akonadi
phoneeditwidget.h
00001 /* 00002 This file is part of Akonadi Contact. 00003 00004 Copyright (c) 2009 Tobias Koenig <tokoe@kde.org> 00005 00006 This library is free software; you can redistribute it and/or modify it 00007 under the terms of the GNU Library General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or (at your 00009 option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, but WITHOUT 00012 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00014 License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to the 00018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 02110-1301, USA. 00020 */ 00021 00022 00023 #ifndef PHONEEDITWIDGET_H 00024 #define PHONEEDITWIDGET_H 00025 00026 #include <QtCore/QList> 00027 00028 #include <kabc/addressee.h> 00029 #include <kcombobox.h> 00030 #include <kdialog.h> 00031 00032 class KLineEdit; 00033 00034 class QButtonGroup; 00035 class QCheckBox; 00036 class QScrollArea; 00037 class QSignalMapper; 00038 class QVBoxLayout; 00039 00043 class PhoneTypeCombo : public KComboBox 00044 { 00045 Q_OBJECT 00046 00047 public: 00053 PhoneTypeCombo( QWidget *parent = 0 ); 00054 00058 ~PhoneTypeCombo(); 00059 00063 void setType( KABC::PhoneNumber::Type type ); 00064 00068 KABC::PhoneNumber::Type type() const; 00069 00070 private Q_SLOTS: 00071 void selected( int ); 00072 void otherSelected(); 00073 00074 private: 00075 void update(); 00076 00077 KABC::PhoneNumber::Type mType; 00078 int mLastSelected; 00079 QList<int> mTypeList; 00080 }; 00081 00086 class PhoneNumberWidget : public QWidget 00087 { 00088 Q_OBJECT 00089 00090 public: 00096 PhoneNumberWidget( QWidget *parent = 0 ); 00097 00101 void setNumber( const KABC::PhoneNumber &number ); 00102 00106 KABC::PhoneNumber number() const; 00107 00111 void setReadOnly( bool readOnly ); 00112 00113 Q_SIGNALS: 00114 void modified(); 00115 00116 private: 00117 PhoneTypeCombo *mTypeCombo; 00118 KLineEdit *mNumberEdit; 00119 KABC::PhoneNumber mNumber; 00120 }; 00121 00125 class PhoneNumberListWidget : public QWidget 00126 { 00127 Q_OBJECT 00128 00129 public: 00135 PhoneNumberListWidget( QWidget *parent = 0 ); 00136 00140 ~PhoneNumberListWidget(); 00141 00145 void setPhoneNumbers( const KABC::PhoneNumber::List &list ); 00146 00150 KABC::PhoneNumber::List phoneNumbers() const; 00151 00155 void setReadOnly( bool readOnly ); 00156 00160 int phoneNumberCount() const; 00161 00162 public Q_SLOTS: 00166 void add(); 00167 00171 void remove(); 00172 00173 private Q_SLOTS: 00174 void changed( int ); 00175 00176 private: 00177 void recreateNumberWidgets(); 00178 00179 KABC::PhoneNumber::List mPhoneNumberList; 00180 QList<PhoneNumberWidget*> mWidgets; 00181 00182 QVBoxLayout *mWidgetLayout; 00183 00184 bool mReadOnly; 00185 QSignalMapper *mMapper; 00186 }; 00187 00191 class PhoneEditWidget : public QWidget 00192 { 00193 Q_OBJECT 00194 00195 public: 00201 explicit PhoneEditWidget( QWidget *parent = 0 ); 00202 00206 ~PhoneEditWidget(); 00207 00211 void loadContact( const KABC::Addressee &contact ); 00212 00216 void storeContact( KABC::Addressee &contact ) const; 00217 00221 void setReadOnly( bool readOnly ); 00222 00223 private Q_SLOTS: 00224 void changed(); 00225 00226 private: 00227 QPushButton *mAddButton; 00228 QPushButton *mRemoveButton; 00229 00230 bool mReadOnly; 00231 00232 QScrollArea *mListScrollArea; 00233 PhoneNumberListWidget *mPhoneNumberListWidget; 00234 }; 00235 00239 class PhoneTypeDialog : public KDialog 00240 { 00241 public: 00248 explicit PhoneTypeDialog( KABC::PhoneNumber::Type type, QWidget *parent = 0 ); 00249 00253 KABC::PhoneNumber::Type type() const; 00254 00255 private: 00256 KABC::PhoneNumber::Type mType; 00257 KABC::PhoneNumber::TypeList mTypeList; 00258 00259 QButtonGroup *mGroup; 00260 QCheckBox *mPreferredBox; 00261 }; 00262 00263 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Tue May 8 2012 00:00:45 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Tue May 8 2012 00:00:45 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.