24 #ifndef CUSTOMFIELDSWIDGET_H
25 #define CUSTOMFIELDSWIDGET_H
27 #include <tdeabc/addressee.h>
28 #include <kdialogbase.h>
29 #include <tdelocale.h>
33 #include <tqstringlist.h>
34 #include <tqvaluevector.h>
37 #include "contacteditorwidget.h"
56 TQHBoxLayout *mLayout;
59 typedef TQValueList<FieldRecord> FieldRecordList;
61 class AddFieldDialog :
public KDialogBase
67 AddFieldDialog( TQWidget *parent,
const char *name = 0 );
69 TQString title()
const;
70 TQString identifier()
const;
71 TQString type()
const;
72 bool isGlobal()
const;
75 void nameChanged(
const TQString& );
82 TQValueVector<TQString> mTypeList;
83 TQValueVector<TQString> mTypeName;
86 class FieldWidget :
public TQWidget
92 FieldWidget( TQWidget *parent,
const char *name = 0 );
94 void addField(
const TQString &identifier,
const TQString &title,
95 const TQString &type,
bool isGlobal );
97 void removeField(
const TQString &identifier );
99 void loadContact( TDEABC::Addressee *addr );
100 void storeContact( TDEABC::Addressee *addr );
101 void setReadOnly(
bool readOnly );
103 FieldRecordList fields()
const {
return mFieldList; }
105 void removeLocalFields();
112 void recalculateLayout();
114 TQVBoxLayout *mGlobalLayout;
115 TQVBoxLayout *mLocalLayout;
118 FieldRecordList mFieldList;
121 class CustomFieldsWidget :
public KAB::ContactEditorWidget
127 CustomFieldsWidget( TDEABC::AddressBook *ab, TQWidget *parent,
const char *name = 0 );
129 void loadContact( TDEABC::Addressee *addr );
130 void storeContact( TDEABC::Addressee *addr );
131 void setReadOnly(
bool readOnly );
140 TQStringList marshallFields(
bool )
const;
142 TQPushButton *mAddButton;
143 TQPushButton *mRemoveButton;
144 TQGridLayout *mLayout;
146 FieldWidget *mFieldWidget;
148 TDEABC::Addressee mAddressee;
151 class CustomFieldsWidgetFactory :
public KAB::ContactEditorWidgetFactory
154 KAB::ContactEditorWidget *createWidget( TDEABC::AddressBook *ab, TQWidget *parent,
const char *name )
156 return new CustomFieldsWidget( ab, parent, name );
159 TQString pageTitle()
const {
return i18n(
"Custom Fields" ); }
160 TQString pageIdentifier()
const {
return "custom_fields"; }
163 void splitField(
const TQString&, TQString&, TQString&, TQString& );