Diffstat (limited to 'kaddressbook/phoneeditwidget.cpp') (more/less context) (ignore whitespace changes)
-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 | |||
@@ -163,32 +163,41 @@ void PhoneEditWidget::pendingDelete() | |||
163 | 163 | ||
164 | void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &li ) | 164 | void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &li ) |
165 | { | 165 | { |
166 | if ( li.isEmpty() ) { | 166 | if ( li.isEmpty() ) { |
167 | setDefaults(); | 167 | setDefaults(); |
168 | return; | 168 | return; |
169 | } | 169 | } |
170 | mTypeNumberEditList.clear(); | 170 | mTypeNumberEditList.clear(); |
171 | KABC::PhoneNumber::List::Iterator it; | 171 | KABC::PhoneNumber::List::Iterator it; |
172 | KABC::PhoneNumber::List list = li; | 172 | KABC::PhoneNumber::List list2 = li; |
173 | PhoneTypeNumberEdit* edit = 0;//mTypeNumberEditList.first(); | 173 | KABC::PhoneNumber::List list ; |
174 | |||
175 | PhoneNumber::TypeList tList = PhoneNumber::supportedTypeList(); | ||
176 | int i = 0; | ||
177 | int max = tList.count(); | ||
178 | while ( i < max-1 ) { | ||
179 | for ( it = list2.begin(); it != list2.end(); ++it ) { | ||
180 | if ( (*it).type() == tList[i] ) { | ||
181 | list.append( (*it ) ); | ||
182 | break; | ||
183 | } | ||
184 | } | ||
185 | ++i; | ||
186 | } | ||
187 | for ( it = list2.begin(); it != list2.end(); ++it ) { | ||
188 | if ( (*it).type() == tList[ max-1 ] ) | ||
189 | list.append( (*it ) ); | ||
190 | } | ||
174 | for ( it = list.begin(); it != list.end(); ++it ) { | 191 | for ( it = list.begin(); it != list.end(); ++it ) { |
175 | if ( edit ) { | ||
176 | edit->setPhoneNumber( (*it ) ); | ||
177 | edit = mTypeNumberEditList.next(); | ||
178 | } else { | ||
179 | PhoneTypeNumberEdit* editNew = appendEditCombo(); | 192 | PhoneTypeNumberEdit* editNew = appendEditCombo(); |
180 | editNew->setPhoneNumber( (*it ) ); | 193 | editNew->setPhoneNumber( (*it ) ); |
181 | } | ||
182 | } | ||
183 | while ( edit ) { | ||
184 | edit->hide(); | ||
185 | edit = mTypeNumberEditList.next(); | ||
186 | } | 194 | } |
195 | |||
187 | } | 196 | } |
188 | KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers() | 197 | KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers() |
189 | { | 198 | { |
190 | KABC::PhoneNumber::List retList; | 199 | KABC::PhoneNumber::List retList; |
191 | 200 | ||
192 | PhoneTypeNumberEdit* edit = mTypeNumberEditList.first(); | 201 | PhoneTypeNumberEdit* edit = mTypeNumberEditList.first(); |
193 | while ( edit ) { | 202 | while ( edit ) { |
194 | if ( edit->isValid() ) { | 203 | if ( edit->isValid() ) { |