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 @@ -63,16 +63,19 @@ class PhoneEditWidget : public QScrollView signals: void modified(); void typeChange( int oldType, int newType ); private slots: - void addNumber(); + void deleteEdit( PhoneTypeNumberEdit* ew ); + void addNumber(); + void pendingDelete(); protected: private: + PhoneTypeNumberEdit* mPendingDelete; void setDefaults(); PhoneTypeNumberEdit* appendEditCombo(); QWidget* mw; QVBoxLayout* mainLayout; QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; @@ -209,35 +212,34 @@ public: lay->addWidget( mNumber ); connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) ); connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) ); connect( mNumber , SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( textChanged ( const QString & ) ) ); mCombo->insertStringList( PhoneNumber::supportedTypeListNames() ); - mIsValid = true; } - + ~PhoneTypeNumberEdit() { + // qDebug("~PhoneTypeNumberEdit() "); + } void setPhoneNumber( const KABC::PhoneNumber &phoneNumber ) { mPhoneNumber = phoneNumber; int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); mCombo->setCurrentItem( index ); mNumber->setText( mPhoneNumber.number() ); - mIsValid = true; show(); } KABC::PhoneNumber phoneNumber() { mPhoneNumber.setNumber( mNumber->text() ); int index = mCombo->currentItem(); mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); return mPhoneNumber; } bool isValid() { - if ( !mIsValid ) return false; if ( mNumber->text().isEmpty() )return false; return true; } private slots: void typeExternalChanged( int oldType, int newType ) { @@ -246,15 +248,13 @@ public: int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); mCombo->setCurrentItem( index ); } } void deleteNumber() { - emit modified(); - hide(); - mIsValid = false; + emit deleteMe( this ); } void comboTypeChange( int index ) { int old = mPhoneNumber.type(); int newT = PhoneNumber::supportedTypeList()[index]; if ( old != newT ) { @@ -272,15 +272,15 @@ public: { emit modified(); } signals: void typeChange( int oldType, int newType ); void modified(); + void deleteMe( PhoneTypeNumberEdit* ); private: - bool mIsValid; KABC::PhoneNumber mPhoneNumber; QPushButton* mMinusButton; KComboBox *mCombo; KLineEdit *mNumber; }; |