videocollection/videocollectionview/src/videolistwidget.cpp
changeset 36 8aed59de29f9
parent 35 3738fe97f027
child 37 4eb2df7f7cbe
equal deleted inserted replaced
35:3738fe97f027 36:8aed59de29f9
    13 *
    13 *
    14 * Description:   Videolist content widget implementation
    14 * Description:   Videolist content widget implementation
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 #include "videocollectiontrace.h"
    18 #include "videolistwidget.h"
    19 #include "videolistwidget.h"
    19 
    20 
    20 #include <qcoreapplication.h>
    21 #include <qcoreapplication.h>
    21 #include <qtimer.h>
    22 #include <qtimer.h>
    22 #include <hbscrollbar.h>
    23 #include <hbscrollbar.h>
    25 #include <hbaction.h>
    26 #include <hbaction.h>
    26 #include <hbinstance.h>
    27 #include <hbinstance.h>
    27 #include <hbmainwindow.h>
    28 #include <hbmainwindow.h>
    28 #include <hblistviewitem.h>
    29 #include <hblistviewitem.h>
    29 #include <hbmessagebox.h>
    30 #include <hbmessagebox.h>
       
    31 #include <hbinputdialog.h>
    30 #include <vcxmyvideosdefs.h>
    32 #include <vcxmyvideosdefs.h>
    31 
    33 
    32 #include "videocollectionviewutils.h"
    34 #include "videocollectionviewutils.h"
    33 #include "videocollectionuiloader.h"
    35 #include "videocollectionuiloader.h"
    34 #include "videolistselectiondialog.h"
    36 #include "videolistselectiondialog.h"
    50 mModel(0),
    52 mModel(0),
    51 mVideoServices(0),
    53 mVideoServices(0),
    52 mCurrentLevel(VideoCollectionCommon::ELevelInvalid),
    54 mCurrentLevel(VideoCollectionCommon::ELevelInvalid),
    53 mSignalsConnected(false),
    55 mSignalsConnected(false),
    54 mIsService(false),
    56 mIsService(false),
    55 mNavKeyBackAction(0),
    57 mNavKeyAction(0),
    56 mNavKeyQuitAction(0),
       
    57 mContextMenu(0),
    58 mContextMenu(0),
    58 mSelectionMode(HbAbstractItemView::NoSelection),
    59 mSelectionMode(HbAbstractItemView::NoSelection),
    59 mScrollPositionTimer(0),
    60 mScrollPositionTimer(0),
    60 mUiLoader(uiLoader)
    61 mUiLoader(uiLoader)
    61 {
    62 {
    62     // NOP
    63 	FUNC_LOG_ADDR(this);
    63 }
    64 }
    64 
    65 
    65 // ---------------------------------------------------------------------------
    66 // ---------------------------------------------------------------------------
    66 // Destructor
    67 // Destructor
    67 // ---------------------------------------------------------------------------
    68 // ---------------------------------------------------------------------------
    68 //
    69 //
    69 VideoListWidget::~VideoListWidget()
    70 VideoListWidget::~VideoListWidget()
    70 {
    71 {
       
    72 	FUNC_LOG_ADDR(this);
    71     delete mScrollPositionTimer;
    73     delete mScrollPositionTimer;
    72     mScrollPositionTimer = 0;
    74     mScrollPositionTimer = 0;
    73 	mContextMenuActions.clear();
    75 	mContextMenuActions.clear();
    74 	disconnect();
    76 	disconnect();
    75     delete mContextMenu;
    77     delete mContextMenu;
    76     mContextMenu = 0;
    78     mContextMenu = 0;
    77     delete mNavKeyBackAction;
    79     delete mNavKeyAction;
    78     mNavKeyBackAction = 0;
    80     mNavKeyAction = 0;
    79     delete mNavKeyQuitAction;
       
    80     mNavKeyQuitAction = 0;
       
    81 }
    81 }
    82 
    82 
    83 // ---------------------------------------------------------------------------
    83 // ---------------------------------------------------------------------------
    84 // initialize
    84 // initialize
    85 // ---------------------------------------------------------------------------
    85 // ---------------------------------------------------------------------------
    86 //
    86 //
    87 int VideoListWidget::initialize(VideoSortFilterProxyModel &model, VideoServices* videoServices)
    87 int VideoListWidget::initialize(VideoSortFilterProxyModel &model, VideoServices* videoServices)
    88 {
    88 {
       
    89 	FUNC_LOG_ADDR(this);
    89     mModel = &model;
    90     mModel = &model;
    90 
    91 
    91 	mVideoServices = videoServices;
    92 	mVideoServices = videoServices;
    92 
    93 
    93 	if(mVideoServices)
    94 	if(mVideoServices)
    96 	}
    97 	}
    97 
    98 
    98     // init list view
    99     // init list view
    99     VideoCollectionViewUtils::initListView(this);
   100     VideoCollectionViewUtils::initListView(this);
   100 
   101 
   101     // Navigation keys.
       
   102     mNavKeyBackAction = new HbAction(Hb::BackNaviAction);
       
   103 	
       
   104     mNavKeyQuitAction = new HbAction(Hb::QuitNaviAction);
       
   105 
       
   106 	mScrollPositionTimer = new QTimer();
   102 	mScrollPositionTimer = new QTimer();
   107 	mScrollPositionTimer->setSingleShot(true);
   103 	mScrollPositionTimer->setSingleShot(true);
   108 
   104 
   109 	if (mIsService)
   105 	if (mIsService)
   110 	{
   106 	{
   120 // activate
   116 // activate
   121 // ---------------------------------------------------------------------------
   117 // ---------------------------------------------------------------------------
   122 //
   118 //
   123 int VideoListWidget::activate()
   119 int VideoListWidget::activate()
   124 {
   120 {
       
   121 	FUNC_LOG_ADDR(this);
   125     return activate(mCurrentLevel);
   122     return activate(mCurrentLevel);
   126 }
   123 }
   127 
   124 
   128 // ---------------------------------------------------------------------------
   125 // ---------------------------------------------------------------------------
   129 // activate
   126 // activate
   130 // ---------------------------------------------------------------------------
   127 // ---------------------------------------------------------------------------
   131 //
   128 //
   132 int VideoListWidget::activate(VideoCollectionCommon::TCollectionLevels level)
   129 int VideoListWidget::activate(VideoCollectionCommon::TCollectionLevels level)
   133 {
   130 {
       
   131 	FUNC_LOG_ADDR(this);
       
   132 	INFO_2("VideoListWidget::activate() [0x%x]: level: %d", this, level);
       
   133 	
   134     if(!mModel)
   134     if(!mModel)
   135     {
   135     {
   136         return -1;
   136         return -1;
   137     }
   137     }
   138     
   138     
   139 	mCurrentLevel = level;
   139 	mCurrentLevel = level;
   140     setVisible(true);
   140     setVisible(true);
   141 
   141 
   142     if ( connectSignals() < 0)
   142     setNavigationAction();
   143     {
   143 
       
   144     if (connectSignals() < 0)
       
   145     {
       
   146         ERROR_1(-1, "VideoListWidget::activate() [0x%x]: connecting signals failed.", this);
   144         return -1;
   147         return -1;
   145     }
   148     }
   146 
   149 
   147     HbView *currentView = hbInstance->allMainWindows().value(0)->currentView();
       
   148 
       
   149     // Set navigation key only when widget is not in selection mode.
       
   150     if(currentView && mSelectionMode == HbAbstractItemView::NoSelection)
       
   151     {
       
   152         if(level != VideoCollectionCommon::ELevelDefaultColl && 
       
   153            level != VideoCollectionCommon::ELevelAlbum)
       
   154         {
       
   155             if(mNavKeyQuitAction)
       
   156             {
       
   157                 currentView->setNavigationAction(mNavKeyQuitAction);
       
   158             }
       
   159         }
       
   160         else if(mNavKeyBackAction)
       
   161         {
       
   162             currentView->setNavigationAction(mNavKeyBackAction);
       
   163         }
       
   164     }
       
   165     // open model to the current level in case not in album or category
   150     // open model to the current level in case not in album or category
   166     if(level != VideoCollectionCommon::ELevelAlbum &&
   151     if (level != VideoCollectionCommon::ELevelAlbum &&
   167         level != VideoCollectionCommon::ELevelDefaultColl)
   152         level != VideoCollectionCommon::ELevelDefaultColl)
   168     {
   153     {
   169          mModel->open(level);
   154          mModel->open(level);
   170     }
   155     }
   171     
   156     
   181 // deactivate
   166 // deactivate
   182 // ---------------------------------------------------------------------------
   167 // ---------------------------------------------------------------------------
   183 //
   168 //
   184 void VideoListWidget::deactivate()
   169 void VideoListWidget::deactivate()
   185 {
   170 {
       
   171 	FUNC_LOG_ADDR(this);
   186     if(mContextMenu) 
   172     if(mContextMenu) 
   187     {
   173     {
   188         mContextMenu->hide();
   174         mContextMenu->hide();
   189     }
   175     }
   190 
   176 
   191     setVisible(false);
   177     setVisible(false);
   192     disConnectSignals();
   178     disConnectSignals();
   193     
   179 
   194     // Free allocated memory for list thumbnails and disable background fetching.
   180     // Free allocated memory for list thumbnails and disable background fetching.
   195     VideoThumbnailData &thumbnailData = VideoThumbnailData::instance();
   181     VideoThumbnailData &thumbnailData = VideoThumbnailData::instance();
   196     thumbnailData.enableBackgroundFetching(false);
   182     thumbnailData.enableBackgroundFetching(false);
   197     thumbnailData.freeThumbnailData();
   183     thumbnailData.freeThumbnailData();
   198 }
   184 }
   201 // getLevel
   187 // getLevel
   202 // ---------------------------------------------------------------------------
   188 // ---------------------------------------------------------------------------
   203 //
   189 //
   204 VideoCollectionCommon::TCollectionLevels VideoListWidget::getLevel()
   190 VideoCollectionCommon::TCollectionLevels VideoListWidget::getLevel()
   205 {
   191 {
       
   192 	FUNC_LOG_ADDR(this);
   206     return mCurrentLevel;
   193     return mCurrentLevel;
   207 }
   194 }
   208 
   195 
   209 // ---------------------------------------------------------------------------
   196 // ---------------------------------------------------------------------------
   210 // connectSignals
   197 // connectSignals
   211 // ---------------------------------------------------------------------------
   198 // ---------------------------------------------------------------------------
   212 //
   199 //
   213 int VideoListWidget::connectSignals()
   200 int VideoListWidget::connectSignals()
   214 {
   201 {
       
   202 	FUNC_LOG_ADDR(this);
       
   203 	
       
   204 	int retval(0);
       
   205 	
   215     if (!mSignalsConnected)
   206     if (!mSignalsConnected)
   216     {
   207     {
   217         if(!connect(this, SIGNAL(scrollingStarted()), this, SLOT(scrollingStartedSlot())) ||
   208         if(!connect(this, SIGNAL(scrollingStarted()), this, SLOT(scrollingStartedSlot())) ||
   218            !connect(this, SIGNAL(scrollingEnded()), this, SLOT(scrollingEndedSlot())) ||
   209            !connect(this, SIGNAL(scrollingEnded()), this, SLOT(scrollingEndedSlot())) ||
   219            !connect(this, SIGNAL(scrollPositionChanged(const QPointF &)), 
   210            !connect(this, SIGNAL(scrollPositionChanged(const QPointF &)), 
   220                    this, SLOT(scrollPositionChangedSlot(const QPointF &))) ||
   211                    this, SLOT(scrollPositionChangedSlot(const QPointF &))) ||
   221            !connect(mScrollPositionTimer, SIGNAL(timeout()), this, SLOT(scrollPositionTimerSlot())) || 
   212            !connect(mScrollPositionTimer, SIGNAL(timeout()), this, SLOT(scrollPositionTimerSlot())) || 
   222            !connect(mNavKeyBackAction, SIGNAL(triggered()), this, SLOT(back())) ||
   213            !connect(this, SIGNAL(longPressed(HbAbstractViewItem *, const QPointF &)), 
   223            !connect(mNavKeyQuitAction, SIGNAL(triggered()), qApp, SLOT(quit()))) 
   214                     this, SLOT(longPressedSlot(HbAbstractViewItem *, const QPointF &))))
   224         {
   215         {
   225             return -1;
   216             return -1;
   226         }
   217         }
       
   218 
       
   219         if (!isBrowsingService())
       
   220         {
       
   221 	        if(VideoCollectionCommon::EModelTypeCollectionContent == mModel->getType())
       
   222 	        {
       
   223 	            if (!connect(mNavKeyAction, SIGNAL(triggered()), this, SLOT(back())))
       
   224 				{
       
   225 					retval = -1;
       
   226 				}
       
   227 	        }
       
   228 	        else
       
   229 	        {
       
   230 	            if (!connect(mNavKeyAction, SIGNAL(triggered()), qApp, SLOT(quit())))
       
   231 				{
       
   232 					retval = -1;
       
   233 				}
       
   234 	        }
       
   235         }
       
   236         
   227         mSignalsConnected = true;
   237         mSignalsConnected = true;
   228     }
   238     }
   229 	return 0;
   239 	return retval;
   230 }
   240 }
   231 
   241 
   232 // ---------------------------------------------------------------------------
   242 // ---------------------------------------------------------------------------
   233 // disConnectSignals
   243 // disConnectSignals
   234 // ---------------------------------------------------------------------------
   244 // ---------------------------------------------------------------------------
   235 //
   245 //
   236 void VideoListWidget::disConnectSignals()
   246 void VideoListWidget::disConnectSignals()
   237 {
   247 {
   238     disconnect(this, SIGNAL(scrollingStarted()), this, SLOT(scrollingStartedSlot()));
   248     FUNC_LOG_ADDR(this);
   239     disconnect(this, SIGNAL(scrollingEnded()), this, SLOT(scrollingEndedSlot()));
   249     
   240     disconnect(this, SIGNAL(scrollPositionChanged(const QPointF&)), 
   250     // safe to disconnect these always
   241                this, SLOT(scrollPositionChangedSlot(const QPointF&)));
   251     disconnect(
   242     disconnect(mScrollPositionTimer, SIGNAL(timeout()), this, SLOT(scrollPositionTimerSlot()));
   252         this, SIGNAL(scrollingStarted()),
   243     disconnect(mNavKeyBackAction, SIGNAL(triggered()), this, SLOT(back()));
   253         this, SLOT(scrollingStartedSlot()));
   244     disconnect(mNavKeyQuitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
   254     disconnect(
       
   255         this, SIGNAL(scrollingEnded()),
       
   256         this, SLOT(scrollingEndedSlot()));
       
   257     disconnect(
       
   258         this, SIGNAL(scrollPositionChanged(const QPointF&)), 
       
   259         this, SLOT(scrollPositionChangedSlot(const QPointF&)));
       
   260     disconnect(this, SIGNAL(longPressed(HbAbstractViewItem *, const QPointF &)), 
       
   261              this, SLOT(longPressedSlot(HbAbstractViewItem *, const QPointF &)));
       
   262     
       
   263     // check that scroll position timer is created
       
   264     if (mScrollPositionTimer)
       
   265     {
       
   266         disconnect(
       
   267             mScrollPositionTimer, SIGNAL(timeout()),
       
   268             this, SLOT(scrollPositionTimerSlot()));
       
   269     }
       
   270     
       
   271     // check that model and navigation action exists
       
   272     if (!isBrowsingService())
       
   273     {
       
   274 	    if (mModel &&
       
   275 	        mModel->getType() == VideoCollectionCommon::EModelTypeCollectionContent)
       
   276 	    {
       
   277 	        if (mNavKeyAction)
       
   278 	        {
       
   279 	            disconnect(
       
   280 	                mNavKeyAction, SIGNAL(triggered()),
       
   281 	                this, SLOT(back()));
       
   282 	        }
       
   283 	    }
       
   284 	    else
       
   285 	    {
       
   286 	        if (mNavKeyAction)
       
   287 	        {
       
   288 	            disconnect(
       
   289 	                mNavKeyAction, SIGNAL(triggered()),
       
   290 	                qApp, SLOT(quit()));
       
   291 	        }
       
   292 	    }
       
   293     }
   245 
   294 
   246 	mSignalsConnected = false;
   295 	mSignalsConnected = false;
   247 }
   296 }
   248 
   297 
   249 // ---------------------------------------------------------------------------
   298 // ---------------------------------------------------------------------------
       
   299 // isBrowsingService
       
   300 // ---------------------------------------------------------------------------
       
   301 //
       
   302 bool VideoListWidget::isBrowsingService() const
       
   303 {
       
   304     FUNC_LOG_ADDR(this);
       
   305     
       
   306     bool isBrowsingService = false;
       
   307     
       
   308     if (mIsService &&
       
   309         mVideoServices &&
       
   310         mVideoServices->currentService() == VideoServices::EBrowse)
       
   311     {
       
   312         isBrowsingService = true;
       
   313     }
       
   314     
       
   315     return isBrowsingService;
       
   316 
       
   317 }
       
   318 
       
   319 // ---------------------------------------------------------------------------
       
   320 // setNavigationAction
       
   321 // ---------------------------------------------------------------------------
       
   322 //
       
   323 void VideoListWidget::setNavigationAction()
       
   324 {
       
   325     FUNC_LOG_ADDR(this);
       
   326     
       
   327     // Create navigation action if not already created
       
   328     if (!mNavKeyAction)
       
   329     {
       
   330         if (isBrowsingService())
       
   331         {
       
   332             mNavKeyAction = new HbAction(Hb::QuitNaviAction);
       
   333             if (mNavKeyAction)
       
   334             {
       
   335                 connect(
       
   336                     mNavKeyAction, SIGNAL(triggered()),
       
   337                     mVideoServices, SLOT(browsingEnded()));
       
   338             }
       
   339         }
       
   340         else if (mModel)
       
   341         {
       
   342             if (VideoCollectionCommon::EModelTypeCollectionContent == mModel->getType())
       
   343             {
       
   344                 mNavKeyAction = new HbAction(Hb::BackNaviAction);
       
   345             }
       
   346             else
       
   347             {
       
   348                 mNavKeyAction = new HbAction(Hb::QuitNaviAction);
       
   349             }
       
   350         }
       
   351     }
       
   352         
       
   353     // Set navigation action only when widget is not in selection mode
       
   354     if (mSelectionMode == HbAbstractItemView::NoSelection)
       
   355     {
       
   356         HbView *currentView = hbInstance->allMainWindows().value(0)->currentView();
       
   357         if (currentView)
       
   358         {
       
   359             currentView->setNavigationAction(mNavKeyAction);
       
   360         }
       
   361     }
       
   362 }
       
   363 
       
   364 // ---------------------------------------------------------------------------
   250 // deleteItemSlot
   365 // deleteItemSlot
   251 // ---------------------------------------------------------------------------
   366 // ---------------------------------------------------------------------------
   252 //
   367 //
   253 void VideoListWidget::deleteItemSlot()
   368 void VideoListWidget::deleteItemSlot()
   254 {
   369 {
       
   370 	FUNC_LOG_ADDR(this);
   255     if(!mModel)
   371     if(!mModel)
   256     {
   372     {
   257         return;
   373         return;
   258     }
   374     }
   259     
   375     
   260     QVariant variant;
   376     QVariant variant;
   261     QModelIndex index = currentIndex();
   377     QModelIndex index = currentIndex();
   262     variant = mModel->data(index, Qt::DisplayRole);
   378     variant = mModel->data(index, VideoCollectionCommon::KeyTitle);
   263 
   379 
   264     if (variant.isValid())
   380     if (variant.isValid())
   265     {
   381     {
   266         QString text = hbTrId("txt_videos_info_do_you_want_to_delete_1").arg(
   382         QString text = hbTrId("txt_videos_info_do_you_want_to_delete_1").arg(
   267                 variant.toStringList().first());
   383                 variant.toString());
   268         if(HbMessageBox::question(text))
   384         if(HbMessageBox::question(text))
   269         {
   385         {
   270             QModelIndexList list;
   386             QModelIndexList list;
   271             list.append(index);
   387             list.append(index);
   272             mModel->deleteItems(list);
   388             mModel->deleteItems(list);
   278 // createContextMenu
   394 // createContextMenu
   279 // ---------------------------------------------------------------------------
   395 // ---------------------------------------------------------------------------
   280 //
   396 //
   281 void VideoListWidget::createContextMenu()
   397 void VideoListWidget::createContextMenu()
   282 {
   398 {
       
   399 	FUNC_LOG_ADDR(this);
   283     if(mContextMenu)
   400     if(mContextMenu)
   284     {
   401     {
   285         return;
   402         return;
   286     }
   403     }
   287     
   404     
   288     mContextMenu = new HbMenu();
   405     mContextMenu = new HbMenu();
   289     if (mContextMenu)
   406     if (mContextMenu)
   290     {
   407     {
   291         mContextMenu->setDismissPolicy(HbPopup::TapAnywhere);
   408         mContextMenu->setDismissPolicy(HbPopup::TapAnywhere);
   292         if (mIsService)
   409         
       
   410         VideoServices::TVideoService service = VideoServices::ENoService;
       
   411         if (mIsService &&
       
   412             mVideoServices)
       
   413         {
       
   414             service = mVideoServices->currentService();
       
   415         }
       
   416         
       
   417         if (service == VideoServices::EUriFetcher)
   293         {
   418         {
   294             mContextMenuActions[EActionPlay]    = 
   419             mContextMenuActions[EActionPlay]    = 
   295                     mContextMenu->addAction(hbTrId("txt_videos_menu_play"), this, SLOT(playItemSlot())); 
   420                     mContextMenu->addAction(hbTrId("txt_videos_menu_play"), this, SLOT(openItemSlot())); 
   296             mContextMenuActions[EActionDetails] = 
   421             mContextMenuActions[EActionDetails] = 
   297                     mContextMenu->addAction(hbTrId("txt_common_menu_details"), this, SLOT(openDetailsSlot()));
   422                     mContextMenu->addAction(hbTrId("txt_common_menu_details"), this, SLOT(openDetailsSlot()));
   298         }
   423         }
       
   424         else if (service == VideoServices::EBrowse)
       
   425         {
       
   426             mContextMenuActions[EActionPlay]    = 
       
   427                     mContextMenu->addAction(hbTrId("txt_videos_menu_play"), this, SLOT(openItemSlot())); 
       
   428             mContextMenuActions[EActionDelete]           = 
       
   429                     mContextMenu->addAction(hbTrId("txt_common_menu_delete"), this, SLOT(deleteItemSlot()));
       
   430             mContextMenuActions[EActionDetails] = 
       
   431                     mContextMenu->addAction(hbTrId("txt_common_menu_details"), this, SLOT(openDetailsSlot()));
       
   432         }
   299         else
   433         else
   300         {
   434         {
       
   435             mContextMenuActions[EActionPlay]    = 
       
   436                     mContextMenu->addAction(hbTrId("txt_videos_menu_play"), this, SLOT(openItemSlot())); 
       
   437             mContextMenuActions[EActionOpen]    = 
       
   438                                 mContextMenu->addAction(hbTrId("txt_common_menu_open"), this, SLOT(openItemSlot()));  
   301             mContextMenuActions[EActionAddToCollection] = 
   439             mContextMenuActions[EActionAddToCollection] = 
   302                     mContextMenu->addAction(hbTrId("txt_videos_menu_add_to_collection"), this, SLOT(addToCollectionSlot()));
   440                     mContextMenu->addAction(hbTrId("txt_videos_menu_add_to_collection"), this, SLOT(addToCollectionSlot()));
   303             mContextMenuActions[EActionRemove]           = 
   441             mContextMenuActions[EActionRemove]           = 
   304                     mContextMenu->addAction(hbTrId("txt_videos_menu_remove_from_collection"), this, SLOT(removeFromCollectionSlot()));
   442                     mContextMenu->addAction(hbTrId("txt_videos_menu_remove_from_collection"), this, SLOT(removeFromCollectionSlot()));
   305             mContextMenuActions[EActionRename]           = 
   443             mContextMenuActions[EActionRename]           = 
   318 // setContextMenu
   456 // setContextMenu
   319 // -------------------------------------------------------------------------------------------------
   457 // -------------------------------------------------------------------------------------------------
   320 //
   458 //
   321 void VideoListWidget::setContextMenu()
   459 void VideoListWidget::setContextMenu()
   322 {
   460 {
       
   461 	FUNC_LOG_ADDR(this);
   323     if(!mContextMenu)
   462     if(!mContextMenu)
   324     {
   463     {
   325         createContextMenu();
   464         createContextMenu();
   326     }
   465     }
   327     
   466     
   328     if (!mContextMenu)
   467     if (!mContextMenu)
   329     {
   468     {
   330         // failed to create context menu, return
   469         ERROR_1(-1, "VideoListWidget::setContextMenu() [0x%x]: failed to create context menu.", this);
   331         return;
   470         return;
   332     }
   471     }
   333     
   472     
   334 	int menuActionCount = 0;
   473 	int menuActionCount = 0;
   335     HbAction *action = 0;
   474     HbAction *action = 0;
   341 			action->setVisible(false);
   480 			action->setVisible(false);
   342         }
   481         }
   343     }
   482     }
   344     if(menuActionCount != mContextMenuActions.values().count() || mContextMenuActions.values().count() == 0)
   483     if(menuActionCount != mContextMenuActions.values().count() || mContextMenuActions.values().count() == 0)
   345     {
   484     {
   346     	// fatal error, some action(s) was not created before.
   485         ERROR_1(-1, "VideoListWidget::setContextMenu() [0x%x]: all actions have not been created.", this);
   347         delete mContextMenu;
   486         delete mContextMenu;
   348         mContextMenu = 0;
   487         mContextMenu = 0;
   349         mContextMenuActions.clear();
   488         mContextMenuActions.clear();
   350     	return;
   489     	return;
   351     }
   490     }
   352 
   491 
   353     HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
   492     if (isBrowsingService())
       
   493     {
       
   494         setBrowsingServiceContextMenu();
       
   495         return;
       
   496     }
       
   497     
   354 
   498 
   355     if(mCurrentLevel == VideoCollectionCommon::ELevelVideos ||
   499     if(mCurrentLevel == VideoCollectionCommon::ELevelVideos ||
   356        mCurrentLevel == VideoCollectionCommon::ELevelDefaultColl)
   500        mCurrentLevel == VideoCollectionCommon::ELevelDefaultColl)
   357     {
   501     {        
   358     	if (!mIsService)
   502     	if (!mIsService)
   359     	{
   503     	{
   360 			mContextMenuActions[EActionAddToCollection]->setVisible(true);
   504 			mContextMenuActions[EActionAddToCollection]->setVisible(true);
   361     		mContextMenuActions[EActionDelete]->setVisible(true);
   505     		mContextMenuActions[EActionDelete]->setVisible(true);
   362     	}
   506     	}
   363     	else
   507     	mContextMenuActions[EActionPlay]->setVisible(true);
   364     	{
       
   365     		mContextMenuActions[EActionPlay]->setVisible(true);
       
   366     	}
       
   367 		mContextMenuActions[EActionDetails]->setVisible(true);
   508 		mContextMenuActions[EActionDetails]->setVisible(true);
   368     }
   509     }
   369     else if(mCurrentLevel == VideoCollectionCommon::ELevelCategory) 
   510     else if(mCurrentLevel == VideoCollectionCommon::ELevelCategory) 
   370     {
   511     {
   371 		if(!mIsService)
   512         mContextMenuActions[EActionOpen]->setVisible(true);
       
   513         TMPXItemId mpxId = mModel->getMediaIdAtIndex(currentIndex());
       
   514 		if(!mIsService && mpxId.iId2 == KVcxMvcMediaTypeAlbum)
   372 		{
   515 		{
   373             mContextMenuActions[EActionRename]->setVisible(true);
   516             mContextMenuActions[EActionRename]->setVisible(true);
   374             mContextMenuActions[EActionRemoveCollection]->setVisible(true);
   517             mContextMenuActions[EActionRemoveCollection]->setVisible(true);
   375 		}
   518 		}
   376     }
   519     }
   379     	if (!mIsService)
   522     	if (!mIsService)
   380     	{
   523     	{
   381 			mContextMenuActions[EActionRemove]->setVisible(true);
   524 			mContextMenuActions[EActionRemove]->setVisible(true);
   382             mContextMenuActions[EActionDelete]->setVisible(true);
   525             mContextMenuActions[EActionDelete]->setVisible(true);
   383     	}
   526     	}
   384     	else
   527     	mContextMenuActions[EActionPlay]->setVisible(true);
   385     	{
       
   386     		mContextMenuActions[EActionPlay]->setVisible(true);
       
   387     	}
       
   388 		mContextMenuActions[EActionDetails]->setVisible(true);
   528 		mContextMenuActions[EActionDetails]->setVisible(true);
   389     }
   529     }
   390 }
   530 }
   391 
   531 
       
   532 // ---------------------------------------------------------------------------
       
   533 // setBrowsingServiceContextMenu
       
   534 // ---------------------------------------------------------------------------
       
   535 //
       
   536 void VideoListWidget::setBrowsingServiceContextMenu()
       
   537 {
       
   538     FUNC_LOG_ADDR(this);
       
   539     mContextMenuActions[EActionPlay]->setVisible(true);
       
   540     mContextMenuActions[EActionDelete]->setVisible(true);
       
   541     mContextMenuActions[EActionDetails]->setVisible(true);
       
   542 }
   392 
   543 
   393 // ---------------------------------------------------------------------------
   544 // ---------------------------------------------------------------------------
   394 // getModel
   545 // getModel
   395 // ---------------------------------------------------------------------------
   546 // ---------------------------------------------------------------------------
   396 //
   547 //
   397 VideoSortFilterProxyModel& VideoListWidget::getModel()
   548 VideoSortFilterProxyModel& VideoListWidget::getModel()
   398 { 
   549 { 
       
   550 	FUNC_LOG_ADDR(this);
   399     return *mModel; 
   551     return *mModel; 
   400 }
   552 }
   401 
   553 
   402 // ---------------------------------------------------------------------------
   554 // ---------------------------------------------------------------------------
   403 // emitActivated
   555 // emitActivated
   404 // This slot is called by the fw when viewitem is activated
   556 // This slot is called by the fw when viewitem is activated
   405 // ---------------------------------------------------------------------------
   557 // ---------------------------------------------------------------------------
   406 //
   558 //
   407 void VideoListWidget::emitActivated (const QModelIndex &modelIndex)
   559 void VideoListWidget::emitActivated (const QModelIndex &modelIndex)
   408 {
   560 {
   409     // surprisingly interenting feature: after long press also single press
   561 	FUNC_LOG_ADDR(this);
       
   562     // surprisingly interesting feature: after long press also single press
   410     // is executed. as a workaround the following hack check is needed.
   563     // is executed. as a workaround the following hack check is needed.
   411     // otherwise after the context menu is shown also single press action
   564     // otherwise after the context menu is shown also single press action
   412     // is executed.
   565     // is executed.
   413     if (mContextMenu &&
   566     if (mContextMenu &&
   414         mContextMenu->isVisible())
   567         mContextMenu->isVisible())
   415     {
   568     {
   416         // do not activate context menu if it is already visible
   569         // do not activate context menu if it is already visible
   417         return;
   570         return;
   418     }
   571     }
   419     
       
   420     if(mSelectionMode != HbAbstractItemView::NoSelection)
   572     if(mSelectionMode != HbAbstractItemView::NoSelection)
   421     {
   573     {
   422         // no custom functionality defined
   574         // no custom functionality defined
   423         emit activated(modelIndex);
   575         emit activated(modelIndex);
   424         return;
   576         return;
   425     }
   577     }
   426 
   578     if(mIsService &&
   427     if (!mModel || !modelIndex.isValid())
   579        mVideoServices &&
       
   580        mVideoServices->currentService() == VideoServices::EUriFetcher &&
       
   581        mCurrentLevel != VideoCollectionCommon::ELevelCategory)
       
   582     {
       
   583         QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath);
       
   584         if ( variant.isValid()  )
       
   585         {
       
   586             QString itemPath = variant.value<QString>();
       
   587             emit(fileUri(itemPath));
       
   588         }
       
   589     }
       
   590     else
       
   591     {
       
   592         doActivateItem(modelIndex);
       
   593     }
       
   594 }
       
   595 
       
   596 // ---------------------------------------------------------------------------
       
   597 // doActivateItem
       
   598 // ---------------------------------------------------------------------------
       
   599 //
       
   600 void VideoListWidget::doActivateItem(const QModelIndex &index)
       
   601 {
       
   602     FUNC_LOG_ADDR(this);
       
   603     if (!mModel || !index.isValid())
   428     {
   604     {
   429         return;
   605         return;
   430     }
   606     }
   431     
   607     
   432     if (mCurrentLevel == VideoCollectionCommon::ELevelCategory)
   608     if (mCurrentLevel == VideoCollectionCommon::ELevelCategory)
   433     {
   609     {
   434         QVariant variant = mModel->data(modelIndex, Qt::DisplayRole);
   610         QVariant variant = mModel->data(index, VideoCollectionCommon::KeyTitle);
   435         if (variant.isValid())
   611         if (variant.isValid())
   436         {
   612         {
   437             // signal view that item has been activated
   613             // signal view that item has been activated
   438             emit(collectionOpened(true,
   614             emit(collectionOpened(true,
   439                 variant.toStringList().first(),
   615                 variant.toString(),
   440                 modelIndex));                       
   616                 index));                       
   441         }
   617         }
   442         return;
   618         return;
   443     }
       
   444     if(mIsService && (mCurrentLevel != VideoCollectionCommon::ELevelCategory))
       
   445     {
       
   446     	QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath);
       
   447 		if ( variant.isValid()  )
       
   448 		{
       
   449 			QString itemPath = variant.value<QString>();
       
   450 			emit(fileUri(itemPath));
       
   451 		}
       
   452     }
   619     }
   453     else
   620     else
   454     {
   621     {
   455     	mModel->openItem(mModel->getMediaIdAtIndex(modelIndex));
   622     	mModel->openItem(mModel->getMediaIdAtIndex(index));
   456     }
   623     }
   457 }
   624 }
   458 
   625 
   459 // ---------------------------------------------------------------------------
   626 // ---------------------------------------------------------------------------
   460 // setSelectionMode
   627 // setSelectionMode
   461 // called by the fw when user long presses some item
   628 // called by the fw when user long presses some item
   462 // ---------------------------------------------------------------------------
   629 // ---------------------------------------------------------------------------
   463 //
   630 //
   464 //
       
   465 void VideoListWidget::setSelectionMode(int mode)
   631 void VideoListWidget::setSelectionMode(int mode)
   466 {
   632 {
       
   633 	FUNC_LOG_ADDR(this);
   467     HbAbstractItemView::SelectionMode selMode = HbAbstractItemView::NoSelection;
   634     HbAbstractItemView::SelectionMode selMode = HbAbstractItemView::NoSelection;
   468     if(mode >= HbAbstractItemView::NoSelection && mode <= HbAbstractItemView::ContiguousSelection)
   635     if(mode >= HbAbstractItemView::NoSelection && mode <= HbAbstractItemView::ContiguousSelection)
   469     {
   636     {
   470         selMode = HbAbstractItemView::SelectionMode(mode);
   637         selMode = HbAbstractItemView::SelectionMode(mode);
   471     }
   638     }
   473     HbListView::setSelectionMode(selMode);
   640     HbListView::setSelectionMode(selMode);
   474     mSelectionMode = mode;
   641     mSelectionMode = mode;
   475 }
   642 }
   476 
   643 
   477 // ---------------------------------------------------------------------------
   644 // ---------------------------------------------------------------------------
   478 // longPressGesture
   645 // longPressedSlot
   479 // called by the fw when user long presses some item
   646 // called by the fw when user long presses some item
   480 // ---------------------------------------------------------------------------
   647 // ---------------------------------------------------------------------------
   481 //
   648 //
   482 //
   649 void VideoListWidget::longPressedSlot(HbAbstractViewItem *item, const QPointF &point)
   483 void VideoListWidget::longPressGesture (const QPointF &point)
   650 {
   484 {
   651     FUNC_LOG_ADDR(this);
   485     if(mSelectionMode != HbAbstractItemView::NoSelection)
   652     if(mSelectionMode != HbAbstractItemView::NoSelection)
   486     {
   653     {
   487         // do not activate context menu during selection mode
   654         // do not activate context menu during selection mode
   488         return;
   655         return;
   489     }
   656     }
   490 
   657 
   491     HbAbstractViewItem *viewItem = itemAtPosition(point);
   658     if(item)
   492     if (viewItem)
   659     {
   493     {
   660         QModelIndex index = item->modelIndex();
   494         QModelIndex index = viewItem->modelIndex();
       
   495         if(mModel && index.isValid())
   661         if(mModel && index.isValid())
   496         {   
   662         {
   497             TMPXItemId mpxId = mModel->getMediaIdAtIndex(index);
   663             setContextMenu();
   498             // Only videos and user created albums have context menu.
   664             // if menu not yet exists, it has been created
   499             if((mpxId.iId2 == KVcxMvcMediaTypeVideo) ||
   665             // setup might fail causing menu to be removed
   500                (!mIsService && mpxId.iId2 == KVcxMvcMediaTypeAlbum ))
   666             if(mContextMenu)
   501             {
   667             {
   502                 setContextMenu();
   668                 mContextMenu->setPreferredPos(point);
   503                 // if menu not yet exists, it has been created
   669                 mContextMenu->show();
   504                 // setup might fail causing menu to be removed
       
   505                 if(mContextMenu)
       
   506                 {
       
   507                     mContextMenu->setPreferredPos(point);
       
   508                     mContextMenu->show();
       
   509                 }
       
   510             }
   670             }
   511         }
   671         }
   512     }
   672     }
   513 	HbListView::longPressGesture(point);
   673 }
       
   674 
       
   675 // ---------------------------------------------------------------------------
       
   676 // panGesture
       
   677 // ---------------------------------------------------------------------------
       
   678 //
       
   679 void VideoListWidget::panGesture(const QPointF &point)
       
   680 {
       
   681 	FUNC_LOG_ADDR(this);
       
   682     if (mContextMenu)
       
   683     {
       
   684         if (!mContextMenu->isVisible())
       
   685         {
       
   686             HbListView::panGesture(point);
       
   687         }
       
   688     }
       
   689     else
       
   690     {
       
   691         HbListView::panGesture(point);
       
   692     }
   514 }
   693 }
   515 
   694 
   516 // ---------------------------------------------------------------------------
   695 // ---------------------------------------------------------------------------
   517 // doDelayedsSlot
   696 // doDelayedsSlot
   518 // ---------------------------------------------------------------------------
   697 // ---------------------------------------------------------------------------
   519 //
   698 //
   520 void VideoListWidget::doDelayedsSlot()
   699 void VideoListWidget::doDelayedsSlot()
   521 {
   700 {
       
   701 	FUNC_LOG_ADDR(this);
   522 	if (!mContextMenu)
   702 	if (!mContextMenu)
   523 	{
   703 	{
   524 		createContextMenu();
   704 		createContextMenu();
   525 	}
   705 	}
   526 }
   706 }
   527 
   707 
   528 // ---------------------------------------------------------------------------
   708 // ---------------------------------------------------------------------------
   529 // playItemSlot
   709 // playItemSlot
   530 // ---------------------------------------------------------------------------
   710 // ---------------------------------------------------------------------------
   531 //
   711 //
   532 void VideoListWidget::playItemSlot()
   712 void VideoListWidget::openItemSlot()
   533 {
   713 {
   534     mModel->openItem(mModel->getMediaIdAtIndex(currentIndex()));
   714     FUNC_LOG_ADDR(this);
       
   715     doActivateItem(currentIndex());
   535 }
   716 }
   536 
   717 
   537 // ---------------------------------------------------------------------------
   718 // ---------------------------------------------------------------------------
   538 // openDetailsSlot
   719 // openDetailsSlot
   539 // ---------------------------------------------------------------------------
   720 // ---------------------------------------------------------------------------
   540 //
   721 //
   541 void VideoListWidget::openDetailsSlot()
   722 void VideoListWidget::openDetailsSlot()
   542 {   
   723 {   
       
   724 	FUNC_LOG_ADDR(this);
   543     if(mModel && mModel->fetchItemDetails(currentIndex()) == 0 ) 
   725     if(mModel && mModel->fetchItemDetails(currentIndex()) == 0 ) 
   544     {
   726     {
   545         emit command(MpxHbVideoCommon::ActivateVideoDetailsView);
   727         emit command(MpxHbVideoCommon::ActivateVideoDetailsView);
   546     }
   728     }
   547 }
   729 }
   550 // renameSlot
   732 // renameSlot
   551 // ---------------------------------------------------------------------------
   733 // ---------------------------------------------------------------------------
   552 //
   734 //
   553 void VideoListWidget::renameSlot()
   735 void VideoListWidget::renameSlot()
   554 {
   736 {
   555 	debugNotImplementedYet();
   737 	FUNC_LOG_ADDR(this);
       
   738     if(!mModel)
       
   739     {
       
   740         return;
       
   741     }
       
   742     
       
   743     QModelIndex index = currentIndex();
       
   744     QVariant variant = mModel->data(index, VideoCollectionCommon::KeyTitle);
       
   745     TMPXItemId itemId = mModel->getMediaIdAtIndex(index);
       
   746 
       
   747     if(variant.isValid() && itemId.iId2 == KVcxMvcMediaTypeAlbum)
       
   748     {
       
   749         bool ok = false;
       
   750         QString label(hbTrId("txt_videos_title_enter_name"));
       
   751         QString albumName = variant.toString();
       
   752         QString newAlbumName;
       
   753 
       
   754         // Query a name for the collection
       
   755         newAlbumName = HbInputDialog::getText(label, albumName, &ok);
       
   756         // Rename only when name has changed. 
       
   757         if(ok && newAlbumName.length() && newAlbumName.trimmed() != albumName)
       
   758         {
       
   759             // Resolve collection true name and rename the album
       
   760             newAlbumName = mModel->resolveAlbumName(newAlbumName);
       
   761             mModel->renameAlbum(itemId, newAlbumName);
       
   762         }
       
   763     }
   556 }
   764 }
   557 
   765 
   558 // ---------------------------------------------------------------------------
   766 // ---------------------------------------------------------------------------
   559 // addToCollectionSlot
   767 // addToCollectionSlot
   560 // ---------------------------------------------------------------------------
   768 // ---------------------------------------------------------------------------
   561 //
   769 //
   562 void VideoListWidget::addToCollectionSlot()
   770 void VideoListWidget::addToCollectionSlot()
   563 {
   771 {
       
   772 	FUNC_LOG_ADDR(this);
   564     VideoListSelectionDialog *dialog =
   773     VideoListSelectionDialog *dialog =
   565        mUiLoader->findWidget<VideoListSelectionDialog>(
   774        mUiLoader->findWidget<VideoListSelectionDialog>(
   566            DOCML_NAME_DIALOG);
   775            DOCML_NAME_DIALOG);
   567     if (!dialog || !mModel)
   776     if (!dialog || !mModel)
   568     {
   777     {
       
   778         ERROR_1(-1, "VideoListWidget::addToCollectionSlot() [0x%x]: failed to get selection dialog or model is null.", this);
   569         return;
   779         return;
   570     }
   780     }
   571     TMPXItemId itemId = mModel->getMediaIdAtIndex(currentIndex());
   781     TMPXItemId itemId = mModel->getMediaIdAtIndex(currentIndex());
   572     if(itemId != TMPXItemId::InvalidId())
   782     if(itemId != TMPXItemId::InvalidId())
   573     {
   783     {
   580 // removeFromCollectionSlot
   790 // removeFromCollectionSlot
   581 // ---------------------------------------------------------------------------
   791 // ---------------------------------------------------------------------------
   582 //
   792 //
   583 void VideoListWidget::removeFromCollectionSlot()
   793 void VideoListWidget::removeFromCollectionSlot()
   584 {
   794 {
       
   795 	FUNC_LOG_ADDR(this);
   585     if(!mModel)
   796     if(!mModel)
   586     {
   797     {
   587         return;
   798         return;
   588     }
   799     }
   589     TMPXItemId collectionId = mModel->getOpenItem();
   800     TMPXItemId collectionId = mModel->getOpenItem();
   601 // removeCollectionSlot
   812 // removeCollectionSlot
   602 // ---------------------------------------------------------------------------
   813 // ---------------------------------------------------------------------------
   603 //
   814 //
   604 void VideoListWidget::removeCollectionSlot()
   815 void VideoListWidget::removeCollectionSlot()
   605 {
   816 {
       
   817 	FUNC_LOG_ADDR(this);
   606     if(!mModel)
   818     if(!mModel)
   607     {
   819     {
   608         return;
   820         return;
   609     }
   821     }
   610     
   822     
   611     QVariant variant;
   823     QVariant variant;
   612     QModelIndex index = currentIndex();
   824     QModelIndex index = currentIndex();
   613     variant = mModel->data(index, Qt::DisplayRole);
   825     variant = mModel->data(index, VideoCollectionCommon::KeyTitle);
   614 
   826 
   615     if (variant.isValid())
   827     if (variant.isValid())
   616     {
   828     {
   617         QString text = tr("Do you want to remove collection \"%1\"?").arg( //TODO: localisation
   829         QString text = hbTrId("txt_videos_info_do_you_want_to_remove_collection").arg(
   618                 variant.toStringList().first());
   830                 variant.toString());
   619         if(HbMessageBox::question(text))
   831         if(HbMessageBox::question(text))
   620         {
   832         {
   621             QModelIndexList list;
   833             QModelIndexList list;
   622             list.append(index);
   834             list.append(index);
   623         	mModel->removeAlbums(list);
   835         	mModel->removeAlbums(list);
   624         }
   836         }
   625     }
   837     }
   626 }
   838 }
   627 
   839 
   628 // ---------------------------------------------------------------------------
   840 // ---------------------------------------------------------------------------
   629 // playAllSlot
       
   630 // ---------------------------------------------------------------------------
       
   631 //
       
   632 void VideoListWidget::playAllSlot()
       
   633 {
       
   634 	debugNotImplementedYet();
       
   635 }
       
   636 
       
   637 // ---------------------------------------------------------------------------
       
   638 // back
   841 // back
   639 // ---------------------------------------------------------------------------
   842 // ---------------------------------------------------------------------------
   640 //
   843 //
   641 void VideoListWidget::back()
   844 void VideoListWidget::back()
   642 {
   845 {
   643 	// Empty the proxy model causing the items to be removed from list widget.
   846 	FUNC_LOG_ADDR(this);
   644     mModel->setAlbumInUse(TMPXItemId::InvalidId());
   847 
   645     if(mModel)
   848     if(mModel)
   646     {
   849     {
   647         emit collectionOpened(false, QString(), QModelIndex());
   850     	// Empty the proxy model causing the items to be removed from list widget.
       
   851         mModel->setAlbumInUse(TMPXItemId::InvalidId());
       
   852 		emit collectionOpened(false, QString(), QModelIndex());
   648     }
   853     }
   649 }
   854 }
   650 
   855 
   651 // ---------------------------------------------------------------------------
   856 // ---------------------------------------------------------------------------
   652 // scrollingStartedSlot
   857 // scrollingStartedSlot
   653 // ---------------------------------------------------------------------------
   858 // ---------------------------------------------------------------------------
   654 //
   859 //
   655 void VideoListWidget::scrollingStartedSlot()
   860 void VideoListWidget::scrollingStartedSlot()
   656 {
   861 {
       
   862 	FUNC_LOG_ADDR(this);
   657     VideoThumbnailData::instance().enableThumbnailCreation(false);
   863     VideoThumbnailData::instance().enableThumbnailCreation(false);
   658 }
   864 }
   659 
   865 
   660 // ---------------------------------------------------------------------------
   866 // ---------------------------------------------------------------------------
   661 // scrollingEndedSlot
   867 // scrollingEndedSlot
   662 // ---------------------------------------------------------------------------
   868 // ---------------------------------------------------------------------------
   663 //
   869 //
   664 void VideoListWidget::scrollingEndedSlot()
   870 void VideoListWidget::scrollingEndedSlot()
   665 {
   871 {
       
   872 	FUNC_LOG_ADDR(this);
   666     if(mScrollPositionTimer)
   873     if(mScrollPositionTimer)
   667         mScrollPositionTimer->stop();	
   874     {
       
   875         mScrollPositionTimer->stop();
       
   876     }
   668     VideoThumbnailData::instance().enableThumbnailCreation(true);
   877     VideoThumbnailData::instance().enableThumbnailCreation(true);
   669     fetchThumbnailsForVisibleItems();
   878     fetchThumbnailsForVisibleItems();
   670 }
   879 }
   671 
   880 
   672 // ---------------------------------------------------------------------------
   881 // ---------------------------------------------------------------------------
   684 // scrollPositionTimerSlot
   893 // scrollPositionTimerSlot
   685 // ---------------------------------------------------------------------------
   894 // ---------------------------------------------------------------------------
   686 //
   895 //
   687 void VideoListWidget::scrollPositionTimerSlot()
   896 void VideoListWidget::scrollPositionTimerSlot()
   688 {
   897 {
       
   898 	FUNC_LOG_ADDR(this);
   689     fetchThumbnailsForVisibleItems();
   899     fetchThumbnailsForVisibleItems();
   690 }
   900 }
   691 
   901 
   692 // ---------------------------------------------------------------------------
   902 // ---------------------------------------------------------------------------
   693 // fetchThumbnailsForVisibleItems
   903 // fetchThumbnailsForVisibleItems
   694 // ---------------------------------------------------------------------------
   904 // ---------------------------------------------------------------------------
   695 //
   905 //
   696 void VideoListWidget::fetchThumbnailsForVisibleItems()
   906 void VideoListWidget::fetchThumbnailsForVisibleItems()
   697 {
   907 {
       
   908 	FUNC_LOG_ADDR(this);
   698     const QList<HbAbstractViewItem *> itemsVisible = visibleItems();
   909     const QList<HbAbstractViewItem *> itemsVisible = visibleItems();
   699 
   910 
   700     if(itemsVisible.count() > 0)
   911     if(itemsVisible.count() > 0)
   701     {
   912     {
   702         int row = itemsVisible.value(0)->modelIndex().row();
   913         int row = itemsVisible.value(0)->modelIndex().row();
   703         VideoThumbnailData::instance().startBackgroundFetching(mModel, row);
   914         VideoThumbnailData::instance().startBackgroundFetching(mModel, row);
   704     }
   915     }
   705 }
   916 }
   706 
   917 
   707 // ---------------------------------------------------------------------------
       
   708 // debugNotImplementedYet
       
   709 // ---------------------------------------------------------------------------
       
   710 //
       
   711 void VideoListWidget::debugNotImplementedYet()
       
   712 {
       
   713     HbMessageBox::information(tr("Not implemented yet"));
       
   714 }
       
   715 
       
   716 // end of file
   918 // end of file