summaryrefslogtreecommitdiffabout
path: root/kabc/addressbook.h
Unidiff
Diffstat (limited to 'kabc/addressbook.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 3a8e028..f89d7da 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -35,39 +35,39 @@ $Id$
35 35
36#include "addressee.h" 36#include "addressee.h"
37#include "field.h" 37#include "field.h"
38 38
39namespace KABC { 39namespace KABC {
40 40
41class ErrorHandler; 41class ErrorHandler;
42class Resource; 42class Resource;
43class Ticket; 43class Ticket;
44 44
45/** 45/**
46 @short Address Book 46 @short Address Book
47 47
48 This class provides access to a collection of address book entries. 48 This class provides access to a collection of address book entries.
49*/ 49*/
50class AddressBook : public QObject 50class AddressBook : public QObject
51{ 51{
52 Q_OBJECT 52 Q_OBJECT
53 53
54 friend QDataStream &operator<<( QDataStream &, const AddressBook & ); 54 friend QDataStream &operator<<( QDataStream &, const AddressBook & );
55 friend QDataStream &operator>>( QDataStream &, AddressBook & ); 55 friend QDataStream &operator>>( QDataStream &, AddressBook & );
56 friend class StdAddressBook; 56 friend class StdAddressBook;
57 57
58 public: 58 public:
59 /** 59 /**
60 @short Address Book Iterator 60 @short Address Book Iterator
61 61
62 This class provides an iterator for address book entries. 62 This class provides an iterator for address book entries.
63 */ 63 */
64 class Iterator 64 class Iterator
65 { 65 {
66 public: 66 public:
67 Iterator(); 67 Iterator();
68 Iterator( const Iterator & ); 68 Iterator( const Iterator & );
69 ~Iterator(); 69 ~Iterator();
70 70
71 Iterator &operator=( const Iterator & ); 71 Iterator &operator=( const Iterator & );
72 const Addressee &operator*() const; 72 const Addressee &operator*() const;
73 Addressee &operator*(); 73 Addressee &operator*();
@@ -76,76 +76,77 @@ class AddressBook : public QObject
76 Iterator &operator++(int); 76 Iterator &operator++(int);
77 Iterator &operator--(); 77 Iterator &operator--();
78 Iterator &operator--(int); 78 Iterator &operator--(int);
79 bool operator==( const Iterator &it ); 79 bool operator==( const Iterator &it );
80 bool operator!=( const Iterator &it ); 80 bool operator!=( const Iterator &it );
81 81
82 struct IteratorData; 82 struct IteratorData;
83 IteratorData *d; 83 IteratorData *d;
84 }; 84 };
85 85
86 /** 86 /**
87 @short Address Book Const Iterator 87 @short Address Book Const Iterator
88 88
89 This class provides a const iterator for address book entries. 89 This class provides a const iterator for address book entries.
90 */ 90 */
91 class ConstIterator 91 class ConstIterator
92 { 92 {
93 public: 93 public:
94 ConstIterator(); 94 ConstIterator();
95 ConstIterator( const ConstIterator & ); 95 ConstIterator( const ConstIterator & );
96 ~ConstIterator(); 96 ~ConstIterator();
97 97
98 ConstIterator &operator=( const ConstIterator & ); 98 ConstIterator &operator=( const ConstIterator & );
99 const Addressee &operator*() const; 99 const Addressee &operator*() const;
100 const Addressee* operator->() const; 100 const Addressee* operator->() const;
101 ConstIterator &operator++(); 101 ConstIterator &operator++();
102 ConstIterator &operator++(int); 102 ConstIterator &operator++(int);
103 ConstIterator &operator--(); 103 ConstIterator &operator--();
104 ConstIterator &operator--(int); 104 ConstIterator &operator--(int);
105 bool operator==( const ConstIterator &it ); 105 bool operator==( const ConstIterator &it );
106 bool operator!=( const ConstIterator &it ); 106 bool operator!=( const ConstIterator &it );
107 107
108 struct ConstIteratorData; 108 struct ConstIteratorData;
109 ConstIteratorData *d; 109 ConstIteratorData *d;
110 }; 110 };
111 111
112 /** 112 /**
113 Constructs a address book object. 113 Constructs a address book object.
114 114
115 @param format File format class. 115 @param format File format class.
116 */ 116 */
117 AddressBook(); 117 AddressBook();
118 AddressBook( const QString &config ); 118 AddressBook( const QString &config );
119 AddressBook( const QString &config, const QString &family );
119 virtual ~AddressBook(); 120 virtual ~AddressBook();
120 121
121 /** 122 /**
122 Requests a ticket for saving the addressbook. Calling this function locks 123 Requests a ticket for saving the addressbook. Calling this function locks
123 the addressbook for all other processes. If the address book is already 124 the addressbook for all other processes. If the address book is already
124 locked the function returns 0. You need the returned @ref Ticket object 125 locked the function returns 0. You need the returned @ref Ticket object
125 for calling the @ref save() function. 126 for calling the @ref save() function.
126 127
127 @see save() 128 @see save()
128 */ 129 */
129 Ticket *requestSaveTicket( Resource *resource=0 ); 130 Ticket *requestSaveTicket( Resource *resource=0 );
130 131
131 /** 132 /**
132 Load address book from file. 133 Load address book from file.
133 */ 134 */
134 bool load(); 135 bool load();
135 136
136 /** 137 /**
137 Save address book. The address book is saved to the file, the Ticket 138 Save address book. The address book is saved to the file, the Ticket
138 object has been requested for by @ref requestSaveTicket(). 139 object has been requested for by @ref requestSaveTicket().
139 140
140 @param ticket a ticket object returned by @ref requestSaveTicket() 141 @param ticket a ticket object returned by @ref requestSaveTicket()
141 */ 142 */
142 bool save( Ticket *ticket ); 143 bool save( Ticket *ticket );
143 144
144 /** 145 /**
145 Returns a iterator for first entry of address book. 146 Returns a iterator for first entry of address book.
146 */ 147 */
147 Iterator begin(); 148 Iterator begin();
148 149
149 /** 150 /**
150 Returns a const iterator for first entry of address book. 151 Returns a const iterator for first entry of address book.
151 */ 152 */
@@ -156,25 +157,25 @@ class AddressBook : public QObject
156 */ 157 */
157 Iterator end(); 158 Iterator end();
158 159
159 /** 160 /**
160 Returns a const iterator for first entry of address book. 161 Returns a const iterator for first entry of address book.
161 */ 162 */
162 ConstIterator end() const; 163 ConstIterator end() const;
163 164
164 /** 165 /**
165 Removes all entries from address book. 166 Removes all entries from address book.
166 */ 167 */
167 void clear(); 168 void clear();
168 169
169 /** 170 /**
170 Insert an Addressee object into address book. If an object with the same 171 Insert an Addressee object into address book. If an object with the same
171 unique id already exists in the address book it it replaced by the new 172 unique id already exists in the address book it it replaced by the new
172 one. If not the new object is appended to the address book. 173 one. If not the new object is appended to the address book.
173 */ 174 */
174 void insertAddressee( const Addressee & ); 175 void insertAddressee( const Addressee & );
175 176
176 /** 177 /**
177 Removes entry from the address book. 178 Removes entry from the address book.
178 */ 179 */
179 void removeAddressee( const Addressee & ); 180 void removeAddressee( const Addressee & );
180 181
@@ -234,36 +235,36 @@ class AddressBook : public QObject
234 void emitAddressBookLocked() { emit addressBookLocked( this ); } 235 void emitAddressBookLocked() { emit addressBookLocked( this ); }
235 void emitAddressBookUnlocked() { emit addressBookUnlocked( this ); } 236 void emitAddressBookUnlocked() { emit addressBookUnlocked( this ); }
236 void emitAddressBookChanged() { emit addressBookChanged( this ); } 237 void emitAddressBookChanged() { emit addressBookChanged( this ); }
237 238
238 /** 239 /**
239 Return list of all Fields known to the address book which are associated 240 Return list of all Fields known to the address book which are associated
240 with the given field category. 241 with the given field category.
241 */ 242 */
242 Field::List fields( int category = Field::All ); 243 Field::List fields( int category = Field::All );
243 244
244 /** 245 /**
245 Add custom field to address book. 246 Add custom field to address book.
246 247
247 @param label User visible label of the field. 248 @param label User visible label of the field.
248 @param category Ored list of field categories. 249 @param category Ored list of field categories.
249 @param key Identifier used as key for reading and writing the field. 250 @param key Identifier used as key for reading and writing the field.
250 @param app String used as application key for reading and writing 251 @param app String used as application key for reading and writing
251 the field. 252 the field.
252 */ 253 */
253 bool addCustomField( const QString &label, int category = Field::All, 254 bool addCustomField( const QString &label, int category = Field::All,
254 const QString &key = QString::null, 255 const QString &key = QString::null,
255 const QString &app = QString::null ); 256 const QString &app = QString::null );
256 257
257 258
258 /** 259 /**
259 Add address book resource. 260 Add address book resource.
260 */ 261 */
261 bool addResource( Resource * ); 262 bool addResource( Resource * );
262 263
263 /** 264 /**
264 Remove address book resource. 265 Remove address book resource.
265 */ 266 */
266 bool removeResource( Resource * ); 267 bool removeResource( Resource * );
267 268
268 /** 269 /**
269 Return pointer list of all resources. 270 Return pointer list of all resources.
@@ -299,29 +300,28 @@ class AddressBook : public QObject
299 300
300 /** 301 /**
301 Emitted, when the address book has been unlocked. 302 Emitted, when the address book has been unlocked.
302 */ 303 */
303 void addressBookUnlocked( AddressBook * ); 304 void addressBookUnlocked( AddressBook * );
304 305
305 protected: 306 protected:
306 void deleteRemovedAddressees(); 307 void deleteRemovedAddressees();
307 void setStandardResource( Resource * ); 308 void setStandardResource( Resource * );
308 Resource *standardResource(); 309 Resource *standardResource();
309 KRES::Manager<Resource> *resourceManager(); 310 KRES::Manager<Resource> *resourceManager();
310 311
312 void init(const QString &config, const QString &family);
313
311 private: 314 private:
312//US QPtrList<Resource> mDummy; // Remove in KDE 4 315//US QPtrList<Resource> mDummy; // Remove in KDE 4
313 316
314//US optimization
315 void init(const QString &config);
316
317 317
318 struct AddressBookData; 318 struct AddressBookData;
319 AddressBookData *d; 319 AddressBookData *d;
320}; 320};
321 321
322QDataStream &operator<<( QDataStream &, const AddressBook & ); 322QDataStream &operator<<( QDataStream &, const AddressBook & );
323QDataStream &operator>>( QDataStream &, AddressBook & ); 323QDataStream &operator>>( QDataStream &, AddressBook & );
324 324
325} 325}
326 326
327#endif 327#endif