kaddressbook
phoneeditwidget.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 PHONEEDITWIDGET_H 00025 #define PHONEEDITWIDGET_H 00026 00027 #include <kcombobox.h> 00028 #include <kdialog.h> 00029 00030 #include "addresseeconfig.h" 00031 00032 #include <QtCore/QList> 00033 00034 class QButtonGroup; 00035 class QCheckBox; 00036 class QScrollArea; 00037 class QSignalMapper; 00038 class QVBoxLayout; 00039 00040 class KLineEdit; 00041 class KComboBox; 00042 00043 class PhoneTypeCombo : public KComboBox 00044 { 00045 Q_OBJECT 00046 00047 public: 00048 PhoneTypeCombo( QWidget *parent ); 00049 ~PhoneTypeCombo(); 00050 00051 void setType( KABC::PhoneNumber::Type type ); 00052 KABC::PhoneNumber::Type type() const; 00053 00054 Q_SIGNALS: 00055 void modified(); 00056 00057 protected Q_SLOTS: 00058 void selected( int ); 00059 void otherSelected(); 00060 00061 private: 00062 void update(); 00063 00064 KABC::PhoneNumber::Type mType; 00065 int mLastSelected; 00066 QList<int> mTypeList; 00067 }; 00068 00069 class PhoneNumberWidget : public QWidget 00070 { 00071 Q_OBJECT 00072 00073 public: 00074 PhoneNumberWidget( QWidget *parent ); 00075 00076 void setNumber( const KABC::PhoneNumber &number ); 00077 KABC::PhoneNumber number() const; 00078 00079 void setReadOnly( bool readOnly ); 00080 00081 Q_SIGNALS: 00082 void modified(); 00083 00084 private: 00085 PhoneTypeCombo *mTypeCombo; 00086 KLineEdit *mNumberEdit; 00087 KABC::PhoneNumber mNumber; 00088 }; 00089 00090 class PhoneNumberListWidget : public QWidget 00091 { 00092 Q_OBJECT 00093 00094 public: 00095 PhoneNumberListWidget( QWidget *parent = 0 ); 00096 ~PhoneNumberListWidget(); 00097 00098 void setPhoneNumbers( const KABC::PhoneNumber::List &list ); 00099 KABC::PhoneNumber::List phoneNumbers() const; 00100 00101 void setReadOnly( bool readOnly ); 00102 00103 int phoneNumberCount() const; 00104 00105 Q_SIGNALS: 00106 void modified(); 00107 00108 public Q_SLOTS: 00109 void add(); 00110 void remove(); 00111 00112 protected Q_SLOTS: 00113 void changed(); 00114 void changed( int pos ); 00115 00116 private: 00117 void recreateNumberWidgets(); 00118 00119 KABC::PhoneNumber::List mPhoneNumberList; 00120 QList<PhoneNumberWidget*> mWidgets; 00121 00122 QVBoxLayout *mWidgetLayout; 00123 00124 bool mReadOnly; 00125 QSignalMapper *mMapper; 00126 }; 00127 00131 class PhoneEditWidget : public QWidget 00132 { 00133 Q_OBJECT 00134 00135 public: 00136 PhoneEditWidget( QWidget *parent, const char *name = 0 ); 00137 ~PhoneEditWidget(); 00138 00139 void setPhoneNumbers( const KABC::PhoneNumber::List &list ); 00140 KABC::PhoneNumber::List phoneNumbers() const; 00141 00142 void setReadOnly( bool readOnly ); 00143 00144 Q_SIGNALS: 00145 void modified(); 00146 00147 protected Q_SLOTS: 00148 void changed(); 00149 00150 private: 00151 QPushButton *mAddButton; 00152 QPushButton *mRemoveButton; 00153 00154 bool mReadOnly; 00155 00156 QScrollArea *mListScrollArea; 00157 PhoneNumberListWidget *mPhoneNumberListWidget; 00158 }; 00159 00163 class PhoneTypeDialog : public KDialog 00164 { 00165 Q_OBJECT 00166 public: 00167 PhoneTypeDialog( KABC::PhoneNumber::Type type, QWidget *parent ); 00168 00169 KABC::PhoneNumber::Type type() const; 00170 00171 private: 00172 KABC::PhoneNumber::Type mType; 00173 KABC::PhoneNumber::TypeList mTypeList; 00174 00175 QButtonGroup *mGroup; 00176 QCheckBox *mPreferredBox; 00177 }; 00178 00179 #endif
KDE 4.2 API Reference