summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp54
1 files changed, 52 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
@@ -1878,4 +1878,2 @@ void KABCore::initActions()
1878 1878
1879
1880
1881 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1879 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
@@ -1887,2 +1885,12 @@ void KABCore::initActions()
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,
@@ -2016,2 +2024,4 @@ void KABCore::addActionsManually()
2016 mActionRemoveVoice->plug( changeMenu ); 2024 mActionRemoveVoice->plug( changeMenu );
2025 mActionSetCat->plug( changeMenu );
2026 mActionAddCat->plug( changeMenu );
2017 // settings menu 2027 // settings menu
@@ -2098,2 +2108,42 @@ void KABCore::showLicence()
2098} 2108}
2109void KABCore::setCat()
2110{
2111 setCategories( true );
2112}
2113void KABCore::addCat()
2114{
2115 setCategories( false );
2116}
2117void 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}
2099void KABCore::removeVoice() 2149void KABCore::removeVoice()