author | zautrix <zautrix> | 2005-01-14 19:02:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-14 19:02:53 (UTC) |
commit | 620f8de219ee34c209960f02c8296c0568dd5d8b (patch) (unidiff) | |
tree | 772170b3b9ceaf8c204e2bdd9cbb333427de30cd /kaddressbook | |
parent | 61c95ce0295f1397db6499c5b468a9fb3d32a0f4 (diff) | |
download | kdepimpi-620f8de219ee34c209960f02c8296c0568dd5d8b.zip kdepimpi-620f8de219ee34c209960f02c8296c0568dd5d8b.tar.gz kdepimpi-620f8de219ee34c209960f02c8296c0568dd5d8b.tar.bz2 |
formatted name fixes
-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 |
8 files changed, 113 insertions, 32 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp index 3397e06..c6993e9 100644 --- a/kaddressbook/addresseeeditorwidget.cpp +++ b/kaddressbook/addresseeeditorwidget.cpp | |||
@@ -952,69 +952,69 @@ void AddresseeEditorWidget::setupTab3_1() | |||
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 | ||
@@ -1156,64 +1156,66 @@ void AddresseeEditorWidget::save() | |||
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(); |
diff --git a/kaddressbook/extensionmanager.cpp b/kaddressbook/extensionmanager.cpp index 98561dc..efbdf17 100644 --- a/kaddressbook/extensionmanager.cpp +++ b/kaddressbook/extensionmanager.cpp | |||
@@ -29,64 +29,65 @@ | |||
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(); |
@@ -129,94 +130,94 @@ void ExtensionManager::setActiveExtension( int id ) | |||
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 |
diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp index b0d04ca..39d2ae4 100644 --- a/kaddressbook/filter.cpp +++ b/kaddressbook/filter.cpp | |||
@@ -151,55 +151,56 @@ void Filter::save( KConfig *config, QString baseGroup, Filter::List &list ) | |||
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 | |||
@@ -122,109 +122,145 @@ $Id$ | |||
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 ); |
@@ -1117,82 +1153,88 @@ void KABCore::incrementalSearch( const QString& text ) | |||
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; |
@@ -1512,65 +1554,65 @@ QString KABCore::getNameByPhone( const QString &phone ) | |||
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 | { |
@@ -1967,64 +2009,67 @@ void KABCore::initActions() | |||
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" ); |
@@ -2107,64 +2152,65 @@ void KABCore::addActionsManually() | |||
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 ); |
@@ -2273,69 +2319,100 @@ void KABCore::manageCategories( ) | |||
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 |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 85ffbdb..0d5891e 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -249,64 +249,65 @@ class KABCore : public QWidget, public KSyncInterface | |||
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 | */ |
@@ -344,64 +345,65 @@ class KABCore : public QWidget, public KSyncInterface | |||
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; |
@@ -448,64 +450,65 @@ class KABCore : public QWidget, public KSyncInterface | |||
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 | // ********************* |
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index db123da..a2095d4 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp | |||
@@ -31,65 +31,65 @@ | |||
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 ); |
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 | |||
@@ -189,55 +189,50 @@ AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name ) | |||
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 | |||
@@ -196,80 +196,82 @@ QString NameEditDialog::givenName() const | |||
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 ) ); |