-rw-r--r-- | kabc/distributionlist.cpp | 30 | ||||
-rw-r--r-- | kabc/distributionlisteditor.cpp | 1 |
2 files changed, 19 insertions, 12 deletions
diff --git a/kabc/distributionlist.cpp b/kabc/distributionlist.cpp index 45b9dda..0735aba 100644 --- a/kabc/distributionlist.cpp +++ b/kabc/distributionlist.cpp @@ -51,6 +51,8 @@ QString DistributionList::name() const void DistributionList::insertEntry( const Addressee &a, const QString &email ) { - Entry e( a, email ); - + QString em = email; + if (em.isNull() ) + em = a.preferredEmail(); + Entry e( a, em ); QValueList<Entry>::Iterator it; for( it = mEntries.begin(); it != mEntries.end(); ++it ) { @@ -60,8 +62,8 @@ void DistributionList::insertEntry( const Addressee &a, const QString &email ) a simple 'email1 == email2' wont work here */ - if ( ( (*it).email.isNull() && email.isEmpty() ) || - ( (*it).email.isEmpty() && email.isNull() ) || - ( (*it).email == email ) ) { - *it = e; + if ( ( (*it).email.isNull() && em.isEmpty() ) || + ( (*it).email.isEmpty() && em.isNull() ) || + ( (*it).email == em ) ) { + //*it = e; return; } @@ -179,7 +181,7 @@ bool DistributionListManager::load() cfg.setGroup( mAddressBook->identifier() ); //US we work in microkde with a list of distributionlists - QStringList distlists = cfg.readListEntry( "Lists" ); + QStringList distlists = cfg.readListEntry( "__Lists__List__" ); if ( distlists.isEmpty() ) { - kdDebug(5700) << "No distlists for '" << mAddressBook->identifier() << "'" << endl; + qDebug("no distlist for AB "); return false; } @@ -192,5 +194,5 @@ bool DistributionListManager::load() QStringList value = cfg.readListEntry( name ); - kdDebug(5700) << "DLM::load(): " << name << ": " << value.join(",") << endl; + DistributionList *list = new DistributionList( this, name ); @@ -201,5 +203,5 @@ bool DistributionListManager::load() QString email = *it2; - kdDebug(5700) << "----- Entry " << id << endl; + Addressee a = mAddressBook->findByUid( id ); @@ -218,5 +220,5 @@ bool DistributionListManager::load() bool DistributionListManager::save() { - kdDebug(5700) << "DistListManager::save()" << endl; + KSimpleConfig cfg( locateLocal( "data", "kabc/distlists" ) ); @@ -233,5 +235,9 @@ bool DistributionListManager::save() for( it = entries.begin(); it != entries.end(); ++it ) { value.append( (*it).addressee.uid() ); + if (( *it).email.isEmpty()) + value.append( " " ); + else value.append( (*it).email ); + // qDebug("uid *%s* email *%s* ", (*it).addressee.uid().latin1(),(*it).email.latin1() ); } cfg.writeEntry( list->name(), value ); @@ -244,5 +250,5 @@ bool DistributionListManager::save() namelist.append( list->name() ); } - cfg.writeEntry( "Lists", namelist ); + cfg.writeEntry( "__Lists__List__", namelist ); diff --git a/kabc/distributionlisteditor.cpp b/kabc/distributionlisteditor.cpp index 8b485d8..bad1efc 100644 --- a/kabc/distributionlisteditor.cpp +++ b/kabc/distributionlisteditor.cpp @@ -71,4 +71,5 @@ QString EmailSelectDialog::getEmail( const QStringList &emails, const QString &c QWidget *parent ) { + EmailSelectDialog *dlg = new EmailSelectDialog( emails, current, parent ); dlg->exec(); |