ui/uiengine/model/listmodel/src/glxalbummodel.cpp
changeset 24 99ad1390cd33
parent 23 74c9f037fd5d
child 29 2c833fc9e98f
--- a/ui/uiengine/model/listmodel/src/glxalbummodel.cpp	Fri Mar 19 09:28:59 2010 +0200
+++ b/ui/uiengine/model/listmodel/src/glxalbummodel.cpp	Fri Apr 16 14:58:46 2010 +0300
@@ -20,6 +20,13 @@
 #include <QDebug>
 #include <hbicon.h>
 #include <QStringList>
+#include <QBrush>
+
+#include "glxicondefs.h" //Contains the icon names/Ids
+
+const QColor KListOddRowColor(211, 211, 211, 127);
+const QColor KListEvenRowColor(255, 250, 250, 127);
+
 
 GlxAlbumModel::GlxAlbumModel(GlxModelParm & modelParm):mContextMode(GlxContextInvalid)
 {
@@ -32,7 +39,7 @@
     mContextMode = GlxContextSelectionList;
     
     //todo get this Default icon from some generic path and not directly.
-    mDefaultIcon = new HbIcon(":/data/All_default.png");
+     mDefaultIcon = new HbIcon(GLXICON_DEFAULT);
 
 	int err = connect(mMLWrapper, SIGNAL(updateItem(int, GlxTBContextType)), this, SLOT(itemUpdated1(int, GlxTBContextType)));
 	qDebug("updateItem() connection status %d", err);
@@ -120,7 +127,18 @@
                 return *itemIcon;
             }
         }
-		
+    case Qt::BackgroundRole:
+        {
+            if (rowIndex % 2 == 0)
+            {
+                return QBrush(KListEvenRowColor);
+            }
+            else
+            {
+                return QBrush(KListOddRowColor);
+            }
+        }
+
     case GlxFocusIndexRole :
         idx = getFocusIndex();
         return idx.row();
@@ -147,7 +165,14 @@
             return TRUE;
         }
     }
-    
+
+    if ( GlxVisualWindowIndex == role ) {
+        if ( value.isValid() &&  value.canConvert <int> () ) {
+            mMLWrapper->setVisibleWindowIndex(  value.value <int> () );
+            return TRUE;
+        }
+    }
+
     if ( GlxSelectedIndexRole == role ) {
         if ( value.isValid() &&  value.canConvert <int> () ) {
             setSelectedIndex( index( value.value <int> (), 0) );