KContacts

field.h
1 /*
2  This file is part of the KContacts framework.
3  SPDX-FileCopyrightText: 2002 Cornelius Schumacher <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef KCONTACTS_FIELD_H
9 #define KCONTACTS_FIELD_H
10 
11 #include "addressee.h"
12 #include <QString>
13 
14 class KConfigGroup;
15 
16 namespace KContacts {
32 class KCONTACTS_EXPORT Field
33 {
34 public:
39 
47  All = 0x0,
51  Frequent = 0x01,
55  Address = 0x02,
60  Email = 0x04,
64  Personal = 0x08,
69  Organization = 0x10,
73  CustomCategory = 0x20
74  };
75 
79  Q_REQUIRED_RESULT virtual QString label();
80 
84  Q_REQUIRED_RESULT virtual int category();
85 
92  static QString categoryLabel(int category);
93 
101  Q_REQUIRED_RESULT virtual QString value(const KContacts::Addressee &addressee);
102 
109  Q_REQUIRED_RESULT virtual bool setValue(KContacts::Addressee &addressee, const QString &value);
110 
114  Q_REQUIRED_RESULT QString sortKey(const KContacts::Addressee &addressee);
115 
121  Q_REQUIRED_RESULT virtual bool isCustom();
122 
129  Q_REQUIRED_RESULT virtual bool equals(Field *field);
130 
134  static Field::List allFields();
135 
139  Q_REQUIRED_RESULT static Field::List defaultFields();
140 
149  static Field *createCustomField(const QString &label, int category, const QString &key, const QString &app);
150 
154  static void deleteFields();
155 
163  static void saveFields(KConfigGroup &cfg, const QString &identifier, const Field::List &fields);
172  static void saveFields(const QString &identifier, const Field::List &fields);
173 
180  static Field::List restoreFields(const KConfigGroup &cfg, const QString &identifier);
181 
189  static Field::List restoreFields(const QString &identifier);
190 
191 protected:
200  static void createField(int id, int category = 0);
201 
210  static void createDefaultField(int id, int category = 0);
211 
212 private:
213  class Private;
214 
215  Field(Private *p);
216  virtual ~Field();
217 
218  Private *const d;
219 };
220 }
221 #endif
Class that holds a Email for a contact.
Definition: email.h:23
Organization
Postal address information.
Definition: address.h:27
QList< Field * > List
This type is used for a list of fields.
Definition: field.h:38
address book entry
Definition: addressee.h:68
Represents a field in the Addressbook.
Definition: field.h:32
FieldCategory
Represents the category a field belongs to.
Definition: field.h:43
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Jul 8 2020 22:53:31 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.