distributionlist.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KABC_DISTRIBUTIONLIST_H
00022 #define KABC_DISTRIBUTIONLIST_H
00023
00024 #include <kdirwatch.h>
00025
00026 #include "addressbook.h"
00027
00028 namespace KABC {
00029
00030 class DistributionListManager;
00031
00039 class KABC_EXPORT DistributionList
00040 {
00041 public:
00049 struct Entry
00050 {
00051 typedef QValueList<Entry> List;
00052
00053 Entry() {}
00054 Entry( const Addressee &_addressee, const QString &_email ) :
00055 addressee( _addressee ), email( _email ) {}
00056
00057 Addressee addressee;
00058 QString email;
00059 };
00060
00067 DistributionList( DistributionListManager *manager, const QString &name );
00068
00072 ~DistributionList();
00073
00078 void setName( const QString & );
00079
00083 QString name() const;
00084
00089 void insertEntry( const Addressee &, const QString &email=QString::null );
00090
00095 void removeEntry( const Addressee &, const QString &email=QString::null );
00096
00101 QStringList emails() const;
00102
00107 Entry::List entries() const;
00108
00109 private:
00110 DistributionListManager *mManager;
00111 QString mName;
00112
00113 Entry::List mEntries;
00114 };
00115
00122 class KABC_EXPORT DistributionListManager
00123 {
00124 public:
00128 DistributionListManager( AddressBook * );
00129
00133 ~DistributionListManager();
00134
00138 DistributionList *list( const QString &name );
00139
00144 void insert( DistributionList * );
00145
00150 void remove( DistributionList * );
00151
00155 QStringList listNames();
00156
00160 bool load();
00161
00165 bool save();
00166
00167 private:
00168 class DistributionListManagerPrivate;
00169 DistributionListManagerPrivate *d;
00170
00171 QPtrList<DistributionList> mLists;
00172 };
00173
00189 class KABC_EXPORT DistributionListWatcher : public QObject
00190 {
00191 Q_OBJECT
00192
00193 public:
00197 static DistributionListWatcher *self();
00198
00199 signals:
00205 void changed();
00206
00207 protected:
00208 DistributionListWatcher();
00209 ~DistributionListWatcher();
00210
00211 private:
00212 static DistributionListWatcher* mSelf;
00213 KDirWatch *mDirWatch;
00214 };
00215
00216 }
00217 #endif
|