summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/phoneeditwidget.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h
index fbf9fe7..f61087b 100644
--- a/kaddressbook/phoneeditwidget.h
+++ b/kaddressbook/phoneeditwidget.h
@@ -55,96 +55,98 @@ class PhoneEditWidget : public QWidget
55 public: 55 public:
56 PhoneEditWidget( QWidget *parent, const char *name = 0 ); 56 PhoneEditWidget( QWidget *parent, const char *name = 0 );
57 ~PhoneEditWidget(); 57 ~PhoneEditWidget();
58 58
59 void setPhoneNumbers( const KABC::PhoneNumber::List &list ); 59 void setPhoneNumbers( const KABC::PhoneNumber::List &list );
60 KABC::PhoneNumber::List phoneNumbers(); 60 KABC::PhoneNumber::List phoneNumbers();
61 61
62 // void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); 62 // void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* );
63 //KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); 63 //KABC::PhoneNumber currentPhoneNumber( KComboBox*, int );
64 64
65 signals: 65 signals:
66 void modified(); 66 void modified();
67 void typeChange( int oldType, int newType ); 67 void typeChange( int oldType, int newType );
68 68
69 private slots: 69 private slots:
70 void bottomVisible(); 70 void bottomVisible();
71 void addNumberInt( int ); 71 void addNumberInt( int );
72 void deleteEdit( PhoneTypeNumberEdit* ew ); 72 void deleteEdit( PhoneTypeNumberEdit* ew );
73 void addNumber(); 73 void addNumber();
74 void pendingDelete(); 74 void pendingDelete();
75 protected: 75 protected:
76 76
77 private: 77 private:
78 QScrollView* sv; 78 QScrollView* sv;
79 QPopupMenu *mPopup; 79 QPopupMenu *mPopup;
80 int mPopupCount; 80 int mPopupCount;
81 PhoneTypeNumberEdit* mPendingDelete; 81 PhoneTypeNumberEdit* mPendingDelete;
82 void setDefaults(); 82 void setDefaults();
83 PhoneTypeNumberEdit* appendEditCombo(); 83 PhoneTypeNumberEdit* appendEditCombo();
84 QWidget* mw; 84 QWidget* mw;
85 QVBoxLayout* mainLayout; 85 QVBoxLayout* mainLayout;
86 QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; 86 QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList;
87 87
88}; 88};
89 89
90 90
91class PhoneTypeNumberEdit : public QWidget 91class PhoneTypeNumberEdit : public QWidget
92{ 92{
93 Q_OBJECT 93 Q_OBJECT
94public: 94public:
95 PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent ) 95 PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent )
96 { 96 {
97 QHBoxLayout * lay = new QHBoxLayout( this ); 97 QHBoxLayout * lay = new QHBoxLayout( this );
98 lay->setSpacing( 2 ); 98 lay->setSpacing( 2 );
99 lay->setMargin( 0 ); 99 lay->setMargin( 0 );
100 mMinusButton = new QPushButton ( this ); 100 mMinusButton = new QPushButton ( this );
101 mMinusButton->setPixmap ( SmallIcon("minus")); 101 mMinusButton->setPixmap ( SmallIcon("minus"));
102 mCombo = new KComboBox( this ); 102 mCombo = new KComboBox( this );
103 if ( QApplication::desktop()->width() <= 640 )
104 mCombo->setSizeLimit ( 6 );
103 mNumber = new KLineEdit( this ); 105 mNumber = new KLineEdit( this );
104 mMinusButton->setMaximumHeight( mNumber->sizeHint().height() + 6); 106 mMinusButton->setMaximumHeight( mNumber->sizeHint().height() + 6);
105 lay->addWidget( mMinusButton ); 107 lay->addWidget( mMinusButton );
106 lay->addWidget( mCombo ); 108 lay->addWidget( mCombo );
107 lay->addWidget( mNumber ); 109 lay->addWidget( mNumber );
108 connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) ); 110 connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) );
109 connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) ); 111 connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) );
110 connect( mNumber , SIGNAL ( textChanged ( const QString & ) ), 112 connect( mNumber , SIGNAL ( textChanged ( const QString & ) ),
111 this, SLOT ( textChanged ( const QString & ) ) ); 113 this, SLOT ( textChanged ( const QString & ) ) );
112 mCombo->insertStringList( PhoneNumber::supportedTypeListNames() ); 114 mCombo->insertStringList( PhoneNumber::supportedTypeListNames() );
113 } 115 }
114 ~PhoneTypeNumberEdit() { 116 ~PhoneTypeNumberEdit() {
115 // qDebug("~PhoneTypeNumberEdit() "); 117 // qDebug("~PhoneTypeNumberEdit() ");
116 } 118 }
117 void setPhoneNumber( const KABC::PhoneNumber &phoneNumber ) 119 void setPhoneNumber( const KABC::PhoneNumber &phoneNumber )
118 { 120 {
119 mPhoneNumber = phoneNumber; 121 mPhoneNumber = phoneNumber;
120 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); 122 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
121 mCombo->setCurrentItem( index ); 123 mCombo->setCurrentItem( index );
122 mNumber->setText( mPhoneNumber.number() ); 124 mNumber->setText( mPhoneNumber.number() );
123 show(); 125 show();
124 mNumber->setFocus(); 126 mNumber->setFocus();
125 } 127 }
126 KABC::PhoneNumber phoneNumber() 128 KABC::PhoneNumber phoneNumber()
127 { 129 {
128 mPhoneNumber.setNumber( mNumber->text() ); 130 mPhoneNumber.setNumber( mNumber->text() );
129 int index = mCombo->currentItem(); 131 int index = mCombo->currentItem();
130 mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); 132 mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] );
131 return mPhoneNumber; 133 return mPhoneNumber;
132 } 134 }
133 bool isValid() 135 bool isValid()
134 { 136 {
135 if ( mNumber->text().isEmpty() )return false; 137 if ( mNumber->text().isEmpty() )return false;
136 return true; 138 return true;
137 } 139 }
138 int currentType() 140 int currentType()
139 { 141 {
140 return mCombo->currentItem(); 142 return mCombo->currentItem();
141 } 143 }
142 private slots: 144 private slots:
143 void typeExternalChanged( int oldType, int newType ) 145 void typeExternalChanged( int oldType, int newType )
144 { 146 {
145 if ( mPhoneNumber.type() == newType ) { 147 if ( mPhoneNumber.type() == newType ) {
146 mPhoneNumber.setType(oldType); 148 mPhoneNumber.setType(oldType);
147 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); 149 int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
148 mCombo->setCurrentItem( index ); 150 mCombo->setCurrentItem( index );
149 } 151 }
150 } 152 }