-rw-r--r-- | kaddressbook/kabcore.cpp | 54 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 5 |
2 files changed, 57 insertions, 2 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index e6bdde9..2c2f1a0 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1875,17 +1875,25 @@ void KABCore::initActions() | |||
1875 | SLOT( setWhoAmI() ), actionCollection(), | 1875 | SLOT( setWhoAmI() ), actionCollection(), |
1876 | "set_personal" ); | 1876 | "set_personal" ); |
1877 | 1877 | ||
1878 | 1878 | ||
1879 | |||
1880 | |||
1881 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1879 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1882 | SLOT( setCategories() ), actionCollection(), | 1880 | SLOT( setCategories() ), actionCollection(), |
1883 | "edit_set_categories" ); | 1881 | "edit_set_categories" ); |
1884 | 1882 | ||
1885 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1883 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1886 | SLOT( removeVoice() ), actionCollection(), | 1884 | SLOT( removeVoice() ), actionCollection(), |
1887 | "remove_voice" ); | 1885 | "remove_voice" ); |
1886 | |||
1887 | mActionSetCat= new KAction( i18n( "Set categories..." ), 0, this, | ||
1888 | SLOT( setCat() ), actionCollection(), | ||
1889 | "remove_voice" ); | ||
1890 | |||
1891 | |||
1892 | mActionAddCat= new KAction( i18n( "Add categories..." ), 0, this, | ||
1893 | SLOT( addCat() ), actionCollection(), | ||
1894 | "remove_voice" ); | ||
1895 | |||
1888 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 1896 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
1889 | SLOT( importFromOL() ), actionCollection(), | 1897 | SLOT( importFromOL() ), actionCollection(), |
1890 | "import_OL" ); | 1898 | "import_OL" ); |
1891 | #ifdef KAB_EMBEDDED | 1899 | #ifdef KAB_EMBEDDED |
@@ -2013,8 +2021,10 @@ void KABCore::addActionsManually() | |||
2013 | editMenu->insertSeparator(); | 2021 | editMenu->insertSeparator(); |
2014 | mActionSelectAll->plug( editMenu ); | 2022 | mActionSelectAll->plug( editMenu ); |
2015 | 2023 | ||
2016 | mActionRemoveVoice->plug( changeMenu ); | 2024 | mActionRemoveVoice->plug( changeMenu ); |
2025 | mActionSetCat->plug( changeMenu ); | ||
2026 | mActionAddCat->plug( changeMenu ); | ||
2017 | // settings menu | 2027 | // settings menu |
2018 | //US special menuentry to configure the addressbook resources. On KDE | 2028 | //US special menuentry to configure the addressbook resources. On KDE |
2019 | // you do that through the control center !!! | 2029 | // you do that through the control center !!! |
2020 | mActionConfigResources->plug( settingsMenu ); | 2030 | mActionConfigResources->plug( settingsMenu ); |
@@ -2095,8 +2105,48 @@ void KABCore::addActionsManually() | |||
2095 | void KABCore::showLicence() | 2105 | void KABCore::showLicence() |
2096 | { | 2106 | { |
2097 | KApplication::showLicence(); | 2107 | KApplication::showLicence(); |
2098 | } | 2108 | } |
2109 | void KABCore::setCat() | ||
2110 | { | ||
2111 | setCategories( true ); | ||
2112 | } | ||
2113 | void KABCore::addCat() | ||
2114 | { | ||
2115 | setCategories( false ); | ||
2116 | } | ||
2117 | void KABCore::setCategories( bool removeOld ) | ||
2118 | { | ||
2119 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KABPrefs::instance(), 0 ); | ||
2120 | if (! csd->exec()) { | ||
2121 | message( i18n("Setting categories cancelled") ); | ||
2122 | delete csd; | ||
2123 | return; | ||
2124 | } | ||
2125 | message( i18n("Setting categories ... please wait!") ); | ||
2126 | QStringList catList = csd->selectedCategories(); | ||
2127 | delete csd; | ||
2128 | catList.sort(); | ||
2129 | QStringList newList; | ||
2130 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | ||
2131 | KABC::Addressee::List::Iterator it; | ||
2132 | for ( it = list.begin(); it != list.end(); ++it ) { | ||
2133 | if ( removeOld ) { | ||
2134 | (*it).setCategories( catList ); | ||
2135 | } else { | ||
2136 | newList = (*it).categories(); | ||
2137 | int i; | ||
2138 | for( i = 0; i< catList.count(); ++i ) { | ||
2139 | if ( !newList.contains (catList[i])) | ||
2140 | newList.append( catList[i] ); | ||
2141 | } | ||
2142 | newList.sort(); | ||
2143 | (*it).setCategories( newList ); | ||
2144 | } | ||
2145 | contactModified((*it) ); | ||
2146 | } | ||
2147 | message( i18n("Setting categories completed!") ); | ||
2148 | } | ||
2099 | void KABCore::removeVoice() | 2149 | void KABCore::removeVoice() |
2100 | { | 2150 | { |
2101 | 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 ) | 2151 | 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 ) |
2102 | return; | 2152 | return; |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index c01d598..1bdae5f 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -369,8 +369,11 @@ class KABCore : public QWidget, public KSyncInterface | |||
369 | void clipboardDataChanged(); | 369 | void clipboardDataChanged(); |
370 | void updateActionMenu(); | 370 | void updateActionMenu(); |
371 | void configureKeyBindings(); | 371 | void configureKeyBindings(); |
372 | void removeVoice(); | 372 | void removeVoice(); |
373 | void setCat(); | ||
374 | void addCat(); | ||
375 | void setCategories( bool removeOld ); | ||
373 | #ifdef KAB_EMBEDDED | 376 | #ifdef KAB_EMBEDDED |
374 | void configureResources(); | 377 | void configureResources(); |
375 | #endif //KAB_EMBEDDED | 378 | #endif //KAB_EMBEDDED |
376 | 379 | ||
@@ -469,8 +472,10 @@ class KABCore : public QWidget, public KSyncInterface | |||
469 | QPopupMenu *ImportMenu; | 472 | QPopupMenu *ImportMenu; |
470 | QPopupMenu *ExportMenu; | 473 | QPopupMenu *ExportMenu; |
471 | //LR additional methods | 474 | //LR additional methods |
472 | KAction *mActionRemoveVoice; | 475 | KAction *mActionRemoveVoice; |
476 | KAction *mActionSetCat; | ||
477 | KAction *mActionAddCat; | ||
473 | KAction * mActionImportOL; | 478 | KAction * mActionImportOL; |
474 | 479 | ||
475 | #ifndef KAB_EMBEDDED | 480 | #ifndef KAB_EMBEDDED |
476 | KAddressBookService *mAddressBookService; | 481 | KAddressBookService *mAddressBookService; |