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 | |||
@@ -955,24 +955,26 @@ void KABCore::setWhoAmI() | |||
955 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 955 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
956 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 956 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
957 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 957 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
958 | } | 958 | } |
959 | 959 | ||
960 | void KABCore::setCategories() | 960 | void KABCore::setCategories() |
961 | { | 961 | { |
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; |
967 | QString msg = i18n( "Merge with existing categories?" ); | 968 | QString msg = i18n( "Merge with existing categories?" ); |
968 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 969 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
969 | merge = true; | 970 | merge = true; |
970 | 971 | ||
972 | message( i18n("Setting categories ... please wait!") ); | ||
971 | QStringList categories = dlg.selectedCategories(); | 973 | QStringList categories = dlg.selectedCategories(); |
972 | 974 | ||
973 | QStringList uids = mViewManager->selectedUids(); | 975 | QStringList uids = mViewManager->selectedUids(); |
974 | QStringList::Iterator it; | 976 | QStringList::Iterator it; |
975 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 977 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
976 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 978 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
977 | if ( !addr.isEmpty() ) { | 979 | if ( !addr.isEmpty() ) { |
978 | if ( !merge ) | 980 | if ( !merge ) |
@@ -988,16 +990,17 @@ void KABCore::setCategories() | |||
988 | } | 990 | } |
989 | 991 | ||
990 | mAddressBook->insertAddressee( addr ); | 992 | mAddressBook->insertAddressee( addr ); |
991 | } | 993 | } |
992 | } | 994 | } |
993 | 995 | ||
994 | if ( uids.count() > 0 ) | 996 | if ( uids.count() > 0 ) |
995 | setModified( true ); | 997 | setModified( true ); |
998 | message( i18n("Setting categories completed!") ); | ||
996 | } | 999 | } |
997 | 1000 | ||
998 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 1001 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
999 | { | 1002 | { |
1000 | mIncSearchWidget->setFields( fields ); | 1003 | mIncSearchWidget->setFields( fields ); |
1001 | } | 1004 | } |
1002 | 1005 | ||
1003 | void KABCore::incrementalSearch( const QString& text ) | 1006 | void KABCore::incrementalSearch( const QString& text ) |
@@ -1879,25 +1882,21 @@ void KABCore::initActions() | |||
1879 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1882 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1880 | SLOT( setCategories() ), actionCollection(), | 1883 | SLOT( setCategories() ), actionCollection(), |
1881 | "edit_set_categories" ); | 1884 | "edit_set_categories" ); |
1882 | 1885 | ||
1883 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1886 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1884 | SLOT( removeVoice() ), actionCollection(), | 1887 | SLOT( removeVoice() ), actionCollection(), |
1885 | "remove_voice" ); | 1888 | "remove_voice" ); |
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" ); |
1890 | 1893 | ||
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, |
1897 | SLOT( importFromOL() ), actionCollection(), | 1896 | SLOT( importFromOL() ), actionCollection(), |
1898 | "import_OL" ); | 1897 | "import_OL" ); |
1899 | #ifdef KAB_EMBEDDED | 1898 | #ifdef KAB_EMBEDDED |
1900 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 1899 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
1901 | this, SLOT( showLicence() ), actionCollection(), | 1900 | this, SLOT( showLicence() ), actionCollection(), |
1902 | "licence_about_data" ); | 1901 | "licence_about_data" ); |
1903 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 1902 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
@@ -2017,18 +2016,16 @@ void KABCore::addActionsManually() | |||
2017 | mActionCut->plug( editMenu ); | 2016 | mActionCut->plug( editMenu ); |
2018 | mActionCopy->plug( editMenu ); | 2017 | mActionCopy->plug( editMenu ); |
2019 | mActionPaste->plug( editMenu ); | 2018 | mActionPaste->plug( editMenu ); |
2020 | mActionDelete->plug( editMenu ); | 2019 | mActionDelete->plug( editMenu ); |
2021 | editMenu->insertSeparator(); | 2020 | editMenu->insertSeparator(); |
2022 | mActionSelectAll->plug( editMenu ); | 2021 | mActionSelectAll->plug( editMenu ); |
2023 | 2022 | ||
2024 | mActionRemoveVoice->plug( changeMenu ); | 2023 | mActionRemoveVoice->plug( changeMenu ); |
2025 | mActionSetCat->plug( changeMenu ); | ||
2026 | mActionAddCat->plug( changeMenu ); | ||
2027 | // settings menu | 2024 | // settings menu |
2028 | //US special menuentry to configure the addressbook resources. On KDE | 2025 | //US special menuentry to configure the addressbook resources. On KDE |
2029 | // you do that through the control center !!! | 2026 | // you do that through the control center !!! |
2030 | mActionConfigResources->plug( settingsMenu ); | 2027 | mActionConfigResources->plug( settingsMenu ); |
2031 | settingsMenu->insertSeparator(); | 2028 | settingsMenu->insertSeparator(); |
2032 | 2029 | ||
2033 | mActionConfigKAddressbook->plug( settingsMenu ); | 2030 | mActionConfigKAddressbook->plug( settingsMenu ); |
2034 | 2031 | ||
@@ -2049,16 +2046,17 @@ void KABCore::addActionsManually() | |||
2049 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2046 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2050 | mActionDetails->plug( tb ); | 2047 | mActionDetails->plug( tb ); |
2051 | settingsMenu->insertSeparator(); | 2048 | settingsMenu->insertSeparator(); |
2052 | mActionBR->plug(settingsMenu ); | 2049 | mActionBR->plug(settingsMenu ); |
2053 | settingsMenu->insertSeparator(); | 2050 | settingsMenu->insertSeparator(); |
2054 | 2051 | ||
2055 | mActionWhoAmI->plug( settingsMenu ); | 2052 | mActionWhoAmI->plug( settingsMenu ); |
2056 | mActionCategories->plug( settingsMenu ); | 2053 | mActionCategories->plug( settingsMenu ); |
2054 | mActionManageCategories->plug( settingsMenu ); | ||
2057 | 2055 | ||
2058 | 2056 | ||
2059 | mActionWN->plug( helpMenu ); | 2057 | mActionWN->plug( helpMenu ); |
2060 | mActionSyncHowto->plug( helpMenu ); | 2058 | mActionSyncHowto->plug( helpMenu ); |
2061 | mActionKdeSyncHowto->plug( helpMenu ); | 2059 | mActionKdeSyncHowto->plug( helpMenu ); |
2062 | mActionMultiSyncHowto->plug( helpMenu ); | 2060 | mActionMultiSyncHowto->plug( helpMenu ); |
2063 | mActionFaq->plug( helpMenu ); | 2061 | mActionFaq->plug( helpMenu ); |
2064 | mActionLicence->plug( helpMenu ); | 2062 | mActionLicence->plug( helpMenu ); |
@@ -2101,55 +2099,20 @@ void KABCore::addActionsManually() | |||
2101 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2099 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2102 | syncManager->fillSyncMenu(); | 2100 | syncManager->fillSyncMenu(); |
2103 | 2101 | ||
2104 | } | 2102 | } |
2105 | void KABCore::showLicence() | 2103 | void KABCore::showLicence() |
2106 | { | 2104 | { |
2107 | KApplication::showLicence(); | 2105 | KApplication::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 | } |
2149 | void KABCore::removeVoice() | 2112 | void KABCore::removeVoice() |
2150 | { | 2113 | { |
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 ) | 2114 | 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 ) |
2152 | return; | 2115 | return; |
2153 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 2116 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
2154 | KABC::Addressee::List::Iterator it; | 2117 | KABC::Addressee::List::Iterator it; |
2155 | for ( it = list.begin(); it != list.end(); ++it ) { | 2118 | for ( it = list.begin(); it != list.end(); ++it ) { |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 1bdae5f..bf5398b 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -238,16 +238,17 @@ class KABCore : public QWidget, public KSyncInterface | |||
238 | */ | 238 | */ |
239 | void setWhoAmI(); | 239 | void setWhoAmI(); |
240 | 240 | ||
241 | /** | 241 | /** |
242 | Displays the category dialog and applies the result to all | 242 | Displays the category dialog and applies the result to all |
243 | selected contacts. | 243 | selected contacts. |
244 | */ | 244 | */ |
245 | void setCategories(); | 245 | void setCategories(); |
246 | void manageCategories(); | ||
246 | 247 | ||
247 | /** | 248 | /** |
248 | Sets the field list of the Incremental Search Widget. | 249 | Sets the field list of the Incremental Search Widget. |
249 | */ | 250 | */ |
250 | void setSearchFields( const KABC::Field::List &fields ); | 251 | void setSearchFields( const KABC::Field::List &fields ); |
251 | 252 | ||
252 | /** | 253 | /** |
253 | Search with the current search field for a contact, that matches | 254 | Search with the current search field for a contact, that matches |
@@ -365,19 +366,16 @@ class KABCore : public QWidget, public KSyncInterface | |||
365 | void setCaptionBack(); | 366 | void setCaptionBack(); |
366 | void importFromOL(); | 367 | void importFromOL(); |
367 | void extensionModified( const KABC::Addressee::List &list ); | 368 | void extensionModified( const KABC::Addressee::List &list ); |
368 | void extensionChanged( int id ); | 369 | void extensionChanged( int id ); |
369 | void clipboardDataChanged(); | 370 | void clipboardDataChanged(); |
370 | void updateActionMenu(); | 371 | void updateActionMenu(); |
371 | void configureKeyBindings(); | 372 | void configureKeyBindings(); |
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 |
377 | void configureResources(); | 375 | void configureResources(); |
378 | #endif //KAB_EMBEDDED | 376 | #endif //KAB_EMBEDDED |
379 | 377 | ||
380 | void slotEditorDestroyed( const QString &uid ); | 378 | void slotEditorDestroyed( const QString &uid ); |
381 | void configurationChanged(); | 379 | void configurationChanged(); |
382 | void addressBookChanged(); | 380 | void addressBookChanged(); |
383 | 381 | ||
@@ -449,16 +447,17 @@ class KABCore : public QWidget, public KSyncInterface | |||
449 | KAction *mActionConfigKAddressbook; | 447 | KAction *mActionConfigKAddressbook; |
450 | KAction *mActionConfigShortcuts; | 448 | KAction *mActionConfigShortcuts; |
451 | KAction *mActionConfigureToolbars; | 449 | KAction *mActionConfigureToolbars; |
452 | KAction *mActionKeyBindings; | 450 | KAction *mActionKeyBindings; |
453 | KToggleAction *mActionJumpBar; | 451 | KToggleAction *mActionJumpBar; |
454 | KToggleAction *mActionDetails; | 452 | KToggleAction *mActionDetails; |
455 | KAction *mActionWhoAmI; | 453 | KAction *mActionWhoAmI; |
456 | KAction *mActionCategories; | 454 | KAction *mActionCategories; |
455 | KAction *mActionManageCategories; | ||
457 | KAction *mActionAboutKAddressbook; | 456 | KAction *mActionAboutKAddressbook; |
458 | KAction *mActionLicence; | 457 | KAction *mActionLicence; |
459 | KAction *mActionFaq; | 458 | KAction *mActionFaq; |
460 | KAction *mActionWN; | 459 | KAction *mActionWN; |
461 | KAction *mActionSyncHowto; | 460 | KAction *mActionSyncHowto; |
462 | KAction *mActionKdeSyncHowto; | 461 | KAction *mActionKdeSyncHowto; |
463 | KAction *mActionMultiSyncHowto; | 462 | KAction *mActionMultiSyncHowto; |
464 | 463 | ||
@@ -468,18 +467,16 @@ class KABCore : public QWidget, public KSyncInterface | |||
468 | QPopupMenu *filterMenu; | 467 | QPopupMenu *filterMenu; |
469 | QPopupMenu *settingsMenu; | 468 | QPopupMenu *settingsMenu; |
470 | QPopupMenu *changeMenu; | 469 | QPopupMenu *changeMenu; |
471 | //US QAction *mActionSave; | 470 | //US QAction *mActionSave; |
472 | QPopupMenu *ImportMenu; | 471 | QPopupMenu *ImportMenu; |
473 | QPopupMenu *ExportMenu; | 472 | QPopupMenu *ExportMenu; |
474 | //LR additional methods | 473 | //LR additional methods |
475 | KAction *mActionRemoveVoice; | 474 | KAction *mActionRemoveVoice; |
476 | KAction *mActionSetCat; | ||
477 | KAction *mActionAddCat; | ||
478 | KAction * mActionImportOL; | 475 | KAction * mActionImportOL; |
479 | 476 | ||
480 | #ifndef KAB_EMBEDDED | 477 | #ifndef KAB_EMBEDDED |
481 | KAddressBookService *mAddressBookService; | 478 | KAddressBookService *mAddressBookService; |
482 | #endif //KAB_EMBEDDED | 479 | #endif //KAB_EMBEDDED |
483 | 480 | ||
484 | class KABCorePrivate; | 481 | class KABCorePrivate; |
485 | KABCorePrivate *d; | 482 | KABCorePrivate *d; |