-rw-r--r-- | kabc/addressbook.cpp | 35 |
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 ) AddressBook::AddressBook() { - init(0); + init(0, "contact"); } AddressBook::AddressBook( const QString &config ) { - init(config); + init(config, "contact"); } -void AddressBook::init(const QString &config) +AddressBook::AddressBook( const QString &config, const QString &family ) +{ + init(config, family); + +} + +// the default family is "contact" +void AddressBook::init(const QString &config, const QString &family ) { d = new AddressBookData; @@ -236,7 +243,7 @@ void AddressBook::init(const QString &config) // qDebug("AddressBook::init 1 config=0"); } - + //US d->mErrorHandler = 0; - d->mManager = new KRES::Manager<Resource>( "contact" ); + d->mManager = new KRES::Manager<Resource>( family, false ); d->mManager->readConfig( d->mConfig ); } @@ -252,5 +259,5 @@ AddressBook::~AddressBook() bool AddressBook::load() { - + clear(); @@ -278,5 +285,5 @@ bool AddressBook::save( Ticket *ticket ) if ( ticket->resource() ) { deleteRemovedAddressees(); - + return ticket->resource()->save( ticket ); } @@ -357,5 +364,5 @@ void AddressBook::insertAddressee( const Addressee &a ) if ( changed ) { (*it).setRevision( QDateTime::currentDateTime() ); - (*it).setChanged( true ); + (*it).setChanged( true ); } @@ -436,5 +443,5 @@ Addressee::List AddressBook::findByEmail( const QString &email ) Iterator it; for ( it = begin(); it != end(); ++it ) { - mailList = (*it).emails(); + mailList = (*it).emails(); for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) { if ( email == (*ite) ) { @@ -492,7 +499,7 @@ Field::List AddressBook::fields( int category ) d->mAllFields = Field::allFields(); } - + if ( category == Field::All ) return d->mAllFields; - + Field::List result; Field::List::ConstIterator it; @@ -500,5 +507,5 @@ Field::List AddressBook::fields( int category ) if ( (*it)->category() & category ) result.append( *it ); } - + return result; } @@ -542,6 +549,4 @@ QDataStream &KABC::operator>>( QDataStream &s, AddressBook &ab ) bool AddressBook::addResource( Resource *resource ) { - qDebug("AddressBook::addResource 1"); - if ( !resource->open() ) { kdDebug(5700) << "AddressBook::addResource(): can't add resource" << endl; @@ -573,5 +578,5 @@ QPtrList<Resource> AddressBook::resources() // qDebug("AddressBook::resources() 1"); - + KRES::Manager<Resource>::ActiveIterator it; for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) |