21 #include "distributionlist.h"
26 #include <kstandarddirs.h>
29 #include <QApplication>
30 #include <QtCore/QPair>
31 #include <QtCore/QPointer>
35 class DistributionList::Entry::Private
39 Private( Addressee _addressee,
const QString &_email )
52 : d( new Private( entry.d->addressee, entry.d->email ) )
57 : d( new Private( _addressee, _email ) )
68 d->addressee = entry.d->addressee;
69 d->email = entry.d->email;
84 class DistributionList::Private
89 : mResource( resource ), mIdentifier( identifier ), mName( name )
93 QPointer<Resource> mResource;
100 : d( new Private( resource, KRandom::randomString(10), name ) )
102 d->mResource->insertDistributionList(
this );
106 const QString &identifier,
const QString &name )
107 : d( new Private( resource, identifier, name ) )
109 d->mResource->insertDistributionList(
this );
114 if ( d->mResource ) {
115 d->mResource->removeDistributionList(
this );
128 return d->mIdentifier;
145 QList<Entry>::Iterator it;
146 for ( it = d->mEntries.begin(); it != d->mEntries.end(); ++it ) {
147 if ( ( *it ).addressee().uid() == a.uid() ) {
152 if ( ( ( *it ).email().isNull() && email.isEmpty() ) ||
153 ( ( *it ).email().isEmpty() && email.isNull() ) ||
154 ( ( *it ).email() == email ) ) {
160 d->mEntries.append( e );
165 QList<Entry>::Iterator it;
166 for ( it = d->mEntries.begin(); it != d->mEntries.end(); ++it ) {
167 if ( ( *it ).addressee().uid() == a.uid() && ( *it ).email() == email ) {
168 d->mEntries.erase( it );
178 Entry::List::ConstIterator it;
179 for ( it = d->mEntries.constBegin(); it != d->mEntries.constEnd(); ++it ) {
180 const Addressee a = ( *it ).addressee();
181 QString email = ( *it ).email().isEmpty() ? a.fullEmail() :
182 a.fullEmail( ( *it ).email() );
184 if ( !email.isEmpty() ) {
185 emails.append( email );
197 Resource *DistributionList::resource()
const
202 typedef QList< QPair<QString, QString> > MissingEntryList;