author | zautrix <zautrix> | 2004-07-03 23:38:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-03 23:38:18 (UTC) |
commit | 260befadfaa64d94de7d38d7f6cad0d22f52c226 (patch) (unidiff) | |
tree | 96923d1ac1304e8f07028941e830437465bb9558 | |
parent | 00fe3539778c859d22f595e516733b3cc792e167 (diff) | |
download | kdepimpi-260befadfaa64d94de7d38d7f6cad0d22f52c226.zip kdepimpi-260befadfaa64d94de7d38d7f6cad0d22f52c226.tar.gz kdepimpi-260befadfaa64d94de7d38d7f6cad0d22f52c226.tar.bz2 |
fixed distribution lists
-rw-r--r-- | kabc/distributionlist.cpp | 32 | ||||
-rw-r--r-- | kabc/distributionlisteditor.cpp | 1 |
2 files changed, 20 insertions, 13 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 | |||
51 | void DistributionList::insertEntry( const Addressee &a, const QString &email ) | 51 | void DistributionList::insertEntry( const Addressee &a, const QString &email ) |
52 | { | 52 | { |
53 | Entry e( a, email ); | 53 | QString em = email; |
54 | 54 | if (em.isNull() ) | |
55 | em = a.preferredEmail(); | ||
56 | Entry e( a, em ); | ||
55 | QValueList<Entry>::Iterator it; | 57 | QValueList<Entry>::Iterator it; |
56 | for( it = mEntries.begin(); it != mEntries.end(); ++it ) { | 58 | for( it = mEntries.begin(); it != mEntries.end(); ++it ) { |
@@ -60,8 +62,8 @@ void DistributionList::insertEntry( const Addressee &a, const QString &email ) | |||
60 | a simple 'email1 == email2' wont work here | 62 | a simple 'email1 == email2' wont work here |
61 | */ | 63 | */ |
62 | if ( ( (*it).email.isNull() && email.isEmpty() ) || | 64 | if ( ( (*it).email.isNull() && em.isEmpty() ) || |
63 | ( (*it).email.isEmpty() && email.isNull() ) || | 65 | ( (*it).email.isEmpty() && em.isNull() ) || |
64 | ( (*it).email == email ) ) { | 66 | ( (*it).email == em ) ) { |
65 | *it = e; | 67 | //*it = e; |
66 | return; | 68 | return; |
67 | } | 69 | } |
@@ -179,7 +181,7 @@ bool DistributionListManager::load() | |||
179 | cfg.setGroup( mAddressBook->identifier() ); | 181 | cfg.setGroup( mAddressBook->identifier() ); |
180 | //US we work in microkde with a list of distributionlists | 182 | //US we work in microkde with a list of distributionlists |
181 | QStringList distlists = cfg.readListEntry( "Lists" ); | 183 | QStringList distlists = cfg.readListEntry( "__Lists__List__" ); |
182 | if ( distlists.isEmpty() ) { | 184 | if ( distlists.isEmpty() ) { |
183 | kdDebug(5700) << "No distlists for '" << mAddressBook->identifier() << "'" << endl; | 185 | qDebug("no distlist for AB "); |
184 | return false; | 186 | return false; |
185 | } | 187 | } |
@@ -192,5 +194,5 @@ bool DistributionListManager::load() | |||
192 | QStringList value = cfg.readListEntry( name ); | 194 | QStringList value = cfg.readListEntry( name ); |
193 | 195 | ||
194 | kdDebug(5700) << "DLM::load(): " << name << ": " << value.join(",") << endl; | 196 | |
195 | 197 | ||
196 | DistributionList *list = new DistributionList( this, name ); | 198 | DistributionList *list = new DistributionList( this, name ); |
@@ -201,5 +203,5 @@ bool DistributionListManager::load() | |||
201 | QString email = *it2; | 203 | QString email = *it2; |
202 | 204 | ||
203 | kdDebug(5700) << "----- Entry " << id << endl; | 205 | |
204 | 206 | ||
205 | Addressee a = mAddressBook->findByUid( id ); | 207 | Addressee a = mAddressBook->findByUid( id ); |
@@ -218,5 +220,5 @@ bool DistributionListManager::load() | |||
218 | bool DistributionListManager::save() | 220 | bool DistributionListManager::save() |
219 | { | 221 | { |
220 | kdDebug(5700) << "DistListManager::save()" << endl; | 222 | |
221 | 223 | ||
222 | KSimpleConfig cfg( locateLocal( "data", "kabc/distlists" ) ); | 224 | KSimpleConfig cfg( locateLocal( "data", "kabc/distlists" ) ); |
@@ -233,5 +235,9 @@ bool DistributionListManager::save() | |||
233 | for( it = entries.begin(); it != entries.end(); ++it ) { | 235 | for( it = entries.begin(); it != entries.end(); ++it ) { |
234 | value.append( (*it).addressee.uid() ); | 236 | value.append( (*it).addressee.uid() ); |
235 | value.append( (*it).email ); | 237 | if (( *it).email.isEmpty()) |
238 | value.append( " " ); | ||
239 | else | ||
240 | value.append( (*it).email ); | ||
241 | // qDebug("uid *%s* email *%s* ", (*it).addressee.uid().latin1(),(*it).email.latin1() ); | ||
236 | } | 242 | } |
237 | cfg.writeEntry( list->name(), value ); | 243 | cfg.writeEntry( list->name(), value ); |
@@ -244,5 +250,5 @@ bool DistributionListManager::save() | |||
244 | namelist.append( list->name() ); | 250 | namelist.append( list->name() ); |
245 | } | 251 | } |
246 | cfg.writeEntry( "Lists", namelist ); | 252 | cfg.writeEntry( "__Lists__List__", namelist ); |
247 | 253 | ||
248 | 254 | ||
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 | |||
71 | QWidget *parent ) | 71 | QWidget *parent ) |
72 | { | 72 | { |
73 | |||
73 | EmailSelectDialog *dlg = new EmailSelectDialog( emails, current, parent ); | 74 | EmailSelectDialog *dlg = new EmailSelectDialog( emails, current, parent ); |
74 | dlg->exec(); | 75 | dlg->exec(); |