diff -r de1630741fbe -r 2a11b5b00470 phonebookui/pbkcommonui/src/cntphonenumbermodel.cpp --- a/phonebookui/pbkcommonui/src/cntphonenumbermodel.cpp Mon May 03 12:24:20 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntphonenumbermodel.cpp Fri May 14 15:42:23 2010 +0300 @@ -35,10 +35,13 @@ // if there's no details, add if ( all.isEmpty() ) { - QContactPhoneNumber number; - number.setSubTypes( QContactPhoneNumber::SubTypeMobile ); - - all.append( number ); + QContactPhoneNumber mobileNumber; + mobileNumber.setSubTypes( QContactPhoneNumber::SubTypeMobile ); + all.append( mobileNumber ); + + QContactPhoneNumber landLineNumber; + landLineNumber.setSubTypes( QContactPhoneNumber::SubTypeLandline ); + all.append( landLineNumber ); } HbDataFormModelItem* root = invisibleRootItem(); @@ -54,7 +57,7 @@ { QContactPhoneNumber number; number.setSubTypes( QContactPhoneNumber::SubTypeMobile ); - + appendDataFormItem( new CntDetailModelItem(number), invisibleRootItem() ); } @@ -65,25 +68,21 @@ for ( int i = 0; i < count; i++ ) { CntDetailModelItem* item = static_cast( root->childAt(i) ); QContactDetail detail = item->detail(); + mContact->saveDetail( &detail ); if ( detail.definitionName() == QContactPhoneNumber::DefinitionName ) { - QContactPhoneNumber phonenumber = detail; - if ( phonenumber.number().length() > 0 ) { - mContact->saveDetail( &phonenumber ); - } + if ( detail.value(QContactPhoneNumber::FieldNumber).isEmpty() ) + mContact->removeDetail( &detail ); } - else if ( detail.definitionName() == QContactOnlineAccount::DefinitionName ) + + if ( detail.definitionName() == QContactOnlineAccount::DefinitionName ) { - QContactOnlineAccount account = detail; - if ( account.accountUri().length() > 0 ) { - mContact->saveDetail( &account ); + if ( detail.value(QContactOnlineAccount::FieldAccountUri).isEmpty() ) + { + mContact->removeDetail( &detail ); } } - else { - /* should never be here */ - qWarning() << "Unknown: " << detail.definitionName(); - } } }