author | zautrix <zautrix> | 2005-10-28 16:38:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-28 16:38:18 (UTC) |
commit | d6eb485cf2ff7a14918f51a5b21b5306f9908fdb (patch) (unidiff) | |
tree | 6382df41981bad0d38a384868cfacc04c7b4a149 /kaddressbook/phoneeditwidget.h | |
parent | 869e4921d8b052c376b2769de44674a8c2d68221 (diff) | |
download | kdepimpi-d6eb485cf2ff7a14918f51a5b21b5306f9908fdb.zip kdepimpi-d6eb485cf2ff7a14918f51a5b21b5306f9908fdb.tar.gz kdepimpi-d6eb485cf2ff7a14918f51a5b21b5306f9908fdb.tar.bz2 |
fixx
Diffstat (limited to 'kaddressbook/phoneeditwidget.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/phoneeditwidget.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h index df5aff9..0477b6c 100644 --- a/kaddressbook/phoneeditwidget.h +++ b/kaddressbook/phoneeditwidget.h | |||
@@ -146,134 +146,135 @@ class PhoneEditWidget : public QWidget | |||
146 | 146 | ||
147 | KABC::PhoneNumber::List mPhoneList; | 147 | KABC::PhoneNumber::List mPhoneList; |
148 | }; | 148 | }; |
149 | 149 | ||
150 | /** | 150 | /** |
151 | Dialog for editing lists of phonenumbers. | 151 | Dialog for editing lists of phonenumbers. |
152 | */ | 152 | */ |
153 | class PhoneEditDialog : public KDialogBase | 153 | class PhoneEditDialog : public KDialogBase |
154 | { | 154 | { |
155 | Q___OBJECT | 155 | Q___OBJECT |
156 | 156 | ||
157 | public: | 157 | public: |
158 | PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name = 0 ); | 158 | PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name = 0 ); |
159 | ~PhoneEditDialog(); | 159 | ~PhoneEditDialog(); |
160 | 160 | ||
161 | const KABC::PhoneNumber::List &phoneNumbers(); | 161 | const KABC::PhoneNumber::List &phoneNumbers(); |
162 | bool changed() const; | 162 | bool changed() const; |
163 | 163 | ||
164 | protected s__lots: | 164 | protected s__lots: |
165 | void slotAddPhoneNumber(); | 165 | void slotAddPhoneNumber(); |
166 | void slotRemovePhoneNumber(); | 166 | void slotRemovePhoneNumber(); |
167 | void slotEditPhoneNumber(); | 167 | void slotEditPhoneNumber(); |
168 | void slotSelectionChanged(); | 168 | void slotSelectionChanged(); |
169 | 169 | ||
170 | private: | 170 | private: |
171 | KABC::PhoneNumber::List mPhoneNumberList; | 171 | KABC::PhoneNumber::List mPhoneNumberList; |
172 | KABC::PhoneNumber::TypeList mTypeList; | 172 | KABC::PhoneNumber::TypeList mTypeList; |
173 | KComboBox *mTypeBox; | 173 | KComboBox *mTypeBox; |
174 | KListView *mListView; | 174 | KListView *mListView; |
175 | 175 | ||
176 | QPushButton *mRemoveButton; | 176 | QPushButton *mRemoveButton; |
177 | QPushButton *mEditButton; | 177 | QPushButton *mEditButton; |
178 | 178 | ||
179 | bool mChanged; | 179 | bool mChanged; |
180 | }; | 180 | }; |
181 | 181 | ||
182 | /** | 182 | /** |
183 | Dialog for editing phone number types. | 183 | Dialog for editing phone number types. |
184 | */ | 184 | */ |
185 | class PhoneTypeDialog : public KDialogBase | 185 | class PhoneTypeDialog : public KDialogBase |
186 | { | 186 | { |
187 | Q___OBJECT | 187 | Q___OBJECT |
188 | public: | 188 | public: |
189 | PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 ); | 189 | PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 ); |
190 | 190 | ||
191 | KABC::PhoneNumber phoneNumber(); | 191 | KABC::PhoneNumber phoneNumber(); |
192 | 192 | ||
193 | private: | 193 | private: |
194 | KABC::PhoneNumber mPhoneNumber; | 194 | KABC::PhoneNumber mPhoneNumber; |
195 | KABC::PhoneNumber::TypeList mTypeList; | 195 | KABC::PhoneNumber::TypeList mTypeList; |
196 | 196 | ||
197 | QButtonGroup *mGroup; | 197 | QButtonGroup *mGroup; |
198 | QCheckBox *mPreferredBox; | 198 | QCheckBox *mPreferredBox; |
199 | KLineEdit *mNumber; | 199 | KLineEdit *mNumber; |
200 | }; | 200 | }; |
201 | #endif | 201 | #endif |
202 | 202 | ||
203 | class PhoneTypeNumberEdit : public QWidget | 203 | class PhoneTypeNumberEdit : public QWidget |
204 | { | 204 | { |
205 | Q_OBJECT | 205 | Q_OBJECT |
206 | public: | 206 | public: |
207 | PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent ) | 207 | PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent ) |
208 | { | 208 | { |
209 | QHBoxLayout * lay = new QHBoxLayout( this ); | 209 | QHBoxLayout * lay = new QHBoxLayout( this ); |
210 | lay->setSpacing( KDialogBase::spacingHintSmall() ); | 210 | lay->setSpacing( 2 ); |
211 | lay->setMargin( KDialogBase::marginHintSmall() ); | 211 | lay->setMargin( 0 ); |
212 | mMinusButton = new QPushButton ( this ); | 212 | mMinusButton = new QPushButton ( this ); |
213 | mMinusButton->setPixmap ( SmallIcon("minus")); | 213 | mMinusButton->setPixmap ( SmallIcon("minus")); |
214 | mCombo = new KComboBox( this ); | 214 | mCombo = new KComboBox( this ); |
215 | mNumber = new KLineEdit( this ); | 215 | mNumber = new KLineEdit( this ); |
216 | mMinusButton->setMaximumHeight( mNumber->sizeHint().height() + 6); | ||
216 | lay->addWidget( mMinusButton ); | 217 | lay->addWidget( mMinusButton ); |
217 | lay->addWidget( mCombo ); | 218 | lay->addWidget( mCombo ); |
218 | lay->addWidget( mNumber ); | 219 | lay->addWidget( mNumber ); |
219 | connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) ); | 220 | connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) ); |
220 | connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) ); | 221 | connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) ); |
221 | connect( mNumber , SIGNAL ( textChanged ( const QString & ) ), | 222 | connect( mNumber , SIGNAL ( textChanged ( const QString & ) ), |
222 | this, SLOT ( textChanged ( const QString & ) ) ); | 223 | this, SLOT ( textChanged ( const QString & ) ) ); |
223 | mCombo->insertStringList( PhoneNumber::supportedTypeListNames() ); | 224 | mCombo->insertStringList( PhoneNumber::supportedTypeListNames() ); |
224 | } | 225 | } |
225 | ~PhoneTypeNumberEdit() { | 226 | ~PhoneTypeNumberEdit() { |
226 | // qDebug("~PhoneTypeNumberEdit() "); | 227 | // qDebug("~PhoneTypeNumberEdit() "); |
227 | } | 228 | } |
228 | void setPhoneNumber( const KABC::PhoneNumber &phoneNumber ) | 229 | void setPhoneNumber( const KABC::PhoneNumber &phoneNumber ) |
229 | { | 230 | { |
230 | mPhoneNumber = phoneNumber; | 231 | mPhoneNumber = phoneNumber; |
231 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); | 232 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); |
232 | mCombo->setCurrentItem( index ); | 233 | mCombo->setCurrentItem( index ); |
233 | mNumber->setText( mPhoneNumber.number() ); | 234 | mNumber->setText( mPhoneNumber.number() ); |
234 | show(); | 235 | show(); |
235 | mNumber->setFocus(); | 236 | mNumber->setFocus(); |
236 | } | 237 | } |
237 | KABC::PhoneNumber phoneNumber() | 238 | KABC::PhoneNumber phoneNumber() |
238 | { | 239 | { |
239 | mPhoneNumber.setNumber( mNumber->text() ); | 240 | mPhoneNumber.setNumber( mNumber->text() ); |
240 | int index = mCombo->currentItem(); | 241 | int index = mCombo->currentItem(); |
241 | mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); | 242 | mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); |
242 | return mPhoneNumber; | 243 | return mPhoneNumber; |
243 | } | 244 | } |
244 | bool isValid() | 245 | bool isValid() |
245 | { | 246 | { |
246 | if ( mNumber->text().isEmpty() )return false; | 247 | if ( mNumber->text().isEmpty() )return false; |
247 | return true; | 248 | return true; |
248 | } | 249 | } |
249 | int currentType() | 250 | int currentType() |
250 | { | 251 | { |
251 | return mCombo->currentItem(); | 252 | return mCombo->currentItem(); |
252 | } | 253 | } |
253 | private slots: | 254 | private slots: |
254 | void typeExternalChanged( int oldType, int newType ) | 255 | void typeExternalChanged( int oldType, int newType ) |
255 | { | 256 | { |
256 | if ( mPhoneNumber.type() == newType ) { | 257 | if ( mPhoneNumber.type() == newType ) { |
257 | mPhoneNumber.setType(oldType); | 258 | mPhoneNumber.setType(oldType); |
258 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); | 259 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); |
259 | mCombo->setCurrentItem( index ); | 260 | mCombo->setCurrentItem( index ); |
260 | } | 261 | } |
261 | } | 262 | } |
262 | void deleteNumber() | 263 | void deleteNumber() |
263 | { | 264 | { |
264 | emit deleteMe( this ); | 265 | emit deleteMe( this ); |
265 | } | 266 | } |
266 | void comboTypeChange( int index ) | 267 | void comboTypeChange( int index ) |
267 | { | 268 | { |
268 | int old = mPhoneNumber.type(); | 269 | int old = mPhoneNumber.type(); |
269 | int newT = PhoneNumber::supportedTypeList()[index]; | 270 | int newT = PhoneNumber::supportedTypeList()[index]; |
270 | if ( old != newT ) { | 271 | if ( old != newT ) { |
271 | emit modified(); | 272 | emit modified(); |
272 | if ( newT != PhoneNumber::Voice ) | 273 | if ( newT != PhoneNumber::Voice ) |
273 | emit typeChange ( old, newT ); | 274 | emit typeChange ( old, newT ); |
274 | mPhoneNumber.setType(newT ); | 275 | mPhoneNumber.setType(newT ); |
275 | } | 276 | } |
276 | 277 | ||
277 | } | 278 | } |
278 | void textChanged ( const QString & ) | 279 | void textChanged ( const QString & ) |
279 | { | 280 | { |