KContacts

contactgroup.h
1 /*
2  This file is part of the KContacts framework.
3  SPDX-FileCopyrightText: 2008 Tobias Koenig <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef KCONTACTS_CONTACTGROUP_H
9 #define KCONTACTS_CONTACTGROUP_H
10 
11 #include <QVector>
12 #include <QSharedDataPointer>
13 #include <QMetaType>
14 
15 #include "kcontacts_export.h"
16 
17 class QString;
18 
19 namespace KContacts {
32 class KCONTACTS_EXPORT ContactGroup
33 {
34 public:
35 
39  class KCONTACTS_EXPORT ContactReference
40  {
41  public:
46 
51 
55  ContactReference(const ContactReference &other);
56 
60  ContactReference(const QString &uid);
61 
66 
73  void setUid(const QString &uid);
74 
81  Q_REQUIRED_RESULT QString uid() const;
82 
88  void setGid(const QString &gid);
89 
94  Q_REQUIRED_RESULT QString gid() const;
95 
99  void setPreferredEmail(const QString &email);
100 
105  Q_REQUIRED_RESULT QString preferredEmail() const;
106 
115  void insertCustom(const QString &key, const QString &value);
116 
120  void removeCustom(const QString &key);
121 
126  Q_REQUIRED_RESULT QString custom(const QString &key) const;
127 
131  ContactReference &operator=(const ContactReference &other);
132 
136  Q_REQUIRED_RESULT bool operator==(const ContactReference &other) const;
137 
138  private:
139  class ContactReferencePrivate;
141  };
142 
146  class KCONTACTS_EXPORT ContactGroupReference
147  {
148  public:
153 
158 
163 
167  ContactGroupReference(const QString &uid);
168 
173 
177  void setUid(const QString &uid);
178 
182  QString uid() const;
183 
192  void insertCustom(const QString &key, const QString &value);
193 
197  void removeCustom(const QString &key);
198 
203  QString custom(const QString &key) const;
204 
208  ContactGroupReference &operator=(const ContactGroupReference &other);
209 
213  bool operator==(const ContactGroupReference &other) const;
214 
215  private:
216  class ContactGroupReferencePrivate;
218  };
219 
223  class KCONTACTS_EXPORT Data
224  {
225  public:
230 
234  Data();
235 
239  Data(const Data &other);
240 
244  Data(const QString &name, const QString &email);
245 
249  ~Data();
250 
254  void setName(const QString &name);
255 
259  Q_REQUIRED_RESULT QString name() const;
260 
264  void setEmail(const QString &email);
265 
269  Q_REQUIRED_RESULT QString email() const;
270 
279  void insertCustom(const QString &key, const QString &value);
280 
284  void removeCustom(const QString &key);
285 
290  Q_REQUIRED_RESULT QString custom(const QString &key) const;
291 
295  Data &operator=(const Data &other);
296 
300  Q_REQUIRED_RESULT bool operator==(const Data &other) const;
301 
302  private:
303  class DataPrivate;
305  };
306 
311 
315  ContactGroup();
316 
320  ContactGroup(const ContactGroup &other);
321 
325  ContactGroup(const QString &name);
326 
330  ~ContactGroup();
331 
335  void setId(const QString &id);
336 
340  Q_REQUIRED_RESULT QString id() const;
341 
345  void setName(const QString &name);
346 
350  Q_REQUIRED_RESULT QString name() const;
351 
356  Q_REQUIRED_RESULT int count() const;
357 
361  Q_REQUIRED_RESULT int contactReferenceCount() const;
362 
366  Q_REQUIRED_RESULT int contactGroupReferenceCount() const;
367 
371  Q_REQUIRED_RESULT int dataCount() const;
372 
376  Q_REQUIRED_RESULT ContactReference &contactReference(int index);
377 
381  const ContactReference &contactReference(int index) const;
382 
386  ContactGroupReference &contactGroupReference(int index);
387 
391  const ContactGroupReference &contactGroupReference(int index) const;
392 
396  Data &data(int index);
397 
401  const Data &data(int index) const;
402 
406  void append(const ContactReference &reference);
407 
411  void append(const ContactGroupReference &reference);
412 
416  void append(const Data &data);
417 
421  void remove(const ContactReference &reference);
422 
426  void remove(const ContactGroupReference &reference);
427 
431  void remove(const Data &data);
432 
436  void removeAllContactReferences();
437 
441  void removeAllContactGroupReferences();
442 
446  void removeAllContactData();
447 
451  ContactGroup &operator=(const ContactGroup &other);
452 
456  Q_REQUIRED_RESULT bool operator==(const ContactGroup &other) const;
457 
461  static QString mimeType();
462 
463 private:
464  class Private;
466 };
467 }
468 Q_DECLARE_TYPEINFO(KContacts::ContactGroup::ContactGroupReference, Q_MOVABLE_TYPE);
469 Q_DECLARE_TYPEINFO(KContacts::ContactGroup::ContactReference, Q_MOVABLE_TYPE);
470 
471 #define KCONTACTS_CONTACTGROUP_METATYPE_DEFINED
472 Q_DECLARE_METATYPE(KContacts::ContactGroup)
473 
474 #endif
This class represents a group of contacts.
Definition: contactgroup.h:32
This class represents a contact group reference.
Definition: contactgroup.h:146
QVector< Data > List
A list of contact data.
Definition: contactgroup.h:229
QVector< ContactGroup > List
A list of contact groups.
Definition: contactgroup.h:310
This class represents a contact reference.
Definition: contactgroup.h:39
QVector< ContactGroupReference > List
A list of contact group references.
Definition: contactgroup.h:152
This class represents a contact data object.
Definition: contactgroup.h:223
QVector< ContactReference > List
A list of contact references.
Definition: contactgroup.h:45
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Sep 21 2020 22:55:31 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.