/*
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: videolist selection dialog implementation
*
*/
// Version : %version: 30.1.7 %
// INCLUDE FILES
#include <qgraphicsitem.h>
#include <qtimer.h>
#include <vcxmyvideosdefs.h>
#include <hbaction.h>
#include <hbabstractitemview.h>
#include <hbinputdialog.h>
#include <hbwidget.h>
#include <hblistview.h>
#include <hblistviewitem.h>
#include "videoproxymodelgeneric.h"
#include "videolistselectiondialog.h"
#include "videocollectionwrapper.h"
#include "videocollectionviewutils.h"
#include "videocollectionclient.h"
#include "videocollectiontrace.h"
#include "videothumbnaildata.h"
// Object names.
const char* const SELECTION_DIALOG_OBJECT_NAME_NEW_COLLECTION = "vc:SelectionDialogNewCollection";
const char* const LIST_VIEW_OBJECT_NAME_CREATE_COLLECTION = "vc::ListViewInputDialogCreateCollection";
const char* const SELECTION_DIALOG_OBJECT_NAME_BUTTON_OK = "vc:SelectionDialogButtonOk";
const char* const SELECTION_DIALOG_OBJECT_NAME_BUTTON_CANCEL = "vc:SelectionDialogButtonCancel";
// Interval in ms to report the scroll position.
const int SCROLL_POSITION_TIMER_TIMEOUT = 100;
/**
* global qHash function required fo creating hash values for TMPXItemId -keys
*/
inline uint qHash(TMPXItemId key)
{
QPair<uint, uint> keyPair(key.iId1, key.iId2);
return qHash(keyPair);
}
/**
* Helper function for creating a new album name query dialog
*/
HbInputDialog* gCreateNewAlbumNameDialog(const char* objectName)
{
QString label(hbTrId("txt_videos_title_enter_name"));
QString text(hbTrId("txt_videos_dialog_entry_new_collection"));
HbInputDialog *dialog = new HbInputDialog();
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setObjectName(objectName);
dialog->setPromptText(label);
dialog->setValue(text);
return dialog;
}
// ---------------------------------------------------------------------------
// VideoListSelectionDialog
// ---------------------------------------------------------------------------
//
VideoListSelectionDialog::VideoListSelectionDialog( QGraphicsItem *parent)
: HbSelectionDialog( parent )
, mTypeOfSelection( ENoFunction )
, mModel( 0 )
, mModelReady( false )
, mAlbumListReady( false )
, mListInitialised( false )
, mPrimaryAction( 0 )
, mSecondaryAction( 0 )
, mScrollPositionTimer( 0 )
{
FUNC_LOG;
// create model and init list, this will create listview in HbSelectionDialog
mModel = VideoCollectionWrapper::instance().getGenericModel();
initList(0);
}
// ---------------------------------------------------------------------------
// ~VideoListSelectionDialog
// ---------------------------------------------------------------------------
//
VideoListSelectionDialog::~VideoListSelectionDialog()
{
FUNC_LOG;
delete mScrollPositionTimer;
delete mPrimaryAction;
delete mSecondaryAction;
}
// ---------------------------------------------------------------------------
// setupContent
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::setupContent(VideoListSelectionDialog::TSelectionFunction type, TMPXItemId activeItem)
{
FUNC_LOG;
INFO_1("VideoListSelectionDialog::setupContent() type: %d", type);
if(type == ENoFunction)
{
return;
}
mTypeOfSelection = type;
if(!initDialog())
{
ERROR(-1, "VideoListSelectionDialog::setupContent() dialog init failed.");
return;
}
mSelectedVideos.clear();
mSelectedAlbumId = TMPXItemId::InvalidId();
mNewAlbumText = QString();
// if provided "owner" is album or category
if(activeItem != TMPXItemId::InvalidId())
{
// if album, set as "selected"
if(activeItem.iId2 == KVcxMvcMediaTypeAlbum)
{
mSelectedAlbumId = activeItem;
}
else if(activeItem.iId2 == KVcxMvcMediaTypeVideo)
{
mSelectedVideos.insert(activeItem);
}
}
// set (or reset) generic id filter
bool filterValue = true;
if(mTypeOfSelection == EAddToCollection ||
mTypeOfSelection == ESelectCollection ||
mTypeOfSelection == ECreateCollection)
{
filterValue = false;
}
mModel->setGenericIdFilter(activeItem, filterValue);
activateSelection();
}
// ---------------------------------------------------------------------------
// initDialog
// ---------------------------------------------------------------------------
//
bool VideoListSelectionDialog::initDialog()
{
FUNC_LOG;
if(!mModel)
{
mModel = VideoCollectionWrapper::instance().getGenericModel();
if (!mModel)
{
return false;
}
}
if(!mScrollPositionTimer)
{
mScrollPositionTimer = new QTimer();
mScrollPositionTimer->setSingleShot(true);
}
return true;
}
// ---------------------------------------------------------------------------
// initList
// ---------------------------------------------------------------------------
//
bool VideoListSelectionDialog::initList(VideoProxyModelGeneric *model)
{
FUNC_LOG;
setModel(model);
if(!mListInitialised)
{
HbWidget* content = static_cast<HbWidget*>(this->primitive("content"));
if(content)
{
HbListView* view = static_cast<HbListView*>(content->primitive("list"));
if (view)
{
HbListViewItem *prototype = view->listItemPrototype();
if(prototype)
{
prototype->setGraphicsSize(HbListViewItem::WideThumbnail);
}
view->setItemRecycling(true);
view->setClampingStyle(HbScrollArea::BounceBackClamping);
view->setScrollingStyle(HbScrollArea::PanWithFollowOn);
view->setFrictionEnabled(true);
view->setUniformItemSizes(true);
view->setSelectionMode(HbAbstractItemView::NoSelection);
view->setItemPixmapCacheEnabled(true);
view->setEnabledAnimations(HbAbstractItemView::None);
mListInitialised = true;
}
}
}
return mListInitialised;
}
// ---------------------------------------------------------------------------
// activateSelection
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::activateSelection(bool changeMode)
{
FUNC_LOG;
QString headingTxt("");
QString primaryTxt("");
// create texts
switch(mTypeOfSelection)
{
case EDeleteVideos:
primaryTxt = hbTrId("txt_common_button_delete");
headingTxt = hbTrId("txt_videos_title_delete_videos");
break;
case EAddToCollection:
primaryTxt = hbTrId("txt_common_button_add");
headingTxt = hbTrId("txt_videos_title_add_videos");
break;
case ECreateCollection:
primaryTxt = hbTrId("txt_common_button_ok");
headingTxt = hbTrId("txt_videos_title_add_videos");
break;
case ERemoveFromCollection:
primaryTxt = hbTrId("txt_common_button_remove");
headingTxt = hbTrId("txt_videos_title_remove_videos");
break;
case ESelectCollection:
primaryTxt = hbTrId("txt_videos_button_new");
headingTxt = hbTrId("txt_videos_title_select_collection");
break;
default:
break;
}
mModelReady = false;
mAlbumListReady = false;
setModel(0);
if(mTypeOfSelection == ESelectCollection)
{
mModel->open(VideoCollectionCommon::ELevelCategory);
VideoCollectionViewUtils::sortModel(mModel, false, VideoCollectionCommon::ELevelCategory);
setModel(mModel);
setSelectionMode(HbAbstractItemView::NoSelection);
if(changeMode)
{
removeAction(mSecondaryAction);
if(!mPrimaryAction)
{
mPrimaryAction = new HbAction();
mPrimaryAction->setObjectName(SELECTION_DIALOG_OBJECT_NAME_BUTTON_OK);
addAction(mPrimaryAction);
}
// New collection button is always enabled for collection selection.
mPrimaryAction->setDisabled(false);
}
else
{
clearActions();
if(!mPrimaryAction)
{
mPrimaryAction = new HbAction(primaryTxt);
mPrimaryAction->setObjectName(SELECTION_DIALOG_OBJECT_NAME_BUTTON_OK);
}
else
{
mPrimaryAction->setText(primaryTxt);
}
addAction(mPrimaryAction);
if(!mSecondaryAction)
{
mSecondaryAction = new HbAction(hbTrId("txt_common_button_cancel"));
mSecondaryAction->setObjectName(SELECTION_DIALOG_OBJECT_NAME_BUTTON_CANCEL);
}
addAction(mSecondaryAction);
// New collection button is always enabled for collection selection.
mPrimaryAction->setDisabled(false);
}
}
else
{
mModel->open(VideoCollectionCommon::ELevelVideos);
VideoCollectionViewUtils::sortModel(mModel, false, VideoCollectionCommon::ELevelVideos);
setModel(mModel);
setSelectionMode(HbAbstractItemView::MultiSelection);
clearActions();
if(!mPrimaryAction)
{
mPrimaryAction = new HbAction(primaryTxt);
mPrimaryAction->setObjectName(SELECTION_DIALOG_OBJECT_NAME_BUTTON_OK);
}
else
{
mPrimaryAction->setText(primaryTxt);
}
addAction(mPrimaryAction);
// Add button will be enabled when videos are selected from the list.
mPrimaryAction->setDisabled(mTypeOfSelection != ECreateCollection);
if(!mSecondaryAction)
{
mSecondaryAction = new HbAction(hbTrId("txt_common_button_cancel"));
mSecondaryAction->setObjectName(SELECTION_DIALOG_OBJECT_NAME_BUTTON_CANCEL);
}
addAction(mSecondaryAction);
}
setHeadingText(headingTxt);
// "add to collection", "remove from collection" and "create collection" -selections
// needs additional functionality for primary key
if(mTypeOfSelection == EAddToCollection ||
mTypeOfSelection == ERemoveFromCollection ||
mTypeOfSelection == ECreateCollection)
{
mPrimaryAction->disconnect(SIGNAL(triggered()));
connect(mPrimaryAction, SIGNAL(triggered()), this, SLOT(primaryActionTriggeredSlot()));
}
}
// ---------------------------------------------------------------------------
// exec
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::exec()
{
FUNC_LOG;
connectSignals();
if(mTypeOfSelection == ECreateCollection)
{
// note this does not leak memory as the dialog will destroy itself upon close.
HbInputDialog *dialog = gCreateNewAlbumNameDialog(LIST_VIEW_OBJECT_NAME_CREATE_COLLECTION);
dialog->open(this, SLOT(newAlbumNameDialogFinished(HbAction *)));
}
else if(mModel->rowCount())
{
// show dialog
VideoThumbnailData::instance().enableBackgroundFetching(true);
fetchThumbnailsForVisibleItems();
HbSelectionDialog::open();
}
else if((mModelReady && mTypeOfSelection != ESelectCollection) ||
(mAlbumListReady && mTypeOfSelection == ESelectCollection))
{
INFO("VideoListSelectionDialog::exec(): nothing to show, finishing.")
// no items, finish right away
finishedSlot(mPrimaryAction);
}
}
// ---------------------------------------------------------------------------
// finishedSlot
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::finishedSlot(HbAction *action)
{
FUNC_LOG;
disconnectSignals();
if(mScrollPositionTimer)
{
if(mScrollPositionTimer->isActive())
{
mScrollPositionTimer->stop();
}
delete mScrollPositionTimer;
mScrollPositionTimer = 0;
}
if(action != mPrimaryAction)
{
if(mTypeOfSelection == ESelectCollection)
{
QModelIndexList selection = selectedModelIndexes();
int count(selection.count());
if((count == 1) && (selection.at(0).isValid()))
{
mSelectedAlbumId = mModel->getMediaIdAtIndex(selection.at(0));
}
else
{
INFO("VideoListSelectionDialog::exec(): secondary action triggered.")
return;
}
}
else
{
INFO("VideoListSelectionDialog::exec(): secondary action triggered.")
return;
}
}
if(mTypeOfSelection == ESelectCollection)
{
mTypeOfSelection = EAddToCollection;
if(mSelectedAlbumId == TMPXItemId::InvalidId())
{
close(); // closes selection dialog if it's open.
// note this does not leak memory as the dialog will destroy itself upon close.
HbInputDialog *dialog = gCreateNewAlbumNameDialog(SELECTION_DIALOG_OBJECT_NAME_NEW_COLLECTION);
dialog->open(this, SLOT(newAlbumNameDialogFinished(HbAction *)));
}
else
{
finalize();
}
}
else
{
finalize();
}
}
// ---------------------------------------------------------------------------
// newAlbumNameDialogFinished
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::newAlbumNameDialogFinished(HbAction *action)
{
FUNC_LOG;
Q_UNUSED(action);
HbInputDialog *dialog = static_cast<HbInputDialog*>(sender());
QVariant variant = dialog->value();
if(dialog->actions().first() == action && variant.isValid())
{
QString text = mModel->resolveAlbumName(variant.toString());
if(!text.isEmpty())
{
if(mSelectedVideos.count() == 0 && mModel->rowCount())
{
mNewAlbumText = text;
// show video selection dialog
VideoThumbnailData::instance().enableBackgroundFetching(true);
fetchThumbnailsForVisibleItems();
HbSelectionDialog::open();
}
else
{
mSelectedAlbumId = mModel->addNewAlbum(text);
finalize(text);
}
}
else
{
// new album name empty, effectively cancel, so disconnect signals.
disconnectSignals();
}
}
else
{
// new album dialog cancelled, disconnect signals.
disconnectSignals();
}
}
// ---------------------------------------------------------------------------
// finalize
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::finalize(QString albumName)
{
close();
// Must be checked again if type was ESelectCollection
if(mTypeOfSelection == EAddToCollection ||
mTypeOfSelection == ECreateCollection)
{
if(mTypeOfSelection == ECreateCollection)
{
mSelectedAlbumId = mModel->addNewAlbum(mNewAlbumText);
albumName = mNewAlbumText;
}
if(mSelectedAlbumId != TMPXItemId::InvalidId() && mSelectedVideos.count())
{
if(mModel->addItemsInAlbum(mSelectedAlbumId, mSelectedVideos.toList()) == 0)
{
if(!albumName.length())
{
albumName = getSelectedName();
}
QList<QVariant> dataList;
dataList.append(QVariant(mSelectedVideos.count()));
dataList.append(QVariant(albumName));
QVariant data = dataList;
VideoCollectionViewUtils::instance().showStatusMsgSlot(
VideoCollectionCommon::statusVideosAddedToCollection,
data);
}
}
}
else if(mTypeOfSelection == ERemoveFromCollection)
{
if(mSelectedAlbumId != TMPXItemId::InvalidId() && mSelectedVideos.count())
{
if(mModel->removeItemsFromAlbum(mSelectedAlbumId, mSelectedVideos.toList()) == 0)
{
QVariant data = getSelectedName();
VideoCollectionViewUtils::instance().showStatusMsgSlot(
VideoCollectionCommon::statusVideosRemovedFromCollection,
data);
}
}
}
// user is deleting videos
else if(mTypeOfSelection == EDeleteVideos)
{
QModelIndexList selection = selectedModelIndexes();
QVariant data = selection.count();
VideoCollectionViewUtils::instance().showStatusMsgSlot(
VideoCollectionCommon::statusDeleteInProgress,
data);
// delete items
mModel->deleteItems(selection);
}
}
// ---------------------------------------------------------------------------
// selectionChangedSlot
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::selectionChangedSlot()
{
FUNC_LOG;
if(!mPrimaryAction || mTypeOfSelection == ESelectCollection)
{
INFO("VideoListSelectionDialog::selectionChangedSlot(): no primary action or we are selecting collection.")
return;
}
QModelIndexList selected(selectedModelIndexes());
if(selected.count() > 0)
{
mPrimaryAction->setDisabled(false);
if(mTypeOfSelection == ECreateCollection)
{
mPrimaryAction->setText(hbTrId("txt_common_button_add"));
}
}
else
{
mPrimaryAction->setDisabled(mTypeOfSelection != ECreateCollection);
if(mTypeOfSelection == ECreateCollection)
{
mPrimaryAction->setText(hbTrId("txt_common_button_ok"));
}
}
}
// ---------------------------------------------------------------------------
// modelReadySlot
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::modelReadySlot()
{
FUNC_LOG;
mModelReady = true;
if(mTypeOfSelection != ESelectCollection)
{
if(!mModel->rowCount())
{
// no items, finish right away
INFO("VideoListSelectionDialog::modelReadySlot(): nothing to show, finishing.");
if(mTypeOfSelection == EAddToCollection ||
mTypeOfSelection == ERemoveFromCollection)
{
primaryActionTriggeredSlot();
}
else
{
finishedSlot(mPrimaryAction);
}
return;
}
// if dialog is not yet visible, bring it visible.
if(!isVisible() && mTypeOfSelection != ECreateCollection)
{
HbSelectionDialog::open();
}
}
}
// ---------------------------------------------------------------------------
// albumListReadySlot
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::albumListReadySlot()
{
mAlbumListReady = true;
if(mTypeOfSelection == ESelectCollection)
{
if(!mModel->rowCount())
{
finishedSlot(mPrimaryAction);
return;
}
else
{
mPrimaryAction->setText(hbTrId("txt_videos_button_new"));
}
// if dialog is not yet visible, bring it visible.
if(!isVisible())
{
HbSelectionDialog::open();
}
}
}
// ---------------------------------------------------------------------------
// primaryActionTriggeredSlot
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::primaryActionTriggeredSlot()
{
FUNC_LOG;
// reconnect primary action
mPrimaryAction->disconnect(SIGNAL(triggered()));
connect(mPrimaryAction, SIGNAL(triggered()), this, SLOT(close()));
// update video items selection here before content changes.
QModelIndexList indexes = selectedModelIndexes();
int count = indexes.count();
TMPXItemId id = TMPXItemId::InvalidId();
for(int i = 0; i < count; ++i)
{
id = mModel->getMediaIdAtIndex(indexes.at(i));
if(id.iId2 == KVcxMvcMediaTypeVideo)
{
mSelectedVideos.insert(id);
}
}
if(mSelectedAlbumId != TMPXItemId::InvalidId() ||
mTypeOfSelection == ECreateCollection)
{
INFO("VideoListSelectionDialog::primaryActionTriggeredSlot(): closing dialog.")
mPrimaryAction->trigger();
return;
}
else if(mTypeOfSelection == EAddToCollection)
{
INFO("VideoListSelectionDialog::primaryActionTriggeredSlot(): activating collection selection.")
// videos for collection selected, but collection
// not yet selected, activate selection for it
mTypeOfSelection = ESelectCollection;
activateSelection(true);
}
}
// ---------------------------------------------------------------------------
// connectSignals
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::connectSignals()
{
FUNC_LOG;
// dialog finished
connect(this, SIGNAL(finished(HbAction*)), this, SLOT(finishedSlot(HbAction*)));
//selection changes
connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedSlot()));
// model changes signals
connect(mModel->sourceModel(), SIGNAL(modelReady()), this, SLOT(modelReadySlot()));
connect(mModel->sourceModel(), SIGNAL(albumListReady()), this, SLOT(albumListReadySlot()));
connect(mScrollPositionTimer, SIGNAL(timeout()), this, SLOT(scrollPositionTimerSlot()));
HbWidget* content = static_cast<HbWidget*>(this->primitive("content"));
HbListView* view(0);
if(content)
{
view = static_cast<HbListView*>(content->primitive("list"));
if (view)
{
connect(view, SIGNAL(scrollingEnded()), this, SLOT(scrollingEndedSlot()));
connect(view, SIGNAL(scrollingStarted()), this, SLOT(scrollingStartedSlot()));
connect(view, SIGNAL(scrollPositionChanged(const QPointF &)),
this, SLOT(scrollPositionChangedSlot(const QPointF &)));
}
}
}
// ---------------------------------------------------------------------------
// disconnectSignals
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::disconnectSignals()
{
FUNC_LOG;
disconnect(this, SIGNAL(finished(HbAction*)), this, SLOT(finishedSlot(HbAction*)));
//selection changes
disconnect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedSlot()));
// model changes signals
disconnect(mModel->sourceModel(), SIGNAL(modelReady()), this, SLOT(modelReadySlot()));
disconnect(mModel->sourceModel(), SIGNAL(albumListReady()), this, SLOT(albumListReadySlot()));
// check that scroll position timer is created
if (mScrollPositionTimer)
{
disconnect(
mScrollPositionTimer, SIGNAL(timeout()),
this, SLOT(scrollPositionTimerSlot()));
}
HbWidget* content = static_cast<HbWidget*>(this->primitive("content"));
HbListView* view(0);
if(content)
{
view = static_cast<HbListView*>(content->primitive("list"));
if (view)
{
disconnect(view, SIGNAL(scrollingEnded()), this, SLOT(scrollingEndedSlot()));
disconnect(view, SIGNAL(scrollingStarted()), this, SLOT(scrollingStartedSlot()));
disconnect(view, SIGNAL(scrollPositionChanged(const QPointF &)),
this, SLOT(scrollPositionChangedSlot(const QPointF &)));
}
}
}
// ---------------------------------------------------------------------------
// getSelectedName
// ---------------------------------------------------------------------------
//
QString VideoListSelectionDialog::getSelectedName()
{
FUNC_LOG;
QString name;
if(mSelectedAlbumId.iId2 > KVcxMvcMediaTypeVideo)
{
VideoProxyModelGeneric *model = VideoCollectionWrapper::instance().getGenericModel();
if(!model)
{
return name;
}
QModelIndex index = model->indexOfId(mSelectedAlbumId);
if(index.isValid())
{
name = model->data(index, VideoCollectionCommon::KeyTitle).toString();
}
}
return name;
}
// ---------------------------------------------------------------------------
// scrollingStartedSlot
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::scrollingStartedSlot()
{
FUNC_LOG_ADDR(this);
VideoThumbnailData::instance().enableThumbnailCreation(false);
}
// ---------------------------------------------------------------------------
// scrollingEndedSlot
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::scrollingEndedSlot()
{
FUNC_LOG_ADDR(this);
if(mScrollPositionTimer)
{
mScrollPositionTimer->stop();
}
VideoThumbnailData::instance().enableBackgroundFetching(true);
VideoThumbnailData::instance().enableThumbnailCreation(true);
fetchThumbnailsForVisibleItems();
}
// ---------------------------------------------------------------------------
// scrollPositionChangedSlot
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::scrollPositionChangedSlot(const QPointF &newPosition)
{
Q_UNUSED(newPosition);
if(mScrollPositionTimer && !mScrollPositionTimer->isActive())
mScrollPositionTimer->start(SCROLL_POSITION_TIMER_TIMEOUT);
}
// ---------------------------------------------------------------------------
// scrollPositionTimerSlot
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::scrollPositionTimerSlot()
{
FUNC_LOG_ADDR(this);
fetchThumbnailsForVisibleItems();
}
// ---------------------------------------------------------------------------
// fetchThumbnailsForVisibleItems
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::fetchThumbnailsForVisibleItems()
{
FUNC_LOG_ADDR(this);
// No need to do anything if thumbnail fetching is not enabled.
if(!VideoThumbnailData::instance().backgroundFetchingEnabled())
{
return;
}
HbWidget* content = static_cast<HbWidget*>(this->primitive("content"));
HbListView* view(0);
if(content)
{
view = static_cast<HbListView*>(content->primitive("list"));
if (!view)
{
return;
}
}
const QList<HbAbstractViewItem *> itemsVisible = view->visibleItems();
if(itemsVisible.count() > 0)
{
int row = itemsVisible.value(0)->modelIndex().row();
VideoThumbnailData::instance().startBackgroundFetching(mModel, row);
}
else
{
// Nothing visible yet, start from first index.
VideoThumbnailData::instance().startBackgroundFetching(mModel, 0);
}
}
// End of file