summaryrefslogtreecommitdiffabout
path: root/kaddressbook/phoneeditwidget.cpp
Unidiff
Diffstat (limited to 'kaddressbook/phoneeditwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/phoneeditwidget.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp
index b20275d..997fc05 100644
--- a/kaddressbook/phoneeditwidget.cpp
+++ b/kaddressbook/phoneeditwidget.cpp
@@ -77,6 +77,4 @@ PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name )
77 hbLayout->add( temp ); 77 hbLayout->add( temp );
78 appendEditCombo();
79 appendEditCombo();
80 appendEditCombo();
81 setDefaults(); 78 setDefaults();
79 mTypeNumberEditList.setAutoDelete( true );
82} 80}
@@ -88,3 +86,4 @@ void PhoneEditWidget::setDefaults()
88{ 86{
89 PhoneTypeNumberEdit* edit = mTypeNumberEditList.first(); 87 mTypeNumberEditList.clear();
88 PhoneTypeNumberEdit* edit = appendEditCombo();
90 KABC::PhoneNumber phoneNumber; 89 KABC::PhoneNumber phoneNumber;
@@ -92,13 +91,9 @@ void PhoneEditWidget::setDefaults()
92 edit->setPhoneNumber( phoneNumber ); 91 edit->setPhoneNumber( phoneNumber );
93 edit = mTypeNumberEditList.next(); 92 edit = appendEditCombo();
94 phoneNumber.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref ); 93 phoneNumber.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref );
95 edit->setPhoneNumber( phoneNumber ); 94 edit->setPhoneNumber( phoneNumber );
96 edit = mTypeNumberEditList.next(); 95 edit = appendEditCombo();
97 phoneNumber.setType( KABC::PhoneNumber::Cell ); 96 phoneNumber.setType( KABC::PhoneNumber::Cell );
98 edit->setPhoneNumber( phoneNumber ); 97 edit->setPhoneNumber( phoneNumber );
99 edit = mTypeNumberEditList.next(); 98
100 while ( edit ) {
101 edit->hide();
102 edit = mTypeNumberEditList.next();
103 }
104} 99}
@@ -113,2 +108,3 @@ PhoneTypeNumberEdit* PhoneEditWidget::appendEditCombo()
113 connect ( edit, SIGNAL ( modified() ), this, SIGNAL ( modified() ) ); 108 connect ( edit, SIGNAL ( modified() ), this, SIGNAL ( modified() ) );
109 connect ( edit, SIGNAL ( deleteMe( PhoneTypeNumberEdit* ) ), this, SLOT ( deleteEdit( PhoneTypeNumberEdit*) ) );
114 connect ( this, SIGNAL ( typeChange( int , int)), edit, SLOT ( typeExternalChanged( int, int)) ); 110 connect ( this, SIGNAL ( typeChange( int , int)), edit, SLOT ( typeExternalChanged( int, int)) );
@@ -120,2 +116,13 @@ PhoneTypeNumberEdit* PhoneEditWidget::appendEditCombo()
120 116
117void PhoneEditWidget::deleteEdit( PhoneTypeNumberEdit* ew )
118{
119 mPendingDelete = ew;
120 QTimer::singleShot( 0, this, SLOT ( pendingDelete() ) );
121}
122void PhoneEditWidget::pendingDelete()
123{
124 mTypeNumberEditList.removeRef( mPendingDelete );
125 emit modified();
126}
127
121void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &li ) 128void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &li )
@@ -125,6 +132,7 @@ void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &li )
125 return; 132 return;
126 } 133 }
134 mTypeNumberEditList.clear();
127 KABC::PhoneNumber::List::Iterator it; 135 KABC::PhoneNumber::List::Iterator it;
128 KABC::PhoneNumber::List list = li; 136 KABC::PhoneNumber::List list = li;
129 PhoneTypeNumberEdit* edit = mTypeNumberEditList.first(); 137 PhoneTypeNumberEdit* edit = 0;//mTypeNumberEditList.first();
130 for ( it = list.begin(); it != list.end(); ++it ) { 138 for ( it = list.begin(); it != list.end(); ++it ) {
@@ -142,4 +150,2 @@ void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &li )
142 } 150 }
143 //mainLayout->invalidate ();
144 mw->update();
145} 151}
@@ -517,2 +523,3 @@ PhoneEditDialog::~PhoneEditDialog()
517{ 523{
524 qDebug("PhoneEditDialog::~PhoneEditDialog() ");
518} 525}