-rw-r--r-- | bin/kdepim/WhatsNew.txt | 5 | ||||
-rw-r--r-- | kaddressbook/addresseeeditorwidget.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/extensionmanager.cpp | 7 | ||||
-rw-r--r-- | kaddressbook/filter.cpp | 21 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 87 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 3 | ||||
-rw-r--r-- | kaddressbook/kabprefs.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/addresseewidget.cpp | 11 | ||||
-rw-r--r-- | kaddressbook/nameeditdialog.cpp | 8 |
9 files changed, 118 insertions, 32 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index ff87423..5be1d28 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,79 +1,84 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 1.9.17 ************ | 3 | ********** VERSION 1.9.17 ************ |
4 | 4 | ||
5 | KO/Pi: | 5 | KO/Pi: |
6 | Fixed that tooltips were not updated after moving an item in agenda view. | 6 | Fixed that tooltips were not updated after moving an item in agenda view. |
7 | Fixed a bug in sorting start date for recurring events in list view. | 7 | Fixed a bug in sorting start date for recurring events in list view. |
8 | 8 | ||
9 | KA/Pi: | 9 | KA/Pi: |
10 | All fields search does now actually search all the (possible) fields, | 10 | All fields search does now actually search all the (possible) fields, |
11 | not only those listed in the contact list. | 11 | not only those listed in the contact list. |
12 | Made is possible to inline a picture in a vcard on the Z. | 12 | Made is possible to inline a picture in a vcard on the Z. |
13 | This was only possible on the desktop, now is it possible on the Z as well. | 13 | This was only possible on the desktop, now is it possible on the Z as well. |
14 | Fixed of missing save settings after filter configuration. | 14 | Fixed of missing save settings after filter configuration. |
15 | Made saving of addressbook much faster. | 15 | Made saving of addressbook much faster. |
16 | Fixed extension widget layout problem. | ||
17 | Fixed saving of default formatted name settings. | ||
18 | Fixed formatted name handling in edit dialog. | ||
19 | Added an option for changing formatted names of many contacts | ||
20 | (menu: File - Change - Set formatted name). | ||
16 | 21 | ||
17 | QWhatsThis was not working on the Z ( only black rectangle was shown). | 22 | QWhatsThis was not working on the Z ( only black rectangle was shown). |
18 | This is Fixed. | 23 | This is Fixed. |
19 | 24 | ||
20 | KDE-Sync: | 25 | KDE-Sync: |
21 | Now readonly KDE resources are synced as well. | 26 | Now readonly KDE resources are synced as well. |
22 | (They are not changed in KDE itself, of course). | 27 | (They are not changed in KDE itself, of course). |
23 | 28 | ||
24 | 29 | ||
25 | 30 | ||
26 | ********** VERSION 1.9.16 ************ | 31 | ********** VERSION 1.9.16 ************ |
27 | 32 | ||
28 | KO/Pi: | 33 | KO/Pi: |
29 | Fixed search dialog size on Z 6000 (480x640 display). | 34 | Fixed search dialog size on Z 6000 (480x640 display). |
30 | Added setting to hide/show time in agenda items. | 35 | Added setting to hide/show time in agenda items. |
31 | Added setting to hide not running todos in todo view. | 36 | Added setting to hide not running todos in todo view. |
32 | Added columns for start date/time in todo view. | 37 | Added columns for start date/time in todo view. |
33 | Replaced the solid half-hour lines in agenda view by dot lines. | 38 | Replaced the solid half-hour lines in agenda view by dot lines. |
34 | Added possibility of printing the What's Next View on the desktop | 39 | Added possibility of printing the What's Next View on the desktop |
35 | (i.e. Windows and Linux). | 40 | (i.e. Windows and Linux). |
36 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. | 41 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. |
37 | Added tooltips in month view.(Tooltips only available on desktop) | 42 | Added tooltips in month view.(Tooltips only available on desktop) |
38 | 43 | ||
39 | Fixed a strange problem in KO/Pi alarm applet. | 44 | Fixed a strange problem in KO/Pi alarm applet. |
40 | Did not find the actual problem, | 45 | Did not find the actual problem, |
41 | such that now Qtopia reboots again if deinstalling the alarm applet. | 46 | such that now Qtopia reboots again if deinstalling the alarm applet. |
42 | But the alarm applet should work again. | 47 | But the alarm applet should work again. |
43 | 48 | ||
44 | KA/Pi: | 49 | KA/Pi: |
45 | Fixed the problem, that internal pictures were not saved. | 50 | Fixed the problem, that internal pictures were not saved. |
46 | 51 | ||
47 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. | 52 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. |
48 | 53 | ||
49 | Fixed some minor problems. (Like word wrap in help text windows). | 54 | Fixed some minor problems. (Like word wrap in help text windows). |
50 | 55 | ||
51 | Fixed a compiling problem in microkde/kresources. | 56 | Fixed a compiling problem in microkde/kresources. |
52 | 57 | ||
53 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. | 58 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. |
54 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) | 59 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) |
55 | such that now syncing KO/Pi with Sharp DTM should work on the | 60 | such that now syncing KO/Pi with Sharp DTM should work on the |
56 | Zaurus C 3000 model. | 61 | Zaurus C 3000 model. |
57 | 62 | ||
58 | ********** VERSION 1.9.15 ************ | 63 | ********** VERSION 1.9.15 ************ |
59 | 64 | ||
60 | Usebilty enhancements in KO/Pi: | 65 | Usebilty enhancements in KO/Pi: |
61 | When clicking on the date in a month view cell, the day view is shown. | 66 | When clicking on the date in a month view cell, the day view is shown. |
62 | Old behaviour was, that the "new event" dialog popped up. | 67 | Old behaviour was, that the "new event" dialog popped up. |
63 | 68 | ||
64 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). | 69 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). |
65 | That means, you can restore the latest | 70 | That means, you can restore the latest |
66 | event/todo/journal you have deleted. | 71 | event/todo/journal you have deleted. |
67 | A journal is deleted, if you clear all the text of the journal. | 72 | A journal is deleted, if you clear all the text of the journal. |
68 | 73 | ||
69 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. | 74 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. |
70 | 75 | ||
71 | KA/Pi starting in 480x640 resolution: | 76 | KA/Pi starting in 480x640 resolution: |
72 | Hide the filter action in toolbar | 77 | Hide the filter action in toolbar |
73 | and added icons for undo/delete/redo in toolbar. | 78 | and added icons for undo/delete/redo in toolbar. |
74 | 79 | ||
75 | Change in OM/Pi ViewMail dialog: | 80 | Change in OM/Pi ViewMail dialog: |
76 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. | 81 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. |
77 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). | 82 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). |
78 | 83 | ||
79 | Fixed a crash when deleting mail-accounts in OM/Pi. | 84 | Fixed a crash when deleting mail-accounts in OM/Pi. |
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp index 3397e06..c6993e9 100644 --- a/kaddressbook/addresseeeditorwidget.cpp +++ b/kaddressbook/addresseeeditorwidget.cpp | |||
@@ -920,133 +920,133 @@ qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be | |||
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", "kabcrc") ); |
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 ); |
@@ -1124,128 +1124,130 @@ void AddresseeEditorWidget::save() | |||
1124 | mAddressee.removeEmail( *iter ); | 1124 | mAddressee.removeEmail( *iter ); |
1125 | 1125 | ||
1126 | emails = mEmailWidget->emails(); | 1126 | emails = mEmailWidget->emails(); |
1127 | bool first = true; | 1127 | bool first = true; |
1128 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) { | 1128 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) { |
1129 | mAddressee.insertEmail( *iter, first ); | 1129 | mAddressee.insertEmail( *iter, first ); |
1130 | first = false; | 1130 | first = false; |
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | // Save the phone numbers | 1133 | // Save the phone numbers |
1134 | KABC::PhoneNumber::List phoneNumbers; | 1134 | KABC::PhoneNumber::List phoneNumbers; |
1135 | KABC::PhoneNumber::List::Iterator phoneIter; | 1135 | KABC::PhoneNumber::List::Iterator phoneIter; |
1136 | phoneNumbers = mAddressee.phoneNumbers(); | 1136 | phoneNumbers = mAddressee.phoneNumbers(); |
1137 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); | 1137 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); |
1138 | ++phoneIter ) | 1138 | ++phoneIter ) |
1139 | mAddressee.removePhoneNumber( *phoneIter ); | 1139 | mAddressee.removePhoneNumber( *phoneIter ); |
1140 | 1140 | ||
1141 | phoneNumbers = mPhoneEditWidget->phoneNumbers(); | 1141 | phoneNumbers = mPhoneEditWidget->phoneNumbers(); |
1142 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); | 1142 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); |
1143 | ++phoneIter ) | 1143 | ++phoneIter ) |
1144 | mAddressee.insertPhoneNumber( *phoneIter ); | 1144 | mAddressee.insertPhoneNumber( *phoneIter ); |
1145 | 1145 | ||
1146 | // Save the addresses | 1146 | // Save the addresses |
1147 | KABC::Address::List addresses; | 1147 | KABC::Address::List addresses; |
1148 | KABC::Address::List::Iterator addressIter; | 1148 | KABC::Address::List::Iterator addressIter; |
1149 | addresses = mAddressee.addresses(); | 1149 | addresses = mAddressee.addresses(); |
1150 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); | 1150 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); |
1151 | ++addressIter ) | 1151 | ++addressIter ) |
1152 | mAddressee.removeAddress( *addressIter ); | 1152 | mAddressee.removeAddress( *addressIter ); |
1153 | 1153 | ||
1154 | addresses = mAddressEditWidget->addresses(); | 1154 | addresses = mAddressEditWidget->addresses(); |
1155 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); | 1155 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); |
1156 | ++addressIter ) | 1156 | ++addressIter ) |
1157 | mAddressee.insertAddress( *addressIter ); | 1157 | mAddressee.insertAddress( *addressIter ); |
1158 | mDirty = false; | 1158 | mDirty = false; |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | bool AddresseeEditorWidget::dirty() | 1161 | bool AddresseeEditorWidget::dirty() |
1162 | { | 1162 | { |
1163 | 1163 | ||
1164 | if ( ! mDirty ) { | 1164 | if ( ! mDirty ) { |
1165 | if ( mBirthdayPicker->inputIsValid() ) { | 1165 | if ( mBirthdayPicker->inputIsValid() ) { |
1166 | QDate da = mBirthdayPicker->date(); | 1166 | QDate da = mBirthdayPicker->date(); |
1167 | if ( !(da == mAddressee.birthday().date())) | 1167 | if ( !(da == mAddressee.birthday().date())) |
1168 | mDirty = true; | 1168 | mDirty = true; |
1169 | } | 1169 | } |
1170 | else { | 1170 | else { |
1171 | mBirthdayPicker->clear(); | 1171 | mBirthdayPicker->clear(); |
1172 | } | 1172 | } |
1173 | if ( mAnniversaryPicker->inputIsValid() ) { | 1173 | if ( mAnniversaryPicker->inputIsValid() ) { |
1174 | QDate da = mAnniversaryPicker->date(); | 1174 | QDate da = mAnniversaryPicker->date(); |
1175 | if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), | 1175 | if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), |
1176 | "%Y-%m-%d")) | 1176 | "%Y-%m-%d")) |
1177 | mDirty = true; | 1177 | mDirty = true; |
1178 | } | 1178 | } |
1179 | else { | 1179 | else { |
1180 | mAnniversaryPicker->clear(); | 1180 | mAnniversaryPicker->clear(); |
1181 | } | 1181 | } |
1182 | } | 1182 | } |
1183 | return mDirty; | 1183 | return mDirty; |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | void AddresseeEditorWidget::nameTextChanged( const QString &text ) | 1186 | void AddresseeEditorWidget::nameTextChanged( const QString &text ) |
1187 | { | 1187 | { |
1188 | if ( mBlockSignals ) | ||
1189 | return; | ||
1188 | // use the addressee class to parse the name for us | 1190 | // use the addressee class to parse the name for us |
1189 | mAConfig->setUid( mAddressee.uid() ); | 1191 | mAConfig->setUid( mAddressee.uid() ); |
1190 | if ( mAConfig->automaticNameParsing() ) { | 1192 | if ( mAConfig->automaticNameParsing() ) { |
1191 | if ( !mAddressee.formattedName().isEmpty() ) { | 1193 | if ( !mAddressee.formattedName().isEmpty() ) { |
1192 | QString fn = mAddressee.formattedName(); | 1194 | QString fn = mAddressee.formattedName(); |
1193 | mAddressee.setNameFromString( text ); | 1195 | mAddressee.setNameFromString( text ); |
1194 | mAddressee.setFormattedName( fn ); | 1196 | mAddressee.setFormattedName( fn ); |
1195 | } else { | 1197 | } else { |
1196 | // use extra addressee to avoid a formatted name assignment | 1198 | // use extra addressee to avoid a formatted name assignment |
1197 | Addressee addr; | 1199 | Addressee addr; |
1198 | addr.setNameFromString( text ); | 1200 | addr.setNameFromString( text ); |
1199 | mAddressee.setPrefix( addr.prefix() ); | 1201 | mAddressee.setPrefix( addr.prefix() ); |
1200 | mAddressee.setGivenName( addr.givenName() ); | 1202 | mAddressee.setGivenName( addr.givenName() ); |
1201 | mAddressee.setAdditionalName( addr.additionalName() ); | 1203 | mAddressee.setAdditionalName( addr.additionalName() ); |
1202 | mAddressee.setFamilyName( addr.familyName() ); | 1204 | mAddressee.setFamilyName( addr.familyName() ); |
1203 | mAddressee.setSuffix( addr.suffix() ); | 1205 | mAddressee.setSuffix( addr.suffix() ); |
1204 | } | 1206 | } |
1205 | } | 1207 | } |
1206 | 1208 | ||
1207 | nameBoxChanged(); | 1209 | nameBoxChanged(); |
1208 | 1210 | ||
1209 | emitModified(); | 1211 | emitModified(); |
1210 | } | 1212 | } |
1211 | 1213 | ||
1212 | void AddresseeEditorWidget::nameBoxChanged() | 1214 | void AddresseeEditorWidget::nameBoxChanged() |
1213 | { | 1215 | { |
1214 | KABC::Addressee addr; | 1216 | KABC::Addressee addr; |
1215 | mAConfig->setUid( mAddressee.uid() ); | 1217 | mAConfig->setUid( mAddressee.uid() ); |
1216 | if ( mAConfig->automaticNameParsing() ) { | 1218 | if ( mAConfig->automaticNameParsing() ) { |
1217 | addr.setNameFromString( mNameEdit->text() ); | 1219 | addr.setNameFromString( mNameEdit->text() ); |
1218 | mNameLabel->hide(); | 1220 | mNameLabel->hide(); |
1219 | mNameEdit->show(); | 1221 | mNameEdit->show(); |
1220 | } else { | 1222 | } else { |
1221 | addr = mAddressee; | 1223 | addr = mAddressee; |
1222 | mNameEdit->hide(); | 1224 | mNameEdit->hide(); |
1223 | mNameLabel->setText( mNameEdit->text() ); | 1225 | mNameLabel->setText( mNameEdit->text() ); |
1224 | mNameLabel->show(); | 1226 | mNameLabel->show(); |
1225 | } | 1227 | } |
1226 | 1228 | ||
1227 | if ( mFormattedNameType != NameEditDialog::CustomName ) { | 1229 | if ( mFormattedNameType != NameEditDialog::CustomName ) { |
1228 | mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); | 1230 | mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); |
1229 | mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); | 1231 | mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); |
1230 | } | 1232 | } |
1231 | } | 1233 | } |
1232 | 1234 | ||
1233 | void AddresseeEditorWidget::nameButtonClicked() | 1235 | void AddresseeEditorWidget::nameButtonClicked() |
1234 | { | 1236 | { |
1235 | // show the name dialog. | 1237 | // show the name dialog. |
1236 | NameEditDialog dialog( mAddressee, mFormattedNameType, this ); | 1238 | NameEditDialog dialog( mAddressee, mFormattedNameType, this ); |
1237 | 1239 | ||
1238 | if ( KApplication::execDialog( &dialog) ) { | 1240 | if ( KApplication::execDialog( &dialog) ) { |
1239 | if ( dialog.changed() ) { | 1241 | if ( dialog.changed() ) { |
1240 | mAddressee.setFamilyName( dialog.familyName() ); | 1242 | mAddressee.setFamilyName( dialog.familyName() ); |
1241 | mAddressee.setGivenName( dialog.givenName() ); | 1243 | mAddressee.setGivenName( dialog.givenName() ); |
1242 | mAddressee.setPrefix( dialog.prefix() ); | 1244 | mAddressee.setPrefix( dialog.prefix() ); |
1243 | mAddressee.setSuffix( dialog.suffix() ); | 1245 | mAddressee.setSuffix( dialog.suffix() ); |
1244 | mAddressee.setAdditionalName( dialog.additionalName() ); | 1246 | mAddressee.setAdditionalName( dialog.additionalName() ); |
1245 | mFormattedNameType = dialog.formattedNameType(); | 1247 | mFormattedNameType = dialog.formattedNameType(); |
1246 | if ( mFormattedNameType == NameEditDialog::CustomName ) { | 1248 | if ( mFormattedNameType == NameEditDialog::CustomName ) { |
1247 | mFormattedNameLabel->setText( dialog.customFormattedName() ); | 1249 | mFormattedNameLabel->setText( dialog.customFormattedName() ); |
1248 | mAddressee.setFormattedName( dialog.customFormattedName() ); | 1250 | mAddressee.setFormattedName( dialog.customFormattedName() ); |
1249 | } | 1251 | } |
1250 | // Update the name edit. | 1252 | // Update the name edit. |
1251 | bool block = mNameEdit->signalsBlocked(); | 1253 | bool block = mNameEdit->signalsBlocked(); |
diff --git a/kaddressbook/extensionmanager.cpp b/kaddressbook/extensionmanager.cpp index 98561dc..efbdf17 100644 --- a/kaddressbook/extensionmanager.cpp +++ b/kaddressbook/extensionmanager.cpp | |||
@@ -1,248 +1,249 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #include <qlayout.h> | 23 | #include <qlayout.h> |
24 | #include <qapplication.h> | 24 | #include <qapplication.h> |
25 | #include <kactionclasses.h> | 25 | #include <kactionclasses.h> |
26 | #include <kconfig.h> | 26 | #include <kconfig.h> |
27 | #include <kdebug.h> | 27 | #include <kdebug.h> |
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | 29 | ||
30 | #ifndef KAB_EMBEDDED | 30 | #ifndef KAB_EMBEDDED |
31 | #include <ktrader.h> | 31 | #include <ktrader.h> |
32 | #else //KAB_EMBEDDED | 32 | #else //KAB_EMBEDDED |
33 | #include <features/mergewidget.h> | 33 | #include <features/mergewidget.h> |
34 | #include <features/distributionlistwidget.h> | 34 | #include <features/distributionlistwidget.h> |
35 | #endif //KAB_EMBEDDED | 35 | #endif //KAB_EMBEDDED |
36 | 36 | ||
37 | #include "addresseeeditorwidget.h" | 37 | #include "addresseeeditorwidget.h" |
38 | #include "kabcore.h" | 38 | #include "kabcore.h" |
39 | #include "kabprefs.h" | 39 | #include "kabprefs.h" |
40 | 40 | ||
41 | #include "extensionmanager.h" | 41 | #include "extensionmanager.h" |
42 | 42 | ||
43 | ExtensionManager::ExtensionManager( KABCore *core, QWidget *parent, | 43 | ExtensionManager::ExtensionManager( KABCore *core, QWidget *parent, |
44 | const char *name ) | 44 | const char *name ) |
45 | : QScrollView( parent, name ), mCore( core ), mCurrentExtensionWidget( 0 ) | 45 | : QScrollView( parent, name ), mCore( core ), mCurrentExtensionWidget( 0 ) |
46 | { | 46 | { |
47 | #ifdef KAB_EMBEDDED | 47 | #ifdef KAB_EMBEDDED |
48 | //US QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); | 48 | //US QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); |
49 | QWidget *settingsmenu = (QWidget*)mCore->getSettingsMenu(); | 49 | QWidget *settingsmenu = (QWidget*)mCore->getSettingsMenu(); |
50 | #endif //KAB_EMBEDDED | 50 | #endif //KAB_EMBEDDED |
51 | 51 | ||
52 | mActionExtensions = new KSelectAction( i18n( "Show Extension Bar" ), 0, | 52 | mActionExtensions = new KSelectAction( i18n( "Show Extension Bar" ), 0, |
53 | mCore->actionCollection(), | 53 | mCore->actionCollection(), |
54 | "options_show_extensions" ); | 54 | "options_show_extensions" ); |
55 | 55 | ||
56 | mActionExtensions->plug( settingsmenu ); | 56 | mActionExtensions->plug( settingsmenu ); |
57 | 57 | ||
58 | connect( mActionExtensions, SIGNAL( activated( int ) ), | 58 | connect( mActionExtensions, SIGNAL( activated( int ) ), |
59 | SLOT( setActiveExtension( int ) ) ); | 59 | SLOT( setActiveExtension( int ) ) ); |
60 | mWidgetBox = new QWidget( viewport() ); | 60 | mWidgetBox = new QWidget( viewport() ); |
61 | new QHBoxLayout (mWidgetBox ); | ||
61 | addChild( mWidgetBox ); | 62 | addChild( mWidgetBox ); |
62 | setResizePolicy(AutoOneFit); | 63 | setResizePolicy(AutoOneFit); |
63 | createExtensionWidgets(); | 64 | createExtensionWidgets(); |
64 | hide(); | 65 | hide(); |
65 | } | 66 | } |
66 | 67 | ||
67 | ExtensionManager::~ExtensionManager() | 68 | ExtensionManager::~ExtensionManager() |
68 | { | 69 | { |
69 | } | 70 | } |
70 | 71 | ||
71 | void ExtensionManager::restoreSettings() | 72 | void ExtensionManager::restoreSettings() |
72 | { | 73 | { |
73 | mActionExtensions->setCurrentItem( KABPrefs::instance()->mCurrentExtension ); | 74 | mActionExtensions->setCurrentItem( KABPrefs::instance()->mCurrentExtension ); |
74 | int i = 1; | 75 | int i = 1; |
75 | mCurrentExtensionWidget = mExtensionWidgetList.at( i-1 ); | 76 | mCurrentExtensionWidget = mExtensionWidgetList.at( i-1 ); |
76 | while ( mCurrentExtensionWidget ) { | 77 | while ( mCurrentExtensionWidget ) { |
77 | if( i != KABPrefs::instance()->mCurrentExtension ) | 78 | if( i != KABPrefs::instance()->mCurrentExtension ) |
78 | mCurrentExtensionWidget->hide(); | 79 | mCurrentExtensionWidget->hide(); |
79 | mCurrentExtensionWidget = mExtensionWidgetList.at( ++i-1 ); | 80 | mCurrentExtensionWidget = mExtensionWidgetList.at( ++i-1 ); |
80 | 81 | ||
81 | } | 82 | } |
82 | setActiveExtension( mActionExtensions->currentItem() ); | 83 | setActiveExtension( mActionExtensions->currentItem() ); |
83 | } | 84 | } |
84 | 85 | ||
85 | void ExtensionManager::saveSettings() | 86 | void ExtensionManager::saveSettings() |
86 | { | 87 | { |
87 | KABPrefs::instance()->mCurrentExtension = mActionExtensions->currentItem(); | 88 | KABPrefs::instance()->mCurrentExtension = mActionExtensions->currentItem(); |
88 | } | 89 | } |
89 | 90 | ||
90 | void ExtensionManager::reconfigure() | 91 | void ExtensionManager::reconfigure() |
91 | { | 92 | { |
92 | saveSettings(); | 93 | saveSettings(); |
93 | createExtensionWidgets(); | 94 | createExtensionWidgets(); |
94 | restoreSettings(); | 95 | restoreSettings(); |
95 | } | 96 | } |
96 | 97 | ||
97 | bool ExtensionManager::isQuickEditVisible() const | 98 | bool ExtensionManager::isQuickEditVisible() const |
98 | { | 99 | { |
99 | return ( mCurrentExtensionWidget && | 100 | return ( mCurrentExtensionWidget && |
100 | mCurrentExtensionWidget->identifier() == "contact_editor" ); | 101 | mCurrentExtensionWidget->identifier() == "contact_editor" ); |
101 | } | 102 | } |
102 | 103 | ||
103 | void ExtensionManager::setSelectionChanged() | 104 | void ExtensionManager::setSelectionChanged() |
104 | { | 105 | { |
105 | if ( mCurrentExtensionWidget ) | 106 | if ( mCurrentExtensionWidget ) |
106 | mCurrentExtensionWidget->contactsSelectionChanged(); | 107 | mCurrentExtensionWidget->contactsSelectionChanged(); |
107 | } | 108 | } |
108 | 109 | ||
109 | void ExtensionManager::setActiveExtension( int id ) | 110 | void ExtensionManager::setActiveExtension( int id ) |
110 | { | 111 | { |
111 | //qDebug("+++++++++++++++++++ExtensionManager::setActiveExtension %d ", id); | 112 | //qDebug("+++++++++++++++++++ExtensionManager::setActiveExtension %d ", id); |
112 | if ( id == 0 ) { | 113 | if ( id == 0 ) { |
113 | hide(); | 114 | hide(); |
114 | mCurrentExtensionWidget = 0; | 115 | mCurrentExtensionWidget = 0; |
115 | #ifndef DESKTOP_VERSION | 116 | #ifndef DESKTOP_VERSION |
116 | //US our screen is so small, that we better hide the detailscreen, just in case. | 117 | //US our screen is so small, that we better hide the detailscreen, just in case. |
117 | //US mCore->setDetailsToState( ); | 118 | //US mCore->setDetailsToState( ); |
118 | #endif //KAB_EMBEDDED | 119 | #endif //KAB_EMBEDDED |
119 | } else if ( id > 0 ) { | 120 | } else if ( id > 0 ) { |
120 | if ( mCurrentExtensionWidget ) | 121 | if ( mCurrentExtensionWidget ) |
121 | mCurrentExtensionWidget->hide(); | 122 | mCurrentExtensionWidget->hide(); |
122 | 123 | ||
123 | mCurrentExtensionWidget = mExtensionWidgetList.at( id - 1 ); | 124 | mCurrentExtensionWidget = mExtensionWidgetList.at( id - 1 ); |
124 | 125 | ||
125 | if ( mCurrentExtensionWidget ) { | 126 | if ( mCurrentExtensionWidget ) { |
126 | #ifndef DESKTOP_VERSION | 127 | #ifndef DESKTOP_VERSION |
127 | //US our screen is so small, that we better hide the detailscreen, just in case. | 128 | //US our screen is so small, that we better hide the detailscreen, just in case. |
128 | //US mCore->setDetailsVisible( false ); | 129 | //US mCore->setDetailsVisible( false ); |
129 | #endif //KAB_EMBEDDED | 130 | #endif //KAB_EMBEDDED |
130 | show(); | 131 | show(); |
131 | mWidgetBox->show(); | 132 | mWidgetBox->show(); |
132 | mCurrentExtensionWidget->show(); | 133 | mCurrentExtensionWidget->show(); |
133 | } else { | 134 | } else { |
134 | hide(); | 135 | hide(); |
135 | mCurrentExtensionWidget = 0; | 136 | mCurrentExtensionWidget = 0; |
136 | #ifndef DESKTOP_VERSION | 137 | #ifndef DESKTOP_VERSION |
137 | //US our screen is so small, that we better hide the detailscreen, just in case. | 138 | //US our screen is so small, that we better hide the detailscreen, just in case. |
138 | //US mCore->setDetailsToState( ); | 139 | //US mCore->setDetailsToState( ); |
139 | #endif //KAB_EMBEDDED | 140 | #endif //KAB_EMBEDDED |
140 | } | 141 | } |
141 | } | 142 | } |
142 | 143 | ||
143 | emit changedActiveExtension( id ); | 144 | emit changedActiveExtension( id ); |
144 | } | 145 | } |
145 | 146 | ||
146 | void ExtensionManager::createExtensionWidgets() | 147 | void ExtensionManager::createExtensionWidgets() |
147 | { | 148 | { |
148 | // clear extension widget list | 149 | // clear extension widget list |
149 | mExtensionWidgetList.setAutoDelete( true ); | 150 | mExtensionWidgetList.setAutoDelete( true ); |
150 | QPtrListIterator<ExtensionWidget> wdgIt( mExtensionWidgetList ); | 151 | QPtrListIterator<ExtensionWidget> wdgIt( mExtensionWidgetList ); |
151 | ExtensionWidget *wdg = 0; | 152 | ExtensionWidget *wdg = 0; |
152 | while ( ( wdg = wdgIt.current() ) != 0 ) | 153 | while ( ( wdg = wdgIt.current() ) != 0 ) |
153 | mExtensionWidgetList.remove( wdg ); | 154 | mExtensionWidgetList.remove( wdg ); |
154 | 155 | ||
155 | mExtensionWidgetList.setAutoDelete( false ); | 156 | mExtensionWidgetList.setAutoDelete( false ); |
156 | 157 | ||
157 | QStringList extensionNames( i18n( "None" ) ); | 158 | QStringList extensionNames( i18n( "None" ) ); |
158 | 159 | ||
159 | // add addressee editor as default | 160 | // add addressee editor as default |
160 | 161 | ||
161 | QHBoxLayout *hbl = new QHBoxLayout (mWidgetBox ); | 162 | QHBoxLayout *hbl = (QHBoxLayout *) mWidgetBox->layout();; |
162 | 163 | ||
163 | wdg = new AddresseeEditorWidget( mCore, true, mWidgetBox ); | 164 | wdg = new AddresseeEditorWidget( mCore, true, mWidgetBox ); |
164 | hbl->addWidget( wdg ); | 165 | hbl->addWidget( wdg ); |
165 | //wdg->hide(); | 166 | //wdg->hide(); |
166 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), | 167 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), |
167 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); | 168 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); |
168 | mExtensionWidgetList.append( wdg ); | 169 | mExtensionWidgetList.append( wdg ); |
169 | extensionNames.append( wdg->title() ); | 170 | extensionNames.append( wdg->title() ); |
170 | 171 | ||
171 | // load the other extensions | 172 | // load the other extensions |
172 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; | 173 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; |
173 | 174 | ||
174 | #ifndef KAB_EMBEDDED | 175 | #ifndef KAB_EMBEDDED |
175 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); | 176 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); |
176 | KTrader::OfferList::ConstIterator it; | 177 | KTrader::OfferList::ConstIterator it; |
177 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 178 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
178 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) | 179 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) |
179 | continue; | 180 | continue; |
180 | 181 | ||
181 | KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); | 182 | KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); |
182 | if ( !factory ) { | 183 | if ( !factory ) { |
183 | kdDebug(5720) << "ExtensionManager::loadExtensions(): Factory creation failed" << endl; | 184 | //kdDebug(5720) << "ExtensionManager::loadExtensions(): Factory creation failed" << endl; |
184 | continue; | 185 | continue; |
185 | } | 186 | } |
186 | 187 | ||
187 | ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); | 188 | ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory ); |
188 | 189 | ||
189 | if ( !extensionFactory ) { | 190 | if ( !extensionFactory ) { |
190 | kdDebug(5720) << "ExtensionManager::loadExtensions(): Cast failed" << endl; | 191 | //kdDebug(5720) << "ExtensionManager::loadExtensions(): Cast failed" << endl; |
191 | continue; | 192 | continue; |
192 | } | 193 | } |
193 | 194 | ||
194 | if ( !activeExtensions.contains( extensionFactory->identifier() ) ) | 195 | if ( !activeExtensions.contains( extensionFactory->identifier() ) ) |
195 | continue; | 196 | continue; |
196 | 197 | ||
197 | wdg = extensionFactory->extension( mCore, this ); | 198 | wdg = extensionFactory->extension( mCore, this ); |
198 | if ( wdg ) { | 199 | if ( wdg ) { |
199 | //wdg->hide(); | 200 | //wdg->hide(); |
200 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), | 201 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), |
201 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); | 202 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); |
202 | mExtensionWidgetList.append( wdg ); | 203 | mExtensionWidgetList.append( wdg ); |
203 | extensionNames.append( wdg->title() ); | 204 | extensionNames.append( wdg->title() ); |
204 | } | 205 | } |
205 | } | 206 | } |
206 | #else //KAB_EMBEDDED | 207 | #else //KAB_EMBEDDED |
207 | //load Mergefactory/extension | 208 | //load Mergefactory/extension |
208 | ExtensionFactory *extensionFactory = new MergeFactory(); | 209 | ExtensionFactory *extensionFactory = new MergeFactory(); |
209 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 210 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
210 | { | 211 | { |
211 | wdg = extensionFactory->extension( mCore, mWidgetBox ); | 212 | wdg = extensionFactory->extension( mCore, mWidgetBox ); |
212 | if ( wdg ) { | 213 | if ( wdg ) { |
213 | hbl->addWidget( wdg ); | 214 | hbl->addWidget( wdg ); |
214 | //wdg->hide(); | 215 | //wdg->hide(); |
215 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), | 216 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), |
216 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); | 217 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); |
217 | mExtensionWidgetList.append( wdg ); | 218 | mExtensionWidgetList.append( wdg ); |
218 | extensionNames.append( wdg->title() ); | 219 | extensionNames.append( wdg->title() ); |
219 | } | 220 | } |
220 | } | 221 | } |
221 | 222 | ||
222 | //load DistributionListfactory/extension | 223 | //load DistributionListfactory/extension |
223 | extensionFactory = new DistributionListFactory(); | 224 | extensionFactory = new DistributionListFactory(); |
224 | if (activeExtensions.contains( extensionFactory->identifier() ) ) | 225 | if (activeExtensions.contains( extensionFactory->identifier() ) ) |
225 | { | 226 | { |
226 | wdg = extensionFactory->extension( mCore, mWidgetBox ); | 227 | wdg = extensionFactory->extension( mCore, mWidgetBox ); |
227 | if ( wdg ) { | 228 | if ( wdg ) { |
228 | hbl->addWidget( wdg ); | 229 | hbl->addWidget( wdg ); |
229 | //wdg->hide(); | 230 | //wdg->hide(); |
230 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), | 231 | connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ), |
231 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); | 232 | SIGNAL( modified( const KABC::Addressee::List& ) ) ); |
232 | mExtensionWidgetList.append( wdg ); | 233 | mExtensionWidgetList.append( wdg ); |
233 | extensionNames.append( wdg->title() ); | 234 | extensionNames.append( wdg->title() ); |
234 | } | 235 | } |
235 | } | 236 | } |
236 | 237 | ||
237 | hbl->addStretch(); | 238 | hbl->addStretch(); |
238 | 239 | ||
239 | #endif //KAB_EMBEDDED | 240 | #endif //KAB_EMBEDDED |
240 | 241 | ||
241 | 242 | ||
242 | mActionExtensions->setItems( extensionNames ); | 243 | mActionExtensions->setItems( extensionNames ); |
243 | mCurrentExtensionWidget = 0; | 244 | mCurrentExtensionWidget = 0; |
244 | } | 245 | } |
245 | 246 | ||
246 | #ifndef KAB_EMBEDDED | 247 | #ifndef KAB_EMBEDDED |
247 | #include "extensionmanager.moc" | 248 | #include "extensionmanager.moc" |
248 | #endif //KAB_EMBEDDED | 249 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp index b0d04ca..39d2ae4 100644 --- a/kaddressbook/filter.cpp +++ b/kaddressbook/filter.cpp | |||
@@ -119,87 +119,88 @@ void Filter::save( KConfig *config ) | |||
119 | config->writeEntry( "Name", mName ); | 119 | config->writeEntry( "Name", mName ); |
120 | config->writeEntry( "Enabled", mEnabled ); | 120 | config->writeEntry( "Enabled", mEnabled ); |
121 | config->writeEntry( "Categories", mCategoryList ); | 121 | config->writeEntry( "Categories", mCategoryList ); |
122 | config->writeEntry( "MatchRule", (int)mMatchRule ); | 122 | config->writeEntry( "MatchRule", (int)mMatchRule ); |
123 | } | 123 | } |
124 | 124 | ||
125 | void Filter::restore( KConfig *config ) | 125 | void Filter::restore( KConfig *config ) |
126 | { | 126 | { |
127 | mName = config->readEntry( "Name", "<internal error>" ); | 127 | mName = config->readEntry( "Name", "<internal error>" ); |
128 | mEnabled = config->readBoolEntry( "Enabled", true ); | 128 | mEnabled = config->readBoolEntry( "Enabled", true ); |
129 | mCategoryList = config->readListEntry( "Categories" ); | 129 | mCategoryList = config->readListEntry( "Categories" ); |
130 | mMatchRule = (MatchRule)config->readNumEntry( "MatchRule", Matching ); | 130 | mMatchRule = (MatchRule)config->readNumEntry( "MatchRule", Matching ); |
131 | } | 131 | } |
132 | 132 | ||
133 | void Filter::save( KConfig *config, QString baseGroup, Filter::List &list ) | 133 | void Filter::save( KConfig *config, QString baseGroup, Filter::List &list ) |
134 | { | 134 | { |
135 | { | 135 | { |
136 | KConfigGroupSaver s( config, baseGroup ); | 136 | KConfigGroupSaver s( config, baseGroup ); |
137 | 137 | ||
138 | // remove the old filters | 138 | // remove the old filters |
139 | uint count = config->readNumEntry( "Count" ); | 139 | uint count = config->readNumEntry( "Count" ); |
140 | /* // memory access violation here | 140 | /* // memory access violation here |
141 | for ( uint i = 0; i < count; ++i ) | 141 | for ( uint i = 0; i < count; ++i ) |
142 | config->deleteGroup( QString( "%1_%2" ).arg( baseGroup ).arg( i ) ); | 142 | config->deleteGroup( QString( "%1_%2" ).arg( baseGroup ).arg( i ) ); |
143 | */ | 143 | */ |
144 | } | 144 | } |
145 | 145 | ||
146 | int index = 0; | 146 | int index = 0; |
147 | Filter::List::Iterator iter; | 147 | Filter::List::Iterator iter; |
148 | for ( iter = list.begin(); iter != list.end(); ++iter ) { | 148 | for ( iter = list.begin(); iter != list.end(); ++iter ) { |
149 | if ( !(*iter).mInternal ) { | 149 | if ( !(*iter).mInternal ) { |
150 | KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( index ) ); | 150 | KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( index ) ); |
151 | 151 | ||
152 | (*iter).save( config ); | 152 | (*iter).save( config ); |
153 | index++; | 153 | index++; |
154 | } | 154 | } |
155 | } | 155 | } |
156 | 156 | ||
157 | KConfigGroupSaver s( config, baseGroup ); | 157 | KConfigGroupSaver s( config, baseGroup ); |
158 | 158 | ||
159 | config->writeEntry( "Count", index ); | 159 | config->writeEntry( "Count", index ); |
160 | 160 | ||
161 | } | 161 | } |
162 | 162 | ||
163 | Filter::List Filter::restore( KConfig *config, QString baseGroup ) | 163 | Filter::List Filter::restore( KConfig *config, QString baseGroup ) |
164 | { | 164 | { |
165 | Filter::List list; | 165 | Filter::List list; |
166 | int count = 0; | 166 | int count = 0; |
167 | Filter f; | 167 | Filter f; |
168 | 168 | ||
169 | { | 169 | { |
170 | KConfigGroupSaver s( config, baseGroup ); | 170 | KConfigGroupSaver s( config, baseGroup ); |
171 | count = config->readNumEntry( "Count", 0 ); | 171 | count = config->readNumEntry( "Count", 0 ); |
172 | } | 172 | } |
173 | 173 | ||
174 | for ( int i = 0; i < count; i++ ) { | 174 | for ( int i = 0; i < count; i++ ) { |
175 | { | 175 | { |
176 | KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( i ) ); | 176 | KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( i ) ); |
177 | f.restore( config ); | 177 | f.restore( config ); |
178 | } | 178 | } |
179 | 179 | ||
180 | list.append( f ); | 180 | list.append( f ); |
181 | } | 181 | } |
182 | 182 | ||
183 | QStringList cats = KABPrefs::instance()->mCustomCategories; | 183 | if ( list.isEmpty()) { |
184 | for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) { | 184 | QStringList cats = KABPrefs::instance()->mCustomCategories; |
185 | Filter filter; | 185 | for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) { |
186 | filter.mName = *it; | 186 | Filter filter; |
187 | filter.mEnabled = true; | 187 | filter.mName = *it; |
188 | filter.mCategoryList = *it; | 188 | filter.mEnabled = true; |
189 | filter.mMatchRule = Matching; | 189 | filter.mCategoryList = *it; |
190 | filter.mInternal = true; | 190 | filter.mMatchRule = Matching; |
191 | list.append( filter ); | 191 | filter.mInternal = true; |
192 | list.append( filter ); | ||
193 | } | ||
192 | } | 194 | } |
193 | |||
194 | return list; | 195 | return list; |
195 | } | 196 | } |
196 | 197 | ||
197 | void Filter::setMatchRule( MatchRule rule ) | 198 | void Filter::setMatchRule( MatchRule rule ) |
198 | { | 199 | { |
199 | mMatchRule = rule; | 200 | mMatchRule = rule; |
200 | } | 201 | } |
201 | 202 | ||
202 | Filter::MatchRule Filter::matchRule() const | 203 | Filter::MatchRule Filter::matchRule() const |
203 | { | 204 | { |
204 | return mMatchRule; | 205 | return mMatchRule; |
205 | } | 206 | } |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index e14e579..c6288fa 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -90,173 +90,209 @@ $Id$ | |||
90 | 90 | ||
91 | #include <qapp.h> | 91 | #include <qapp.h> |
92 | #include <qmenubar.h> | 92 | #include <qmenubar.h> |
93 | //#include <qtoolbar.h> | 93 | //#include <qtoolbar.h> |
94 | #include <qmessagebox.h> | 94 | #include <qmessagebox.h> |
95 | #include <kdebug.h> | 95 | #include <kdebug.h> |
96 | #include <kiconloader.h> // needed for SmallIcon | 96 | #include <kiconloader.h> // needed for SmallIcon |
97 | #include <kresources/kcmkresources.h> | 97 | #include <kresources/kcmkresources.h> |
98 | #include <ktoolbar.h> | 98 | #include <ktoolbar.h> |
99 | 99 | ||
100 | 100 | ||
101 | //#include <qlabel.h> | 101 | //#include <qlabel.h> |
102 | 102 | ||
103 | 103 | ||
104 | #ifndef DESKTOP_VERSION | 104 | #ifndef DESKTOP_VERSION |
105 | #include <qpe/ir.h> | 105 | #include <qpe/ir.h> |
106 | #include <qpe/qpemenubar.h> | 106 | #include <qpe/qpemenubar.h> |
107 | #include <qtopia/qcopenvelope_qws.h> | 107 | #include <qtopia/qcopenvelope_qws.h> |
108 | #else | 108 | #else |
109 | 109 | ||
110 | #include <qmenubar.h> | 110 | #include <qmenubar.h> |
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | #endif // KAB_EMBEDDED | 113 | #endif // KAB_EMBEDDED |
114 | #include "kcmconfigs/kcmkabconfig.h" | 114 | #include "kcmconfigs/kcmkabconfig.h" |
115 | #include "kcmconfigs/kcmkdepimconfig.h" | 115 | #include "kcmconfigs/kcmkdepimconfig.h" |
116 | #include "kpimglobalprefs.h" | 116 | #include "kpimglobalprefs.h" |
117 | #include "externalapphandler.h" | 117 | #include "externalapphandler.h" |
118 | #include "xxportselectdialog.h" | 118 | #include "xxportselectdialog.h" |
119 | 119 | ||
120 | 120 | ||
121 | #include <kresources/selectdialog.h> | 121 | #include <kresources/selectdialog.h> |
122 | #include <kmessagebox.h> | 122 | #include <kmessagebox.h> |
123 | 123 | ||
124 | #include <picture.h> | 124 | #include <picture.h> |
125 | #include <resource.h> | 125 | #include <resource.h> |
126 | 126 | ||
127 | //US#include <qsplitter.h> | 127 | //US#include <qsplitter.h> |
128 | #include <qmap.h> | 128 | #include <qmap.h> |
129 | #include <qdir.h> | 129 | #include <qdir.h> |
130 | #include <qfile.h> | 130 | #include <qfile.h> |
131 | #include <qvbox.h> | 131 | #include <qvbox.h> |
132 | #include <qlayout.h> | 132 | #include <qlayout.h> |
133 | #include <qclipboard.h> | 133 | #include <qclipboard.h> |
134 | #include <qtextstream.h> | 134 | #include <qtextstream.h> |
135 | #include <qradiobutton.h> | 135 | #include <qradiobutton.h> |
136 | #include <qbuttongroup.h> | 136 | #include <qbuttongroup.h> |
137 | 137 | ||
138 | #include <libkdepim/categoryselectdialog.h> | 138 | #include <libkdepim/categoryselectdialog.h> |
139 | #include <libkdepim/categoryeditdialog.h> | 139 | #include <libkdepim/categoryeditdialog.h> |
140 | #include <kabc/vcardconverter.h> | 140 | #include <kabc/vcardconverter.h> |
141 | 141 | ||
142 | 142 | ||
143 | #include "addresseeutil.h" | 143 | #include "addresseeutil.h" |
144 | #include "undocmds.h" | 144 | #include "undocmds.h" |
145 | #include "addresseeeditordialog.h" | 145 | #include "addresseeeditordialog.h" |
146 | #include "viewmanager.h" | 146 | #include "viewmanager.h" |
147 | #include "details/detailsviewcontainer.h" | 147 | #include "details/detailsviewcontainer.h" |
148 | #include "kabprefs.h" | 148 | #include "kabprefs.h" |
149 | #include "xxportmanager.h" | 149 | #include "xxportmanager.h" |
150 | #include "incsearchwidget.h" | 150 | #include "incsearchwidget.h" |
151 | #include "jumpbuttonbar.h" | 151 | #include "jumpbuttonbar.h" |
152 | #include "extensionmanager.h" | 152 | #include "extensionmanager.h" |
153 | #include "addresseeconfig.h" | 153 | #include "addresseeconfig.h" |
154 | #include "nameeditdialog.h" | ||
154 | #include <kcmultidialog.h> | 155 | #include <kcmultidialog.h> |
155 | 156 | ||
156 | #ifdef _WIN32_ | 157 | #ifdef _WIN32_ |
157 | 158 | ||
158 | #include "kaimportoldialog.h" | 159 | #include "kaimportoldialog.h" |
159 | #else | 160 | #else |
160 | #include <unistd.h> | 161 | #include <unistd.h> |
161 | #endif | 162 | #endif |
162 | // sync includes | 163 | // sync includes |
163 | #include <libkdepim/ksyncprofile.h> | 164 | #include <libkdepim/ksyncprofile.h> |
164 | #include <libkdepim/ksyncprefsdialog.h> | 165 | #include <libkdepim/ksyncprefsdialog.h> |
165 | 166 | ||
166 | 167 | ||
167 | class KABCatPrefs : public QDialog | 168 | class KABCatPrefs : public QDialog |
168 | { | 169 | { |
169 | public: | 170 | public: |
170 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : | 171 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : |
171 | QDialog( parent, name, true ) | 172 | QDialog( parent, name, true ) |
172 | { | 173 | { |
173 | setCaption( i18n("Manage new Categories") ); | 174 | setCaption( i18n("Manage new Categories") ); |
174 | QVBoxLayout* lay = new QVBoxLayout( this ); | 175 | QVBoxLayout* lay = new QVBoxLayout( this ); |
175 | lay->setSpacing( 3 ); | 176 | lay->setSpacing( 3 ); |
176 | lay->setMargin( 3 ); | 177 | lay->setMargin( 3 ); |
177 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 178 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
178 | lay->addWidget( lab ); | 179 | lay->addWidget( lab ); |
179 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 180 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
180 | lay->addWidget( format ); | 181 | lay->addWidget( format ); |
181 | format->setExclusive ( true ) ; | 182 | format->setExclusive ( true ) ; |
182 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 183 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
183 | new QRadioButton(i18n("Remove from addressees"), format ); | 184 | new QRadioButton(i18n("Remove from addressees"), format ); |
184 | addCatBut->setChecked( true ); | 185 | addCatBut->setChecked( true ); |
185 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 186 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
186 | lay->addWidget( ok ); | 187 | lay->addWidget( ok ); |
187 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 188 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
188 | lay->addWidget( cancel ); | 189 | lay->addWidget( cancel ); |
189 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 190 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
190 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 191 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
191 | resize( 200, 200 ); | 192 | resize( 200, 200 ); |
192 | } | 193 | } |
193 | 194 | ||
194 | bool addCat() { return addCatBut->isChecked(); } | 195 | bool addCat() { return addCatBut->isChecked(); } |
195 | private: | 196 | private: |
196 | QRadioButton* addCatBut; | 197 | QRadioButton* addCatBut; |
197 | }; | 198 | }; |
198 | 199 | ||
200 | class KABFormatPrefs : public QDialog | ||
201 | { | ||
202 | public: | ||
203 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : | ||
204 | QDialog( parent, name, true ) | ||
205 | { | ||
206 | setCaption( i18n("Set formatted name") ); | ||
207 | QVBoxLayout* lay = new QVBoxLayout( this ); | ||
208 | lay->setSpacing( 3 ); | ||
209 | lay->setMargin( 3 ); | ||
210 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); | ||
211 | lay->addWidget( lab ); | ||
212 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); | ||
213 | lay->addWidget( format ); | ||
214 | format->setExclusive ( true ) ; | ||
215 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); | ||
216 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); | ||
217 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); | ||
218 | company = new QRadioButton(i18n("Organization: MI6"), format ); | ||
219 | simple->setChecked( true ); | ||
220 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); | ||
221 | lay->addWidget( setCompany ); | ||
222 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); | ||
223 | lay->addWidget( ok ); | ||
224 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | ||
225 | lay->addWidget( cancel ); | ||
226 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | ||
227 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | ||
228 | resize( 200, 200 ); | ||
229 | } | ||
230 | public: | ||
231 | QRadioButton* simple, *full, *reverse, *company; | ||
232 | QCheckBox* setCompany; | ||
233 | }; | ||
234 | |||
199 | 235 | ||
200 | 236 | ||
201 | class KAex2phonePrefs : public QDialog | 237 | class KAex2phonePrefs : public QDialog |
202 | { | 238 | { |
203 | public: | 239 | public: |
204 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 240 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
205 | QDialog( parent, name, true ) | 241 | QDialog( parent, name, true ) |
206 | { | 242 | { |
207 | setCaption( i18n("Export to phone options") ); | 243 | setCaption( i18n("Export to phone options") ); |
208 | QVBoxLayout* lay = new QVBoxLayout( this ); | 244 | QVBoxLayout* lay = new QVBoxLayout( this ); |
209 | lay->setSpacing( 3 ); | 245 | lay->setSpacing( 3 ); |
210 | lay->setMargin( 3 ); | 246 | lay->setMargin( 3 ); |
211 | QLabel *lab; | 247 | QLabel *lab; |
212 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 248 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
213 | lab->setAlignment (AlignHCenter ); | 249 | lab->setAlignment (AlignHCenter ); |
214 | QHBox* temphb; | 250 | QHBox* temphb; |
215 | temphb = new QHBox( this ); | 251 | temphb = new QHBox( this ); |
216 | new QLabel( i18n("I/O device: "), temphb ); | 252 | new QLabel( i18n("I/O device: "), temphb ); |
217 | mPhoneDevice = new QLineEdit( temphb); | 253 | mPhoneDevice = new QLineEdit( temphb); |
218 | lay->addWidget( temphb ); | 254 | lay->addWidget( temphb ); |
219 | temphb = new QHBox( this ); | 255 | temphb = new QHBox( this ); |
220 | new QLabel( i18n("Connection: "), temphb ); | 256 | new QLabel( i18n("Connection: "), temphb ); |
221 | mPhoneConnection = new QLineEdit( temphb); | 257 | mPhoneConnection = new QLineEdit( temphb); |
222 | lay->addWidget( temphb ); | 258 | lay->addWidget( temphb ); |
223 | temphb = new QHBox( this ); | 259 | temphb = new QHBox( this ); |
224 | new QLabel( i18n("Model(opt.): "), temphb ); | 260 | new QLabel( i18n("Model(opt.): "), temphb ); |
225 | mPhoneModel = new QLineEdit( temphb); | 261 | mPhoneModel = new QLineEdit( temphb); |
226 | lay->addWidget( temphb ); | 262 | lay->addWidget( temphb ); |
227 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 263 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
228 | // lay->addWidget( mWriteToSim ); | 264 | // lay->addWidget( mWriteToSim ); |
229 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 265 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
230 | lab->setAlignment (AlignHCenter ); | 266 | lab->setAlignment (AlignHCenter ); |
231 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 267 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
232 | lay->addWidget( ok ); | 268 | lay->addWidget( ok ); |
233 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 269 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
234 | lay->addWidget( cancel ); | 270 | lay->addWidget( cancel ); |
235 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 271 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
236 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 272 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
237 | resize( 220, 240 ); | 273 | resize( 220, 240 ); |
238 | 274 | ||
239 | } | 275 | } |
240 | 276 | ||
241 | public: | 277 | public: |
242 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 278 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
243 | QCheckBox* mWriteToSim; | 279 | QCheckBox* mWriteToSim; |
244 | }; | 280 | }; |
245 | 281 | ||
246 | 282 | ||
247 | bool pasteWithNewUid = true; | 283 | bool pasteWithNewUid = true; |
248 | 284 | ||
249 | #ifdef KAB_EMBEDDED | 285 | #ifdef KAB_EMBEDDED |
250 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 286 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
251 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 287 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
252 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 288 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
253 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 289 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
254 | #else //KAB_EMBEDDED | 290 | #else //KAB_EMBEDDED |
255 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 291 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
256 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 292 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
257 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 293 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
258 | mReadWrite( readWrite ), mModified( false ) | 294 | mReadWrite( readWrite ), mModified( false ) |
259 | #endif //KAB_EMBEDDED | 295 | #endif //KAB_EMBEDDED |
260 | { | 296 | { |
261 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 297 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
262 | // syncManager->setBlockSave(false); | 298 | // syncManager->setBlockSave(false); |
@@ -1085,146 +1121,152 @@ void KABCore::setCategories() | |||
1085 | QStringList::Iterator it; | 1121 | QStringList::Iterator it; |
1086 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 1122 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
1087 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 1123 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
1088 | if ( !addr.isEmpty() ) { | 1124 | if ( !addr.isEmpty() ) { |
1089 | if ( !merge ) | 1125 | if ( !merge ) |
1090 | addr.setCategories( categories ); | 1126 | addr.setCategories( categories ); |
1091 | else { | 1127 | else { |
1092 | QStringList addrCategories = addr.categories(); | 1128 | QStringList addrCategories = addr.categories(); |
1093 | QStringList::Iterator catIt; | 1129 | QStringList::Iterator catIt; |
1094 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 1130 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
1095 | if ( !addrCategories.contains( *catIt ) ) | 1131 | if ( !addrCategories.contains( *catIt ) ) |
1096 | addrCategories.append( *catIt ); | 1132 | addrCategories.append( *catIt ); |
1097 | } | 1133 | } |
1098 | addr.setCategories( addrCategories ); | 1134 | addr.setCategories( addrCategories ); |
1099 | } | 1135 | } |
1100 | mAddressBook->insertAddressee( addr ); | 1136 | mAddressBook->insertAddressee( addr ); |
1101 | } | 1137 | } |
1102 | } | 1138 | } |
1103 | 1139 | ||
1104 | if ( uids.count() > 0 ) | 1140 | if ( uids.count() > 0 ) |
1105 | setModified( true ); | 1141 | setModified( true ); |
1106 | message( i18n("Setting categories completed!") ); | 1142 | message( i18n("Setting categories completed!") ); |
1107 | } | 1143 | } |
1108 | 1144 | ||
1109 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 1145 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
1110 | { | 1146 | { |
1111 | mIncSearchWidget->setFields( fields ); | 1147 | mIncSearchWidget->setFields( fields ); |
1112 | } | 1148 | } |
1113 | 1149 | ||
1114 | void KABCore::incrementalSearch( const QString& text ) | 1150 | void KABCore::incrementalSearch( const QString& text ) |
1115 | { | 1151 | { |
1116 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); | 1152 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); |
1117 | } | 1153 | } |
1118 | 1154 | ||
1119 | void KABCore::setModified() | 1155 | void KABCore::setModified() |
1120 | { | 1156 | { |
1121 | setModified( true ); | 1157 | setModified( true ); |
1122 | } | 1158 | } |
1123 | 1159 | ||
1124 | void KABCore::setModifiedWOrefresh() | 1160 | void KABCore::setModifiedWOrefresh() |
1125 | { | 1161 | { |
1126 | // qDebug("KABCore::setModifiedWOrefresh() "); | 1162 | // qDebug("KABCore::setModifiedWOrefresh() "); |
1127 | mModified = true; | 1163 | mModified = true; |
1128 | mActionSave->setEnabled( mModified ); | 1164 | mActionSave->setEnabled( mModified ); |
1129 | 1165 | ||
1130 | 1166 | ||
1131 | } | 1167 | } |
1132 | void KABCore::setModified( bool modified ) | 1168 | void KABCore::setModified( bool modified ) |
1133 | { | 1169 | { |
1134 | mModified = modified; | 1170 | mModified = modified; |
1135 | mActionSave->setEnabled( mModified ); | 1171 | mActionSave->setEnabled( mModified ); |
1136 | 1172 | ||
1137 | if ( modified ) | 1173 | if ( modified ) |
1138 | mJumpButtonBar->recreateButtons(); | 1174 | mJumpButtonBar->recreateButtons(); |
1139 | 1175 | ||
1140 | mViewManager->refreshView(); | 1176 | mViewManager->refreshView(); |
1141 | 1177 | ||
1142 | } | 1178 | } |
1143 | 1179 | ||
1144 | bool KABCore::modified() const | 1180 | bool KABCore::modified() const |
1145 | { | 1181 | { |
1146 | return mModified; | 1182 | return mModified; |
1147 | } | 1183 | } |
1148 | 1184 | ||
1149 | void KABCore::contactModified( const KABC::Addressee &addr ) | 1185 | void KABCore::contactModified( const KABC::Addressee &addr ) |
1186 | { | ||
1187 | addrModified( addr ); | ||
1188 | } | ||
1189 | |||
1190 | void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) | ||
1150 | { | 1191 | { |
1151 | 1192 | ||
1152 | Command *command = 0; | 1193 | Command *command = 0; |
1153 | QString uid; | 1194 | QString uid; |
1154 | 1195 | ||
1155 | // check if it exists already | 1196 | // check if it exists already |
1156 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 1197 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
1157 | if ( origAddr.isEmpty() ) | 1198 | if ( origAddr.isEmpty() ) |
1158 | command = new PwNewCommand( mAddressBook, addr ); | 1199 | command = new PwNewCommand( mAddressBook, addr ); |
1159 | else { | 1200 | else { |
1160 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 1201 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
1161 | uid = addr.uid(); | 1202 | uid = addr.uid(); |
1162 | } | 1203 | } |
1163 | 1204 | ||
1164 | UndoStack::instance()->push( command ); | 1205 | UndoStack::instance()->push( command ); |
1165 | RedoStack::instance()->clear(); | 1206 | RedoStack::instance()->clear(); |
1166 | mDetails->setAddressee( addr ); | 1207 | if ( updateDetails ) |
1208 | mDetails->setAddressee( addr ); | ||
1167 | setModified( true ); | 1209 | setModified( true ); |
1168 | } | 1210 | } |
1169 | 1211 | ||
1170 | void KABCore::newContact() | 1212 | void KABCore::newContact() |
1171 | { | 1213 | { |
1172 | 1214 | ||
1173 | 1215 | ||
1174 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 1216 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
1175 | 1217 | ||
1176 | QPtrList<KRES::Resource> kresResources; | 1218 | QPtrList<KRES::Resource> kresResources; |
1177 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 1219 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
1178 | KABC::Resource *resource; | 1220 | KABC::Resource *resource; |
1179 | while ( ( resource = it.current() ) != 0 ) { | 1221 | while ( ( resource = it.current() ) != 0 ) { |
1180 | ++it; | 1222 | ++it; |
1181 | if ( !resource->readOnly() ) { | 1223 | if ( !resource->readOnly() ) { |
1182 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 1224 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
1183 | if ( res ) | 1225 | if ( res ) |
1184 | kresResources.append( res ); | 1226 | kresResources.append( res ); |
1185 | } | 1227 | } |
1186 | } | 1228 | } |
1187 | 1229 | ||
1188 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 1230 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
1189 | resource = static_cast<KABC::Resource*>( res ); | 1231 | resource = static_cast<KABC::Resource*>( res ); |
1190 | 1232 | ||
1191 | if ( resource ) { | 1233 | if ( resource ) { |
1192 | KABC::Addressee addr; | 1234 | KABC::Addressee addr; |
1193 | addr.setResource( resource ); | 1235 | addr.setResource( resource ); |
1194 | mEditorDialog->setAddressee( addr ); | 1236 | mEditorDialog->setAddressee( addr ); |
1195 | KApplication::execDialog ( mEditorDialog ); | 1237 | KApplication::execDialog ( mEditorDialog ); |
1196 | 1238 | ||
1197 | } else | 1239 | } else |
1198 | return; | 1240 | return; |
1199 | 1241 | ||
1200 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 1242 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
1201 | 1243 | ||
1202 | 1244 | ||
1203 | } | 1245 | } |
1204 | 1246 | ||
1205 | void KABCore::addEmail( QString aStr ) | 1247 | void KABCore::addEmail( QString aStr ) |
1206 | { | 1248 | { |
1207 | #ifndef KAB_EMBEDDED | 1249 | #ifndef KAB_EMBEDDED |
1208 | QString fullName, email; | 1250 | QString fullName, email; |
1209 | 1251 | ||
1210 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 1252 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
1211 | 1253 | ||
1212 | // Try to lookup the addressee matching the email address | 1254 | // Try to lookup the addressee matching the email address |
1213 | bool found = false; | 1255 | bool found = false; |
1214 | QStringList emailList; | 1256 | QStringList emailList; |
1215 | KABC::AddressBook::Iterator it; | 1257 | KABC::AddressBook::Iterator it; |
1216 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 1258 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
1217 | emailList = (*it).emails(); | 1259 | emailList = (*it).emails(); |
1218 | if ( emailList.contains( email ) > 0 ) { | 1260 | if ( emailList.contains( email ) > 0 ) { |
1219 | found = true; | 1261 | found = true; |
1220 | (*it).setNameFromString( fullName ); | 1262 | (*it).setNameFromString( fullName ); |
1221 | editContact( (*it).uid() ); | 1263 | editContact( (*it).uid() ); |
1222 | } | 1264 | } |
1223 | } | 1265 | } |
1224 | 1266 | ||
1225 | if ( !found ) { | 1267 | if ( !found ) { |
1226 | KABC::Addressee addr; | 1268 | KABC::Addressee addr; |
1227 | addr.setNameFromString( fullName ); | 1269 | addr.setNameFromString( fullName ); |
1228 | addr.insertEmail( email, true ); | 1270 | addr.insertEmail( email, true ); |
1229 | 1271 | ||
1230 | mAddressBook->insertAddressee( addr ); | 1272 | mAddressBook->insertAddressee( addr ); |
@@ -1480,129 +1522,129 @@ void KABCore::extensionChanged( int id ) | |||
1480 | } | 1522 | } |
1481 | 1523 | ||
1482 | 1524 | ||
1483 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1525 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
1484 | { | 1526 | { |
1485 | 1527 | ||
1486 | if ( list.count() != 0 ) { | 1528 | if ( list.count() != 0 ) { |
1487 | KABC::Addressee::List::ConstIterator it; | 1529 | KABC::Addressee::List::ConstIterator it; |
1488 | for ( it = list.begin(); it != list.end(); ++it ) | 1530 | for ( it = list.begin(); it != list.end(); ++it ) |
1489 | mAddressBook->insertAddressee( *it ); | 1531 | mAddressBook->insertAddressee( *it ); |
1490 | if ( list.count() > 1 ) | 1532 | if ( list.count() > 1 ) |
1491 | setModified(); | 1533 | setModified(); |
1492 | else | 1534 | else |
1493 | setModifiedWOrefresh(); | 1535 | setModifiedWOrefresh(); |
1494 | } | 1536 | } |
1495 | if ( list.count() == 0 ) | 1537 | if ( list.count() == 0 ) |
1496 | mViewManager->refreshView(); | 1538 | mViewManager->refreshView(); |
1497 | else | 1539 | else |
1498 | mViewManager->refreshView( list[ 0 ].uid() ); | 1540 | mViewManager->refreshView( list[ 0 ].uid() ); |
1499 | 1541 | ||
1500 | 1542 | ||
1501 | 1543 | ||
1502 | } | 1544 | } |
1503 | 1545 | ||
1504 | QString KABCore::getNameByPhone( const QString &phone ) | 1546 | QString KABCore::getNameByPhone( const QString &phone ) |
1505 | { | 1547 | { |
1506 | #ifndef KAB_EMBEDDED | 1548 | #ifndef KAB_EMBEDDED |
1507 | QRegExp r( "[/*/-/ ]" ); | 1549 | QRegExp r( "[/*/-/ ]" ); |
1508 | QString localPhone( phone ); | 1550 | QString localPhone( phone ); |
1509 | 1551 | ||
1510 | bool found = false; | 1552 | bool found = false; |
1511 | QString ownerName = ""; | 1553 | QString ownerName = ""; |
1512 | KABC::AddressBook::Iterator iter; | 1554 | KABC::AddressBook::Iterator iter; |
1513 | KABC::PhoneNumber::List::Iterator phoneIter; | 1555 | KABC::PhoneNumber::List::Iterator phoneIter; |
1514 | KABC::PhoneNumber::List phoneList; | 1556 | KABC::PhoneNumber::List phoneList; |
1515 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1557 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1516 | phoneList = (*iter).phoneNumbers(); | 1558 | phoneList = (*iter).phoneNumbers(); |
1517 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1559 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1518 | ++phoneIter) { | 1560 | ++phoneIter) { |
1519 | // Get rid of separator chars so just the numbers are compared. | 1561 | // Get rid of separator chars so just the numbers are compared. |
1520 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1562 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1521 | ownerName = (*iter).formattedName(); | 1563 | ownerName = (*iter).formattedName(); |
1522 | found = true; | 1564 | found = true; |
1523 | } | 1565 | } |
1524 | } | 1566 | } |
1525 | } | 1567 | } |
1526 | 1568 | ||
1527 | return ownerName; | 1569 | return ownerName; |
1528 | #else //KAB_EMBEDDED | 1570 | #else //KAB_EMBEDDED |
1529 | qDebug("KABCore::getNameByPhone finsih method"); | 1571 | qDebug("KABCore::getNameByPhone finsih method"); |
1530 | return ""; | 1572 | return ""; |
1531 | #endif //KAB_EMBEDDED | 1573 | #endif //KAB_EMBEDDED |
1532 | 1574 | ||
1533 | } | 1575 | } |
1534 | 1576 | ||
1535 | void KABCore::openConfigDialog() | 1577 | void KABCore::openConfigDialog() |
1536 | { | 1578 | { |
1537 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1579 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1538 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1580 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1539 | ConfigureDialog->addModule(kabcfg ); | 1581 | ConfigureDialog->addModule(kabcfg ); |
1540 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 1582 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
1541 | ConfigureDialog->addModule(kdelibcfg ); | 1583 | ConfigureDialog->addModule(kdelibcfg ); |
1542 | 1584 | ||
1543 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1585 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1544 | this, SLOT( configurationChanged() ) ); | 1586 | this, SLOT( configurationChanged() ) ); |
1545 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1587 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1546 | this, SLOT( configurationChanged() ) ); | 1588 | this, SLOT( configurationChanged() ) ); |
1547 | saveSettings(); | 1589 | saveSettings(); |
1548 | #ifndef DESKTOP_VERSION | 1590 | #ifndef DESKTOP_VERSION |
1549 | ConfigureDialog->showMaximized(); | 1591 | ConfigureDialog->showMaximized(); |
1550 | #endif | 1592 | #endif |
1551 | if ( ConfigureDialog->exec() ) | 1593 | if ( ConfigureDialog->exec() ) |
1552 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 1594 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
1553 | delete ConfigureDialog; | 1595 | delete ConfigureDialog; |
1554 | } | 1596 | } |
1555 | 1597 | ||
1556 | void KABCore::openLDAPDialog() | 1598 | void KABCore::openLDAPDialog() |
1557 | { | 1599 | { |
1558 | #ifndef KAB_EMBEDDED | 1600 | #ifndef KAB_EMBEDDED |
1559 | if ( !mLdapSearchDialog ) { | 1601 | if ( !mLdapSearchDialog ) { |
1560 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1602 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1561 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1603 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1562 | SLOT( refreshView() ) ); | 1604 | SLOT( refreshView() ) ); |
1563 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1605 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1564 | SLOT( setModified() ) ); | 1606 | SLOT( setModified() ) ); |
1565 | } else | 1607 | } else |
1566 | mLdapSearchDialog->restoreSettings(); | 1608 | mLdapSearchDialog->restoreSettings(); |
1567 | 1609 | ||
1568 | if ( mLdapSearchDialog->isOK() ) | 1610 | if ( mLdapSearchDialog->isOK() ) |
1569 | mLdapSearchDialog->exec(); | 1611 | mLdapSearchDialog->exec(); |
1570 | #else //KAB_EMBEDDED | 1612 | #else //KAB_EMBEDDED |
1571 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1613 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1572 | #endif //KAB_EMBEDDED | 1614 | #endif //KAB_EMBEDDED |
1573 | } | 1615 | } |
1574 | 1616 | ||
1575 | void KABCore::print() | 1617 | void KABCore::print() |
1576 | { | 1618 | { |
1577 | #ifndef KAB_EMBEDDED | 1619 | #ifndef KAB_EMBEDDED |
1578 | KPrinter printer; | 1620 | KPrinter printer; |
1579 | if ( !printer.setup( this ) ) | 1621 | if ( !printer.setup( this ) ) |
1580 | return; | 1622 | return; |
1581 | 1623 | ||
1582 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1624 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1583 | mViewManager->selectedUids(), this ); | 1625 | mViewManager->selectedUids(), this ); |
1584 | 1626 | ||
1585 | wizard.exec(); | 1627 | wizard.exec(); |
1586 | #else //KAB_EMBEDDED | 1628 | #else //KAB_EMBEDDED |
1587 | qDebug("KABCore::print() finsih method"); | 1629 | qDebug("KABCore::print() finsih method"); |
1588 | #endif //KAB_EMBEDDED | 1630 | #endif //KAB_EMBEDDED |
1589 | 1631 | ||
1590 | } | 1632 | } |
1591 | 1633 | ||
1592 | 1634 | ||
1593 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1635 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1594 | { | 1636 | { |
1595 | if ( mGUIClient ) | 1637 | if ( mGUIClient ) |
1596 | mGUIClient->insertChildClient( client ); | 1638 | mGUIClient->insertChildClient( client ); |
1597 | else | 1639 | else |
1598 | KMessageBox::error( this, "no KXMLGUICLient"); | 1640 | KMessageBox::error( this, "no KXMLGUICLient"); |
1599 | } | 1641 | } |
1600 | 1642 | ||
1601 | 1643 | ||
1602 | void KABCore::configurationChanged() | 1644 | void KABCore::configurationChanged() |
1603 | { | 1645 | { |
1604 | mExtensionManager->reconfigure(); | 1646 | mExtensionManager->reconfigure(); |
1605 | } | 1647 | } |
1606 | 1648 | ||
1607 | void KABCore::addressBookChanged() | 1649 | void KABCore::addressBookChanged() |
1608 | { | 1650 | { |
@@ -1935,128 +1977,131 @@ void KABCore::initActions() | |||
1935 | 1977 | ||
1936 | if ( mIsPart ) { | 1978 | if ( mIsPart ) { |
1937 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1979 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1938 | SLOT( openConfigDialog() ), actionCollection(), | 1980 | SLOT( openConfigDialog() ), actionCollection(), |
1939 | "kaddressbook_configure" ); | 1981 | "kaddressbook_configure" ); |
1940 | 1982 | ||
1941 | //US not implemented yet | 1983 | //US not implemented yet |
1942 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1984 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1943 | // this, SLOT( configureKeyBindings() ), actionCollection(), | 1985 | // this, SLOT( configureKeyBindings() ), actionCollection(), |
1944 | // "kaddressbook_configure_shortcuts" ); | 1986 | // "kaddressbook_configure_shortcuts" ); |
1945 | #ifdef KAB_EMBEDDED | 1987 | #ifdef KAB_EMBEDDED |
1946 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1988 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1947 | mActionConfigureToolbars->setEnabled( false ); | 1989 | mActionConfigureToolbars->setEnabled( false ); |
1948 | #endif //KAB_EMBEDDED | 1990 | #endif //KAB_EMBEDDED |
1949 | 1991 | ||
1950 | } else { | 1992 | } else { |
1951 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1993 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1952 | 1994 | ||
1953 | //US not implemented yet | 1995 | //US not implemented yet |
1954 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1996 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1955 | } | 1997 | } |
1956 | 1998 | ||
1957 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1999 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1958 | actionCollection(), "options_show_jump_bar" ); | 2000 | actionCollection(), "options_show_jump_bar" ); |
1959 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 2001 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1960 | 2002 | ||
1961 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 2003 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
1962 | actionCollection(), "options_show_details" ); | 2004 | actionCollection(), "options_show_details" ); |
1963 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 2005 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1964 | 2006 | ||
1965 | 2007 | ||
1966 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, | 2008 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, |
1967 | SLOT( toggleBeamReceive() ), actionCollection(), | 2009 | SLOT( toggleBeamReceive() ), actionCollection(), |
1968 | "kaddressbook_beam_rec" ); | 2010 | "kaddressbook_beam_rec" ); |
1969 | 2011 | ||
1970 | 2012 | ||
1971 | // misc | 2013 | // misc |
1972 | // only enable LDAP lookup if we can handle the protocol | 2014 | // only enable LDAP lookup if we can handle the protocol |
1973 | #ifndef KAB_EMBEDDED | 2015 | #ifndef KAB_EMBEDDED |
1974 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 2016 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1975 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 2017 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1976 | this, SLOT( openLDAPDialog() ), actionCollection(), | 2018 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1977 | "ldap_lookup" ); | 2019 | "ldap_lookup" ); |
1978 | } | 2020 | } |
1979 | #else //KAB_EMBEDDED | 2021 | #else //KAB_EMBEDDED |
1980 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 2022 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1981 | #endif //KAB_EMBEDDED | 2023 | #endif //KAB_EMBEDDED |
1982 | 2024 | ||
1983 | 2025 | ||
1984 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 2026 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1985 | SLOT( setWhoAmI() ), actionCollection(), | 2027 | SLOT( setWhoAmI() ), actionCollection(), |
1986 | "set_personal" ); | 2028 | "set_personal" ); |
1987 | 2029 | ||
1988 | 2030 | ||
1989 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 2031 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1990 | SLOT( setCategories() ), actionCollection(), | 2032 | SLOT( setCategories() ), actionCollection(), |
1991 | "edit_set_categories" ); | 2033 | "edit_set_categories" ); |
1992 | mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this, | 2034 | mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this, |
1993 | SLOT( editCategories() ), actionCollection(), | 2035 | SLOT( editCategories() ), actionCollection(), |
1994 | "edit__categories" ); | 2036 | "edit__categories" ); |
1995 | 2037 | ||
1996 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 2038 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1997 | SLOT( removeVoice() ), actionCollection(), | 2039 | SLOT( removeVoice() ), actionCollection(), |
1998 | "remove_voice" ); | 2040 | "remove_voice" ); |
2041 | mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, | ||
2042 | SLOT( setFormattedName() ), actionCollection(), | ||
2043 | "set_formatted" ); | ||
1999 | 2044 | ||
2000 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, | 2045 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, |
2001 | SLOT( manageCategories() ), actionCollection(), | 2046 | SLOT( manageCategories() ), actionCollection(), |
2002 | "remove_voice" ); | 2047 | "remove_voice" ); |
2003 | 2048 | ||
2004 | 2049 | ||
2005 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 2050 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
2006 | SLOT( importFromOL() ), actionCollection(), | 2051 | SLOT( importFromOL() ), actionCollection(), |
2007 | "import_OL" ); | 2052 | "import_OL" ); |
2008 | #ifdef KAB_EMBEDDED | 2053 | #ifdef KAB_EMBEDDED |
2009 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 2054 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
2010 | this, SLOT( showLicence() ), actionCollection(), | 2055 | this, SLOT( showLicence() ), actionCollection(), |
2011 | "licence_about_data" ); | 2056 | "licence_about_data" ); |
2012 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 2057 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
2013 | this, SLOT( faq() ), actionCollection(), | 2058 | this, SLOT( faq() ), actionCollection(), |
2014 | "faq_about_data" ); | 2059 | "faq_about_data" ); |
2015 | mActionWN = new KAction( i18n( "What's New?" ), 0, | 2060 | mActionWN = new KAction( i18n( "What's New?" ), 0, |
2016 | this, SLOT( whatsnew() ), actionCollection(), | 2061 | this, SLOT( whatsnew() ), actionCollection(), |
2017 | "wn" ); | 2062 | "wn" ); |
2018 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, | 2063 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, |
2019 | this, SLOT( synchowto() ), actionCollection(), | 2064 | this, SLOT( synchowto() ), actionCollection(), |
2020 | "sync" ); | 2065 | "sync" ); |
2021 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, | 2066 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, |
2022 | this, SLOT( kdesynchowto() ), actionCollection(), | 2067 | this, SLOT( kdesynchowto() ), actionCollection(), |
2023 | "kdesync" ); | 2068 | "kdesync" ); |
2024 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, | 2069 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, |
2025 | this, SLOT( multisynchowto() ), actionCollection(), | 2070 | this, SLOT( multisynchowto() ), actionCollection(), |
2026 | "multisync" ); | 2071 | "multisync" ); |
2027 | 2072 | ||
2028 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 2073 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
2029 | this, SLOT( createAboutData() ), actionCollection(), | 2074 | this, SLOT( createAboutData() ), actionCollection(), |
2030 | "kaddressbook_about_data" ); | 2075 | "kaddressbook_about_data" ); |
2031 | #endif //KAB_EMBEDDED | 2076 | #endif //KAB_EMBEDDED |
2032 | 2077 | ||
2033 | clipboardDataChanged(); | 2078 | clipboardDataChanged(); |
2034 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2079 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2035 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2080 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2036 | } | 2081 | } |
2037 | 2082 | ||
2038 | //US we need this function, to plug all actions into the correct menues. | 2083 | //US we need this function, to plug all actions into the correct menues. |
2039 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 2084 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
2040 | void KABCore::addActionsManually() | 2085 | void KABCore::addActionsManually() |
2041 | { | 2086 | { |
2042 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 2087 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
2043 | 2088 | ||
2044 | #ifdef KAB_EMBEDDED | 2089 | #ifdef KAB_EMBEDDED |
2045 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 2090 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
2046 | QPopupMenu *editMenu = new QPopupMenu( this ); | 2091 | QPopupMenu *editMenu = new QPopupMenu( this ); |
2047 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 2092 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
2048 | 2093 | ||
2049 | KToolBar* tb = mMainWindow->toolBar(); | 2094 | KToolBar* tb = mMainWindow->toolBar(); |
2050 | 2095 | ||
2051 | #ifndef DESKTOP_VERSION | 2096 | #ifndef DESKTOP_VERSION |
2052 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { | 2097 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { |
2053 | #endif | 2098 | #endif |
2054 | QMenuBar* mb = mMainWindow->menuBar(); | 2099 | QMenuBar* mb = mMainWindow->menuBar(); |
2055 | 2100 | ||
2056 | //US setup menubar. | 2101 | //US setup menubar. |
2057 | //Disable the following block if you do not want to have a menubar. | 2102 | //Disable the following block if you do not want to have a menubar. |
2058 | mb->insertItem( i18n("&File"), fileMenu ); | 2103 | mb->insertItem( i18n("&File"), fileMenu ); |
2059 | mb->insertItem( i18n("&Edit"), editMenu ); | 2104 | mb->insertItem( i18n("&Edit"), editMenu ); |
2060 | mb->insertItem( i18n("&View"), viewMenu ); | 2105 | mb->insertItem( i18n("&View"), viewMenu ); |
2061 | mb->insertItem( i18n("&Settings"), settingsMenu ); | 2106 | mb->insertItem( i18n("&Settings"), settingsMenu ); |
2062 | mb->insertItem( i18n("Synchronize"), syncMenu ); | 2107 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
@@ -2075,128 +2120,129 @@ void KABCore::addActionsManually() | |||
2075 | 2120 | ||
2076 | tb->enableMoving(false); | 2121 | tb->enableMoving(false); |
2077 | popupBarTB->insertItem( i18n("&File"), fileMenu ); | 2122 | popupBarTB->insertItem( i18n("&File"), fileMenu ); |
2078 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); | 2123 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); |
2079 | popupBarTB->insertItem( i18n("&View"), viewMenu ); | 2124 | popupBarTB->insertItem( i18n("&View"), viewMenu ); |
2080 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); | 2125 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); |
2081 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 2126 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
2082 | mViewManager->getFilterAction()->plug ( popupBarTB); | 2127 | mViewManager->getFilterAction()->plug ( popupBarTB); |
2083 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); | 2128 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); |
2084 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); | 2129 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); |
2085 | if (QApplication::desktop()->width() > 320 ) { | 2130 | if (QApplication::desktop()->width() > 320 ) { |
2086 | // mViewManager->getFilterAction()->plug ( tb); | 2131 | // mViewManager->getFilterAction()->plug ( tb); |
2087 | } | 2132 | } |
2088 | } | 2133 | } |
2089 | #endif | 2134 | #endif |
2090 | // mActionQuit->plug ( mMainWindow->toolBar()); | 2135 | // mActionQuit->plug ( mMainWindow->toolBar()); |
2091 | 2136 | ||
2092 | 2137 | ||
2093 | 2138 | ||
2094 | //US Now connect the actions with the menue entries. | 2139 | //US Now connect the actions with the menue entries. |
2095 | mActionPrint->plug( fileMenu ); | 2140 | mActionPrint->plug( fileMenu ); |
2096 | mActionMail->plug( fileMenu ); | 2141 | mActionMail->plug( fileMenu ); |
2097 | fileMenu->insertSeparator(); | 2142 | fileMenu->insertSeparator(); |
2098 | 2143 | ||
2099 | mActionNewContact->plug( fileMenu ); | 2144 | mActionNewContact->plug( fileMenu ); |
2100 | mActionNewContact->plug( tb ); | 2145 | mActionNewContact->plug( tb ); |
2101 | 2146 | ||
2102 | mActionEditAddressee->plug( fileMenu ); | 2147 | mActionEditAddressee->plug( fileMenu ); |
2103 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 2148 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
2104 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 2149 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
2105 | mActionEditAddressee->plug( tb ); | 2150 | mActionEditAddressee->plug( tb ); |
2106 | 2151 | ||
2107 | fileMenu->insertSeparator(); | 2152 | fileMenu->insertSeparator(); |
2108 | mActionSave->plug( fileMenu ); | 2153 | mActionSave->plug( fileMenu ); |
2109 | fileMenu->insertItem( "&Import", ImportMenu ); | 2154 | fileMenu->insertItem( "&Import", ImportMenu ); |
2110 | fileMenu->insertItem( "&Export", ExportMenu ); | 2155 | fileMenu->insertItem( "&Export", ExportMenu ); |
2111 | fileMenu->insertItem( i18n("&Change"), changeMenu ); | 2156 | fileMenu->insertItem( i18n("&Change"), changeMenu ); |
2112 | #ifndef DESKTOP_VERSION | 2157 | #ifndef DESKTOP_VERSION |
2113 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); | 2158 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); |
2114 | #endif | 2159 | #endif |
2115 | 2160 | ||
2116 | fileMenu->insertSeparator(); | 2161 | fileMenu->insertSeparator(); |
2117 | mActionMailVCard->plug( fileMenu ); | 2162 | mActionMailVCard->plug( fileMenu ); |
2118 | #ifndef DESKTOP_VERSION | 2163 | #ifndef DESKTOP_VERSION |
2119 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); | 2164 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); |
2120 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); | 2165 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); |
2121 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); | 2166 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); |
2122 | #endif | 2167 | #endif |
2123 | fileMenu->insertSeparator(); | 2168 | fileMenu->insertSeparator(); |
2124 | mActionQuit->plug( fileMenu ); | 2169 | mActionQuit->plug( fileMenu ); |
2125 | #ifdef _WIN32_ | 2170 | #ifdef _WIN32_ |
2126 | mActionImportOL->plug( ImportMenu ); | 2171 | mActionImportOL->plug( ImportMenu ); |
2127 | #endif | 2172 | #endif |
2128 | // edit menu | 2173 | // edit menu |
2129 | mActionUndo->plug( editMenu ); | 2174 | mActionUndo->plug( editMenu ); |
2130 | mActionRedo->plug( editMenu ); | 2175 | mActionRedo->plug( editMenu ); |
2131 | editMenu->insertSeparator(); | 2176 | editMenu->insertSeparator(); |
2132 | mActionCut->plug( editMenu ); | 2177 | mActionCut->plug( editMenu ); |
2133 | mActionCopy->plug( editMenu ); | 2178 | mActionCopy->plug( editMenu ); |
2134 | mActionPaste->plug( editMenu ); | 2179 | mActionPaste->plug( editMenu ); |
2135 | mActionDelete->plug( editMenu ); | 2180 | mActionDelete->plug( editMenu ); |
2136 | editMenu->insertSeparator(); | 2181 | editMenu->insertSeparator(); |
2137 | mActionSelectAll->plug( editMenu ); | 2182 | mActionSelectAll->plug( editMenu ); |
2138 | 2183 | ||
2184 | mActionSetFormattedName->plug( changeMenu ); | ||
2139 | mActionRemoveVoice->plug( changeMenu ); | 2185 | mActionRemoveVoice->plug( changeMenu ); |
2140 | // settings menu | 2186 | // settings menu |
2141 | //US special menuentry to configure the addressbook resources. On KDE | 2187 | //US special menuentry to configure the addressbook resources. On KDE |
2142 | // you do that through the control center !!! | 2188 | // you do that through the control center !!! |
2143 | mActionConfigResources->plug( settingsMenu ); | 2189 | mActionConfigResources->plug( settingsMenu ); |
2144 | settingsMenu->insertSeparator(); | 2190 | settingsMenu->insertSeparator(); |
2145 | 2191 | ||
2146 | mActionConfigKAddressbook->plug( settingsMenu ); | 2192 | mActionConfigKAddressbook->plug( settingsMenu ); |
2147 | 2193 | ||
2148 | if ( mIsPart ) { | 2194 | if ( mIsPart ) { |
2149 | //US not implemented yet | 2195 | //US not implemented yet |
2150 | //mActionConfigShortcuts->plug( settingsMenu ); | 2196 | //mActionConfigShortcuts->plug( settingsMenu ); |
2151 | //mActionConfigureToolbars->plug( settingsMenu ); | 2197 | //mActionConfigureToolbars->plug( settingsMenu ); |
2152 | 2198 | ||
2153 | } else { | 2199 | } else { |
2154 | //US not implemented yet | 2200 | //US not implemented yet |
2155 | //mActionKeyBindings->plug( settingsMenu ); | 2201 | //mActionKeyBindings->plug( settingsMenu ); |
2156 | } | 2202 | } |
2157 | 2203 | ||
2158 | settingsMenu->insertSeparator(); | 2204 | settingsMenu->insertSeparator(); |
2159 | 2205 | ||
2160 | mActionJumpBar->plug( settingsMenu ); | 2206 | mActionJumpBar->plug( settingsMenu ); |
2161 | mActionDetails->plug( settingsMenu ); | 2207 | mActionDetails->plug( settingsMenu ); |
2162 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2208 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2163 | mActionDetails->plug( tb ); | 2209 | mActionDetails->plug( tb ); |
2164 | settingsMenu->insertSeparator(); | 2210 | settingsMenu->insertSeparator(); |
2165 | #ifndef DESKTOP_VERSION | 2211 | #ifndef DESKTOP_VERSION |
2166 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); | 2212 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); |
2167 | #endif | 2213 | #endif |
2168 | settingsMenu->insertSeparator(); | 2214 | settingsMenu->insertSeparator(); |
2169 | 2215 | ||
2170 | mActionWhoAmI->plug( settingsMenu ); | 2216 | mActionWhoAmI->plug( settingsMenu ); |
2171 | mActionEditCategories->plug( settingsMenu ); | 2217 | mActionEditCategories->plug( settingsMenu ); |
2172 | mActionEditCategories->plug( changeMenu ); | 2218 | mActionEditCategories->plug( changeMenu ); |
2173 | mActionCategories->plug( changeMenu ); | 2219 | mActionCategories->plug( changeMenu ); |
2174 | mActionManageCategories->plug( changeMenu ); | 2220 | mActionManageCategories->plug( changeMenu ); |
2175 | 2221 | ||
2176 | mActionCategories->plug( settingsMenu ); | 2222 | mActionCategories->plug( settingsMenu ); |
2177 | mActionManageCategories->plug( settingsMenu ); | 2223 | mActionManageCategories->plug( settingsMenu ); |
2178 | 2224 | ||
2179 | 2225 | ||
2180 | mActionWN->plug( helpMenu ); | 2226 | mActionWN->plug( helpMenu ); |
2181 | mActionSyncHowto->plug( helpMenu ); | 2227 | mActionSyncHowto->plug( helpMenu ); |
2182 | mActionKdeSyncHowto->plug( helpMenu ); | 2228 | mActionKdeSyncHowto->plug( helpMenu ); |
2183 | mActionMultiSyncHowto->plug( helpMenu ); | 2229 | mActionMultiSyncHowto->plug( helpMenu ); |
2184 | mActionFaq->plug( helpMenu ); | 2230 | mActionFaq->plug( helpMenu ); |
2185 | mActionLicence->plug( helpMenu ); | 2231 | mActionLicence->plug( helpMenu ); |
2186 | mActionAboutKAddressbook->plug( helpMenu ); | 2232 | mActionAboutKAddressbook->plug( helpMenu ); |
2187 | 2233 | ||
2188 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2234 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2189 | 2235 | ||
2190 | mActionSave->plug( tb ); | 2236 | mActionSave->plug( tb ); |
2191 | mViewManager->getFilterAction()->plug ( tb); | 2237 | mViewManager->getFilterAction()->plug ( tb); |
2192 | //LR hide filteraction on started in 480x640 | 2238 | //LR hide filteraction on started in 480x640 |
2193 | if (QApplication::desktop()->width() == 480 ) { | 2239 | if (QApplication::desktop()->width() == 480 ) { |
2194 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 2240 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
2195 | } | 2241 | } |
2196 | mActionUndo->plug( tb ); | 2242 | mActionUndo->plug( tb ); |
2197 | mActionDelete->plug( tb ); | 2243 | mActionDelete->plug( tb ); |
2198 | mActionRedo->plug( tb ); | 2244 | mActionRedo->plug( tb ); |
2199 | } else { | 2245 | } else { |
2200 | mActionSave->plug( tb ); | 2246 | mActionSave->plug( tb ); |
2201 | tb->enableMoving(false); | 2247 | tb->enableMoving(false); |
2202 | } | 2248 | } |
@@ -2241,133 +2287,164 @@ void KABCore::manageCategories( ) | |||
2241 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2287 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2242 | if ( !cp->exec() ) { | 2288 | if ( !cp->exec() ) { |
2243 | delete cp; | 2289 | delete cp; |
2244 | return; | 2290 | return; |
2245 | } | 2291 | } |
2246 | int count = 0; | 2292 | int count = 0; |
2247 | message( i18n("Please wait, processing categories...")); | 2293 | message( i18n("Please wait, processing categories...")); |
2248 | if ( cp->addCat() ) { | 2294 | if ( cp->addCat() ) { |
2249 | KABC::AddressBook::Iterator it; | 2295 | KABC::AddressBook::Iterator it; |
2250 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2296 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2251 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2297 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2252 | QStringList catIncList = (*it).categories(); | 2298 | QStringList catIncList = (*it).categories(); |
2253 | int i; | 2299 | int i; |
2254 | for( i = 0; i< catIncList.count(); ++i ) { | 2300 | for( i = 0; i< catIncList.count(); ++i ) { |
2255 | if ( !catList.contains (catIncList[i])) { | 2301 | if ( !catList.contains (catIncList[i])) { |
2256 | catList.append( catIncList[i] ); | 2302 | catList.append( catIncList[i] ); |
2257 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2303 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2258 | ++count; | 2304 | ++count; |
2259 | } | 2305 | } |
2260 | } | 2306 | } |
2261 | } | 2307 | } |
2262 | catList.sort(); | 2308 | catList.sort(); |
2263 | KABPrefs::instance()->mCustomCategories = catList; | 2309 | KABPrefs::instance()->mCustomCategories = catList; |
2264 | KABPrefs::instance()->writeConfig(); | 2310 | KABPrefs::instance()->writeConfig(); |
2265 | message(QString::number( count )+ i18n(" categories added to list! ")); | 2311 | message(QString::number( count )+ i18n(" categories added to list! ")); |
2266 | } else { | 2312 | } else { |
2267 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2313 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2268 | QStringList catIncList; | 2314 | QStringList catIncList; |
2269 | QStringList newCatList; | 2315 | QStringList newCatList; |
2270 | KABC::AddressBook::Iterator it; | 2316 | KABC::AddressBook::Iterator it; |
2271 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2317 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2272 | QStringList catIncList = (*it).categories(); | 2318 | QStringList catIncList = (*it).categories(); |
2273 | int i; | 2319 | int i; |
2274 | if ( catIncList.count() ) { | 2320 | if ( catIncList.count() ) { |
2275 | newCatList.clear(); | 2321 | newCatList.clear(); |
2276 | for( i = 0; i< catIncList.count(); ++i ) { | 2322 | for( i = 0; i< catIncList.count(); ++i ) { |
2277 | if ( catList.contains (catIncList[i])) { | 2323 | if ( catList.contains (catIncList[i])) { |
2278 | newCatList.append( catIncList[i] ); | 2324 | newCatList.append( catIncList[i] ); |
2279 | } | 2325 | } |
2280 | } | 2326 | } |
2281 | newCatList.sort(); | 2327 | newCatList.sort(); |
2282 | (*it).setCategories( newCatList ); | 2328 | (*it).setCategories( newCatList ); |
2283 | mAddressBook->insertAddressee( (*it) ); | 2329 | mAddressBook->insertAddressee( (*it) ); |
2284 | } | 2330 | } |
2285 | } | 2331 | } |
2286 | setModified( true ); | 2332 | setModified( true ); |
2287 | mViewManager->refreshView(); | 2333 | mViewManager->refreshView(); |
2288 | message( i18n("Removing categories done!")); | 2334 | message( i18n("Removing categories done!")); |
2289 | } | 2335 | } |
2290 | delete cp; | 2336 | delete cp; |
2291 | } | 2337 | } |
2292 | void KABCore::removeVoice() | 2338 | void KABCore::removeVoice() |
2293 | { | 2339 | { |
2294 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 2340 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
2295 | return; | 2341 | return; |
2296 | KABC::Addressee::List list; | 2342 | KABC::Addressee::List list; |
2297 | XXPortSelectDialog dlg( this, false, this ); | 2343 | XXPortSelectDialog dlg( this, false, this ); |
2298 | if ( dlg.exec() ) | 2344 | if ( dlg.exec() ) |
2299 | list = dlg.contacts(); | 2345 | list = dlg.contacts(); |
2300 | else | 2346 | else |
2301 | return; | 2347 | return; |
2302 | KABC::Addressee::List::Iterator it; | 2348 | KABC::Addressee::List::Iterator it; |
2303 | for ( it = list.begin(); it != list.end(); ++it ) { | 2349 | for ( it = list.begin(); it != list.end(); ++it ) { |
2304 | if ( (*it).removeVoice() ) | 2350 | if ( (*it).removeVoice() ) |
2305 | contactModified((*it) ); | 2351 | addrModified((*it), false ); |
2306 | } | 2352 | } |
2307 | } | 2353 | } |
2308 | 2354 | ||
2309 | 2355 | void KABCore::setFormattedName() | |
2356 | { | ||
2357 | KABFormatPrefs setpref; | ||
2358 | if ( !setpref.exec() ) { | ||
2359 | return; | ||
2360 | } | ||
2361 | KABC::Addressee::List list; | ||
2362 | XXPortSelectDialog dlg( this, false, this ); | ||
2363 | if ( dlg.exec() ) | ||
2364 | list = dlg.contacts(); | ||
2365 | else | ||
2366 | return; | ||
2367 | KABC::Addressee::List::Iterator it; | ||
2368 | for ( it = list.begin(); it != list.end(); ++it ) { | ||
2369 | QString fName; | ||
2370 | if ( setpref.simple->isChecked() ) | ||
2371 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); | ||
2372 | else if ( setpref.full->isChecked() ) | ||
2373 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); | ||
2374 | else if ( setpref.reverse->isChecked() ) | ||
2375 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); | ||
2376 | else | ||
2377 | fName = (*it).organization(); | ||
2378 | if ( setpref.setCompany->isChecked() ) | ||
2379 | if ( fName.isEmpty() || fName =="," ) | ||
2380 | fName = (*it).organization(); | ||
2381 | (*it).setFormattedName( fName ); | ||
2382 | addrModified((*it),false ); | ||
2383 | } | ||
2384 | Addressee add; | ||
2385 | mDetails->setAddressee( add ); | ||
2386 | } | ||
2310 | 2387 | ||
2311 | void KABCore::clipboardDataChanged() | 2388 | void KABCore::clipboardDataChanged() |
2312 | { | 2389 | { |
2313 | 2390 | ||
2314 | if ( mReadWrite ) | 2391 | if ( mReadWrite ) |
2315 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2392 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2316 | 2393 | ||
2317 | } | 2394 | } |
2318 | 2395 | ||
2319 | void KABCore::updateActionMenu() | 2396 | void KABCore::updateActionMenu() |
2320 | { | 2397 | { |
2321 | UndoStack *undo = UndoStack::instance(); | 2398 | UndoStack *undo = UndoStack::instance(); |
2322 | RedoStack *redo = RedoStack::instance(); | 2399 | RedoStack *redo = RedoStack::instance(); |
2323 | 2400 | ||
2324 | if ( undo->isEmpty() ) | 2401 | if ( undo->isEmpty() ) |
2325 | mActionUndo->setText( i18n( "Undo" ) ); | 2402 | mActionUndo->setText( i18n( "Undo" ) ); |
2326 | else | 2403 | else |
2327 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2404 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2328 | 2405 | ||
2329 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2406 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2330 | 2407 | ||
2331 | if ( !redo->top() ) | 2408 | if ( !redo->top() ) |
2332 | mActionRedo->setText( i18n( "Redo" ) ); | 2409 | mActionRedo->setText( i18n( "Redo" ) ); |
2333 | else | 2410 | else |
2334 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2411 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2335 | 2412 | ||
2336 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2413 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2337 | } | 2414 | } |
2338 | 2415 | ||
2339 | void KABCore::configureKeyBindings() | 2416 | void KABCore::configureKeyBindings() |
2340 | { | 2417 | { |
2341 | #ifndef KAB_EMBEDDED | 2418 | #ifndef KAB_EMBEDDED |
2342 | KKeyDialog::configure( actionCollection(), true ); | 2419 | KKeyDialog::configure( actionCollection(), true ); |
2343 | #else //KAB_EMBEDDED | 2420 | #else //KAB_EMBEDDED |
2344 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2421 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2345 | #endif //KAB_EMBEDDED | 2422 | #endif //KAB_EMBEDDED |
2346 | } | 2423 | } |
2347 | 2424 | ||
2348 | #ifdef KAB_EMBEDDED | 2425 | #ifdef KAB_EMBEDDED |
2349 | void KABCore::configureResources() | 2426 | void KABCore::configureResources() |
2350 | { | 2427 | { |
2351 | KRES::KCMKResources dlg( this, "" , 0 ); | 2428 | KRES::KCMKResources dlg( this, "" , 0 ); |
2352 | 2429 | ||
2353 | if ( !dlg.exec() ) | 2430 | if ( !dlg.exec() ) |
2354 | return; | 2431 | return; |
2355 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2432 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2356 | } | 2433 | } |
2357 | #endif //KAB_EMBEDDED | 2434 | #endif //KAB_EMBEDDED |
2358 | 2435 | ||
2359 | 2436 | ||
2360 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2437 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2361 | * for the attendees list of an event. | 2438 | * for the attendees list of an event. |
2362 | */ | 2439 | */ |
2363 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2440 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2364 | { | 2441 | { |
2365 | QStringList nameList; | 2442 | QStringList nameList; |
2366 | QStringList emailList; | 2443 | QStringList emailList; |
2367 | QStringList uidList; | 2444 | QStringList uidList; |
2368 | 2445 | ||
2369 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2446 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2370 | uint i=0; | 2447 | uint i=0; |
2371 | for (i=0; i < list.count(); i++) | 2448 | for (i=0; i < list.count(); i++) |
2372 | { | 2449 | { |
2373 | nameList.append(list[i].realName()); | 2450 | nameList.append(list[i].realName()); |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 85ffbdb..0d5891e 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -217,299 +217,302 @@ class KABCore : public QWidget, public KSyncInterface | |||
217 | */ | 217 | */ |
218 | void cutContacts(); | 218 | void cutContacts(); |
219 | 219 | ||
220 | /** | 220 | /** |
221 | Paste contacts from clipboard into the address book. | 221 | Paste contacts from clipboard into the address book. |
222 | */ | 222 | */ |
223 | void pasteContacts(); | 223 | void pasteContacts(); |
224 | 224 | ||
225 | /** | 225 | /** |
226 | Paste given contacts into the address book. | 226 | Paste given contacts into the address book. |
227 | 227 | ||
228 | @param list The list of addressee, which shall be pasted. | 228 | @param list The list of addressee, which shall be pasted. |
229 | */ | 229 | */ |
230 | void pasteContacts( KABC::Addressee::List &list ); | 230 | void pasteContacts( KABC::Addressee::List &list ); |
231 | 231 | ||
232 | /** | 232 | /** |
233 | Sets the whoAmI contact, that is used by many other programs to | 233 | Sets the whoAmI contact, that is used by many other programs to |
234 | get personal information about the current user. | 234 | get personal information about the current user. |
235 | */ | 235 | */ |
236 | void setWhoAmI(); | 236 | void setWhoAmI(); |
237 | 237 | ||
238 | /** | 238 | /** |
239 | Displays the category dialog and applies the result to all | 239 | Displays the category dialog and applies the result to all |
240 | selected contacts. | 240 | selected contacts. |
241 | */ | 241 | */ |
242 | void setCategories(); | 242 | void setCategories(); |
243 | void manageCategories(); | 243 | void manageCategories(); |
244 | void editCategories(); | 244 | void editCategories(); |
245 | 245 | ||
246 | /** | 246 | /** |
247 | Sets the field list of the Incremental Search Widget. | 247 | Sets the field list of the Incremental Search Widget. |
248 | */ | 248 | */ |
249 | void setSearchFields( const KABC::Field::List &fields ); | 249 | void setSearchFields( const KABC::Field::List &fields ); |
250 | 250 | ||
251 | /** | 251 | /** |
252 | Search with the current search field for a contact, that matches | 252 | Search with the current search field for a contact, that matches |
253 | the given text, and selects it in the view. | 253 | the given text, and selects it in the view. |
254 | */ | 254 | */ |
255 | void incrementalSearch( const QString& text ); | 255 | void incrementalSearch( const QString& text ); |
256 | 256 | ||
257 | /** | 257 | /** |
258 | Marks the address book as modified. | 258 | Marks the address book as modified. |
259 | */ | 259 | */ |
260 | void setModified(); | 260 | void setModified(); |
261 | /** | 261 | /** |
262 | Marks the address book as modified without refreshing the view. | 262 | Marks the address book as modified without refreshing the view. |
263 | */ | 263 | */ |
264 | void setModifiedWOrefresh(); | 264 | void setModifiedWOrefresh(); |
265 | 265 | ||
266 | /** | 266 | /** |
267 | Marks the address book as modified concerning the argument. | 267 | Marks the address book as modified concerning the argument. |
268 | */ | 268 | */ |
269 | void setModified( bool modified ); | 269 | void setModified( bool modified ); |
270 | 270 | ||
271 | /** | 271 | /** |
272 | Returns whether the address book is modified. | 272 | Returns whether the address book is modified. |
273 | */ | 273 | */ |
274 | bool modified() const; | 274 | bool modified() const; |
275 | 275 | ||
276 | /** | 276 | /** |
277 | Called whenever an contact is modified in the contact editor | 277 | Called whenever an contact is modified in the contact editor |
278 | dialog or the quick edit. | 278 | dialog or the quick edit. |
279 | */ | 279 | */ |
280 | void contactModified( const KABC::Addressee &addr ); | 280 | void contactModified( const KABC::Addressee &addr ); |
281 | void addrModified( const KABC::Addressee &addr, bool updateDetails = true ); | ||
281 | 282 | ||
282 | /** | 283 | /** |
283 | DCOP METHODS. | 284 | DCOP METHODS. |
284 | */ | 285 | */ |
285 | void addEmail( QString addr ); | 286 | void addEmail( QString addr ); |
286 | void importVCard( const KURL& url, bool showPreview ); | 287 | void importVCard( const KURL& url, bool showPreview ); |
287 | void importVCard( const QString& vCard, bool showPreview ); | 288 | void importVCard( const QString& vCard, bool showPreview ); |
288 | void newContact(); | 289 | void newContact(); |
289 | QString getNameByPhone( const QString& phone ); | 290 | QString getNameByPhone( const QString& phone ); |
290 | /** | 291 | /** |
291 | END DCOP METHODS | 292 | END DCOP METHODS |
292 | */ | 293 | */ |
293 | 294 | ||
294 | /** | 295 | /** |
295 | Saves the contents of the AddressBook back to disk. | 296 | Saves the contents of the AddressBook back to disk. |
296 | */ | 297 | */ |
297 | void save(); | 298 | void save(); |
298 | 299 | ||
299 | /** | 300 | /** |
300 | Undos the last command using the undo stack. | 301 | Undos the last command using the undo stack. |
301 | */ | 302 | */ |
302 | void undo(); | 303 | void undo(); |
303 | 304 | ||
304 | /** | 305 | /** |
305 | Redos the last command that was undone, using the redo stack. | 306 | Redos the last command that was undone, using the redo stack. |
306 | */ | 307 | */ |
307 | void redo(); | 308 | void redo(); |
308 | 309 | ||
309 | /** | 310 | /** |
310 | Shows the edit dialog for the given uid. If the uid is QString::null, | 311 | Shows the edit dialog for the given uid. If the uid is QString::null, |
311 | the method will try to find a selected addressee in the view. | 312 | the method will try to find a selected addressee in the view. |
312 | */ | 313 | */ |
313 | void editContact( const QString &uid /*US = QString::null*/ ); | 314 | void editContact( const QString &uid /*US = QString::null*/ ); |
314 | //US added a second method without defaultparameter | 315 | //US added a second method without defaultparameter |
315 | void editContact2(); | 316 | void editContact2(); |
316 | 317 | ||
317 | /** | 318 | /** |
318 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 319 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
319 | the method will try to find a selected addressee in the view. | 320 | the method will try to find a selected addressee in the view. |
320 | */ | 321 | */ |
321 | void executeContact( const QString &uid /*US = QString::null*/ ); | 322 | void executeContact( const QString &uid /*US = QString::null*/ ); |
322 | 323 | ||
323 | /** | 324 | /** |
324 | Launches the configuration dialog. | 325 | Launches the configuration dialog. |
325 | */ | 326 | */ |
326 | void openConfigDialog(); | 327 | void openConfigDialog(); |
327 | 328 | ||
328 | /** | 329 | /** |
329 | Launches the ldap search dialog. | 330 | Launches the ldap search dialog. |
330 | */ | 331 | */ |
331 | void openLDAPDialog(); | 332 | void openLDAPDialog(); |
332 | 333 | ||
333 | /** | 334 | /** |
334 | Creates a KAddressBookPrinter, which will display the print | 335 | Creates a KAddressBookPrinter, which will display the print |
335 | dialog and do the printing. | 336 | dialog and do the printing. |
336 | */ | 337 | */ |
337 | void print(); | 338 | void print(); |
338 | 339 | ||
339 | /** | 340 | /** |
340 | Registers a new GUI client, so plugins can register its actions. | 341 | Registers a new GUI client, so plugins can register its actions. |
341 | */ | 342 | */ |
342 | void addGUIClient( KXMLGUIClient *client ); | 343 | void addGUIClient( KXMLGUIClient *client ); |
343 | 344 | ||
344 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 345 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
345 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 346 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
346 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 347 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
347 | 348 | ||
348 | 349 | ||
349 | signals: | 350 | signals: |
350 | void contactSelected( const QString &name ); | 351 | void contactSelected( const QString &name ); |
351 | void contactSelected( const QPixmap &pixmap ); | 352 | void contactSelected( const QPixmap &pixmap ); |
352 | public slots: | 353 | public slots: |
353 | void recieve(QString cmsg ); | 354 | void recieve(QString cmsg ); |
354 | void getFile( bool success ); | 355 | void getFile( bool success ); |
355 | void syncFileRequest(); | 356 | void syncFileRequest(); |
356 | void setDetailsVisible( bool visible ); | 357 | void setDetailsVisible( bool visible ); |
357 | void setDetailsToState(); | 358 | void setDetailsToState(); |
358 | 359 | ||
359 | void saveSettings(); | 360 | void saveSettings(); |
360 | 361 | ||
361 | private slots: | 362 | private slots: |
362 | void updateToolBar(); | 363 | void updateToolBar(); |
363 | void updateMainWindow(); | 364 | void updateMainWindow(); |
364 | void receive( const QCString& cmsg, const QByteArray& data ); | 365 | void receive( const QCString& cmsg, const QByteArray& data ); |
365 | void toggleBeamReceive( ); | 366 | void toggleBeamReceive( ); |
366 | void disableBR(bool); | 367 | void disableBR(bool); |
367 | void setJumpButtonBarVisible( bool visible ); | 368 | void setJumpButtonBarVisible( bool visible ); |
368 | void setCaptionBack(); | 369 | void setCaptionBack(); |
369 | void importFromOL(); | 370 | void importFromOL(); |
370 | void extensionModified( const KABC::Addressee::List &list ); | 371 | void extensionModified( const KABC::Addressee::List &list ); |
371 | void extensionChanged( int id ); | 372 | void extensionChanged( int id ); |
372 | void clipboardDataChanged(); | 373 | void clipboardDataChanged(); |
373 | void updateActionMenu(); | 374 | void updateActionMenu(); |
374 | void configureKeyBindings(); | 375 | void configureKeyBindings(); |
375 | void removeVoice(); | 376 | void removeVoice(); |
377 | void setFormattedName(); | ||
376 | #ifdef KAB_EMBEDDED | 378 | #ifdef KAB_EMBEDDED |
377 | void configureResources(); | 379 | void configureResources(); |
378 | #endif //KAB_EMBEDDED | 380 | #endif //KAB_EMBEDDED |
379 | 381 | ||
380 | void slotEditorDestroyed( const QString &uid ); | 382 | void slotEditorDestroyed( const QString &uid ); |
381 | void configurationChanged(); | 383 | void configurationChanged(); |
382 | void addressBookChanged(); | 384 | void addressBookChanged(); |
383 | 385 | ||
384 | private: | 386 | private: |
385 | void resizeEvent(QResizeEvent* e ); | 387 | void resizeEvent(QResizeEvent* e ); |
386 | bool mBRdisabled; | 388 | bool mBRdisabled; |
387 | #ifndef DESKTOP_VERSION | 389 | #ifndef DESKTOP_VERSION |
388 | QCopChannel* infrared; | 390 | QCopChannel* infrared; |
389 | #endif | 391 | #endif |
390 | QTimer *mMessageTimer; | 392 | QTimer *mMessageTimer; |
391 | void initGUI(); | 393 | void initGUI(); |
392 | void initActions(); | 394 | void initActions(); |
393 | QString getPhoneFile(); | 395 | QString getPhoneFile(); |
394 | 396 | ||
395 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 397 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
396 | const char *name = 0 ); | 398 | const char *name = 0 ); |
397 | 399 | ||
398 | KXMLGUIClient *mGUIClient; | 400 | KXMLGUIClient *mGUIClient; |
399 | 401 | ||
400 | KABC::AddressBook *mAddressBook; | 402 | KABC::AddressBook *mAddressBook; |
401 | 403 | ||
402 | ViewManager *mViewManager; | 404 | ViewManager *mViewManager; |
403 | // QSplitter *mDetailsSplitter; | 405 | // QSplitter *mDetailsSplitter; |
404 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 406 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
405 | ViewContainer *mDetails; | 407 | ViewContainer *mDetails; |
406 | KDGanttMinimizeSplitter* mMiniSplitter; | 408 | KDGanttMinimizeSplitter* mMiniSplitter; |
407 | XXPortManager *mXXPortManager; | 409 | XXPortManager *mXXPortManager; |
408 | JumpButtonBar *mJumpButtonBar; | 410 | JumpButtonBar *mJumpButtonBar; |
409 | IncSearchWidget *mIncSearchWidget; | 411 | IncSearchWidget *mIncSearchWidget; |
410 | ExtensionManager *mExtensionManager; | 412 | ExtensionManager *mExtensionManager; |
411 | 413 | ||
412 | KCMultiDialog *mConfigureDialog; | 414 | KCMultiDialog *mConfigureDialog; |
413 | 415 | ||
414 | #ifndef KAB_EMBEDDED | 416 | #ifndef KAB_EMBEDDED |
415 | LDAPSearchDialog *mLdapSearchDialog; | 417 | LDAPSearchDialog *mLdapSearchDialog; |
416 | #endif //KAB_EMBEDDED | 418 | #endif //KAB_EMBEDDED |
417 | // QDict<AddresseeEditorDialog> mEditorDict; | 419 | // QDict<AddresseeEditorDialog> mEditorDict; |
418 | AddresseeEditorDialog *mEditorDialog; | 420 | AddresseeEditorDialog *mEditorDialog; |
419 | bool mReadWrite; | 421 | bool mReadWrite; |
420 | bool mModified; | 422 | bool mModified; |
421 | bool mIsPart; | 423 | bool mIsPart; |
422 | bool mMultipleViewsAtOnce; | 424 | bool mMultipleViewsAtOnce; |
423 | 425 | ||
424 | 426 | ||
425 | //US file menu | 427 | //US file menu |
426 | KAction *mActionMail; | 428 | KAction *mActionMail; |
427 | KAction *mActionBeam; | 429 | KAction *mActionBeam; |
428 | KToggleAction *mActionBR; | 430 | KToggleAction *mActionBR; |
429 | KAction *mActionExport2phone; | 431 | KAction *mActionExport2phone; |
430 | KAction* mActionPrint; | 432 | KAction* mActionPrint; |
431 | KAction* mActionNewContact; | 433 | KAction* mActionNewContact; |
432 | KAction *mActionSave; | 434 | KAction *mActionSave; |
433 | KAction *mActionEditAddressee; | 435 | KAction *mActionEditAddressee; |
434 | KAction *mActionMailVCard; | 436 | KAction *mActionMailVCard; |
435 | KAction *mActionBeamVCard; | 437 | KAction *mActionBeamVCard; |
436 | 438 | ||
437 | KAction *mActionQuit; | 439 | KAction *mActionQuit; |
438 | 440 | ||
439 | //US edit menu | 441 | //US edit menu |
440 | KAction *mActionCopy; | 442 | KAction *mActionCopy; |
441 | KAction *mActionCut; | 443 | KAction *mActionCut; |
442 | KAction *mActionPaste; | 444 | KAction *mActionPaste; |
443 | KAction *mActionSelectAll; | 445 | KAction *mActionSelectAll; |
444 | KAction *mActionUndo; | 446 | KAction *mActionUndo; |
445 | KAction *mActionRedo; | 447 | KAction *mActionRedo; |
446 | KAction *mActionDelete; | 448 | KAction *mActionDelete; |
447 | 449 | ||
448 | //US settings menu | 450 | //US settings menu |
449 | KAction *mActionConfigResources; | 451 | KAction *mActionConfigResources; |
450 | KAction *mActionConfigKAddressbook; | 452 | KAction *mActionConfigKAddressbook; |
451 | KAction *mActionConfigShortcuts; | 453 | KAction *mActionConfigShortcuts; |
452 | KAction *mActionConfigureToolbars; | 454 | KAction *mActionConfigureToolbars; |
453 | KAction *mActionKeyBindings; | 455 | KAction *mActionKeyBindings; |
454 | KToggleAction *mActionJumpBar; | 456 | KToggleAction *mActionJumpBar; |
455 | KToggleAction *mActionDetails; | 457 | KToggleAction *mActionDetails; |
456 | KAction *mActionWhoAmI; | 458 | KAction *mActionWhoAmI; |
457 | KAction *mActionCategories; | 459 | KAction *mActionCategories; |
458 | KAction *mActionEditCategories; | 460 | KAction *mActionEditCategories; |
459 | KAction *mActionManageCategories; | 461 | KAction *mActionManageCategories; |
460 | KAction *mActionAboutKAddressbook; | 462 | KAction *mActionAboutKAddressbook; |
461 | KAction *mActionLicence; | 463 | KAction *mActionLicence; |
462 | KAction *mActionFaq; | 464 | KAction *mActionFaq; |
463 | KAction *mActionWN; | 465 | KAction *mActionWN; |
464 | KAction *mActionSyncHowto; | 466 | KAction *mActionSyncHowto; |
465 | KAction *mActionKdeSyncHowto; | 467 | KAction *mActionKdeSyncHowto; |
466 | KAction *mActionMultiSyncHowto; | 468 | KAction *mActionMultiSyncHowto; |
467 | 469 | ||
468 | KAction *mActionDeleteView; | 470 | KAction *mActionDeleteView; |
469 | 471 | ||
470 | QPopupMenu *viewMenu; | 472 | QPopupMenu *viewMenu; |
471 | QPopupMenu *filterMenu; | 473 | QPopupMenu *filterMenu; |
472 | QPopupMenu *settingsMenu; | 474 | QPopupMenu *settingsMenu; |
473 | QPopupMenu *changeMenu; | 475 | QPopupMenu *changeMenu; |
474 | QPopupMenu *beamMenu; | 476 | QPopupMenu *beamMenu; |
475 | //US QAction *mActionSave; | 477 | //US QAction *mActionSave; |
476 | QPopupMenu *ImportMenu; | 478 | QPopupMenu *ImportMenu; |
477 | QPopupMenu *ExportMenu; | 479 | QPopupMenu *ExportMenu; |
478 | //LR additional methods | 480 | //LR additional methods |
479 | KAction *mActionRemoveVoice; | 481 | KAction *mActionRemoveVoice; |
482 | KAction *mActionSetFormattedName; | ||
480 | KAction * mActionImportOL; | 483 | KAction * mActionImportOL; |
481 | 484 | ||
482 | #ifndef KAB_EMBEDDED | 485 | #ifndef KAB_EMBEDDED |
483 | KAddressBookService *mAddressBookService; | 486 | KAddressBookService *mAddressBookService; |
484 | #endif //KAB_EMBEDDED | 487 | #endif //KAB_EMBEDDED |
485 | 488 | ||
486 | class KABCorePrivate; | 489 | class KABCorePrivate; |
487 | KABCorePrivate *d; | 490 | KABCorePrivate *d; |
488 | //US bool mBlockSaveFlag; | 491 | //US bool mBlockSaveFlag; |
489 | 492 | ||
490 | #ifdef KAB_EMBEDDED | 493 | #ifdef KAB_EMBEDDED |
491 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 494 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
492 | #endif //KAB_EMBEDDED | 495 | #endif //KAB_EMBEDDED |
493 | 496 | ||
494 | //this are the overwritten callbackmethods from the syncinterface | 497 | //this are the overwritten callbackmethods from the syncinterface |
495 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 498 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
496 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 499 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
497 | virtual void removeSyncInfo( QString syncProfile); | 500 | virtual void removeSyncInfo( QString syncProfile); |
498 | bool syncPhone(); | 501 | bool syncPhone(); |
499 | void message( QString m ); | 502 | void message( QString m ); |
500 | 503 | ||
501 | // LR ******************************* | 504 | // LR ******************************* |
502 | // sync stuff! | 505 | // sync stuff! |
503 | QString sentSyncFile(); | 506 | QString sentSyncFile(); |
504 | QPopupMenu *syncMenu; | 507 | QPopupMenu *syncMenu; |
505 | KSyncManager* syncManager; | 508 | KSyncManager* syncManager; |
506 | int mGlobalSyncMode; | 509 | int mGlobalSyncMode; |
507 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 510 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
508 | KABC::Addressee getLastSyncAddressee(); | 511 | KABC::Addressee getLastSyncAddressee(); |
509 | QDateTime mLastAddressbookSync; | 512 | QDateTime mLastAddressbookSync; |
510 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 513 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |
511 | // ********************* | 514 | // ********************* |
512 | 515 | ||
513 | }; | 516 | }; |
514 | 517 | ||
515 | #endif | 518 | #endif |
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index db123da..a2095d4 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp | |||
@@ -1,127 +1,127 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | //US#ifdef KAB_EMBEDDED | 24 | //US#ifdef KAB_EMBEDDED |
25 | //#include <qstring.h> | 25 | //#include <qstring.h> |
26 | //#endif //KAB_EMBEDDED | 26 | //#endif //KAB_EMBEDDED |
27 | 27 | ||
28 | #include <qtextstream.h> | 28 | #include <qtextstream.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qregexp.h> | 30 | #include <qregexp.h> |
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | #include <libkdepim/kpimglobalprefs.h> | 32 | #include <libkdepim/kpimglobalprefs.h> |
33 | 33 | ||
34 | #include <kconfig.h> | 34 | #include <kconfig.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kstaticdeleter.h> | 36 | #include <kstaticdeleter.h> |
37 | //US#include <kdebug.h> // defines kdDebug() | 37 | //US#include <kdebug.h> // defines kdDebug() |
38 | 38 | ||
39 | #include "kabprefs.h" | 39 | #include "kabprefs.h" |
40 | 40 | ||
41 | #ifdef DESKTOP_VERSION | 41 | #ifdef DESKTOP_VERSION |
42 | #include <qapplication.h> | 42 | #include <qapplication.h> |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | KABPrefs *KABPrefs::sInstance = 0; | 45 | KABPrefs *KABPrefs::sInstance = 0; |
46 | static KStaticDeleter<KABPrefs> staticDeleterAB; | 46 | static KStaticDeleter<KABPrefs> staticDeleterAB; |
47 | 47 | ||
48 | KABPrefs::KABPrefs() | 48 | KABPrefs::KABPrefs() |
49 | : KPimPrefs("kaddressbookrc") | 49 | : KPimPrefs("kaddressbookrc") |
50 | { | 50 | { |
51 | mDetailsFont = QFont("helvetica",12); | 51 | mDetailsFont = QFont("helvetica",12); |
52 | KPrefs::setCurrentGroup( "Views" ); | 52 | KPrefs::setCurrentGroup( "Views" ); |
53 | addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); | 53 | addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); |
54 | 54 | ||
55 | KPrefs::setCurrentGroup( "General" ); | 55 | KPrefs::setCurrentGroup( "General" ); |
56 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); | 56 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); |
57 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); | 57 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); |
58 | 58 | ||
59 | #ifdef KAB_EMBEDDED | 59 | #ifdef KAB_EMBEDDED |
60 | addItemBool("AskForQuit",&mAskForQuit,true); | 60 | addItemBool("AskForQuit",&mAskForQuit,true); |
61 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 61 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
62 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 62 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
63 | addItemBool("SearchWithReturn",&mSearchWithReturn, true ); | 63 | addItemBool("SearchWithReturn",&mSearchWithReturn, false ); |
64 | addItemFont("DetailsFont",&mDetailsFont); | 64 | addItemFont("DetailsFont",&mDetailsFont); |
65 | 65 | ||
66 | 66 | ||
67 | #endif //KAB_EMBEDDED | 67 | #endif //KAB_EMBEDDED |
68 | 68 | ||
69 | KPrefs::setCurrentGroup( "MainWindow" ); | 69 | KPrefs::setCurrentGroup( "MainWindow" ); |
70 | bool m_visible = false; | 70 | bool m_visible = false; |
71 | #ifdef DESKTOP_VERSION | 71 | #ifdef DESKTOP_VERSION |
72 | m_visible = true; | 72 | m_visible = true; |
73 | #endif | 73 | #endif |
74 | addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible ); | 74 | addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible ); |
75 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); | 75 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); |
76 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); | 76 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); |
77 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); | 77 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); |
78 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); | 78 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); |
79 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); | 79 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); |
80 | 80 | ||
81 | 81 | ||
82 | KPrefs::setCurrentGroup( "Extensions_General" ); | 82 | KPrefs::setCurrentGroup( "Extensions_General" ); |
83 | QStringList defaultExtensions; | 83 | QStringList defaultExtensions; |
84 | defaultExtensions << "merge"; | 84 | defaultExtensions << "merge"; |
85 | defaultExtensions << "distribution_list_editor"; | 85 | defaultExtensions << "distribution_list_editor"; |
86 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); | 86 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); |
87 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); | 87 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); |
88 | 88 | ||
89 | KPrefs::setCurrentGroup( "Views" ); | 89 | KPrefs::setCurrentGroup( "Views" ); |
90 | QString defaultView = i18n( "Default Table View" ); | 90 | QString defaultView = i18n( "Default Table View" ); |
91 | addItemString( "CurrentView", &mCurrentView, defaultView ); | 91 | addItemString( "CurrentView", &mCurrentView, defaultView ); |
92 | addItemStringList( "ViewNames", &mViewNames, defaultView ); | 92 | addItemStringList( "ViewNames", &mViewNames, defaultView ); |
93 | 93 | ||
94 | KPrefs::setCurrentGroup( "Filters" ); | 94 | KPrefs::setCurrentGroup( "Filters" ); |
95 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); | 95 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); |
96 | 96 | ||
97 | } | 97 | } |
98 | 98 | ||
99 | KABPrefs::~KABPrefs() | 99 | KABPrefs::~KABPrefs() |
100 | { | 100 | { |
101 | //qDebug("KABPrefs::~KABPrefs() "); | 101 | //qDebug("KABPrefs::~KABPrefs() "); |
102 | if (sInstance == this) | 102 | if (sInstance == this) |
103 | sInstance = staticDeleterAB.setObject(0); | 103 | sInstance = staticDeleterAB.setObject(0); |
104 | } | 104 | } |
105 | 105 | ||
106 | KABPrefs *KABPrefs::instance() | 106 | KABPrefs *KABPrefs::instance() |
107 | { | 107 | { |
108 | if ( !sInstance ) { | 108 | if ( !sInstance ) { |
109 | #ifdef KAB_EMBEDDED | 109 | #ifdef KAB_EMBEDDED |
110 | sInstance = staticDeleterAB.setObject( new KABPrefs() ); | 110 | sInstance = staticDeleterAB.setObject( new KABPrefs() ); |
111 | #else //KAB_EMBEDDED | 111 | #else //KAB_EMBEDDED |
112 | //US the following line has changed ???. Why | 112 | //US the following line has changed ???. Why |
113 | staticDeleterAB.setObject( sInstance, new KABPrefs() ); | 113 | staticDeleterAB.setObject( sInstance, new KABPrefs() ); |
114 | #endif //KAB_EMBEDDED | 114 | #endif //KAB_EMBEDDED |
115 | sInstance->readConfig(); | 115 | sInstance->readConfig(); |
116 | } | 116 | } |
117 | 117 | ||
118 | return sInstance; | 118 | return sInstance; |
119 | } | 119 | } |
120 | 120 | ||
121 | void KABPrefs::setCategoryDefaults() | 121 | void KABPrefs::setCategoryDefaults() |
122 | { | 122 | { |
123 | mCustomCategories.clear(); | 123 | mCustomCategories.clear(); |
124 | 124 | ||
125 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) | 125 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) |
126 | << i18n( "Customer" ) << i18n( "Friend" ); | 126 | << i18n( "Customer" ) << i18n( "Friend" ); |
127 | } | 127 | } |
diff --git a/kaddressbook/kcmconfigs/addresseewidget.cpp b/kaddressbook/kcmconfigs/addresseewidget.cpp index eb5bdd9..168d39e 100644 --- a/kaddressbook/kcmconfigs/addresseewidget.cpp +++ b/kaddressbook/kcmconfigs/addresseewidget.cpp | |||
@@ -157,87 +157,82 @@ void NamePartWidget::textChanged( const QString& text ) | |||
157 | AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name ) | 157 | AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name ) |
158 | : QWidget( parent, name ) | 158 | : QWidget( parent, name ) |
159 | { | 159 | { |
160 | QGridLayout *layout; | 160 | QGridLayout *layout; |
161 | 161 | ||
162 | mPrefix = new NamePartWidget( i18n( "Prefixes" ), this ); | 162 | mPrefix = new NamePartWidget( i18n( "Prefixes" ), this ); |
163 | mInclusion = new NamePartWidget( i18n( "Inclusions" ), this ); | 163 | mInclusion = new NamePartWidget( i18n( "Inclusions" ), this ); |
164 | mSuffix = new NamePartWidget( i18n( "Suffixes" ), this ); | 164 | mSuffix = new NamePartWidget( i18n( "Suffixes" ), this ); |
165 | QString dfn; | 165 | QString dfn; |
166 | if (QApplication::desktop()->width() > 320 ) | 166 | if (QApplication::desktop()->width() > 320 ) |
167 | dfn = i18n( "Default formatted name:" ); | 167 | dfn = i18n( "Default formatted name:" ); |
168 | else | 168 | else |
169 | dfn = i18n( "Def. formatted name:" ); | 169 | dfn = i18n( "Def. formatted name:" ); |
170 | 170 | ||
171 | QLabel *label = new QLabel( dfn, this ); | 171 | QLabel *label = new QLabel( dfn, this ); |
172 | 172 | ||
173 | mFormattedNameCombo = new KComboBox( this ); | 173 | mFormattedNameCombo = new KComboBox( this ); |
174 | mFormattedNameCombo->insertItem( i18n( "Empty" ) ); | 174 | mFormattedNameCombo->insertItem( i18n( "Empty" ) ); |
175 | mFormattedNameCombo->insertItem( i18n( "Simple Name" ) ); | 175 | mFormattedNameCombo->insertItem( i18n( "Simple Name" ) ); |
176 | mFormattedNameCombo->insertItem( i18n( "Full Name" ) ); | 176 | mFormattedNameCombo->insertItem( i18n( "Full Name" ) ); |
177 | mFormattedNameCombo->insertItem( i18n( "Reverse Name" ) ); | 177 | mFormattedNameCombo->insertItem( i18n( "Reverse Name" ) ); |
178 | 178 | ||
179 | if (KGlobal::getOrientation() == KGlobal::Portrait) | 179 | if (KGlobal::getOrientation() == KGlobal::Portrait) |
180 | { | 180 | { |
181 | layout = new QGridLayout( this, 4, 2, KDialog::marginHintSmall(), | 181 | layout = new QGridLayout( this, 4, 2, KDialog::marginHintSmall(), |
182 | KDialog::spacingHintSmall() ); | 182 | KDialog::spacingHintSmall() ); |
183 | 183 | ||
184 | layout->addMultiCellWidget( mPrefix, 0, 0, 0, 1 ); | 184 | layout->addMultiCellWidget( mPrefix, 0, 0, 0, 1 ); |
185 | layout->addMultiCellWidget( mInclusion, 1, 1, 0, 1 ); | 185 | layout->addMultiCellWidget( mInclusion, 1, 1, 0, 1 ); |
186 | layout->addMultiCellWidget( mSuffix, 2, 2, 0, 1 ); | 186 | layout->addMultiCellWidget( mSuffix, 2, 2, 0, 1 ); |
187 | layout->addWidget( label, 3, 0 ); | 187 | layout->addWidget( label, 3, 0 ); |
188 | layout->addWidget( mFormattedNameCombo, 3, 1 ); | 188 | layout->addWidget( mFormattedNameCombo, 3, 1 ); |
189 | 189 | ||
190 | } | 190 | } |
191 | else | 191 | else |
192 | { | 192 | { |
193 | layout = new QGridLayout( this, 2, 3, KDialog::marginHint(), | 193 | layout = new QGridLayout( this, 2, 3, KDialog::marginHint(), |
194 | KDialog::spacingHint() ); | 194 | KDialog::spacingHint() ); |
195 | 195 | ||
196 | layout->addWidget( mPrefix, 0, 0 ); | 196 | layout->addWidget( mPrefix, 0, 0 ); |
197 | layout->addWidget( mInclusion, 0, 1 ); | 197 | layout->addWidget( mInclusion, 0, 1 ); |
198 | layout->addWidget( mSuffix, 0, 2 ); | 198 | layout->addWidget( mSuffix, 0, 2 ); |
199 | layout->addWidget( label, 1, 0 ); | 199 | layout->addWidget( label, 1, 0 ); |
200 | layout->addMultiCellWidget( mFormattedNameCombo, 1, 1, 1, 2 ); | 200 | layout->addMultiCellWidget( mFormattedNameCombo, 1, 1, 1, 2 ); |
201 | } | 201 | } |
202 | 202 | ||
203 | connect( mPrefix, SIGNAL( modified() ), SIGNAL( modified() ) ); | 203 | connect( mPrefix, SIGNAL( modified() ), SIGNAL( modified() ) ); |
204 | connect( mInclusion, SIGNAL( modified() ), SIGNAL( modified() ) ); | 204 | connect( mInclusion, SIGNAL( modified() ), SIGNAL( modified() ) ); |
205 | connect( mSuffix, SIGNAL( modified() ), SIGNAL( modified() ) ); | 205 | connect( mSuffix, SIGNAL( modified() ), SIGNAL( modified() ) ); |
206 | connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SIGNAL( modified() ) ); | 206 | connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SIGNAL( modified() ) ); |
207 | } | 207 | } |
208 | 208 | ||
209 | AddresseeWidget::~AddresseeWidget() | 209 | AddresseeWidget::~AddresseeWidget() |
210 | { | 210 | { |
211 | } | 211 | } |
212 | 212 | ||
213 | void AddresseeWidget::restoreSettings() | 213 | void AddresseeWidget::restoreSettings() |
214 | { | 214 | { |
215 | KConfig config( locateLocal("config", "kabcrc") ); | 215 | KConfig config( locateLocal("config", "kabcrc") ); |
216 | config.setGroup( "General" ); | 216 | config.setGroup( "General" ); |
217 | 217 | ||
218 | mPrefix->setNameParts( config.readListEntry( "Prefixes" ) ); | 218 | mPrefix->setNameParts( config.readListEntry( "Prefixes" ) ); |
219 | mInclusion->setNameParts( config.readListEntry( "Inclusions" ) ); | 219 | mInclusion->setNameParts( config.readListEntry( "Inclusions" ) ); |
220 | mSuffix->setNameParts( config.readListEntry( "Suffixes" ) ); | 220 | mSuffix->setNameParts( config.readListEntry( "Suffixes" ) ); |
221 | 221 | mFormattedNameCombo->setCurrentItem( config.readNumEntry( "FormattedNameType", 1 ) ); | |
222 | KConfig cfg( locateLocal("config","kaddressbookrc") ); | ||
223 | cfg.setGroup( "General" ); | ||
224 | mFormattedNameCombo->setCurrentItem( cfg.readNumEntry( "FormattedNameType", 1 ) ); | ||
225 | } | 222 | } |
226 | 223 | ||
227 | void AddresseeWidget::saveSettings() | 224 | void AddresseeWidget::saveSettings() |
228 | { | 225 | { |
226 | qDebug("AddresseeWidget::saveSettings() "); | ||
229 | KConfig config( locateLocal("config","kabcrc") ); | 227 | KConfig config( locateLocal("config","kabcrc") ); |
230 | config.setGroup( "General" ); | 228 | config.setGroup( "General" ); |
231 | 229 | ||
232 | config.writeEntry( "Prefixes", mPrefix->nameParts() ); | 230 | config.writeEntry( "Prefixes", mPrefix->nameParts() ); |
233 | config.writeEntry( "Inclusions", mInclusion->nameParts() ); | 231 | config.writeEntry( "Inclusions", mInclusion->nameParts() ); |
234 | config.writeEntry( "Suffixes", mSuffix->nameParts() ); | 232 | config.writeEntry( "Suffixes", mSuffix->nameParts() ); |
235 | 233 | config.writeEntry( "FormattedNameType", mFormattedNameCombo->currentItem() ); | |
236 | KConfig cfg( locateLocal("config","kaddressbookrc") ); | ||
237 | cfg.setGroup( "General" ); | ||
238 | cfg.writeEntry( "FormattedNameType", mFormattedNameCombo->currentItem() ); | ||
239 | } | 234 | } |
240 | 235 | ||
241 | #ifndef KAB_EMBEDDED | 236 | #ifndef KAB_EMBEDDED |
242 | #include "addresseewidget.moc" | 237 | #include "addresseewidget.moc" |
243 | #endif //KAB_EMBEDDED | 238 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp index 8213c2b..f5dba0f 100644 --- a/kaddressbook/nameeditdialog.cpp +++ b/kaddressbook/nameeditdialog.cpp | |||
@@ -164,130 +164,132 @@ NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type, | |||
164 | connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); | 164 | connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); |
165 | connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); | 165 | connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); |
166 | connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); | 166 | connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); |
167 | connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); | 167 | connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); |
168 | connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); | 168 | connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); |
169 | connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); | 169 | connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); |
170 | connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); | 170 | connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); |
171 | connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); | 171 | connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); |
172 | connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( modified() ) ); | 172 | connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( modified() ) ); |
173 | connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); | 173 | connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); |
174 | 174 | ||
175 | updateTypeCombo(); | 175 | updateTypeCombo(); |
176 | mFormattedNameCombo->setCurrentItem( type ); | 176 | mFormattedNameCombo->setCurrentItem( type ); |
177 | 177 | ||
178 | 178 | ||
179 | mChanged = false; | 179 | mChanged = false; |
180 | } | 180 | } |
181 | 181 | ||
182 | NameEditDialog::~NameEditDialog() | 182 | NameEditDialog::~NameEditDialog() |
183 | { | 183 | { |
184 | } | 184 | } |
185 | 185 | ||
186 | QString NameEditDialog::familyName() const | 186 | QString NameEditDialog::familyName() const |
187 | { | 187 | { |
188 | return mFamilyNameEdit->text(); | 188 | return mFamilyNameEdit->text(); |
189 | } | 189 | } |
190 | 190 | ||
191 | QString NameEditDialog::givenName() const | 191 | QString NameEditDialog::givenName() const |
192 | { | 192 | { |
193 | return mGivenNameEdit->text(); | 193 | return mGivenNameEdit->text(); |
194 | } | 194 | } |
195 | 195 | ||
196 | QString NameEditDialog::prefix() const | 196 | QString NameEditDialog::prefix() const |
197 | { | 197 | { |
198 | return mPrefixCombo->currentText(); | 198 | return mPrefixCombo->currentText(); |
199 | } | 199 | } |
200 | 200 | ||
201 | QString NameEditDialog::suffix() const | 201 | QString NameEditDialog::suffix() const |
202 | { | 202 | { |
203 | return mSuffixCombo->currentText(); | 203 | return mSuffixCombo->currentText(); |
204 | } | 204 | } |
205 | 205 | ||
206 | QString NameEditDialog::additionalName() const | 206 | QString NameEditDialog::additionalName() const |
207 | { | 207 | { |
208 | return mAdditionalNameEdit->text(); | 208 | return mAdditionalNameEdit->text(); |
209 | } | 209 | } |
210 | 210 | ||
211 | QString NameEditDialog::customFormattedName() const | 211 | QString NameEditDialog::customFormattedName() const |
212 | { | 212 | { |
213 | return mFormattedNameEdit->text(); | 213 | return mFormattedNameEdit->text(); |
214 | } | 214 | } |
215 | 215 | ||
216 | int NameEditDialog::formattedNameType() const | 216 | int NameEditDialog::formattedNameType() const |
217 | { | 217 | { |
218 | return mFormattedNameCombo->currentItem(); | 218 | return mFormattedNameCombo->currentItem(); |
219 | } | 219 | } |
220 | 220 | ||
221 | bool NameEditDialog::changed() const | 221 | bool NameEditDialog::changed() const |
222 | { | 222 | { |
223 | return mChanged; | 223 | return mChanged; |
224 | } | 224 | } |
225 | 225 | ||
226 | QString NameEditDialog::formattedName( const KABC::Addressee &addr, int type ) | 226 | QString NameEditDialog::formattedName( const KABC::Addressee &addr, int type ) |
227 | { | 227 | { |
228 | QString retval; | ||
228 | switch ( type ) { | 229 | switch ( type ) { |
229 | case SimpleName: | 230 | case SimpleName: |
230 | return addr.givenName() + " " + addr.familyName(); | 231 | retval = addr.givenName() + " " + addr.familyName(); |
231 | break; | 232 | break; |
232 | case FullName: | 233 | case FullName: |
233 | return addr.prefix() + " " + addr.givenName() + " " + | 234 | retval =addr.prefix() + " " + addr.givenName() + " " + |
234 | addr.additionalName() + " " + addr.familyName() + " " + | 235 | addr.additionalName() + " " + addr.familyName() + " " + |
235 | addr.suffix(); | 236 | addr.suffix(); |
236 | break; | 237 | break; |
237 | case ReverseName: | 238 | case ReverseName: |
238 | return addr.familyName() + ", " + addr.givenName(); | 239 | retval = addr.familyName() + ", " + addr.givenName(); |
239 | break; | 240 | break; |
240 | default: | 241 | default: |
241 | return ""; | 242 | return ""; |
242 | break; | 243 | break; |
243 | } | 244 | } |
245 | return retval.stripWhiteSpace (); | ||
244 | } | 246 | } |
245 | 247 | ||
246 | void NameEditDialog::parseBoxChanged( bool value ) | 248 | void NameEditDialog::parseBoxChanged( bool value ) |
247 | { | 249 | { |
248 | //AddresseeConfig::instance()->setUid( addr.uid() ); | 250 | //AddresseeConfig::instance()->setUid( addr.uid() ); |
249 | AddresseeConfig::instance()->setAutomaticNameParsing( value ); | 251 | AddresseeConfig::instance()->setAutomaticNameParsing( value ); |
250 | } | 252 | } |
251 | 253 | ||
252 | void NameEditDialog::typeChanged( int pos ) | 254 | void NameEditDialog::typeChanged( int pos ) |
253 | { | 255 | { |
254 | mFormattedNameEdit->setEnabled( pos == 0 ); | 256 | mFormattedNameEdit->setEnabled( pos == 0 ); |
255 | } | 257 | } |
256 | 258 | ||
257 | void NameEditDialog::modified() | 259 | void NameEditDialog::modified() |
258 | { | 260 | { |
259 | mChanged = true; | 261 | mChanged = true; |
260 | } | 262 | } |
261 | 263 | ||
262 | void NameEditDialog::updateTypeCombo() | 264 | void NameEditDialog::updateTypeCombo() |
263 | { | 265 | { |
264 | KABC::Addressee addr; | 266 | KABC::Addressee addr; |
265 | addr.setPrefix( mPrefixCombo->currentText() ); | 267 | addr.setPrefix( mPrefixCombo->currentText() ); |
266 | addr.setGivenName( mGivenNameEdit->text() ); | 268 | addr.setGivenName( mGivenNameEdit->text() ); |
267 | addr.setAdditionalName( mAdditionalNameEdit->text() ); | 269 | addr.setAdditionalName( mAdditionalNameEdit->text() ); |
268 | addr.setFamilyName( mFamilyNameEdit->text() ); | 270 | addr.setFamilyName( mFamilyNameEdit->text() ); |
269 | addr.setSuffix( mSuffixCombo->currentText() ); | 271 | addr.setSuffix( mSuffixCombo->currentText() ); |
270 | 272 | ||
271 | int pos = mFormattedNameCombo->currentItem(); | 273 | int pos = mFormattedNameCombo->currentItem(); |
272 | 274 | ||
273 | mFormattedNameCombo->clear(); | 275 | mFormattedNameCombo->clear(); |
274 | mFormattedNameCombo->insertItem( i18n( "Custom" ) ); | 276 | mFormattedNameCombo->insertItem( i18n( "Custom" ) ); |
275 | mFormattedNameCombo->insertItem( formattedName( addr, SimpleName ) ); | 277 | mFormattedNameCombo->insertItem( formattedName( addr, SimpleName ) ); |
276 | mFormattedNameCombo->insertItem( formattedName( addr, FullName ) ); | 278 | mFormattedNameCombo->insertItem( formattedName( addr, FullName ) ); |
277 | mFormattedNameCombo->insertItem( formattedName( addr, ReverseName ) ); | 279 | mFormattedNameCombo->insertItem( formattedName( addr, ReverseName ) ); |
278 | 280 | ||
279 | mFormattedNameCombo->setCurrentItem( pos ); | 281 | mFormattedNameCombo->setCurrentItem( pos ); |
280 | } | 282 | } |
281 | 283 | ||
282 | void NameEditDialog::slotHelp() | 284 | void NameEditDialog::slotHelp() |
283 | { | 285 | { |
284 | #ifndef KAB_EMBEDDED | 286 | #ifndef KAB_EMBEDDED |
285 | kapp->invokeHelp( "managing-contacts-automatic-nameparsing" ); | 287 | kapp->invokeHelp( "managing-contacts-automatic-nameparsing" ); |
286 | #else //KAB_EMBEDDED | 288 | #else //KAB_EMBEDDED |
287 | qDebug("NameEditDialog::slotHelp Help is not supported yet"); | 289 | qDebug("NameEditDialog::slotHelp Help is not supported yet"); |
288 | #endif //KAB_EMBEDDED | 290 | #endif //KAB_EMBEDDED |
289 | } | 291 | } |
290 | 292 | ||
291 | #ifndef KAB_EMBEDDED | 293 | #ifndef KAB_EMBEDDED |
292 | #include "nameeditdialog.moc" | 294 | #include "nameeditdialog.moc" |
293 | #endif //KAB_EMBEDDED | 295 | #endif //KAB_EMBEDDED |