phonebookui/pbkcommonui/src/cntcollectionlistmodel.cpp
changeset 31 2a11b5b00470
parent 27 de1630741fbe
child 37 fd64c38c277d
--- a/phonebookui/pbkcommonui/src/cntcollectionlistmodel.cpp	Mon May 03 12:24:20 2010 +0300
+++ b/phonebookui/pbkcommonui/src/cntcollectionlistmodel.cpp	Fri May 14 15:42:23 2010 +0300
@@ -109,22 +109,6 @@
     
     beginRemoveRows(parent, row, row);
     mDataPointer->mDataList.removeAt(row);
-    if (mDataPointer->mExtensions.remove(row) > 0)
-    {
-        // if extension group was deleted, refresh the indices of extension group map
-        QList<int> keyList = mDataPointer->mExtensions.keys();
-        qSort(keyList);
-        
-        for (int i = 0;i < keyList.count();i++)
-        {
-            if (keyList.at(i) > row)
-            {
-                CntUiGroupSupplier* groupSupplier = mDataPointer->mExtensions.take(keyList.at(i));
-                mDataPointer->mExtensions.insert(keyList.at(i) - 1, groupSupplier);
-            }
-        }
-    }
-
     endRemoveRows();
 
     return true;
@@ -137,7 +121,8 @@
 {
     for (int i = 0;i < rowCount();i++)
     {
-        if (mDataPointer->mDataList.at(i)[2] == localId)
+        // extension items have 4 items in the list, we don't allow those to be deleted from here
+        if (mDataPointer->mDataList.at(i)[2] == localId && mDataPointer->mDataList.at(i).count() < 4)
         {
             removeRow(i);
             break;
@@ -221,13 +206,13 @@
        }
        else
        {
-       displayList.append(hbTrId("txt_phob_dblist_favorites_val_no_favorites_selecte")); // as this isn't supported yet
+           displayList.append(hbTrId("txt_phob_dblist_favorites_val_no_favorites_selecte"));
        }
 
     }
     dataList.append(displayList);
     dataList.append(QStringList("qtg_large_favourites"));
-    dataList.append(mFavoriteGroupId); // as favorites doesn't really have a contact Id, -1 is used
+    dataList.append(mFavoriteGroupId);
     mDataPointer->mDataList.append(dataList);
 }
 
@@ -358,9 +343,23 @@
                 }
                 dataList.append(displayList);
                 
-                // icon, default for now always
-                dataList.append(QStringList("qtg_large_custom"));
-                
+                // Default if no image for group 
+                bool icon = false;
+                QList<QContactAvatar> details = contact.details<QContactAvatar>();
+                for (int i = 0;i < details.count();i++)
+                {
+                    if (details.at(i).imageUrl().isValid())
+                    {
+                        dataList.append(QStringList(details.at(i).imageUrl().toString()));
+                        icon = true;
+                        break;
+                    }
+                }
+                if(!icon)
+                {
+                    dataList.append(QStringList("qtg_large_custom"));
+                }
+ 
                 // contact Id for identification
                 dataList.append(groupContactIds.at(i));