• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

kabc

  • KABC
  • Field
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | List of all members
KABC::Field Class Reference

#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 KConfigGroup &cfg, const QString &identifier)
 
static Field::List restoreFields (const QString &identifier)
 
static void saveFields (KConfigGroup &cfg, const QString &identifier, const Field::List &fields)
 
static void saveFields (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

This type is used for a list of fields.

Definition at line 52 of file field.h.

Member Enumeration Documentation

enum KABC::Field::FieldCategory

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.

Definition at line 57 of file field.h.

Member Function Documentation

Field::List Field::allFields ( )
static

Returns a list of all fields.

Definition at line 464 of file field.cpp.

int Field::category ( )
virtual

Returns the ored categories the field belongs to.

Definition at line 204 of file field.cpp.

QString Field::categoryLabel ( int  category)
static

Returns the translated label for category.

Parameters
categorythe category of type FieldCategory
Returns
the translated label

Definition at line 209 of file field.cpp.

Field * Field::createCustomField ( const QString &  label,
int  category,
const QString &  key,
const QString &  app 
)
static

Creates a custom field.

Parameters
labelThe label for this field
categoryThe category of this field
keyUnique key for this field
appUnique app name for this field

Definition at line 623 of file field.cpp.

void Field::createDefaultField ( int  id,
int  category = 0 
)
staticprotected

Creates a field and appends it to the list of default fields.

Parameters
idThe identifier for the field
categoryThe optional category for the field

Definition at line 525 of file field.cpp.

void Field::createField ( int  id,
int  category = 0 
)
staticprotected

Creates a field and appends it to the general list of fields.

Parameters
idThe identifier for the field
categoryThe optional category for the field

Definition at line 520 of file field.cpp.

Field::List Field::defaultFields ( )
static

Returns a list of the default fields.

Definition at line 510 of file field.cpp.

void Field::deleteFields ( )
static

Delete all fields from list.

Definition at line 530 of file field.cpp.

bool Field::equals ( Field *  field)
virtual

Returns, if the field is equal with field.

Parameters
fieldthe field to compare this field to
Returns
true if the fields are equal, false otherwise

Definition at line 612 of file field.cpp.

bool Field::isCustom ( )
virtual

Returns, if the field is a user-defined field.

Returns
true if this is a custom field, false otherwise

Definition at line 459 of file field.cpp.

QString Field::label ( )
virtual

Returns the translated label for this field.

Definition at line 118 of file field.cpp.

Field::List Field::restoreFields ( const KConfigGroup &  cfg,
const QString &  identifier 
)
static

Load the field settings from a config file.

Parameters
cfgThe config file object
identifierThe unique identifier

Definition at line 587 of file field.cpp.

Field::List 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
identifierThe unique identifier

Definition at line 580 of file field.cpp.

void Field::saveFields ( KConfigGroup &  cfg,
const QString &  identifier,
const Field::List &  fields 
)
static

Save the field settings to a config file.

Parameters
cfgThe config file object
identifierThe unique identifier
fieldsThe list of the fields

Definition at line 558 of file field.cpp.

void 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
identifierThe unique identifier
fieldsThe list of the fields

Definition at line 550 of file field.cpp.

bool Field::setValue ( KABC::Addressee &  a,
const QString &  value 
)
virtual

Sets the value of the field in the given Addressee.

Returns
true on success or false, if the given string couldn't be converted to a valid value.

Definition at line 364 of file field.cpp.

QString Field::sortKey ( const KABC::Addressee &  a)

Returns a string, that can be used for sorting.

Definition at line 417 of file field.cpp.

QString Field::value ( const KABC::Addressee &  a)
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.

Definition at line 231 of file field.cpp.


The documentation for this class was generated from the following files:
  • field.h
  • field.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:01:06 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kabc

Skip menu "kabc"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal