summaryrefslogtreecommitdiffabout
path: root/kaddressbook/phoneeditwidget.h
Unidiff
Diffstat (limited to 'kaddressbook/phoneeditwidget.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/phoneeditwidget.h18
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
@@ -63,16 +63,19 @@ class PhoneEditWidget : public QScrollView
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
@@ -209,35 +212,34 @@ public:
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 {
@@ -246,15 +248,13 @@ public:
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 ) {
@@ -272,15 +272,15 @@ public:
272 { 272 {
273 emit modified(); 273 emit modified();
274 } 274 }
275 signals: 275 signals:
276void typeChange( int oldType, int newType ); 276void typeChange( int oldType, int newType );
277 void modified(); 277 void modified();
278 void deleteMe( PhoneTypeNumberEdit* );
278 279
279private: 280private:
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