phoneeditwidget.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 PHONEEDITWIDGET_H 00025 #define PHONEEDITWIDGET_H 00026 00027 #include <kcombobox.h> 00028 #include <kdialogbase.h> 00029 00030 #include "addresseeconfig.h" 00031 00032 class TQButtonGroup; 00033 class TQCheckBox; 00034 class TQSignalMapper; 00035 00036 class KLineEdit; 00037 class KComboBox; 00038 00039 class PhoneTypeCombo : public KComboBox 00040 { 00041 Q_OBJECT 00042 00043 00044 public: 00045 PhoneTypeCombo( TQWidget *parent ); 00046 ~PhoneTypeCombo(); 00047 00048 void setType( int type ); 00049 int type() const; 00050 00051 signals: 00052 void modified(); 00053 00054 protected slots: 00055 void selected( int ); 00056 void otherSelected(); 00057 00058 private: 00059 void update(); 00060 00061 int mType; 00062 int mLastSelected; 00063 TQValueList<int> mTypeList; 00064 }; 00065 00066 class PhoneNumberWidget : public TQWidget 00067 { 00068 Q_OBJECT 00069 00070 00071 public: 00072 PhoneNumberWidget( TQWidget *parent ); 00073 00074 void setNumber( const TDEABC::PhoneNumber &number ); 00075 TDEABC::PhoneNumber number() const; 00076 00077 void setReadOnly( bool readOnly ); 00078 00079 signals: 00080 void modified(); 00081 00082 private: 00083 PhoneTypeCombo *mTypeCombo; 00084 KLineEdit *mNumberEdit; 00085 TDEABC::PhoneNumber mNumber; 00086 }; 00087 00091 class PhoneEditWidget : public TQWidget 00092 { 00093 Q_OBJECT 00094 00095 00096 public: 00097 PhoneEditWidget( TQWidget *parent, const char *name = 0 ); 00098 ~PhoneEditWidget(); 00099 00100 void setPhoneNumbers( const TDEABC::PhoneNumber::List &list ); 00101 TDEABC::PhoneNumber::List phoneNumbers() const; 00102 00103 void setReadOnly( bool readOnly ); 00104 00105 signals: 00106 void modified(); 00107 00108 protected slots: 00109 void add(); 00110 void remove(); 00111 void changed(); 00112 void changed( int pos ); 00113 00114 private: 00115 void recreateNumberWidgets(); 00116 00117 TDEABC::PhoneNumber::List mPhoneNumberList; 00118 TQPtrList<PhoneNumberWidget> mWidgets; 00119 00120 TQPushButton *mAddButton; 00121 TQPushButton *mRemoveButton; 00122 TQVBoxLayout *mWidgetLayout; 00123 00124 bool mReadOnly; 00125 TQSignalMapper *mMapper; 00126 }; 00127 00131 class PhoneTypeDialog : public KDialogBase 00132 { 00133 Q_OBJECT 00134 00135 public: 00136 PhoneTypeDialog( int type, TQWidget *parent ); 00137 00138 int type() const; 00139 00140 private: 00141 int mType; 00142 TDEABC::PhoneNumber::TypeList mTypeList; 00143 00144 TQButtonGroup *mGroup; 00145 TQCheckBox *mPreferredBox; 00146 }; 00147 00148 #endif