author | zautrix <zautrix> | 2004-10-30 01:00:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-30 01:00:42 (UTC) |
commit | c477fa8ba7eacfaba3d154a72153acc7bc46abdc (patch) (unidiff) | |
tree | 0ba938ac70b5f878515432a7ba36525f6167be3f /kaddressbook | |
parent | af857a738da80e9eb68cf311832d44ecb9caf1dd (diff) | |
download | kdepimpi-c477fa8ba7eacfaba3d154a72153acc7bc46abdc.zip kdepimpi-c477fa8ba7eacfaba3d154a72153acc7bc46abdc.tar.gz kdepimpi-c477fa8ba7eacfaba3d154a72153acc7bc46abdc.tar.bz2 |
AARGG. I just noticed, that set categories was alreday there. removed my second implementation
-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 | |||
@@ -962,5 +962,6 @@ void KABCore::setCategories() | |||
962 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 962 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
963 | if ( !dlg.exec() ) | 963 | if ( !dlg.exec() ) { |
964 | return; | 964 | message( i18n("Setting categories cancelled") ); |
965 | 965 | return; | |
966 | } | ||
966 | bool merge = false; | 967 | bool merge = false; |
@@ -970,2 +971,3 @@ void KABCore::setCategories() | |||
970 | 971 | ||
972 | message( i18n("Setting categories ... please wait!") ); | ||
971 | QStringList categories = dlg.selectedCategories(); | 973 | QStringList categories = dlg.selectedCategories(); |
@@ -995,2 +997,3 @@ void KABCore::setCategories() | |||
995 | setModified( true ); | 997 | setModified( true ); |
998 | message( i18n("Setting categories completed!") ); | ||
996 | } | 999 | } |
@@ -1886,4 +1889,4 @@ void KABCore::initActions() | |||
1886 | 1889 | ||
1887 | mActionSetCat= new KAction( i18n( "Set categories..." ), 0, this, | 1890 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, |
1888 | SLOT( setCat() ), actionCollection(), | 1891 | SLOT( manageCategories() ), actionCollection(), |
1889 | "remove_voice" ); | 1892 | "remove_voice" ); |
@@ -1891,6 +1894,2 @@ void KABCore::initActions() | |||
1891 | 1894 | ||
1892 | mActionAddCat= new KAction( i18n( "Add categories..." ), 0, this, | ||
1893 | SLOT( addCat() ), actionCollection(), | ||
1894 | "remove_voice" ); | ||
1895 | |||
1896 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 1895 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
@@ -2024,4 +2023,2 @@ void KABCore::addActionsManually() | |||
2024 | mActionRemoveVoice->plug( changeMenu ); | 2023 | mActionRemoveVoice->plug( changeMenu ); |
2025 | mActionSetCat->plug( changeMenu ); | ||
2026 | mActionAddCat->plug( changeMenu ); | ||
2027 | // settings menu | 2024 | // settings menu |
@@ -2056,2 +2053,3 @@ void KABCore::addActionsManually() | |||
2056 | mActionCategories->plug( settingsMenu ); | 2053 | mActionCategories->plug( settingsMenu ); |
2054 | mActionManageCategories->plug( settingsMenu ); | ||
2057 | 2055 | ||
@@ -2108,41 +2106,6 @@ void KABCore::showLicence() | |||
2108 | } | 2106 | } |
2109 | void KABCore::setCat() | 2107 | |
2110 | { | 2108 | void KABCore::manageCategories( ) |
2111 | setCategories( true ); | ||
2112 | } | ||
2113 | void KABCore::addCat() | ||
2114 | { | ||
2115 | setCategories( false ); | ||
2116 | } | ||
2117 | void KABCore::setCategories( bool removeOld ) | ||
2118 | { | 2109 | { |
2119 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KABPrefs::instance(), 0 ); | 2110 | |
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 | } | 2111 | } |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 1bdae5f..bf5398b 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -245,2 +245,3 @@ class KABCore : public QWidget, public KSyncInterface | |||
245 | void setCategories(); | 245 | void setCategories(); |
246 | void manageCategories(); | ||
246 | 247 | ||
@@ -372,5 +373,2 @@ class KABCore : public QWidget, public KSyncInterface | |||
372 | void removeVoice(); | 373 | void removeVoice(); |
373 | void setCat(); | ||
374 | void addCat(); | ||
375 | void setCategories( bool removeOld ); | ||
376 | #ifdef KAB_EMBEDDED | 374 | #ifdef KAB_EMBEDDED |
@@ -456,2 +454,3 @@ class KABCore : public QWidget, public KSyncInterface | |||
456 | KAction *mActionCategories; | 454 | KAction *mActionCategories; |
455 | KAction *mActionManageCategories; | ||
457 | KAction *mActionAboutKAddressbook; | 456 | KAction *mActionAboutKAddressbook; |
@@ -475,4 +474,2 @@ class KABCore : public QWidget, public KSyncInterface | |||
475 | KAction *mActionRemoveVoice; | 474 | KAction *mActionRemoveVoice; |
476 | KAction *mActionSetCat; | ||
477 | KAction *mActionAddCat; | ||
478 | KAction * mActionImportOL; | 475 | KAction * mActionImportOL; |