summaryrefslogtreecommitdiffabout
path: root/kaddressbook/phoneeditwidget.h
authorzautrix <zautrix>2005-10-28 12:10:35 (UTC)
committer zautrix <zautrix>2005-10-28 12:10:35 (UTC)
commitcee83f70d8e4a6945f4456c55ab1b280d3425f0f (patch) (unidiff)
tree1b317655a344f1a3640ef2561d61075e0feddd64 /kaddressbook/phoneeditwidget.h
parentb27cb619bb9005ad4345d38bbee3b1c3d0eda1b2 (diff)
downloadkdepimpi-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.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
@@ -57,28 +57,31 @@ class PhoneEditWidget : public QScrollView
57 57
58 void setPhoneNumbers( const KABC::PhoneNumber::List &list ); 58 void setPhoneNumbers( const KABC::PhoneNumber::List &list );
59 KABC::PhoneNumber::List phoneNumbers(); 59 KABC::PhoneNumber::List phoneNumbers();
60 60
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};
81 84
82 85
83 86
84 87
@@ -203,85 +206,82 @@ public:
203 mMinusButton = new QPushButton ( this ); 206 mMinusButton = new QPushButton ( this );
204 mMinusButton->setPixmap ( SmallIcon("minus")); 207 mMinusButton->setPixmap ( SmallIcon("minus"));
205 mCombo = new KComboBox( this ); 208 mCombo = new KComboBox( this );
206 mNumber = new KLineEdit( this ); 209 mNumber = new KLineEdit( this );
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 );
263 mPhoneNumber.setType(newT ); 263 mPhoneNumber.setType(newT );
264 } 264 }
265 265
266 } 266 }
267 int currentType() 267 int currentType()
268 { 268 {
269 return mCombo->currentItem(); 269 return mCombo->currentItem();
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:
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
287#endif 287#endif