34 } |
34 } |
35 |
35 |
36 void CntNoteEditorModel::insertDetailField() |
36 void CntNoteEditorModel::insertDetailField() |
37 { |
37 { |
38 QContactNote emptyNote; |
38 QContactNote emptyNote; |
|
39 mNoteList.append( emptyNote ); |
39 appendDataFormItem( new CntDetailModelItem(emptyNote), invisibleRootItem() ); |
40 appendDataFormItem( new CntDetailModelItem(emptyNote), invisibleRootItem() ); |
40 } |
41 } |
41 |
42 |
42 void CntNoteEditorModel::saveContactDetails() |
43 void CntNoteEditorModel::saveContactDetails() |
43 { |
44 { |
44 HbDataFormModelItem* root = invisibleRootItem(); |
45 HbDataFormModelItem* root = invisibleRootItem(); |
45 |
46 |
46 int count( root->childCount() ); |
47 int count( root->childCount() ); |
47 for ( int i(0); i < count; i++ ) { |
48 for ( int i(0); i < count; i++ ) { |
48 CntDetailModelItem* detail = static_cast<CntDetailModelItem*>( root->childAt(i) ); |
49 CntDetailModelItem* detail = static_cast<CntDetailModelItem*>( root->childAt(i) ); |
49 QContactDetail note = detail->detail(); |
50 QContactNote note = detail->detail(); |
50 mContact->saveDetail( ¬e ); |
|
51 |
51 |
52 if ( note.value(QContactNote::FieldNote).isEmpty() ) |
52 if ( !mNoteList.contains(note) ) |
|
53 { |
|
54 mContact->saveDetail( ¬e ); |
|
55 } |
|
56 |
|
57 if ( note.note().isEmpty() ) |
53 { |
58 { |
54 mContact->removeDetail( ¬e ); |
59 mContact->removeDetail( ¬e ); |
55 } |
60 } |
56 } |
61 } |
57 } |
62 } |