summaryrefslogtreecommitdiffabout
path: root/kabc
authorzautrix <zautrix>2005-10-28 11:31:59 (UTC)
committer zautrix <zautrix>2005-10-28 11:31:59 (UTC)
commitb27cb619bb9005ad4345d38bbee3b1c3d0eda1b2 (patch) (unidiff)
treea7ac6002208ddedcd9dc13cd0e91294519883007 /kabc
parent5ceebb8563f134c789e9082d1bc49723beb28c8c (diff)
downloadkdepimpi-b27cb619bb9005ad4345d38bbee3b1c3d0eda1b2.zip
kdepimpi-b27cb619bb9005ad4345d38bbee3b1c3d0eda1b2.tar.gz
kdepimpi-b27cb619bb9005ad4345d38bbee3b1c3d0eda1b2.tar.bz2
commit
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp4
-rw-r--r--kabc/addresseeview.cpp2
2 files changed, 4 insertions, 2 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 19c78ee..789a694 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -870,407 +870,407 @@ QString Addressee::givenName() const
870 870
871QString Addressee::givenNameLabel() 871QString Addressee::givenNameLabel()
872{ 872{
873 return i18n("Given Name"); 873 return i18n("Given Name");
874} 874}
875 875
876 876
877void Addressee::setAdditionalName( const QString &additionalName ) 877void Addressee::setAdditionalName( const QString &additionalName )
878{ 878{
879 if ( additionalName == mData->additionalName ) return; 879 if ( additionalName == mData->additionalName ) return;
880 detach(); 880 detach();
881 mData->empty = false; 881 mData->empty = false;
882 mData->additionalName = additionalName; 882 mData->additionalName = additionalName;
883} 883}
884 884
885QString Addressee::additionalName() const 885QString Addressee::additionalName() const
886{ 886{
887 return mData->additionalName; 887 return mData->additionalName;
888} 888}
889 889
890QString Addressee::additionalNameLabel() 890QString Addressee::additionalNameLabel()
891{ 891{
892 return i18n("Additional Names"); 892 return i18n("Additional Names");
893} 893}
894 894
895 895
896void Addressee::setPrefix( const QString &prefix ) 896void Addressee::setPrefix( const QString &prefix )
897{ 897{
898 if ( prefix == mData->prefix ) return; 898 if ( prefix == mData->prefix ) return;
899 detach(); 899 detach();
900 mData->empty = false; 900 mData->empty = false;
901 mData->prefix = prefix; 901 mData->prefix = prefix;
902} 902}
903 903
904QString Addressee::prefix() const 904QString Addressee::prefix() const
905{ 905{
906 return mData->prefix; 906 return mData->prefix;
907} 907}
908 908
909QString Addressee::prefixLabel() 909QString Addressee::prefixLabel()
910{ 910{
911 return i18n("Honorific Prefixes"); 911 return i18n("Honorific Prefixes");
912} 912}
913 913
914 914
915void Addressee::setSuffix( const QString &suffix ) 915void Addressee::setSuffix( const QString &suffix )
916{ 916{
917 if ( suffix == mData->suffix ) return; 917 if ( suffix == mData->suffix ) return;
918 detach(); 918 detach();
919 mData->empty = false; 919 mData->empty = false;
920 mData->suffix = suffix; 920 mData->suffix = suffix;
921} 921}
922 922
923QString Addressee::suffix() const 923QString Addressee::suffix() const
924{ 924{
925 return mData->suffix; 925 return mData->suffix;
926} 926}
927 927
928QString Addressee::suffixLabel() 928QString Addressee::suffixLabel()
929{ 929{
930 return i18n("Honorific Suffixes"); 930 return i18n("Honorific Suffixes");
931} 931}
932 932
933 933
934void Addressee::setNickName( const QString &nickName ) 934void Addressee::setNickName( const QString &nickName )
935{ 935{
936 if ( nickName == mData->nickName ) return; 936 if ( nickName == mData->nickName ) return;
937 detach(); 937 detach();
938 mData->empty = false; 938 mData->empty = false;
939 mData->nickName = nickName; 939 mData->nickName = nickName;
940} 940}
941 941
942QString Addressee::nickName() const 942QString Addressee::nickName() const
943{ 943{
944 return mData->nickName; 944 return mData->nickName;
945} 945}
946 946
947QString Addressee::nickNameLabel() 947QString Addressee::nickNameLabel()
948{ 948{
949 return i18n("Nick Name"); 949 return i18n("Nick Name");
950} 950}
951 951
952 952
953void Addressee::setBirthday( const QDateTime &birthday ) 953void Addressee::setBirthday( const QDateTime &birthday )
954{ 954{
955 if ( birthday == mData->birthday ) return; 955 if ( birthday == mData->birthday ) return;
956 detach(); 956 detach();
957 mData->empty = false; 957 mData->empty = false;
958 mData->birthday = birthday; 958 mData->birthday = birthday;
959} 959}
960 960
961QDateTime Addressee::birthday() const 961QDateTime Addressee::birthday() const
962{ 962{
963 return mData->birthday; 963 return mData->birthday;
964} 964}
965 965
966QString Addressee::birthdayLabel() 966QString Addressee::birthdayLabel()
967{ 967{
968 return i18n("Birthday"); 968 return i18n("Birthday");
969} 969}
970 970
971 971
972QString Addressee::homeAddressStreetLabel() 972QString Addressee::homeAddressStreetLabel()
973{ 973{
974 return i18n("Home Address Street"); 974 return i18n("Home Address Street");
975} 975}
976 976
977 977
978QString Addressee::homeAddressLocalityLabel() 978QString Addressee::homeAddressLocalityLabel()
979{ 979{
980 return i18n("Home Address Locality"); 980 return i18n("Home Address Locality");
981} 981}
982 982
983 983
984QString Addressee::homeAddressRegionLabel() 984QString Addressee::homeAddressRegionLabel()
985{ 985{
986 return i18n("Home Address Region"); 986 return i18n("Home Address Region");
987} 987}
988 988
989 989
990QString Addressee::homeAddressPostalCodeLabel() 990QString Addressee::homeAddressPostalCodeLabel()
991{ 991{
992 return i18n("Home Address Postal Code"); 992 return i18n("Home Address Postal Code");
993} 993}
994 994
995 995
996QString Addressee::homeAddressCountryLabel() 996QString Addressee::homeAddressCountryLabel()
997{ 997{
998 return i18n("Home Address Country"); 998 return i18n("Home Address Country");
999} 999}
1000 1000
1001 1001
1002QString Addressee::homeAddressLabelLabel() 1002QString Addressee::homeAddressLabelLabel()
1003{ 1003{
1004 return i18n("Home Address Label"); 1004 return i18n("Home Address Label");
1005} 1005}
1006 1006
1007 1007
1008QString Addressee::businessAddressStreetLabel() 1008QString Addressee::businessAddressStreetLabel()
1009{ 1009{
1010 return i18n("Business Address Street"); 1010 return i18n("Business Address Street");
1011} 1011}
1012 1012
1013 1013
1014QString Addressee::businessAddressLocalityLabel() 1014QString Addressee::businessAddressLocalityLabel()
1015{ 1015{
1016 return i18n("Business Address Locality"); 1016 return i18n("Business Address Locality");
1017} 1017}
1018 1018
1019 1019
1020QString Addressee::businessAddressRegionLabel() 1020QString Addressee::businessAddressRegionLabel()
1021{ 1021{
1022 return i18n("Business Address Region"); 1022 return i18n("Business Address Region");
1023} 1023}
1024 1024
1025 1025
1026QString Addressee::businessAddressPostalCodeLabel() 1026QString Addressee::businessAddressPostalCodeLabel()
1027{ 1027{
1028 return i18n("Business Address Postal Code"); 1028 return i18n("Business Address Postal Code");
1029} 1029}
1030 1030
1031 1031
1032QString Addressee::businessAddressCountryLabel() 1032QString Addressee::businessAddressCountryLabel()
1033{ 1033{
1034 return i18n("Business Address Country"); 1034 return i18n("Business Address Country");
1035} 1035}
1036 1036
1037 1037
1038QString Addressee::businessAddressLabelLabel() 1038QString Addressee::businessAddressLabelLabel()
1039{ 1039{
1040 return i18n("Business Address Label"); 1040 return i18n("Business Address Label");
1041} 1041}
1042 1042
1043 1043
1044QString Addressee::homePhoneLabel() 1044QString Addressee::homePhoneLabel()
1045{ 1045{
1046 return i18n("Home Phone"); 1046 return i18n("Home Phone");
1047} 1047}
1048 1048
1049 1049
1050QString Addressee::businessPhoneLabel() 1050QString Addressee::businessPhoneLabel()
1051{ 1051{
1052 return i18n("Work Phone"); 1052 return i18n("Work Phone");
1053} 1053}
1054 1054
1055 1055
1056QString Addressee::mobilePhoneLabel() 1056QString Addressee::mobilePhoneLabel()
1057{ 1057{
1058 return i18n("Mobile Phone"); 1058 return i18n("Mobile Phone");
1059} 1059}
1060QString Addressee::mobileWorkPhoneLabel() 1060QString Addressee::mobileWorkPhoneLabel()
1061{ 1061{
1062 return i18n("Mobile2 (work)"); 1062 return i18n("Mobile2 (Work)");
1063} 1063}
1064QString Addressee::mobileHomePhoneLabel() 1064QString Addressee::mobileHomePhoneLabel()
1065{ 1065{
1066 return i18n("Mobile (Home)"); 1066 return i18n("Mobile (Home)");
1067} 1067}
1068 1068
1069 1069
1070QString Addressee::homeFaxLabel() 1070QString Addressee::homeFaxLabel()
1071{ 1071{
1072 return i18n("Fax (Home)"); 1072 return i18n("Fax (Home)");
1073} 1073}
1074 1074
1075 1075
1076QString Addressee::businessFaxLabel() 1076QString Addressee::businessFaxLabel()
1077{ 1077{
1078 return i18n("Fax (Work)"); 1078 return i18n("Fax (Work)");
1079} 1079}
1080 1080
1081 1081
1082QString Addressee::carPhoneLabel() 1082QString Addressee::carPhoneLabel()
1083{ 1083{
1084 return i18n("Mobile2 (car)"); 1084 return i18n("Mobile2 (Car)");
1085} 1085}
1086 1086
1087 1087
1088QString Addressee::isdnLabel() 1088QString Addressee::isdnLabel()
1089{ 1089{
1090 return i18n("ISDN"); 1090 return i18n("ISDN");
1091} 1091}
1092 1092
1093 1093
1094QString Addressee::pagerLabel() 1094QString Addressee::pagerLabel()
1095{ 1095{
1096 return i18n("Pager"); 1096 return i18n("Pager");
1097} 1097}
1098 1098
1099QString Addressee::sipLabel() 1099QString Addressee::sipLabel()
1100{ 1100{
1101 return i18n("SIP"); 1101 return i18n("SIP");
1102} 1102}
1103 1103
1104QString Addressee::emailLabel() 1104QString Addressee::emailLabel()
1105{ 1105{
1106 return i18n("Email Address"); 1106 return i18n("Email Address");
1107} 1107}
1108 1108
1109 1109
1110void Addressee::setMailer( const QString &mailer ) 1110void Addressee::setMailer( const QString &mailer )
1111{ 1111{
1112 if ( mailer == mData->mailer ) return; 1112 if ( mailer == mData->mailer ) return;
1113 detach(); 1113 detach();
1114 mData->empty = false; 1114 mData->empty = false;
1115 mData->mailer = mailer; 1115 mData->mailer = mailer;
1116} 1116}
1117 1117
1118QString Addressee::mailer() const 1118QString Addressee::mailer() const
1119{ 1119{
1120 return mData->mailer; 1120 return mData->mailer;
1121} 1121}
1122 1122
1123QString Addressee::mailerLabel() 1123QString Addressee::mailerLabel()
1124{ 1124{
1125 return i18n("Mail Client"); 1125 return i18n("Mail Client");
1126} 1126}
1127 1127
1128 1128
1129void Addressee::setTimeZone( const TimeZone &timeZone ) 1129void Addressee::setTimeZone( const TimeZone &timeZone )
1130{ 1130{
1131 if ( timeZone == mData->timeZone ) return; 1131 if ( timeZone == mData->timeZone ) return;
1132 detach(); 1132 detach();
1133 mData->empty = false; 1133 mData->empty = false;
1134 mData->timeZone = timeZone; 1134 mData->timeZone = timeZone;
1135} 1135}
1136 1136
1137TimeZone Addressee::timeZone() const 1137TimeZone Addressee::timeZone() const
1138{ 1138{
1139 return mData->timeZone; 1139 return mData->timeZone;
1140} 1140}
1141 1141
1142QString Addressee::timeZoneLabel() 1142QString Addressee::timeZoneLabel()
1143{ 1143{
1144 return i18n("Time Zone"); 1144 return i18n("Time Zone");
1145} 1145}
1146 1146
1147 1147
1148void Addressee::setGeo( const Geo &geo ) 1148void Addressee::setGeo( const Geo &geo )
1149{ 1149{
1150 if ( geo == mData->geo ) return; 1150 if ( geo == mData->geo ) return;
1151 detach(); 1151 detach();
1152 mData->empty = false; 1152 mData->empty = false;
1153 mData->geo = geo; 1153 mData->geo = geo;
1154} 1154}
1155 1155
1156Geo Addressee::geo() const 1156Geo Addressee::geo() const
1157{ 1157{
1158 return mData->geo; 1158 return mData->geo;
1159} 1159}
1160 1160
1161QString Addressee::geoLabel() 1161QString Addressee::geoLabel()
1162{ 1162{
1163 return i18n("Geographic Position"); 1163 return i18n("Geographic Position");
1164} 1164}
1165 1165
1166 1166
1167void Addressee::setTitle( const QString &title ) 1167void Addressee::setTitle( const QString &title )
1168{ 1168{
1169 if ( title == mData->title ) return; 1169 if ( title == mData->title ) return;
1170 detach(); 1170 detach();
1171 mData->empty = false; 1171 mData->empty = false;
1172 mData->title = title; 1172 mData->title = title;
1173} 1173}
1174 1174
1175QString Addressee::title() const 1175QString Addressee::title() const
1176{ 1176{
1177 return mData->title; 1177 return mData->title;
1178} 1178}
1179 1179
1180QString Addressee::titleLabel() 1180QString Addressee::titleLabel()
1181{ 1181{
1182 return i18n("Title"); 1182 return i18n("Title");
1183} 1183}
1184 1184
1185 1185
1186void Addressee::setRole( const QString &role ) 1186void Addressee::setRole( const QString &role )
1187{ 1187{
1188 if ( role == mData->role ) return; 1188 if ( role == mData->role ) return;
1189 detach(); 1189 detach();
1190 mData->empty = false; 1190 mData->empty = false;
1191 mData->role = role; 1191 mData->role = role;
1192} 1192}
1193 1193
1194QString Addressee::role() const 1194QString Addressee::role() const
1195{ 1195{
1196 return mData->role; 1196 return mData->role;
1197} 1197}
1198 1198
1199QString Addressee::roleLabel() 1199QString Addressee::roleLabel()
1200{ 1200{
1201 return i18n("Role"); 1201 return i18n("Role");
1202} 1202}
1203 1203
1204 1204
1205void Addressee::setOrganization( const QString &organization ) 1205void Addressee::setOrganization( const QString &organization )
1206{ 1206{
1207 if ( organization == mData->organization ) return; 1207 if ( organization == mData->organization ) return;
1208 detach(); 1208 detach();
1209 mData->empty = false; 1209 mData->empty = false;
1210 mData->organization = organization; 1210 mData->organization = organization;
1211} 1211}
1212 1212
1213QString Addressee::organization() const 1213QString Addressee::organization() const
1214{ 1214{
1215 return mData->organization; 1215 return mData->organization;
1216} 1216}
1217 1217
1218QString Addressee::organizationLabel() 1218QString Addressee::organizationLabel()
1219{ 1219{
1220 return i18n("Organization"); 1220 return i18n("Organization");
1221} 1221}
1222 1222
1223 1223
1224void Addressee::setNote( const QString &note ) 1224void Addressee::setNote( const QString &note )
1225{ 1225{
1226 if ( note == mData->note ) return; 1226 if ( note == mData->note ) return;
1227 detach(); 1227 detach();
1228 mData->empty = false; 1228 mData->empty = false;
1229 mData->note = note; 1229 mData->note = note;
1230} 1230}
1231 1231
1232QString Addressee::note() const 1232QString Addressee::note() const
1233{ 1233{
1234 return mData->note; 1234 return mData->note;
1235} 1235}
1236 1236
1237QString Addressee::noteLabel() 1237QString Addressee::noteLabel()
1238{ 1238{
1239 return i18n("Note"); 1239 return i18n("Note");
1240} 1240}
1241 1241
1242 1242
1243void Addressee::setProductId( const QString &productId ) 1243void Addressee::setProductId( const QString &productId )
1244{ 1244{
1245 if ( productId == mData->productId ) return; 1245 if ( productId == mData->productId ) return;
1246 detach(); 1246 detach();
1247 mData->empty = false; 1247 mData->empty = false;
1248 mData->productId = productId; 1248 mData->productId = productId;
1249} 1249}
1250 1250
1251QString Addressee::productId() const 1251QString Addressee::productId() const
1252{ 1252{
1253 return mData->productId; 1253 return mData->productId;
1254} 1254}
1255 1255
1256QString Addressee::productIdLabel() 1256QString Addressee::productIdLabel()
1257{ 1257{
1258 return i18n("Product Identifier"); 1258 return i18n("Product Identifier");
1259} 1259}
1260 1260
1261 1261
1262void Addressee::setRevision( const QDateTime &revision ) 1262void Addressee::setRevision( const QDateTime &revision )
1263{ 1263{
1264 if ( revision == mData->revision ) return; 1264 if ( revision == mData->revision ) return;
1265 detach(); 1265 detach();
1266 mData->empty = false; 1266 mData->empty = false;
1267 mData->revision = QDateTime( revision.date(), 1267 mData->revision = QDateTime( revision.date(),
1268 QTime (revision.time().hour(), 1268 QTime (revision.time().hour(),
1269 revision.time().minute(), 1269 revision.time().minute(),
1270 revision.time().second())); 1270 revision.time().second()));
1271} 1271}
1272 1272
1273QDateTime Addressee::revision() const 1273QDateTime Addressee::revision() const
1274{ 1274{
1275 return mData->revision; 1275 return mData->revision;
1276} 1276}
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index 05d604f..aae923c 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -395,316 +395,318 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
395 bool picAvailUrl = false; 395 bool picAvailUrl = false;
396 if (! picture.undefined() ) { 396 if (! picture.undefined() ) {
397 picAvailintern = (picture.isIntern() && !picture.data().isNull()); 397 picAvailintern = (picture.isIntern() && !picture.data().isNull());
398 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); 398 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() );
399 } 399 }
400 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { 400 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) {
401 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; 401 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">";
402 if ( picAvailintern ) { 402 if ( picAvailintern ) {
403 QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); 403 QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() );
404 int wid = picture.data().width(); 404 int wid = picture.data().width();
405 int hei = picture.data().height(); 405 int hei = picture.data().height();
406 if ( wid > 128 || hei > 128 ) { 406 if ( wid > 128 || hei > 128 ) {
407 if ( wid > hei ) { 407 if ( wid > hei ) {
408 hei = (hei*128)/wid; 408 hei = (hei*128)/wid;
409 wid = 128; 409 wid = 128;
410 } else { 410 } else {
411 wid = (wid*128)/hei; 411 wid = (wid*128)/hei;
412 hei = 128; 412 hei = 128;
413 } 413 }
414 } 414 }
415 picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei); 415 picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei);
416 } else { 416 } else {
417 if ( picAvailUrl ) { 417 if ( picAvailUrl ) {
418 QPixmap picPix( picture.url() ); 418 QPixmap picPix( picture.url() );
419 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix ); 419 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix );
420 int wid = picPix.width(); 420 int wid = picPix.width();
421 int hei = picPix.height(); 421 int hei = picPix.height();
422 if ( wid > 128 || hei > 128 ) { 422 if ( wid > 128 || hei > 128 ) {
423 if ( wid > hei ) { 423 if ( wid > hei ) {
424 hei = (hei*128)/wid; 424 hei = (hei*128)/wid;
425 wid = 128; 425 wid = 128;
426 } else { 426 } else {
427 wid = (wid*128)/hei; 427 wid = (wid*128)/hei;
428 hei = 128; 428 hei = 128;
429 } 429 }
430 } 430 }
431 picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei); 431 picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei);
432 } else { 432 } else {
433 if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) { 433 if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) {
434 static bool setDefaultImageChildren = false; 434 static bool setDefaultImageChildren = false;
435 if ( !setDefaultImageChildren ) { 435 if ( !setDefaultImageChildren ) {
436 QMimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) ); 436 QMimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) );
437 setDefaultImageChildren = true; 437 setDefaultImageChildren = true;
438 } 438 }
439 picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">"; 439 picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">";
440 440
441 } else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) { 441 } else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) {
442 static bool setDefaultImagepouses = false; 442 static bool setDefaultImagepouses = false;
443 if ( !setDefaultImagepouses ) { 443 if ( !setDefaultImagepouses ) {
444 QMimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) ); 444 QMimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) );
445 setDefaultImagepouses = true; 445 setDefaultImagepouses = true;
446 } 446 }
447 picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">"; 447 picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">";
448 } else { 448 } else {
449 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); 449 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
450 if ( gen == "male" ) { 450 if ( gen == "male" ) {
451 static bool setDefaultImageMale = false; 451 static bool setDefaultImageMale = false;
452 if ( !setDefaultImageMale ) { 452 if ( !setDefaultImageMale ) {
453 QMimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) ); 453 QMimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) );
454 setDefaultImageMale = true; 454 setDefaultImageMale = true;
455 } 455 }
456 picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">"; 456 picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">";
457 457
458 } else if ( gen == "female" ) { 458 } else if ( gen == "female" ) {
459 static bool setDefaultImageFemale = false; 459 static bool setDefaultImageFemale = false;
460 if ( !setDefaultImageFemale ) { 460 if ( !setDefaultImageFemale ) {
461 QMimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) ); 461 QMimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) );
462 setDefaultImageFemale = true; 462 setDefaultImageFemale = true;
463 } 463 }
464 picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">"; 464 picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">";
465 465
466 } else { 466 } else {
467 static bool setDefaultImage = false; 467 static bool setDefaultImage = false;
468 if ( !setDefaultImage ) { 468 if ( !setDefaultImage ) {
469 //qDebug("Setting default pixmap "); 469 //qDebug("Setting default pixmap ");
470 QMimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) ); 470 QMimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) );
471 setDefaultImage = true; 471 setDefaultImage = true;
472 } 472 }
473 picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">"; 473 picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">";
474 } 474 }
475 } 475 }
476 } 476 }
477 } 477 }
478 mText = QString::fromLatin1( 478 mText = QString::fromLatin1(
479 "<html>" 479 "<html>"
480 "<body text=\"%1\" bgcolor=\"%2\">" // text and background color 480 "<body text=\"%1\" bgcolor=\"%2\">" // text and background color
481 "<table>" 481 "<table>"
482 "<tr>" 482 "<tr>"
483 "<td rowspan=\"3\" align=\"right\" valign=\"top\">" 483 "<td rowspan=\"3\" align=\"right\" valign=\"top\">"
484 "%3" 484 "%3"
485 "</td>" 485 "</td>"
486 "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name 486 "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name
487 "</tr>" 487 "</tr>"
488 "%5" // role 488 "%5" // role
489 "%6" // organization 489 "%6" // organization
490 "<td colspan=\"2\">&nbsp;</td>" 490 "<td colspan=\"2\">&nbsp;</td>"
491 "%7" // dynamic part 491 "%7" // dynamic part
492 "%8" // notes 492 "%8" // notes
493 "</table>" 493 "</table>"
494 "</body>" 494 "</body>"
495 "</html>") 495 "</html>")
496//US 496//US
497 .arg( /*KGlobalSettings::textColor().name()*/ "black" ) 497 .arg( /*KGlobalSettings::textColor().name()*/ "black" )
498//US 498//US
499 .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) 499 .arg( /*KGlobalSettings::baseColor().name()*/ "white" )
500 .arg( picString ) 500 .arg( picString )
501 .arg( name ) 501 .arg( name )
502 .arg( aRole ) 502 .arg( aRole )
503 .arg( aOrga ) 503 .arg( aOrga )
504 .arg( dynamicPart ) 504 .arg( dynamicPart )
505 .arg( notes ); 505 .arg( notes );
506 506
507 } else { // no picture! 507 } else { // no picture!
508 508
509mText = "<table width=\"100%\">\n"; 509mText = "<table width=\"100%\">\n";
510 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 510 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
511#ifdef DESKTOP_VERSION 511#ifdef DESKTOP_VERSION
512 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; 512 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>";
513 mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>"; 513 mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>";
514#else 514#else
515 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>"; 515 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>";
516 mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>"; 516 mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>";
517#endif 517#endif
518 518
519 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; 519 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
520 520
521 mText += "<table><td colspan=\"2\">&nbsp;</td>"; 521 mText += "<table><td colspan=\"2\">&nbsp;</td>";
522 /* 522 /*
523 mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" 523 mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>"
524 "<td align=\"left\"><b>%2</b></td></tr>" ) 524 "<td align=\"left\"><b>%2</b></td></tr>" )
525 .arg( i18n(" ") ) 525 .arg( i18n(" ") )
526 .arg( name ); 526 .arg( name );
527 */ 527 */
528 if ( ! mAddressee.role().isEmpty() ) 528 if ( ! mAddressee.role().isEmpty() )
529 mText += QString("<tr><td align=\"right\"><b>%1</b></td>" 529 mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
530 "<td align=\"left\">%2</td></tr>" ) 530 "<td align=\"left\">%2</td></tr>" )
531 .arg( i18n(" ") ) 531 .arg( i18n(" ") )
532 .arg( mAddressee.role()); 532 .arg( mAddressee.role());
533 if ( ! mAddressee.organization().isEmpty() ) 533 if ( ! mAddressee.organization().isEmpty() )
534 mText += QString("<tr><td align=\"right\"><b>%1</b></td>" 534 mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
535 "<td align=\"left\">%2</td></tr>" ) 535 "<td align=\"left\">%2</td></tr>" )
536 .arg( i18n(" ") ) 536 .arg( i18n(" ") )
537 .arg( mAddressee.organization()); 537 .arg( mAddressee.organization());
538 mText += dynamicPart; 538 mText += dynamicPart;
539 mText += notes; 539 mText += notes;
540 mText += "</table>"; 540 mText += "</table>";
541 541
542 } 542 }
543 543
544 // at last display it... 544 // at last display it...
545 setText( mText ); 545 setText( mText );
546 546
547} 547}
548 548
549QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones ,bool preferred ) 549QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones ,bool preferred )
550{ 550{
551 ExternalAppHandler* eah = ExternalAppHandler::instance(); 551 ExternalAppHandler* eah = ExternalAppHandler::instance();
552 bool kphoneAvail = eah->isPhoneAppAvailable(); 552 bool kphoneAvail = eah->isPhoneAppAvailable();
553 bool kfaxAvail = eah->isFaxAppAvailable(); 553 bool kfaxAvail = eah->isFaxAppAvailable();
554 bool ksmsAvail = eah->isSMSAppAvailable(); 554 bool ksmsAvail = eah->isSMSAppAvailable();
555 bool kpagerAvail = eah->isPagerAppAvailable(); 555 bool kpagerAvail = eah->isPagerAppAvailable();
556 bool ksipAvail = eah->isSIPAppAvailable(); 556 bool ksipAvail = eah->isSIPAppAvailable();
557 QString dynamicPart; 557 QString dynamicPart;
558 KABC::PhoneNumber::List::ConstIterator phoneIt; 558 KABC::PhoneNumber::List::ConstIterator phoneIt;
559 QString extension; 559 QString extension;
560 int phonetype; 560 int phonetype;
561 QString sms; 561 QString sms;
562 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { 562 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) {
563 phonetype = (*phoneIt).type(); 563 phonetype = (*phoneIt).type();
564 if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) 564 if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred )
565 continue; 565 continue;
566 if (ksmsAvail && 566 if (ksmsAvail &&
567 ( 567 (
568 ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || 568 ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) ||
569 ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) 569 ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell)
570 ) 570 )
571 ) 571 )
572 { 572 {
573 sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) 573 sms = QString("<a href=\"smsto:%1 \">(sms)</a>" )
574 .arg( (*phoneIt).number() ); 574 .arg( (*phoneIt).number() );
575 575
576 } 576 }
577 else 577 else
578 sms = ""; 578 sms = "";
579 579
580 extension = QString::null; 580 extension = QString::null;
581 if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { 581 if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) {
582 if (kfaxAvail) extension = "faxto:"; 582 if (kfaxAvail) extension = "faxto:";
583 } 583 }
584 else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { 584 else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) {
585 if (kpagerAvail) extension = "pagerto:"; 585 if (kpagerAvail) extension = "pagerto:";
586 } 586 }
587#if 0
587 else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { 588 else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) {
588 if (ksipAvail) extension = "sipto:"; 589 if (ksipAvail) extension = "sipto:";
589 } 590 }
591#endif
590 else if (kphoneAvail) { 592 else if (kphoneAvail) {
591 extension = "phoneto:"; 593 extension = "phoneto:";
592 } 594 }
593 else 595 else
594 extension = QString::null; 596 extension = QString::null;
595 597
596 if ( !extension.isEmpty() ) { 598 if ( !extension.isEmpty() ) {
597 dynamicPart += QString( 599 dynamicPart += QString(
598 "<tr><td align=\"right\"><b>%1</b></td>" 600 "<tr><td align=\"right\"><b>%1</b></td>"
599 "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) 601 "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" )
600 .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) 602 .arg( KABC::PhoneNumber::typeLabel( phonetype ) )
601 .arg( extension ) 603 .arg( extension )
602 .arg( (*phoneIt).number() ) 604 .arg( (*phoneIt).number() )
603 .arg( (*phoneIt).number() ) 605 .arg( (*phoneIt).number() )
604 .arg( sms ); 606 .arg( sms );
605 607
606 } else { 608 } else {
607 dynamicPart += QString( 609 dynamicPart += QString(
608 "<tr><td align=\"right\"><b>%1</b></td>" 610 "<tr><td align=\"right\"><b>%1</b></td>"
609 "<td align=\"left\">%2 %3</td></tr>" ) 611 "<td align=\"left\">%2 %3</td></tr>" )
610 .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) 612 .arg( KABC::PhoneNumber::typeLabel( phonetype ) )
611 .arg( (*phoneIt).number() ) 613 .arg( (*phoneIt).number() )
612 .arg( sms ); 614 .arg( sms );
613 } 615 }
614 } 616 }
615 return dynamicPart; 617 return dynamicPart;
616} 618}
617/* 619/*
618KABC::Addressee AddresseeView::addressee() const 620KABC::Addressee AddresseeView::addressee() const
619{ 621{
620 return mAddressee; 622 return mAddressee;
621} 623}
622*/ 624*/
623void AddresseeView::addTag(const QString & tag,const QString & text) 625void AddresseeView::addTag(const QString & tag,const QString & text)
624{ 626{
625 if ( text.isEmpty() ) 627 if ( text.isEmpty() )
626 return; 628 return;
627 int number=text.contains("\n"); 629 int number=text.contains("\n");
628 QString str = "<" + tag + ">"; 630 QString str = "<" + tag + ">";
629 QString tmpText=text; 631 QString tmpText=text;
630 QString tmpStr=str; 632 QString tmpStr=str;
631 if(number !=-1) 633 if(number !=-1)
632 { 634 {
633 if (number > 0) { 635 if (number > 0) {
634 int pos=0; 636 int pos=0;
635 QString tmp; 637 QString tmp;
636 for(int i=0;i<=number;i++) { 638 for(int i=0;i<=number;i++) {
637 pos=tmpText.find("\n"); 639 pos=tmpText.find("\n");
638 tmp=tmpText.left(pos); 640 tmp=tmpText.left(pos);
639 tmpText=tmpText.right(tmpText.length()-pos-1); 641 tmpText=tmpText.right(tmpText.length()-pos-1);
640 tmpStr+=tmp+"<br>"; 642 tmpStr+=tmp+"<br>";
641 } 643 }
642 } 644 }
643 else tmpStr += tmpText; 645 else tmpStr += tmpText;
644 tmpStr+="</" + tag + ">"; 646 tmpStr+="</" + tag + ">";
645 mText.append(tmpStr); 647 mText.append(tmpStr);
646 } 648 }
647 else 649 else
648 { 650 {
649 str += text + "</" + tag + ">"; 651 str += text + "</" + tag + ">";
650 mText.append(str); 652 mText.append(str);
651 } 653 }
652} 654}
653 655
654AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name, 656AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name,
655 true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false) 657 true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false)
656{ 658{
657 findButton( Close )->setText( i18n("Cancel Sync")); 659 findButton( Close )->setText( i18n("Cancel Sync"));
658 findButton( Ok )->setText( i18n("Remote")); 660 findButton( Ok )->setText( i18n("Remote"));
659 findButton( User1 )->setText( i18n("Local")); 661 findButton( User1 )->setText( i18n("Local"));
660 QWidget* topframe = new QWidget( this ); 662 QWidget* topframe = new QWidget( this );
661 setMainWidget( topframe ); 663 setMainWidget( topframe );
662 QBoxLayout* bl; 664 QBoxLayout* bl;
663 if ( QApplication::desktop()->width() < 640 ) { 665 if ( QApplication::desktop()->width() < 640 ) {
664 bl = new QVBoxLayout( topframe ); 666 bl = new QVBoxLayout( topframe );
665 } else { 667 } else {
666 bl = new QHBoxLayout( topframe ); 668 bl = new QHBoxLayout( topframe );
667 } 669 }
668 QVBox* subframe = new QVBox( topframe ); 670 QVBox* subframe = new QVBox( topframe );
669 bl->addWidget(subframe ); 671 bl->addWidget(subframe );
670 QLabel* lab = new QLabel( i18n("Local Addressee"), subframe ); 672 QLabel* lab = new QLabel( i18n("Local Addressee"), subframe );
671 if ( takeloc ) 673 if ( takeloc )
672 lab->setBackgroundColor(Qt::green.light() ); 674 lab->setBackgroundColor(Qt::green.light() );
673 AddresseeView * av = new AddresseeView( subframe ); 675 AddresseeView * av = new AddresseeView( subframe );
674 av->setAddressee( loc ); 676 av->setAddressee( loc );
675 subframe = new QVBox( topframe ); 677 subframe = new QVBox( topframe );
676 bl->addWidget(subframe ); 678 bl->addWidget(subframe );
677 lab = new QLabel( i18n("Remote Addressee"), subframe ); 679 lab = new QLabel( i18n("Remote Addressee"), subframe );
678 if ( !takeloc ) 680 if ( !takeloc )
679 lab->setBackgroundColor(Qt::green.light() ); 681 lab->setBackgroundColor(Qt::green.light() );
680 av = new AddresseeView( subframe ); 682 av = new AddresseeView( subframe );
681 av->setAddressee( rem ); 683 av->setAddressee( rem );
682 QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); 684 QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote()));
683 QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); 685 QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local()));
684#ifndef DESKTOP_VERSION 686#ifndef DESKTOP_VERSION
685 showMaximized(); 687 showMaximized();
686#else 688#else
687 resize ( 640, 400 ); 689 resize ( 640, 400 );
688#endif 690#endif
689} 691}
690 692
691int AddresseeChooser::executeD( bool local ) 693int AddresseeChooser::executeD( bool local )
692{ 694{
693 mSyncResult = 3; 695 mSyncResult = 3;
694 if ( local ) 696 if ( local )
695 findButton( User1 )->setFocus(); 697 findButton( User1 )->setFocus();
696 else 698 else
697 findButton( Ok )->setFocus(); 699 findButton( Ok )->setFocus();
698 exec(); 700 exec();
699 return mSyncResult; 701 return mSyncResult;
700} 702}
701void AddresseeChooser::slot_remote() 703void AddresseeChooser::slot_remote()
702{ 704{
703 mSyncResult = 2; 705 mSyncResult = 2;
704 accept(); 706 accept();
705} 707}
706void AddresseeChooser::slot_local() 708void AddresseeChooser::slot_local()
707{ 709{
708 mSyncResult = 1; 710 mSyncResult = 1;
709 accept(); 711 accept();
710} 712}