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