videocollection/videocollectionview/src/videolistview.cpp
changeset 55 4bfa887905cf
parent 50 21fe8338c6bf
child 58 d2b028fd1f7d
equal deleted inserted replaced
50:21fe8338c6bf 55:4bfa887905cf
  1304     showAction(false, DOCML_NAME_SORT_BY_DATE);
  1304     showAction(false, DOCML_NAME_SORT_BY_DATE);
  1305     showAction(false, DOCML_NAME_SORT_BY_NAME);
  1305     showAction(false, DOCML_NAME_SORT_BY_NAME);
  1306     showAction(false, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
  1306     showAction(false, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
  1307     showAction(false, DOCML_NAME_SORT_BY_SIZE);
  1307     showAction(false, DOCML_NAME_SORT_BY_SIZE);
  1308     showAction(false, DOCML_NAME_SORT_MENU);
  1308     showAction(false, DOCML_NAME_SORT_MENU);
  1309     
  1309 
       
  1310     HbAction *firstAction = (HbAction*)(toolBar()->actions().first());
       
  1311 
       
  1312     bool isCollectionsView = mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionCollections] &&
       
  1313            firstAction == mToolbarActions[ETBActionAllVideos];
       
  1314     
       
  1315     // Create collection action is shown even when there's no videos. 
       
  1316     if(isCollectionsView && !mVideoServices)
       
  1317     {
       
  1318         showAction(true, DOCML_NAME_CREATE_COLLECTION);
       
  1319     }
       
  1320     
       
  1321     //  No other actions shown if there's no videos.
  1310     VideoSortFilterProxyModel *model = mCurrentList->getModel();
  1322     VideoSortFilterProxyModel *model = mCurrentList->getModel();
  1311     if (!model || !model->rowCount())
  1323     if (!model || !model->rowCount())
  1312     {
  1324     {
  1313         return;
  1325         return;
  1314     }
  1326     }
  1316     // get current sorting values
  1328     // get current sorting values
  1317     int role;
  1329     int role;
  1318     Qt::SortOrder order;
  1330     Qt::SortOrder order;
  1319     model->getSorting(role, order);
  1331     model->getSorting(role, order);
  1320 
  1332 
  1321     HbAction *firstAction = (HbAction*)(toolBar()->actions().first());
       
  1322 
       
  1323     if(mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionAllVideos] &&
  1333     if(mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionAllVideos] &&
  1324        firstAction == mToolbarActions[ETBActionAllVideos])
  1334        firstAction == mToolbarActions[ETBActionAllVideos])
  1325     {
  1335     {
  1326         showAction(true, DOCML_NAME_SORT_MENU);
  1336         showAction(true, DOCML_NAME_SORT_MENU);
  1327 
       
  1328         showAction(true, DOCML_NAME_SORT_BY_DATE);
  1337         showAction(true, DOCML_NAME_SORT_BY_DATE);
  1329         showAction(true, DOCML_NAME_SORT_BY_NAME);
  1338         showAction(true, DOCML_NAME_SORT_BY_NAME);
  1330         showAction(true, DOCML_NAME_SORT_BY_SIZE);
  1339         showAction(true, DOCML_NAME_SORT_BY_SIZE);
  1331 
  1340 
  1332         HbAction* action = mSortingRoles.key(role);
  1341         HbAction* action = mSortingRoles.key(role);
  1339         {
  1348         {
  1340             showAction(true, DOCML_NAME_ADD_TO_COLLECTION);
  1349             showAction(true, DOCML_NAME_ADD_TO_COLLECTION);
  1341             showAction(true, DOCML_NAME_DELETE_MULTIPLE);
  1350             showAction(true, DOCML_NAME_DELETE_MULTIPLE);
  1342         }
  1351         }
  1343     }
  1352     }
  1344     else if(mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionCollections] &&
  1353     else if(isCollectionsView)
  1345     		firstAction == mToolbarActions[ETBActionAllVideos] )
  1354     {
  1346     {
       
  1347         if (!mVideoServices)
       
  1348         {
       
  1349             showAction(true, DOCML_NAME_CREATE_COLLECTION);
       
  1350         }
       
  1351         showAction(true, DOCML_NAME_SORT_MENU);
  1355         showAction(true, DOCML_NAME_SORT_MENU);
  1352         showAction(true, DOCML_NAME_SORT_BY_NAME);
  1356         showAction(true, DOCML_NAME_SORT_BY_NAME);
  1353         showAction(true, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
  1357         showAction(true, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
  1354     	
  1358     	
  1355 		HbAction* action = mSortingRoles.key(role);
  1359 		HbAction* action = mSortingRoles.key(role);