-rw-r--r-- | bin/kdepim/WhatsNew.txt | 5 | ||||
-rw-r--r-- | kaddressbook/addresseeeditorwidget.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/extensionmanager.cpp | 7 | ||||
-rw-r--r-- | kaddressbook/filter.cpp | 21 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 87 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 3 | ||||
-rw-r--r-- | kaddressbook/kabprefs.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/addresseewidget.cpp | 11 | ||||
-rw-r--r-- | kaddressbook/nameeditdialog.cpp | 8 |
9 files changed, 118 insertions, 32 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index ff87423..5be1d28 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -14,4 +14,9 @@ This was only possible on the desktop, now is it possible on the Z as well. | |||
14 | Fixed of missing save settings after filter configuration. | 14 | Fixed of missing save settings after filter configuration. |
15 | Made saving of addressbook much faster. | 15 | Made saving of addressbook much faster. |
16 | Fixed extension widget layout problem. | ||
17 | Fixed saving of default formatted name settings. | ||
18 | Fixed formatted name handling in edit dialog. | ||
19 | Added an option for changing formatted names of many contacts | ||
20 | (menu: File - Change - Set formatted name). | ||
16 | 21 | ||
17 | QWhatsThis was not working on the Z ( only black rectangle was shown). | 22 | QWhatsThis was not working on the Z ( only black rectangle was shown). |
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp index 3397e06..c6993e9 100644 --- a/kaddressbook/addresseeeditorwidget.cpp +++ b/kaddressbook/addresseeeditorwidget.cpp | |||
@@ -982,9 +982,9 @@ void AddresseeEditorWidget::load() | |||
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; |
@@ -1186,4 +1186,6 @@ bool AddresseeEditorWidget::dirty() | |||
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() ); |
diff --git a/kaddressbook/extensionmanager.cpp b/kaddressbook/extensionmanager.cpp index 98561dc..efbdf17 100644 --- a/kaddressbook/extensionmanager.cpp +++ b/kaddressbook/extensionmanager.cpp | |||
@@ -59,4 +59,5 @@ ExtensionManager::ExtensionManager( KABCore *core, QWidget *parent, | |||
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); |
@@ -159,5 +160,5 @@ void ExtensionManager::createExtensionWidgets() | |||
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 ); |
@@ -181,5 +182,5 @@ void ExtensionManager::createExtensionWidgets() | |||
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 | } |
@@ -188,5 +189,5 @@ void ExtensionManager::createExtensionWidgets() | |||
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 | } |
diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp index b0d04ca..39d2ae4 100644 --- a/kaddressbook/filter.cpp +++ b/kaddressbook/filter.cpp | |||
@@ -181,15 +181,16 @@ Filter::List Filter::restore( KConfig *config, QString baseGroup ) | |||
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 | } |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index e14e579..c6288fa 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -152,4 +152,5 @@ $Id$ | |||
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 | ||
@@ -197,4 +198,39 @@ private: | |||
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 | ||
@@ -1147,5 +1183,10 @@ bool KABCore::modified() const | |||
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 | ||
@@ -1164,5 +1205,6 @@ void KABCore::contactModified( const KABC::Addressee &addr ) | |||
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 | } |
@@ -1542,5 +1584,5 @@ void KABCore::openConfigDialog() | |||
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() ) ); |
@@ -1997,4 +2039,7 @@ void KABCore::initActions() | |||
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, |
@@ -2137,4 +2182,5 @@ void KABCore::addActionsManually() | |||
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 |
@@ -2303,9 +2349,40 @@ void KABCore::removeVoice() | |||
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() |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 85ffbdb..0d5891e 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -279,4 +279,5 @@ class KABCore : public QWidget, public KSyncInterface | |||
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 | /** |
@@ -374,4 +375,5 @@ class KABCore : public QWidget, public KSyncInterface | |||
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(); |
@@ -478,4 +480,5 @@ class KABCore : public QWidget, public KSyncInterface | |||
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 | ||
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index db123da..a2095d4 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp | |||
@@ -61,5 +61,5 @@ KABPrefs::KABPrefs() | |||
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 | ||
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 | |||
@@ -219,12 +219,10 @@ void AddresseeWidget::restoreSettings() | |||
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" ); |
@@ -233,8 +231,5 @@ void AddresseeWidget::saveSettings() | |||
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 | ||
diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp index 8213c2b..f5dba0f 100644 --- a/kaddressbook/nameeditdialog.cpp +++ b/kaddressbook/nameeditdialog.cpp | |||
@@ -226,15 +226,16 @@ bool NameEditDialog::changed() const | |||
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: |
@@ -242,4 +243,5 @@ QString NameEditDialog::formattedName( const KABC::Addressee &addr, int type ) | |||
242 | break; | 243 | break; |
243 | } | 244 | } |
245 | return retval.stripWhiteSpace (); | ||
244 | } | 246 | } |
245 | 247 | ||