Need to store config when changing units, if not very bad things happen
[kdepim.git] / kaddressbook / addresseeeditorwidget.h
blob93917245b87869ee7f231db0c13b082d473941c7
1 /*
2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
24 #ifndef ADDRESSEEEDITORWIDGET_H
25 #define ADDRESSEEEDITORWIDGET_H
27 #include <qdatetime.h>
29 #include <kabc/addressee.h>
30 #include <kdialogbase.h>
31 #include <kjanuswidget.h>
33 #include "addresseeeditorbase.h"
34 #include "contacteditorwidgetmanager.h"
35 #include "extensionwidget.h"
37 class QCheckBox;
38 class QSpinBox;
39 class QTabWidget;
40 class QTextEdit;
42 class KComboBox;
43 class KDateEdit;
44 class KLineEdit;
45 class KSqueezedTextLabel;
47 class AddressEditWidget;
48 class EmailEditWidget;
49 class IMEditWidget;
50 class KeyWidget;
51 class PhoneEditWidget;
52 class SecrecyWidget;
54 namespace KAB {
55 class Core;
58 namespace KPIM {
59 class AddresseeLineEdit;
60 class CategorySelectDialog;
61 class CategoryEditDialog;
64 namespace KABC { class AddressBook; }
66 class AddresseeEditorWidget : public AddresseeEditorBase
68 Q_OBJECT
70 public:
71 AddresseeEditorWidget( QWidget *parent, const char *name = 0 );
72 ~AddresseeEditorWidget();
74 void setAddressee( const KABC::Addressee& );
75 const KABC::Addressee &addressee();
77 void load();
78 void save();
80 bool dirty();
82 void setInitialFocus();
84 bool readyToClose();
86 protected slots:
87 void textChanged( const QString& );
88 void pageChanged( QWidget *wdg );
90 /**
91 Emits the modified signal and sets the dirty flag. Any slot
92 that modifies data should use this method instead of calling emit
93 modified() directly.
95 void emitModified();
97 void dateChanged( const QDate& );
98 void invalidDate();
99 void nameTextChanged( const QString& );
100 void organizationTextChanged( const QString& );
101 void nameBoxChanged();
102 void nameButtonClicked();
103 void selectCategories();
106 Called whenever the categories change in the categories dialog.
108 void categoriesSelected( const QStringList& );
111 Edits which categories are available in the CategorySelectDialog.
113 void editCategories();
115 private:
116 void initGUI();
117 void setupTab1();
118 void setupTab2();
119 void setupAdditionalTabs();
120 void setupCustomFieldsTabs();
122 void setReadOnly( bool );
124 KABC::Addressee mAddressee;
125 int mFormattedNameType;
126 bool mDirty;
127 bool mBlockSignals;
128 bool mReadOnly;
130 // GUI
131 KPIM::CategorySelectDialog *mCategorySelectDialog;
132 KPIM::CategoryEditDialog *mCategoryEditDialog;
133 QTabWidget *mTabWidget;
135 // Tab1
136 KLineEdit *mNameEdit;
137 KLineEdit *mRoleEdit;
138 KLineEdit *mOrgEdit;
139 KSqueezedTextLabel *mFormattedNameLabel;
140 AddressEditWidget *mAddressEditWidget;
141 EmailEditWidget *mEmailWidget;
142 IMEditWidget *mIMWidget;
143 PhoneEditWidget *mPhoneEditWidget;
144 KLineEdit *mURLEdit;
145 KLineEdit *mBlogEdit;
146 QPushButton *mCategoryButton;
147 KLineEdit *mCategoryEdit;
148 SecrecyWidget *mSecrecyWidget;
149 KSqueezedTextLabel *mNameLabel;
151 // Tab2
152 KLineEdit *mDepartmentEdit;
153 KLineEdit *mOfficeEdit;
154 KLineEdit *mProfessionEdit;
155 KLineEdit *mTitleEdit;
156 KPIM::AddresseeLineEdit *mManagerEdit;
157 KPIM::AddresseeLineEdit *mAssistantEdit;
158 KLineEdit *mNicknameEdit;
159 KPIM::AddresseeLineEdit *mSpouseEdit;
160 KDateEdit *mBirthdayPicker;
161 KDateEdit *mAnniversaryPicker;
162 QTextEdit *mNoteEdit;
164 QDict<ContactEditorTabPage> mTabPages;
167 #endif