Diffstat (limited to 'kaddressbook/phoneeditwidget.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/phoneeditwidget.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h index c730c7b..df5aff9 100644 --- a/kaddressbook/phoneeditwidget.h +++ b/kaddressbook/phoneeditwidget.h @@ -22,16 +22,17 @@ with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <kdialogbase.h> #include <kiconloader.h> #include <qpushbutton.h> #include <qlayout.h> +#include <qpopupmenu.h> #include <qptrlist.h> #include <qscrollview.h> #include "addresseeconfig.h" #include "typecombo.h" class QButtonGroup; @@ -42,17 +43,17 @@ class PhoneTypeNumberEdit; #include <kcombobox.h> #include <kabc/phonenumber.h> typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; /** Widget for editing phone numbers. */ -class PhoneEditWidget : public QScrollView +class PhoneEditWidget : public QWidget { Q_OBJECT public: PhoneEditWidget( QWidget *parent, const char *name = 0 ); ~PhoneEditWidget(); void setPhoneNumbers( const KABC::PhoneNumber::List &list ); @@ -61,22 +62,27 @@ class PhoneEditWidget : public QScrollView // void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); //KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); signals: void modified(); void typeChange( int oldType, int newType ); private slots: + void bottomVisible(); + void addNumberInt( int ); void deleteEdit( PhoneTypeNumberEdit* ew ); void addNumber(); void pendingDelete(); protected: private: + QScrollView* sv; + QPopupMenu *mPopup; + int mPopupCount; PhoneTypeNumberEdit* mPendingDelete; void setDefaults(); PhoneTypeNumberEdit* appendEditCombo(); QWidget* mw; QVBoxLayout* mainLayout; QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; KABC::PhoneNumber::List mPhoneList; @@ -221,30 +227,34 @@ public: } void setPhoneNumber( const KABC::PhoneNumber &phoneNumber ) { mPhoneNumber = phoneNumber; int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); mCombo->setCurrentItem( index ); mNumber->setText( mPhoneNumber.number() ); show(); - + mNumber->setFocus(); } KABC::PhoneNumber phoneNumber() { mPhoneNumber.setNumber( mNumber->text() ); int index = mCombo->currentItem(); mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); return mPhoneNumber; } bool isValid() { if ( mNumber->text().isEmpty() )return false; return true; } + int currentType() + { + return mCombo->currentItem(); + } private slots: void typeExternalChanged( int oldType, int newType ) { if ( mPhoneNumber.type() == newType ) { mPhoneNumber.setType(oldType); int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); mCombo->setCurrentItem( index ); } @@ -254,25 +264,22 @@ public: emit deleteMe( this ); } void comboTypeChange( int index ) { int old = mPhoneNumber.type(); int newT = PhoneNumber::supportedTypeList()[index]; if ( old != newT ) { emit modified(); - emit typeChange ( old, newT ); + if ( newT != PhoneNumber::Voice ) + emit typeChange ( old, newT ); mPhoneNumber.setType(newT ); } } - int currentType() - { - return mCombo->currentItem(); - } void textChanged ( const QString & ) { emit modified(); } signals: void typeChange( int oldType, int newType ); void modified(); void deleteMe( PhoneTypeNumberEdit* ); |