kaddressbook
addresseditwidget.h
Go to the documentation of this file.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 Qt, and distribute the resulting executable, 00021 without including the source code for Qt in the source distribution. 00022 */ 00023 00024 #ifndef ADDRESSEDITWIDGET_H 00025 #define ADDRESSEDITWIDGET_H 00026 00027 #include <QtGui/QWidget> 00028 00029 #include <KDialog> 00030 00031 #include <kabc/address.h> 00032 #include <kabc/addressee.h> 00033 00034 #include "addresseeconfig.h" 00035 #include "typecombo.h" 00036 00037 class QButtonGroup; 00038 class QCheckBox; 00039 class QLabel; 00040 class QTextEdit; 00041 00042 class KComboBox; 00043 class KLineEdit; 00044 00045 typedef TypeCombo<KABC::Address, KABC::Address::Type> AddressTypeCombo; 00046 00050 class AddressEditWidget : public QWidget 00051 { 00052 Q_OBJECT 00053 00054 public: 00055 AddressEditWidget( QWidget *parent, const char *name = 0 ); 00056 ~AddressEditWidget(); 00057 00058 KABC::Address::List addresses(); 00059 void setAddresses( const KABC::Addressee &addr, 00060 const KABC::Address::List &list ); 00061 void updateAddressee( const KABC::Addressee &addr ); 00062 00063 void updateTypeCombo( const KABC::Address::List&, KComboBox* ); 00064 KABC::Address currentAddress( KComboBox*, int ); 00065 00066 void setReadOnly( bool readOnly ); 00067 00068 Q_SIGNALS: 00069 void modified(); 00070 00071 protected Q_SLOTS: 00072 void updateAddressEdit(); 00073 00074 void edit(); 00075 00076 private: 00077 AddressTypeCombo *mTypeCombo; 00078 00079 QPushButton *mEditButton; 00080 QLabel *mAddressField; 00081 00082 KABC::Address::List mAddressList; 00083 KABC::Addressee mAddressee; 00084 int mIndex; 00085 }; 00086 00090 class AddressEditDialog : public KDialog 00091 { 00092 Q_OBJECT 00093 00094 public: 00095 AddressEditDialog( const KABC::Address::List &list, int selected, 00096 QWidget *parent ); 00097 ~AddressEditDialog(); 00098 00099 KABC::Address::List addresses(); 00100 bool changed() const; 00101 00102 protected Q_SLOTS: 00103 void addAddress(); 00104 void removeAddress(); 00105 void changeType(); 00106 void editLabel(); 00107 00108 void updateAddressEdits(); 00109 void modified(); 00110 00111 private: 00112 void saveAddress( KABC::Address &addr ); 00113 void fillCountryCombo(); 00114 QStringList sortLocaleAware( const QStringList& ); 00115 00116 AddressTypeCombo *mTypeCombo; 00117 QTextEdit *mStreetTextEdit; 00118 KComboBox *mCountryCombo; 00119 KLineEdit *mRegionEdit; 00120 KLineEdit *mLocalityEdit; 00121 KLineEdit *mPostalCodeEdit; 00122 KLineEdit *mPOBoxEdit; 00123 QCheckBox *mPreferredCheckBox; 00124 00125 QPushButton *mRemoveButton; 00126 QPushButton *mChangeTypeButton; 00127 00128 KABC::Address::List mAddressList; 00129 KABC::Address *mPreviousAddress; 00130 bool mChanged; 00131 00132 QString mLabel; 00133 }; 00134 00138 class AddressTypeDialog : public KDialog 00139 { 00140 public: 00141 AddressTypeDialog( KABC::Address::Type type, QWidget *parent ); 00142 ~AddressTypeDialog(); 00143 00144 KABC::Address::Type type() const; 00145 00146 private: 00147 QButtonGroup *mGroup; 00148 00149 KABC::Address::TypeList mTypeList; 00150 }; 00151 00152 #endif
KDE 4.2 API Reference