kabc
KABC::Field Class Reference
Represents a field in the Addressbook. More...
#include <field.h>
Public Types | |
enum | FieldCategory { All = 0x0, Frequent = 0x01, Address = 0x02, Email = 0x04, Personal = 0x08, Organization = 0x10, CustomCategory = 0x20 } |
typedef QList< Field * > | List |
Public Member Functions | |
virtual int | category () |
virtual bool | equals (Field *field) |
virtual bool | isCustom () |
virtual QString | label () |
virtual bool | setValue (KABC::Addressee &, const QString &) |
QString | sortKey (const KABC::Addressee &) |
virtual QString | value (const KABC::Addressee &) |
Static Public Member Functions | |
static Field::List | allFields () |
static QString | categoryLabel (int category) |
static Field * | createCustomField (const QString &label, int category, const QString &key, const QString &app) |
static Field::List | defaultFields () |
static void | deleteFields () |
static Field::List | restoreFields (const QString &identifier) |
static Field::List | restoreFields (const KConfigGroup &cfg, const QString &identifier) |
static void | saveFields (const QString &identifier, const Field::List &fields) |
static void | saveFields (KConfigGroup &cfg, const QString &identifier, const Field::List &fields) |
Static Protected Member Functions | |
static void | createDefaultField (int id, int category=0) |
static void | createField (int id, int category=0) |
Detailed Description
Represents a field in the Addressbook.
This class represents a field in the Addressbook database. It provides methods for accessing meta-information about the field (such as label() or category()) as well as getting or setting the field's value in an instance of Addressee (value(), setValue()).
Furthermore, some static methods are provided for getting a list of all fields (allFields(), defaultFields()), for creating new fields (createCustomField()) and for saving or loading fields to/from a config file (saveFields(), restoreFields()).
Definition at line 46 of file field.h.
Member Typedef Documentation
typedef QList<Field *> KABC::Field::List |
Member Enumeration Documentation
Represents the category a field belongs to.
- Enumerator:
All All fields.
Frequent Frequently used fields.
Address Fields which belong to the address, such as Street, City, Zip, etc.
Email Fields which store information about the e-mail contact, such as e-mail address or mail client.
Personal Personal fields, such as Birthday, Home Address fields, IM Address, etc.
Organization Fields about the organization, such as Business Address fields, Department, Profession, etc.
CustomCategory Custom (user-defined) fields.
Member Function Documentation
static Field::List KABC::Field::allFields | ( | ) | [static] |
Returns a list of all fields.
virtual int KABC::Field::category | ( | ) | [virtual] |
Returns the ored categories the field belongs to.
static QString KABC::Field::categoryLabel | ( | int | category | ) | [static] |
Returns the translated label for category
.
- Parameters:
-
category the category of type FieldCategory
- Returns:
- the translated label
static Field* KABC::Field::createCustomField | ( | const QString & | label, | |
int | category, | |||
const QString & | key, | |||
const QString & | app | |||
) | [static] |
Creates a custom field.
- Parameters:
-
label The label for this field category The category of this field key Unique key for this field app Unique app name for this field
static void KABC::Field::createDefaultField | ( | int | id, | |
int | category = 0 | |||
) | [static, protected] |
For internal use only.
Creates a field and appends it to the list of default fields.
- Parameters:
-
id The identifier for the field category The optional category for the field
static void KABC::Field::createField | ( | int | id, | |
int | category = 0 | |||
) | [static, protected] |
For internal use only.
Creates a field and appends it to the general list of fields.
- Parameters:
-
id The identifier for the field category The optional category for the field
static Field::List KABC::Field::defaultFields | ( | ) | [static] |
Returns a list of the default fields.
static void KABC::Field::deleteFields | ( | ) | [static] |
Delete all fields from list.
virtual bool KABC::Field::equals | ( | Field * | field | ) | [virtual] |
Returns, if the field is equal with field
.
- Parameters:
-
field the field to compare this field to
- Returns:
true
if the fields are equal,false
otherwise
virtual bool KABC::Field::isCustom | ( | ) | [virtual] |
Returns, if the field is a user-defined field.
- Returns:
true
if this is a custom field,false
otherwise
virtual QString KABC::Field::label | ( | ) | [virtual] |
Returns the translated label for this field.
static Field::List KABC::Field::restoreFields | ( | const QString & | identifier | ) | [static] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Here, the list is loaded from KGlobal::config() from group "KABCFields".
- Parameters:
-
identifier The unique identifier
static Field::List KABC::Field::restoreFields | ( | const KConfigGroup & | cfg, | |
const QString & | identifier | |||
) | [static] |
Load the field settings from a config file.
- Parameters:
-
cfg The config file object identifier The unique identifier
static void KABC::Field::saveFields | ( | const QString & | identifier, | |
const Field::List & | fields | |||
) | [static] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Here, the list is stored in KGlobal::config() in group "KABCFields".
- Parameters:
-
identifier The unique identifier fields The list of the fields
static void KABC::Field::saveFields | ( | KConfigGroup & | cfg, | |
const QString & | identifier, | |||
const Field::List & | fields | |||
) | [static] |
Save the field settings to a config file.
- Parameters:
-
cfg The config file object identifier The unique identifier fields The list of the fields
virtual bool KABC::Field::setValue | ( | KABC::Addressee & | , | |
const QString & | ||||
) | [virtual] |
Sets the value of the field in the given Addressee.
- Returns:
true
on success orfalse
, if the given string couldn't be converted to a valid value.
QString KABC::Field::sortKey | ( | const KABC::Addressee & | ) |
Returns a string, that can be used for sorting.
virtual QString KABC::Field::value | ( | const KABC::Addressee & | ) | [virtual] |
Returns a string representation of the value the field has in the given Addressee.
- Returns:
- the string representation of the value or QString(), if it is not possible to convert the value to a string.
The documentation for this class was generated from the following file: