ui/views/listview/src/glxlistview.cpp
changeset 49 f291796e213d
parent 48 d0b4e67b3a60
child 50 a0f57508af73
child 55 fb37077c270f
equal deleted inserted replaced
48:d0b4e67b3a60 49:f291796e213d
    61 }
    61 }
    62 
    62 
    63 void GlxListView::setModel(QAbstractItemModel *model) 
    63 void GlxListView::setModel(QAbstractItemModel *model) 
    64 {
    64 {
    65     qDebug("GlxListView::setModel()");
    65     qDebug("GlxListView::setModel()");
       
    66     if ( mModel ) {
       
    67         disconnect(mModel, SIGNAL(listPopulated()), this, SLOT( populated()));
       
    68     }
    66     mModel =  model ;
    69     mModel =  model ;
    67     mListView->setModel(mModel);
    70     mListView->setModel(mModel);
       
    71     connect(mModel, SIGNAL(listPopulated()), this, SLOT( populated()));
    68 }
    72 }
    69 
    73 
    70 void GlxListView::addToolBar( HbToolBar *toolBar ) 
    74 void GlxListView::addToolBar( HbToolBar *toolBar ) 
    71 {
    75 {
    72     setToolBar(toolBar) ;
    76     setToolBar(toolBar) ;
   178         delete mDocLoader;
   182         delete mDocLoader;
   179         mDocLoader = NULL;
   183         mDocLoader = NULL;
   180     }
   184     }
   181 }
   185 }
   182 
   186 
       
   187 void GlxListView::populated()
       
   188 {
       
   189     QVariant variant = mModel->data(mModel->index(0,0), GlxVisualWindowIndex );
       
   190     int visualIndex = 0;
       
   191     if ( variant.isValid() &&  variant.canConvert<int> () ) 
       
   192     {
       
   193         visualIndex = variant.value<int>();
       
   194     }
       
   195 	//Scroll To the Visible Index as mentioned in the AM.
       
   196     mListView->scrollTo(mModel->index(visualIndex, 0),  HbAbstractItemView::PositionAtTop );
       
   197 }
   183 void GlxListView::itemSelected(const QModelIndex &  index)
   198 void GlxListView::itemSelected(const QModelIndex &  index)
   184 {
   199 {
   185     qDebug("GlxListView::itemSelected() index = %d", index.row() );
   200     qDebug("GlxListView::itemSelected() index = %d", index.row() );
   186     if ( mIsLongPress ) {
   201     if ( mIsLongPress ) {
   187         mIsLongPress = false ;
   202         mIsLongPress = false ;