-rw-r--r-- | kaddressbook/kabcore.cpp | 61 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 7 |
2 files changed, 14 insertions, 54 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 2c2f1a0..83027ac 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -959,16 +959,18 @@ void KABCore::setWhoAmI() void KABCore::setCategories() { KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); - if ( !dlg.exec() ) - return; - + if ( !dlg.exec() ) { + message( i18n("Setting categories cancelled") ); + return; + } bool merge = false; QString msg = i18n( "Merge with existing categories?" ); if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) merge = true; + message( i18n("Setting categories ... please wait!") ); QStringList categories = dlg.selectedCategories(); QStringList uids = mViewManager->selectedUids(); QStringList::Iterator it; @@ -992,8 +994,9 @@ void KABCore::setCategories() } if ( uids.count() > 0 ) setModified( true ); + message( i18n("Setting categories completed!") ); } void KABCore::setSearchFields( const KABC::Field::List &fields ) { @@ -1883,17 +1886,13 @@ void KABCore::initActions() mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, SLOT( removeVoice() ), actionCollection(), "remove_voice" ); - mActionSetCat= new KAction( i18n( "Set categories..." ), 0, this, - SLOT( setCat() ), actionCollection(), + mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, + SLOT( manageCategories() ), actionCollection(), "remove_voice" ); - mActionAddCat= new KAction( i18n( "Add categories..." ), 0, this, - SLOT( addCat() ), actionCollection(), - "remove_voice" ); - mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, SLOT( importFromOL() ), actionCollection(), "import_OL" ); #ifdef KAB_EMBEDDED @@ -2021,10 +2020,8 @@ void KABCore::addActionsManually() editMenu->insertSeparator(); mActionSelectAll->plug( editMenu ); mActionRemoveVoice->plug( changeMenu ); - mActionSetCat->plug( changeMenu ); - mActionAddCat->plug( changeMenu ); // settings menu //US special menuentry to configure the addressbook resources. On KDE // you do that through the control center !!! mActionConfigResources->plug( settingsMenu ); @@ -2053,8 +2050,9 @@ void KABCore::addActionsManually() settingsMenu->insertSeparator(); mActionWhoAmI->plug( settingsMenu ); mActionCategories->plug( settingsMenu ); + mActionManageCategories->plug( settingsMenu ); mActionWN->plug( helpMenu ); mActionSyncHowto->plug( helpMenu ); @@ -2105,47 +2103,12 @@ void KABCore::addActionsManually() void KABCore::showLicence() { KApplication::showLicence(); } -void KABCore::setCat() -{ - setCategories( true ); -} -void KABCore::addCat() -{ - setCategories( false ); -} -void KABCore::setCategories( bool removeOld ) + +void KABCore::manageCategories( ) { - KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KABPrefs::instance(), 0 ); - if (! csd->exec()) { - message( i18n("Setting categories cancelled") ); - delete csd; - return; - } - message( i18n("Setting categories ... please wait!") ); - QStringList catList = csd->selectedCategories(); - delete csd; - catList.sort(); - QStringList newList; - KABC::Addressee::List list = mViewManager->selectedAddressees(); - KABC::Addressee::List::Iterator it; - for ( it = list.begin(); it != list.end(); ++it ) { - if ( removeOld ) { - (*it).setCategories( catList ); - } else { - newList = (*it).categories(); - int i; - for( i = 0; i< catList.count(); ++i ) { - if ( !newList.contains (catList[i])) - newList.append( catList[i] ); - } - newList.sort(); - (*it).setCategories( newList ); - } - contactModified((*it) ); - } - message( i18n("Setting categories completed!") ); + } void KABCore::removeVoice() { 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 ) diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 1bdae5f..bf5398b 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h @@ -242,8 +242,9 @@ class KABCore : public QWidget, public KSyncInterface Displays the category dialog and applies the result to all selected contacts. */ void setCategories(); + void manageCategories(); /** Sets the field list of the Incremental Search Widget. */ @@ -369,11 +370,8 @@ class KABCore : public QWidget, public KSyncInterface void clipboardDataChanged(); void updateActionMenu(); void configureKeyBindings(); void removeVoice(); - void setCat(); - void addCat(); - void setCategories( bool removeOld ); #ifdef KAB_EMBEDDED void configureResources(); #endif //KAB_EMBEDDED @@ -453,8 +451,9 @@ class KABCore : public QWidget, public KSyncInterface KToggleAction *mActionJumpBar; KToggleAction *mActionDetails; KAction *mActionWhoAmI; KAction *mActionCategories; + KAction *mActionManageCategories; KAction *mActionAboutKAddressbook; KAction *mActionLicence; KAction *mActionFaq; KAction *mActionWN; @@ -472,10 +471,8 @@ class KABCore : public QWidget, public KSyncInterface QPopupMenu *ImportMenu; QPopupMenu *ExportMenu; //LR additional methods KAction *mActionRemoveVoice; - KAction *mActionSetCat; - KAction *mActionAddCat; KAction * mActionImportOL; #ifndef KAB_EMBEDDED KAddressBookService *mAddressBookService; |