ui/views/gridview/src/glxgridview.cpp
changeset 26 c499df2dbb33
parent 24 99ad1390cd33
child 29 2c833fc9e98f
equal deleted inserted replaced
24:99ad1390cd33 26:c499df2dbb33
    48       mGridView(NULL), 
    48       mGridView(NULL), 
    49       mView(NULL), 
    49       mView(NULL), 
    50       mWindow(window), 
    50       mWindow(window), 
    51       mModel ( NULL), 
    51       mModel ( NULL), 
    52       mVisualIndex(0),
    52       mVisualIndex(0),
    53       mItem(NULL)
    53       mItem(NULL),
       
    54       mIsLongPress (false)
    54 {
    55 {
    55     OstTraceFunctionEntry0( GLXGRIDVIEW_GLXGRIDVIEW_ENTRY );
    56     OstTraceFunctionEntry0( GLXGRIDVIEW_GLXGRIDVIEW_ENTRY );
    56     mDocLoader = new HbDocumentLoader();
    57     mDocLoader = new HbDocumentLoader();
    57     OstTraceFunctionExit0( GLXGRIDVIEW_GLXGRIDVIEW_EXIT );
    58     OstTraceFunctionExit0( GLXGRIDVIEW_GLXGRIDVIEW_EXIT );
    58 	setContentFullScreen( true );
    59 	setContentFullScreen( true );
    71 
    72 
    72 void GlxGridView::deActivate()
    73 void GlxGridView::deActivate()
    73 {
    74 {
    74     OstTraceFunctionEntry0( GLXGRIDVIEW_DEACTIVATE_ENTRY );
    75     OstTraceFunctionEntry0( GLXGRIDVIEW_DEACTIVATE_ENTRY );
    75     removeViewConnection();
    76     removeViewConnection();
       
    77     mModel = NULL;
    76     OstTraceFunctionExit0( GLXGRIDVIEW_DEACTIVATE_EXIT );
    78     OstTraceFunctionExit0( GLXGRIDVIEW_DEACTIVATE_EXIT );
    77 }
    79 }
    78 
    80 
    79 void GlxGridView::initializeView(QAbstractItemModel *model)
    81 void GlxGridView::initializeView(QAbstractItemModel *model)
    80 {
    82 {
   173 }
   175 }
   174 
   176 
   175 void GlxGridView::loadGridView(Qt::Orientation orient)
   177 void GlxGridView::loadGridView(Qt::Orientation orient)
   176 {
   178 {
   177     OstTraceFunctionEntry0( GLXGRIDVIEW_LOADGRIDVIEW_ENTRY );
   179     OstTraceFunctionEntry0( GLXGRIDVIEW_LOADGRIDVIEW_ENTRY );
   178     bool loaded = true;
   180     bool loaded = false;
   179     QString section;
   181     QString section;
   180     GlxContextMode mode ;
   182     GlxContextMode mode ;
   181     
   183     
   182     //Load the widgets accroding to the current Orientation
   184     //Load the widgets accroding to the current Orientation
   183     if(orient == Qt::Horizontal) {
   185     if(orient == Qt::Horizontal) {
   232 {
   234 {
   233     OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_ADDVIEWCONNECTION, "GlxGridView::addViewConnection" );
   235     OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_ADDVIEWCONNECTION, "GlxGridView::addViewConnection" );
   234     connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(loadGridView(Qt::Orientation)));
   236     connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(loadGridView(Qt::Orientation)));
   235     connect(mGridView, SIGNAL(activated(const QModelIndex &)), this, SLOT( itemSelected(const QModelIndex &)));
   237     connect(mGridView, SIGNAL(activated(const QModelIndex &)), this, SLOT( itemSelected(const QModelIndex &)));
   236     connect( mGridView, SIGNAL( scrollingEnded() ), this, SLOT( setVisvalWindowIndex() ) );
   238     connect( mGridView, SIGNAL( scrollingEnded() ), this, SLOT( setVisvalWindowIndex() ) );
   237     if(XQServiceUtil::isService()){
       
   238         connect(mGridView, SIGNAL(activated(const QModelIndex &)), this, SIGNAL( gridItemSelected(const QModelIndex &)));
       
   239     }
       
   240     connect(mGridView, SIGNAL(longPressed( HbAbstractViewItem*, QPointF )),this, SLOT( indicateLongPress( HbAbstractViewItem*, QPointF ) ) );
   239     connect(mGridView, SIGNAL(longPressed( HbAbstractViewItem*, QPointF )),this, SLOT( indicateLongPress( HbAbstractViewItem*, QPointF ) ) );
   241 }
   240 }
   242 
   241 
   243 void GlxGridView::removeViewConnection ()
   242 void GlxGridView::removeViewConnection ()
   244 {
   243 {
   245     OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_REMOVEVIEWCONNECTION, "GlxGridView::removeViewConnection" );
   244     OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_REMOVEVIEWCONNECTION, "GlxGridView::removeViewConnection" );
   246     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(loadGridView(Qt::Orientation)));
   245     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(loadGridView(Qt::Orientation)));
   247     disconnect(mGridView, SIGNAL(activated(const QModelIndex &)), this, SLOT( itemSelected(const QModelIndex &)));
   246     disconnect(mGridView, SIGNAL(activated(const QModelIndex &)), this, SLOT( itemSelected(const QModelIndex &)));
   248     disconnect(mGridView, SIGNAL(activated(const QModelIndex &)), this, SIGNAL( gridItemSelected(const QModelIndex &)));
       
   249     disconnect( mGridView, SIGNAL( scrollingEnded() ), this, SLOT( setVisvalWindowIndex() ) );
   247     disconnect( mGridView, SIGNAL( scrollingEnded() ), this, SLOT( setVisvalWindowIndex() ) );
   250     disconnect(mGridView, SIGNAL(longPressed( HbAbstractViewItem*, QPointF )),this, SLOT( indicateLongPress( HbAbstractViewItem*, QPointF ) ) );
   248     disconnect(mGridView, SIGNAL(longPressed( HbAbstractViewItem*, QPointF )),this, SLOT( indicateLongPress( HbAbstractViewItem*, QPointF ) ) );
   251 }
   249 }
   252 
   250 
   253 void GlxGridView::resetItemTransform()
   251 void GlxGridView::resetItemTransform()
   263 
   261 
   264 void GlxGridView::itemSelected(const QModelIndex &  index)
   262 void GlxGridView::itemSelected(const QModelIndex &  index)
   265 {
   263 {
   266     OstTrace1( TRACE_NORMAL, GLXGRIDVIEW_ITEMSELECTED, "GlxGridView::itemSelected;index=%d", index.row() );
   264     OstTrace1( TRACE_NORMAL, GLXGRIDVIEW_ITEMSELECTED, "GlxGridView::itemSelected;index=%d", index.row() );
   267 
   265 
   268     if ( mGridView->selectionMode() == HbGridView::MultiSelection ){ //in multi selection mode no need to open the full screen
   266     if ( mGridView->selectionMode() == HbGridView::MultiSelection ) { //in multi selection mode no need to open the full screen
   269     return ;
   267         return ;
   270     }
   268     }
       
   269     if ( mIsLongPress ) {
       
   270         mIsLongPress = false;
       
   271         return ;
       
   272     }
       
   273     if(XQServiceUtil::isService()){
       
   274         emit gridItemSelected(index);
       
   275         return;
       
   276     }
       
   277     
   271     OstTraceEventStart0( EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_START, "Fullscreen Launch Time" );
   278     OstTraceEventStart0( EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_START, "Fullscreen Launch Time" );
   272     
   279     
   273     if ( mModel ) 
   280     if ( mModel ) {
   274         {
       
   275         mModel->setData( index, index.row(), GlxFocusIndexRole );
   281         mModel->setData( index, index.row(), GlxFocusIndexRole );
   276         }
   282     }
   277     emit actionTriggered( EGlxCmdFullScreenOpen );
   283     emit actionTriggered( EGlxCmdFullScreenOpen );
   278     OstTraceEventStop( EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_STOP, "Fullscreen Launch Time", EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_START );
   284     OstTraceEventStop( EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_STOP, "Fullscreen Launch Time", EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_START );
   279 }
   285 }
   280 
   286 
   281 void GlxGridView::setVisvalWindowIndex()
   287 void GlxGridView::setVisvalWindowIndex()
   327     }
   333     }
   328 
   334 
   329     if ( mModel ) {
   335     if ( mModel ) {
   330     	mModel->setData( item->modelIndex(), item->modelIndex().row(), GlxFocusIndexRole );
   336     	mModel->setData( item->modelIndex(), item->modelIndex().row(), GlxFocusIndexRole );
   331     }
   337     }
       
   338     mIsLongPress = true;
   332     emit itemSpecificMenuTriggered(viewId(),coords);
   339     emit itemSpecificMenuTriggered(viewId(),coords);
   333 }
   340 }