summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp4
-rw-r--r--kabc/addressee.h2
-rw-r--r--kabc/field.cpp6
-rw-r--r--kaddressbook/kabcore.cpp54
-rw-r--r--kaddressbook/kabcore.h5
5 files changed, 68 insertions, 3 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index eec0f1f..3ce733d 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -1997,4 +1997,8 @@ QString Addressee::resourceLabel()
1997 return i18n("Resource"); 1997 return i18n("Resource");
1998} 1998}
1999QString Addressee::categoryLabel()
2000{
2001 return i18n("Category");
2002}
1999 2003
2000void Addressee::setChanged( bool value ) 2004void Addressee::setChanged( bool value )
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 2c81c1a..08d2f56 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -824,5 +824,5 @@ class Addressee
824 //US 824 //US
825 static QString resourceLabel(); 825 static QString resourceLabel();
826 826 static QString categoryLabel();
827 /** 827 /**
828 Mark addressee as changed. 828 Mark addressee as changed.
diff --git a/kabc/field.cpp b/kabc/field.cpp
index d95cd19..89d0b77 100644
--- a/kabc/field.cpp
+++ b/kabc/field.cpp
@@ -58,4 +58,5 @@ class Field::FieldImpl
58 NickName, 58 NickName,
59 Birthday, 59 Birthday,
60 Category,
60 HomeAddressStreet, 61 HomeAddressStreet,
61 HomeAddressLocality, 62 HomeAddressLocality,
@@ -196,4 +197,6 @@ QString Field::label()
196 case FieldImpl::Resource: 197 case FieldImpl::Resource:
197 return Addressee::resourceLabel(); 198 return Addressee::resourceLabel();
199 case FieldImpl::Category:
200 return Addressee::categoryLabel();
198 case FieldImpl::Sip: 201 case FieldImpl::Sip:
199 return Addressee::sipLabel(); 202 return Addressee::sipLabel();
@@ -278,4 +281,6 @@ QString Field::value( const KABC::Addressee &a )
278 case FieldImpl::Resource: 281 case FieldImpl::Resource:
279 return a.resource()->resourceName(); 282 return a.resource()->resourceName();
283 case FieldImpl::Category:
284 return a.categories().join(",");
280 case FieldImpl::HomePhone: 285 case FieldImpl::HomePhone:
281 return a.phoneNumber( PhoneNumber::Home ).number(); 286 return a.phoneNumber( PhoneNumber::Home ).number();
@@ -396,4 +401,5 @@ Field::List Field::allFields()
396 createField( FieldImpl::NickName, Personal ); 401 createField( FieldImpl::NickName, Personal );
397 createField( FieldImpl::Birthday, Personal ); 402 createField( FieldImpl::Birthday, Personal );
403 createField( FieldImpl::Category );
398 createField( FieldImpl::HomeAddressStreet, Address|Personal ); 404 createField( FieldImpl::HomeAddressStreet, Address|Personal );
399 createField( FieldImpl::HomeAddressLocality, Address|Personal ); 405 createField( FieldImpl::HomeAddressLocality, Address|Personal );
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index e6bdde9..2c2f1a0 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1877,6 +1877,4 @@ void KABCore::initActions()
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(),
@@ -1886,4 +1884,14 @@ void KABCore::initActions()
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(),
@@ -2015,4 +2023,6 @@ void KABCore::addActionsManually()
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
@@ -2097,4 +2107,44 @@ void KABCore::showLicence()
2097 KApplication::showLicence(); 2107 KApplication::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()
2100{ 2150{
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c01d598..1bdae5f 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -371,4 +371,7 @@ class KABCore : public QWidget, public KSyncInterface
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();
@@ -471,4 +474,6 @@ class KABCore : public QWidget, public KSyncInterface
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