kaddressbook

addresseeeditorwidget.h
00001 /*
00002     This file is part of KAddressBook.
00003     Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018 
00019     As a special exception, permission is given to link this program
00020     with any edition of TQt, and distribute the resulting executable,
00021     without including the source code for TQt in the source distribution.
00022 */
00023 
00024 #ifndef ADDRESSEEEDITORWIDGET_H
00025 #define ADDRESSEEEDITORWIDGET_H
00026 
00027 #include <tqdatetime.h>
00028 
00029 #include <tdeabc/addressee.h>
00030 #include <kdialogbase.h>
00031 #include <kjanuswidget.h>
00032 
00033 #include "addresseeeditorbase.h"
00034 #include "contacteditorwidgetmanager.h"
00035 #include "extensionwidget.h"
00036 
00037 class TQCheckBox;
00038 class TQSpinBox;
00039 class TQTabWidget;
00040 class TQTextEdit;
00041 
00042 class KComboBox;
00043 class KDateEdit;
00044 class KLineEdit;
00045 class KSqueezedTextLabel;
00046 
00047 class AddressEditWidget;
00048 class EmailEditWidget;
00049 class IMEditWidget;
00050 class KeyWidget;
00051 class PhoneEditWidget;
00052 class SecrecyWidget;
00053 
00054 namespace KAB {
00055 class Core;
00056 }
00057 
00058 namespace KPIM {
00059 class AddresseeLineEdit;
00060 class CategorySelectDialog;
00061 class CategoryEditDialog;
00062 }
00063 
00064 namespace TDEABC { class AddressBook; }
00065 
00066 class AddresseeEditorWidget : public AddresseeEditorBase
00067 {
00068   Q_OBJECT
00069   
00070 
00071   public:
00072     AddresseeEditorWidget( TQWidget *parent, const char *name = 0 );
00073     ~AddresseeEditorWidget();
00074 
00075     void setAddressee( const TDEABC::Addressee& );
00076     const TDEABC::Addressee &addressee();
00077 
00078     void load();
00079     void save();
00080 
00081     bool dirty();
00082 
00083     void setInitialFocus();
00084 
00085     bool readyToClose();
00086 
00087   protected slots:
00088     void textChanged( const TQString& );
00089     void pageChanged( TQWidget *wdg );
00090 
00096     void emitModified();
00097 
00098     void dateChanged( const TQDate& );
00099     void invalidDate();
00100     void nameTextChanged( const TQString& );
00101     void organizationTextChanged( const TQString& );
00102     void nameBoxChanged();
00103     void nameButtonClicked();
00104     void selectCategories();
00105 
00109     void categoriesSelected( const TQStringList& );
00110 
00114     void editCategories();
00115 
00116   private:
00117     void initGUI();
00118     void setupTab1();
00119     void setupTab2();
00120     void setupAdditionalTabs();
00121     void setupCustomFieldsTabs();
00122 
00123     void setReadOnly( bool );
00124 
00125     TDEABC::Addressee mAddressee;
00126     int mFormattedNameType;
00127     bool mDirty;
00128     bool mBlockSignals;
00129     bool mReadOnly;
00130 
00131     // GUI
00132     KPIM::CategorySelectDialog *mCategorySelectDialog;
00133     KPIM::CategoryEditDialog *mCategoryEditDialog;
00134     TQTabWidget *mTabWidget;
00135 
00136     // Tab1
00137     KLineEdit *mNameEdit;
00138     KLineEdit *mRoleEdit;
00139     KLineEdit *mOrgEdit;
00140     KSqueezedTextLabel *mFormattedNameLabel;
00141     AddressEditWidget *mAddressEditWidget;
00142     EmailEditWidget *mEmailWidget;
00143     IMEditWidget *mIMWidget;
00144     PhoneEditWidget *mPhoneEditWidget;
00145     KLineEdit *mURLEdit;
00146     KLineEdit *mBlogEdit;
00147     TQPushButton *mCategoryButton;
00148     KLineEdit *mCategoryEdit;
00149     SecrecyWidget *mSecrecyWidget;
00150     KSqueezedTextLabel *mNameLabel;
00151 
00152     // Tab2
00153     KLineEdit *mDepartmentEdit;
00154     KLineEdit *mOfficeEdit;
00155     KLineEdit *mProfessionEdit;
00156     KLineEdit *mTitleEdit;
00157     KPIM::AddresseeLineEdit *mManagerEdit;
00158     KPIM::AddresseeLineEdit *mAssistantEdit;
00159     KLineEdit *mNicknameEdit;
00160     KPIM::AddresseeLineEdit *mSpouseEdit;
00161     KDateEdit *mBirthdayPicker;
00162     KDateEdit *mAnniversaryPicker;
00163     TQTextEdit *mNoteEdit;
00164 
00165     TQDict<ContactEditorTabPage> mTabPages;
00166 };
00167 
00168 #endif