videocollection/videocollectionview/src/videocollectionviewutils.cpp
changeset 46 adbe7d5ba2f5
parent 28 c48470be1ba7
child 47 45e72b57a2fd
equal deleted inserted replaced
28:c48470be1ba7 46:adbe7d5ba2f5
    13 *
    13 *
    14 * Description: video collection view plugin's ui utils class
    14 * Description: video collection view plugin's ui utils class
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 39 %
    18 // Version : %version: 41 %
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include <hbapplication.h>
       
    22 #include <hbactivitymanager.h>
       
    23 #include <hbglobal.h>
    21 #include <hbglobal.h>
    24 #include <hblistview.h>
    22 #include <hblistview.h>
    25 #include <hbscrollbar.h>
    23 #include <hbscrollbar.h>
    26 #include <hblistviewitem.h>
    24 #include <hblistviewitem.h>
    27 #include <hbdialog.h>
    25 #include <hbdialog.h>
    30 #include <centralrepository.h>
    28 #include <centralrepository.h>
    31 
    29 
    32 #include "videocollectioncommon.h"
    30 #include "videocollectioncommon.h"
    33 #include "videocollectionviewutils.h"
    31 #include "videocollectionviewutils.h"
    34 #include "videosortfilterproxymodel.h"
    32 #include "videosortfilterproxymodel.h"
       
    33 #include "videoactivitystate.h"
    35 #include "videocollectiontrace.h"
    34 #include "videocollectiontrace.h"
    36 
    35 
    37 // Object names.
    36 // Object names.
    38 const char* const VIEW_UTILS_OBJECT_NAME_STATUS_MSG          = "vc:ViewUtilsStatusMessage";
    37 const char* const VIEW_UTILS_OBJECT_NAME_STATUS_MSG          = "vc:ViewUtilsStatusMessage";
    39 const char* const VIEW_UTILS_OBJECT_NAME_MESSAGE_BOX_WARNING = "vc:ViewUtilsMessageBoxWarning";
    38 const char* const VIEW_UTILS_OBJECT_NAME_MESSAGE_BOX_WARNING = "vc:ViewUtilsMessageBoxWarning";
    49 
    48 
    50 const int KAddToCollectionDataCount(2);
    49 const int KAddToCollectionDataCount(2);
    51 const int KAddToCollectionCountIndex(0);
    50 const int KAddToCollectionCountIndex(0);
    52 const int KAddToCollectionNameIndex(1);
    51 const int KAddToCollectionNameIndex(1);
    53 
    52 
    54 static const char* ACTIVITY_VIDEOS_MAINVIEW = "VideosMainView";
       
    55 
    53 
    56 // ---------------------------------------------------------------------------
    54 // ---------------------------------------------------------------------------
    57 // instance
    55 // instance
    58 // ---------------------------------------------------------------------------
    56 // ---------------------------------------------------------------------------
    59 //
    57 //
   318 // saveWidgetLevel
   316 // saveWidgetLevel
   319 // ---------------------------------------------------------------------------
   317 // ---------------------------------------------------------------------------
   320 //
   318 //
   321 void VideoCollectionViewUtils::saveWidgetLevel(VideoCollectionCommon::TCollectionLevels &level)
   319 void VideoCollectionViewUtils::saveWidgetLevel(VideoCollectionCommon::TCollectionLevels &level)
   322 {
   320 {
   323     FUNC_LOG;
   321     FUNC_LOG; 
   324     HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager();
   322     QVariant data = int(level);
   325     if(!activityManager)
   323     VideoActivityState::instance().setActivityData(data, VideoActivityData::KEY_WIDGET_LEVEL);
   326     {
       
   327         return;
       
   328     }
       
   329     // clean up any previous versions of this activity from the activity manager.
       
   330    activityManager->removeActivity(ACTIVITY_VIDEOS_MAINVIEW);
       
   331    
       
   332    QVariant data = int(level);
       
   333    
       
   334    activityManager->addActivity(ACTIVITY_VIDEOS_MAINVIEW, data, QVariantHash());
       
   335 
       
   336 
       
   337 }
   324 }
   338   
   325   
   339 // ---------------------------------------------------------------------------
   326 // ---------------------------------------------------------------------------
   340 // loadWidgetLevel
   327 // loadWidgetLevel
   341 // ---------------------------------------------------------------------------
   328 // ---------------------------------------------------------------------------
   344 {
   331 {
   345     FUNC_LOG;
   332     FUNC_LOG;
   346     // all videos view is the default value to be returned in case nothing can be read
   333     // all videos view is the default value to be returned in case nothing can be read
   347     // from the activity manager
   334     // from the activity manager
   348     VideoCollectionCommon::TCollectionLevels level(VideoCollectionCommon::ELevelVideos);
   335     VideoCollectionCommon::TCollectionLevels level(VideoCollectionCommon::ELevelVideos);
   349     
   336     QVariant data = VideoActivityState::instance().getActivityData(VideoActivityData::KEY_WIDGET_LEVEL);
   350     HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager();
       
   351     if(!activityManager)
       
   352     {
       
   353         return level;
       
   354     }
       
   355     QVariant data =activityManager->activityData(ACTIVITY_VIDEOS_MAINVIEW);
       
   356     if(data.toInt() == VideoCollectionCommon::ELevelCategory)
   337     if(data.toInt() == VideoCollectionCommon::ELevelCategory)
   357     {
   338     {
   358         level = VideoCollectionCommon::ELevelCategory;
   339         level = VideoCollectionCommon::ELevelCategory;
   359     }
   340     }
   360     return level;
   341     return level;