40 } |
40 } |
41 |
41 |
42 void CntEmailEditorModel::insertDetailField() |
42 void CntEmailEditorModel::insertDetailField() |
43 { |
43 { |
44 QContactEmailAddress newAddr; |
44 QContactEmailAddress newAddr; |
45 |
|
46 CntDetailModelItem* item = new CntDetailModelItem( newAddr ); |
45 CntDetailModelItem* item = new CntDetailModelItem( newAddr ); |
47 appendDataFormItem( item, invisibleRootItem() ); |
46 appendDataFormItem( item, invisibleRootItem() ); |
48 } |
47 } |
49 |
48 |
50 void CntEmailEditorModel::saveContactDetails() |
49 void CntEmailEditorModel::saveContactDetails() |
51 { |
50 { |
52 HbDataFormModelItem* root = invisibleRootItem(); |
51 HbDataFormModelItem* root = invisibleRootItem(); |
53 int count( root->childCount() ); |
52 int count( root->childCount() ); |
54 for ( int i(0); i < count; i++ ) { |
53 for ( int i(0); i < count; i++ ) { |
55 CntDetailModelItem* item = static_cast<CntDetailModelItem*>( root->childAt(i) ); |
54 CntDetailModelItem* item = static_cast<CntDetailModelItem*>( root->childAt(i) ); |
56 QContactEmailAddress address = item->detail(); |
55 QContactDetail address = item->detail(); |
57 QString email = address.emailAddress(); |
56 mContact->saveDetail( &address ); |
58 if ( email.length() > 0 ) { |
57 |
59 mContact->saveDetail( &address ); |
58 if ( address.value(QContactEmailAddress::FieldEmailAddress).isEmpty() ) { |
|
59 mContact->removeDetail( &address ); |
60 } |
60 } |
61 } |
61 } |
62 } |
62 } |
63 |
63 |
64 // End of File |
64 // End of File |