summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/distributionlist.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/kabc/distributionlist.h b/kabc/distributionlist.h
index ccff487..5f091b1 100644
--- a/kabc/distributionlist.h
+++ b/kabc/distributionlist.h
@@ -1,219 +1,217 @@
1/* 1/*
2 This file is part of libkabc. 2 This file is part of libkabc.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#ifndef KABC_DISTRIBUTIONLIST_H 21#ifndef KABC_DISTRIBUTIONLIST_H
22#define KABC_DISTRIBUTIONLIST_H 22#define KABC_DISTRIBUTIONLIST_H
23 23
24#include <kdirwatch.h> 24#include <kdirwatch.h>
25 25
26#include "addressbook.h" 26#include "addressbook.h"
27 27
28namespace KABC { 28namespace KABC {
29 29
30class DistributionListManager; 30class DistributionListManager;
31 31
32/** 32/**
33 @short Distribution list of email addresses 33 @short Distribution list of email addresses
34 34
35 This class represents a list of email addresses. Each email address is 35 This class represents a list of email addresses. Each email address is
36 associated with an address book entry. If the address book entry changes, the 36 associated with an address book entry. If the address book entry changes, the
37 entry in the distribution list is automatically updated. 37 entry in the distribution list is automatically updated.
38*/ 38*/
39class DistributionList 39class DistributionList
40{ 40{
41 public: 41 public:
42 /** 42 /**
43 @short Distribution List Entry 43 @short Distribution List Entry
44 44
45 This class represents an entry of a distribution list. It consists of an 45 This class represents an entry of a distribution list. It consists of an
46 addressee and an email address. If the email address is null, the 46 addressee and an email address. If the email address is null, the
47 preferred email address of the addressee is used. 47 preferred email address of the addressee is used.
48 */ 48 */
49 struct Entry 49 struct Entry
50 { 50 {
51 typedef QValueList<Entry> List; 51 typedef QValueList<Entry> List;
52 52
53 Entry() {} 53 Entry() {}
54 Entry( const Addressee &_addressee, const QString &_email ) : 54 Entry( const Addressee &_addressee, const QString &_email ) :
55 addressee( _addressee ), email( _email ) {} 55 addressee( _addressee ), email( _email ) {}
56 56
57 Addressee addressee; 57 Addressee addressee;
58 QString email; 58 QString email;
59 }; 59 };
60 60
61 /** 61 /**
62 Create distribution list object. 62 Create distribution list object.
63 63
64 @param manager Managing object of this list. 64 @param manager Managing object of this list.
65 @param name Name of this list. 65 @param name Name of this list.
66 */ 66 */
67 DistributionList( DistributionListManager *manager, const QString &name ); 67 DistributionList( DistributionListManager *manager, const QString &name );
68 68
69 /** 69 /**
70 Destructor. 70 Destructor.
71 */ 71 */
72 ~DistributionList(); 72 ~DistributionList();
73 73
74 /** 74 /**
75 Set name of this list. The name is used as key by the 75 Set name of this list. The name is used as key by the
76 DistributinListManager. 76 DistributinListManager.
77 */ 77 */
78 void setName( const QString & ); 78 void setName( const QString & );
79 79
80 /** 80 /**
81 Get name of this list. 81 Get name of this list.
82 */ 82 */
83 QString name() const; 83 QString name() const;
84 84
85 /** 85 /**
86 Insert an entry into this distribution list. If the entry already exists 86 Insert an entry into this distribution list. If the entry already exists
87 nothing happens. 87 nothing happens.
88 */ 88 */
89 void insertEntry( const Addressee &, const QString &email=QString::null ); 89 void insertEntry( const Addressee &, const QString &email=QString::null );
90 90
91 /** 91 /**
92 Remove an entry from this distribution list. If the entry doesn't exist 92 Remove an entry from this distribution list. If the entry doesn't exist
93 nothing happens. 93 nothing happens.
94 */ 94 */
95 void removeEntry( const Addressee &, const QString &email=QString::null ); 95 void removeEntry( const Addressee &, const QString &email=QString::null );
96 96
97 /** 97 /**
98 Return list of email addresses, which belong to this distributon list. 98 Return list of email addresses, which belong to this distributon list.
99 These addresses can be directly used by e.g. a mail client. 99 These addresses can be directly used by e.g. a mail client.
100 */ 100 */
101 QStringList emails() const; 101 QStringList emails() const;
102 102
103 /** 103 /**
104 Return list of entries belonging to this distribution list. This function 104 Return list of entries belonging to this distribution list. This function
105 is mainly useful for a distribution list editor. 105 is mainly useful for a distribution list editor.
106 */ 106 */
107 Entry::List entries() const; 107 Entry::List entries() const;
108 108
109 private: 109 private:
110 DistributionListManager *mManager; 110 DistributionListManager *mManager;
111 QString mName; 111 QString mName;
112 112
113 Entry::List mEntries; 113 Entry::List mEntries;
114}; 114};
115 115
116/** 116/**
117 @short Manager of distribution lists 117 @short Manager of distribution lists
118 118
119 This class represents a collection of distribution lists, which are associated 119 This class represents a collection of distribution lists, which are associated
120 with a given address book. 120 with a given address book.
121*/ 121*/
122class DistributionListManager 122class DistributionListManager
123{ 123{
124 public: 124 public:
125 /** 125 /**
126 Create manager for given address book. 126 Create manager for given address book.
127 */ 127 */
128 DistributionListManager( AddressBook * ); 128 DistributionListManager( AddressBook * );
129 129
130 /** 130 /**
131 Destructor. 131 Destructor.
132 */ 132 */
133 ~DistributionListManager(); 133 ~DistributionListManager();
134 134
135 /** 135 /**
136 Return distribution list with given name. 136 Return distribution list with given name.
137 */ 137 */
138 DistributionList *list( const QString &name ); 138 DistributionList *list( const QString &name );
139 139
140 /** 140 /**
141 Insert distribution list. If a list with this name already exists, nothing 141 Insert distribution list. If a list with this name already exists, nothing
142 happens. 142 happens.
143 */ 143 */
144 void insert( DistributionList * ); 144 void insert( DistributionList * );
145 145
146 /** 146 /**
147 Remove distribution list. If a list with this name doesn't exist, nothing 147 Remove distribution list. If a list with this name doesn't exist, nothing
148 happens. 148 happens.
149 */ 149 */
150 void remove( DistributionList * ); 150 void remove( DistributionList * );
151 151
152 /** 152 /**
153 Return names of all distribution lists managed by this manager. 153 Return names of all distribution lists managed by this manager.
154 */ 154 */
155 QStringList listNames(); 155 QStringList listNames();
156 156
157 /** 157 /**
158 Load distribution lists form disk. 158 Load distribution lists form disk.
159 */ 159 */
160 bool load(); 160 bool load();
161 161
162 /** 162 /**
163 Save distribution lists to disk. 163 Save distribution lists to disk.
164 */ 164 */
165 bool save(); 165 bool save();
166 166
167 private: 167 private:
168 AddressBook *mAddressBook; 168 AddressBook *mAddressBook;
169 169
170 QPtrList<DistributionList> mLists; 170 QPtrList<DistributionList> mLists;
171}; 171};
172 172
173/** 173/**
174 @short Watchdog for distribution lists 174 @short Watchdog for distribution lists
175 175
176 This class provides a @ref changed() signal that i emitted when the 176 This class provides a @ref changed() signal that i emitted when the
177 distribution lists has changed in some way. 177 distribution lists has changed in some way.
178 178
179 Exapmle: 179 Exapmle:
180 180
181 <pre> 181 <pre>
182 KABC::DistributionListWatcher *watchdog = KABC::DistributionListWatcher::self() 182 KABC::DistributionListWatcher *watchdog = KABC::DistributionListWatcher::self()
183 183
184 connect( watchdog, SIGNAL( changed() ), SLOT( doSomething() ) ); 184 connect( watchdog, SIGNAL( changed() ), SLOT( doSomething() ) );
185 </pre> 185 </pre>
186*/ 186*/
187 187
188class DistributionListWatcher : public QObject 188class DistributionListWatcher : public QObject
189{ 189{
190 Q_OBJECT 190 Q_OBJECT
191 191
192 public: 192 public:
193 /** 193 /**
194 * Returns the watcher object. 194 * Returns the watcher object.
195 */ 195 */
196 static DistributionListWatcher *self(); 196 static DistributionListWatcher *self();
197 197
198 198
199 signals: 199 signals:
200 /** 200 /**
201 * This signal is emmitted whenever the distribution lists has 201 * This signal is emmitted whenever the distribution lists has
202 * changed (if a list was added or removed, when a list was 202 * changed (if a list was added or removed, when a list was
203 * renamed or the entries of the list changed). 203 * renamed or the entries of the list changed).
204 */ 204 */
205 void changed(); 205 void changed();
206 206
207 protected: 207 protected:
208 DistributionListWatcher(); 208 DistributionListWatcher();
209 ~DistributionListWatcher(); 209 ~DistributionListWatcher();
210 210
211 private: 211 private:
212 static DistributionListWatcher* mSelf; 212 static DistributionListWatcher* mSelf;
213#ifndef KAB_EMBEDDED 213//US KDirWatch *mDirWatch;
214 KDirWatch *mDirWatch;
215#endif //KAB_EMBEDDED
216}; 214};
217 215
218} 216}
219#endif 217#endif