summaryrefslogtreecommitdiffabout
path: root/kabc/addressbook.cpp
Unidiff
Diffstat (limited to 'kabc/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 0838157..20310a0 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -217,13 +217,20 @@ bool AddressBook::ConstIterator::operator!=( const ConstIterator &it )
217AddressBook::AddressBook() 217AddressBook::AddressBook()
218{ 218{
219 init(0); 219 init(0, "contact");
220} 220}
221 221
222AddressBook::AddressBook( const QString &config ) 222AddressBook::AddressBook( const QString &config )
223{ 223{
224 init(config); 224 init(config, "contact");
225} 225}
226 226
227void AddressBook::init(const QString &config) 227AddressBook::AddressBook( const QString &config, const QString &family )
228{
229 init(config, family);
230
231}
232
233// the default family is "contact"
234void AddressBook::init(const QString &config, const QString &family )
228{ 235{
229 d = new AddressBookData; 236 d = new AddressBookData;
@@ -236,7 +243,7 @@ void AddressBook::init(const QString &config)
236// qDebug("AddressBook::init 1 config=0"); 243// qDebug("AddressBook::init 1 config=0");
237 } 244 }
238 245
239//US d->mErrorHandler = 0; 246//US d->mErrorHandler = 0;
240 d->mManager = new KRES::Manager<Resource>( "contact" ); 247 d->mManager = new KRES::Manager<Resource>( family, false );
241 d->mManager->readConfig( d->mConfig ); 248 d->mManager->readConfig( d->mConfig );
242} 249}
@@ -252,5 +259,5 @@ AddressBook::~AddressBook()
252bool AddressBook::load() 259bool AddressBook::load()
253{ 260{
254 261
255 262
256 clear(); 263 clear();
@@ -278,5 +285,5 @@ bool AddressBook::save( Ticket *ticket )
278 if ( ticket->resource() ) { 285 if ( ticket->resource() ) {
279 deleteRemovedAddressees(); 286 deleteRemovedAddressees();
280 287
281 return ticket->resource()->save( ticket ); 288 return ticket->resource()->save( ticket );
282 } 289 }
@@ -357,5 +364,5 @@ void AddressBook::insertAddressee( const Addressee &a )
357 if ( changed ) { 364 if ( changed ) {
358 (*it).setRevision( QDateTime::currentDateTime() ); 365 (*it).setRevision( QDateTime::currentDateTime() );
359 (*it).setChanged( true ); 366 (*it).setChanged( true );
360 } 367 }
361 368
@@ -436,5 +443,5 @@ Addressee::List AddressBook::findByEmail( const QString &email )
436 Iterator it; 443 Iterator it;
437 for ( it = begin(); it != end(); ++it ) { 444 for ( it = begin(); it != end(); ++it ) {
438 mailList = (*it).emails(); 445 mailList = (*it).emails();
439 for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) { 446 for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) {
440 if ( email == (*ite) ) { 447 if ( email == (*ite) ) {
@@ -492,7 +499,7 @@ Field::List AddressBook::fields( int category )
492 d->mAllFields = Field::allFields(); 499 d->mAllFields = Field::allFields();
493 } 500 }
494 501
495 if ( category == Field::All ) return d->mAllFields; 502 if ( category == Field::All ) return d->mAllFields;
496 503
497 Field::List result; 504 Field::List result;
498 Field::List::ConstIterator it; 505 Field::List::ConstIterator it;
@@ -500,5 +507,5 @@ Field::List AddressBook::fields( int category )
500 if ( (*it)->category() & category ) result.append( *it ); 507 if ( (*it)->category() & category ) result.append( *it );
501 } 508 }
502 509
503 return result; 510 return result;
504} 511}
@@ -542,6 +549,4 @@ QDataStream &KABC::operator>>( QDataStream &s, AddressBook &ab )
542bool AddressBook::addResource( Resource *resource ) 549bool AddressBook::addResource( Resource *resource )
543{ 550{
544 qDebug("AddressBook::addResource 1");
545
546 if ( !resource->open() ) { 551 if ( !resource->open() ) {
547 kdDebug(5700) << "AddressBook::addResource(): can't add resource" << endl; 552 kdDebug(5700) << "AddressBook::addResource(): can't add resource" << endl;
@@ -573,5 +578,5 @@ QPtrList<Resource> AddressBook::resources()
573 578
574// qDebug("AddressBook::resources() 1"); 579// qDebug("AddressBook::resources() 1");
575 580
576 KRES::Manager<Resource>::ActiveIterator it; 581 KRES::Manager<Resource>::ActiveIterator it;
577 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) 582 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it )