ui/uiengine/model/listmodel/src/glxalbummodel.cpp
changeset 45 863223ea6961
parent 40 112f0ac2d1f0
child 50 a0f57508af73
child 55 fb37077c270f
--- a/ui/uiengine/model/listmodel/src/glxalbummodel.cpp	Fri Jun 11 17:53:15 2010 +0530
+++ b/ui/uiengine/model/listmodel/src/glxalbummodel.cpp	Fri Jun 25 15:41:33 2010 +0530
@@ -48,8 +48,11 @@
 	qDebug("insertItems() connection status %d", err);
 	err = connect(mMLWrapper, SIGNAL(removeItems(int, int)), this, SLOT(itemsRemoved(int, int)));
 	qDebug("removeItems() connection status %d", err);
+    err = connect(mMLWrapper, SIGNAL(populated()), this, SLOT(modelPopulated()));
+	qDebug("populated() connection status %d", err);
     err = connect(this, SIGNAL(iconAvailable(int, HbIcon*, GlxTBContextType)), this, SLOT(updateItemIcon(int, HbIcon*, GlxTBContextType)));
 	qDebug("iconAvailable() connection status %d", err);
+	mTempVisibleWindowIndex = 0;
     itemIconCache.setMaxCost(50);
 }
 
@@ -62,6 +65,7 @@
 	err = disconnect(mMLWrapper, SIGNAL(insertItems(int, int)), this, SLOT(itemsAdded(int, int)));
 	err = disconnect(mMLWrapper, SIGNAL(removeItems(int, int)), this, SLOT(itemsRemoved(int, int)));
     err = disconnect(this, SIGNAL(iconAvailable(int, HbIcon*, GlxTBContextType)), this, SLOT(updateItemIcon(int, HbIcon*, GlxTBContextType)));
+    err = disconnect(mMLWrapper, SIGNAL(populated()), this, SLOT(modelPopulated()));
 	delete mMLWrapper;
     mMLWrapper = NULL;
     itemIconCache.clear();
@@ -149,6 +153,8 @@
         
     case GlxSystemItemRole :
         return mMLWrapper->isSystemItem( getFocusIndex().row() );
+    case GlxVisualWindowIndex :
+        return mMLWrapper->getVisibleWindowIndex();
            
     default :       
         return QVariant();
@@ -186,6 +192,12 @@
             return TRUE;
         }
     }
+    if ( GlxTempVisualWindowIndex == role ) {
+        if ( value.isValid() && value.canConvert<int> () ) {
+        mTempVisibleWindowIndex = value.value <int> (); 
+            return TRUE;
+        }
+    }
     return FALSE;
 }
 
@@ -232,6 +244,14 @@
     return index(mMLWrapper->getFocusIndex(), 0);
 }
 
+void GlxAlbumModel::modelPopulated()
+{
+    if ( mTempVisibleWindowIndex!=-1) {
+        mMLWrapper->setVisibleWindowIndex(mTempVisibleWindowIndex);
+        mTempVisibleWindowIndex = -1;
+        emit listPopulated();
+    }
+}
 void GlxAlbumModel::itemUpdated1(int mlIndex,GlxTBContextType tbContextType  )
 {
 	Q_UNUSED(tbContextType);