Diffstat (limited to 'kaddressbook/phoneeditwidget.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/phoneeditwidget.h | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h new file mode 100644 index 0000000..7fe4bc0 --- a/dev/null +++ b/kaddressbook/phoneeditwidget.h | |||
@@ -0,0 +1,147 @@ | |||
1 | #ifndef PHONEEDITWIDGET_H | ||
2 | #define PHONEEDITWIDGET_H | ||
3 | /* | ||
4 | This file is part of KAddressBook. | ||
5 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | ||
6 | |||
7 | This program is free software; you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation; either version 2 of the License, or | ||
10 | (at your option) any later version. | ||
11 | |||
12 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software | ||
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
20 | |||
21 | As a special exception, permission is given to link this program | ||
22 | with any edition of Qt, and distribute the resulting executable, | ||
23 | without including the source code for Qt in the source distribution. | ||
24 | */ | ||
25 | |||
26 | #include <kdialogbase.h> | ||
27 | |||
28 | #include "addresseeconfig.h" | ||
29 | #include "typecombo.h" | ||
30 | |||
31 | class QButtonGroup; | ||
32 | class QCheckBox; | ||
33 | |||
34 | class KListView; | ||
35 | class KLineEdit; | ||
36 | class KComboBox; | ||
37 | |||
38 | typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; | ||
39 | |||
40 | /** | ||
41 | Widget for editing phone numbers. | ||
42 | */ | ||
43 | class PhoneEditWidget : public QWidget | ||
44 | { | ||
45 | Q_OBJECT | ||
46 | |||
47 | public: | ||
48 | PhoneEditWidget( QWidget *parent, const char *name = 0 ); | ||
49 | ~PhoneEditWidget(); | ||
50 | |||
51 | void setPhoneNumbers( const KABC::PhoneNumber::List &list ); | ||
52 | KABC::PhoneNumber::List phoneNumbers(); | ||
53 | |||
54 | void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); | ||
55 | KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); | ||
56 | |||
57 | signals: | ||
58 | void modified(); | ||
59 | |||
60 | private slots: | ||
61 | void edit(); | ||
62 | |||
63 | void updatePrefEdit(); | ||
64 | void updateSecondEdit(); | ||
65 | void updateThirdEdit(); | ||
66 | void updateFourthEdit(); | ||
67 | |||
68 | void slotPrefEditChanged(); | ||
69 | void slotSecondEditChanged(); | ||
70 | void slotThirdEditChanged(); | ||
71 | void slotFourthEditChanged(); | ||
72 | |||
73 | protected: | ||
74 | void updateLineEdits(); | ||
75 | void updateCombos(); | ||
76 | |||
77 | private: | ||
78 | void updateEdit( PhoneTypeCombo *combo ); | ||
79 | void updatePhoneNumber( PhoneTypeCombo *combo ); | ||
80 | void updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo ); | ||
81 | |||
82 | PhoneTypeCombo *mPrefCombo; | ||
83 | PhoneTypeCombo *mSecondCombo; | ||
84 | PhoneTypeCombo *mThirdCombo; | ||
85 | PhoneTypeCombo *mFourthCombo; | ||
86 | |||
87 | KLineEdit *mPrefEdit; | ||
88 | KLineEdit *mSecondEdit; | ||
89 | KLineEdit *mThirdEdit; | ||
90 | KLineEdit *mFourthEdit; | ||
91 | |||
92 | KABC::PhoneNumber::List mPhoneList; | ||
93 | }; | ||
94 | |||
95 | /** | ||
96 | Dialog for editing lists of phonenumbers. | ||
97 | */ | ||
98 | class PhoneEditDialog : public KDialogBase | ||
99 | { | ||
100 | Q_OBJECT | ||
101 | |||
102 | public: | ||
103 | PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name = 0 ); | ||
104 | ~PhoneEditDialog(); | ||
105 | |||
106 | const KABC::PhoneNumber::List &phoneNumbers(); | ||
107 | bool changed() const; | ||
108 | |||
109 | protected slots: | ||
110 | void slotAddPhoneNumber(); | ||
111 | void slotRemovePhoneNumber(); | ||
112 | void slotEditPhoneNumber(); | ||
113 | void slotSelectionChanged(); | ||
114 | |||
115 | private: | ||
116 | KABC::PhoneNumber::List mPhoneNumberList; | ||
117 | KABC::PhoneNumber::TypeList mTypeList; | ||
118 | KComboBox *mTypeBox; | ||
119 | KListView *mListView; | ||
120 | |||
121 | QPushButton *mRemoveButton; | ||
122 | QPushButton *mEditButton; | ||
123 | |||
124 | bool mChanged; | ||
125 | }; | ||
126 | |||
127 | /** | ||
128 | Dialog for editing phone number types. | ||
129 | */ | ||
130 | class PhoneTypeDialog : public KDialogBase | ||
131 | { | ||
132 | Q_OBJECT | ||
133 | public: | ||
134 | PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 ); | ||
135 | |||
136 | KABC::PhoneNumber phoneNumber(); | ||
137 | |||
138 | private: | ||
139 | KABC::PhoneNumber mPhoneNumber; | ||
140 | KABC::PhoneNumber::TypeList mTypeList; | ||
141 | |||
142 | QButtonGroup *mGroup; | ||
143 | QCheckBox *mPreferredBox; | ||
144 | KLineEdit *mNumber; | ||
145 | }; | ||
146 | |||
147 | #endif | ||