ui/views/listview/src/glxlistview.cpp
changeset 24 99ad1390cd33
parent 23 74c9f037fd5d
child 26 c499df2dbb33
--- a/ui/views/listview/src/glxlistview.cpp	Fri Mar 19 09:28:59 2010 +0200
+++ b/ui/views/listview/src/glxlistview.cpp	Fri Apr 16 14:58:46 2010 +0300
@@ -24,7 +24,7 @@
 #include <hbmainwindow.h>
 #include <hbdocumentloader.h>
 #include <hbabstractviewitem.h>
-
+#include <HbListViewItem.h>
 //User Includes
 #include "glxviewids.h"
 #include "glxlistview.h"
@@ -54,8 +54,6 @@
 {
     qDebug("GlxListView::deActivate()");
     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation)));
-    takeToolBar(); //To:Do improved later
-    emit toolBarChanged();
 }
 
 void GlxListView::setModel(QAbstractItemModel *model) 
@@ -67,10 +65,6 @@
 
 void GlxListView::addToolBar( HbToolBar *toolBar ) 
 {
-    //toolBar->setParent(this);
-    if ( mListView ) {
-        toolBar->setZValue(mListView->zValue());
-    }
     setToolBar(toolBar) ;
 }
 
@@ -97,6 +91,7 @@
     qDebug("GlxListView::addViewConnection()");
     connect(mListView, SIGNAL(activated(const QModelIndex &)), this, SLOT( itemSelected(const QModelIndex &)));
     connect(mListView, SIGNAL(longPressed( HbAbstractViewItem*, QPointF )),this, SLOT( indicateLongPress( HbAbstractViewItem*, QPointF ) ) );
+    connect( mListView, SIGNAL( scrollingEnded() ), this, SLOT( setVisvalWindowIndex() ) );
 }
 
 void GlxListView::removeViewConnection()
@@ -104,8 +99,27 @@
     qDebug("GlxListView::removeViewConnection()");
     disconnect(mListView, SIGNAL(activated(const QModelIndex &)), this, SLOT( itemSelected(const QModelIndex &)));
     disconnect(mListView, SIGNAL(longPressed( HbAbstractViewItem*, QPointF )),this, SLOT( indicateLongPress( HbAbstractViewItem*, QPointF ) ) );
+    disconnect( mListView, SIGNAL( scrollingEnded() ), this, SLOT( setVisvalWindowIndex() ) );
 }
 
+void GlxListView::setVisvalWindowIndex()
+    {
+    QList< HbAbstractViewItem * >  visibleItemList =  mListView->visibleItems();
+    qDebug("GlxListView::setVisvalWindowIndex() %d", visibleItemList.count());    
+    
+    if ( visibleItemList.count() <= 0 )
+        return ;
+
+    HbAbstractViewItem *item = visibleItemList.at(0);    
+    if ( item == NULL ) 
+        return ;
+        
+    if (  item->modelIndex().row() < 0 || item->modelIndex().row() >= mModel->rowCount() )
+        return ;
+    
+    mModel->setData( item->modelIndex (), item->modelIndex().row(), GlxVisualWindowIndex);
+    }
+
 void GlxListView::loadListView()
 {
     qDebug("GlxListView::loadListView()");
@@ -125,7 +139,9 @@
                 //sets the widget
                 setWidget((QGraphicsWidget*) mView);
                 }
-            }   
+            }  
+        HbListViewItem *prototype = mListView->listItemPrototype();
+        prototype->setStretchingStyle(HbListViewItem::StretchLandscape);
         }
 }