author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kabc/distributionlist.h | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | kabc/distributionlist.h | 7 |
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,212 +1,215 @@ | |||
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 | ||
28 | namespace KABC { | 31 | namespace KABC { |
29 | 32 | ||
30 | class DistributionListManager; | 33 | class 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 | */ |
39 | class DistributionList | 42 | class 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. |
100 | */ | 103 | */ |
101 | QStringList emails() const; | 104 | QStringList emails() const; |
102 | 105 | ||
103 | /** | 106 | /** |
104 | Return list of entries belonging to this distribution list. This function | 107 | Return list of entries belonging to this distribution list. This function |
105 | is mainly useful for a distribution list editor. | 108 | is mainly useful for a distribution list editor. |
106 | */ | 109 | */ |
107 | Entry::List entries() const; | 110 | Entry::List entries() const; |
108 | 111 | ||
109 | private: | 112 | private: |
110 | DistributionListManager *mManager; | 113 | DistributionListManager *mManager; |
111 | QString mName; | 114 | QString mName; |
112 | 115 | ||
113 | Entry::List mEntries; | 116 | Entry::List mEntries; |
114 | }; | 117 | }; |
115 | 118 | ||
116 | /** | 119 | /** |
117 | @short Manager of distribution lists | 120 | @short Manager of distribution lists |
118 | 121 | ||
119 | This class represents a collection of distribution lists, which are associated | 122 | This class represents a collection of distribution lists, which are associated |
120 | with a given address book. | 123 | with a given address book. |
121 | */ | 124 | */ |
122 | class DistributionListManager | 125 | class 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 | /* |
189 | class DistributionListWatcher : public QObject | 192 | class 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 |