kabc
field.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KABC_FIELD_H
00022 #define KABC_FIELD_H
00023
00024 #include "addressee.h"
00025 #include <QtCore/QString>
00026
00027 class KConfigGroup;
00028
00029 namespace KABC {
00030
00046 class KABC_EXPORT Field
00047 {
00048 public:
00052 typedef QList<Field *> List;
00053
00057 enum FieldCategory {
00061 All = 0x0,
00065 Frequent = 0x01,
00069 Address = 0x02,
00074 Email = 0x04,
00078 Personal = 0x08,
00083 Organization = 0x10,
00087 CustomCategory = 0x20
00088 };
00089
00093 virtual QString label();
00094
00098 virtual int category();
00099
00106 static QString categoryLabel( int category );
00107
00115 virtual QString value( const KABC::Addressee & );
00116
00123 virtual bool setValue( KABC::Addressee &, const QString & );
00124
00128 QString sortKey( const KABC::Addressee & );
00129
00135 virtual bool isCustom();
00136
00143 virtual bool equals( Field *field );
00144
00148 static Field::List allFields();
00149
00153 static Field::List defaultFields();
00154
00163 static Field *createCustomField( const QString &label, int category,
00164 const QString &key, const QString &app );
00165
00169 static void deleteFields();
00170
00178 static void saveFields( KConfigGroup &cfg, const QString &identifier,
00179 const Field::List &fields );
00188 static void saveFields( const QString &identifier,
00189 const Field::List &fields );
00190
00197 static Field::List restoreFields( const KConfigGroup &cfg, const QString &identifier );
00198
00206 static Field::List restoreFields( const QString &identifier );
00207
00208 protected:
00217 static void createField( int id, int category = 0 );
00218
00227 static void createDefaultField( int id, int category = 0 );
00228
00229 private:
00230 class Private;
00231
00232 Field( Private * );
00233 virtual ~Field();
00234
00235 Private *const d;
00236 };
00237
00238 }
00239 #endif