author | zautrix <zautrix> | 2005-10-28 14:43:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-28 14:43:31 (UTC) |
commit | ab099bc1be027fe01dc252a9d7a0f8821e782d65 (patch) (side-by-side diff) | |
tree | 85bfb03f334da60dffcc52d54202f51d0f947e3f /kaddressbook | |
parent | caaa030d8bc2aa82c53e5d30abc314b992d7226f (diff) | |
download | kdepimpi-ab099bc1be027fe01dc252a9d7a0f8821e782d65.zip kdepimpi-ab099bc1be027fe01dc252a9d7a0f8821e782d65.tar.gz kdepimpi-ab099bc1be027fe01dc252a9d7a0f8821e782d65.tar.bz2 |
fixxxx
-rw-r--r-- | kaddressbook/phoneeditwidget.cpp | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp index 9e7e221..66f0a5e 100644 --- a/kaddressbook/phoneeditwidget.cpp +++ b/kaddressbook/phoneeditwidget.cpp @@ -155,48 +155,57 @@ void PhoneEditWidget::deleteEdit( PhoneTypeNumberEdit* ew ) mPendingDelete = ew; QTimer::singleShot( 0, this, SLOT ( pendingDelete() ) ); } void PhoneEditWidget::pendingDelete() { mTypeNumberEditList.removeRef( mPendingDelete ); emit modified(); } void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &li ) { if ( li.isEmpty() ) { setDefaults(); return; } mTypeNumberEditList.clear(); - KABC::PhoneNumber::List::Iterator it; - KABC::PhoneNumber::List list = li; - PhoneTypeNumberEdit* edit = 0;//mTypeNumberEditList.first(); + KABC::PhoneNumber::List::Iterator it; + KABC::PhoneNumber::List list2 = li; + KABC::PhoneNumber::List list ; + + PhoneNumber::TypeList tList = PhoneNumber::supportedTypeList(); + int i = 0; + int max = tList.count(); + while ( i < max-1 ) { + for ( it = list2.begin(); it != list2.end(); ++it ) { + if ( (*it).type() == tList[i] ) { + list.append( (*it ) ); + break; + } + } + ++i; + } + for ( it = list2.begin(); it != list2.end(); ++it ) { + if ( (*it).type() == tList[ max-1 ] ) + list.append( (*it ) ); + } for ( it = list.begin(); it != list.end(); ++it ) { - if ( edit ) { - edit->setPhoneNumber( (*it ) ); - edit = mTypeNumberEditList.next(); - } else { PhoneTypeNumberEdit* editNew = appendEditCombo(); editNew->setPhoneNumber( (*it ) ); - } - } - while ( edit ) { - edit->hide(); - edit = mTypeNumberEditList.next(); } + } KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers() { KABC::PhoneNumber::List retList; PhoneTypeNumberEdit* edit = mTypeNumberEditList.first(); while ( edit ) { if ( edit->isValid() ) { retList.append( edit->phoneNumber()); } edit = mTypeNumberEditList.next(); } return retList; } |