phonebookui/pbkcommonui/src/cnturleditormodel.cpp
changeset 31 2a11b5b00470
parent 25 76a2435edfd4
child 40 b46a585f6909
--- a/phonebookui/pbkcommonui/src/cnturleditormodel.cpp	Mon May 03 12:24:20 2010 +0300
+++ b/phonebookui/pbkcommonui/src/cnturleditormodel.cpp	Fri May 14 15:42:23 2010 +0300
@@ -22,7 +22,7 @@
 CntUrlEditorModel::CntUrlEditorModel(QContact* aContact) :
     CntDetailEditorModel(aContact)
 {
-    QList<QContactUrl> urlList = mContact->details<QContactUrl> ();
+    QList<QContactUrl> urlList = mContact->details<QContactUrl>();
     if (urlList.isEmpty()) {
         QContactUrl url;
         url.setSubType(QContactUrl::SubTypeHomePage);
@@ -43,7 +43,7 @@
 {
     QContactUrl url;
     url.setSubType(QContactUrl::SubTypeHomePage);
-    
+        
     appendDataFormItem( new CntDetailModelItem(url), invisibleRootItem() );
 }
 
@@ -54,9 +54,12 @@
     int count(root->childCount());
     for (int i(0); i < count; i++) {
         CntDetailModelItem* detail = static_cast<CntDetailModelItem*> (root->childAt(i));
-        QContactUrl url = detail->detail();
-        if (url.url().length() > 0) {
-            mContact->saveDetail(&url);
+        QContactDetail url = detail->detail();
+        mContact->saveDetail( &url );
+        
+        if ( url.value(QContactUrl::FieldUrl).isEmpty() )
+        {
+            mContact->removeDetail( &url );
         }
     }
 }