cmmanager/cpdestinationplugin/src/cpdestinationgroup.cpp
changeset 40 c5b848e6c7d1
parent 32 5c4486441ae6
child 41 bbb64eb3bdee
--- a/cmmanager/cpdestinationplugin/src/cpdestinationgroup.cpp	Thu May 27 14:35:19 2010 +0300
+++ b/cmmanager/cpdestinationplugin/src/cpdestinationgroup.cpp	Thu Jun 10 16:00:16 2010 +0300
@@ -88,6 +88,8 @@
         destDataItem->setContentWidgetData(QString("additionalText"),iapCount);
         destDataItem->setDestinationId(destinationList.at(i)->id());
         destDataItem->setDestinationName(destinationList.at(i)->name());
+        HbIcon destIcon(resolveDestinationIcon(destinationList.at(i)));
+        destDataItem->setEntryItemIcon(destIcon);
         bool connected = connect(destDataItem, 
                                  SIGNAL(destChanged()), 
                                  this, 
@@ -254,6 +256,8 @@
         destDataItem->setContentWidgetData(QString("additionalText"),iapCount);
         destDataItem->setDestinationId(0);
         destDataItem->setDestinationName(hbTrId("txt_occ_dblist_uncategorized"));
+        HbIcon destIcon(mCmManager->getUncategorizedIcon());
+        destDataItem->setEntryItemIcon(destIcon);
         bool connected = connect(
             destDataItem, 
             SIGNAL(destChanged()), 
@@ -333,3 +337,37 @@
     OstTrace0(TRACE_FLOW, CPDESTINATIONGROUP_GETDESTINATIONADDITIONALTEXT_EXIT, "Exit");
     return result;
 }
+
+/*!
+    Helper function for showing icons.
+    
+    \return Returns string representing given destination's icon
+ */
+QString CpDestinationGroup::resolveDestinationIcon(
+    QSharedPointer<CmDestinationShim> destination) const
+{
+    QString result(destination->getIcon());
+    
+    if (result.isEmpty()) {
+        uint metaData = destination->metadata(CMManagerShim::SnapMetadataPurpose);
+        switch (metaData) {
+            case CMManagerShim::SnapPurposeInternet:
+                result = "qtg_small_internet";
+                break;
+            case CMManagerShim::SnapPurposeIntranet:
+                result = "qtg_small_intranet";
+                break;
+            case CMManagerShim::SnapPurposeMMS:
+                result = "qtg_small_mms";
+                break;
+            case CMManagerShim::SnapPurposeOperator:
+                result = "qtg_small_operator";
+                break;
+            default:
+                // CMManagerShim::SnapPurposeUnknown
+                result = "qtg_small_favorite";
+                break;
+        }
+    }
+    return result;
+}