author | zautrix <zautrix> | 2005-10-28 12:10:35 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-28 12:10:35 (UTC) |
commit | cee83f70d8e4a6945f4456c55ab1b280d3425f0f (patch) (unidiff) | |
tree | 1b317655a344f1a3640ef2561d61075e0feddd64 /kaddressbook/phoneeditwidget.h | |
parent | b27cb619bb9005ad4345d38bbee3b1c3d0eda1b2 (diff) | |
download | kdepimpi-cee83f70d8e4a6945f4456c55ab1b280d3425f0f.zip kdepimpi-cee83f70d8e4a6945f4456c55ab1b280d3425f0f.tar.gz kdepimpi-cee83f70d8e4a6945f4456c55ab1b280d3425f0f.tar.bz2 |
commit
Diffstat (limited to 'kaddressbook/phoneeditwidget.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/phoneeditwidget.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h index 6a514ed..c730c7b 100644 --- a/kaddressbook/phoneeditwidget.h +++ b/kaddressbook/phoneeditwidget.h | |||
@@ -61,20 +61,23 @@ class PhoneEditWidget : public QScrollView | |||
61 | // void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); | 61 | // void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); |
62 | //KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); | 62 | //KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); |
63 | 63 | ||
64 | signals: | 64 | signals: |
65 | void modified(); | 65 | void modified(); |
66 | void typeChange( int oldType, int newType ); | 66 | void typeChange( int oldType, int newType ); |
67 | 67 | ||
68 | private slots: | 68 | private slots: |
69 | void addNumber(); | 69 | void deleteEdit( PhoneTypeNumberEdit* ew ); |
70 | void addNumber(); | ||
71 | void pendingDelete(); | ||
70 | protected: | 72 | protected: |
71 | 73 | ||
72 | private: | 74 | private: |
75 | PhoneTypeNumberEdit* mPendingDelete; | ||
73 | void setDefaults(); | 76 | void setDefaults(); |
74 | PhoneTypeNumberEdit* appendEditCombo(); | 77 | PhoneTypeNumberEdit* appendEditCombo(); |
75 | QWidget* mw; | 78 | QWidget* mw; |
76 | QVBoxLayout* mainLayout; | 79 | QVBoxLayout* mainLayout; |
77 | QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; | 80 | QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; |
78 | 81 | ||
79 | KABC::PhoneNumber::List mPhoneList; | 82 | KABC::PhoneNumber::List mPhoneList; |
80 | }; | 83 | }; |
@@ -207,56 +210,53 @@ public: | |||
207 | lay->addWidget( mMinusButton ); | 210 | lay->addWidget( mMinusButton ); |
208 | lay->addWidget( mCombo ); | 211 | lay->addWidget( mCombo ); |
209 | lay->addWidget( mNumber ); | 212 | lay->addWidget( mNumber ); |
210 | connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) ); | 213 | connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) ); |
211 | connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) ); | 214 | connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) ); |
212 | connect( mNumber , SIGNAL ( textChanged ( const QString & ) ), | 215 | connect( mNumber , SIGNAL ( textChanged ( const QString & ) ), |
213 | this, SLOT ( textChanged ( const QString & ) ) ); | 216 | this, SLOT ( textChanged ( const QString & ) ) ); |
214 | mCombo->insertStringList( PhoneNumber::supportedTypeListNames() ); | 217 | mCombo->insertStringList( PhoneNumber::supportedTypeListNames() ); |
215 | mIsValid = true; | ||
216 | } | 218 | } |
217 | 219 | ~PhoneTypeNumberEdit() { | |
220 | // qDebug("~PhoneTypeNumberEdit() "); | ||
221 | } | ||
218 | void setPhoneNumber( const KABC::PhoneNumber &phoneNumber ) | 222 | void setPhoneNumber( const KABC::PhoneNumber &phoneNumber ) |
219 | { | 223 | { |
220 | mPhoneNumber = phoneNumber; | 224 | mPhoneNumber = phoneNumber; |
221 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); | 225 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); |
222 | mCombo->setCurrentItem( index ); | 226 | mCombo->setCurrentItem( index ); |
223 | mNumber->setText( mPhoneNumber.number() ); | 227 | mNumber->setText( mPhoneNumber.number() ); |
224 | mIsValid = true; | ||
225 | show(); | 228 | show(); |
226 | 229 | ||
227 | } | 230 | } |
228 | KABC::PhoneNumber phoneNumber() | 231 | KABC::PhoneNumber phoneNumber() |
229 | { | 232 | { |
230 | mPhoneNumber.setNumber( mNumber->text() ); | 233 | mPhoneNumber.setNumber( mNumber->text() ); |
231 | int index = mCombo->currentItem(); | 234 | int index = mCombo->currentItem(); |
232 | mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); | 235 | mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); |
233 | return mPhoneNumber; | 236 | return mPhoneNumber; |
234 | } | 237 | } |
235 | bool isValid() | 238 | bool isValid() |
236 | { | 239 | { |
237 | if ( !mIsValid ) return false; | ||
238 | if ( mNumber->text().isEmpty() )return false; | 240 | if ( mNumber->text().isEmpty() )return false; |
239 | return true; | 241 | return true; |
240 | } | 242 | } |
241 | private slots: | 243 | private slots: |
242 | void typeExternalChanged( int oldType, int newType ) | 244 | void typeExternalChanged( int oldType, int newType ) |
243 | { | 245 | { |
244 | if ( mPhoneNumber.type() == newType ) { | 246 | if ( mPhoneNumber.type() == newType ) { |
245 | mPhoneNumber.setType(oldType); | 247 | mPhoneNumber.setType(oldType); |
246 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); | 248 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); |
247 | mCombo->setCurrentItem( index ); | 249 | mCombo->setCurrentItem( index ); |
248 | } | 250 | } |
249 | } | 251 | } |
250 | void deleteNumber() | 252 | void deleteNumber() |
251 | { | 253 | { |
252 | emit modified(); | 254 | emit deleteMe( this ); |
253 | hide(); | ||
254 | mIsValid = false; | ||
255 | } | 255 | } |
256 | void comboTypeChange( int index ) | 256 | void comboTypeChange( int index ) |
257 | { | 257 | { |
258 | int old = mPhoneNumber.type(); | 258 | int old = mPhoneNumber.type(); |
259 | int newT = PhoneNumber::supportedTypeList()[index]; | 259 | int newT = PhoneNumber::supportedTypeList()[index]; |
260 | if ( old != newT ) { | 260 | if ( old != newT ) { |
261 | emit modified(); | 261 | emit modified(); |
262 | emit typeChange ( old, newT ); | 262 | emit typeChange ( old, newT ); |
@@ -270,18 +270,18 @@ public: | |||
270 | } | 270 | } |
271 | void textChanged ( const QString & ) | 271 | void textChanged ( const QString & ) |
272 | { | 272 | { |
273 | emit modified(); | 273 | emit modified(); |
274 | } | 274 | } |
275 | signals: | 275 | signals: |
276 | void typeChange( int oldType, int newType ); | 276 | void typeChange( int oldType, int newType ); |
277 | void modified(); | 277 | void modified(); |
278 | void deleteMe( PhoneTypeNumberEdit* ); | ||
278 | 279 | ||
279 | private: | 280 | private: |
280 | bool mIsValid; | ||
281 | KABC::PhoneNumber mPhoneNumber; | 281 | KABC::PhoneNumber mPhoneNumber; |
282 | QPushButton* mMinusButton; | 282 | QPushButton* mMinusButton; |
283 | KComboBox *mCombo; | 283 | KComboBox *mCombo; |
284 | KLineEdit *mNumber; | 284 | KLineEdit *mNumber; |
285 | }; | 285 | }; |
286 | 286 | ||
287 | #endif | 287 | #endif |