summaryrefslogtreecommitdiffabout
path: root/kabc/distributionlist.h
Unidiff
Diffstat (limited to 'kabc/distributionlist.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/distributionlist.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/kabc/distributionlist.h b/kabc/distributionlist.h
index c81e543..8d21a17 100644
--- a/kabc/distributionlist.h
+++ b/kabc/distributionlist.h
@@ -1,99 +1,102 @@
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//Added by qt3to4:
28#include <Q3ValueList>
29#include <Q3PtrList>
27 30
28namespace KABC { 31namespace KABC {
29 32
30class DistributionListManager; 33class DistributionListManager;
31 34
32/** 35/**
33 @short Distribution list of email addresses 36 @short Distribution list of email addresses
34 37
35 This class represents a list of email addresses. Each email address is 38 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 39 associated with an address book entry. If the address book entry changes, the
37 entry in the distribution list is automatically updated. 40 entry in the distribution list is automatically updated.
38*/ 41*/
39class DistributionList 42class DistributionList
40{ 43{
41 public: 44 public:
42 /** 45 /**
43 @short Distribution List Entry 46 @short Distribution List Entry
44 47
45 This class represents an entry of a distribution list. It consists of an 48 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 49 addressee and an email address. If the email address is null, the
47 preferred email address of the addressee is used. 50 preferred email address of the addressee is used.
48 */ 51 */
49 struct Entry 52 struct Entry
50 { 53 {
51 typedef QValueList<Entry> List; 54 typedef Q3ValueList<Entry> List;
52 55
53 Entry() {} 56 Entry() {}
54 Entry( const Addressee &_addressee, const QString &_email ) : 57 Entry( const Addressee &_addressee, const QString &_email ) :
55 addressee( _addressee ), email( _email ) {} 58 addressee( _addressee ), email( _email ) {}
56 59
57 Addressee addressee; 60 Addressee addressee;
58 QString email; 61 QString email;
59 }; 62 };
60 63
61 /** 64 /**
62 Create distribution list object. 65 Create distribution list object.
63 66
64 @param manager Managing object of this list. 67 @param manager Managing object of this list.
65 @param name Name of this list. 68 @param name Name of this list.
66 */ 69 */
67 DistributionList( DistributionListManager *manager, const QString &name ); 70 DistributionList( DistributionListManager *manager, const QString &name );
68 71
69 /** 72 /**
70 Destructor. 73 Destructor.
71 */ 74 */
72 ~DistributionList(); 75 ~DistributionList();
73 76
74 /** 77 /**
75 Set name of this list. The name is used as key by the 78 Set name of this list. The name is used as key by the
76 DistributinListManager. 79 DistributinListManager.
77 */ 80 */
78 void setName( const QString & ); 81 void setName( const QString & );
79 82
80 /** 83 /**
81 Get name of this list. 84 Get name of this list.
82 */ 85 */
83 QString name() const; 86 QString name() const;
84 87
85 /** 88 /**
86 Insert an entry into this distribution list. If the entry already exists 89 Insert an entry into this distribution list. If the entry already exists
87 nothing happens. 90 nothing happens.
88 */ 91 */
89 void insertEntry( const Addressee &, const QString &email=QString::null ); 92 void insertEntry( const Addressee &, const QString &email=QString::null );
90 93
91 /** 94 /**
92 Remove an entry from this distribution list. If the entry doesn't exist 95 Remove an entry from this distribution list. If the entry doesn't exist
93 nothing happens. 96 nothing happens.
94 */ 97 */
95 void removeEntry( const Addressee &, const QString &email=QString::null ); 98 void removeEntry( const Addressee &, const QString &email=QString::null );
96 99
97 /** 100 /**
98 Return list of email addresses, which belong to this distributon list. 101 Return list of email addresses, which belong to this distributon list.
99 These addresses can be directly used by e.g. a mail client. 102 These addresses can be directly used by e.g. a mail client.
@@ -122,91 +125,91 @@ class DistributionList
122class DistributionListManager 125class DistributionListManager
123{ 126{
124 public: 127 public:
125 /** 128 /**
126 Create manager for given address book. 129 Create manager for given address book.
127 */ 130 */
128 DistributionListManager( AddressBook * ); 131 DistributionListManager( AddressBook * );
129 132
130 /** 133 /**
131 Destructor. 134 Destructor.
132 */ 135 */
133 ~DistributionListManager(); 136 ~DistributionListManager();
134 137
135 /** 138 /**
136 Return distribution list with given name. 139 Return distribution list with given name.
137 */ 140 */
138 DistributionList *list( const QString &name ); 141 DistributionList *list( const QString &name );
139 142
140 /** 143 /**
141 Insert distribution list. If a list with this name already exists, nothing 144 Insert distribution list. If a list with this name already exists, nothing
142 happens. 145 happens.
143 */ 146 */
144 void insert( DistributionList * ); 147 void insert( DistributionList * );
145 148
146 /** 149 /**
147 Remove distribution list. If a list with this name doesn't exist, nothing 150 Remove distribution list. If a list with this name doesn't exist, nothing
148 happens. 151 happens.
149 */ 152 */
150 void remove( DistributionList * ); 153 void remove( DistributionList * );
151 154
152 /** 155 /**
153 Return names of all distribution lists managed by this manager. 156 Return names of all distribution lists managed by this manager.
154 */ 157 */
155 QStringList listNames(); 158 QStringList listNames();
156 159
157 /** 160 /**
158 Load distribution lists form disk. 161 Load distribution lists form disk.
159 */ 162 */
160 bool load(); 163 bool load();
161 164
162 /** 165 /**
163 Save distribution lists to disk. 166 Save distribution lists to disk.
164 */ 167 */
165 bool save(); 168 bool save();
166 169
167 private: 170 private:
168 AddressBook *mAddressBook; 171 AddressBook *mAddressBook;
169 172
170 QPtrList<DistributionList> mLists; 173 Q3PtrList<DistributionList> mLists;
171}; 174};
172 175
173/** 176/**
174 @short Watchdog for distribution lists 177 @short Watchdog for distribution lists
175 178
176 This class provides a @ref changed() signal that i emitted when the 179 This class provides a @ref changed() signal that i emitted when the
177 distribution lists has changed in some way. 180 distribution lists has changed in some way.
178 181
179 Exapmle: 182 Exapmle:
180 183
181 <pre> 184 <pre>
182 KABC::DistributionListWatcher *watchdog = KABC::DistributionListWatcher::self() 185 KABC::DistributionListWatcher *watchdog = KABC::DistributionListWatcher::self()
183 186
184 connect( watchdog, SIGNAL( changed() ), SLOT( doSomething() ) ); 187 connect( watchdog, SIGNAL( changed() ), SLOT( doSomething() ) );
185 </pre> 188 </pre>
186*/ 189*/
187 190
188/* 191/*
189class DistributionListWatcher : public QObject 192class DistributionListWatcher : public QObject
190{ 193{
191 Q_OBJECT_XX 194 Q_OBJECT_XX
192 195
193 public: 196 public:
194 197
195 static DistributionListWatcher *self(); 198 static DistributionListWatcher *self();
196 199
197 200
198 signals: 201 signals:
199 202
200 void changed(); 203 void changed();
201 204
202 protected: 205 protected:
203 DistributionListWatcher(); 206 DistributionListWatcher();
204 ~DistributionListWatcher(); 207 ~DistributionListWatcher();
205 208
206 private: 209 private:
207 static DistributionListWatcher* mSelf; 210 static DistributionListWatcher* mSelf;
208 KDirWatch *mDirWatch; 211 KDirWatch *mDirWatch;
209}; 212};
210*/ 213*/
211} 214}
212#endif 215#endif