author | zautrix <zautrix> | 2004-10-12 20:21:55 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-12 20:21:55 (UTC) |
commit | c38bc76bfec3aae65f3bc22c3e2a6ac0d6b0437d (patch) (unidiff) | |
tree | 786dcfb580c2399d85ab80c0f68b9adc22515db5 | |
parent | 4a3a203c0f95f7d53a784c785004f8c4452c0154 (diff) | |
download | kdepimpi-c38bc76bfec3aae65f3bc22c3e2a6ac0d6b0437d.zip kdepimpi-c38bc76bfec3aae65f3bc22c3e2a6ac0d6b0437d.tar.gz kdepimpi-c38bc76bfec3aae65f3bc22c3e2a6ac0d6b0437d.tar.bz2 |
remoced debug output
-rw-r--r-- | kaddressbook/addresseeeditorwidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp index 4db0a20..012780b 100644 --- a/kaddressbook/addresseeeditorwidget.cpp +++ b/kaddressbook/addresseeeditorwidget.cpp | |||
@@ -881,385 +881,385 @@ void AddresseeEditorWidget::setupTab3() | |||
881 | 881 | ||
882 | ////////////////////////////////////// | 882 | ////////////////////////////////////// |
883 | // Geo | 883 | // Geo |
884 | mGeoWidget = new GeoWidget( tab3 ); | 884 | mGeoWidget = new GeoWidget( tab3 ); |
885 | // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); | 885 | // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); |
886 | connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 886 | connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
887 | layout->addWidget( mGeoWidget, 0, 0 ); | 887 | layout->addWidget( mGeoWidget, 0, 0 ); |
888 | /*US | 888 | /*US |
889 | ////////////////////////////////////// | 889 | ////////////////////////////////////// |
890 | // Sound | 890 | // Sound |
891 | #ifndef KAB_EMBEDDED | 891 | #ifndef KAB_EMBEDDED |
892 | mSoundWidget = new SoundWidget( tab3 ); | 892 | mSoundWidget = new SoundWidget( tab3 ); |
893 | mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); | 893 | mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); |
894 | connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 894 | connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
895 | layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); | 895 | layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); |
896 | #else //KAB_EMBEDDED | 896 | #else //KAB_EMBEDDED |
897 | qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); | 897 | qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); |
898 | #endif //KAB_EMBEDDED | 898 | #endif //KAB_EMBEDDED |
899 | 899 | ||
900 | ////////////////////////////////////// | 900 | ////////////////////////////////////// |
901 | // Images | 901 | // Images |
902 | mImageWidget = new ImageWidget( tab3 ); | 902 | mImageWidget = new ImageWidget( tab3 ); |
903 | mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); | 903 | mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); |
904 | connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 904 | connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
905 | layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop ); | 905 | layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop ); |
906 | */ | 906 | */ |
907 | //US | 907 | //US |
908 | /* | 908 | /* |
909 | KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 ); | 909 | KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 ); |
910 | layout->addMultiCellWidget( bar, 1, 1, 0, 0 ); | 910 | layout->addMultiCellWidget( bar, 1, 1, 0, 0 ); |
911 | */ | 911 | */ |
912 | ////////////////////////////////////// | 912 | ////////////////////////////////////// |
913 | // Keys | 913 | // Keys |
914 | mKeyWidget = new KeyWidget( tab3 ); | 914 | mKeyWidget = new KeyWidget( tab3 ); |
915 | //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); | 915 | //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); |
916 | connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 916 | connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
917 | //US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); | 917 | //US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); |
918 | layout->addWidget( mKeyWidget, 1, 0 ); | 918 | layout->addWidget( mKeyWidget, 1, 0 ); |
919 | 919 | ||
920 | mTabWidget->addTab( tab3, i18n( "&Misc" ) ); | 920 | mTabWidget->addTab( tab3, i18n( "&Misc" ) ); |
921 | } | 921 | } |
922 | 922 | ||
923 | void AddresseeEditorWidget::setupTab3_1() | 923 | void AddresseeEditorWidget::setupTab3_1() |
924 | { | 924 | { |
925 | // This is the Misc tab | 925 | // This is the Misc tab |
926 | QWidget *tab3 = new QWidget( mTabWidget ); | 926 | QWidget *tab3 = new QWidget( mTabWidget ); |
927 | 927 | ||
928 | //US QGridLayout *layout = new QGridLayout( tab3, 2, 3 ); | 928 | //US QGridLayout *layout = new QGridLayout( tab3, 2, 3 ); |
929 | QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); | 929 | QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); |
930 | layout->setMargin( KDialogBase::marginHint() ); | 930 | layout->setMargin( KDialogBase::marginHint() ); |
931 | layout->setSpacing( KDialogBase::spacingHint() ); | 931 | layout->setSpacing( KDialogBase::spacingHint() ); |
932 | //US layout->setColStretch( 2, 1 ); | 932 | //US layout->setColStretch( 2, 1 ); |
933 | 933 | ||
934 | /*US | 934 | /*US |
935 | ////////////////////////////////////// | 935 | ////////////////////////////////////// |
936 | // Geo | 936 | // Geo |
937 | mGeoWidget = new GeoWidget( tab3 ); | 937 | mGeoWidget = new GeoWidget( tab3 ); |
938 | mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); | 938 | mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); |
939 | connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 939 | connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
940 | layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop ); | 940 | layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop ); |
941 | */ | 941 | */ |
942 | ////////////////////////////////////// | 942 | ////////////////////////////////////// |
943 | // Sound | 943 | // Sound |
944 | #ifndef KAB_EMBEDDED | 944 | #ifndef KAB_EMBEDDED |
945 | mSoundWidget = new SoundWidget( tab3 ); | 945 | mSoundWidget = new SoundWidget( tab3 ); |
946 | mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); | 946 | mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); |
947 | connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 947 | connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
948 | layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); | 948 | layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); |
949 | #else //KAB_EMBEDDED | 949 | #else //KAB_EMBEDDED |
950 | //US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); | 950 | //US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); |
951 | #endif //KAB_EMBEDDED | 951 | #endif //KAB_EMBEDDED |
952 | 952 | ||
953 | ////////////////////////////////////// | 953 | ////////////////////////////////////// |
954 | // Images | 954 | // Images |
955 | mImageWidget = new ImageWidget( tab3 ); | 955 | mImageWidget = new ImageWidget( tab3 ); |
956 | mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); | 956 | mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); |
957 | connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 957 | connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
958 | layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop ); | 958 | layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop ); |
959 | /*US | 959 | /*US |
960 | ////////////////////////////////////// | 960 | ////////////////////////////////////// |
961 | // Keys | 961 | // Keys |
962 | mKeyWidget = new KeyWidget( tab3 ); | 962 | mKeyWidget = new KeyWidget( tab3 ); |
963 | mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); | 963 | mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); |
964 | connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); | 964 | connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); |
965 | layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); | 965 | layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); |
966 | */ | 966 | */ |
967 | mTabWidget->addTab( tab3, i18n( "&Images" ) ); | 967 | mTabWidget->addTab( tab3, i18n( "&Images" ) ); |
968 | } | 968 | } |
969 | 969 | ||
970 | 970 | ||
971 | void AddresseeEditorWidget::load() | 971 | void AddresseeEditorWidget::load() |
972 | { | 972 | { |
973 | 973 | ||
974 | // Block signals in case anything tries to emit modified | 974 | // Block signals in case anything tries to emit modified |
975 | // CS: This doesn't seem to work. | 975 | // CS: This doesn't seem to work. |
976 | bool block = signalsBlocked(); | 976 | bool block = signalsBlocked(); |
977 | blockSignals( true ); | 977 | blockSignals( true ); |
978 | mBlockSignals = true; // used for internal signal blocking | 978 | mBlockSignals = true; // used for internal signal blocking |
979 | 979 | ||
980 | mNameEdit->setText( mAddressee.assembledName() ); | 980 | mNameEdit->setText( mAddressee.assembledName() ); |
981 | 981 | ||
982 | if ( mAddressee.formattedName().isEmpty() ) { | 982 | if ( mAddressee.formattedName().isEmpty() ) { |
983 | //US KConfig config( "kaddressbookrc" ); | 983 | //US KConfig config( "kaddressbookrc" ); |
984 | KConfig config( locateLocal("config", "kaddressbookrc") ); | 984 | KConfig config( locateLocal("config", "kaddressbookrc") ); |
985 | config.setGroup( "General" ); | 985 | config.setGroup( "General" ); |
986 | mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 ); | 986 | mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 ); |
987 | mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); | 987 | mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); |
988 | } else { | 988 | } else { |
989 | if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) ) | 989 | if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) ) |
990 | mFormattedNameType = NameEditDialog::SimpleName; | 990 | mFormattedNameType = NameEditDialog::SimpleName; |
991 | else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) ) | 991 | else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) ) |
992 | mFormattedNameType = NameEditDialog::FullName; | 992 | mFormattedNameType = NameEditDialog::FullName; |
993 | else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) ) | 993 | else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) ) |
994 | mFormattedNameType = NameEditDialog::ReverseName; | 994 | mFormattedNameType = NameEditDialog::ReverseName; |
995 | else | 995 | else |
996 | mFormattedNameType = NameEditDialog::CustomName; | 996 | mFormattedNameType = NameEditDialog::CustomName; |
997 | } | 997 | } |
998 | 998 | ||
999 | mFormattedNameLabel->setText( mAddressee.formattedName() ); | 999 | mFormattedNameLabel->setText( mAddressee.formattedName() ); |
1000 | 1000 | ||
1001 | mRoleEdit->setText( mAddressee.role() ); | 1001 | mRoleEdit->setText( mAddressee.role() ); |
1002 | mOrgEdit->setText( mAddressee.organization() ); | 1002 | mOrgEdit->setText( mAddressee.organization() ); |
1003 | 1003 | ||
1004 | //US mURLEdit->setURL( mAddressee.url().url() ); | 1004 | //US mURLEdit->setURL( mAddressee.url().url() ); |
1005 | mURLEdit->setText( mAddressee.url().prettyURL() ); | 1005 | mURLEdit->setText( mAddressee.url().prettyURL() ); |
1006 | //US?? mURLEdit->home( false ); | 1006 | //US?? mURLEdit->home( false ); |
1007 | 1007 | ||
1008 | // mNoteEdit->setText( mAddressee.note() ); | 1008 | // mNoteEdit->setText( mAddressee.note() ); |
1009 | mNoteEdit->setText( mAddressee.note() ); | 1009 | mNoteEdit->setText( mAddressee.note() ); |
1010 | mEmailWidget->setEmails( mAddressee.emails() ); | 1010 | mEmailWidget->setEmails( mAddressee.emails() ); |
1011 | mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() ); | 1011 | mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() ); |
1012 | mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() ); | 1012 | mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() ); |
1013 | mBirthdayPicker->setDate( mAddressee.birthday().date() ); | 1013 | mBirthdayPicker->setDate( mAddressee.birthday().date() ); |
1014 | 1014 | ||
1015 | //US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom( | 1015 | //US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom( |
1016 | //US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) ); | 1016 | //US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) ); |
1017 | QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), | 1017 | QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), |
1018 | "%Y-%m-%d"); // = Qt::ISODate | 1018 | "%Y-%m-%d"); // = Qt::ISODate |
1019 | mAnniversaryPicker->setDate( dt ); | 1019 | mAnniversaryPicker->setDate( dt ); |
1020 | 1020 | ||
1021 | 1021 | ||
1022 | mNicknameEdit->setText( mAddressee.nickName() ); | 1022 | mNicknameEdit->setText( mAddressee.nickName() ); |
1023 | mCategoryEdit->setText( mAddressee.categories().join( "," ) ); | 1023 | mCategoryEdit->setText( mAddressee.categories().join( "," ) ); |
1024 | 1024 | ||
1025 | mGeoWidget->setGeo( mAddressee.geo() ); | 1025 | mGeoWidget->setGeo( mAddressee.geo() ); |
1026 | mImageWidget->setPhoto( mAddressee.photo() ); | 1026 | mImageWidget->setPhoto( mAddressee.photo() ); |
1027 | mImageWidget->setLogo( mAddressee.logo() ); | 1027 | mImageWidget->setLogo( mAddressee.logo() ); |
1028 | mKeyWidget->setKeys( mAddressee.keys() ); | 1028 | mKeyWidget->setKeys( mAddressee.keys() ); |
1029 | mSecrecyWidget->setSecrecy( mAddressee.secrecy() ); | 1029 | mSecrecyWidget->setSecrecy( mAddressee.secrecy() ); |
1030 | #ifndef KAB_EMBEDDED | 1030 | #ifndef KAB_EMBEDDED |
1031 | mSoundWidget->setSound( mAddressee.sound() ); | 1031 | mSoundWidget->setSound( mAddressee.sound() ); |
1032 | #else //KAB_EMBEDDED | 1032 | #else //KAB_EMBEDDED |
1033 | //US qDebug("AddresseeEditorWidget::load has to be changed 2"); | 1033 | //US qDebug("AddresseeEditorWidget::load has to be changed 2"); |
1034 | #endif //KAB_EMBEDDED | 1034 | #endif //KAB_EMBEDDED |
1035 | 1035 | ||
1036 | // Load customs | 1036 | // Load customs |
1037 | mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) ); | 1037 | mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) ); |
1038 | mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) ); | 1038 | mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) ); |
1039 | mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) ); | 1039 | mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) ); |
1040 | mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) ); | 1040 | mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) ); |
1041 | mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); | 1041 | mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); |
1042 | mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); | 1042 | mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); |
1043 | mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); | 1043 | mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); |
1044 | mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); | 1044 | mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); |
1045 | QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); | 1045 | QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); |
1046 | if ( gen == "female" ) | 1046 | if ( gen == "female" ) |
1047 | mGenderBox->setCurrentItem ( 1 ); | 1047 | mGenderBox->setCurrentItem ( 1 ); |
1048 | else if ( gen == "male" ) | 1048 | else if ( gen == "male" ) |
1049 | mGenderBox->setCurrentItem ( 2 ); | 1049 | mGenderBox->setCurrentItem ( 2 ); |
1050 | else | 1050 | else |
1051 | mGenderBox->setCurrentItem ( 0 ); | 1051 | mGenderBox->setCurrentItem ( 0 ); |
1052 | blockSignals( block ); | 1052 | blockSignals( block ); |
1053 | mBlockSignals = false; | 1053 | mBlockSignals = false; |
1054 | 1054 | ||
1055 | mDirty = false; | 1055 | mDirty = false; |
1056 | } | 1056 | } |
1057 | 1057 | ||
1058 | void AddresseeEditorWidget::save() | 1058 | void AddresseeEditorWidget::save() |
1059 | { | 1059 | { |
1060 | if ( !dirty() ) { | 1060 | if ( !dirty() ) { |
1061 | return; | 1061 | return; |
1062 | } | 1062 | } |
1063 | 1063 | ||
1064 | mAddressee.setRole( mRoleEdit->text() ); | 1064 | mAddressee.setRole( mRoleEdit->text() ); |
1065 | mAddressee.setOrganization( mOrgEdit->text() ); | 1065 | mAddressee.setOrganization( mOrgEdit->text() ); |
1066 | mAddressee.setUrl( KURL( mURLEdit->text() ) ); | 1066 | mAddressee.setUrl( KURL( mURLEdit->text() ) ); |
1067 | mAddressee.setNote( mNoteEdit->text() ); | 1067 | mAddressee.setNote( mNoteEdit->text() ); |
1068 | if ( mBirthdayPicker->inputIsValid() ) { | 1068 | if ( mBirthdayPicker->inputIsValid() ) { |
1069 | QDate da = mBirthdayPicker->date(); | 1069 | QDate da = mBirthdayPicker->date(); |
1070 | if ( da > QDate::currentDate() ) | 1070 | if ( da > QDate::currentDate() ) |
1071 | da.setYMD(da.year()-100, da.month(), da.day() ); | 1071 | da.setYMD(da.year()-100, da.month(), da.day() ); |
1072 | mAddressee.setBirthday( QDateTime( da ) ); | 1072 | mAddressee.setBirthday( QDateTime( da ) ); |
1073 | qDebug("bday %s ",da.toString().latin1()); | 1073 | //qDebug("bday %s ",da.toString().latin1()); |
1074 | } | 1074 | } |
1075 | else { | 1075 | else { |
1076 | mAddressee.setBirthday( QDateTime() ); | 1076 | mAddressee.setBirthday( QDateTime() ); |
1077 | mBirthdayPicker->clear(); | 1077 | mBirthdayPicker->clear(); |
1078 | } | 1078 | } |
1079 | mAddressee.setNickName( mNicknameEdit->text() ); | 1079 | mAddressee.setNickName( mNicknameEdit->text() ); |
1080 | mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); | 1080 | mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); |
1081 | 1081 | ||
1082 | mAddressee.setGeo( mGeoWidget->geo() ); | 1082 | mAddressee.setGeo( mGeoWidget->geo() ); |
1083 | mAddressee.setPhoto( mImageWidget->photo() ); | 1083 | mAddressee.setPhoto( mImageWidget->photo() ); |
1084 | mAddressee.setLogo( mImageWidget->logo() ); | 1084 | mAddressee.setLogo( mImageWidget->logo() ); |
1085 | mAddressee.setKeys( mKeyWidget->keys() ); | 1085 | mAddressee.setKeys( mKeyWidget->keys() ); |
1086 | #ifndef KAB_EMBEDDED | 1086 | #ifndef KAB_EMBEDDED |
1087 | mAddressee.setSound( mSoundWidget->sound() ); | 1087 | mAddressee.setSound( mSoundWidget->sound() ); |
1088 | #else //KAB_EMBEDDED | 1088 | #else //KAB_EMBEDDED |
1089 | //US qDebug("AddresseeEditorWidget::save sound not supported"); | 1089 | //US qDebug("AddresseeEditorWidget::save sound not supported"); |
1090 | #endif //KAB_EMBEDDED | 1090 | #endif //KAB_EMBEDDED |
1091 | mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); | 1091 | mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); |
1092 | 1092 | ||
1093 | // save custom fields | 1093 | // save custom fields |
1094 | mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); | 1094 | mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); |
1095 | mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); | 1095 | mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); |
1096 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() ); | 1096 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() ); |
1097 | mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); | 1097 | mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); |
1098 | mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); | 1098 | mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); |
1099 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); | 1099 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); |
1100 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); | 1100 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); |
1101 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); | 1101 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); |
1102 | if ( mAnniversaryPicker->inputIsValid() ) { | 1102 | if ( mAnniversaryPicker->inputIsValid() ) { |
1103 | QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); | 1103 | QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); |
1104 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); | 1104 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); |
1105 | } | 1105 | } |
1106 | else { | 1106 | else { |
1107 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); | 1107 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); |
1108 | mAnniversaryPicker->clear(); | 1108 | mAnniversaryPicker->clear(); |
1109 | } | 1109 | } |
1110 | int gen = mGenderBox->currentItem (); | 1110 | int gen = mGenderBox->currentItem (); |
1111 | if ( gen == 1 ) | 1111 | if ( gen == 1 ) |
1112 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); | 1112 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); |
1113 | else if ( gen == 2 ) | 1113 | else if ( gen == 2 ) |
1114 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); | 1114 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); |
1115 | else | 1115 | else |
1116 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" ); | 1116 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" ); |
1117 | 1117 | ||
1118 | // Save the email addresses | 1118 | // Save the email addresses |
1119 | QStringList emails = mAddressee.emails(); | 1119 | QStringList emails = mAddressee.emails(); |
1120 | QStringList::Iterator iter; | 1120 | QStringList::Iterator iter; |
1121 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) | 1121 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) |
1122 | mAddressee.removeEmail( *iter ); | 1122 | mAddressee.removeEmail( *iter ); |
1123 | 1123 | ||
1124 | emails = mEmailWidget->emails(); | 1124 | emails = mEmailWidget->emails(); |
1125 | bool first = true; | 1125 | bool first = true; |
1126 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) { | 1126 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) { |
1127 | mAddressee.insertEmail( *iter, first ); | 1127 | mAddressee.insertEmail( *iter, first ); |
1128 | first = false; | 1128 | first = false; |
1129 | } | 1129 | } |
1130 | 1130 | ||
1131 | // Save the phone numbers | 1131 | // Save the phone numbers |
1132 | KABC::PhoneNumber::List phoneNumbers; | 1132 | KABC::PhoneNumber::List phoneNumbers; |
1133 | KABC::PhoneNumber::List::Iterator phoneIter; | 1133 | KABC::PhoneNumber::List::Iterator phoneIter; |
1134 | phoneNumbers = mAddressee.phoneNumbers(); | 1134 | phoneNumbers = mAddressee.phoneNumbers(); |
1135 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); | 1135 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); |
1136 | ++phoneIter ) | 1136 | ++phoneIter ) |
1137 | mAddressee.removePhoneNumber( *phoneIter ); | 1137 | mAddressee.removePhoneNumber( *phoneIter ); |
1138 | 1138 | ||
1139 | phoneNumbers = mPhoneEditWidget->phoneNumbers(); | 1139 | phoneNumbers = mPhoneEditWidget->phoneNumbers(); |
1140 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); | 1140 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); |
1141 | ++phoneIter ) | 1141 | ++phoneIter ) |
1142 | mAddressee.insertPhoneNumber( *phoneIter ); | 1142 | mAddressee.insertPhoneNumber( *phoneIter ); |
1143 | 1143 | ||
1144 | // Save the addresses | 1144 | // Save the addresses |
1145 | KABC::Address::List addresses; | 1145 | KABC::Address::List addresses; |
1146 | KABC::Address::List::Iterator addressIter; | 1146 | KABC::Address::List::Iterator addressIter; |
1147 | addresses = mAddressee.addresses(); | 1147 | addresses = mAddressee.addresses(); |
1148 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); | 1148 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); |
1149 | ++addressIter ) | 1149 | ++addressIter ) |
1150 | mAddressee.removeAddress( *addressIter ); | 1150 | mAddressee.removeAddress( *addressIter ); |
1151 | 1151 | ||
1152 | addresses = mAddressEditWidget->addresses(); | 1152 | addresses = mAddressEditWidget->addresses(); |
1153 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); | 1153 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); |
1154 | ++addressIter ) | 1154 | ++addressIter ) |
1155 | mAddressee.insertAddress( *addressIter ); | 1155 | mAddressee.insertAddress( *addressIter ); |
1156 | mDirty = false; | 1156 | mDirty = false; |
1157 | } | 1157 | } |
1158 | 1158 | ||
1159 | bool AddresseeEditorWidget::dirty() | 1159 | bool AddresseeEditorWidget::dirty() |
1160 | { | 1160 | { |
1161 | 1161 | ||
1162 | if ( ! mDirty ) { | 1162 | if ( ! mDirty ) { |
1163 | if ( mBirthdayPicker->inputIsValid() ) { | 1163 | if ( mBirthdayPicker->inputIsValid() ) { |
1164 | QDate da = mBirthdayPicker->date(); | 1164 | QDate da = mBirthdayPicker->date(); |
1165 | if ( !(da == mAddressee.birthday().date())) | 1165 | if ( !(da == mAddressee.birthday().date())) |
1166 | mDirty = true; | 1166 | mDirty = true; |
1167 | } | 1167 | } |
1168 | else { | 1168 | else { |
1169 | mBirthdayPicker->clear(); | 1169 | mBirthdayPicker->clear(); |
1170 | } | 1170 | } |
1171 | if ( mAnniversaryPicker->inputIsValid() ) { | 1171 | if ( mAnniversaryPicker->inputIsValid() ) { |
1172 | QDate da = mAnniversaryPicker->date(); | 1172 | QDate da = mAnniversaryPicker->date(); |
1173 | if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), | 1173 | if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), |
1174 | "%Y-%m-%d")) | 1174 | "%Y-%m-%d")) |
1175 | mDirty = true; | 1175 | mDirty = true; |
1176 | } | 1176 | } |
1177 | else { | 1177 | else { |
1178 | mAnniversaryPicker->clear(); | 1178 | mAnniversaryPicker->clear(); |
1179 | } | 1179 | } |
1180 | } | 1180 | } |
1181 | return mDirty; | 1181 | return mDirty; |
1182 | } | 1182 | } |
1183 | 1183 | ||
1184 | void AddresseeEditorWidget::nameTextChanged( const QString &text ) | 1184 | void AddresseeEditorWidget::nameTextChanged( const QString &text ) |
1185 | { | 1185 | { |
1186 | // use the addressee class to parse the name for us | 1186 | // use the addressee class to parse the name for us |
1187 | mAConfig->setUid( mAddressee.uid() ); | 1187 | mAConfig->setUid( mAddressee.uid() ); |
1188 | if ( mAConfig->automaticNameParsing() ) { | 1188 | if ( mAConfig->automaticNameParsing() ) { |
1189 | if ( !mAddressee.formattedName().isEmpty() ) { | 1189 | if ( !mAddressee.formattedName().isEmpty() ) { |
1190 | QString fn = mAddressee.formattedName(); | 1190 | QString fn = mAddressee.formattedName(); |
1191 | mAddressee.setNameFromString( text ); | 1191 | mAddressee.setNameFromString( text ); |
1192 | mAddressee.setFormattedName( fn ); | 1192 | mAddressee.setFormattedName( fn ); |
1193 | } else { | 1193 | } else { |
1194 | // use extra addressee to avoid a formatted name assignment | 1194 | // use extra addressee to avoid a formatted name assignment |
1195 | Addressee addr; | 1195 | Addressee addr; |
1196 | addr.setNameFromString( text ); | 1196 | addr.setNameFromString( text ); |
1197 | mAddressee.setPrefix( addr.prefix() ); | 1197 | mAddressee.setPrefix( addr.prefix() ); |
1198 | mAddressee.setGivenName( addr.givenName() ); | 1198 | mAddressee.setGivenName( addr.givenName() ); |
1199 | mAddressee.setAdditionalName( addr.additionalName() ); | 1199 | mAddressee.setAdditionalName( addr.additionalName() ); |
1200 | mAddressee.setFamilyName( addr.familyName() ); | 1200 | mAddressee.setFamilyName( addr.familyName() ); |
1201 | mAddressee.setSuffix( addr.suffix() ); | 1201 | mAddressee.setSuffix( addr.suffix() ); |
1202 | } | 1202 | } |
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | nameBoxChanged(); | 1205 | nameBoxChanged(); |
1206 | 1206 | ||
1207 | emitModified(); | 1207 | emitModified(); |
1208 | } | 1208 | } |
1209 | 1209 | ||
1210 | void AddresseeEditorWidget::nameBoxChanged() | 1210 | void AddresseeEditorWidget::nameBoxChanged() |
1211 | { | 1211 | { |
1212 | KABC::Addressee addr; | 1212 | KABC::Addressee addr; |
1213 | mAConfig->setUid( mAddressee.uid() ); | 1213 | mAConfig->setUid( mAddressee.uid() ); |
1214 | if ( mAConfig->automaticNameParsing() ) { | 1214 | if ( mAConfig->automaticNameParsing() ) { |
1215 | addr.setNameFromString( mNameEdit->text() ); | 1215 | addr.setNameFromString( mNameEdit->text() ); |
1216 | mNameLabel->hide(); | 1216 | mNameLabel->hide(); |
1217 | mNameEdit->show(); | 1217 | mNameEdit->show(); |
1218 | } else { | 1218 | } else { |
1219 | addr = mAddressee; | 1219 | addr = mAddressee; |
1220 | mNameEdit->hide(); | 1220 | mNameEdit->hide(); |
1221 | mNameLabel->setText( mNameEdit->text() ); | 1221 | mNameLabel->setText( mNameEdit->text() ); |
1222 | mNameLabel->show(); | 1222 | mNameLabel->show(); |
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | if ( mFormattedNameType != NameEditDialog::CustomName ) { | 1225 | if ( mFormattedNameType != NameEditDialog::CustomName ) { |
1226 | mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); | 1226 | mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); |
1227 | mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); | 1227 | mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); |
1228 | } | 1228 | } |
1229 | } | 1229 | } |
1230 | 1230 | ||
1231 | void AddresseeEditorWidget::nameButtonClicked() | 1231 | void AddresseeEditorWidget::nameButtonClicked() |
1232 | { | 1232 | { |
1233 | // show the name dialog. | 1233 | // show the name dialog. |
1234 | NameEditDialog dialog( mAddressee, mFormattedNameType, this ); | 1234 | NameEditDialog dialog( mAddressee, mFormattedNameType, this ); |
1235 | 1235 | ||
1236 | if ( KApplication::execDialog( &dialog) ) { | 1236 | if ( KApplication::execDialog( &dialog) ) { |
1237 | if ( dialog.changed() ) { | 1237 | if ( dialog.changed() ) { |
1238 | mAddressee.setFamilyName( dialog.familyName() ); | 1238 | mAddressee.setFamilyName( dialog.familyName() ); |
1239 | mAddressee.setGivenName( dialog.givenName() ); | 1239 | mAddressee.setGivenName( dialog.givenName() ); |
1240 | mAddressee.setPrefix( dialog.prefix() ); | 1240 | mAddressee.setPrefix( dialog.prefix() ); |
1241 | mAddressee.setSuffix( dialog.suffix() ); | 1241 | mAddressee.setSuffix( dialog.suffix() ); |
1242 | mAddressee.setAdditionalName( dialog.additionalName() ); | 1242 | mAddressee.setAdditionalName( dialog.additionalName() ); |
1243 | mFormattedNameType = dialog.formattedNameType(); | 1243 | mFormattedNameType = dialog.formattedNameType(); |
1244 | if ( mFormattedNameType == NameEditDialog::CustomName ) { | 1244 | if ( mFormattedNameType == NameEditDialog::CustomName ) { |
1245 | mFormattedNameLabel->setText( dialog.customFormattedName() ); | 1245 | mFormattedNameLabel->setText( dialog.customFormattedName() ); |
1246 | mAddressee.setFormattedName( dialog.customFormattedName() ); | 1246 | mAddressee.setFormattedName( dialog.customFormattedName() ); |
1247 | } | 1247 | } |
1248 | // Update the name edit. | 1248 | // Update the name edit. |
1249 | bool block = mNameEdit->signalsBlocked(); | 1249 | bool block = mNameEdit->signalsBlocked(); |
1250 | mNameEdit->blockSignals( true ); | 1250 | mNameEdit->blockSignals( true ); |
1251 | mNameEdit->setText( mAddressee.assembledName() ); | 1251 | mNameEdit->setText( mAddressee.assembledName() ); |
1252 | mNameEdit->blockSignals( block ); | 1252 | mNameEdit->blockSignals( block ); |
1253 | 1253 | ||
1254 | // Update the combo box. | 1254 | // Update the combo box. |
1255 | nameBoxChanged(); | 1255 | nameBoxChanged(); |
1256 | 1256 | ||
1257 | emitModified(); | 1257 | emitModified(); |
1258 | } | 1258 | } |
1259 | } | 1259 | } |
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | void AddresseeEditorWidget::categoryButtonClicked() | 1262 | void AddresseeEditorWidget::categoryButtonClicked() |
1263 | { | 1263 | { |
1264 | // Show the category dialog | 1264 | // Show the category dialog |
1265 | if ( mCategoryDialog == 0 ) { | 1265 | if ( mCategoryDialog == 0 ) { |