summaryrefslogtreecommitdiffabout
path: root/kabc/addressbook.cpp
Side-by-side diff
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
@@ -216,15 +216,22 @@ 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;
if (config != 0) {
@@ -235,9 +242,9 @@ void AddressBook::init(const QString &config)
d->mConfig = 0;
// 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 );
}
@@ -251,7 +258,7 @@ AddressBook::~AddressBook()
bool AddressBook::load()
{
-
+
clear();
@@ -277,7 +284,7 @@ bool AddressBook::save( Ticket *ticket )
if ( ticket->resource() ) {
deleteRemovedAddressees();
-
+
return ticket->resource()->save( ticket );
}
@@ -356,7 +363,7 @@ void AddressBook::insertAddressee( const Addressee &a )
if ( changed ) {
(*it).setRevision( QDateTime::currentDateTime() );
- (*it).setChanged( true );
+ (*it).setChanged( true );
}
return;
@@ -435,7 +442,7 @@ 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) ) {
results.append( *it );
@@ -491,15 +498,15 @@ Field::List AddressBook::fields( int category )
if ( d->mAllFields.isEmpty() ) {
d->mAllFields = Field::allFields();
}
-
+
if ( category == Field::All ) return d->mAllFields;
-
+
Field::List result;
Field::List::ConstIterator it;
for( it = d->mAllFields.begin(); it != d->mAllFields.end(); ++it ) {
if ( (*it)->category() & category ) result.append( *it );
}
-
+
return result;
}
@@ -541,8 +548,6 @@ 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;
return false;
@@ -572,7 +577,7 @@ QPtrList<Resource> AddressBook::resources()
QPtrList<Resource> list;
// qDebug("AddressBook::resources() 1");
-
+
KRES::Manager<Resource>::ActiveIterator it;
for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it )
list.append( *it );