# HG changeset patch
# User hgs
# Date 1270150729 -10800
# Node ID 4f111d64a3419748b68603f53445b9fddc25ac92
# Parent dec420019252dab20a5d4f1061a9656cd91382c8
201005
diff -r dec420019252 -r 4f111d64a341 layers.sysdef.xml
--- a/layers.sysdef.xml Tue Feb 02 00:12:10 2010 +0200
+++ b/layers.sysdef.xml Thu Apr 01 22:38:49 2010 +0300
@@ -1,63 +1,29 @@
-
]>
-
+
+
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff -r dec420019252 -r 4f111d64a341 videocollection/bwins/videocollectionwrapperu.def
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/bwins/videocollectionwrapperu.def Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,68 @@
+EXPORTS
+ ?getThumbnail@VideoThumbnailData@@QAEPBVQIcon@@VTMPXItemId@@@Z @ 1 NONAME ; class QIcon const * VideoThumbnailData::getThumbnail(class TMPXItemId)
+ ?sendAsyncStatus@VideoCollectionWrapper@@QAEXHAAVQVariant@@@Z @ 2 NONAME ; void VideoCollectionWrapper::sendAsyncStatus(int, class QVariant &)
+ ??1VideoSortFilterProxyModel@@UAE@XZ @ 3 NONAME ; VideoSortFilterProxyModel::~VideoSortFilterProxyModel(void)
+ ?startFetchingThumbnail@VideoThumbnailData@@QAEHHH@Z @ 4 NONAME ; int VideoThumbnailData::startFetchingThumbnail(int, int)
+ ?removeThumbnail@VideoThumbnailData@@QAE_NVTMPXItemId@@@Z @ 5 NONAME ; bool VideoThumbnailData::removeThumbnail(class TMPXItemId)
+ ?deleteItems@VideoSortFilterProxyModel@@QAEHABV?$QList@VQModelIndex@@@@@Z @ 6 NONAME ; int VideoSortFilterProxyModel::deleteItems(class QList const &)
+ ?trUtf8@VideoThumbnailData@@SA?AVQString@@PBD0@Z @ 7 NONAME ; class QString VideoThumbnailData::trUtf8(char const *, char const *)
+ ?back@VideoSortFilterProxyModel@@QAEHXZ @ 8 NONAME ; int VideoSortFilterProxyModel::back(void)
+ ?modelReady@VideoSortFilterProxyModel@@IAEXXZ @ 9 NONAME ; void VideoSortFilterProxyModel::modelReady(void)
+ ?qt_metacall@VideoThumbnailData@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 10 NONAME ; int VideoThumbnailData::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?fullDetailsReady@VideoSortFilterProxyModel@@IAEXH@Z @ 11 NONAME ; void VideoSortFilterProxyModel::fullDetailsReady(int)
+ ??1VideoThumbnailData@@EAE@XZ @ 12 NONAME ; VideoThumbnailData::~VideoThumbnailData(void)
+ ??_EVideoThumbnailData@@UAE@I@Z @ 13 NONAME ; VideoThumbnailData::~VideoThumbnailData(unsigned int)
+ ?getMediaFilePathForId@VideoSortFilterProxyModel@@QAE?AVQString@@VTMPXItemId@@@Z @ 14 NONAME ; class QString VideoSortFilterProxyModel::getMediaFilePathForId(class TMPXItemId)
+ ?qt_metacast@VideoCollectionWrapper@@UAEPAXPBD@Z @ 15 NONAME ; void * VideoCollectionWrapper::qt_metacast(char const *)
+ ??0VideoSortFilterProxyModel@@QAE@PAVQObject@@@Z @ 16 NONAME ; VideoSortFilterProxyModel::VideoSortFilterProxyModel(class QObject *)
+ ?startBackgroundFetching@VideoThumbnailData@@QAEXH@Z @ 17 NONAME ; void VideoThumbnailData::startBackgroundFetching(int)
+ ?tr@VideoSortFilterProxyModel@@SA?AVQString@@PBD0H@Z @ 18 NONAME ; class QString VideoSortFilterProxyModel::tr(char const *, char const *, int)
+ ?instance@VideoThumbnailData@@SAAAV1@XZ @ 19 NONAME ; class VideoThumbnailData & VideoThumbnailData::instance(void)
+ ?fetchItemDetails@VideoSortFilterProxyModel@@QAEHABVQModelIndex@@@Z @ 20 NONAME ; int VideoSortFilterProxyModel::fetchItemDetails(class QModelIndex const &)
+ ??0VideoCollectionWrapper@@AAE@XZ @ 21 NONAME ; VideoCollectionWrapper::VideoCollectionWrapper(void)
+ ?metaObject@VideoSortFilterProxyModel@@UBEPBUQMetaObject@@XZ @ 22 NONAME ; struct QMetaObject const * VideoSortFilterProxyModel::metaObject(void) const
+ ?metaObject@VideoCollectionWrapper@@UBEPBUQMetaObject@@XZ @ 23 NONAME ; struct QMetaObject const * VideoCollectionWrapper::metaObject(void) const
+ ?open@VideoSortFilterProxyModel@@QAEHH@Z @ 24 NONAME ; int VideoSortFilterProxyModel::open(int)
+ ?lessThan@VideoSortFilterProxyModel@@MBE_NABVQModelIndex@@0@Z @ 25 NONAME ; bool VideoSortFilterProxyModel::lessThan(class QModelIndex const &, class QModelIndex const &) const
+ ?getStaticMetaObject@VideoCollectionWrapper@@SAABUQMetaObject@@XZ @ 26 NONAME ; struct QMetaObject const & VideoCollectionWrapper::getStaticMetaObject(void)
+ ?getStaticMetaObject@VideoSortFilterProxyModel@@SAABUQMetaObject@@XZ @ 27 NONAME ; struct QMetaObject const & VideoSortFilterProxyModel::getStaticMetaObject(void)
+ ?trUtf8@VideoSortFilterProxyModel@@SA?AVQString@@PBD0@Z @ 28 NONAME ; class QString VideoSortFilterProxyModel::trUtf8(char const *, char const *)
+ ?doSorting@VideoSortFilterProxyModel@@QAEXHW4SortOrder@Qt@@_N@Z @ 29 NONAME ; void VideoSortFilterProxyModel::doSorting(int, enum Qt::SortOrder, bool)
+ ??_EVideoCollectionWrapper@@UAE@I@Z @ 30 NONAME ; VideoCollectionWrapper::~VideoCollectionWrapper(unsigned int)
+ ?getStaticMetaObject@VideoThumbnailData@@SAABUQMetaObject@@XZ @ 31 NONAME ; struct QMetaObject const & VideoThumbnailData::getStaticMetaObject(void)
+ ?getMediaIdAtIndex@VideoSortFilterProxyModel@@QAE?AVTMPXItemId@@ABVQModelIndex@@@Z @ 32 NONAME ; class TMPXItemId VideoSortFilterProxyModel::getMediaIdAtIndex(class QModelIndex const &)
+ ?qt_metacall@VideoCollectionWrapper@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 33 NONAME ; int VideoCollectionWrapper::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?trUtf8@VideoThumbnailData@@SA?AVQString@@PBD0H@Z @ 34 NONAME ; class QString VideoThumbnailData::trUtf8(char const *, char const *, int)
+ ?enableBackgroundFetching@VideoThumbnailData@@QAEX_N@Z @ 35 NONAME ; void VideoThumbnailData::enableBackgroundFetching(bool)
+ ?openItem@VideoSortFilterProxyModel@@QAEHABVQModelIndex@@@Z @ 36 NONAME ; int VideoSortFilterProxyModel::openItem(class QModelIndex const &)
+ ?tr@VideoCollectionWrapper@@SA?AVQString@@PBD0H@Z @ 37 NONAME ; class QString VideoCollectionWrapper::tr(char const *, char const *, int)
+ ?staticMetaObject@VideoSortFilterProxyModel@@2UQMetaObject@@B @ 38 NONAME ; struct QMetaObject const VideoSortFilterProxyModel::staticMetaObject
+ ?tr@VideoSortFilterProxyModel@@SA?AVQString@@PBD0@Z @ 39 NONAME ; class QString VideoSortFilterProxyModel::tr(char const *, char const *)
+ ?asyncStatus@VideoCollectionWrapper@@IAEXHAAVQVariant@@@Z @ 40 NONAME ; void VideoCollectionWrapper::asyncStatus(int, class QVariant &)
+ ?initialize@VideoSortFilterProxyModel@@QAEHPAVVideoListDataModel@@@Z @ 41 NONAME ; int VideoSortFilterProxyModel::initialize(class VideoListDataModel *)
+ ?shortDetailsReady@VideoSortFilterProxyModel@@IAEXH@Z @ 42 NONAME ; void VideoSortFilterProxyModel::shortDetailsReady(int)
+ ?instance@VideoCollectionWrapper@@SAPAV1@XZ @ 43 NONAME ; class VideoCollectionWrapper * VideoCollectionWrapper::instance(void)
+ ?thumbnailsFetched@VideoThumbnailData@@IAEXV?$QList@VTMPXItemId@@@@@Z @ 44 NONAME ; void VideoThumbnailData::thumbnailsFetched(class QList)
+ ?trUtf8@VideoCollectionWrapper@@SA?AVQString@@PBD0@Z @ 45 NONAME ; class QString VideoCollectionWrapper::trUtf8(char const *, char const *)
+ ?processSorting@VideoSortFilterProxyModel@@AAEXXZ @ 46 NONAME ; void VideoSortFilterProxyModel::processSorting(void)
+ ?filterAcceptsRow@VideoSortFilterProxyModel@@MBE_NHABVQModelIndex@@@Z @ 47 NONAME ; bool VideoSortFilterProxyModel::filterAcceptsRow(int, class QModelIndex const &) const
+ ?metaObject@VideoThumbnailData@@UBEPBUQMetaObject@@XZ @ 48 NONAME ; struct QMetaObject const * VideoThumbnailData::metaObject(void) const
+ ?tr@VideoThumbnailData@@SA?AVQString@@PBD0H@Z @ 49 NONAME ; class QString VideoThumbnailData::tr(char const *, char const *, int)
+ ?addNewCollection@VideoSortFilterProxyModel@@QAEHVQString@@0V?$QList@VTMPXItemId@@@@@Z @ 50 NONAME ; int VideoSortFilterProxyModel::addNewCollection(class QString, class QString, class QList)
+ ?qt_metacast@VideoThumbnailData@@UAEPAXPBD@Z @ 51 NONAME ; void * VideoThumbnailData::qt_metacast(char const *)
+ ?trUtf8@VideoSortFilterProxyModel@@SA?AVQString@@PBD0H@Z @ 52 NONAME ; class QString VideoSortFilterProxyModel::trUtf8(char const *, char const *, int)
+ ?tr@VideoCollectionWrapper@@SA?AVQString@@PBD0@Z @ 53 NONAME ; class QString VideoCollectionWrapper::tr(char const *, char const *)
+ ?decreaseReferenceCount@VideoCollectionWrapper@@QAEXXZ @ 54 NONAME ; void VideoCollectionWrapper::decreaseReferenceCount(void)
+ ??_EVideoSortFilterProxyModel@@UAE@I@Z @ 55 NONAME ; VideoSortFilterProxyModel::~VideoSortFilterProxyModel(unsigned int)
+ ?mInstance@VideoCollectionWrapper@@0PAV1@A @ 56 NONAME ; class VideoCollectionWrapper * VideoCollectionWrapper::mInstance
+ ?getModel@VideoCollectionWrapper@@QAEPAVVideoSortFilterProxyModel@@XZ @ 57 NONAME ; class VideoSortFilterProxyModel * VideoCollectionWrapper::getModel(void)
+ ?qt_metacall@VideoSortFilterProxyModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 58 NONAME ; int VideoSortFilterProxyModel::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?freeThumbnailData@VideoThumbnailData@@QAEXXZ @ 59 NONAME ; void VideoThumbnailData::freeThumbnailData(void)
+ ?qt_metacast@VideoSortFilterProxyModel@@UAEPAXPBD@Z @ 60 NONAME ; void * VideoSortFilterProxyModel::qt_metacast(char const *)
+ ?staticMetaObject@VideoCollectionWrapper@@2UQMetaObject@@B @ 61 NONAME ; struct QMetaObject const VideoCollectionWrapper::staticMetaObject
+ ?tr@VideoThumbnailData@@SA?AVQString@@PBD0@Z @ 62 NONAME ; class QString VideoThumbnailData::tr(char const *, char const *)
+ ??1VideoCollectionWrapper@@EAE@XZ @ 63 NONAME ; VideoCollectionWrapper::~VideoCollectionWrapper(void)
+ ?trUtf8@VideoCollectionWrapper@@SA?AVQString@@PBD0H@Z @ 64 NONAME ; class QString VideoCollectionWrapper::trUtf8(char const *, char const *, int)
+ ??0VideoThumbnailData@@AAE@XZ @ 65 NONAME ; VideoThumbnailData::VideoThumbnailData(void)
+ ?staticMetaObject@VideoThumbnailData@@2UQMetaObject@@B @ 66 NONAME ; struct QMetaObject const VideoThumbnailData::staticMetaObject
+
diff -r dec420019252 -r 4f111d64a341 videocollection/eabi/videocollectionwrapperu.def
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/eabi/videocollectionwrapperu.def Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,68 @@
+EXPORTS
+ _ZN18VideoThumbnailData11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME
+ _ZN18VideoThumbnailData11qt_metacastEPKc @ 2 NONAME
+ _ZN18VideoThumbnailData12getThumbnailE10TMPXItemId @ 3 NONAME
+ _ZN18VideoThumbnailData15removeThumbnailE10TMPXItemId @ 4 NONAME
+ _ZN18VideoThumbnailData16staticMetaObjectE @ 5 NONAME DATA 16
+ _ZN18VideoThumbnailData17freeThumbnailDataEv @ 6 NONAME
+ _ZN18VideoThumbnailData17thumbnailsFetchedE5QListI10TMPXItemIdE @ 7 NONAME
+ _ZN18VideoThumbnailData19getStaticMetaObjectEv @ 8 NONAME
+ _ZN18VideoThumbnailData22startFetchingThumbnailEii @ 9 NONAME
+ _ZN18VideoThumbnailData23startBackgroundFetchingEi @ 10 NONAME
+ _ZN18VideoThumbnailData24enableBackgroundFetchingEb @ 11 NONAME
+ _ZN18VideoThumbnailData8instanceEv @ 12 NONAME
+ _ZN18VideoThumbnailDataC1Ev @ 13 NONAME
+ _ZN18VideoThumbnailDataC2Ev @ 14 NONAME
+ _ZN18VideoThumbnailDataD0Ev @ 15 NONAME
+ _ZN18VideoThumbnailDataD1Ev @ 16 NONAME
+ _ZN18VideoThumbnailDataD2Ev @ 17 NONAME
+ _ZN22VideoCollectionWrapper11asyncStatusEiR8QVariant @ 18 NONAME
+ _ZN22VideoCollectionWrapper11qt_metacallEN11QMetaObject4CallEiPPv @ 19 NONAME
+ _ZN22VideoCollectionWrapper11qt_metacastEPKc @ 20 NONAME
+ _ZN22VideoCollectionWrapper15sendAsyncStatusEiR8QVariant @ 21 NONAME
+ _ZN22VideoCollectionWrapper16staticMetaObjectE @ 22 NONAME DATA 16
+ _ZN22VideoCollectionWrapper19getStaticMetaObjectEv @ 23 NONAME
+ _ZN22VideoCollectionWrapper22decreaseReferenceCountEv @ 24 NONAME
+ _ZN22VideoCollectionWrapper8getModelEv @ 25 NONAME
+ _ZN22VideoCollectionWrapper8instanceEv @ 26 NONAME
+ _ZN22VideoCollectionWrapper9mInstanceE @ 27 NONAME DATA 4
+ _ZN22VideoCollectionWrapperC1Ev @ 28 NONAME
+ _ZN22VideoCollectionWrapperC2Ev @ 29 NONAME
+ _ZN22VideoCollectionWrapperD0Ev @ 30 NONAME
+ _ZN22VideoCollectionWrapperD1Ev @ 31 NONAME
+ _ZN22VideoCollectionWrapperD2Ev @ 32 NONAME
+ _ZN25VideoSortFilterProxyModel10initializeEP18VideoListDataModel @ 33 NONAME
+ _ZN25VideoSortFilterProxyModel10modelReadyEv @ 34 NONAME
+ _ZN25VideoSortFilterProxyModel11deleteItemsERK5QListI11QModelIndexE @ 35 NONAME
+ _ZN25VideoSortFilterProxyModel11qt_metacallEN11QMetaObject4CallEiPPv @ 36 NONAME
+ _ZN25VideoSortFilterProxyModel11qt_metacastEPKc @ 37 NONAME
+ _ZN25VideoSortFilterProxyModel14processSortingEv @ 38 NONAME
+ _ZN25VideoSortFilterProxyModel16addNewCollectionE7QStringS0_5QListI10TMPXItemIdE @ 39 NONAME
+ _ZN25VideoSortFilterProxyModel16fetchItemDetailsERK11QModelIndex @ 40 NONAME
+ _ZN25VideoSortFilterProxyModel16fullDetailsReadyEi @ 41 NONAME
+ _ZN25VideoSortFilterProxyModel16staticMetaObjectE @ 42 NONAME DATA 16
+ _ZN25VideoSortFilterProxyModel17getMediaIdAtIndexERK11QModelIndex @ 43 NONAME
+ _ZN25VideoSortFilterProxyModel17shortDetailsReadyEi @ 44 NONAME
+ _ZN25VideoSortFilterProxyModel19getStaticMetaObjectEv @ 45 NONAME
+ _ZN25VideoSortFilterProxyModel21getMediaFilePathForIdE10TMPXItemId @ 46 NONAME
+ _ZN25VideoSortFilterProxyModel4backEv @ 47 NONAME
+ _ZN25VideoSortFilterProxyModel4openEi @ 48 NONAME
+ _ZN25VideoSortFilterProxyModel8openItemERK11QModelIndex @ 49 NONAME
+ _ZN25VideoSortFilterProxyModel9doSortingEiN2Qt9SortOrderEb @ 50 NONAME
+ _ZN25VideoSortFilterProxyModelC1EP7QObject @ 51 NONAME
+ _ZN25VideoSortFilterProxyModelC2EP7QObject @ 52 NONAME
+ _ZN25VideoSortFilterProxyModelD0Ev @ 53 NONAME
+ _ZN25VideoSortFilterProxyModelD1Ev @ 54 NONAME
+ _ZN25VideoSortFilterProxyModelD2Ev @ 55 NONAME
+ _ZNK18VideoThumbnailData10metaObjectEv @ 56 NONAME
+ _ZNK22VideoCollectionWrapper10metaObjectEv @ 57 NONAME
+ _ZNK25VideoSortFilterProxyModel10metaObjectEv @ 58 NONAME
+ _ZNK25VideoSortFilterProxyModel16filterAcceptsRowEiRK11QModelIndex @ 59 NONAME
+ _ZNK25VideoSortFilterProxyModel8lessThanERK11QModelIndexS2_ @ 60 NONAME
+ _ZTI18VideoThumbnailData @ 61 NONAME
+ _ZTI22VideoCollectionWrapper @ 62 NONAME
+ _ZTI25VideoSortFilterProxyModel @ 63 NONAME
+ _ZTV18VideoThumbnailData @ 64 NONAME
+ _ZTV22VideoCollectionWrapper @ 65 NONAME
+ _ZTV25VideoSortFilterProxyModel @ 66 NONAME
+
diff -r dec420019252 -r 4f111d64a341 videocollection/inc/videocollectioncommon.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/inc/videocollectioncommon.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2009 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: definition of common data for video collection components
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONCOMMON_H__
+#define __VIDEOCOLLECTIONCOMMON_H__
+
+
+#include
+
+namespace VideoCollectionCommon
+{
+ /**
+ * enums indicating keys for the detail data
+ * fetched from video model
+ */
+ enum VideoDetailKey
+ {
+ KeyUndefined = Qt::UserRole,
+ KeyDateTime,
+ KeySizeValue,
+ KeyStatus,
+ KeyMetaData,
+ KeyFilePath,
+ KeyLast
+ };
+
+ /**
+ * Keys for the metadata map fetched from video model.
+ * These are strings, because QVariant only supports QMap
+ */
+ const char* const MetaKeyDate = "MetaKeyDate";
+ const char* const MetaKeyDurationString = "MetaKeyDurationString";
+ const char* const MetaKeySizeString = "MetaKeySizeString";
+ const char* const MetaKeyStarRating = "MetaKeyStarRating";
+ const char* const MetaKeyDRMInfo = "MetaKeyDRMInfo";
+ const char* const MetaKeyServiceURL = "MetaKeyServiceURL";
+ const char* const MetaKeyDescription = "MetaKeyDescription";
+ const char* const MetaKeyModifiedDate = "MetaKeyModifiedDate";
+ const char* const MetaKeyShotLocation = "MetaKeyShotLocation";
+ const char* const MetaKeyAuthor = "MetaKeyAuthor";
+ const char* const MetaKeyCopyright = "MetaKeyCopyright";
+ const char* const MetaKeyAudioType = "MetaKeyAudioType";
+ const char* const MetaKeyLanguageString = "MetaKeyLanguageString";
+ const char* const MetaKeyKeywords = "MetaKeyKeywords";
+ const char* const MetaKeyVideoResolutionString = "MetaKeyVideoResolutionString";
+ const char* const MetaKeyBitRate = "MetaKeyBitRate";
+ const char* const MetaKeyFormat = "MetaKeyFormat";
+
+ enum VideoItemStatus
+ {
+ StatusNone = 0,
+ StatusDeleted
+ };
+
+ /**
+ * Labels for the different details. Needs to be in the same
+ * order than the VideoDetailLabelKeys.
+ */
+ const char * const VideoDetailLabels[] = {
+ QT_TR_NOOP("DRM: %1"),
+ QT_TR_NOOP("Service: %1"),
+ QT_TR_NOOP("Description: %1"),
+ QT_TR_NOOP("Length: %1"),
+ QT_TR_NOOP("Date: %1"),
+ QT_TR_NOOP("Modified: %1"),
+ QT_TR_NOOP("Location: %1"),
+ QT_TR_NOOP("Author: %1"),
+ QT_TR_NOOP("Copyright: %1"),
+ QT_TR_NOOP("Audio Type: %1"),
+ QT_TR_NOOP("Language: %1"),
+ QT_TR_NOOP("Keywords: %1"),
+ QT_TR_NOOP("Size: %1"),
+ QT_TR_NOOP("Resolution: %1"),
+ QT_TR_NOOP("Format: %1"),
+ QT_TR_NOOP("Bitrate: %1")
+ };
+
+ /**
+ * Order of keys in the labels const array.
+ */
+ const char * const VideoDetailLabelKeys[] = {
+ MetaKeyDRMInfo,
+ MetaKeyServiceURL,
+ MetaKeyDescription,
+ MetaKeyDurationString,
+ MetaKeyDate,
+ MetaKeyModifiedDate,
+ MetaKeyShotLocation,
+ MetaKeyAuthor,
+ MetaKeyCopyright,
+ MetaKeyAudioType,
+ MetaKeyLanguageString,
+ MetaKeyKeywords,
+ MetaKeySizeString,
+ MetaKeyVideoResolutionString,
+ MetaKeyFormat,
+ MetaKeyBitRate
+ };
+
+
+ /**
+ * Collection related asyncronous
+ * operations status codes
+ */
+ enum VideoCollectionAsyncStatus
+ {
+ statusSingleDeleteFail = 1,
+ statusMultipleDeleteFail,
+ statusMultipleDeleteSucceed
+ };
+
+
+}
+#endif // __VIDEOCOLLECTIONCOMMON_H__
diff -r dec420019252 -r 4f111d64a341 videocollection/mpxmyvideoscollection/download/src/vcxmyvideosdownloadutil.cpp
--- a/videocollection/mpxmyvideoscollection/download/src/vcxmyvideosdownloadutil.cpp Tue Feb 02 00:12:10 2010 +0200
+++ b/videocollection/mpxmyvideoscollection/download/src/vcxmyvideosdownloadutil.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -15,8 +15,7 @@
*
*/
-
-
+#define MVCOLLECTION_10_1_DISABLE_DOWNLOADS
// INCLUDE FILES
#include
@@ -130,12 +129,17 @@
CVcxMyVideosDownloadUtil::~CVcxMyVideosDownloadUtil()
{
MPX_FUNC("CVcxMyVideosDownloadUtil::~CVcxMyVideosDownloadUtil");
+
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
iDownloadManager.Disconnect(); //disconnects all downloads and puts them to pause
iDownloadManager.Close();
delete iDownloadDeleteTimer;
iDownloadsToDelete.Close();
iDeleteContent.Close();
-
+
if ( iConnUtil )
{
iConnUtil->RemoveObserver( this );
@@ -165,6 +169,10 @@
{
MPX_FUNC("CVcxMyVideosDownloadUtil::ConstructL");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
TUid uid = TUid::Uid( KVcxUidMyVideosMpxCollection );
iDownloadManager.ConnectL( uid, *this, ETrue );
@@ -188,6 +196,11 @@
void CVcxMyVideosDownloadUtil::StartDownloadL( CMPXMedia& aDownload )
{
MPX_FUNC("CVcxMyVideosDownloadUtil::StartDownloadL");
+
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
// Requesting a new connection, update state
iRoamingOngoing = EFalse;
TInt err( KErrNone );
@@ -294,6 +307,10 @@
//
TInt CVcxMyVideosDownloadUtil::PauseDownload( TUint32 aDownloadId )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return 0;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
RHttpDownload* download = Download( aDownloadId );
if ( !download )
@@ -313,6 +330,9 @@
THttpDownloadEvent aEvent )
{
MPX_FUNC("CVcxMyVideosDownloadUtil::HandleDMgrEventL");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
TInt32 downloadId;
aDownload.GetIntAttribute( EDlAttrId, downloadId );
@@ -457,6 +477,10 @@
//
RHttpDownload* CVcxMyVideosDownloadUtil::Download( TUint32 aDownloadId )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return 0;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
if ( aDownloadId == 0 )
{
return NULL;
@@ -486,6 +510,9 @@
RHttpDownload* CVcxMyVideosDownloadUtil::Download( const TDesC& aFileName )
{
MPX_FUNC("CVcxMyVideosDownloadUtil::Download()");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return 0;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
TInt count = iDownloadManager.CurrentDownloads().Count();
TInt i;
@@ -525,6 +552,11 @@
{
MPX_FUNC("CVcxMyVideosDownloadUtil::CancelDownload");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return 0;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
+
if ( iDownloadManager.CurrentDownloads().Count() < 1 )
{
return KErrNotFound;
@@ -559,6 +591,10 @@
TBool CVcxMyVideosDownloadUtil::RequestIsRoamingAllowedL()
{
MPX_FUNC("CVcxMyVideosDownloadUtil::RequestIsRoamingAllowedL");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return EFalse;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
iDownloadManager.Disconnect();
iRoamingOngoing = ETrue;
return ETrue;
@@ -571,6 +607,10 @@
void CVcxMyVideosDownloadUtil::IapChangedL()
{
MPX_FUNC("CVcxMyVideosDownloadUtil::IapChangedL");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
if ( !iRoamingOngoing )
{
// This is not roaming situation, must not call GetIap()
@@ -601,6 +641,10 @@
RHttpDownload& aDownload,
TVcxMyVideosDownloadState& aDownloadState )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
TInt32 dlStateInDlManager;
aDownload.GetIntAttribute( EDlAttrState, dlStateInDlManager );
@@ -636,6 +680,10 @@
TInt8 CVcxMyVideosDownloadUtil::DownloadProgress( RHttpDownload& aDownload, TUint64& aDownloaded,
TBool aAllowSilentReset )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return 0;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
TInt64 downloaded;
TInt32 fullSize;
@@ -703,6 +751,10 @@
//
const TDesC& CVcxMyVideosDownloadUtil::GetS60DlStateDes( TInt32 aState )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return KVcxUnknownStateDes;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
switch ( aState )
{
case EHttpDlCreated:
@@ -764,6 +816,10 @@
//
const TDesC& CVcxMyVideosDownloadUtil::GetS60DlProgressDes( TInt32 aProgress )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return KVcxUnknownProgressDes;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
switch ( aProgress )
{
case EHttpProgNone:
@@ -850,6 +906,10 @@
//
void CVcxMyVideosDownloadUtil::DeleteDownloadAsync( TInt32 aDownloadId, TBool aDeleteContent )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
iDownloadsToDelete.Append( aDownloadId );
iDeleteContent.Append( aDeleteContent );
if ( !iDownloadDeleteTimer->IsActive() )
@@ -864,6 +924,10 @@
//
void CVcxMyVideosDownloadUtil::TimerExpired( CVcxMyVideosTimer* aTimer )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
if ( aTimer == iDownloadDeleteTimer )
{
for ( TInt i = 0; i < iDownloadsToDelete.Count(); i++ )
@@ -911,6 +975,9 @@
void CVcxMyVideosDownloadUtil::ClearOrphanDownloadsL( CMPXMedia& aVideoList )
{
MPX_FUNC("CVcxMyVideosDownloadUtil::ClearOrphanDownloadsL");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
const CDownloadArray& downloads = Downloads();
@@ -950,6 +1017,10 @@
//
void CVcxMyVideosDownloadUtil::NotifyDownloadStarted()
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
TUid::Uid( KVcxNsMpxMediatorCategory ),
KVcxNsMpxEventDownloadStarted ,
@@ -963,6 +1034,10 @@
//
void CVcxMyVideosDownloadUtil::NotifyIfNoActiveDownloads()
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
if ( !ActiveDownloadCount() )
{
iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
@@ -979,6 +1054,10 @@
//
void CVcxMyVideosDownloadUtil::NotifyDownloadCompleted( const TDesC8& aMsg )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
TUid::Uid( KVcxNsMpxMediatorCategory ),
KVcxNsMpxEventDownloadCompleted,
@@ -992,6 +1071,10 @@
//
void CVcxMyVideosDownloadUtil::NotifyNewVideosCountDecreased( const TDesC8& aMsg )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
TUid::Uid( KVcxNsMpxMediatorCategory ),
KVcxNsMpxEventNewVideosCountDecreased,
@@ -1005,6 +1088,10 @@
//
TInt32 CVcxMyVideosDownloadUtil::ActiveDownloadCount()
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return 0;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
const CDownloadArray& dlarray = Downloads();
TInt32 dlCount( 0 );
@@ -1032,6 +1119,12 @@
MPX_FUNC("CVcxMyVideosDownloadUtil::CreateFilePathL");
HBufC* path = HBufC::NewL( KMaxPathLength );
+
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return path;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
+
CleanupStack::PushL( path ); // 1->
TPtr pathPtr( path->Des() );
@@ -1089,6 +1182,9 @@
void CVcxMyVideosDownloadUtil::GeneratePathL( const CMPXMedia& aMedia, TDes& aPath, TInt aCounter )
{
MPX_FUNC("CVcxMyVideosDownloadUtil::GeneratePathL");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
_LIT( KBasePathNormal, "\\My Videos\\Downloads\\" );
_LIT( KBasePathSystemDrive, "\\Data\\My Videos\\Downloads\\" );
@@ -1236,6 +1332,10 @@
//
void CVcxMyVideosDownloadUtil::FindSubDirL( const TDesC& aPath )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
MPX_FUNC("CVcxMyVideosDownloadUtil::FindSubDirL");
MPX_DEBUG2("CVcxMyVideosDownloadUtil:: aPath = %S", &aPath);
@@ -1291,6 +1391,10 @@
TInt CVcxMyVideosDownloadUtil::FileCountL( const TDesC& aPath )
{
TInt count = 0; // return 0 in case of fail
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return 0;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
CDir* dir = NULL;
TInt err = iFs.GetDir( aPath, KEntryAttNormal | KEntryAttMatchMask, ESortBySize, dir );
@@ -1314,6 +1418,10 @@
{
MPX_FUNC("CVcxMyVideosDownloadUtil::UsedMemoryDesL");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return iUsedMemoryDrivePath;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
CVcxMyVideosDriveMonitor* driveMonitor = CVcxMyVideosDriveMonitor::NewL( iFs );
CleanupStack::PushL( driveMonitor ); // 1->
driveMonitor->GetUsedMemoryL( iUsedDrive );
@@ -1333,6 +1441,10 @@
//
void CVcxMyVideosDownloadUtil::StopProgressTimer()
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
if ( ActiveDownloadCount() == 0 )
{
MPX_DEBUG1("CVcxMyVideosDownloadUtil:: stopped iDownloadProgressTimer");
@@ -1346,6 +1458,10 @@
//
void CVcxMyVideosDownloadUtil::StartProgressTimer()
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
if ( !iDownloadProgressTimer->IsActive() && ActiveDownloadCount() > 0 )
{
MPX_DEBUG1("CVcxMyVideosDownloadUtil:: started iDownloadProgressTimer");
diff -r dec420019252 -r 4f111d64a341 videocollection/mpxmyvideoscollection/inc/vcxmyvideosvideocache.h
--- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideosvideocache.h Tue Feb 02 00:12:10 2010 +0200
+++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosvideocache.h Thu Apr 01 22:38:49 2010 +0300
@@ -11,12 +11,11 @@
*
* Contributors:
*
-* Description: Contains cached MDS media items*
+* Description: Contains cached MDS media items*
*/
-
#ifndef VCXMYVIDEOSVIDEOCACHE_H
#define VCXMYVIDEOSVIDEOCACHE_H
@@ -348,6 +347,10 @@
*/
TVcxMyVideosSortingOrder iLastSortingOrder;
+ /**
+ * Set to ETrue when doing videolist fetching.
+ */
+ TBool IsFetchingVideoList;
private:
/**
diff -r dec420019252 -r 4f111d64a341 videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsdb.cpp
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsdb.cpp Tue Feb 02 00:12:10 2010 +0200
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsdb.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -11,12 +11,11 @@
*
* Contributors:
*
-* Description: MPX My Videos collection plugin's MDS database class*
+* Description: MPX My Videos collection plugin's MDS database class*
*/
-
//#include
#include
#include
@@ -31,6 +30,9 @@
#include
#include "vcxmyvideosmdsdb.h"
#include "vcxmyvideoscollectionutil.h"
+#include "vcxmyvideosmdsalbums.h"
+#include "vcxmyvideoscollectionutil.h"
+#include "vcxmyvideosmdscmdqueue.h"
_LIT( KVcxVideoObjectName, "Video" );
//1 (ID)
@@ -78,18 +80,20 @@
{
MPX_FUNC( "CVcxMyVideosMdsDb::ConstructL" );
+ iCmdQueue = CVcxMyVideosMdsCmdQueue::NewL( *this );
+
iActiveSchedulerWait = new (ELeave) CActiveSchedulerWait;
MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL CMdESession::NewL" );
// Create session
- iMDSError = KErrNone;
+ iMdsError = KErrNone;
- iMDSSession = CMdESession::NewL( *this );
- if (!iMDSSession)
+ iMdsSession = CMdESession::NewL( *this );
+ if (!iMdsSession)
{
// Failed to create session, leave
- User::Leave( iMDSError );
+ User::Leave( iMdsError );
}
// Wait until session opened
@@ -97,21 +101,21 @@
MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL iActiveSchedulerWait->Start done" );
- if ( iMDSError != KErrNone )
+ if ( iMdsError != KErrNone )
{
- MPX_DEBUG2("Failed to create session to MDS: %d", iMDSError);
- User::LeaveIfError( iMDSError );
+ MPX_DEBUG2("Failed to create session to MDS: %d", iMdsError);
+ User::LeaveIfError( iMdsError );
}
// Get the schema definitions
- iMDSError = KErrNone;
+ iMdsError = KErrNone;
GetSchemaDefinitionsL();
// Is schema ok
- if ( iMDSError != KErrNone )
+ if ( iMdsError != KErrNone )
{
// Schema not loaded, abort
- User::Leave( iMDSError );
+ User::Leave( iMdsError );
}
MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL Adding observers" );
@@ -121,9 +125,15 @@
// do not bother us much since we try to fetch the item from the db
// after the add notification anyways, and then we use video condition.
// Eventually extra events are ignored.
- iMDSSession->AddObjectObserverL( *this, NULL );
+ iMdsSession->AddObjectObserverL( *this, NULL );
+
+ iMdsSession->AddObjectPresentObserverL( *this );
- iMDSSession->AddObjectPresentObserverL( *this );
+ iAlbums = CVcxMyVideosMdsAlbums::NewL( *this );
+
+ TCallBack callBack( AsyncHandleQueryCompleted, this );
+ iAsyncHandleQueryCompleteCaller = new (ELeave) CAsyncCallBack( callBack,
+ CActive::EPriorityStandard );
}
// ---------------------------------------------------------------------------
@@ -182,31 +192,42 @@
{
MPX_FUNC( "CVcxMyVideosMdsDb::~CVcxMyVideosMdsDb()" );
- if ( iMDSSession )
+ Cancel();
+
+ delete iCmdQueue;
+
+ if ( iMdsSession )
{
- TRAP_IGNORE( iMDSSession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdsSession->RemoveObjectObserverL( *this ) );
}
- Cancel();
-
delete iVideoQuery;
- delete iMDSSession;
+ delete iAlbums;
+ delete iMdsSession;
delete iActiveSchedulerWait;
+ delete iAsyncHandleQueryCompleteCaller;
}
// ---------------------------------------------------------------------------
// CVcxMyVideosMdsDb::Cancel
// ---------------------------------------------------------------------------
//
-void CVcxMyVideosMdsDb::Cancel()
+void CVcxMyVideosMdsDb::Cancel( TRequestType aType )
{
MPX_FUNC("CVcxMyVideosMdsDb::Cancel()");
- if ( iVideoQuery )
+ iCmdQueue->Cancel( aType );
+
+ if ( aType == EAll || aType == EGetVideoList )
{
- iVideoQuery->Cancel();
+ if ( iVideoQuery )
+ {
+ iVideoQuery->Cancel();
+ }
+ iVideoListFetchingIsOngoing = EFalse;
}
- iVideoListFetchingIsOngoing = EFalse;
+
+ iAlbums->Cancel( aType );
}
// ---------------------------------------------------------------------------
@@ -219,13 +240,13 @@
{
MPX_FUNC( "CVcxMyVideosMdsDb::AddVideoL" );
- if ( !iMDSSession )
+ if ( !iMdsSession )
{
- MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMDSError);
- User::Leave( iMDSError );
+ MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError);
+ User::Leave( iMdsError );
}
- CMdEObject* object = iMDSSession->NewObjectLC(
+ CMdEObject* object = iMdsSession->NewObjectLC(
*iVideoObjectDef, aVideo.ValueText( KMPXMediaGeneralUri ) ); // 1->
// check if the file exists and use the creation time from the file
@@ -260,11 +281,11 @@
}
Media2ObjectL( aVideo, *object );
- TRAPD( err, aMdsId = iMDSSession->AddObjectL( *object ) );
+ TRAPD( err, aMdsId = iMdsSession->AddObjectL( *object ) );
if ( err != KErrNone )
{
- MPX_DEBUG2( "CVcxMyVideosMdsDb:: iMDSSession->AddObjectL leaved with error: %d", err );
+ MPX_DEBUG2( "CVcxMyVideosMdsDb:: iMdsSession->AddObjectL leaved with error: %d", err );
User::Leave( err );
}
@@ -290,10 +311,10 @@
{
MPX_FUNC( "CVcxMyVideosMdsDb::RemoveVideoL" );
- if ( !iMDSSession )
+ if ( !iMdsSession )
{
- MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session, returning %d", iMDSError);
- return iMDSError;
+ MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session, returning %d", iMdsError);
+ return iMdsError;
}
TInt retValue( KErrNone );
@@ -301,7 +322,7 @@
MPX_DEBUG2( "CVcxMyVideosMdsDb:: removing object %d", aMdsId );
- TRAPD( err, id = iMDSSession->RemoveObjectL( aMdsId ) );
+ TRAPD( err, id = iMdsSession->RemoveObjectL( aMdsId ) );
if ( err == KErrNone )
{
@@ -317,7 +338,7 @@
}
else
{
- MPX_DEBUG2( "CVcxMyVideosMdsDb:: iMDSSession->RemoveObjectL left: %d", err );
+ MPX_DEBUG2( "CVcxMyVideosMdsDb:: iMdsSession->RemoveObjectL left: %d", err );
retValue = err;
}
@@ -332,10 +353,10 @@
{
MPX_FUNC( "CVcxMyVideosMdsDb::UpdateVideoL" );
- if ( !iMDSSession )
+ if ( !iMdsSession )
{
- MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMDSError);
- User::Leave( iMDSError );
+ MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError);
+ User::Leave( iMdsError );
}
TMPXItemId mpxId = aVideo.ValueTObjectL( KMPXMediaGeneralId );
@@ -343,7 +364,7 @@
MPX_DEBUG2("CVcxMyVideosMdsDb::UpdateVideoL updating object %d ", mpxId.iId1);
CMdEObject* object =
- iMDSSession->OpenObjectL( mpxId.iId1, *iVideoObjectDef );
+ iMdsSession->OpenObjectL( mpxId.iId1, *iVideoObjectDef );
if ( object == NULL )
{
// No object with this ID was found!
@@ -360,7 +381,7 @@
Media2ObjectL( aVideo, *object );
- iMDSSession->CommitObjectL(*object);
+ iMdsSession->CommitObjectL(*object);
CleanupStack::PopAndDestroy(object);
}
@@ -382,11 +403,30 @@
TBool aAscending, TBool aFullDetails, CMPXMedia*& aVideoList )
{
MPX_FUNC( "CVcxMyVideosMdsDb::CreateVideoListL" );
+
+ CVcxMyVideosMdsCmdGetVideoList* cmd = CVcxMyVideosMdsCmdGetVideoList::NewL();
+ cmd->iCmdType = CVcxMyVideosMdsDb::EGetVideoList;
+ cmd->iSortingOrder = aSortingOrder;
+ cmd->iAscending = aAscending;
+ cmd->iFullDetails = aFullDetails;
+ cmd->iVideoList = &aVideoList;
- if ( !iMDSSession )
+ iCmdQueue->ExecuteCmdL( cmd ); //ownership moves
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsDb::DoCreateVideoListL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsDb::DoCreateVideoListL( TVcxMyVideosSortingOrder aSortingOrder,
+ TBool aAscending, TBool aFullDetails, CMPXMedia*& aVideoList )
+ {
+ MPX_FUNC( "CVcxMyVideosMdsDb::DoCreateVideoListL" );
+
+ if ( !iMdsSession )
{
- MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMDSError);
- User::Leave( iMDSError );
+ MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError);
+ User::Leave( iMdsError );
}
if ( iVideoListFetchingIsOngoing )
@@ -405,7 +445,7 @@
delete iVideoQuery;
iVideoQuery = NULL;
- iVideoQuery = iMDSSession->NewObjectQueryL(
+ iVideoQuery = iMdsSession->NewObjectQueryL(
*iNamespaceDef,
*iVideoObjectDef,
this);
@@ -550,38 +590,48 @@
// ---------------------------------------------------------------------------
//
void CVcxMyVideosMdsDb::HandleQueryCompleted(
-#if _DEBUG
- CMdEQuery& aQuery,
-#else
CMdEQuery& /*aQuery*/,
-#endif
TInt /*aError*/)
{
- MPX_FUNC( "CVcxMyVideosMdsDb::HandleQueryCompleted" );
+ iAsyncHandleQueryCompleteCaller->CallBack();
+ }
- if ( !iVideoList )
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsDb::AsyncHandleQueryCompleted
+// ---------------------------------------------------------------------------
+//
+TInt CVcxMyVideosMdsDb::AsyncHandleQueryCompleted( TAny* aThis )
+ {
+ MPX_FUNC( "CVcxMyVideosMdsDb::AsyncHandleQueryCompleted" );
+
+ CVcxMyVideosMdsDb* thisObj = static_cast( aThis );
+
+ if ( !thisObj->iVideoList )
{
MPX_DEBUG1("CVcxMyVideosMdsDb:: iVideoList is NULL, should never happen");
- return;
+ return KErrNone;
}
#ifdef _DEBUG
- CMPXMediaArray* array = iVideoList->Value( KMPXMediaArrayContents );
+ CMPXMediaArray* array = thisObj->iVideoList->Value( KMPXMediaArrayContents );
#endif
- MPX_DEBUG2("CVcxMyVideosMdsDb:: query contains %d items", aQuery.Count());
+ MPX_DEBUG2("CVcxMyVideosMdsDb:: query contains %d items", thisObj->iVideoQuery->Count());
MPX_DEBUG2("CVcxMyVideosMdsDb:: iVideoList contains %d items", array->Count());
- if (iActiveSchedulerWait->IsStarted())
+ if ( thisObj->iActiveSchedulerWait->IsStarted() )
{
- iActiveSchedulerWait->AsyncStop();
+ thisObj->iActiveSchedulerWait->AsyncStop();
}
- iVideoListFetchingIsOngoing = EFalse;
- iMdsDbObserver->HandleCreateVideoListResp( iVideoList, KErrNotFound /* KErrNotFound = no new items */,
+ thisObj->iVideoListFetchingIsOngoing = EFalse;
+ thisObj->iMdsDbObserver->HandleCreateVideoListResp( thisObj->iVideoList, KErrNotFound /* KErrNotFound = no new items */,
ETrue /* complete */);
- iVideoList = NULL; // not owned by us -> just clear
+ thisObj->iVideoList = NULL; // not owned by us -> just clear
+
+ thisObj->iCmdQueue->CmdFinished();
+ return KErrNone;
}
// ---------------------------------------------------------------------------
@@ -628,9 +678,9 @@
{
MPX_DEBUG2( "CVcxMyVideosMdsDb::HandleSessionOpened: %d", aError );
- iMDSError = aError;
- delete iMDSSession;
- iMDSSession = NULL;
+ iMdsError = aError;
+ delete iMdsSession;
+ iMdsSession = NULL;
}
}
@@ -662,9 +712,9 @@
MPX_DEBUG2( "CVcxMyVideosMdsDb::HandleSessionError: %d", aError );
- iMDSError = aError;
- delete iMDSSession;
- iMDSSession = NULL;
+ iMdsError = aError;
+ delete iMdsSession;
+ iMdsSession = NULL;
}
// ---------------------------------------------------------------------------
@@ -676,7 +726,7 @@
TObserverNotificationType aType,
const RArray& aObjectIdArray)
{
- TRAP( iMDSError, DoHandleObjectNotificationL( aType, aObjectIdArray ));
+ TRAP( iMdsError, DoHandleObjectNotificationL( aType, aObjectIdArray ));
}
// ---------------------------------------------------------------------------
@@ -685,20 +735,20 @@
//
CMdEObject* CVcxMyVideosMdsDb::ObjectL( const TItemId aId )
{
- if ( !iMDSSession )
+ if ( !iMdsSession )
{
- MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMDSError);
- User::Leave( iMDSError );
+ MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError);
+ User::Leave( iMdsError );
}
// If the id is not valid, just return NULL, because
- // iMDSSession->GetObjectL leaves in that case
+ // iMdsSession->GetObjectL leaves in that case
if ( aId == KNoId )
{
return NULL;
}
- CMdEObject* object = iMDSSession->GetObjectL( aId, *iVideoObjectDef );
+ CMdEObject* object = iMdsSession->GetObjectL( aId, *iVideoObjectDef );
if ( object )
{
@@ -1385,7 +1435,7 @@
MPX_FUNC( "CVcxMyVideosMdsDb::GetSchemaDefinitionsL" );
// Namespace
- iNamespaceDef = &(iMDSSession->GetDefaultNamespaceDefL());
+ iNamespaceDef = &(iMdsSession->GetDefaultNamespaceDefL());
// Default object definitions
iVideoObjectDef = &(iNamespaceDef->GetObjectDefL( KVcxVideoObjectName ));
@@ -1420,9 +1470,9 @@
iRatingPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
KVcxRatingPropertyName )); //19
iBitratePropertyDef = &(iVideoObjectDef->GetPropertyDefL(
- KVcxBitratePropertyName )); //20
+ KVcxBitratePropertyName )); //20
iAudioFourCcPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
- KVcxAudioFourCcPropertyName )); //21
+ KVcxAudioFourCcPropertyName )); //21
iWidthPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
KVcxWidthPropertyName )); //22
iHeightPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
diff -r dec420019252 -r 4f111d64a341 videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp Tue Feb 02 00:12:10 2010 +0200
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -11,12 +11,11 @@
*
* Contributors:
*
-* Description: Video list cache. Contains cached data from MDS.*
+* Description: Video list cache. Contains cached data from MDS.*
*/
-
// INCLUDE FILES
#include
#include
@@ -385,6 +384,8 @@
{
MPX_DEBUG2("CVcxMyVideosVideoCache:: MDSID(%d) not found from cache, ok", aMdsIds[j]);
+ //TODO: This doesnt work with new mds cmd queue. Cancel must be done if there is _any_ async req going on.
+ // Maybe the fetching could be changed to asynchronous...
if ( iCollection.iMyVideosMdsDb->iVideoListFetchingIsOngoing )
{
// If list fetching is not canceled, CreateVideoObjectL will leave with KErrNotReady.
@@ -588,7 +589,7 @@
TVcxMyVideosSortingOrder sortingOrder = SortingOrderL();
- if ( iCollection.iMyVideosMdsDb->iVideoListFetchingIsOngoing
+ if ( IsFetchingVideoList
&& sortingOrder == iLastSortingOrder && !aForce )
{
MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList creation is already ongoing, skipping");
@@ -599,10 +600,11 @@
{
MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList was partial or in wrong order or aForce was ETrue, recreating");
- if ( iCollection.iMyVideosMdsDb->iVideoListFetchingIsOngoing )
+ if ( IsFetchingVideoList )
{
MPX_DEBUG1("CVcxMyVideosVideoCache:: video list fetching is ongoing, canceling it");
- iCollection.iMyVideosMdsDb->Cancel();
+ iCollection.iMyVideosMdsDb->Cancel( CVcxMyVideosMdsDb::EGetVideoList );
+ IsFetchingVideoList = EFalse;
}
ResetVideoListL();
@@ -628,6 +630,7 @@
EFalse /* brief list */,
iVideoList /* use existing */ );
+ IsFetchingVideoList = ETrue;
iLastSortingOrder = sortingOrder;
iVideoListIsPartial = ETrue;
}
@@ -1030,7 +1033,7 @@
}
}
- // 23
+ // 22
if ( aVideo.IsSupported( KMPXMediaVideoHeight ) )
{
TUint16 height = aVideo.ValueTObjectL( KMPXMediaVideoHeight );
@@ -1491,7 +1494,8 @@
{
MPX_FUNC("CVcxMyVideosVideoCache::ResetVideoListL");
- iCollection.iMyVideosMdsDb->Cancel();
+ //TODO: when should we cancel...
+ //iCollection.iMyVideosMdsDb->Cancel();
CMPXMediaArray* mediaArray =
iVideoList->ValueCObjectL( KMPXMediaArrayContents );
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/conf/s60.confml
Binary file videocollection/videocollectionview/conf/s60.confml has changed
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/conf/videolistview.confml
Binary file videocollection/videocollectionview/conf/videolistview.confml has changed
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/conf/videolistview_2002BC63.crml
Binary file videocollection/videocollectionview/conf/videolistview_2002BC63.crml has changed
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/data/collectionview.docml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/collectionview.docml Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/data/images/mono_video_addvideos.svg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/images/mono_video_addvideos.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,30 @@
+
+
+
\ No newline at end of file
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/data/images/mono_video_removevideos.svg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/images/mono_video_removevideos.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,29 @@
+
+
+
\ No newline at end of file
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/data/images/mono_video_sortvideos.svg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/images/mono_video_sortvideos.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,31 @@
+
+
+
\ No newline at end of file
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/data/images/qtg_mono_video_all.svg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/images/qtg_mono_video_all.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,14 @@
+
+
+
+]>
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/data/images/qtg_mono_video_collection.svg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/images/qtg_mono_video_collection.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,16 @@
+
+
+
+]>
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/data/images/qtg_mono_video_services.svg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/images/qtg_mono_video_services.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,26 @@
+
+
+
+]>
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/data/images/services_icon.svg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/images/services_icon.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,26 @@
+
+
+
+]>
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/data/images/services_icon_pressed.svg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/images/services_icon_pressed.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,26 @@
+
+
+
+]>
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/data/videocollectionview.qrc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/videocollectionview.qrc Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,16 @@
+
+
+ collectionview.docml
+ videolistselectiondialog.docml
+
+
+ images/qtg_mono_video_all.svg
+ images/qtg_mono_video_collection.svg
+ images/qtg_mono_video_services.svg
+ images/mono_video_addvideos.svg
+ images/mono_video_removevideos.svg
+ images/mono_video_sortvideos.svg
+ images/services_icon.svg
+ images/services_icon_pressed.svg
+
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/data/videolistselectiondialog.docml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/videolistselectiondialog.docml Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/inc/videocollectionuiloader.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/inc/videocollectionuiloader.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#ifndef _VIDEOCOLLECTIONUILOADER_H_
+#define _VIDEOCOLLECTIONUILOADER_H_
+
+// System includes
+#include
+
+// Constants
+static const char* DOCML_VIDEOCOLLECTIONVIEW_FILE = ":/layout/collectionview.docml";
+static const char* DOCML_NAME_VIEW = "view";
+
+// Videocollection View
+static const char* DOCML_NAME_VC_HEADINGBANNER = "vc:mBanner";
+static const char* DOCML_NAME_VC_VIDEOLISTWIDGET = "vc:mListWidget";
+static const char* DOCML_NAME_VC_VIDEOHINTWIDGET = "vc:mHintWidget";
+
+// Videocollection Options Menu
+static const char* DOCML_NAME_OPTIONS_MENU = "vc:mOptionsMenu";
+static const char* DOCML_NAME_SORT_MENU = "vc:mSortBy";
+
+static const char* DOCML_NAME_SORT_BY_DATE = "vc:mDate";
+static const char* DOCML_NAME_SORT_BY_NAME = "vc:mName";
+static const char* DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS = "vc:mNumberOfItems";
+static const char* DOCML_NAME_SORT_BY_TOTAL_LENGTH = "vc:mTotalLength";
+static const char* DOCML_NAME_SORT_BY_RATING = "vc:mRating";
+static const char* DOCML_NAME_SORT_BY_SIZE = "vc:mSize";
+
+static const char* DOCML_NAME_ADD_TO_COLLECTION = "vc:mAddtoCollection";
+static const char* DOCML_NAME_CREATE_COLLECTION = "vc:mCreateNewCollection";
+static const char* DOCML_NAME_DELETE_MULTIPLE = "vc:mDeleteMultiple";
+
+static const char* DOCML_NAME_PLAY_IN_QUEUE = "vc:mPlayInQueue";
+static const char* DOCML_NAME_PLAY_ALL_ITEMS = "vc:mPlayAllItems";
+
+// Videocollection hint widget
+static const char* DOCML_NAME_HINT_BUTTON = "vc:mHintButton";
+static const char* DOCML_NAME_HINT_LABEL = "vc:mHintTextLabel";
+
+// video multiselection dialog
+static const char* DOCML_VIDEOSELECTIONDIALOG_FILE = ":/layout/videolistselectiondialog.docml";
+static const char* DOCML_NAME_DIALOG = "mMultiSelectionDialog";
+static const char* DOCML_NAME_DLG_HEADINGLBL = "mHeadingLabel";
+static const char* DOCML_NAME_MARKALL = "mCheckMarkAll";
+static const char* DOCML_NAME_LBL_SELECTION = "mSelectionCount";
+static const char* DOCML_NAME_LIST_CONTAINER = "mListContainer";
+
+
+// Class declaration
+class VideoCollectionUiLoader : public HbDocumentLoader
+{
+
+public:
+
+ VideoCollectionUiLoader();
+
+ ~VideoCollectionUiLoader();
+
+ /**
+ * Returns the requested widget casted to correct type
+ *
+ * @param name Name of the widget
+ * @return Pointer to the widget
+ */
+ template
+ T* findWidget( QString name )
+ {
+ return qobject_cast( HbDocumentLoader::findWidget( name ) );
+ }
+
+ /**
+ * Returns the requested object casted to correct type
+ *
+ * @param name Name of the object
+ * @return Pointer to the object
+ */
+ template
+ T* findObject( QString name )
+ {
+ return qobject_cast( HbDocumentLoader::findObject( name ) );
+ }
+
+private:
+
+ QObject *createObject( const QString& type, const QString &name );
+};
+
+#endif // _VIDEOCOLLECTIONUILOADER_H_
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/inc/videocollectionviewplugin.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/inc/videocollectionviewplugin.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2009 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: VideoCollectionViewPlugin class definition
+*
+*/
+
+#ifndef VIDEOVIEWPLUGIN_H
+#define VIDEOVIEWPLUGIN_H
+
+
+// INCLUDES
+#include
+#include
+#include
+
+class HbAction;
+class VideoCollectionUiLoader;
+class VideoListView;
+
+
+class VideoCollectionViewPlugin : public MpxViewPlugin
+ {
+
+ Q_OBJECT
+
+public: // Constructor / destructor
+
+ /**
+ * Contructor.
+ *
+ */
+ VideoCollectionViewPlugin();
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoCollectionViewPlugin();
+
+public: // from QViewPlugin
+
+ /**
+ * Allocates view and it's objects to be ready to
+ * be activated.
+ *
+ */
+ void createView();
+
+ /**
+ * Deallocates view and it's objects.
+ */
+ void destroyView();
+
+ /**
+ * Activates view
+ *
+ */
+ void activateView();
+
+ /**
+ * Deactivates view
+ *
+ */
+ void deactivateView();
+
+ /**
+ * Returns a pointer to the view
+ *
+ * @return QGraphicsWidget*
+ */
+ QGraphicsWidget* getView();
+
+signals:
+ /**
+ * Command signal, plugin user shoulf connect this in case it wants
+ * to receive commands emitted from the view.
+ *
+ * @param command id
+ */
+ void command( int );
+
+public slots: // from QViewPlugin
+
+ /**
+ * Plugin user can notify orientation changes by connecting into this slot
+ * ti it's signal. In normal cases, view handles orientation chages itself.
+ *
+ * @param orientation new orientation
+ */
+ void orientationChange( Qt::Orientation orientation );
+
+ /**
+ * Plugin user can notify oback button changes by connecting into this slot
+ *
+ */
+ void back();
+
+
+private:
+
+ /**
+ * docml ui loader, owned
+ */
+ VideoCollectionUiLoader *mUiLoader;
+
+ /**
+ * View object, owned
+ */
+ VideoListView *mView;
+
+ /**
+ * Activated flag. Set as true when view is properly activated.
+ * If flag is false, no operations can be do to the view.
+ */
+ bool mActivated;
+
+ };
+
+#endif // VIDEOVIEWPLUGIN_H
+
+// End of File
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/inc/videocollectionviewutils.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/inc/videocollectionviewutils.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* 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: video collection view plugin's ui utils class
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONVIEWUTILS_H__
+#define __VIDEOCOLLECTIONVIEWUTILS_H__
+
+#include
+
+class VideoCollectionViewUtils : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Returns singleton instance for this class.
+ *
+ * WARNING! Not safe to call this from destructor of another function scope static object!
+ *
+ * @return The singleton instance.
+ */
+ static VideoCollectionViewUtils& instance();
+
+ /**
+ * Saves the sorting role and order to cenrep.
+ *
+ * @param role The sorting role.
+ * @param order The sorting order (e.g. ascending or descending).
+ * @return Zero if operation succeeded, less than zero in error cases.
+ */
+ int saveSortingValues(int role, Qt::SortOrder order);
+
+ /**
+ * Loads the sorting role and order from cenrep.
+ *
+ * @param role On return contains the sorting role.
+ * @param order On return contains the sorting order
+ * @return Zero if operation succeeded, less than zero in error cases.
+ */
+ int loadSortingValues(int& role, Qt::SortOrder& order);
+
+ /**
+ * Get service icon resource strings from cenrep.
+ *
+ * @param icon On return contains the resource string for icon image.
+ * @param iconPressed On return contains the resource string for pressed icon image.
+ * @return Zero if operation succeeded, less than zero in error cases.
+ */
+ int getServiceIconStrings(QString& icon, QString& iconPressed);
+
+ /**
+ * Get service URI string.
+ *
+ * @return Service URI string. Invalid string in error cases.
+ */
+ QString getServiceUriString();
+
+public slots:
+
+ /**
+ * Shows status msgs
+ *
+ * @param statusCode status code
+ * @param additional additional data gotten from the status
+ */
+ void showStatusMsgSlot(int statusCode, QVariant &additional);
+
+private:
+
+ /**
+ * disables copy-constructor and assingment operator
+ */
+ Q_DISABLE_COPY(VideoCollectionViewUtils)
+
+ /**
+ * constructor
+ */
+ VideoCollectionViewUtils();
+
+ /**
+ * destructor
+ */
+ virtual ~VideoCollectionViewUtils();
+
+
+};
+
+#endif //__VIDEOCOLLECTIONUIUTILS_H__
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/inc/videohintwidget.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/inc/videohintwidget.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* 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 hint widget
+*
+*/
+
+
+#ifndef VIDEOHINTWIDGET_H
+#define VIDEOHINTWIDGET_H
+
+#include
+
+class HbPushButton;
+class HbLabel;
+class VideoCollectionUiLoader;
+class QGraphicsItem;
+
+/**
+ * Widget for displaying no videos text and possible hint and button for user
+ * find where to download new videos.
+ */
+class VideoHintWidget : public HbWidget
+{
+ Q_OBJECT
+
+public:
+
+ enum HintLevel {
+ AllVideos,
+ Collection
+ };
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ */
+ VideoHintWidget(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ ~VideoHintWidget();
+
+ /**
+ * Method creates colleciton wrapper, grid and list views,
+ * layout and activates correct view based on the current orientation
+ *
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int initialize();
+
+ /**
+ * Sets the level where the hint is correctly. Hint displays differently in
+ * for example collection level, than in allVideos level.
+ *
+ * @param level The current level.
+ */
+ void setLevel(HintLevel level);
+
+ /**
+ * Overridden from QGraphicsItem. Sets the visibility of this widget.
+ *
+ * @param visible true if widget is set visible, false othervise.
+ */
+ void setVisible(bool visible);
+
+private slots:
+
+ /**
+ * Method activates correct view based on the given orientation.
+ */
+ void orientationChangedSlot(Qt::Orientation orientation);
+
+private:
+
+ /**
+ * Method enables and displays current active view
+ *
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ void activate();
+
+ /**
+ * Method disables and hides current active view
+ */
+ void deactivate();
+
+ /**
+ * Shows/hides the correct UI components for current state.
+ */
+ void updateUiComponents();
+
+private:
+
+ Q_DISABLE_COPY(VideoHintWidget)
+
+ /**
+ * Pointer to the XML UI (DocML) loader, not owned
+ */
+ VideoCollectionUiLoader *mUiLoader;
+
+ /**
+ * Service button object.
+ */
+ HbPushButton *mServiceButton;
+
+ /**
+ * Hint text label (ie. the second row label).
+ */
+ HbLabel *mHintLabel;
+
+ /**
+ * Service icon resource string.
+ */
+ QString mServiceIconString;
+
+ /**
+ * Service icon pressed resource string.
+ */
+ QString mServiceIconPressedString;
+
+ /**
+ * Service icon.
+ */
+ HbIcon *mServiceIcon;
+
+ /**
+ * Current hint level.
+ */
+ HintLevel mCurrentLevel;
+
+};
+
+#endif // VIDEOHINTWIDGET_H
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/inc/videolistselectiondialog.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/inc/videolistselectiondialog.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,177 @@
+/*
+* 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
+*
+*/
+
+#ifndef VIDEOLISTSELECTIONDIALOG_H
+#define VIDEOLISTSELECTIONDIALOG_H
+
+#include
+#include
+#include
+
+class QGraphicItem;
+class QItemSelection;
+class HbLabel;
+class HbCheckBox;
+class HbStackedWidget;
+class VideoListWidget;
+class VideoCollectionUiLoader;
+class VideoSortFilterProxyModel;
+
+class VideoListSelectionDialog: public HbDialog
+{
+ /**
+ * definition required for emitting / connecting signals
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoListSelectionDialog)
+
+
+public:
+
+ /**
+ * Constructor
+ *
+ * @param uiLoader used to load UI components from docml
+ * @param parent item's parent component
+ */
+ VideoListSelectionDialog(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent=0);
+
+ /**
+ * Destructor
+ */
+ ~VideoListSelectionDialog();
+
+ /**
+ * Method setups provided title and videolist content widget.
+ * Prepares dialog for showing.
+ * If either provided title is empty or widget is NULL, dialog
+ * is in invalid state and cannot be shown using exec.
+ *
+ * @param title title of the dialog
+ * @param videoList videolist widget.
+ */
+ void setContent(const QString &title, VideoListWidget *videoList);
+
+ /**
+ * Returns selection (mSelection). Selection will be empty in case
+ * dialog is closed using cancell button,
+ *
+ * @return HbAction primary action if "OK" iis pressed
+ */
+ const QItemSelection& getSelection() const;
+
+public slots:
+
+ /**
+ * Shows modal dialog build from the provided Videolistwidget.
+ *
+ * @return HbAction primary action if "OK" iis pressed
+ */
+ HbAction* exec();
+
+private slots:
+
+ /**
+ * Slot connected to mCheckBox's stateChanged -signal.
+ * Selects or deselects all items if mForcedCheck -flag is false.
+ *
+ * If Forcedcehck is true, it indeicates that we want to change the checked state
+ * only, not slect or deselect anything. This is needed for example if after
+ * all items are marked, user manually deselects item's. In that case all is not
+ * marked, so checked state needs to be changed.
+ *
+ * @param state Qt::Checked everything should be set as selected.
+ */
+ void markAllStateChangedSlot(int state);
+
+ /**
+ * disables or enables popup's primary action in case selection changes
+ *
+ * @param selected item selection list containing selected
+ * @param deselected item selection list containing not selected (not used in this scope)
+ */
+ void selectionChangedSlot(const QItemSelection &selected, const QItemSelection &deselected);
+
+ /**
+ * Changes the counter value. Sets the checkbutton state based on selection count.
+ *
+ */
+ void updateCounterSlot();
+
+private:
+
+ /**
+ * connects all required signals into appropriate slots
+ * for selection mode
+ */
+ void connectSignals();
+
+ /**
+ * disconnects all signals
+ */
+ void disconnectSignals();
+
+private:
+
+ /**
+ * docml UI loader, not owned
+ */
+ VideoCollectionUiLoader *mUiLoader;
+
+ /**
+ * content videolist, not owned
+ */
+ VideoListWidget *mVideoList;
+
+ /**
+ * Selection
+ */
+ QItemSelection mSelection;
+
+ /**
+ * header label
+ */
+ HbLabel *mHeading;
+
+ /**
+ * counter label from docml
+ */
+ HbLabel *mItemCount;
+
+ /**
+ * mark all checkbox
+ */
+ HbCheckBox *mCheckBox;
+
+ /**
+ * videolist container in dialog
+ */
+ HbStackedWidget *mListContainer;
+
+ /**
+ * flag indicating that we've changed check-btn state
+ * explicitly and don't wanna handle selection based on that
+ */
+ bool mForcedCheck;
+
+};
+
+#endif //VIDEOLISTSELECTIONDIALOG_H
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/inc/videolistview.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/inc/videolistview.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,427 @@
+/*
+* 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 view class definition
+*
+*/
+
+
+#ifndef VIDEOLISTVIEW_H
+#define VIDEOLISTVIEW_H
+
+#include
+#include
+#include
+
+class QGraphicsItem;
+class VideoListWidget;
+class VideoHintWidget;
+class QActionGroup;
+class QVariant;
+class VideoCollectionViewUtils;
+class VideoSortFilterProxyModel;
+class VideoCollectionWrapper;
+class HbStackedWidget;
+class VideoCollectionUiLoader;
+class HbGroupBox;
+class VideoListSelectionDialog;
+class HbMenu;
+class VideoServices;
+
+
+/**
+ * Class acts as an container for widgets that are used to display different
+ * data: all videos, video collections or video services.
+ *
+ * Class is also responsible to mainatain correct widget active selected by the user's
+ * tap from the toolbar and creating and maintaining main menu commonly used by all widgets.
+ *
+ */
+class VideoListView : public HbView
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ * @param uiLoader VideoCollectionUiLoader instance for this view
+ * @param parent parent of this view
+ */
+ VideoListView(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ ~VideoListView();
+
+ /**
+ * Creates and initializes view objects, toolbar and menu and connects signals
+ *
+ * @return 0 if ok, < 0 if intialisation fails
+ */
+ int initializeView();
+
+ /**
+ * Activates current widget to be shown, enables menu and connects
+ * orientation change signals.
+ *
+ * @return 0 activation ok, < 0 if activation fails
+ */
+ int activateView();
+
+ /**
+ * Deactivates current widget, disables menu and disconnects
+ * orientation change signals.
+ *
+ */
+ void deactivateView();
+
+ /**
+ * Back implementation.
+ * Not used at the moment
+ *
+ */
+ void back();
+
+
+signals:
+
+ /**
+ * Command signal. Should be connected to the
+ * plugin interface's command -signal in order to
+ * get the emitted commands transported uotside plugin.
+ *
+ * @param int command id
+ */
+ void command(int);
+
+private slots:
+
+ /**
+ * slot is connected to model's modelReady -signal
+ */
+ void modelReadySlot();
+
+ /**
+ * slot is connected to service's titleReady -signal
+ */
+ void titleReadySlot(const QString& title);
+
+ /**
+ * Slot is connected to model slots informing changes in item count
+ * Method checks the current model state and updates accrodingly
+ *
+ */
+ void layoutChangedSlot();
+
+ /**
+ * Slot is connected into toolbar's all videos tab's
+ * triggered signal.
+ *
+ * Activates all videos widget by calling changeWidget.
+ *
+ */
+ void openAllVideosViewSlot();
+
+ /**
+ * Slot is connected into toolbar's video collection tab's
+ * triggered signal.
+ *
+ * Activates video collection widget by calling changeWidget.
+ *
+ */
+ void openCollectionViewSlot();
+
+ /**
+ * Slot is connected into toolbar's Service tab's
+ * triggered signal.
+ *
+ * Activates Service widget by calling changeWidget.
+ *
+ */
+ void openServicesViewSlot();
+
+ /**
+ * Slot is connected into main menus sort -items
+ * Method checks sorting role based on active menu item and starts sorting
+ *
+ */
+ void startSorting();
+
+ /**
+ * Slot is connected into main menus "delete items" (delete...) signal
+ *
+ * Calls ui utils to show multiple delete dialog for current widget
+ *
+ */
+ void deleteItemsSlot();
+
+ /**
+ * Slot is connected into main menus "Create new collection..." signal
+ * Shows a selection dialog for creating a new collection
+ *
+ */
+ void createCollectionSlot();
+
+ /**
+ * Slot is connected into toolbar's "Add videos" signal
+ *
+ */
+ void addVideosToCollectionSlot();
+
+ /**
+ * Slot is connected into main menus aboutToShow -signal
+ *
+ */
+ void aboutToShowMainMenuSlot();
+
+ /**
+ * Slot is connected into hbInstance's primary window's
+ * aboutToChangeOrientation -signal. This is called when
+ * orientation is to be change.
+ */
+ void aboutToChangeOrientationSlot();
+
+ /**
+ * Slot is connected into hbInstance's primary window's
+ * aboutToChangeOrientation -signal. This is called when
+ * orientation is changed.
+ *
+ * @param orientation new orientation
+ */
+ void orientationChangedSlot( Qt::Orientation orientation );
+
+ /**
+ * Slot is connected into viewdollectionwrapper's asyncStatus -signal
+ * If status is failed delete, refiltering is called to model before
+ * error message is shown.
+ *
+ * @param statusCode code of error
+ * @param additional additional data of status
+ */
+ void handleAsyncStatusSlot(int statusCode, QVariant &additional);
+
+ /**
+ * Slot is connected to videolistwidgets collectionOpened -signal
+ *
+ * @param collectionOpened
+ * @param collection contains the name of the collection opened
+ */
+ void collectionOpenedSlot(bool collectionOpened, const QString& collection);
+
+ /**
+ * Slot is connected into toolbar's sort by tab's
+ * triggered signal.
+ *
+ * Activates sort by popup menu.
+ *
+ */
+ void openSortByMenuSlot();
+
+ // TODO: following can be removed after all implementation ready
+ /**
+ * Slot is connected into item signals that are not yet implemented.
+ * Slot shows "Not yet implemented" note
+ */
+ void debugNotImplementedYet();
+
+private:
+
+ /**
+ * Cleans all possibly created objects from this. In some cases there are no quarantees
+ * that they were created correctly, and thus is better to start again from clean slate.
+ */
+ void cleanup();
+
+ /**
+ * Method creates 3 tabs for the view's toolbar: all videos, collections and Services.
+ * Tabs' icons are loaded and theiur triggered signals are connected into corresponding slots.
+ *
+ * @return 0 creation ok, < 0 creation fails
+ */
+ int createToolbar();
+
+ /**
+ * Creates action with given parameters. createActionGroup() must be called successfully
+ * before using this method.
+ *
+ * @param tooltip Tooltip text for the action.
+ * @param icon Filepath for the icon file.
+ * @param actionGroup Actiongroup for created action.
+ * @param slot Slot for the triggered signal of the action.
+ * @return HbAction pointer if creation ok, otherwise 0
+ */
+ HbAction* createAction(QString tooltip, QString icon, QActionGroup* actionGroup, const char *slot);
+
+ /**
+ * Method creates collection view's main menu and actions
+ *
+ * @return 0 creation ok, < 0 creation fails
+ */
+ int createMainMenu();
+
+ /**
+ * Method initialises all videos widget used to show all videos
+ * either in list or grid. Method also connects signals emitted by the view into
+ * corresponding slots.
+ *
+ * @return 0 creation ok, < 0 creation fails
+ */
+ int createVideoWidget();
+
+ /**
+ * Method initializes the mVideoHintWidget.
+ *
+ * @return 0 creation ok, < 0 creation fails.
+ */
+ int createHintWidget();
+
+ /**
+ * Shows or hides the hint. Only shows the hint if model does not have any
+ * items.
+ *
+ * @param show Set this to false if you want to force hide the hint.
+ */
+ void showHint(bool show = true);
+
+ /**
+ * Updates the sublabel text.
+ */
+ void updateSubLabel();
+
+private:
+
+ /**
+ * actions ids used in main menu and tool bar
+ */
+ enum TViewActionIds
+ {
+ EActionSortBy = 1,
+ EActionSortByDate,
+ EActionSortByName,
+ EACtionSortByItemCount,
+ EActionSortByLength,
+ EActionSortBySize,
+ EActionNewCollection,
+ EActionAddToCollection,
+ EActionDelete,
+ ETBActionAllVideos,
+ ETBActionCollections,
+ ETBActionServices,
+ ETBActionAddVideos,
+ ETBActionRemoveVideos,
+ ETBActionSortVideos
+ };
+
+
+ /**
+ * sort menu object.
+ */
+ HbMenu *mSortMenu;
+
+ /**
+ * reference to video collection view utils
+ */
+ VideoCollectionViewUtils &mUiUtils;
+
+ /**
+ * pointer to videocollectionwrapper
+ */
+ VideoCollectionWrapper *mWrapper;
+
+ /**
+ * Pointer to the XML UI (DocML) loader, not owned
+ */
+ VideoCollectionUiLoader* mUiLoader;
+
+ /**
+ * view model object.
+ */
+ VideoSortFilterProxyModel *mModel;
+
+ /**
+ * Boolean for knowing when the app was started as a service.
+ */
+ bool mIsService;
+
+ /**
+ * Boolean for knowing when the model is ready.
+ */
+ bool mModelReady;
+
+ /**
+ * HbGroupBox object loaded from docml
+ */
+ HbGroupBox* mSubLabel;
+
+ /**
+ * Options menu object loaded from docml
+ */
+ HbMenu* mOptionsMenu;
+
+ /**
+ * pointer to videoservices instance
+ */
+ VideoServices* mVideoServices;
+
+ /**
+ * Widget for showing all videos
+ */
+ VideoListWidget* mVideoListWidget;
+
+ /**
+ * Widget for showing the hint text.
+ */
+ VideoHintWidget* mVideoHintWidget;
+
+ /**
+ * Action group for the toolbar.
+ */
+ QActionGroup* mToolbarViewsActionGroup;
+
+ /**
+ * Action group for the toolbar.
+ */
+ QActionGroup* mToolbarCollectionActionGroup;
+
+ /**
+ * map containing pointers to main menu actions
+ */
+ QMap mMenuActions;
+
+ /**
+ * map containing toolbar actions
+ */
+ QMap mToolbarActions;
+
+ /**
+ * Soring roles mapped to appropriate actions.
+ */
+ QMap mSortingRoles;
+
+ /**
+ * String containing the name of the currently open collection
+ */
+ QString mCollectionName;
+
+ /**
+ * selection dialog
+ */
+ VideoListSelectionDialog *mSelectionDialog;
+
+};
+
+#endif // VIDEOLISTVIEW_H
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/inc/videolistwidget.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/inc/videolistwidget.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,347 @@
+/*
+* 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 content widget
+*
+*/
+
+
+#ifndef VIDEOLISTWIDGET_H
+#define VIDEOLISTWIDGET_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+class VideoSortFilterProxyModel;
+class HbAction;
+class HbMenu;
+class QTimer;
+
+class QItemSelection;
+class VideoServices;
+
+/**
+ * Widget for displaying all videos, either using list- or grid view.
+ * Widget contains 2 widgets to be used for different orientation in the stacked layout.
+ *
+ * Depending on the orientation and it's change, corresponding view is set active.
+ *
+ */
+class VideoListWidget : public HbListView
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(VideoListWidget)
+public:
+
+ enum TVideoListLevel
+ {
+ ELevelCategory = 2,
+ ELevelVideos = 3
+ };
+
+ enum TVideoListType
+ {
+ EUnknown,
+ EAllVideos, // list displaying all videos
+ ECollections, // list displaying all collections
+ EDefaultColItems, // list displying videos in default collection
+ EUserColItems // list displaying videos in user defined collection
+ };
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ */
+ VideoListWidget(HbView *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoListWidget();
+
+ /**
+ * Method creates colleciton wrapper, grid and list views,
+ * layout and activates correct view based on the current orientation
+ *
+ * @param model Model for this list view.
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int initialize(VideoSortFilterProxyModel &model, VideoServices* videoServices = 0);
+
+ /**
+ * Method enables and displays current active view
+ *
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int activate();
+
+ /**
+ * Method enables and displays current active view
+ *
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int activate(VideoListWidget::TVideoListLevel role);
+
+ /**
+ * Method disables and hides current active view
+ *
+ */
+ void deactivate();
+
+ /**
+ * Used for resolving widget's current type
+ *
+ * @return TVideoListType current level.
+ */
+ TVideoListType getType();
+
+ /**
+ * returns widget's model
+ *
+ * @return VideoSortFilterProxyModel*
+ */
+ VideoSortFilterProxyModel& getModel();
+
+protected:
+
+ /**
+ * Called by the fw when some item is tapped. Method check that
+ * index is valid and calls open item for collectionwrapper to
+ * open media object throught collection.
+ *
+ * @param midelIndex, item's index
+ */
+ void emitActivated (const QModelIndex &modelIndex);
+
+signals:
+
+ /**
+ * Command signal.
+ *
+ * @param int command id
+ */
+ void command(int);
+
+ /**
+ * Signals collection view's state. Used to indicate
+ * view incase some collection item is opened
+ *
+ * @param true if opened, false if closed.
+ * @param optional name string
+ */
+ void collectionOpened(bool, const QString&);
+
+ /**
+ * signal is connected to service's itemSelected -slot
+ */
+ void fileUri(const QString&);
+
+protected slots:
+ /**
+ * Signaled by the fw during long press and indicating that popupmenu
+ * concerning particular item is to be opened.
+ * Saves current selected item's index to mCurrentIndex
+ */
+ void longPressGesture (const QPointF &point);
+
+private slots:
+
+ /**
+ * Signaled for item share.
+ *
+ */
+ void shareItemSlot();
+
+ /**
+ * Signaled for one item deletion.
+ *
+ */
+ void deleteItemSlot();
+
+ /**
+ * Signaled for item rename.
+ *
+ */
+ void renameSlot();
+
+ /**
+ * Signaled to play all items.
+ *
+ */
+ void playAllSlot();
+
+ /**
+ * Signaled to add an item into currently open collection.
+ *
+ */
+ void addItemSlot();
+
+ /**
+ * Signaled to add an item into a collection.
+ *
+ */
+ void addToCollectionSlot();
+
+ /**
+ * Signaled when details will be selected from the videolist's
+ * context menu. Maps mCurrentIndex to model's source index and
+ * calls collection wrapper to open details
+ *
+ */
+ void openDetailsSlot();
+
+ /**
+ * Signaled when the application has been lauched as a service and
+ * playback is initialized from context menu.
+ *
+ */
+ void playItemSlot();
+
+ /**
+ * Signaled when stepping back from collection in collection view
+ *
+ */
+ void back();
+
+ /**
+ * Signaled when view scrolling ends, initiates thumbnail fetching
+ * at index of first visible item.
+ *
+ */
+ void scrollingEndedSlot();
+
+ /**
+ * Signaled when view scroll position changes, initiates timer to
+ * fetch thumbnails at index of first visible item.
+ */
+ void scrollPositionChangedSlot(const QPointF &newPosition);
+
+ // TODO: following can be removed after all implementation ready
+ /**
+ * Slot is connected into item signals that are not yet implemented.
+ * Slot shows "Not yet implemented" note
+ */
+ void debugNotImplementedYet();
+
+private:
+
+ enum TContextActionIds
+ {
+ EActionShare = 1,
+ EActionDelete,
+ EActionDetails,
+ EACtionRemoveFromCollection,
+ EACtionAddToCollection,
+ EACtionRemoveCollection,
+ EActionAddVideos,
+ EActionRename,
+ EActionSetThumb,
+ EActionPlay
+ };
+
+ /**
+ * Method creates popup menu for list items.
+ *
+ */
+ void createContextMenu();
+
+ /**
+ * Method sets correct popup menu for specific list items.
+ *
+ */
+ void setContextMenu(bool isDefaultCollection);
+
+ /**
+ * Method connects signals needed by the widget
+ *
+ * @return int 0 if connect ok, < 0 if connect fails
+ */
+ int connectSignals();
+
+ /**
+ * Method disconnects signals needed by the widget
+ *
+ */
+ void disConnectSignals();
+
+private:
+
+ /**
+ * Provided model
+ * Not own.
+ */
+ VideoSortFilterProxyModel *mModel;
+
+ /**
+ * pointer to videoservices instance
+ */
+ VideoServices* mVideoServices;
+
+ /**
+ * map containing pointers to main menu actions
+ */
+ QMap mContextMenuActions;
+
+ /**
+ * current level indicating content currently showing:
+ * category or videos
+ */
+ VideoListWidget::TVideoListLevel mCurrentLevel;
+
+ /**
+ * True if signals have been connected
+ */
+ bool mSignalsConnected;
+
+ /**
+ * True if details plugin is ready
+ */
+ bool mDetailsReady;
+
+ /**
+ * Boolean for knowing when the app was started as a service.
+ */
+ bool mIsService;
+
+ /**
+ * Secondary softkey action object
+ */
+ HbAction *mSecSkAction;
+
+ /**
+ * Item sensitive context menu
+ */
+ HbMenu *mContextMenu;
+
+ /**
+ * Last opened item id is saved when collection is opened from the
+ * collections -list. Value used to indentify the type of list.
+ */
+ TMPXItemId mLastOpenItemId;
+
+ /**
+ * Timer used to report thumbnail fetches class index of
+ * first visible item when view is scrolling.
+ */
+ QTimer *mScrollPositionTimer;
+};
+
+#endif // VIDEOLISTWIDGET_H
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/src/videocollectionuiloader.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videocollectionuiloader.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#include "videocollectionuiloader.h"
+#include "videolistview.h"
+#include "videolistselectiondialog.h"
+#include "videolistwidget.h"
+#include "videohintwidget.h"
+
+// ---------------------------------------------------------------------------
+// VideoCollectionUiLoader
+// ---------------------------------------------------------------------------
+//
+VideoCollectionUiLoader::VideoCollectionUiLoader() :
+ HbDocumentLoader()
+{
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoCollectionUiLoader
+// ---------------------------------------------------------------------------
+//
+VideoCollectionUiLoader::~VideoCollectionUiLoader()
+{
+}
+
+// ---------------------------------------------------------------------------
+// createObject
+// ---------------------------------------------------------------------------
+//
+QObject* VideoCollectionUiLoader::createObject( const QString& type, const QString &name )
+{
+ QObject* object = 0;
+
+ if ( type == VideoListView::staticMetaObject.className() )
+ {
+ object = new VideoListView(this);
+ }
+ else if ( type == VideoListSelectionDialog::staticMetaObject.className() )
+ {
+ object = new VideoListSelectionDialog(this);
+ }
+ else if ( type == VideoListWidget::staticMetaObject.className() )
+ {
+ object = new VideoListWidget();
+ }
+ else if ( type == VideoHintWidget::staticMetaObject.className() )
+ {
+ object = new VideoHintWidget(this);
+ }
+ if ( object )
+ {
+ object->setObjectName( name );
+ return object;
+ }
+
+ return HbDocumentLoader::createObject( type, name );
+}
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/src/videocollectionviewplugin.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videocollectionviewplugin.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2009 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: VideoCollectionViewPlugin class implementation
+*
+*/
+
+// INCLUDE FILES
+#include
+#include
+#include
+#include
+
+#include "videocollectionviewplugin.h"
+#include "videolistview.h"
+#include "videocollectionuiloader.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewPlugin::VideoCollectionViewPlugin()
+ : mUiLoader(0),
+ mView(0),
+ mActivated(false)
+{
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewPlugin::~VideoCollectionViewPlugin()
+{
+ destroyView();
+}
+
+// ---------------------------------------------------------------------------
+// Create view
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewPlugin::createView()
+{
+ mActivated = false;
+ if ( !mView ) {
+
+ if(!mUiLoader)
+ {
+ mUiLoader = new VideoCollectionUiLoader();
+ }
+
+ mUiLoader->reset();
+
+ bool ok(false);
+
+ QList objects = mUiLoader->load(DOCML_VIDEOCOLLECTIONVIEW_FILE, &ok);
+
+ if (!ok)
+ {
+ return;
+ }
+
+ mView = mUiLoader->findObject( DOCML_NAME_VIEW );
+
+ if(!mView)
+ {
+ // TODO: handle error: creating view
+ return;
+ }
+
+ if(!connect( mView, SIGNAL(command(int)), this, SIGNAL(command(int)) ) ) {
+ // TODO: handle error: connecting signal
+ delete mView;
+ mView = 0;
+ return;
+ }
+
+ mView->initializeView();
+
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Destroy view
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewPlugin::destroyView()
+{
+ deactivateView();
+ disconnect();
+
+ delete mView;
+ mView = 0;
+ delete mUiLoader;
+ mUiLoader = 0;
+}
+
+// ---------------------------------------------------------------------------
+// Activate view
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewPlugin::activateView()
+{
+ if ( !mActivated ) {
+ HbMainWindow *wnd = mView->mainWindow();
+ if(wnd)
+ {
+ mView->activateView();
+ mActivated = true;
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Deactivate view
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewPlugin::deactivateView()
+{
+ if ( mActivated ) {
+ mView->deactivateView();
+ mActivated = false;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Get view
+// ---------------------------------------------------------------------------
+//
+QGraphicsWidget* VideoCollectionViewPlugin::getView()
+{
+ return mView;
+}
+
+// ---------------------------------------------------------------------------
+// Slot: Orientation change
+// // TODO: can be removed
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewPlugin::orientationChange( Qt::Orientation /* orientation */ )
+{
+ // view handles orientation individually
+}
+
+// ---------------------------------------------------------------------------
+// Slot: back
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewPlugin::back()
+{
+ if ( mActivated ) {
+ mView->back();
+ }
+}
+
+XQ_EXPORT_PLUGIN2( videocollectionview, VideoCollectionViewPlugin );
+
+// end of file
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/src/videocollectionviewutils.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videocollectionviewutils.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2009 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: video collection view plugin's ui utils class
+*
+*/
+
+#include
+#include
+#include
+
+#include "videocollectioncommon.h"
+#include "videocollectionviewutils.h"
+
+const int KVideoCollectionViewCenrepUid(0x2002BC63);
+const int KVideoCollectionViewCenrepServiceIconKey(0x2);
+const int KVideoCollectionViewCenrepServiceIconPressedKey(0x3);
+const int KVideoCollectionViewCenrepServiceUriKey(0x4);
+const int KVideoCollectionViewCenrepSortingRoleKey(0x5);
+const int KVideoCollectionViewCenrepSortingOrderKey(0x6);
+
+// ---------------------------------------------------------------------------
+// instance
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewUtils& VideoCollectionViewUtils::instance()
+{
+ static VideoCollectionViewUtils _popupInstance;
+ return _popupInstance;
+}
+
+// ---------------------------------------------------------------------------
+// VideoCollectionViewUtils
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewUtils::VideoCollectionViewUtils()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoCollectionViewUtils
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewUtils::~VideoCollectionViewUtils()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// saveSortingValues
+// ---------------------------------------------------------------------------
+//
+int VideoCollectionViewUtils::saveSortingValues(int role, Qt::SortOrder order)
+{
+ int status = -1;
+ CRepository *cenRep = 0;
+ TRAP_IGNORE(cenRep = CRepository::NewL(TUid::Uid(KVideoCollectionViewCenrepUid)));
+ if(cenRep)
+ {
+ status = cenRep->Set(KVideoCollectionViewCenrepSortingRoleKey, static_cast(role));
+ if(status == KErrNone)
+ {
+ status = cenRep->Set(KVideoCollectionViewCenrepSortingOrderKey, static_cast(order));
+ }
+ delete cenRep;
+ }
+ return status;
+}
+
+// ---------------------------------------------------------------------------
+// loadSortingValues
+// ---------------------------------------------------------------------------
+//
+int VideoCollectionViewUtils::loadSortingValues(int& role, Qt::SortOrder& order)
+{
+ int status = -1;
+ CRepository *cenRep = 0;
+ TRAP_IGNORE(cenRep = CRepository::NewL(TUid::Uid(KVideoCollectionViewCenrepUid)));
+ if(cenRep)
+ {
+ TInt roleValue(KErrNotFound);
+ TInt orderValue(KErrNotFound);
+ status = cenRep->Get(KVideoCollectionViewCenrepSortingRoleKey, roleValue);
+ if(status == KErrNone)
+ {
+ status = cenRep->Get(KVideoCollectionViewCenrepSortingOrderKey, orderValue);
+ if(status == KErrNone)
+ {
+ role = roleValue;
+ order = static_cast(orderValue);
+ }
+ }
+ delete cenRep;
+ }
+ return status;
+}
+
+// ---------------------------------------------------------------------------
+// getServiceIconStrings
+// ---------------------------------------------------------------------------
+//
+int VideoCollectionViewUtils::getServiceIconStrings(QString& icon,
+ QString& iconPressed)
+{
+ int status = -1;
+ CRepository *cenRep = 0;
+ TRAP_IGNORE(cenRep = CRepository::NewL(TUid::Uid(KVideoCollectionViewCenrepUid)));
+ if(cenRep)
+ {
+ TBuf<255> iconValue;
+ TBuf<255> pressedValue;
+ status = cenRep->Get(KVideoCollectionViewCenrepServiceIconKey, iconValue);
+ if(status == KErrNone)
+ {
+ status = cenRep->Get(KVideoCollectionViewCenrepServiceIconPressedKey, pressedValue);
+ if(status == KErrNone)
+ {
+ QString iconTemp((QChar*)iconValue.Ptr(),iconValue.Length());
+ QString pressedTemp((QChar*)pressedValue.Ptr(),pressedValue.Length());
+
+ icon = iconTemp;
+ iconPressed = pressedTemp;
+ }
+ }
+ delete cenRep;
+ }
+ return status;
+}
+
+// ---------------------------------------------------------------------------
+// getServiceUriString
+// ---------------------------------------------------------------------------
+//
+QString VideoCollectionViewUtils::getServiceUriString()
+{
+ QString uri;
+ CRepository *cenRep = 0;
+ TRAP_IGNORE(cenRep = CRepository::NewL(TUid::Uid(KVideoCollectionViewCenrepUid)));
+ if(cenRep)
+ {
+ TBuf<255> uriValue;
+ if(cenRep->Get(KVideoCollectionViewCenrepServiceIconKey, uriValue) == KErrNone)
+ {
+ QString uriTemp((QChar*)uriValue.Ptr(),uriValue.Length());
+ uri = uriTemp;
+ }
+ delete cenRep;
+ }
+ return uri;
+}
+
+// ---------------------------------------------------------------------------
+// showStatusMsgSlot
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewUtils::showStatusMsgSlot(int statusCode, QVariant &additional)
+{
+ QString msg("");
+ bool error(true);
+ if(statusCode == VideoCollectionCommon::statusSingleDeleteFail)
+ {
+ QString format = tr("Unable to delete item %1. It is currently open.");
+ if(additional.isValid())
+ {
+ msg = format.arg(additional.toString());
+ }
+ }
+ else if(statusCode == VideoCollectionCommon::statusMultipleDeleteFail)
+ {
+ msg = tr("Unable to delete some items which are currently open.");
+ }
+ else if(statusCode == VideoCollectionCommon::statusMultipleDeleteSucceed)
+ {
+ QString format = tr("%1 videos deleted");
+ if(additional.isValid())
+ {
+ msg = format.arg(additional.toString());
+ }
+ error = false;
+ }
+
+ if(msg.count() > 0)
+ {
+ if(error)
+ {
+ HbMessageBox::warning(msg);
+ }
+ else
+ {
+ HbMessageBox::information(msg);
+ }
+
+ }
+}
+
+
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/src/videohintwidget.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videohintwidget.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,161 @@
+/*
+* 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 content widget implementation
+*
+*/
+
+#include
+#include
+#include
+#include
+
+#include "videohintwidget.h"
+#include "videocollectionuiloader.h"
+#include "videocollectionviewutils.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoHintWidget::VideoHintWidget(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent) :
+HbWidget(parent),
+mUiLoader(uiLoader),
+mServiceButton(0),
+mHintLabel(0),
+mServiceIcon(0),
+mCurrentLevel(AllVideos)
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoHintWidget::~VideoHintWidget()
+{
+ delete mServiceIcon;
+}
+
+// ---------------------------------------------------------------------------
+// initialize
+// ---------------------------------------------------------------------------
+//
+int VideoHintWidget::initialize()
+{
+ mServiceButton = mUiLoader->findWidget(DOCML_NAME_HINT_BUTTON);
+ mHintLabel = mUiLoader->findWidget(DOCML_NAME_HINT_LABEL);
+ if(!mServiceButton || !mHintLabel)
+ {
+ return -1;
+ }
+
+ VideoCollectionViewUtils& utils = VideoCollectionViewUtils::instance();
+ return utils.getServiceIconStrings(mServiceIconString, mServiceIconPressedString);
+}
+
+// ---------------------------------------------------------------------------
+// setLevel
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::setLevel(HintLevel level)
+{
+ mCurrentLevel = level;
+ if(isVisible()) {
+ updateUiComponents();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// setVisible
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::setVisible(bool visible)
+{
+ HbWidget::setVisible(visible);
+
+ if(visible) {
+ activate();
+ } else {
+ deactivate();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// orientationChanged
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::orientationChangedSlot(Qt::Orientation /*targetOrientation*/)
+{
+ updateUiComponents();
+}
+
+// ---------------------------------------------------------------------------
+// activate
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::activate()
+{
+ if(mServiceIconString.isNull() || mServiceIconString.isEmpty() ||
+ mServiceIconPressedString.isNull() || mServiceIconPressedString.isEmpty())
+ {
+ return;
+ }
+
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+ connect(mainWnd, SIGNAL(orientationChanged(Qt::Orientation)),
+ this, SLOT(orientationChangedSlot(Qt::Orientation)));
+
+ mServiceIcon = new HbIcon(mServiceIconString);
+ mServiceIcon->setIconName(mServiceIconPressedString, QIcon::Normal, QIcon::On);
+
+ updateUiComponents();
+}
+
+// ---------------------------------------------------------------------------
+// deactivate
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::deactivate()
+{
+ disconnect(this, SLOT(orientationChangedSlot(Qt::Orientation)));
+
+ mServiceButton->setIcon(HbIcon());
+ if(mServiceIcon) {
+ delete mServiceIcon;
+ mServiceIcon = 0;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// updateUiComponents
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::updateUiComponents()
+{
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+ mServiceButton->setVisible(mainWnd->orientation() == Qt::Horizontal);
+
+ if(mCurrentLevel == Collection) {
+ mHintLabel->setVisible(false);
+ mServiceButton->setIcon(HbIcon());
+ mServiceButton->setText(tr("Add videos"));
+ } else {
+ mHintLabel->setVisible(true);
+ mServiceButton->setText(QString());
+ mServiceButton->setIcon(*mServiceIcon);
+ }
+}
+
+// end of file
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/src/videolistselectiondialog.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videolistselectiondialog.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,293 @@
+/*
+* 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
+*
+*/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include "videocollectionuiloader.h"
+#include "videolistwidget.h"
+#include "videosortfilterproxymodel.h"
+#include "videolistselectiondialog.h"
+
+// ---------------------------------------------------------------------------
+// VideoListSelectionDialog
+// ---------------------------------------------------------------------------
+//
+VideoListSelectionDialog::VideoListSelectionDialog(VideoCollectionUiLoader *uiLoader,
+ QGraphicsItem *parent) :
+HbDialog(parent),
+mUiLoader(uiLoader),
+mVideoList(0),
+mHeading(0),
+mItemCount(0),
+mCheckBox(0),
+mListContainer(0),
+mForcedCheck(false)
+{
+ setDismissPolicy(HbDialog::NoDismiss);
+ setTimeout(HbDialog::NoTimeout);
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoListSelectionDialog
+// ---------------------------------------------------------------------------
+//
+VideoListSelectionDialog::~VideoListSelectionDialog()
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// getSelection
+// ---------------------------------------------------------------------------
+//
+const QItemSelection& VideoListSelectionDialog::getSelection() const
+{
+ return mSelection;
+}
+
+// ---------------------------------------------------------------------------
+// setContent
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::setContent(const QString &title, VideoListWidget *videoList)
+{
+ mSelection.clear();
+ if(!videoList || title.isEmpty())
+ {
+ mVideoList = 0;
+ return;
+ }
+
+ mVideoList = videoList;
+ if(!mHeading)
+ {
+ mHeading = mUiLoader->findWidget(DOCML_NAME_DLG_HEADINGLBL);
+ }
+ mHeading->setPlainText(title);
+ if(!mItemCount)
+ {
+ mItemCount = mUiLoader->findWidget(DOCML_NAME_LBL_SELECTION);
+ mItemCount->setAlignment(Qt::AlignRight);
+ }
+ mItemCount->setPlainText(tr("0/%1").arg(mVideoList->getModel().rowCount()));
+
+ if(!mCheckBox)
+ {
+ mCheckBox = mUiLoader->findWidget(DOCML_NAME_MARKALL);
+ }
+ mCheckBox->setChecked(false);
+
+ if(!primaryAction())
+ {
+ setPrimaryAction(new HbAction(tr("OK"), this));
+ }
+ primaryAction()->setDisabled(true);
+ if(!secondaryAction())
+ {
+ setSecondaryAction(new HbAction(tr("Cancel"), this));
+ }
+
+}
+
+// ---------------------------------------------------------------------------
+// exec
+// ---------------------------------------------------------------------------
+//
+HbAction* VideoListSelectionDialog::exec()
+{
+ mSelection.clear();
+ if(!mVideoList)
+ {
+ return 0;
+ }
+
+ // setup content of the popup
+ mVideoList->setSelectionMode(HbAbstractItemView::MultiSelection);
+
+ // clear parent layout item from our widget to be able to insert it
+ // to the stackedWidget child
+ QGraphicsLayoutItem *currenParentLayout = mVideoList->parentLayoutItem();
+ QGraphicsItem *currentParentItem = mVideoList->parentItem();
+ mVideoList->setParentLayoutItem(0);
+
+ if(!mListContainer)
+ {
+ mListContainer = mUiLoader->findWidget(DOCML_NAME_LIST_CONTAINER);
+ }
+ mListContainer->addWidget(mVideoList);
+
+ connectSignals();
+
+ // Launch popup syncronously
+ bool accepted = false;
+ HbDialog::exec() == primaryAction() ? accepted = true : accepted = false;
+
+ disconnectSignals();
+
+ // remove out widget from stacked before poptup is to be destroyed to make sure
+ // our widget does not get deleted
+ mListContainer->removeAt(0);
+
+ // restore widget's original parent and layout.
+ mVideoList->setParentItem(currentParentItem);
+ mVideoList->setParentLayoutItem(currenParentLayout);
+
+ mVideoList->setSelectionMode(HbAbstractItemView::NoSelection);
+
+ currentParentItem->setVisible(true);
+ mVideoList->setVisible(true);
+
+ if(!accepted)
+ {
+ mSelection.clear();
+ return secondaryAction();
+ }
+ return primaryAction();
+
+}
+
+// ---------------------------------------------------------------------------
+// markAllStateChanged
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::markAllStateChangedSlot(int state)
+{
+ if(!mVideoList)
+ {
+ return;
+ }
+
+ if(mForcedCheck)
+ {
+ return;
+ }
+ if( state == Qt::Checked)
+ {
+ mVideoList->selectAll();
+ }
+ else
+ {
+ mVideoList->clearSelection();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// selectionChangedSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::selectionChangedSlot(const QItemSelection &selected, const QItemSelection &deselected)
+{
+
+ if(!primaryAction())
+ {
+ return;
+ }
+ if(selected.indexes().count() > 0)
+ {
+ mSelection.merge(selected, QItemSelectionModel::Select);
+ }
+
+ if(deselected.indexes().count() > 0)
+ {
+ mSelection.merge(deselected, QItemSelectionModel::Deselect);
+ }
+
+ if(mSelection.indexes().count() > 0)
+ {
+ primaryAction()->setDisabled(false);
+ }
+ else
+ {
+ primaryAction()->setDisabled(true);
+ }
+
+ updateCounterSlot();
+}
+
+// ---------------------------------------------------------------------------
+// updateCounterSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::updateCounterSlot()
+{
+ if(!mVideoList || !mItemCount)
+ {
+ return;
+ }
+ // orbit does not update HbLabel read from docml in case it isn't cleared first
+ int rowCount = mVideoList->getModel().rowCount();
+ int selectionCount = mSelection.indexes().count();
+ mItemCount->setPlainText(tr("%1/%2").arg(selectionCount).arg(rowCount));
+
+ mForcedCheck = true;
+ if(selectionCount == rowCount && rowCount > 0)
+ {
+ mCheckBox->setChecked(true);
+ }
+ else
+ {
+ mCheckBox->setChecked(false);
+ }
+ mForcedCheck = false;
+
+}
+
+// ---------------------------------------------------------------------------
+// connectSignals
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::connectSignals()
+{
+ // selection changes
+ connect(mVideoList->selectionModel(), SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)),
+ this, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection &)));
+
+ // model changes signals
+ connect(&(mVideoList->getModel()), SIGNAL(layoutChanged()), this, SLOT(updateCounterSlot()));
+ connect(&(mVideoList->getModel()), SIGNAL(rowsInserted(const QModelIndex&, int, int)), this, SLOT(updateCounterSlot()));
+ connect(&(mVideoList->getModel()), SIGNAL(rowsRemoved(const QModelIndex&, int, int)), this, SLOT(updateCounterSlot()));
+
+ // mark all state changes
+ connect(mCheckBox, SIGNAL(stateChanged(int)), this, SLOT(markAllStateChangedSlot(int)));
+
+}
+
+// ---------------------------------------------------------------------------
+// disconnectSignals
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::disconnectSignals()
+{
+
+ disconnect(mVideoList->selectionModel(), SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)),
+ this, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection &)));
+
+ // model changes signals
+ disconnect(&(mVideoList->getModel()), SIGNAL(layoutChanged()), this, SLOT(updateCounterSlot()));
+ disconnect(&(mVideoList->getModel()), SIGNAL(rowsInserted(const QModelIndex&, int, int)), this, SLOT(updateCounterSlot()));
+ disconnect(&(mVideoList->getModel()), SIGNAL(rowsRemoved(const QModelIndex&, int, int)), this, SLOT(updateCounterSlot()));
+
+ // mark all state changes
+ disconnect(mCheckBox, SIGNAL(stateChanged(int)), this, SLOT(markAllStateChangedSlot(int)));
+
+}
+
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/src/videolistview.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videolistview.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,968 @@
+/*
+* Copyright (c) 2009 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 view class source code
+*
+*/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "videoservices.h"
+#include "videolistselectiondialog.h"
+#include "videocollectionviewutils.h"
+#include "videolistwidget.h"
+#include "videohintwidget.h"
+#include "videolistview.h"
+#include "videocollectioncommon.h"
+#include "videocollectionwrapper.h"
+#include "videosortfilterproxymodel.h"
+#include "videocollectionuiloader.h"
+
+// remove these
+#include
+
+const int VIDEO_LIST_VIEW_OPTION_MENU_COUNT = 4;
+const int VIDEO_LIST_VIEW_SORT_MENU_COUNT = 5;
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoListView::VideoListView(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent) :
+HbView(parent),
+mSortMenu(0),
+mUiUtils(VideoCollectionViewUtils::instance()),
+mWrapper(VideoCollectionWrapper::instance()),
+mUiLoader(uiLoader),
+mModel(0),
+mIsService(false),
+mModelReady(false),
+mSubLabel(0),
+mOptionsMenu(0),
+mVideoServices(0),
+mVideoListWidget(0),
+mVideoHintWidget(0),
+mToolbarViewsActionGroup(0),
+mToolbarCollectionActionGroup(0),
+mSelectionDialog(0)
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoListView::~VideoListView()
+{
+ qDebug() << "VideoListView::~VideoListView()";
+ delete mSelectionDialog;
+ // widgets' destructors are being called throught
+ // orbit framework. No need to remove them here.
+ mMenuActions.clear();
+ mToolbarActions.clear();
+ mSortingRoles.clear();
+
+ if(mVideoServices)
+ {
+ mVideoServices->decreaseReferenceCount();
+ mVideoServices = 0;
+ }
+
+ if(mWrapper)
+ {
+ mWrapper->decreaseReferenceCount();
+ mWrapper = 0;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// initializeView()
+// ---------------------------------------------------------------------------
+//
+int VideoListView::initializeView()
+{
+ if(!mUiLoader)
+ {
+ return -1;
+ }
+
+ if (XQServiceUtil::isService() && !mVideoServices)
+ {
+ mIsService = true;
+
+ mVideoServices = VideoServices::instance();
+
+ if (!mVideoServices)
+ {
+ return -1;
+ }
+ else
+ {
+ connect(mVideoServices, SIGNAL(titleReady(const QString&)), this, SLOT(titleReadySlot(const QString&)));
+ }
+ }
+
+ // create model
+ if(mWrapper)
+ {
+ mModel = mWrapper->getModel();
+ }
+
+ if(!mModel || mModel->open(VideoListWidget::ELevelVideos) < 0)
+ {
+ cleanup();
+ return -1;
+ }
+
+ int sortRole(VideoCollectionCommon::KeyDateTime);
+ Qt::SortOrder sortOrder(Qt::AscendingOrder);
+
+ // return value ignored, as in case of error the sortRole and sortOrder variables
+ // stay at their predefined values, and in error cases those are the sorting values
+ // that are used.
+ mUiUtils.loadSortingValues(sortRole, sortOrder);
+
+ mModel->doSorting(sortRole, sortOrder, false);
+
+ mOptionsMenu = mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU);
+
+ if(!mOptionsMenu)
+ {
+ cleanup();
+ return -1;
+ }
+
+ mSubLabel = mUiLoader->findWidget(DOCML_NAME_VC_HEADINGBANNER);
+
+ if(!mSubLabel)
+ {
+ cleanup();
+ return -1;
+ }
+
+ mSubLabel->setCollapsable(false);
+
+ // allocate and initialize views, menus and toolbar
+ if(createVideoWidget() != 0
+ || createHintWidget() != 0
+ || createToolbar() != 0
+ || createMainMenu() != 0)
+ {
+ cleanup();
+ return -1;
+ }
+
+ mSubLabel->setHeading(tr("Retrieving list.."));
+
+ mCollectionName = "";
+
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// titleReadySlot()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::titleReadySlot(const QString& title)
+{
+ setTitle(title);
+}
+
+// ---------------------------------------------------------------------------
+// activateView()
+// ---------------------------------------------------------------------------
+//
+int VideoListView::activateView()
+{
+ mOptionsMenu->setEnabled(true);
+
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+
+ if(!connect(mainWnd, SIGNAL(aboutToChangeOrientation()),
+ this, SLOT( aboutToChangeOrientationSlot())) ||
+ !connect(mainWnd, SIGNAL(orientationChanged(Qt::Orientation)),
+ this, SLOT(orientationChangedSlot(Qt::Orientation))) ||
+ !connect(mWrapper, SIGNAL(asyncStatus(int, QVariant&)),
+ this, SLOT(handleAsyncStatusSlot(int, QVariant&))) ||
+
+ //TODO: seems like rowsremoved is not signaled when files are removed, but layoutchanged
+ //TODO: on the other hand, layoutchanged is not signaled when items are added but rowsinserted is
+
+ !connect(mModel,
+ SIGNAL(rowsInserted(const QModelIndex&, int, int)),
+ this, SLOT(layoutChangedSlot())) ||
+ !connect(mModel,
+ SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
+ this, SLOT(layoutChangedSlot())) ||
+ //TODO: connect to rowsremoved rowsinserted once delete results emitting removed
+ !connect(mModel,
+ SIGNAL(layoutChanged()),
+ this, SLOT(layoutChangedSlot())) ||
+ !connect(mModel,
+ SIGNAL(modelReady()),
+ this, SLOT(modelReadySlot())))
+ {
+ // deactivate view so we get rid of dangling connections.
+ deactivateView();
+ return -1;
+ }
+
+ // activate current vidget, first make sure it's one that can be activated
+ if(mVideoListWidget)
+ {
+ int result = mVideoListWidget->activate();
+ if(result < 0) {
+ // activate failed, deactivate view so we get rid of dangling connections.
+ deactivateView();
+ }
+ else if (mSubLabel->heading() != tr("Retrieving list.."))
+ {
+ updateSubLabel();
+ }
+
+ showHint();
+ mainWnd->unsetOrientation();
+
+ return result;
+ }
+
+ // deactivate view so we get rid of dangling connections.
+ deactivateView();
+ return -1;
+}
+
+// ---------------------------------------------------------------------------
+// modelReadySlot
+// ---------------------------------------------------------------------------
+//
+void VideoListView::modelReadySlot()
+{
+ mModelReady = true;
+ // since the reset signal arrives after
+ // layout changed, need to make sure that
+ // view is updated in case needed
+ layoutChangedSlot();
+}
+
+// ---------------------------------------------------------------------------
+// layoutChangedSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListView::layoutChangedSlot()
+{
+ updateSubLabel();
+
+ if(mModelReady)
+ {
+ showHint();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// deactivateView()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::deactivateView()
+{
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+
+ disconnect(mainWnd, SIGNAL(aboutToChangeOrientation()),
+ this, SLOT(aboutToChangeOrientationSlot()));
+
+ disconnect(mainWnd, SIGNAL(orientationChanged(Qt::Orientation)),
+ this, SLOT(orientationChangedSlot(Qt::Orientation)));
+
+ disconnect(mWrapper, SIGNAL(asyncStatus(int, QVariant&)),
+ this, SLOT(handleAsyncStatusSlot(int, QVariant&)));
+
+ disconnect(mModel,
+ SIGNAL(rowsInserted(const QModelIndex&, int, int)),
+ this, SLOT(layoutChangedSlot()));
+ disconnect(mModel,
+ SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
+ this, SLOT(layoutChangedSlot()));
+ disconnect(mModel,
+ SIGNAL(layoutChanged()),
+ this, SLOT(layoutChangedSlot()));
+ disconnect(mModel,
+ SIGNAL(modelReady()),
+ this, SLOT(modelReadySlot()));
+
+ mOptionsMenu->setVisible(false);
+ mOptionsMenu->setEnabled(false);
+
+ showHint(false);
+
+ if(mVideoListWidget)
+ {
+ mVideoListWidget->deactivate();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// back()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::back()
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// cleanup()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::cleanup()
+{
+ delete mToolbarViewsActionGroup;
+ mToolbarViewsActionGroup = 0;
+
+ delete mToolbarCollectionActionGroup;
+ mToolbarCollectionActionGroup = 0;
+
+ // not deleted as the uiloader owns these.
+ mVideoListWidget = 0;
+ mVideoHintWidget = 0;
+}
+
+// ---------------------------------------------------------------------------
+// createMainMenu()
+// ---------------------------------------------------------------------------
+//
+int VideoListView::createMainMenu()
+{
+ if(mMenuActions.count() > 0)
+ {
+ // Menu is already created.
+ return 0;
+ }
+
+ if(!connect(mOptionsMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowMainMenuSlot())))
+ {
+ return -1;
+ }
+
+ mMenuActions[EActionAddToCollection] = (HbAction*)mUiLoader->findObject(DOCML_NAME_ADD_TO_COLLECTION);
+ connect(mMenuActions[EActionAddToCollection], SIGNAL(triggered()), this, SLOT(debugNotImplementedYet()));
+
+ mMenuActions[EActionNewCollection] = (HbAction*)mUiLoader->findObject(DOCML_NAME_CREATE_COLLECTION);
+ connect(mMenuActions[EActionNewCollection], SIGNAL(triggered()), this, SLOT(createCollectionSlot()));
+
+ mMenuActions[EActionDelete] = (HbAction*)mUiLoader->findObject(DOCML_NAME_DELETE_MULTIPLE);
+ connect(mMenuActions[EActionDelete], SIGNAL(triggered()), this, SLOT(deleteItemsSlot()));
+
+ mSortMenu = mUiLoader->findWidget(DOCML_NAME_SORT_MENU);
+
+ mMenuActions[EActionSortBy] = mSortMenu->menuAction();
+
+ // submenu items and roles for sorting
+ mMenuActions[EActionSortByDate] = (HbAction*)mUiLoader->findObject(DOCML_NAME_SORT_BY_DATE);
+ connect(mMenuActions[EActionSortByDate], SIGNAL(triggered()), this, SLOT(startSorting()));
+ mSortingRoles[mMenuActions[EActionSortByDate]] = VideoCollectionCommon::KeyDateTime;
+
+ mMenuActions[EActionSortByName] = (HbAction*)mUiLoader->findObject(DOCML_NAME_SORT_BY_NAME);
+ connect(mMenuActions[EActionSortByName], SIGNAL(triggered()), this, SLOT(startSorting()));
+ mSortingRoles[mMenuActions[EActionSortByName]] = Qt::DisplayRole;
+
+ mMenuActions[EACtionSortByItemCount] = (HbAction*)mUiLoader->findObject(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
+ connect(mMenuActions[EACtionSortByItemCount], SIGNAL(triggered()), this, SLOT(startSorting()));
+ // TODO:
+ mSortingRoles[mMenuActions[EACtionSortByItemCount]] = 0;
+
+ mMenuActions[EActionSortByLength] = (HbAction*)mUiLoader->findObject(DOCML_NAME_SORT_BY_TOTAL_LENGTH);
+ connect(mMenuActions[EActionSortByLength], SIGNAL(triggered()), this, SLOT(startSorting()));
+ // TODO:
+ mSortingRoles[mMenuActions[EActionSortByLength]] = 0;
+
+ mMenuActions[EActionSortBySize] = (HbAction*)mUiLoader->findObject(DOCML_NAME_SORT_BY_SIZE);
+ connect(mMenuActions[EActionSortBySize], SIGNAL(triggered()), this, SLOT(startSorting()));
+ mSortingRoles[mMenuActions[EActionSortBySize]] = VideoCollectionCommon::KeySizeValue;
+
+ if(mSortMenu->actions().count() != VIDEO_LIST_VIEW_SORT_MENU_COUNT
+ || mOptionsMenu->actions().count() != VIDEO_LIST_VIEW_OPTION_MENU_COUNT)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// createToolbar()
+// Creates toolbar, toolbar actions and toolbar icons
+// ---------------------------------------------------------------------------
+//
+int VideoListView::createToolbar()
+{
+ // Create actiongroup and add all actions to it. This ensures that only one is
+ // active at certain moment.
+
+ if(!mToolbarViewsActionGroup && !mToolbarCollectionActionGroup)
+ {
+ mToolbarViewsActionGroup = new QActionGroup(this);
+ mToolbarCollectionActionGroup = new QActionGroup(this);
+
+ if(!mToolbarViewsActionGroup || !mToolbarCollectionActionGroup)
+ {
+ delete mToolbarViewsActionGroup;
+ mToolbarViewsActionGroup = 0;
+
+ delete mToolbarCollectionActionGroup;
+ mToolbarCollectionActionGroup = 0;
+
+ return -1;
+ }
+
+ // create toolbar item actions
+
+ // All Videos tab
+ mToolbarActions[ETBActionAllVideos] = createAction(tr("All videos"), ":/images/qtg_mono_video_all.svg",
+ mToolbarViewsActionGroup, SLOT(openAllVideosViewSlot()));
+
+ // Collections tab
+ mToolbarActions[ETBActionCollections] = createAction(tr("Collections"), ":/images/qtg_mono_video_collection.svg",
+ mToolbarViewsActionGroup, SLOT(openCollectionViewSlot()));
+
+ if (!mIsService)
+ {
+ // Services tab
+ mToolbarActions[ETBActionServices] = createAction(tr("Services"), ":/images/qtg_mono_video_services.svg",
+ mToolbarViewsActionGroup, SLOT(openServicesViewSlot()));
+ // Add Videos tab
+ mToolbarActions[ETBActionAddVideos] = createAction(tr("Add videos"), ":/images/mono_video_addvideos.svg",
+ mToolbarCollectionActionGroup, SLOT(addVideosToCollectionSlot()));
+
+ // Remove Videos tab
+ mToolbarActions[ETBActionRemoveVideos] = createAction(tr("Remove videos"), ":/images/mono_video_removevideos.svg",
+ mToolbarCollectionActionGroup, SLOT(debugNotImplementedYet()));
+ }
+
+ // Sort by tab
+ mToolbarActions[ETBActionSortVideos] = createAction(tr("Sort by"), ":/images/mono_video_sortvideos.svg",
+ mToolbarCollectionActionGroup, SLOT(openSortByMenuSlot()));
+
+ HbToolBar *bar = toolBar(); // First call to toolBar() creates the object, so on failure it could return 0.
+
+ if( !bar
+ || !mToolbarActions[ETBActionAllVideos]
+ || !mToolbarActions[ETBActionCollections]
+ || !mToolbarActions[ETBActionSortVideos]
+ || (!mToolbarActions[ETBActionServices] && !mIsService)
+ || (!mToolbarActions[ETBActionAddVideos] && !mIsService)
+ || (!mToolbarActions[ETBActionRemoveVideos] && !mIsService))
+ {
+ delete mToolbarActions[ETBActionAllVideos];
+ delete mToolbarActions[ETBActionCollections];
+ delete mToolbarActions[ETBActionServices];
+ delete mToolbarActions[ETBActionAddVideos];
+ delete mToolbarActions[ETBActionRemoveVideos];
+ delete mToolbarActions[ETBActionSortVideos];
+ return -1;
+ }
+
+ // Collection view actions are not checkable
+ mToolbarActions[ETBActionAllVideos]->setCheckable(true);
+ mToolbarActions[ETBActionCollections]->setCheckable(true);
+
+ if (!mIsService)
+ {
+ mToolbarActions[ETBActionServices]->setCheckable(true);
+ }
+
+ // Allvideos is checked at creation phase
+ mToolbarActions[ETBActionAllVideos]->setChecked(true);
+
+ bar->addActions(mToolbarViewsActionGroup->actions());
+ }
+
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// createAction()
+// ---------------------------------------------------------------------------
+//
+HbAction* VideoListView::createAction(QString tooltip, QString icon,
+ QActionGroup* actionGroup, const char *slot)
+{
+ HbAction* action = new HbAction(actionGroup);
+ if(!action) {
+ return 0;
+ }
+
+ action->setToolTip(tooltip);
+ HbIcon hbIcon(icon);
+ action->setIcon(hbIcon);
+
+ if(!connect(action, SIGNAL(triggered()), this, slot)) {
+ // actiongroup deletion deletes this also.
+ // return 0 tells that there was a problem in creation to caller.
+ delete action;
+ return 0;
+ }
+
+ return action;
+}
+
+
+// ---------------------------------------------------------------------------
+// createVideoWidget()
+// ---------------------------------------------------------------------------
+//
+int VideoListView::createVideoWidget()
+{
+ if(!mModel)
+ {
+ return -1;
+ }
+ if(!mVideoListWidget)
+ {
+ mVideoListWidget = mUiLoader->findWidget(DOCML_NAME_VC_VIDEOLISTWIDGET);
+ if(!mVideoListWidget )
+ {
+ return -1;
+ }
+ if(mVideoListWidget->initialize(*mModel, mVideoServices) < 0)
+ {
+ return -1;
+ }
+
+ if(!connect(mVideoListWidget, SIGNAL( command(int)), this, SIGNAL(command(int))) ||
+ !connect(mVideoListWidget, SIGNAL( collectionOpened(bool, const QString&)), this, SLOT(collectionOpenedSlot(bool, const QString&))))
+ {
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// createHintWidget()
+// ---------------------------------------------------------------------------
+//
+int VideoListView::createHintWidget()
+{
+ if(!mVideoHintWidget)
+ {
+ mVideoHintWidget = mUiLoader->findWidget(DOCML_NAME_VC_VIDEOHINTWIDGET);
+ if(!mVideoHintWidget )
+ {
+ return -1;
+ }
+ if(mVideoHintWidget->initialize() < 0)
+ {
+ return -1;
+ }
+
+ HbPushButton* button = mUiLoader->findWidget(DOCML_NAME_HINT_BUTTON);
+ if(!connect(button, SIGNAL(clicked(bool)), this, SLOT(openServicesViewSlot())))
+ {
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// showHint
+// ---------------------------------------------------------------------------
+//
+void VideoListView::showHint(bool show)
+{
+ if (mModel && mModelReady && (mModel->rowCount() == 0) && mVideoHintWidget)
+ {
+ mVideoHintWidget->setVisible(show);
+ }
+ else if (mVideoHintWidget)
+ {
+ show = false;
+ mVideoHintWidget->setVisible(false);
+ }
+
+ if(show && mToolbarViewsActionGroup && mToolbarCollectionActionGroup)
+ {
+ if(!mIsService)
+ {
+ mToolbarActions[ETBActionRemoveVideos]->setEnabled(false);
+ }
+ mToolbarActions[ETBActionSortVideos]->setEnabled(false);
+ }
+ else
+ {
+ if(!mIsService)
+ {
+ if(mToolbarActions[ETBActionRemoveVideos]->isEnabled() == false)
+ {
+ mToolbarActions[ETBActionRemoveVideos]->setEnabled(true);
+ }
+ }
+ if(mToolbarActions[ETBActionSortVideos]->isEnabled() == false)
+ {
+ mToolbarActions[ETBActionSortVideos]->setEnabled(true);
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// updateSubLabel
+// ---------------------------------------------------------------------------
+//
+void VideoListView::updateSubLabel()
+{
+ //TODO: reduce unnecessary updates
+ if (mModel && mVideoListWidget)
+ {
+ int itemCount = mModel->rowCount();
+
+ VideoListWidget::TVideoListType type = mVideoListWidget->getType();
+ if (type == VideoListWidget::EAllVideos)
+ {
+ mSubLabel->setHeading(tr("%1 videos").arg(itemCount));
+ }
+ else if (type == VideoListWidget::ECollections)
+ {
+ mSubLabel->setHeading(tr("%1 collections").arg(itemCount));
+ }
+ else if (type == VideoListWidget::EDefaultColItems ||
+ type == VideoListWidget::EUserColItems)
+ {
+ mSubLabel->setHeading(tr("%1 (%2)").arg(mCollectionName).arg(itemCount));
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// openAllVideosViewSlot()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::openAllVideosViewSlot()
+{
+ mModel->open(VideoListWidget::ELevelVideos);
+ mVideoListWidget->activate(VideoListWidget::ELevelVideos);
+ mVideoHintWidget->setLevel(VideoHintWidget::AllVideos);
+ updateSubLabel();
+}
+
+// ---------------------------------------------------------------------------
+// openCollectionViewSlot()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::openCollectionViewSlot()
+{
+ mModel->open(VideoListWidget::ELevelCategory);
+ mVideoListWidget->activate(VideoListWidget::ELevelCategory);
+ mVideoHintWidget->setLevel(VideoHintWidget::Collection);
+
+ // the collection view is not empty, so we can hide the hint in advance.
+ showHint(false);
+
+ updateSubLabel();
+}
+
+// ---------------------------------------------------------------------------
+// openservicesViewSlot()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::openServicesViewSlot()
+{
+ debugNotImplementedYet();
+}
+
+// ---------------------------------------------------------------------------
+// startSorting()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::startSorting()
+{
+ if(!mModel || !mOptionsMenu)
+ {
+ return;
+ }
+ // Check that action is sort by and it has a sub menu.
+ if(mOptionsMenu->activeAction() != mMenuActions[EActionSortBy] || !mOptionsMenu->activeAction()->menu())
+ {
+ return;
+ }
+
+ int role = mSortingRoles[mOptionsMenu->activeAction()->menu()->activeAction()];
+
+ Qt::SortOrder order(Qt::AscendingOrder);
+
+ if(mModel->sortRole() == role && mModel->sortOrder() == Qt::AscendingOrder)
+ {
+ order = Qt::DescendingOrder;
+ }
+
+ mModel->doSorting(role, order);
+
+ mUiUtils.saveSortingValues(role, order);
+}
+
+// -------------------------------------------------------------------------------------------------
+// aboutToChangeOrientationSlot()
+// hide all items in the window during orientation change
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::aboutToChangeOrientationSlot()
+{
+ // this method is required for changing from to mediawall
+}
+
+// -------------------------------------------------------------------------------------------------
+// orientationChangedSlot()
+// orientation changed, items can be put back to visible after view has handled the change
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::orientationChangedSlot( Qt::Orientation orientation )
+{
+ // this method is required for changing from to mediawall
+
+ // in landscape we need to hide the title and the toolbar. (also required for the mediawall?)
+ // TODO: how about the feature where the toolbar comes visible if screen is tapped?
+ this->setItemVisible(Hb::AllItems, orientation == Qt::Vertical);
+}
+
+// -------------------------------------------------------------------------------------------------
+// deleteItemsSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::deleteItemsSlot()
+{
+ if(!mModel)
+ {
+ return;
+ }
+ if(!mSelectionDialog)
+ {
+ bool ok(false);
+ mUiLoader->load(DOCML_VIDEOSELECTIONDIALOG_FILE, &ok);
+ if(!ok)
+ {
+ return;
+ }
+ mSelectionDialog = mUiLoader->findObject( DOCML_NAME_DIALOG );
+ }
+ mSelectionDialog->setContent(tr("Delete items"), mVideoListWidget);
+ if(mSelectionDialog->exec() == mSelectionDialog->primaryAction())
+ {
+ // get selection and remove
+ QItemSelection selection = mSelectionDialog->getSelection();
+ mModel->deleteItems(selection.indexes());
+ // invalid model to get UI updated
+ mModel->invalidate();
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// createCollectionSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::createCollectionSlot()
+{
+ debugNotImplementedYet();
+}
+
+// -------------------------------------------------------------------------------------------------
+// addVideosToCollectionSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::addVideosToCollectionSlot()
+{
+ debugNotImplementedYet();
+}
+
+// -------------------------------------------------------------------------------------------------
+// aboutToShowMainMenuSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::aboutToShowMainMenuSlot()
+{
+ if(!mModel || !mToolbarViewsActionGroup || !mToolbarCollectionActionGroup)
+ {
+ return;
+ }
+
+ int menuActionCount = 0;
+ HbAction *action = 0;
+ foreach(action, mMenuActions.values())
+ {
+ if(action)
+ {
+ ++menuActionCount;
+ action->setVisible(false);
+ }
+ }
+ if(menuActionCount != mMenuActions.values().count() || mMenuActions.values().count() == 0)
+ {
+ // fatal error, some action(s) was not created.
+ return;
+ }
+
+ if(!mModel->rowCount(QModelIndex()))
+ {
+ // no items, no menu
+ return;
+ }
+
+ HbAction *firstAction = (HbAction*)(toolBar()->actions().first());
+
+ if(mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionAllVideos] &&
+ firstAction == mToolbarActions[ETBActionAllVideos])
+ {
+ mMenuActions[EActionSortBy]->setVisible(true);
+ mMenuActions[EActionSortByDate]->setVisible(true);
+ mMenuActions[EActionSortByName]->setVisible(true);
+ mMenuActions[EActionSortBySize]->setVisible(true);
+
+ if (!mIsService)
+ {
+ mMenuActions[EActionAddToCollection]->setVisible(true);
+ mMenuActions[EActionDelete]->setVisible(true);
+ }
+ }
+ else if(mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionCollections] &&
+ firstAction == mToolbarActions[ETBActionAllVideos] )
+ {
+ if (!mIsService)
+ {
+ mMenuActions[EActionNewCollection]->setVisible(true);
+ }
+ mMenuActions[EActionSortBy]->setVisible(true);
+ mMenuActions[EActionSortByName]->setVisible(true);
+ mMenuActions[EACtionSortByItemCount]->setVisible(true);
+ mMenuActions[EActionSortByLength]->setVisible(true);
+ }
+ else if(firstAction != mToolbarActions[ETBActionAllVideos])
+ {
+ //Add, Remove and Sort by will be launched from toolbar
+ if (!mIsService)
+ {
+ mMenuActions[EActionDelete]->setVisible(true);
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// handleAsyncStatusSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::handleAsyncStatusSlot(int statusCode, QVariant &additional)
+{
+ // in case of error concerns delete, need to reset filtering
+ if(statusCode == VideoCollectionCommon::statusSingleDeleteFail ||
+ statusCode == VideoCollectionCommon::statusMultipleDeleteFail)
+ {
+ if(mModel)
+ {
+ mModel->clear();
+ }
+ }
+ // show msg from status
+ mUiUtils.showStatusMsgSlot(statusCode, additional);
+}
+
+// -------------------------------------------------------------------------------------------------
+// collectionOpenedSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::collectionOpenedSlot(bool collectionOpened, const QString& collection)
+{
+ if(!mToolbarCollectionActionGroup || !mToolbarViewsActionGroup || !mToolbarActions.contains(ETBActionCollections))
+ {
+ return;
+ }
+
+ mCollectionName = collection;
+
+ HbToolBar* bar = toolBar();
+ bar->clearActions();
+
+ if (collectionOpened)
+ {
+ mToolbarActions[ETBActionCollections]->setChecked(false);
+ bar->addActions(mToolbarCollectionActionGroup->actions());
+ }
+ else
+ {
+ bar->addActions(mToolbarViewsActionGroup->actions());
+ mToolbarActions[ETBActionCollections]->setChecked(true);
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// openSortByMenuSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::openSortByMenuSlot()
+{
+ if(!mModel)
+ {
+ return;
+ }
+
+ int menuActionCount = 0;
+ HbAction *action = 0;
+ foreach(action, mMenuActions.values())
+ {
+ if(action)
+ {
+ ++menuActionCount;
+ action->setVisible(false);
+ }
+ }
+ if(menuActionCount != mMenuActions.values().count() || mMenuActions.values().count() == 0)
+ {
+ // fatal error, some action(s) was not created.
+ return;
+ }
+
+ if(!mModel->rowCount(QModelIndex()))
+ {
+ // no items, no menu
+ return;
+ }
+
+ mSortMenu->setVisible(true);
+ mMenuActions[EActionSortBy]->setVisible(true);
+ mMenuActions[EActionSortByDate]->setVisible(true);
+ mMenuActions[EActionSortByName]->setVisible(true);
+ mMenuActions[EActionSortBySize]->setVisible(true);
+
+ QPointF coords((size()/2).width(), (size()/3).height());
+ mSortMenu->exec(coords);
+}
+
+// Just for testing, remove this
+void VideoListView::debugNotImplementedYet()
+{
+ HbMessageBox::information(tr("Not implemented yet"));
+}
+
+// end of file
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/src/videolistwidget.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videolistwidget.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,627 @@
+/*
+* 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 content widget implementation
+*
+*/
+
+#include "videolistwidget.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "videoservices.h"
+#include "videothumbnaildata.h"
+#include "videosortfilterproxymodel.h"
+#include "videocollectioncommon.h"
+#include "mpxhbvideocommondefs.h"
+
+// Interval in ms to report the scroll position.
+const int SCROLL_POSITION_TIMER_TIMEOUT = 100;
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoListWidget::VideoListWidget(HbView *parent) :
+HbListView(parent),
+mModel(0),
+mVideoServices(0),
+mCurrentLevel(VideoListWidget::ELevelVideos),
+mSignalsConnected(false),
+mDetailsReady(false),
+mIsService(false),
+mSecSkAction(0),
+mContextMenu(0),
+mLastOpenItemId(TMPXItemId::InvalidId()),
+mScrollPositionTimer(0)
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoListWidget::~VideoListWidget()
+{
+ delete mScrollPositionTimer;
+ mScrollPositionTimer = 0;
+ mContextMenuActions.clear();
+ disconnect();
+ delete mContextMenu;
+ mContextMenu = 0;
+ delete mSecSkAction;
+ mSecSkAction = 0;
+}
+
+// ---------------------------------------------------------------------------
+// initialize
+// ---------------------------------------------------------------------------
+//
+int VideoListWidget::initialize(VideoSortFilterProxyModel &model, VideoServices* videoServices)
+{
+ mModel = &model;
+
+ mVideoServices = videoServices;
+
+ if(mVideoServices)
+ {
+ mIsService = true;
+ }
+
+ // init widget
+ HbListViewItem *prototype = listItemPrototype();
+ if(!prototype)
+ {
+ return -1;
+ }
+ //Use image layout in prototype
+ prototype->setGraphicsSize(HbListViewItem::Thumbnail);
+ setItemRecycling(true);
+ setClampingStyle(HbScrollArea::BounceBackClamping);
+ setScrollingStyle(HbScrollArea::PanOrFlick);
+ setFrictionEnabled(true);
+ setUniformItemSizes(true);
+ setSelectionMode(HbAbstractItemView::NoSelection);
+
+ //Use scrollbar
+ HbScrollBar *scrollBar = verticalScrollBar();
+ if (!scrollBar)
+ {
+ return -1;
+ }
+ scrollBar->setInteractive(true);
+
+ mSecSkAction = new HbAction( Hb::BackAction );
+
+ if(!mSecSkAction)
+ {
+ return -1;
+ }
+ // initial setup for widget is hidden
+ setVisible(false);
+
+ mScrollPositionTimer = new QTimer();
+ mScrollPositionTimer->setSingleShot(true);
+
+ if (mIsService)
+ {
+ connect(this, SIGNAL(fileUri(const QString&)), mVideoServices, SLOT(itemSelected(const QString&)));
+ }
+
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// activate
+// ---------------------------------------------------------------------------
+//
+int VideoListWidget::activate()
+{
+ return activate(mCurrentLevel);
+}
+
+// ---------------------------------------------------------------------------
+// activate
+// ---------------------------------------------------------------------------
+//
+int VideoListWidget::activate(VideoListWidget::TVideoListLevel level)
+{
+ mLastOpenItemId = TMPXItemId::InvalidId();
+ if(!mModel)
+ {
+ return -1;
+ }
+ mCurrentLevel = level;
+ setModel(mModel);
+ setVisible(true);
+
+ if(mContextMenu)
+ {
+ mContextMenu->setEnabled(true);
+ }
+
+ if ( connectSignals() < 0)
+ {
+ return -1;
+ }
+
+ // Enable thumbnail background fetching.
+ VideoThumbnailData &thumbnailData = VideoThumbnailData::instance();
+ thumbnailData.enableBackgroundFetching(true);
+
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// deactivate
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::deactivate()
+{
+ if(mContextMenu)
+ {
+ mContextMenu->hide();
+ }
+ disConnectSignals();
+ // Free allocated memory for list thumbnails and disable background fetching.
+ VideoThumbnailData &thumbnailData = VideoThumbnailData::instance();
+ thumbnailData.enableBackgroundFetching(false);
+ thumbnailData.freeThumbnailData();
+}
+
+// ---------------------------------------------------------------------------
+// connectSignals
+// ---------------------------------------------------------------------------
+//
+int VideoListWidget::connectSignals()
+{
+
+ if (!mSignalsConnected)
+ {
+ if(!connect(this, SIGNAL(scrollingEnded()), this, SLOT(scrollingEndedSlot())) ||
+ !connect(this, SIGNAL(scrollPositionChanged(const QPointF &)),
+ this, SLOT(scrollPositionChangedSlot(const QPointF &))) ||
+ !connect(mScrollPositionTimer, SIGNAL(timeout()), this, SLOT(scrollingEndedSlot()))
+ )
+ {
+ return -1;
+ }
+ mSignalsConnected = true;
+ }
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// disConnectSignals
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::disConnectSignals()
+{
+ disconnect(this, SIGNAL(scrollingEnded()), this, SLOT(scrollingEndedSlot()));
+ disconnect(this, SIGNAL(scrollPositionChanged(const QPointF&)),
+ this, SLOT(scrollPositionChangedSlot(const QPointF&)));
+ disconnect(mScrollPositionTimer, SIGNAL(timeout()), this, SLOT(scrollingEndedSlot()));
+ mSignalsConnected = false;
+}
+
+// ---------------------------------------------------------------------------
+// shareItemSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::shareItemSlot()
+{
+ debugNotImplementedYet();
+}
+
+// ---------------------------------------------------------------------------
+// deleteItemSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::deleteItemSlot()
+{
+ if(!mModel)
+ {
+ return;
+ }
+
+ QVariant variant;
+ QModelIndex index = currentIndex();
+ variant = mModel->data(index, Qt::DisplayRole);
+
+ if (variant.isValid())
+ {
+ QString text = tr("Do you want to delete \"%1\"?").arg(
+ variant.toStringList().first());
+ if(HbMessageBox::question(text))
+ {
+ QModelIndexList list;
+ list.append(index);
+ mModel->deleteItems(list);
+
+ // exec filtering
+ mModel->invalidate();
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// createContextMenu
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::createContextMenu()
+{
+ if(mContextMenu)
+ {
+ return;
+ }
+ mContextMenu = new HbMenu();
+
+ if (mIsService)
+ {
+ mContextMenuActions[EActionPlay] = mContextMenu->addAction(tr("Play"), this, SLOT(playItemSlot()));
+ mContextMenuActions[EActionDetails] = mContextMenu->addAction(tr("Details"), this, SLOT(openDetailsSlot()));
+
+ }
+ else
+ {
+ mContextMenuActions[EACtionAddToCollection] = mContextMenu->addAction(tr("Add to collection"), this, SLOT(addToCollectionSlot()));
+ mContextMenuActions[EActionAddVideos] = mContextMenu->addAction(tr("Add videos..."), this, SLOT(addItemSlot()));
+ mContextMenuActions[EACtionRemoveFromCollection] = mContextMenu->addAction(tr("Remove from collection"), this, SLOT(debugNotImplementedYet()));
+ mContextMenuActions[EActionShare] = mContextMenu->addAction(tr("Share"), this, SLOT(shareItemSlot()));
+ mContextMenuActions[EActionRename] = mContextMenu->addAction(tr("Rename"), this, SLOT(renameSlot()));
+ mContextMenuActions[EActionSetThumb] = mContextMenu->addAction(tr("Set thumbnail..."), this, SLOT(debugNotImplementedYet()));
+ mContextMenuActions[EACtionRemoveCollection] = mContextMenu->addAction(tr("Remove collection"), this, SLOT(debugNotImplementedYet()));
+ mContextMenuActions[EActionDelete] = mContextMenu->addAction(tr("Delete"), this, SLOT(deleteItemSlot()));
+ mContextMenuActions[EActionDetails] = mContextMenu->addAction(tr("Details"), this, SLOT(openDetailsSlot()));
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// setContextMenu
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListWidget::setContextMenu(bool isDefaultCollection)
+{
+ if(!mContextMenu)
+ {
+ createContextMenu();
+ }
+ int menuActionCount = 0;
+ HbAction *action = 0;
+ foreach(action, mContextMenuActions.values())
+ {
+ if(action)
+ {
+ ++menuActionCount;
+ action->setVisible(false);
+ }
+ }
+ if(menuActionCount != mContextMenuActions.values().count() || mContextMenuActions.values().count() == 0)
+ {
+ // fatal error, some action(s) was not created before.
+ delete mContextMenu;
+ mContextMenu = 0;
+ mContextMenuActions.clear();
+ return;
+ }
+
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+
+ TVideoListType type = getType();
+
+ if(type == EAllVideos ||
+ type == EDefaultColItems)
+ {
+ if (!mIsService)
+ {
+ mContextMenuActions[EACtionAddToCollection]->setVisible(true);
+ mContextMenuActions[EActionShare]->setVisible(true);
+ mContextMenuActions[EActionDelete]->setVisible(true);
+ }
+ else
+ {
+ mContextMenuActions[EActionPlay]->setVisible(true);
+ }
+ mContextMenuActions[EActionDetails]->setVisible(true);
+ }
+ else if(type == ECollections)
+ {
+ if(!mIsService)
+ {
+ mContextMenuActions[EActionAddVideos]->setVisible(true);
+ mContextMenuActions[EActionRename]->setVisible(true);
+ mContextMenuActions[EActionSetThumb]->setVisible(true);
+ mContextMenuActions[EACtionRemoveCollection]->setVisible(true);
+ }
+ }
+ else if(type == EUserColItems)
+ {
+ if (!mIsService)
+ {
+ mContextMenuActions[EACtionRemoveFromCollection]->setVisible(true);
+ mContextMenuActions[EActionShare]->setVisible(true);
+ mContextMenuActions[EActionDelete]->setVisible(true);
+ }
+ else
+ {
+ mContextMenuActions[EActionPlay]->setVisible(true);
+ }
+ mContextMenuActions[EActionDetails]->setVisible(true);
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// getLevel
+// -------------------------------------------------------------------------------------------------
+//
+VideoListWidget::TVideoListType VideoListWidget::getType()
+{
+ TVideoListType type(EUnknown);
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+
+ if(mCurrentLevel == ELevelVideos)
+ {
+ type = EAllVideos;
+ }
+ else if(mCurrentLevel == ELevelCategory)
+ {
+ if(mLastOpenItemId == TMPXItemId::InvalidId())
+ {
+ type = ECollections;
+ }
+ else if(mLastOpenItemId.iId2 == KVcxMvcCategoryIdDownloads ||
+ mLastOpenItemId.iId2 == KVcxMvcCategoryIdCaptured)
+ {
+ type = EDefaultColItems;
+ }
+ else
+ {
+ type = EUserColItems;
+ }
+ }
+ return type;
+}
+
+// ---------------------------------------------------------------------------
+// getModel
+// ---------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel& VideoListWidget::getModel()
+{
+ return *mModel;
+}
+
+// ---------------------------------------------------------------------------
+// emitActivated
+// This slot is called by the fw when viewitem is activated
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::emitActivated (const QModelIndex &modelIndex)
+{
+ if(selectionMode() == HbAbstractItemView::MultiSelection)
+ {
+ // do nothing in case selection mode
+ return;
+ }
+
+ if (!mModel || !modelIndex.isValid())
+ {
+ return;
+ }
+ if (mCurrentLevel == ELevelCategory)
+ {
+ if (getType() == ECollections)
+ {
+ QVariant variant = mModel->data(modelIndex, Qt::DisplayRole);
+ if (variant.isValid())
+ {
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+ mainWnd->addSoftKeyAction( Hb::SecondarySoftKey, mSecSkAction );
+
+ connect(mainWnd->softKeyAction(Hb::SecondarySoftKey),
+ SIGNAL(triggered()), this, SLOT(back()));
+ mLastOpenItemId = mModel->getMediaIdAtIndex(modelIndex);
+ emit(collectionOpened(true, variant.toStringList().first()));
+ }
+ }
+ }
+ if(mIsService && (mCurrentLevel == ELevelCategory) && (getType() != ECollections))
+ {
+ QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath);
+ if ( variant.isValid() )
+ {
+ QString itemPath = variant.value();
+ emit(fileUri(itemPath));
+ }
+ }
+ else
+ {
+ mModel->openItem(modelIndex);
+ }
+}
+
+// ---------------------------------------------------------------------------
+// longPressGesture
+// called by the fw when user long presses some item
+// ---------------------------------------------------------------------------
+//
+//
+void VideoListWidget::longPressGesture (const QPointF &point)
+{
+ if (!mDetailsReady)
+ {
+ emit command(MpxHbVideoCommon::LoadVideoDetailsView);
+ mDetailsReady = true;
+ }
+ if(selectionMode() == HbAbstractItemView::MultiSelection)
+ {
+ // do not activate context menu during selection mode
+ return;
+ }
+
+ QModelIndex index = currentIndex();
+ if(mModel && index.isValid())
+ {
+
+ TMPXItemId mpxId = mModel->getMediaIdAtIndex(index);
+
+ bool defaultCollection(true);
+ if ( ((mpxId.iId2 == 1) && //Category
+ ((mpxId.iId1 != KVcxMvcCategoryIdDownloads) &&
+ (mpxId.iId1 != KVcxMvcCategoryIdCaptured))) ||
+ (mCurrentLevel != ELevelCategory))
+ {
+ defaultCollection = false;
+ }
+
+
+ setContextMenu(defaultCollection);
+ // if menu not yet exists, it has been created
+ // setup might fails causing menu to be removed
+ if(mContextMenu)
+ {
+ mContextMenu->exec(point);
+ }
+ }
+ HbListView::longPressGesture(point);
+}
+
+// ---------------------------------------------------------------------------
+// playItemSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::playItemSlot()
+{
+ mModel->openItem(currentIndex());
+}
+
+// ---------------------------------------------------------------------------
+// openDetailsSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::openDetailsSlot()
+{
+ if(mModel && mModel->fetchItemDetails(currentIndex()) == 0 )
+ {
+ emit command(MpxHbVideoCommon::ActivateVideoDetailsView);
+ }
+}
+// ---------------------------------------------------------------------------
+// renameSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::renameSlot()
+{
+ debugNotImplementedYet();
+}
+
+
+// ---------------------------------------------------------------------------
+// addItemSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::addItemSlot()
+{
+ debugNotImplementedYet();
+}
+
+// ---------------------------------------------------------------------------
+// addToCollectionSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::addToCollectionSlot()
+{
+ debugNotImplementedYet();
+}
+
+
+// ---------------------------------------------------------------------------
+// playAllSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::playAllSlot()
+{
+ debugNotImplementedYet();
+}
+
+// ---------------------------------------------------------------------------
+// back
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::back()
+{
+ mLastOpenItemId = TMPXItemId::InvalidId();
+ if(mModel)
+ {
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+
+ disconnect(mainWnd->softKeyAction(Hb::SecondarySoftKey),
+ SIGNAL(triggered()), this, SLOT(back()));
+
+ mainWnd->removeSoftKeyAction(Hb::SecondarySoftKey, mSecSkAction);
+
+ emit(collectionOpened(false, QString("")));
+
+ mModel->back();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// scrollingEndedSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::scrollingEndedSlot()
+{
+ if(mScrollPositionTimer)
+ mScrollPositionTimer->stop();
+
+ const QList itemsVisible = visibleItems();
+
+ if(itemsVisible.count() > 0)
+ {
+ int row = itemsVisible.value(0)->modelIndex().row();
+ VideoThumbnailData::instance().startBackgroundFetching(row);
+ }
+}
+
+// ---------------------------------------------------------------------------
+// scrollPositionChangedSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::scrollPositionChangedSlot(const QPointF &newPosition)
+{
+ Q_UNUSED(newPosition);
+ if(mScrollPositionTimer && !mScrollPositionTimer->isActive())
+ mScrollPositionTimer->start(SCROLL_POSITION_TIMER_TIMEOUT);
+}
+
+// ---------------------------------------------------------------------------
+// debugNotImplementedYet
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::debugNotImplementedYet()
+{
+ HbMessageBox::information(tr("Not implemented yet"));
+}
+
+// end of file
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testcollectionview/stub/inc/videocollectionuiloader.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testcollectionview/stub/inc/videocollectionuiloader.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#ifndef _VIDEOCOLLECTIONUILOADER_H_
+#define _VIDEOCOLLECTIONUILOADER_H_
+
+// System includes
+#include
+
+// Constants
+static const char* DOCML_VIDEOCOLLECTIONVIEW_FILE = ":/layout/collectionview.docml";
+static const char* DOCML_NAME_VIEW = "view";
+
+// Videocollection View
+static const char* DOCML_NAME_VC_HEADINGBANNER = "vc:mBanner";
+static const char* DOCML_NAME_VC_VIDEOLISTWIDGET = "vc:mListWidget";
+static const char* DOCML_NAME_VC_VIDEOHINTWIDGET = "vc:mHintWidget";
+
+// Videocollection Options Menu
+static const char* DOCML_NAME_OPTIONS_MENU = "vc:mOptionsMenu";
+static const char* DOCML_NAME_SORT_MENU = "vc:mSortBy";
+
+static const char* DOCML_NAME_SORT_BY_DATE = "vc:mDate";
+static const char* DOCML_NAME_SORT_BY_NAME = "vc:mName";
+static const char* DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS = "vc:mNumberOfItems";
+static const char* DOCML_NAME_SORT_BY_TOTAL_LENGTH = "vc:mTotalLength";
+static const char* DOCML_NAME_SORT_BY_RATING = "vc:mRating";
+static const char* DOCML_NAME_SORT_BY_SIZE = "vc:mSize";
+
+static const char* DOCML_NAME_ADD_TO_COLLECTION = "vc:mAddtoCollection";
+static const char* DOCML_NAME_CREATE_COLLECTION = "vc:mCreateNewCollection";
+static const char* DOCML_NAME_DELETE_MULTIPLE = "vc:mDeleteMultiple";
+
+static const char* DOCML_NAME_PLAY_IN_QUEUE = "vc:mPlayInQueue";
+static const char* DOCML_NAME_PLAY_ALL_ITEMS = "vc:mPlayAllItems";
+
+// Videocollection hint widget
+static const char* DOCML_NAME_NOVIDEOS_LABEL = "vc:mNoVideosLabel";
+
+// Class declaration
+class VideoCollectionUiLoader : public HbDocumentLoader
+{
+
+public:
+
+ VideoCollectionUiLoader();
+
+ ~VideoCollectionUiLoader();
+
+ /**
+ * Returns the requested widget casted to correct type
+ *
+ * @param name Name of the widget
+ * @return Pointer to the widget
+ */
+ template
+ T* findWidget( QString name )
+ {
+ return qobject_cast( HbDocumentLoader::findWidget( name ) );
+ }
+
+ /**
+ * Returns the requested object casted to correct type
+ *
+ * @param name Name of the object
+ * @return Pointer to the object
+ */
+ template
+ T* findObject( QString name )
+ {
+ return qobject_cast( HbDocumentLoader::findObject( name ) );
+ }
+
+ static bool mFindFailure;
+
+private:
+
+ QObject *createObject( const QString& type, const QString &name );
+};
+
+#endif // _VIDEOCOLLECTIONUILOADER_H_
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testcollectionview/stub/src/videocollectionuiloader.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testcollectionview/stub/src/videocollectionuiloader.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#include
+#include "videocollectionuiloader.h"
+#include "videolistview.h"
+
+bool VideoCollectionUiLoader::mFindFailure(false);
+
+// ---------------------------------------------------------------------------
+// VideoCollectionUiLoader
+// ---------------------------------------------------------------------------
+//
+VideoCollectionUiLoader::VideoCollectionUiLoader() :
+ HbDocumentLoader()
+{
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoCollectionUiLoader
+// ---------------------------------------------------------------------------
+//
+VideoCollectionUiLoader::~VideoCollectionUiLoader()
+{
+}
+
+// ---------------------------------------------------------------------------
+// createObject
+// ---------------------------------------------------------------------------
+//
+QObject* VideoCollectionUiLoader::createObject( const QString& type, const QString &name )
+{
+ QObject* object = 0;
+
+ if ( type == VideoListView::staticMetaObject.className() )
+ {
+ object = new VideoListView( this );
+ }
+ else if ( type == "VideoListWidget" )
+ {
+ object = new HbListView();
+ }
+ else if ( type == "VideoHintWidget" )
+ {
+ object = new HbWidget();
+ }
+ if ( object )
+ {
+ object->setObjectName( name );
+
+ if (mFindFailure)
+ {
+ delete object;
+ object = 0;
+ }
+ return object;
+ }
+
+ return HbDocumentLoader::createObject( type, name );
+}
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testcollectionview/testcollectionview.pro
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testcollectionview/testcollectionview.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,55 @@
+#
+# Copyright (c) 2009 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:
+#
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += . \
+ inc \
+ src
+INCLUDEPATH += . \
+ /epoc32/include/domain \
+ /epoc32/include/domain/middleware \
+ /epoc32/include/domain/applications \
+ /epoc32/include/osextensions \
+ /epoc32/include/middleware \
+ /epoc32/include/osextensions/stdapis/stlport \
+ stub/inc \
+ ../../../inc \
+
+CONFIG += qtestlib \
+ Hb \
+ symbian_test
+
+LIBS += -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll \
+ -lxqplugins.dll \
+ -lmpxviewframeworkqt.dll
+
+# Input
+HEADERS += inc/testcollectionview.h \
+ stub/inc/videolistview.h \
+ stub/inc/videocollectionuiloader.h \
+ ../../inc/videocollectionviewplugin.h \
+
+SOURCES += src/testcollectionview.cpp \
+ stub/src/videolistview.cpp \
+ stub/src/videocollectionuiloader.cpp \
+ ../../src/videocollectionviewplugin.cpp
+
+RESOURCES += ../../data/videocollectionview.qrc
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,188 @@
+/**
+* Copyright (c) 2009 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: tester for methods in VideoSortFilterProxyModel
+*
+*/
+
+#ifndef __TESTLISTVIEW_H__
+#define __TESTLISTVIEW_H__
+
+
+// INCLUDES
+#include
+#include "hbmessagebox.h"
+
+class VideoListView;
+class VideoSortFilterProxyModel;
+class VideoCollectionWrapper;
+class VideoCollectionUiLoader;
+class VideoListWidget;
+
+class TestListView : public QObject
+{
+ Q_OBJECT
+
+ /**
+ * Will be called before each testfunction is executed.
+ */
+ void init(bool initTestView = true);
+
+ /**
+ * Returns amount of visible menu actions in the video list view.
+ */
+ int visibleMenuActions();
+
+ // Test functions for the test framework.
+
+private slots:
+
+ /**
+ * Will be called after every testfunction.
+ */
+ void cleanup();
+
+ /**
+ * Tests creating and deleting the view.
+ */
+ void testCreateDelete();
+
+ /**
+ * Tests initializeView.
+ */
+ void testInitializeView();
+
+ /**
+ * Tests creating menu of the view.
+ */
+ void testCreateListMenu();
+
+ /**
+ * Tests menus.
+ */
+ void testMenus();
+
+ /**
+ * Tests createAction.
+ */
+ void testCreateAction();
+
+ /**
+ * Tests activatView.
+ */
+ void testActivateView();
+
+ /**
+ * Tests deactivateView.
+ */
+ void testDeactivateView();
+
+ /**
+ * Tests back.
+ */
+ void testBack();
+
+ /**
+ * Tests modelReadySlot.
+ */
+ void testModelReadySlot();
+
+ /**
+ * Tests deleteItemsSlot.
+ */
+ void testDeleteItemsSlot();
+
+ /**
+ * Tests aboutToShowMainMenuSlot.
+ */
+ void testAboutToShowMainMenuSlot();
+
+ /**
+ * Tests openSortByMenuSlot
+ */
+ void testOpenSortByMenuSlot();
+
+ /**
+ * Tests handleStatusSlot.
+ */
+ void testHandleStatusSlot();
+
+ /**
+ * Tests openAllVideosViewSlot.
+ */
+ void testOpenAllVideosViewSlot();
+
+ /**
+ * Tests openCollectionViewSlot.
+ */
+ void testOpenCollectionViewSlot();
+
+ /**
+ * Tests openServicesViewSlot.
+ */
+ void testOpenServicesViewSlot();
+
+ /**
+ * Tests startSortingSlot.
+ */
+ void testStartSortingSlot();
+
+ /**
+ * Tests view when orientation changes.
+ */
+ void testOrientationSlots();
+
+ /**
+ * Tests collectionOpenedSlot.
+ */
+ void testCollectionOpenedSlot();
+
+ /**
+ * Tests updateSubLabel.
+ */
+ void testUpdateSubLabel();
+
+ /**
+ * Tests showHint
+ */
+ void testShowHint();
+
+signals:
+
+ // Signals needed in tests.
+ void testSignal();
+
+ void testSignal(int);
+
+ void testLayoutChangedSignal();
+
+ void testCollectionOpenedSignal(bool, const QString&);
+
+ void testStatusSignal(int, QVariant&);
+
+private:
+
+ VideoCollectionUiLoader* mUiLoader;
+
+ VideoListView* mTestView;
+
+ VideoListWidget* mListWidget;
+
+ VideoCollectionWrapper* mWrapper;
+};
+
+
+#endif // __TESTCOLLECTIONVIEW_H__
+
+// End of file
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,1313 @@
+/**
+* Copyright (c) 2009 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: tester for methods in VideoListView
+*
+*/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "dummyhbmenu.h"
+#include "videocollectionwrapper.h"
+#include "testlistview.h"
+#include "videolistwidget.h"
+#include "videocollectionviewutils.h"
+#include "videolistselectiondialog.h"
+#include "videosortfilterproxymodel.h"
+#include "videocollectionwrapper.h"
+#include "dummydatamodel.h"
+#include "videocollectionuiloader.h"
+#include "videohintwidget.h"
+
+#define private public
+#include "videolistview.h"
+#undef private
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestListView tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testlistview.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestListView::init(bool initTestView)
+{
+ VideoListWidget::mInitializeCount = 0;
+ VideoListWidget::mInitializeReturnValue = 0;
+ VideoListWidget::mActivateCount = 0;
+ VideoListWidget::mActivateReturnValue = 0;
+ VideoListWidget::mActive = false;
+ VideoListWidget::mDeactivateCount = 0;
+ VideoCollectionWrapper::mOpenFails = false;
+ VideoCollectionWrapper::mGetModelFails = false;
+ VideoCollectionViewUtils::mSortRole = -1;
+ VideoListSelectionDialog::mSelectionCount = 0;
+ VideoListSelectionDialog::mMultiSelectionLaunchCount = 0;
+ VideoListSelectionDialog::mMultiSelectionItemSelectionCount = 0;
+ VideoListSelectionDialog::mExecReturnPrimary = false;
+ VideoCollectionViewUtils::mSortOrder = Qt::AscendingOrder;
+ VideoSortFilterProxyModel::mOpenFails = 0;
+ VideoSortFilterProxyModel::mDoSortingCallCount = 0;
+
+ mUiLoader = new VideoCollectionUiLoader();
+
+ mUiLoader->reset();
+
+ bool ok(false);
+
+ QList objects = mUiLoader->load(DOCML_VIDEOCOLLECTIONVIEW_FILE, &ok);
+
+ if (!ok)
+ {
+ return;
+ }
+
+ mTestView = mUiLoader->findObject( DOCML_NAME_VIEW );
+
+ QVERIFY(mTestView);
+
+ mListWidget = mUiLoader->findWidget(DOCML_NAME_VC_VIDEOLISTWIDGET);
+
+ if(initTestView)
+ {
+ QVERIFY(mTestView->initializeView() == 0);
+ VideoSortFilterProxyModel::mDoSortingCallCount = 0;
+ VideoSortFilterProxyModel::mSortRole = -1;
+ VideoSortFilterProxyModel::mSortOrder = Qt::AscendingOrder;
+ }
+ mWrapper = VideoCollectionWrapper::instance();
+ QVERIFY(mWrapper->open(VideoListWidget::ELevelVideos) != 0);
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestListView::cleanup()
+{
+ delete mTestView;
+ mTestView = 0;
+ if(mWrapper)
+ {
+ mWrapper->decreaseReferenceCount();
+ QCOMPARE(mWrapper->mReferenceCount, 0);
+ }
+
+ disconnect();
+}
+
+// ---------------------------------------------------------------------------
+// visibleMenuActions
+// ---------------------------------------------------------------------------
+//
+int TestListView::visibleMenuActions()
+{
+ int visibleActions(0);
+ VideoListView::TViewActionIds key;
+ HbAction *action(0);
+ foreach(key,mTestView->mMenuActions.keys())
+ {
+ action = dynamic_cast(mTestView->mMenuActions[key]);
+ if(action && action->isVisible())
+ visibleActions++;
+ }
+ return visibleActions;
+}
+
+// ---------------------------------------------------------------------------
+// testCreateDelete
+// ---------------------------------------------------------------------------
+//
+void TestListView::testCreateDelete()
+{
+ mWrapper = 0;
+
+ mUiLoader = new VideoCollectionUiLoader();
+
+ mUiLoader->reset();
+
+ bool ok(false);
+
+ QList objects = mUiLoader->load(DOCML_VIDEOCOLLECTIONVIEW_FILE, &ok);
+
+ if (!ok)
+ {
+ return;
+ }
+
+ mTestView = mUiLoader->findObject( DOCML_NAME_VIEW );
+
+ delete mTestView;
+ mTestView = 0;
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test initialize view
+// ---------------------------------------------------------------------------
+//
+void TestListView::testInitializeView()
+{
+ init(false);
+ // Test videolist widget creation failure.
+ VideoListWidget::mInitializeReturnValue = -1;
+ QVERIFY( mTestView->initializeView() < 0 );
+ QVERIFY( mTestView->mVideoListWidget == 0 );
+ QVERIFY( mTestView->mVideoHintWidget == 0 );
+ QVERIFY( mTestView->mToolbarViewsActionGroup == 0 );
+ QVERIFY( mTestView->mToolbarCollectionActionGroup == 0 );
+ QVERIFY( mTestView->mVideoServices == 0 );
+ QVERIFY( mTestView->mIsService == false );
+
+ cleanup();
+
+ // Test widget creation succeed.
+ init(false);
+ VideoCollectionViewUtils::mSortRole = Qt::DisplayRole;
+ VideoCollectionViewUtils::mSortOrder = Qt::DescendingOrder;
+ QVERIFY( mTestView->initializeView() == 0 );
+ // Verify
+ QVERIFY( mTestView->mVideoListWidget != 0 );
+ QVERIFY( mTestView->mVideoHintWidget != 0 );
+ QCOMPARE( VideoListWidget::mInitializeCount, 1 );
+ QVERIFY( mTestView->mToolbarViewsActionGroup != 0 );
+ QVERIFY( mTestView->mToolbarCollectionActionGroup != 0 );
+ QCOMPARE( mTestView->mToolbarViewsActionGroup->actions().count(), 3 );
+ QCOMPARE( mTestView->mToolbarCollectionActionGroup->actions().count(), 3 );
+ QCOMPARE( mTestView->toolBar()->actions().count(), 3 );
+ // to my understanding the all videos action should always be first.
+ QCOMPARE( mTestView->mToolbarViewsActionGroup->actions().first()->toolTip(), tr("All videos") );
+ QVERIFY( mTestView->mToolbarViewsActionGroup->actions().first()->isChecked() );
+ QCOMPARE( VideoSortFilterProxyModel::mSortRole, (int)Qt::DisplayRole );
+ QCOMPARE( VideoSortFilterProxyModel::mSortOrder, Qt::DescendingOrder );
+ QVERIFY( VideoSortFilterProxyModel::mSortAsync == false );
+ QVERIFY( mTestView->mVideoServices == 0 );
+ QVERIFY( mTestView->mIsService == false );
+ cleanup();
+ cleanup();
+
+ // Test command signal.
+ init(true);
+ connect( this, SIGNAL(testSignal(int)), mTestView->mVideoListWidget, SIGNAL(command(int)) );
+ QSignalSpy spy(mTestView, SIGNAL(command(int)));
+ emit testSignal(5);
+ QCOMPARE( spy.count(), 1 );
+ QList arguments = spy.takeFirst();
+ QCOMPARE( arguments.at(0).toInt(), 5 );
+ disconnect();
+ cleanup();
+
+ init(true);
+ VideoListWidget* list = mTestView->mVideoListWidget;
+ VideoHintWidget* hint = mTestView->mVideoHintWidget;
+ QPointer toolbar = mTestView->mToolbarViewsActionGroup;
+ QPointer toolbar2 = mTestView->mToolbarCollectionActionGroup;
+
+ // Test calling initializeView again.
+ QVERIFY( mTestView->initializeView() == 0 );
+
+ QVERIFY( toolbar != 0 );
+ QVERIFY( toolbar2 != 0 );
+ QVERIFY( mTestView->mVideoListWidget == list );
+ QVERIFY( mTestView->mVideoHintWidget == hint );
+ QVERIFY( mTestView->mToolbarViewsActionGroup == toolbar );
+ QVERIFY( mTestView->mToolbarCollectionActionGroup == toolbar2 );
+
+ // Test view deletion.
+ cleanup();
+ QVERIFY( toolbar == 0 );
+ QVERIFY( toolbar2 == 0 );
+
+ // Test get model failure.
+ init(false);
+ QVERIFY(mTestView);
+ VideoCollectionWrapper::mGetModelFails = true;
+ QVERIFY( mTestView->initializeView() < 0 );
+ QVERIFY( mTestView->mVideoListWidget == 0 );
+ QVERIFY( mTestView->mVideoHintWidget == 0 );
+ QVERIFY( mTestView->mToolbarViewsActionGroup == 0 );
+ QVERIFY( mTestView->mToolbarCollectionActionGroup == 0 );
+ cleanup();
+
+ // Test model open failure.
+ init(false);
+ QVERIFY(mTestView);
+ VideoSortFilterProxyModel::mOpenFails = true;
+ QVERIFY( mTestView->initializeView() < 0 );
+ QVERIFY( mTestView->mVideoListWidget == 0 );
+ QVERIFY( mTestView->mVideoHintWidget == 0 );
+ QVERIFY( mTestView->mToolbarViewsActionGroup == 0 );
+ QVERIFY( mTestView->mToolbarCollectionActionGroup == 0 );
+ cleanup();
+
+ // Test sorting value load 'failure'.
+ init(false);
+ VideoCollectionViewUtils::mSortRole = Qt::DisplayRole;
+ VideoCollectionViewUtils::mSortOrder = Qt::DescendingOrder;
+ VideoCollectionViewUtils::mLoadSortingValuesFails = true;
+ QVERIFY( mTestView->initializeView() == 0 );
+ QCOMPARE( VideoSortFilterProxyModel::mSortRole, (int)VideoCollectionCommon::KeyDateTime );
+ QCOMPARE( VideoSortFilterProxyModel::mSortOrder, Qt::AscendingOrder );
+ QVERIFY( VideoSortFilterProxyModel::mSortAsync == false );
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test create menu
+// ---------------------------------------------------------------------------
+//
+void TestListView::testCreateListMenu()
+{
+ init(false);
+ VideoListWidget::mInitializeReturnValue = -1;
+ QVERIFY( mTestView->initializeView() < 0 );
+ HbMenu* menu = mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU);
+ QVERIFY( menu );
+ QCOMPARE( menu->actions().count(), 4 );
+
+ cleanup();
+
+ init(false);
+ VideoListWidget::mInitializeReturnValue = 0;
+ QVERIFY( mTestView->initializeView() == 0 );
+ menu = mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU);
+ QVERIFY( menu );
+ QCOMPARE( menu->actions().count(), 4 );
+
+ HbAction* sortAction = dynamic_cast(menu->actions().at(3));
+ QVERIFY( sortAction );
+ menu = mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU);
+ QVERIFY(menu != 0);
+ QVERIFY( menu->actions().count() == 4 );
+
+ QVERIFY( mTestView->mMenuActions.count() == 9 );
+ QVERIFY( mTestView->mSortingRoles.count() == 5 );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testMenus
+// ---------------------------------------------------------------------------
+//
+void TestListView::testMenus()
+{
+ init();
+
+ HbAction* action;
+ QList tbActions = mTestView->toolBar()->actions();
+ QList tbGroupActions;
+ QList tbGroupActions2;
+
+ // All videos is open for default, verify.
+ QVERIFY(mTestView->mToolbarViewsActionGroup != 0);
+ QVERIFY(mTestView->mToolbarCollectionActionGroup != 0);
+ tbGroupActions = mTestView->mToolbarViewsActionGroup->actions();
+ tbGroupActions2 = mTestView->mToolbarCollectionActionGroup->actions();
+ QVERIFY(mTestView->mToolbarActions.count() == 6);
+ QVERIFY(tbActions.count() == 3);
+ QVERIFY(tbGroupActions.count() == 3);
+ QVERIFY(tbGroupActions2.count() == 3);
+ QVERIFY( tbGroupActions.at(0)->isChecked() ); // First is checked.
+ // visible menu items remains constant after init until
+ // aboutToShowMainMenuSlot is called
+ QVERIFY(visibleMenuActions() == 9);
+ // Verify checkable and visible toolbar actions.
+ HbAction* allVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
+ HbAction* collectionsAction = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
+ HbAction* servicesAction = mTestView->mToolbarActions[VideoListView::ETBActionServices];
+ HbAction* addVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAddVideos];
+ HbAction* removeVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos];
+ HbAction* sortVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionSortVideos];
+ QVERIFY( allVideosAction != 0 && allVideosAction->isCheckable() && allVideosAction->isVisible() &&
+ tbActions.at(0) == tbGroupActions.at(0));
+ QVERIFY( collectionsAction != 0 && collectionsAction->isCheckable() && collectionsAction->isVisible() &&
+ tbActions.at(1) == tbGroupActions.at(1));
+ QVERIFY( servicesAction != 0 && servicesAction->isCheckable() && servicesAction->isVisible() &&
+ tbActions.at(2) == tbGroupActions.at(2));
+ QVERIFY( addVideosAction != 0 && !addVideosAction->isCheckable() &&
+ tbActions.at(0) != tbGroupActions2.at(0));
+ QVERIFY( removeVideosAction != 0 && !removeVideosAction->isCheckable() &&
+ tbActions.at(1) != tbGroupActions2.at(1));
+ QVERIFY( sortVideosAction != 0 && !sortVideosAction->isCheckable() &&
+ tbActions.at(2) != tbGroupActions2.at(2));
+
+ // Open collections.
+ action = dynamic_cast(tbGroupActions.at(1));
+ QVERIFY(action);
+ action->setChecked(false);
+ action->trigger();
+
+ // Verify.
+ QVERIFY(mTestView->mToolbarViewsActionGroup);
+ tbGroupActions = mTestView->mToolbarViewsActionGroup->actions();
+ QVERIFY(mTestView->mToolbarActions.count() == 6);
+ QVERIFY(tbGroupActions.count() == 3);
+ QVERIFY(tbGroupActions2.count() == 3);
+ QVERIFY( tbGroupActions.at(1)->isChecked() ); // 2nd is checked.
+ // visible menu items remains constant after init until
+ // aboutToShowMainMenuSlot is called
+ QVERIFY(visibleMenuActions() == 9);
+ // Verify checkable and visible toolbar actions.
+ allVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
+ collectionsAction = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
+ servicesAction = mTestView->mToolbarActions[VideoListView::ETBActionServices];
+ addVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAddVideos];
+ removeVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos];
+ sortVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionSortVideos];
+ QVERIFY( allVideosAction != 0 && allVideosAction->isCheckable() && allVideosAction->isVisible() &&
+ tbActions.at(0) == tbGroupActions.at(0));
+ QVERIFY( collectionsAction != 0 && collectionsAction->isCheckable() && collectionsAction->isVisible() &&
+ tbActions.at(1) == tbGroupActions.at(1));
+ QVERIFY( servicesAction != 0 && servicesAction->isCheckable() && servicesAction->isVisible() &&
+ tbActions.at(2) == tbGroupActions.at(2));
+ QVERIFY( addVideosAction != 0 && !addVideosAction->isCheckable() &&
+ tbActions.at(0) != tbGroupActions2.at(0));
+ QVERIFY( removeVideosAction != 0 && !removeVideosAction->isCheckable() &&
+ tbActions.at(1) != tbGroupActions2.at(1));
+ QVERIFY( sortVideosAction != 0 && !sortVideosAction->isCheckable() &&
+ tbActions.at(2) != tbGroupActions2.at(2));
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test create toolbar
+// ---------------------------------------------------------------------------
+//
+void TestListView::testCreateAction()
+{
+ init();
+
+ QVERIFY(mTestView->mToolbarViewsActionGroup != 0);
+
+ QList actions = mTestView->mToolbarViewsActionGroup->actions();
+ actions.append(mTestView->mToolbarCollectionActionGroup->actions());
+ QVERIFY(actions.count() == 6);
+
+ QCOMPARE( mTestView->toolBar()->actions().count(), 3 );
+
+ HbAction* allVideos = static_cast(actions.at(0));
+ QVERIFY( allVideos->isCheckable() );
+ QCOMPARE( allVideos->toolTip(), tr("All videos") );
+ QCOMPARE( allVideos->icon().iconName(), QString(":/images/qtg_mono_video_all.svg") );
+
+ HbAction* collections = static_cast(actions.at(1));
+ QVERIFY( collections->isCheckable() );
+ QCOMPARE( collections->toolTip(), tr("Collections") );
+ QCOMPARE( collections->icon().iconName(), QString(":/images/qtg_mono_video_collection.svg") );
+
+ HbAction* services = static_cast(actions.at(2));
+ QVERIFY( services->isCheckable() );
+ QCOMPARE( services->toolTip(), tr("Services") );
+ QCOMPARE( services->icon().iconName(), QString(":/images/qtg_mono_video_services.svg") );
+
+ HbAction* addVideos = static_cast(actions.at(3));
+ QVERIFY( !addVideos->isCheckable() );
+ QCOMPARE( addVideos->toolTip(), tr("Add videos") );
+ QCOMPARE( addVideos->icon().iconName(), QString(":/images/mono_video_addvideos.svg") );
+
+ HbAction* removeVideos = static_cast(actions.at(4));
+ QVERIFY( !removeVideos->isCheckable() );
+ QCOMPARE( removeVideos->toolTip(), tr("Remove videos") );
+ QCOMPARE( removeVideos->icon().iconName(), QString(":/images/mono_video_removevideos.svg") );
+
+ HbAction* sortVideos = static_cast(actions.at(5));
+ QVERIFY( !sortVideos->isCheckable() );
+ QCOMPARE( sortVideos->toolTip(), tr("Sort by") );
+ QCOMPARE( sortVideos->icon().iconName(), QString(":/images/mono_video_sortvideos.svg") );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test activate view
+// ---------------------------------------------------------------------------
+//
+void TestListView::testActivateView()
+{
+ init();
+
+ VideoListWidget* list = mTestView->mVideoListWidget;
+ mTestView->mVideoListWidget = 0;
+
+ QCOMPARE( mTestView->activateView(), -1 );
+ QVERIFY( mTestView->mVideoListWidget->mActive == false );
+ QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 0 );
+ QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 0 );
+ QVERIFY( mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->isEnabled() == false );
+
+ mTestView->mVideoListWidget = list;
+
+ VideoListWidget::mActivateReturnValue = -1;
+
+ QCOMPARE( mTestView->activateView(), -1 );
+ QVERIFY( mTestView->mVideoListWidget->mActive == false );
+ QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 1 );
+ QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 1 );
+ QVERIFY( mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->isEnabled() == false );
+
+ VideoListWidget::mActivateReturnValue = 0;
+
+ QCOMPARE( mTestView->activateView(), 0 );
+ QVERIFY( mTestView->mVideoListWidget->mActive );
+ QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 2 );
+ QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 1 );
+ QVERIFY( mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->isEnabled() );
+
+ QCOMPARE( mTestView->activateView(), 0 );
+ QVERIFY( mTestView->mVideoListWidget->mActive );
+ QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 3 );
+ QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 1 );
+ QVERIFY( mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->isEnabled() );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test deactivate view
+// ---------------------------------------------------------------------------
+//
+void TestListView::testDeactivateView()
+{
+ init();
+
+ VideoListWidget* list = mTestView->mVideoListWidget;
+ mTestView->mVideoListWidget = 0;
+
+ mTestView->deactivateView();
+ QVERIFY( mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->isVisible() == false );
+ QVERIFY( mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->isEnabled() == false );
+ QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 0 );
+
+ mTestView->mVideoListWidget = list;
+
+ mTestView->deactivateView();
+ QVERIFY( mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->isVisible() == false );
+ QVERIFY( mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->isEnabled() == false );
+ QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 1 );
+
+ VideoListWidget::mActivateReturnValue = 0;
+ mTestView->activateView();
+ mTestView->deactivateView();
+ QVERIFY( mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->isVisible() == false );
+ QVERIFY( mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->isEnabled() == false );
+ QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 1 );
+ QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 2 );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testBack
+// ---------------------------------------------------------------------------
+//
+void TestListView::testBack()
+{
+ init();
+
+ mTestView->back();
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test open all videos slot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testOpenAllVideosViewSlot()
+{
+ init();
+
+ QList actions = mTestView->mToolbarViewsActionGroup->actions();
+ HbAction* action = static_cast(actions.at(0));
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::EAllVideos;
+ mTestView->mVideoListWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
+ mTestView->mSubLabel->setHeading("invalid");
+ mTestView->mModel->mLevel = -1;
+
+ // action wont emit if it's already checked.
+ action->setChecked(false);
+ action->trigger();
+ QCOMPARE( mTestView->mVideoListWidget->mCurrentLevel, VideoListWidget::ELevelVideos );
+ QVERIFY( mTestView->mVideoListWidget->mActive == true );
+ QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 1 );
+ QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 0 );
+ QCOMPARE( mTestView->mSubLabel->heading(), tr("%1 videos").arg(mTestView->mModel->rowCount()) );
+ QCOMPARE( mTestView->mModel->mLevel, (int)VideoListWidget::ELevelVideos );
+
+ mTestView->activateView();
+
+ mTestView->mVideoListWidget->mActivateCount = 0;
+ mTestView->mVideoListWidget->mType = VideoListWidget::EAllVideos;
+ mTestView->mVideoListWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
+ mTestView->mSubLabel->setHeading("invalid");
+ mTestView->mModel->mLevel = -1;
+
+ // action wont emit if it's already checked.
+ action->setChecked(false);
+ action->trigger();
+ QCOMPARE( mTestView->mVideoListWidget->mCurrentLevel, VideoListWidget::ELevelVideos );
+ QVERIFY( mTestView->mVideoListWidget->mActive == true );
+ QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 1 );
+ QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 0 );
+ QCOMPARE( mTestView->mSubLabel->heading(), tr("%1 videos").arg(mTestView->mModel->rowCount()) );
+ QCOMPARE( mTestView->mModel->mLevel, (int)VideoListWidget::ELevelVideos );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test open collections view slot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testOpenCollectionViewSlot()
+{
+ init();
+
+ QList actions = mTestView->mToolbarViewsActionGroup->actions();
+ HbAction* action = static_cast(actions.at(1));
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::ECollections;
+ mTestView->mVideoListWidget->mCurrentLevel = VideoListWidget::ELevelVideos;
+ mTestView->mSubLabel->setHeading("invalid");
+ mTestView->mModel->mLevel = -1;
+
+ // action wont emit if it's already checked.
+ action->setChecked(false);
+ action->trigger();
+ QCOMPARE( mTestView->mVideoListWidget->mCurrentLevel, VideoListWidget::ELevelCategory );
+ QVERIFY( mTestView->mVideoListWidget->mActive == true );
+ QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 1 );
+ QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 0 );
+ QCOMPARE( mTestView->mSubLabel->heading(), tr("%1 collections").arg(mTestView->mModel->rowCount()) );
+ QCOMPARE( mTestView->mModel->mLevel, (int)VideoListWidget::ELevelCategory );
+
+ mTestView->activateView();
+
+ mTestView->mVideoListWidget->mActivateCount = 0;
+ mTestView->mVideoListWidget->mType = VideoListWidget::ECollections;
+ mTestView->mVideoListWidget->mCurrentLevel = VideoListWidget::ELevelVideos;
+ mTestView->mSubLabel->setHeading("invalid");
+ mTestView->mModel->mLevel = -1;
+
+ // action wont emit if it's already checked.
+ action->setChecked(false);
+ action->trigger();
+ QCOMPARE( mTestView->mVideoListWidget->mCurrentLevel, VideoListWidget::ELevelCategory );
+ QVERIFY( mTestView->mVideoListWidget->mActive == true );
+ QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 1 );
+ QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 0 );
+ QCOMPARE( mTestView->mSubLabel->heading(), tr("%1 collections").arg(mTestView->mModel->rowCount()) );
+ QCOMPARE( mTestView->mModel->mLevel, (int)VideoListWidget::ELevelCategory );
+
+ cleanup();
+}
+// ---------------------------------------------------------------------------
+// Slot: test open services view slot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testOpenServicesViewSlot()
+{
+ init();
+
+ QList actions = mTestView->mToolbarViewsActionGroup->actions();
+ HbAction* action = static_cast(actions.at(2));
+
+ // action wont emit if it's already checked.
+ action->setChecked(false);
+ action->trigger();
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testStartSorting
+// ---------------------------------------------------------------------------
+//
+void TestListView::testStartSortingSlot()
+{
+ HbAction *action(0);
+
+ // Active action is not sort by.
+ init(true);
+ action = mTestView->mMenuActions[VideoListView::EActionDelete];
+ QVERIFY(action != 0);
+ mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->setActiveAction(action);
+ connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
+ emit testSignal(0);
+ QCOMPARE(VideoSortFilterProxyModel::mDoSortingCallCount, 0);
+ QCOMPARE(VideoSortFilterProxyModel::mSortRole, -1);
+ cleanup();
+
+ // Sort by action has no menu.
+ init(true);
+
+ // Change sort by action to delete action which has no menu.
+ HbAction *sortByAction = mTestView->mMenuActions[VideoListView::EActionSortBy];
+ HbAction *deleteAction = mTestView->mMenuActions[VideoListView::EActionDelete];
+ mTestView->mMenuActions[VideoListView::EActionSortBy] = deleteAction;
+ mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->setActiveAction(deleteAction);
+
+ connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
+ emit testSignal(0);
+ QCOMPARE(VideoSortFilterProxyModel::mDoSortingCallCount, 0);
+ QCOMPARE(VideoSortFilterProxyModel::mSortRole, -1);
+
+ // Change the action back.
+ mTestView->mMenuActions[VideoListView::EActionSortBy] = sortByAction;
+
+ cleanup();
+
+ // View is not initialized.
+ init(false);
+ connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
+ emit testSignal(0);
+ QCOMPARE(VideoSortFilterProxyModel::mDoSortingCallCount, 0);
+ QCOMPARE(VideoSortFilterProxyModel::mSortRole, -1);
+ cleanup();
+
+ // Good case.
+ init();
+ action = mTestView->mMenuActions[VideoListView::EActionSortBy];
+ QVERIFY(action != 0);
+ mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->setActiveAction(action);
+ HbAction* sortAction = mTestView->mMenuActions[VideoListView::EActionSortByName];
+ QVERIFY(sortAction != 0);
+ action->menu()->setActiveAction(sortAction);
+
+ connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
+ emit testSignal(0);
+ QCOMPARE(VideoSortFilterProxyModel::mDoSortingCallCount, 1);
+ QCOMPARE(VideoSortFilterProxyModel::mSortRole, (int)Qt::DisplayRole);
+ QCOMPARE(VideoSortFilterProxyModel::mSortOrder, Qt::AscendingOrder);
+ QVERIFY(VideoSortFilterProxyModel::mSortAsync);
+
+ // emit test signal again, with same parameters. Sorting should be switched to
+ // descending order.
+ emit testSignal(0);
+ QCOMPARE(VideoSortFilterProxyModel::mDoSortingCallCount, 2);
+ QCOMPARE(VideoSortFilterProxyModel::mSortRole, (int)Qt::DisplayRole);
+ QCOMPARE(VideoSortFilterProxyModel::mSortOrder, Qt::DescendingOrder);
+ QVERIFY(VideoSortFilterProxyModel::mSortAsync);
+
+ // on third emit, sorting should be switched back to ascending
+ emit testSignal(0);
+ QCOMPARE(VideoSortFilterProxyModel::mDoSortingCallCount, 3);
+ QCOMPARE(VideoSortFilterProxyModel::mSortRole, (int)Qt::DisplayRole);
+ QCOMPARE(VideoSortFilterProxyModel::mSortOrder, Qt::AscendingOrder);
+ QVERIFY(VideoSortFilterProxyModel::mSortAsync);
+
+ // test that after changing the sort role, the order is also switched to ascending.
+ VideoSortFilterProxyModel::mSortOrder = Qt::DescendingOrder;
+ sortAction = mTestView->mMenuActions[VideoListView::EActionSortByDate];
+ QVERIFY(sortAction != 0);
+ action->menu()->setActiveAction(sortAction);
+
+ emit testSignal(0);
+ QCOMPARE(VideoSortFilterProxyModel::mDoSortingCallCount, 4);
+ QCOMPARE(VideoSortFilterProxyModel::mSortRole, (int)VideoCollectionCommon::KeyDateTime);
+ QCOMPARE(VideoSortFilterProxyModel::mSortOrder, Qt::AscendingOrder);
+ QVERIFY(VideoSortFilterProxyModel::mSortAsync);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test orientation related slots
+// ---------------------------------------------------------------------------
+//
+void TestListView::testOrientationSlots()
+{
+ init();
+
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+ mainWnd->addView(mTestView);
+ mainWnd->setOrientation(Qt::Horizontal);
+ mainWnd->setOrientation(Qt::Vertical);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testModelReadySlot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testModelReadySlot()
+{
+ init();
+ mTestView->mModelReady = false;
+ connect( this, SIGNAL(testSignal()), mTestView, SLOT(modelReadySlot()) );
+ emit testSignal();
+ QVERIFY(mTestView->mModelReady);
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testDeleteItemsSlot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testDeleteItemsSlot()
+{
+ init();
+ connect( this, SIGNAL(testSignal()), mTestView, SLOT(deleteItemsSlot()) );
+ ////////////
+ // no model
+ ////////////
+ VideoSortFilterProxyModel *tmpModel = mTestView->mModel;
+ mTestView->mModel = 0;
+ emit testSignal();
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 0);
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 0);
+ mTestView->mModel = tmpModel;
+
+ cleanup();
+ init();
+ connect( this, SIGNAL(testSignal()), mTestView, SLOT(deleteItemsSlot()) );
+
+ ////////////
+ // no selection dialog
+ ////////////
+ emit testSignal();
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 1);
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 0);
+
+ cleanup();
+ init();
+ connect( this, SIGNAL(testSignal()), mTestView, SLOT(deleteItemsSlot()) );
+
+ ////////////
+ // dialog loading fails
+ ////////////
+ VideoCollectionUiLoader::mFailDialogLoad = true;
+ emit testSignal();
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 0);
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 0);
+ VideoCollectionUiLoader::mFailDialogLoad = false;
+ //////////
+ // document loader deletes all objects in case of error, so we cannot cleanup all
+ if(mWrapper)
+ {
+ mWrapper->decreaseReferenceCount();
+ QCOMPARE(mWrapper->mReferenceCount, 0);
+ }
+ disconnect();
+ ///////////////
+ init();
+ connect( this, SIGNAL(testSignal()), mTestView, SLOT(deleteItemsSlot()) );
+
+ ////////////
+ // selection dialog exists
+ ////////////
+ emit testSignal();
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 1);
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 0);
+ emit testSignal();
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 2);
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 0);
+
+ cleanup();
+ init();
+ connect( this, SIGNAL(testSignal()), mTestView, SLOT(deleteItemsSlot()) );
+
+ ////////////
+ // exec returns primary key (just for the coverity's sake)
+ ////////////
+ VideoListSelectionDialog:: mExecReturnPrimary = true;
+ VideoListSelectionDialog::mSelectionCount = 5;
+ emit testSignal();
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 1);
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 5);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testAboutToShowMainMenuSlot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testAboutToShowMainMenuSlot()
+{
+ // All ok.
+ init();
+ mWrapper->getDataModel()->setRowCount(1);
+ mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->show();
+ QVERIFY(visibleMenuActions() == 6);
+ cleanup();
+
+ // View is not initialized.
+ init(false);
+ mWrapper->getDataModel()->setRowCount(1);
+ connect( this, SIGNAL(testSignal(int)), mTestView, SLOT(aboutToShowMainMenuSlot()) );
+ emit testSignal(0);
+ cleanup();
+
+ HbAction *action(0);
+
+ // Collections is triggered from toolbar.
+ init();
+ mWrapper->getDataModel()->setRowCount(1);
+ action = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
+ QVERIFY(action != 0);
+ action->setChecked(false);
+ action->trigger();
+ mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->show();
+ int visible = visibleMenuActions();
+ QCOMPARE(visible, 5);
+ cleanup();
+
+ // All videos is triggered from toolbar.
+ init();
+ mWrapper->getDataModel()->setRowCount(1);
+ action = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
+ QVERIFY(action != 0);
+ action->setChecked(false);
+ action->trigger();
+ mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->show();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 6);
+ cleanup();
+
+ // Services is triggered from toolbar.
+ init();
+ mWrapper->getDataModel()->setRowCount(1);
+ action = mTestView->mToolbarActions[VideoListView::ETBActionServices];
+ QVERIFY(action != 0);
+ action->setChecked(false);
+ action->trigger();
+ mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->show();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 0);
+ cleanup();
+
+ // Add videos action is visible.
+ init();
+ mTestView->toolBar()->clearActions();
+ mTestView->toolBar()->addActions( mTestView->mToolbarCollectionActionGroup->actions() );
+
+ mWrapper->getDataModel()->setRowCount(1);
+ QVERIFY(action != 0);
+ mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->show();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 1);
+ cleanup();
+
+ // Menu action is null
+ init();
+ mWrapper->getDataModel()->setRowCount(1);
+ action = mTestView->mMenuActions.take(VideoListView::EActionSortBy);
+ delete action;
+ action = NULL;
+ mTestView->mMenuActions[VideoListView::EActionSortBy] = action;
+ mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->show();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 0);
+ cleanup();
+
+ // No menu actions.
+ init();
+ mWrapper->getDataModel()->setRowCount(1);
+ QMap backupActions =
+ QMap(mTestView->mMenuActions);
+ mTestView->mMenuActions.clear();
+ mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->show();
+ mTestView->mMenuActions.unite(backupActions);
+ cleanup();
+
+ // Model has no items.
+ init();
+ mWrapper->getDataModel()->setRowCount(0);
+ mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->show();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 0);
+ cleanup();
+
+ // Toolbar action group is null
+ init();
+ mWrapper->getDataModel()->setRowCount(1);
+ QActionGroup* actionGroup = mTestView->mToolbarViewsActionGroup;
+ mTestView->mToolbarViewsActionGroup = NULL;
+ mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->show();
+ mTestView->mToolbarViewsActionGroup = actionGroup;
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testOpenSortByMenuSlot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testOpenSortByMenuSlot()
+{
+ DummyHbMenu *dummyMenu = new DummyHbMenu;
+ HbMenu *tmpMenu;
+
+ // All ok.
+ init();
+ tmpMenu = mTestView->mSortMenu;
+ mTestView->mSortMenu = dummyMenu;
+ connect( this, SIGNAL(testSignal(int)), mTestView, SLOT(openSortByMenuSlot()) );
+ mWrapper->getDataModel()->setRowCount(1);
+ mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->hide();
+ emit testSignal(0);
+ // sorting menu should be visible
+ QVERIFY(visibleMenuActions() == 4);
+ mTestView->mSortMenu = tmpMenu;
+ cleanup();
+
+ // View is not initialized.
+ init(false);
+ tmpMenu = mTestView->mSortMenu;
+ mTestView->mSortMenu = dummyMenu;
+ connect( this, SIGNAL(testSignal(int)), mTestView, SLOT(openSortByMenuSlot()) );
+ mWrapper->getDataModel()->setRowCount(1);
+ mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->hide();
+ emit testSignal(0);
+ QCOMPARE(visibleMenuActions(), 0);
+ mTestView->mSortMenu = tmpMenu;
+ cleanup();
+
+ // no items
+ init();
+ tmpMenu = mTestView->mSortMenu;
+ mTestView->mSortMenu = dummyMenu;
+ connect( this, SIGNAL(testSignal(int)), mTestView, SLOT(openSortByMenuSlot()) );
+ mWrapper->getDataModel()->setRowCount(0);
+ mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->hide();
+ emit testSignal(0);
+ QCOMPARE(visibleMenuActions(), 0);
+ mTestView->mSortMenu = tmpMenu;
+ cleanup();
+
+ delete dummyMenu;
+
+}
+
+// ---------------------------------------------------------------------------
+// testHandleErrorSlot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testHandleStatusSlot()
+{
+ QVariant *variant = new QVariant();
+
+ // Unknown error code.
+ init();
+ connect(this, SIGNAL(testStatusSignal(int, QVariant&)), mTestView, SLOT(handleAsyncStatusSlot(int, QVariant&)));
+ emit testStatusSignal(0, *variant);
+ QVERIFY(VideoCollectionViewUtils::mLastError == 0);
+ cleanup();
+
+ // Multiple deletion error.
+ init();
+ connect(this, SIGNAL(testStatusSignal(int, QVariant&)), mTestView, SLOT(handleAsyncStatusSlot(int, QVariant&)));
+ emit testStatusSignal(VideoCollectionCommon::statusMultipleDeleteFail, *variant);
+ QVERIFY(VideoCollectionViewUtils::mLastError == VideoCollectionCommon::statusMultipleDeleteFail);
+ cleanup();
+
+ // Deletion error.
+ init();
+ connect(this, SIGNAL(testStatusSignal(int, QVariant&)), mTestView, SLOT(handleAsyncStatusSlot(int, QVariant&)));
+ emit testStatusSignal(VideoCollectionCommon::statusSingleDeleteFail, *variant);
+ QVERIFY(VideoCollectionViewUtils::mLastError == VideoCollectionCommon::statusSingleDeleteFail);
+ cleanup();
+
+ // status multidelete succeed
+ init();
+ connect(this, SIGNAL(testStatusSignal(int, QVariant&)), mTestView, SLOT(handleAsyncStatusSlot(int, QVariant&)));
+ emit testStatusSignal(VideoCollectionCommon::statusMultipleDeleteSucceed, *variant);
+ QVERIFY(VideoCollectionViewUtils::mLastError == VideoCollectionCommon::statusMultipleDeleteSucceed);
+ cleanup();
+
+ // No model.
+ init(false);
+ connect(this, SIGNAL(testStatusSignal(int, QVariant&)), mTestView, SLOT(handleAsyncStatusSlot(int, QVariant&)));
+ emit testStatusSignal(1, *variant);
+ QVERIFY(VideoCollectionViewUtils::mLastError == 1);
+ cleanup();
+
+ delete variant;
+}
+
+// ---------------------------------------------------------------------------
+// testCollectionOpenedSlot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testCollectionOpenedSlot()
+{
+ HbAction* removeVideosAction;
+ HbAction* allVideosAction;
+ HbAction* collectionsAction;
+ HbAction* servicesAction;
+ HbAction* addVideosAction;
+ HbAction* sortVideosAction;
+
+ QString testString;
+
+ // View is not initialized.
+ init(false);
+ connect(this, SIGNAL(testCollectionOpenedSignal(bool, const QString&)), mTestView, SLOT(collectionOpenedSlot(bool, const QString&)));
+ emit testCollectionOpenedSignal(false, testString);
+ cleanup();
+
+ // No toolbar actions.
+ init(true);
+ // Clear actions.
+ QMap backupActions =
+ QMap(mTestView->mToolbarActions);
+ mTestView->mToolbarActions.clear();
+ connect(this, SIGNAL(testCollectionOpenedSignal(bool, const QString&)), mTestView, SLOT(collectionOpenedSlot(bool, const QString&)));
+ emit testCollectionOpenedSignal(true, testString);
+ mTestView->mToolbarActions.unite(backupActions);
+ cleanup();
+
+ // One of the toolbar actions is null.
+ init();
+ removeVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos];
+ mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos] = NULL;
+ connect(this, SIGNAL(testCollectionOpenedSignal(bool, const QString&)), mTestView, SLOT(collectionOpenedSlot(bool, const QString&)));
+ emit testCollectionOpenedSignal(true, testString);
+ // Verify checkable and visible toolbar actions.
+ mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos] = removeVideosAction;
+ allVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
+ collectionsAction = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
+ servicesAction = mTestView->mToolbarActions[VideoListView::ETBActionServices];
+ addVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAddVideos];
+ sortVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionSortVideos];
+ // Remove videos is not checked because it was used as null action.
+ QCOMPARE( mTestView->mCollectionName, testString );
+ QCOMPARE( mTestView->toolBar()->actions().count(), 3 );
+ QVERIFY( allVideosAction != 0 && allVideosAction->isCheckable());
+ QVERIFY( collectionsAction != 0 && collectionsAction->isCheckable());
+ QVERIFY( servicesAction != 0 && servicesAction->isCheckable());
+ QVERIFY( addVideosAction != 0 && !addVideosAction->isCheckable() );
+ QVERIFY( sortVideosAction != 0 && !sortVideosAction->isCheckable() );
+ cleanup();
+
+
+ testString = "Test text string";
+
+ // Collection opened.
+ init();
+ connect(this, SIGNAL(testCollectionOpenedSignal(bool, const QString&)), mTestView, SLOT(collectionOpenedSlot(bool, const QString&)));
+ emit testCollectionOpenedSignal(true, testString);
+ // Verify checkable and visible toolbar actions.
+ allVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
+ collectionsAction = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
+ servicesAction = mTestView->mToolbarActions[VideoListView::ETBActionServices];
+ addVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAddVideos];
+ removeVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos];
+ sortVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionSortVideos];
+ QCOMPARE(mTestView->mCollectionName, testString);
+ QCOMPARE( mTestView->toolBar()->actions().count(), 3 );
+ QVERIFY( allVideosAction != 0 && allVideosAction->isCheckable());
+ QVERIFY( collectionsAction != 0 && collectionsAction->isCheckable());
+ QVERIFY( servicesAction != 0 && servicesAction->isCheckable());
+ QVERIFY( addVideosAction != 0 && !addVideosAction->isCheckable() );
+ QVERIFY( removeVideosAction != 0 && !removeVideosAction->isCheckable() );
+ QVERIFY( sortVideosAction != 0 && !sortVideosAction->isCheckable() );
+ cleanup();
+
+ testString = "Test text string 2";
+
+ // Collection not opened.
+ init();
+ connect(this, SIGNAL(testCollectionOpenedSignal(bool, const QString&)), mTestView, SLOT(collectionOpenedSlot(bool, const QString&)));
+ emit testCollectionOpenedSignal(false, testString);
+ // Verify checkable and visible toolbar actions.
+ allVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
+ collectionsAction = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
+ servicesAction = mTestView->mToolbarActions[VideoListView::ETBActionServices];
+ addVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAddVideos];
+ removeVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos];
+ sortVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionSortVideos];
+ QCOMPARE(mTestView->mCollectionName, testString);
+ QCOMPARE( mTestView->toolBar()->actions().count(), 3 );
+ QVERIFY( allVideosAction != 0 && allVideosAction->isCheckable());
+ QVERIFY( collectionsAction != 0 && collectionsAction->isCheckable());
+ QVERIFY( servicesAction != 0 && servicesAction->isCheckable());
+ QVERIFY( addVideosAction != 0 && !addVideosAction->isCheckable() );
+ QVERIFY( removeVideosAction != 0 && !removeVideosAction->isCheckable() );
+ QVERIFY( sortVideosAction != 0 && !sortVideosAction->isCheckable() );
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testUpdateSubLabel
+// ---------------------------------------------------------------------------
+//
+void TestListView::testUpdateSubLabel()
+{
+ init(true);
+ connect(this, SIGNAL(testLayoutChangedSignal()), mTestView, SLOT(layoutChangedSlot()));
+ connect(this, SIGNAL(testCollectionOpenedSignal(bool, const QString&)), mTestView, SLOT(collectionOpenedSlot(bool, const QString&)));
+ mWrapper->getDataModel()->setRowCount(1);
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::EAllVideos;
+
+ emit testLayoutChangedSignal();
+
+ HbGroupBox* label = mUiLoader->findWidget(DOCML_NAME_VC_HEADINGBANNER);
+
+ QString returnString = label->heading();
+ QString expectedString = "1 videos";
+
+ QCOMPARE(returnString, expectedString);
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::EUnknown;
+
+ emit testLayoutChangedSignal();
+
+ returnString = label->heading();
+ expectedString = "1 videos";
+
+ QCOMPARE(returnString, expectedString);
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::ECollections;
+
+ emit testLayoutChangedSignal();
+
+ returnString = label->heading();
+ expectedString = "1 collections";
+
+ QCOMPARE(returnString, expectedString);
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::EUnknown;
+
+ emit testLayoutChangedSignal();
+
+ returnString = label->heading();
+ expectedString = "1 collections";
+
+ QCOMPARE(returnString, expectedString);
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::EDefaultColItems;
+
+ emit testLayoutChangedSignal();
+
+ returnString = label->heading();
+ expectedString = " (1)";
+
+ QCOMPARE(returnString, expectedString);
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::EUnknown;
+ expectedString = " (1)";
+
+ emit testLayoutChangedSignal();
+
+ returnString = label->heading();
+
+ QCOMPARE(returnString, expectedString);
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::EUserColItems;
+
+ emit testCollectionOpenedSignal(true, QString("NAME"));
+ emit testLayoutChangedSignal();
+
+ returnString = label->heading();
+ expectedString = "NAME (1)";
+
+ QCOMPARE(returnString, expectedString);
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::EAllVideos;
+ VideoSortFilterProxyModel* model = mTestView->mModel;
+ mTestView->mModel = 0;
+ expectedString = "testtesttesttest";
+ label->setHeading(expectedString);
+
+ // should not crash.
+ emit testLayoutChangedSignal();
+
+ // make sure that the heading has not changed.
+ QCOMPARE(label->heading(), expectedString);
+}
+
+// ---------------------------------------------------------------------------
+// testShowHint
+// ---------------------------------------------------------------------------
+//
+void TestListView::testShowHint()
+{
+ init(true);
+ connect(this, SIGNAL(testLayoutChangedSignal()), mTestView, SLOT(layoutChangedSlot()));
+ mWrapper->getDataModel()->setRowCount(1);
+
+ mTestView->mModelReady = false;
+ // tests that the showhint is not called, and currently only way of doing that
+ // is to set hint widget visible and check that it is not hidden.
+ mTestView->mVideoHintWidget->setVisible(true);
+
+ emit testLayoutChangedSignal();
+
+ QVERIFY(mTestView->mVideoHintWidget->isVisible());
+
+ VideoSortFilterProxyModel* model = mTestView->mModel;
+ mTestView->mModel = 0;
+ mTestView->mModelReady = true;
+
+ emit testLayoutChangedSignal();
+
+ QVERIFY(mTestView->mVideoHintWidget->isVisible() == false);
+
+ mTestView->mModel = model;
+ mWrapper->getDataModel()->setRowCount(0);
+ mTestView->mVideoHintWidget->setVisible(true);
+ VideoHintWidget* hint = mTestView->mVideoHintWidget;
+ mTestView->mVideoHintWidget = 0;
+
+ // should not crash. No other verification possible.
+ emit testLayoutChangedSignal();
+
+ mTestView->mVideoHintWidget = hint;
+ mTestView->mVideoHintWidget->setVisible(false);
+
+ emit testLayoutChangedSignal();
+
+ QVERIFY(mTestView->mVideoHintWidget->isVisible());
+
+ mWrapper->getDataModel()->setRowCount(1);
+ mTestView->mVideoHintWidget->setVisible(true);
+
+ emit testLayoutChangedSignal();
+
+ QVERIFY(mTestView->mVideoHintWidget->isVisible() == false);
+}
+
+// End of file
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/inc/hbmessagebox.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/hbmessagebox.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2008-2009 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: HbMessageBox class declaration.
+*
+*/
+
+
+#ifndef HBMESSAGEBOX_H
+#define HBMESSAGEBOX_H
+
+#include
+
+class HbMessageBox;
+
+
+class HbMessageBox
+{
+
+public:
+
+ static bool question(QString text)
+ {
+ mLatestTxt = text;
+ return mQuestionReturnValue;
+ }
+
+ static void information(QString text)
+ {
+ mLatestTxt = text;
+ }
+
+ /**
+ * returned from question
+ */
+ static bool mQuestionReturnValue;
+
+ /**
+ * saved text
+ */
+ static QString mLatestTxt;
+
+};
+
+
+
+#endif // HBMESSAGEBOX_H
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/inc/videocollectionuiloader.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videocollectionuiloader.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#ifndef _VIDEOCOLLECTIONUILOADER_H_
+#define _VIDEOCOLLECTIONUILOADER_H_
+
+// System includes
+#include
+
+// Constants
+static const char* DOCML_VIDEOCOLLECTIONVIEW_FILE = ":/layout/collectionview.docml";
+static const char* DOCML_NAME_VIEW = "view";
+
+// Videocollection View
+static const char* DOCML_NAME_VC_HEADINGBANNER = "vc:mBanner";
+static const char* DOCML_NAME_VC_VIDEOLISTWIDGET = "vc:mListWidget";
+static const char* DOCML_NAME_VC_VIDEOHINTWIDGET = "vc:mHintWidget";
+
+// Videocollection Options Menu
+static const char* DOCML_NAME_OPTIONS_MENU = "vc:mOptionsMenu";
+static const char* DOCML_NAME_SORT_MENU = "vc:mSortBy";
+
+static const char* DOCML_NAME_SORT_BY_DATE = "vc:mDate";
+static const char* DOCML_NAME_SORT_BY_NAME = "vc:mName";
+static const char* DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS = "vc:mNumberOfItems";
+static const char* DOCML_NAME_SORT_BY_TOTAL_LENGTH = "vc:mTotalLength";
+static const char* DOCML_NAME_SORT_BY_RATING = "vc:mRating";
+static const char* DOCML_NAME_SORT_BY_SIZE = "vc:mSize";
+
+static const char* DOCML_NAME_ADD_TO_COLLECTION = "vc:mAddtoCollection";
+static const char* DOCML_NAME_CREATE_COLLECTION = "vc:mCreateNewCollection";
+static const char* DOCML_NAME_DELETE_MULTIPLE = "vc:mDeleteMultiple";
+
+static const char* DOCML_NAME_PLAY_IN_QUEUE = "vc:mPlayInQueue";
+static const char* DOCML_NAME_PLAY_ALL_ITEMS = "vc:mPlayAllItems";
+
+// Videocollection hint widget
+static const char* DOCML_NAME_HINT_BUTTON = "vc:mHintButton";
+static const char* DOCML_NAME_HINT_LABEL = "vc:mHintTextLabel";
+
+// video multiselection dialog
+static const char* DOCML_VIDEOSELECTIONDIALOG_FILE = ":/layout/videolistselectiondialog.docml";
+static const char* DOCML_NAME_DIALOG = "mMultiSelectionDialog";
+static const char* DOCML_NAME_DLG_HEADINGLBL = "mHeadingLabel";
+static const char* DOCML_NAME_MARKALL = "mCheckMarkAll";
+static const char* DOCML_NAME_LBL_SELECTION = "mSelectionCount";
+static const char* DOCML_NAME_LIST_CONTAINER = "mListContainer";
+
+// Class declaration
+class VideoCollectionUiLoader : public HbDocumentLoader
+{
+
+public:
+
+ VideoCollectionUiLoader();
+
+ ~VideoCollectionUiLoader();
+
+ /**
+ * Returns the requested widget casted to correct type
+ *
+ * @param name Name of the widget
+ * @return Pointer to the widget
+ */
+ template
+ T* findWidget( QString name )
+ {
+ return qobject_cast( HbDocumentLoader::findWidget( name ) );
+ }
+
+ /**
+ * Returns the requested object casted to correct type
+ *
+ * @param name Name of the object
+ * @return Pointer to the object
+ */
+ template
+ T* findObject( QString name )
+ {
+ return qobject_cast( HbDocumentLoader::findObject( name ) );
+ }
+
+ static bool mFindFailure;
+
+ static bool mFailDialogLoad;
+
+private:
+
+ QObject *createObject( const QString& type, const QString &name );
+};
+
+#endif // _VIDEOCOLLECTIONUILOADER_H_
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/inc/videocollectionviewutils.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videocollectionviewutils.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* 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: stub video collection view plugin's ui utils class
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONVIEWUTILS_H__
+#define __VIDEOCOLLECTIONVIEWUTILS_H__
+
+#include
+#include
+
+class HbPopupBase;
+class QItemSelection;
+class HbStackedWidget;
+
+class VideoCollectionViewUtils : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Returns singleton instance for this class.
+ *
+ * WARNING! Not safe to call this from destructor of another function scope static object!
+ *
+ * @return The singleton instance.
+ */
+ static VideoCollectionViewUtils& instance();
+
+ /**
+ * Saves the sorting role and order to cenrep.
+ *
+ * @param role The sorting role.
+ * @param order The sorting order (e.g. ascending or descending).
+ * @return Zero if operation succeeded, less than zero in error cases.
+ */
+ int saveSortingValues(int role, Qt::SortOrder order);
+
+ /**
+ * Loads the sorting role and order from cenrep.
+ *
+ * @param role On return contains the sorting role.
+ * @param order On return contains the sorting order
+ * @return Zero if operation succeeded, less than zero in error cases.
+ */
+ int loadSortingValues(int& role, Qt::SortOrder& order);
+
+public slots:
+
+ /**
+ * Shows status msgs
+ *
+ * @param statusCode status code
+ * @param additional additional data gotten from the status
+ */
+ void showStatusMsgSlot(int statusCode, QVariant &additional);
+
+private:
+
+ /**
+ * disables copy-constructor and assingment operator
+ */
+ Q_DISABLE_COPY(VideoCollectionViewUtils)
+
+ /**
+ * constructor
+ */
+ VideoCollectionViewUtils();
+
+ /**
+ * destructor
+ */
+ virtual ~VideoCollectionViewUtils();
+
+
+public:
+ static int mLastError;
+ static bool mLoadSortingValuesFails;
+
+ static int mSortRole;
+ static Qt::SortOrder mSortOrder;
+};
+
+#endif //__VIDEOCOLLECTIONVIEWUTILS_H__
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/inc/videocollectionwrapper.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videocollectionwrapper.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2009 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: VideoCollectionWrapper dummy class definition
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONWRAPPER_H__
+#define __VIDEOCOLLECTIONWRAPPER_H__
+
+
+// INCLUDES
+#include
+
+
+// FORWARD DECLARATIONS
+class VideoSortFilterProxyModel;
+class DummyDataModel;
+
+class VideoCollectionWrapper : public QObject
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+public: // Constructor
+
+ /**
+ * Returns singleton instance for this class.
+ *
+ * WARNING! Not safe to call this from destructor of another function scope static object!
+ *
+ * @return The singleton instance.
+ */
+ static VideoCollectionWrapper *instance();
+
+ /**
+ * Decreases the reference count, when count reaches zero cleanup is done.
+ *
+ */
+ void decreaseReferenceCount();
+
+
+ /**
+ * Opens a collection into all videos category, if not yet opened, and
+ * returns pointer to model
+ *
+ * @return address to model or NULL if fails.
+ */
+ VideoSortFilterProxyModel* open(int level);
+
+ /**
+ * Returns pointer to model
+ *
+ * @return address to model or NULL if fails.
+ */
+ VideoSortFilterProxyModel* getModel();
+
+ /**
+ * Method can be used by client to emit status signal
+ * indicating async operation status.
+ *
+ * @param statusCode code of error
+ *
+ * @param additional additional information for the code
+ */
+ void sendAsyncStatus(int statusCode, QVariant &additional);
+
+public: // Test functions:
+
+ /**
+ * Returns pointer to model with the data.
+ *
+ * @return address to model or NULL if fails.
+ */
+ DummyDataModel* getDataModel();
+
+signals:
+
+ /**
+ * Signal to be emitted in case of some error
+ *
+ * @param statusCode code of error
+ *
+ * @param additional additional information for the code
+ */
+ void asyncStatus(int statusCode, QVariant &additional);
+
+private:
+
+ /**
+ * Private contructor.
+ */
+ VideoCollectionWrapper();
+
+ /**
+ * Private destructor.
+ *
+ */
+ virtual ~VideoCollectionWrapper();
+
+ /**
+ * Creates model.
+ */
+ void createModel();
+
+ /**
+ * disables copy-constructor and assingment operator
+ */
+ Q_DISABLE_COPY(VideoCollectionWrapper)
+
+public:
+
+ VideoSortFilterProxyModel *mModel;
+ DummyDataModel *mDataModel;
+
+ static VideoCollectionWrapper *mInstance;
+
+ static int mReferenceCount;
+
+public:
+ static bool mOpenFails;
+ static bool mGetModelFails;
+};
+
+#endif // __VIDEOCOLLECTIONWRAPPER_H__
+// End of file
+
+
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/inc/videohintwidget.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videohintwidget.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* 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 hint widget
+*
+*/
+
+
+#ifndef VIDEOHINTWIDGET_H
+#define VIDEOHINTWIDGET_H
+
+#include
+
+class HbLabel;
+class VideoCollectionUiLoader;
+class QGraphicsItem;
+
+/**
+ * Widget for displaying no videos text and possible hint and button for user
+ * find where to download new videos.
+ */
+class VideoHintWidget : public HbWidget
+{
+ Q_OBJECT
+
+public:
+
+ enum HintLevel {
+ AllVideos,
+ Collection
+ };
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ */
+ VideoHintWidget(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ ~VideoHintWidget();
+
+ /**
+ * Sets the level where the hint is correctly. Hint displays differently in
+ * for example collection level, than in allVideos level.
+ *
+ * @param level The current level.
+ */
+ void setLevel(HintLevel level);
+
+ /**
+ * Method creates colleciton wrapper, grid and list views,
+ * layout and activates correct view based on the current orientation
+ *
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int initialize();
+
+ /**
+ * Method enables and displays current active view
+ *
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int activate();
+
+ /**
+ * Method disables and hides current active view
+ *
+ */
+ void deactivate();
+
+ /**
+ * Orientation is about to be changed, method synchs
+ * both view's position to match.
+ *
+ */
+ void aboutToChangeOrientation();
+
+ /**
+ * Method activates correct view based on the given orientation.
+ *
+ */
+ void orientationChanged(Qt::Orientation orientation);
+
+signals:
+
+ /**
+ * Command signal.
+ *
+ * @param int command id
+ */
+ void command(int);
+
+private slots:
+
+ /**
+ * Connected to button pressed signal. Should open the currently
+ * configured service.
+ */
+ void buttonPressedSlot();
+
+private:
+
+ Q_DISABLE_COPY(VideoHintWidget)
+
+ /**
+ * Pointer to the XML UI (DocML) loader, not owned
+ */
+ VideoCollectionUiLoader *mUiLoader;
+
+ /**
+ * Hint label object
+ */
+ HbLabel *mHint;
+
+};
+
+#endif // VIDEOHINTWIDGET_H
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/inc/videolistselectiondialog.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videolistselectiondialog.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* 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: Vstub ideolist selection dialog
+*
+*/
+
+#ifndef VIDEOLISTSELECTIONDIALOG_H
+#define VIDEOLISTSELECTIONDIALOG_H
+
+#include
+#include
+#include
+
+class QGraphicItem;
+class VideoListWidget;
+class VideoCollectionUiLoader;
+
+
+class VideoListSelectionDialog: public HbDialog
+{
+ /**
+ * definition required for emitting / connecting signals
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoListSelectionDialog)
+
+
+public:
+
+ /**
+ * Constructor
+ *
+ * @param uiLoader used to load UI components from docml
+ * @param parent item's parent component
+ */
+ VideoListSelectionDialog(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent=0);
+
+ /**
+ * Destructor
+ */
+ ~VideoListSelectionDialog();
+
+ /**
+ * Method setups provided title and videolist content widget.
+ * Prepares dialog for showing.
+ * If either provided title is empty or widget is NULL, dialog
+ * is in invalid state and cannot be shown using exec.
+ *
+ * @param title title of the dialog
+ * @param videoList videolist widget.
+ */
+ void setContent(const QString &title, VideoListWidget *videoList);
+
+ /**
+ * Returns selection (mSelection). Selection will be empty in case
+ * dialog is closed using cancell button,
+ *
+ * @return HbAction primary action if "OK" iis pressed
+ */
+ const QItemSelection& getSelection() const;
+
+ /**
+ * Shows modal dialog build from the provided Videolistwidget.
+ *
+ * @return HbAction primary action if "OK" iis pressed
+ */
+ HbAction* exec();
+
+ /**
+ * returs primary action
+ */
+ HbAction* primaryAction();
+
+ /**
+ * returns secondary action
+ */
+ HbAction* secondaryAction();
+
+ /**
+ * selection
+ */
+ QItemSelection mSelection;
+
+ /**
+ * if true, exec returns primary action
+ */
+ static bool mExecReturnPrimary;
+
+ /**
+ * if selection count to return from getSelection
+ */
+ static int mSelectionCount;
+
+ /**
+ * exec call count
+ */
+ static int mMultiSelectionLaunchCount;
+
+ /**
+ *
+ */
+ static int mMultiSelectionItemSelectionCount;
+private:
+
+ /**
+ * primary action
+ */
+ HbAction *mPrimary;
+
+ /**
+ * secondary action
+ */
+ HbAction *mSecondary;
+};
+
+#endif //VIDEOLISTSELECTIONDIALOG_H
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/inc/videolistwidget.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videolistwidget.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,160 @@
+/*
+* 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 content widget
+*
+*/
+
+
+#ifndef VIDEOLISTWIDGET_H
+#define VIDEOLISTWIDGET_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+class VideoSortFilterProxyModel;
+class HbAction;
+class HbMenu;
+class VideoServices;
+class QItemSelection;
+
+/**
+ * Widget for displaying all videos, either using list- or grid view.
+ * Widget contains 2 widgets to be used for different orientation in the stacked layout.
+ *
+ * Depending on the orientation and it's change, corresponding view is set active.
+ *
+ */
+class VideoListWidget : public HbListView
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(VideoListWidget)
+public:
+
+ enum TVideoListLevel
+ {
+ ELevelCategory = 2,
+ ELevelVideos = 3
+ };
+
+ enum TVideoListType
+ {
+ EUnknown,
+ EAllVideos, // list displaying all videos
+ ECollections, // list displaying all collections
+ EDefaultColItems, // list displying videos in default collection
+ EUserColItems // list displaying videos in user defined collection
+ };
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ */
+ VideoListWidget(HbView *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoListWidget();
+
+ /**
+ * Method creates colleciton wrapper, grid and list views,
+ * layout and activates correct view based on the current orientation
+ *
+ * @param model Model for this list view.
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int initialize(VideoSortFilterProxyModel &model, VideoServices* videoServices = 0);
+
+ /**
+ * Method enables and displays current active view
+ *
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int activate();
+
+ /**
+ * Method enables and displays current active view
+ *
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int activate(VideoListWidget::TVideoListLevel level);
+
+ /**
+ * Method disables and hides current active view
+ *
+ */
+ void deactivate();
+
+ /**
+ * Used for resolving widget's current level
+ *
+ * @return TVideoListType current level.
+ */
+ TVideoListType getType();
+
+ /**
+ * returns widget's model
+ *
+ * @return VideoSortFilterProxyModel*
+ */
+ VideoSortFilterProxyModel& getModel();
+
+signals:
+
+ /**
+ * Command signal.
+ *
+ * @param int command id
+ */
+ void command(int);
+
+ /**
+ * Signals collection view's state. Used to indicate
+ * view incase some collection item is opened
+ *
+ * @param true if opened, false if closed.
+ * @param optional name string
+ */
+ void collectionOpened(bool, const QString&);
+
+public:
+
+ VideoSortFilterProxyModel *mModel;
+
+ VideoListWidget::TVideoListLevel mCurrentLevel;
+
+ VideoListWidget::TVideoListType mType;
+
+ static int mInitializeCount;
+
+ static int mInitializeReturnValue;
+
+ static int mActivateCount;
+
+ static int mActivateReturnValue;
+
+ static bool mActive;
+
+ static int mDeactivateCount;
+
+};
+
+#endif // VIDEOLISTWIDGET_H
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/inc/videoservices.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videoservices.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2009 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: ?Description
+*
+*/
+
+#ifndef __VIDEOSERVICES_H__
+#define __VIDEOSERVICES_H__
+
+#include
+#include "videoserviceurifetch.h"
+
+//FORWARD CLASS DECLARATION
+class VideoServiceUriFetch;
+
+class VideoServices : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Returns singleton instance for this class.
+ *
+ * WARNING! Not safe to call this from destructor of another function scope static object!
+ *
+ * @return The singleton instance.
+ */
+ static VideoServices *instance();
+
+ /**
+ * Decreases the reference count, when count reaches zero cleanup is done.
+ *
+ */
+ void decreaseReferenceCount();
+
+ enum TVideoService
+ {
+ ENoService,
+ EUriFetcher,
+ EPlayback
+ };
+
+ /**
+ * Returns service active status
+ *
+ * @return bool true if active, false if not active
+ *
+ */
+ VideoServices::TVideoService currentService();
+
+private:
+
+ /**
+ * Constructor
+ */
+ VideoServices();
+
+ /**
+ * Destructor.
+ */
+ virtual ~VideoServices();
+
+ void setCurrentService(VideoServices::TVideoService service);
+
+ Q_DISABLE_COPY(VideoServices)
+
+private:
+
+ /**
+ * Singleton instance.
+ */
+ static VideoServices* mInstance;
+
+ VideoServiceUriFetch* mServiceUriFetch;
+
+ VideoServices::TVideoService mCurrentService;
+
+ friend class VideoServiceUriFetch;
+
+public:
+
+ /**
+ * Reference count.
+ */
+ static int mReferenceCount;
+
+};
+
+#endif //__VIDEOSERVICES_H__
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/inc/videoserviceurifetch.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videoserviceurifetch.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2009 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: VideoServiceUriFetch class definition
+*
+*/
+
+#ifndef __VIDEOSERVICESURIFETCH_H__
+#define __VIDEOSERVICESURIFETCH_H__
+
+//INCLUDES
+#include
+
+// FORWARD DECLARATIONS
+class VideoServices;
+
+class VideoServiceUriFetch : public QObject
+{
+
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+public:
+
+ /**
+ * contructor
+ */
+ VideoServiceUriFetch( VideoServices *parent = 0 );
+
+ /**
+ * destructor
+ */
+ ~VideoServiceUriFetch();
+
+public slots: // for QTHighway to notify provider about request
+ /*
+ * Client can use this method launch video URI fetching
+ *
+ * @param title title to be set
+ *
+ */
+ void fetch(const QString& title);
+
+private:
+ VideoServices* mServiceApp;
+};
+
+#endif //__VIDEOSERVICESURIFETCH_H__
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/inc/videosortfilterproxymodel.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videosortfilterproxymodel.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2009 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 sort filter proxy implementation
+*
+*/
+
+#ifndef VIDEOSORTFILTERPROXYMODEL_H
+#define VIDEOSORTFILTERPROXYMODEL_H
+
+#include
+
+class VideoSortFilterProxyModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ */
+ VideoSortFilterProxyModel(QObject *parent=0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoSortFilterProxyModel();
+
+public:
+
+ /**
+ * Opens a collection into all videos category, if not yet opened, and
+ * returns pointer to model
+ */
+ int open(int level);
+
+ /**
+ * Starts sorting using idle timer: starts timer with zero
+ * interval. When system has time to run timer sort() -method
+ * is called.
+ *
+ */
+ void doSorting(int role, Qt::SortOrder order, bool async = true);
+
+ /**
+ * Method to delete items at provided indeces
+ */
+ int deleteItems(const QModelIndexList &indexList);
+
+ void reset();
+
+ /**
+ * Overridden, so that we can return the mSortRole parameter.
+ */
+ int sortRole() const;
+
+ /**
+ * Overridden, so that we can return the mSortOrder parameter.
+ */
+ Qt::SortOrder sortOrder() const;
+
+signals:
+
+ /**
+ * Emitted after sorting is done
+ *
+ */
+ void sortingReady();
+
+ /**
+ * emitted to indicate model readiness
+ */
+ void modelReady();
+
+protected: // from QSortFilterProxyModel
+
+ /**
+ * Compares items based in the role setted before sorting.
+ *
+ */
+ bool lessThan ( const QModelIndex & left, const QModelIndex & right ) const;
+
+ /**
+ * Filtering functionality. Called by the fw.
+ *
+ * @param source_row row to chexk
+ * @param source_parent row's parent
+ *
+ * @return bool row accepted(true) or not accepted(false)
+ */
+ bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const;
+
+
+private slots:
+
+ /**
+ * Timeout slot for zero timer. Stops timer and calls sort().
+ * After call is finished, emits sortingReady.
+ *
+ */
+ void processSorting();
+
+private:
+ QMap mData;
+ int mRowCount;
+
+public:
+ int mLevel;
+
+ static bool mOpenFails;
+ static int mSortRole;
+ static Qt::SortOrder mSortOrder;
+ static bool mSortAsync;
+ static bool mDeleteItemsFails;
+ static int mDoSortingCallCount;
+
+};
+
+#endif //VIDEOSORTFILTERPROXYMODEL_H
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/inc/xqserviceutil.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/xqserviceutil.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef XQSERVICEUTIL_H
+#define XQSERVICEUTIL_H
+
+#include
+#include
+
+class XQServiceUtilXtra;
+
+namespace XQServiceUtil
+{
+ static void toBackground(bool value){};
+ static bool isEmbedded(){return false;};
+ static bool isService()
+ {
+ bool service;
+ XQServiceUtilXtra* ptr = XQServiceUtilXtra::instance();
+ service = ptr->currentService();
+ ptr->decreaseReferenceCount();
+ return service;
+ };
+}
+
+
+
+#endif
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/inc/xqserviceutilxtra.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/xqserviceutilxtra.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef XQSERVICEUTILXTRA_H_
+#define XQSERVICEUTILXTRA_H_
+
+#include
+
+class XQServiceUtilXtra;
+
+class XQServiceUtilXtra : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ static XQServiceUtilXtra *instance();
+
+ void decreaseReferenceCount();
+
+ bool currentService();
+
+ void setCurrentService(bool aservice);
+
+private:
+
+ XQServiceUtilXtra();
+
+ static XQServiceUtilXtra* mInstance;
+
+ virtual ~XQServiceUtilXtra();
+
+
+ Q_DISABLE_COPY(XQServiceUtilXtra)
+
+public:
+
+ /**
+ * Reference count.
+ */
+ static int mReferenceCount;
+
+ static bool service;
+
+};
+#endif
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/src/hbmessagebox.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/hbmessagebox.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 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: stub hbmessagebox
+*
+*/
+
+#include "hbmessagebox.h"
+
+bool HbMessageBox::mQuestionReturnValue = false;
+
+QString HbMessageBox::mLatestTxt = "";
+
+
+
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/src/videocollectionuiloader.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videocollectionuiloader.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#include "videocollectionuiloader.h"
+#include "videolistview.h"
+#include "videolistselectiondialog.h"
+#include "videolistwidget.h"
+#include "videohintwidget.h"
+
+bool VideoCollectionUiLoader::mFindFailure(false);
+bool VideoCollectionUiLoader::mFailDialogLoad(false);
+
+// ---------------------------------------------------------------------------
+// VideoCollectionUiLoader
+// ---------------------------------------------------------------------------
+//
+VideoCollectionUiLoader::VideoCollectionUiLoader() :
+ HbDocumentLoader()
+{
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoCollectionUiLoader
+// ---------------------------------------------------------------------------
+//
+VideoCollectionUiLoader::~VideoCollectionUiLoader()
+{
+}
+
+// ---------------------------------------------------------------------------
+// createObject
+// ---------------------------------------------------------------------------
+//
+QObject* VideoCollectionUiLoader::createObject( const QString& type, const QString &name )
+{
+ QObject* object = 0;
+
+ if ( type == VideoListView::staticMetaObject.className() )
+ {
+ object = new VideoListView( this );
+ }
+ else if ( type == VideoListSelectionDialog::staticMetaObject.className() )
+ {
+ if(!mFailDialogLoad)
+ {
+ object = new VideoListSelectionDialog(this);
+
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else if ( type == VideoListWidget::staticMetaObject.className() )
+ {
+ object = new VideoListWidget();
+ }
+ else if ( type == VideoHintWidget::staticMetaObject.className() )
+ {
+ object = new VideoHintWidget(this);
+ }
+ if ( object )
+ {
+ object->setObjectName( name );
+
+ if (mFindFailure)
+ {
+ delete object;
+ object = 0;
+ }
+ return object;
+ }
+
+ return HbDocumentLoader::createObject( type, name );
+}
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/src/videocollectionviewutils.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videocollectionviewutils.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2009 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: stub video collection view plugin's ui utils class
+*
+*/
+
+#include "videocollectionviewutils.h"
+#include
+#include "videocollectionwrapper.h"
+#include "videosortfilterproxymodel.h"
+#include "dummydatamodel.h"
+
+int VideoCollectionViewUtils::mLastError = -6666;
+bool VideoCollectionViewUtils::mLoadSortingValuesFails = false;
+int VideoCollectionViewUtils::mSortRole = -1;
+Qt::SortOrder VideoCollectionViewUtils::mSortOrder = Qt::AscendingOrder;
+
+// ---------------------------------------------------------------------------
+// instance
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewUtils& VideoCollectionViewUtils::instance()
+{
+ static VideoCollectionViewUtils _popupInstance;
+ return _popupInstance;
+}
+
+// ---------------------------------------------------------------------------
+// VideoCollectionViewUtils
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewUtils::VideoCollectionViewUtils()
+{
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoCollectionViewUtils
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewUtils::~VideoCollectionViewUtils()
+{
+}
+
+// ---------------------------------------------------------------------------
+// showStatusMsgSlot
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewUtils::showStatusMsgSlot(int statusCode, QVariant& /* additional */)
+{
+ mLastError = statusCode;
+}
+
+// ---------------------------------------------------------------------------
+// showErrorMsgSlot
+// ---------------------------------------------------------------------------
+//
+int VideoCollectionViewUtils::saveSortingValues(int role, Qt::SortOrder order)
+{
+ mSortRole = role;
+ mSortOrder = order;
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// showErrorMsgSlot
+// ---------------------------------------------------------------------------
+//
+int VideoCollectionViewUtils::loadSortingValues(int& role, Qt::SortOrder& order)
+{
+ if(mLoadSortingValuesFails) {
+ return -1;
+ }
+
+ role = mSortRole;
+ order = mSortOrder;
+}
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/src/videohintwidget.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videohintwidget.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* 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 content widget implementation
+*
+*/
+
+#include
+#include
+
+#include "videohintwidget.h"
+#include "videocollectionuiloader.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoHintWidget::VideoHintWidget(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent) :
+HbWidget(parent),
+mUiLoader(uiLoader),
+mHint(0)
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoHintWidget::~VideoHintWidget()
+{
+}
+
+// ---------------------------------------------------------------------------
+// initialize
+// ---------------------------------------------------------------------------
+//
+int VideoHintWidget::initialize()
+{
+ mHint = mUiLoader->findWidget(DOCML_NAME_HINT_LABEL);
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// activate
+// ---------------------------------------------------------------------------
+//
+int VideoHintWidget::activate()
+{
+ // TODO load graphics.
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// deactivate
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::deactivate()
+{
+ // TODO delete graphics (to save IVE memory).
+}
+
+
+// ---------------------------------------------------------------------------
+// deactivate
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::setLevel(HintLevel level)
+{
+ // TODO delete graphics (to save IVE memory).
+}
+
+// ---------------------------------------------------------------------------
+// aboutToChangeOrientation
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::aboutToChangeOrientation()
+{
+}
+
+// ---------------------------------------------------------------------------
+// orientationChanged
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::orientationChanged( Qt::Orientation targetOrientation )
+{
+}
+
+// ---------------------------------------------------------------------------
+// orientationChanged
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::buttonPressedSlot()
+{
+ // TODO implementation.
+}
+
+// end of file
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/src/videolistselectiondialog.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videolistselectiondialog.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* 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: stub videolist selection dialog implementation
+*
+*/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include "dummydatamodel.h"
+#include "videocollectionwrapper.h"
+#include "videocollectionuiloader.h"
+#include "videolistwidget.h"
+#include "videosortfilterproxymodel.h"
+#include "videolistselectiondialog.h"
+
+bool VideoListSelectionDialog::mExecReturnPrimary = false;
+
+int VideoListSelectionDialog::mSelectionCount = 0;
+
+int VideoListSelectionDialog::mMultiSelectionLaunchCount = 0;
+
+int VideoListSelectionDialog::mMultiSelectionItemSelectionCount = 0;
+
+
+// ---------------------------------------------------------------------------
+// VideoListSelectionDialog
+// ---------------------------------------------------------------------------
+//
+VideoListSelectionDialog::VideoListSelectionDialog(VideoCollectionUiLoader *uiLoader,
+ QGraphicsItem *parent) :
+HbDialog(parent)
+{
+ Q_UNUSED(uiLoader);
+ mPrimary = new HbAction();
+ mSecondary = new HbAction();
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoListSelectionDialog
+// ---------------------------------------------------------------------------
+//
+VideoListSelectionDialog::~VideoListSelectionDialog()
+{
+ delete mPrimary;
+ delete mSecondary;
+}
+
+// ---------------------------------------------------------------------------
+// getSelection
+// ---------------------------------------------------------------------------
+//
+const QItemSelection& VideoListSelectionDialog::getSelection() const
+{
+ return mSelection;
+}
+
+// ---------------------------------------------------------------------------
+// setContent
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::setContent(const QString &title, VideoListWidget *videoList)
+{
+ Q_UNUSED(title);
+ Q_UNUSED(videoList);
+}
+
+// ---------------------------------------------------------------------------
+// primaryAction
+// ---------------------------------------------------------------------------
+//
+HbAction* VideoListSelectionDialog::primaryAction()
+{
+ return mPrimary;
+}
+
+// ---------------------------------------------------------------------------
+// secondaryAction
+// ---------------------------------------------------------------------------
+//
+HbAction* VideoListSelectionDialog::secondaryAction()
+{
+ return mSecondary;
+}
+
+// ---------------------------------------------------------------------------
+// exec
+// ---------------------------------------------------------------------------
+//
+HbAction* VideoListSelectionDialog::exec()
+{
+ VideoListSelectionDialog::mMultiSelectionLaunchCount++;
+ VideoCollectionWrapper *wrapper = VideoCollectionWrapper::instance();
+ wrapper->open(0);
+
+ if(wrapper)
+ {
+ for(int i=0; igetDataModel()->index(i, 0);
+ if(index.isValid())
+ {
+ mSelection.append(QItemSelectionRange(index));
+ }
+ }
+ }
+ VideoListSelectionDialog::mMultiSelectionItemSelectionCount = mSelection.indexes().count();
+ wrapper->decreaseReferenceCount();
+
+ if(!mExecReturnPrimary)
+ {
+ return secondaryAction();
+ }
+ return primaryAction();
+
+}
+
+
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/src/videolistwidget.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videolistwidget.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* 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 content widget implementation
+*
+*/
+#include "videolistwidget.h"
+#include "videoservices.h"
+
+#include "videosortfilterproxymodel.h"
+
+int VideoListWidget::mInitializeCount(0);
+int VideoListWidget::mInitializeReturnValue(0);
+int VideoListWidget::mActivateCount(0);
+int VideoListWidget::mActivateReturnValue(0);
+bool VideoListWidget::mActive(false);
+int VideoListWidget::mDeactivateCount(0);
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoListWidget::VideoListWidget(HbView *parent) :
+HbListView(parent),
+mModel(0),
+mCurrentLevel(VideoListWidget::ELevelVideos),
+mType(VideoListWidget::EUnknown)
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoListWidget::~VideoListWidget()
+{
+}
+
+// ---------------------------------------------------------------------------
+// initialize
+// ---------------------------------------------------------------------------
+//
+int VideoListWidget::initialize(VideoSortFilterProxyModel &model, VideoServices* videoServices)
+{
+ mInitializeCount++;
+ mModel = &model;
+ return mInitializeReturnValue;
+}
+
+// ---------------------------------------------------------------------------
+// activate
+// ---------------------------------------------------------------------------
+//
+int VideoListWidget::activate()
+{
+ return activate(mCurrentLevel);
+}
+
+// ---------------------------------------------------------------------------
+// activate
+// ---------------------------------------------------------------------------
+//
+int VideoListWidget::activate(VideoListWidget::TVideoListLevel level)
+{
+ mActive = true;
+ mActivateCount++;
+ mCurrentLevel = level;
+ return mActivateReturnValue;
+}
+
+// ---------------------------------------------------------------------------
+// deactivate
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::deactivate()
+{
+ mActive = false;
+ mDeactivateCount++;
+}
+
+// -------------------------------------------------------------------------------------------------
+// getLevel
+// -------------------------------------------------------------------------------------------------
+//
+VideoListWidget::TVideoListType VideoListWidget::getType()
+{
+ return mType;
+}
+
+// ---------------------------------------------------------------------------
+// getModel
+// ---------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel& VideoListWidget::getModel()
+{
+ return *mModel;
+}
+
+// end of file
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/src/videoservices.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videoservices.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2009 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: ?Description
+*
+*/
+
+#include
+#include
+
+
+VideoServices *VideoServices::mInstance = 0;
+int VideoServices::mReferenceCount = 0;
+
+// -----------------------------------------------------------------------------
+// VideoServices::instance()
+// -----------------------------------------------------------------------------
+//
+VideoServices* VideoServices::instance()
+{
+ if(!mInstance)
+ {
+ mInstance = new VideoServices();
+ }
+ mInstance->mReferenceCount++;
+ return mInstance;
+}
+
+// -----------------------------------------------------------------------------
+// VideoServices::decreaseReferenceCount()
+// -----------------------------------------------------------------------------
+//
+void VideoServices::decreaseReferenceCount()
+{
+ if(mInstance)
+ {
+ if(--mInstance->mReferenceCount == 0)
+ {
+ delete mInstance;
+ mInstance = NULL;
+ }
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+// VideoServices()
+// ----------------------------------------------------------------------------
+//
+VideoServices::VideoServices() :
+mCurrentService(VideoServices::ENoService)
+{
+ mServiceUriFetch = new VideoServiceUriFetch(this);
+}
+
+// ----------------------------------------------------------------------------
+// ~VideoServices()
+// ----------------------------------------------------------------------------
+//
+VideoServices::~VideoServices()
+{
+ delete mServiceUriFetch;
+}
+
+
+// ----------------------------------------------------------------------------
+// currentService()
+// ----------------------------------------------------------------------------
+//
+VideoServices::TVideoService VideoServices::currentService()
+{
+ return mCurrentService;
+}
+
+
+// ----------------------------------------------------------------------------
+// setCurrentService()
+// ----------------------------------------------------------------------------
+//
+void VideoServices::setCurrentService(VideoServices::TVideoService service)
+{
+ mCurrentService = service;
+}
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/src/videoserviceurifetch.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videoserviceurifetch.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2009 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: ?Description
+*
+*/
+
+#include
+#include
+
+
+// ----------------------------------------------------------------------------
+// VideoServiceUriFetch()
+// ----------------------------------------------------------------------------
+//
+VideoServiceUriFetch::VideoServiceUriFetch(VideoServices* parent)
+{
+ mServiceApp = parent;
+}
+
+// ----------------------------------------------------------------------------
+// ~VideoServiceUriFetch()
+// ----------------------------------------------------------------------------
+//
+VideoServiceUriFetch::~VideoServiceUriFetch()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// fetch()
+// ----------------------------------------------------------------------------
+//
+void VideoServiceUriFetch::fetch(const QString& title)
+{
+ mServiceApp->setCurrentService(VideoServices::EUriFetcher);
+}
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/src/videosortfilterproxymodel.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videosortfilterproxymodel.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,149 @@
+/*
+* Copyright (c) 2009 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: Videosortfilterproxymodel implementation
+*
+*/
+
+#include
+#include
+
+#include "videocollectioncommon.h"
+#include "videosortfilterproxymodel.h"
+
+int VideoSortFilterProxyModel::mSortRole = -1;
+Qt::SortOrder VideoSortFilterProxyModel::mSortOrder = Qt::AscendingOrder;
+bool VideoSortFilterProxyModel::mSortAsync = false;
+bool VideoSortFilterProxyModel::mDeleteItemsFails = false;
+int VideoSortFilterProxyModel::mDoSortingCallCount = 0;
+bool VideoSortFilterProxyModel::mOpenFails = false;
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::VideoSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::VideoSortFilterProxyModel(QObject *parent) :
+ QSortFilterProxyModel(parent)
+{
+ reset();
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::~VideoSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::~VideoSortFilterProxyModel()
+{
+ reset();
+ disconnect();
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::doSorting
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::open(int level)
+{
+ mLevel = level;
+ if(VideoSortFilterProxyModel::mOpenFails)
+ return -1;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::doSorting
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::doSorting(int role, Qt::SortOrder order, bool async)
+{
+ mDoSortingCallCount++;
+ mSortRole = role;
+ mSortOrder = order;
+ mSortAsync = async;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::deleteItems
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::deleteItems(const QModelIndexList &indexList)
+{
+ if( mDeleteItemsFails )
+ return -1;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::sortRole
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::sortRole() const
+{
+ return mSortRole;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::sortOrder
+// -----------------------------------------------------------------------------
+//
+Qt::SortOrder VideoSortFilterProxyModel::sortOrder() const
+{
+ return mSortOrder;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::processSorting
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::processSorting()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::lessThan
+// -----------------------------------------------------------------------------
+//
+bool VideoSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
+{
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::filterAcceptsRow
+// -----------------------------------------------------------------------------
+//
+bool VideoSortFilterProxyModel::filterAcceptsRow (int source_row, const QModelIndex &source_parent) const
+{
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::reset
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::reset()
+{
+ VideoSortFilterProxyModel::mSortRole = -1;
+ VideoSortFilterProxyModel::mSortOrder = Qt::AscendingOrder;
+ VideoSortFilterProxyModel::mDeleteItemsFails = false;
+ VideoSortFilterProxyModel::mDoSortingCallCount = 0;
+ VideoSortFilterProxyModel::mRowCount = 0;
+ mData.clear();
+}
+
+// end of file
+
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/stub/src/xqserviceutilxtra.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/xqserviceutilxtra.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include
+
+XQServiceUtilXtra* XQServiceUtilXtra::mInstance = 0;
+int XQServiceUtilXtra::mReferenceCount = 0;
+bool XQServiceUtilXtra::service = false;
+
+// -----------------------------------------------------------------------------
+// XQServiceUtilXtra::instance()
+// -----------------------------------------------------------------------------
+//
+XQServiceUtilXtra* XQServiceUtilXtra::instance()
+{
+ if(!mInstance)
+ {
+ mInstance = new XQServiceUtilXtra();
+ }
+ mInstance->mReferenceCount++;
+ return mInstance;
+}
+
+// -----------------------------------------------------------------------------
+// XQServiceUtilXtra::decreaseReferenceCount()
+// -----------------------------------------------------------------------------
+//
+void XQServiceUtilXtra::decreaseReferenceCount()
+{
+ if(mInstance)
+ {
+ if(--mInstance->mReferenceCount == 0)
+ {
+ delete mInstance;
+ mInstance = NULL;
+ }
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+// XQServiceUtilXtra()
+// ----------------------------------------------------------------------------
+//
+XQServiceUtilXtra::XQServiceUtilXtra()
+{
+}
+
+// ----------------------------------------------------------------------------
+// ~XQServiceUtilXtra()
+// ----------------------------------------------------------------------------
+//
+XQServiceUtilXtra::~XQServiceUtilXtra()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+// currentService()
+// ----------------------------------------------------------------------------
+//
+bool XQServiceUtilXtra::currentService()
+{
+ return mInstance->service;
+}
+
+
+// ----------------------------------------------------------------------------
+// setCurrentService()
+// ----------------------------------------------------------------------------
+//
+void XQServiceUtilXtra::setCurrentService(bool aservice)
+{
+ mInstance->service = aservice;
+}
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistview/testlistview.pro
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/testlistview.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,76 @@
+#
+# Copyright (c) 2009 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:
+#
+
+TEMPLATE = app
+TARGET =
+
+DEPENDPATH += . \
+ inc \
+ src
+INCLUDEPATH += stub/inc \
+ . \
+ /epoc32/include/domain \
+ /epoc32/include/domain/middleware \
+ /epoc32/include/domain/applications \
+ /epoc32/include/osextensions \
+ /epoc32/include/middleware \
+ /epoc32/include/osextensions/stdapis/stlport \
+ ../../../inc
+
+CONFIG += qtestlib \
+ Hb \
+ symbian_test
+
+LIBS += -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll \
+ -lxqplugins.dll \
+ -lmpxviewframeworkqt.dll \
+ -lxqserviceutil.dll
+
+# Input
+HEADERS += stub/inc/hbmessagebox.h \
+ inc/testlistview.h \
+ stub/inc/videolistwidget.h \
+ stub/inc/videohintwidget.h \
+ stub/inc/videocollectionviewutils.h \
+ stub/inc/videolistselectiondialog.h \
+ stub/inc/videosortfilterproxymodel.h \
+ stub/inc/videocollectionwrapper.h \
+ stub/inc/dummydatamodel.h \
+ stub/inc/videocollectionuiloader.h \
+ stub/inc/dummyhbmenu.h \
+ stub/inc/videoservices.h \
+ stub/inc/videoserviceurifetch.h \
+ ../../inc/videolistview.h \
+
+SOURCES += stub/src/hbmessagebox.cpp \
+ src/testlistview.cpp \
+ stub/src/videolistwidget.cpp \
+ stub/src/videohintwidget.cpp \
+ stub/src/videocollectionviewutils.cpp \
+ stub/src/videolistselectiondialog.cpp \
+ stub/src/videosortfilterproxymodel.cpp \
+ stub/src/videocollectionwrapper.cpp \
+ stub/src/dummydatamodel.cpp \
+ stub/src/videocollectionuiloader.cpp \
+ stub/src/videoservices.cpp \
+ stub/src/videoserviceurifetch.cpp \
+ ../../src/videolistview.cpp \
+
+RESOURCES += ../../data/videocollectionview.qrc
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistwidget/inc/testlistwidget.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/inc/testlistwidget.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,193 @@
+/**
+* Copyright (c) 2009 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: tester for methods in VideoSortFilterProxyModel
+*
+*/
+
+#ifndef __TESTLISTWIDGET_H__
+#define __TESTLISTWIDGET_H__
+
+
+// INCLUDES
+#include
+
+class VideoListWidget;
+class DummyDataModel;
+class HbAbstractViewItem;
+class HbView;
+class VideoSortFilterProxyModel;
+class VideoCollectionWrapper;
+class HbMainWindow;
+class ListWidgetTester;
+class VideoServices;
+
+class TestListWidget : public QObject
+{
+ Q_OBJECT
+
+public:
+
+
+ // test functions for the test framework
+private slots:
+
+ /**
+ * will be called automaticallybefore each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called automaticallybefore after every testfunction.
+ *
+ */
+ void cleanup();
+
+
+ /**
+ * verifies initialize
+ */
+ void testInitialize();
+
+ /**
+ * verifies activate()
+ */
+ void testActivate();
+
+ /**
+ * verifies deactivate()
+ */
+ void testDeactivate();
+
+ /**
+ * verifies getType
+ */
+ void testGetType();
+
+ /**
+ * verifies getModel
+ */
+ void testGetModel();
+
+ /**
+ * verifies emitActivated
+ */
+ void testEmitActivated();
+
+ /**
+ * verifies longPressGesture
+ */
+ void testLongPressGesture();
+
+ /**
+ * verifies setContextMenu
+ */
+ void testSetContextMenu();
+
+ /**
+ * verifies shareItemSlot
+ */
+ void testShareItemSlot();
+
+ /**
+ * verifies deleteItemSlot
+ */
+ void testDeleteItemSlot();
+
+ /**
+ * verifies renameSlot
+ */
+ void testRenameSlot();
+
+ /**
+ * verifies playAllSlot
+ */
+ void testPlayAllSlot();
+
+ /**
+ * verifies addItemSlot
+ */
+ void testAddItemSlot();
+
+ /**
+ * verifies addToCollectionSlot()
+ */
+ void testAddToCollectionSlot();
+
+ /**
+ * verifies openDetailsSlot()
+ */
+ void testOpenDetailsSlot();
+
+ /**
+ * verifies back()
+ */
+ void testBack();
+
+ /**
+ * verifies scrollingEndedSlot();
+ */
+ void testScrollingEndedSlot();
+
+ /**
+ * verifies scrollPositionChangedSlot();
+ */
+ void testScrollPositionChangedSlot();
+
+signals:
+
+ /**
+ * test signal
+ */
+ void testSignal();
+
+ /**
+ * another test signal
+ */
+ void testSignal(const QPointF&);
+
+private:
+
+
+ /**
+ * object under test, ListWidgetTester is inherited from VideoListWidget
+ */
+ ListWidgetTester* mTestWidget;
+
+ /**
+ * dummy model
+ */
+ DummyDataModel* mDummyModel;
+
+ /**
+ * dummy proxy model
+ */
+ VideoSortFilterProxyModel *mDummyProxyModel;
+
+ /**
+ * dummy view
+ */
+ HbView *mTempView;
+
+ /**
+ * dummy main wnd
+ */
+ HbMainWindow *mDummyMainWnd;
+
+};
+
+
+#endif // __TESTLISTWIDGET_H__
+
+// End of file
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistwidget/src/testlistwidget.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/src/testlistwidget.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,891 @@
+/**
+* Copyright (c) 2009 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: tester for methods in VideoListWidget
+*
+*/
+
+#include
+#include "hblistview.h"
+#include "hbview.h"
+
+#include "videoservices.h"
+#include "videosortfilterproxymodel.h"
+#include "dummydatamodel.h"
+#include "hbscrollbar.h"
+#include "hbmenu.h"
+#include "hbmessagebox.h"
+#include "hbinstance.h"
+#include "hbmainwindow.h"
+#include "mpxhbvideocommondefs.h"
+#include "videothumbnaildata.h"
+#include "videocollectioncommon.h"
+
+#include "testlistwidget.h"
+
+#define private public
+#include "videolistwidget.h"
+#undef private
+
+static const int CONTEXT_MENU_COUNT = 8;
+
+/**
+ * helper class to run protected member of the test object
+ */
+class ListWidgetTester : public VideoListWidget
+{
+public:
+ /**
+ * constructor
+ */
+ ListWidgetTester(HbView *parent) :
+ VideoListWidget(parent)
+ {
+
+ }
+
+ /**
+ * calls emitActivated
+ */
+ void callEmiteActivated(QModelIndex index)
+ {
+ VideoListWidget::emitActivated(index);
+ }
+
+ /**
+ * calls longPressGesture
+ */
+ void callLongPressGesture(const QPointF &point)
+ {
+ VideoListWidget::longPressGesture (point);
+ }
+};
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int /*argc*/, char *argv[])
+{
+
+ TestListWidget tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testlistwidget.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::init()
+{
+ mDummyMainWnd = new HbMainWindow;
+ mTempView = new HbView;
+ mDummyModel = new DummyDataModel();
+ mDummyProxyModel = new VideoSortFilterProxyModel();
+ mDummyProxyModel->setSourceModel(mDummyModel);
+
+ mTestWidget = new ListWidgetTester(mTempView);
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::cleanup()
+{
+ delete mTestWidget;
+ mTestWidget = 0;
+
+ delete mDummyProxyModel;
+ mDummyProxyModel = 0;
+
+ delete mDummyModel;
+ mDummyModel = 0;
+
+ delete mTempView;
+ mTempView = 0;
+
+ delete mDummyMainWnd;
+ mDummyMainWnd = 0;
+
+ hbInstance->mWindowses.clear();
+}
+
+// ---------------------------------------------------------------------------
+// testInitialize
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testInitialize()
+{
+ // no prototype
+ HbListView::mReturnNullPrototype = true;
+ QVERIFY(mTestWidget->initialize(*mDummyProxyModel) == -1);
+ HbListView::mReturnNullPrototype = false;
+
+ // no scroll bar
+ HbListView::mVScrollBarIsNull = true;
+ QVERIFY(mTestWidget->initialize(*mDummyProxyModel) == -1);
+
+ // succeed case ( new operator cannot be stubbed)
+ HbListView::mVScrollBarIsNull = false;
+ HbListView::mReturnNullPrototype = false;
+ QVERIFY(mTestWidget->initialize(*mDummyProxyModel) == 0);
+ QCOMPARE(HbListView::mLatestrecycling, true);
+ QCOMPARE(HbListView::mLatestClamping, HbScrollArea::BounceBackClamping);
+ QCOMPARE(HbListView::mLatestScrolling, HbScrollArea::PanOrFlick);
+ QCOMPARE(HbListView::mLatestFrictionEnabled, true);
+ QCOMPARE(HbListView::mLatestUniformItemSizes, true);
+ QCOMPARE(HbListView::mLatestVisibility, false);
+ QCOMPARE(HbListView::mLatestEnableValue, false);
+ QCOMPARE(HbScrollBar::mInteractive, true);
+ QVERIFY(mTestWidget->mModel == mDummyProxyModel);
+ QVERIFY(mTestWidget->mVideoServices == 0);
+ QVERIFY(mTestWidget->mIsService == false);
+}
+
+// ---------------------------------------------------------------------------
+// testActivate
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testActivate()
+{
+ // no model: fails
+ VideoSortFilterProxyModel *nullModel = 0;
+ QVERIFY(mTestWidget->activate() == -1);
+ QCOMPARE(HbMenu::mEnabledSetted, false);
+ QCOMPARE(HbListView::mLatestVisibility, false);
+ QCOMPARE(HbListView::mLatestModel, nullModel);
+ QCOMPARE(VideoThumbnailData::mBackgroundThumbnailFetchingEnabled, 1);
+
+ // no context menu, model exist: succeeds
+ QVERIFY(mTestWidget->initialize(*mDummyProxyModel) == 0);
+ QVERIFY(mTestWidget->activate() == 0);
+ QCOMPARE(HbMenu::mEnabledSetted, false);
+ QCOMPARE(HbListView::mLatestVisibility, true);
+ QCOMPARE(HbListView::mLatestModel, mDummyProxyModel);
+ QCOMPARE(VideoThumbnailData::mBackgroundThumbnailFetchingEnabled, 1);
+
+ HbMenu::mEnabledSetted = true;
+ HbListView::mLatestVisibility = false;
+ HbListView::mLatestEnableValue = false;
+ HbListView::mLatestModel = 0;
+ VideoThumbnailData::mBackgroundThumbnailFetchingEnabled = 0;
+
+ // context menu exists, succeed (signal connecting failure cannot be tested here)
+ mTestWidget->mContextMenu = new HbMenu;
+ QVERIFY(mTestWidget->activate() == 0);
+ QCOMPARE(HbMenu::mEnabledSetted, true);
+ QCOMPARE(HbListView::mLatestVisibility, true);
+ QCOMPARE(HbListView::mLatestModel, mDummyProxyModel);
+ QCOMPARE(VideoThumbnailData::mBackgroundThumbnailFetchingEnabled, 1);
+}
+
+// ---------------------------------------------------------------------------
+// testDeactivate
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testDeactivate()
+{
+ HbMenu::mEnabledSetted = false;
+ HbListView::mLatestVisibility = false;
+ HbListView::mLatestEnableValue = false;
+ HbListView::mLatestModel = 0;
+ VideoThumbnailData::mBackgroundThumbnailFetchingEnabled = 0;
+ VideoSortFilterProxyModel *nullModel = 0;
+
+ mTestWidget->activate();
+
+ // no context menu and activated without model
+ mTestWidget->deactivate();
+ QCOMPARE(HbListView::mLatestVisibility, false);
+ QCOMPARE(HbListView::mLatestModel, nullModel);
+ QCOMPARE(VideoThumbnailData::mBackgroundThumbnailFetchingEnabled, 0);
+
+ // context menu exists and activated with model
+ mTestWidget->mContextMenu = new HbMenu;
+ QVERIFY(mTestWidget->initialize(*mDummyProxyModel) == 0);
+ mTestWidget->activate();
+ mTestWidget->deactivate();
+ QCOMPARE(HbListView::mLatestVisibility, true);
+ QCOMPARE(HbListView::mLatestModel, mDummyProxyModel);
+ QCOMPARE(VideoThumbnailData::mBackgroundThumbnailFetchingEnabled, 0);
+
+}
+
+// ---------------------------------------------------------------------------
+// testGetLevel
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testGetType()
+{
+ mTestWidget->initialize(*mDummyProxyModel);
+
+
+ // level != ELevelVideos and role != ELevelCategory
+ mTestWidget->mCurrentLevel = (VideoListWidget::TVideoListLevel)0;
+ QCOMPARE(mTestWidget->getType(), VideoListWidget::EUnknown);
+
+ // level == ELevelVideos
+ mTestWidget->mCurrentLevel = VideoListWidget::ELevelVideos;
+ QCOMPARE(mTestWidget->getType(), VideoListWidget::EAllVideos);
+
+ // level == ELevelCategory and mLastOpenItemId == TMPXItemId::InvalidId
+ mTestWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
+ mTestWidget->mLastOpenItemId = TMPXItemId::InvalidId();
+ QCOMPARE(mTestWidget->getType(), VideoListWidget::ECollections);
+
+ // level == ELevelCategory and mLastOpenItemId.iId2 == KVcxMvcCategoryIdDownloads
+ mTestWidget->mLastOpenItemId.iId2 = KVcxMvcCategoryIdDownloads;
+ mTestWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
+ mDummyMainWnd->mSoftKeyAction = mTestWidget->mSecSkAction;
+ QCOMPARE(mTestWidget->getType(), VideoListWidget::EDefaultColItems);
+
+ // level == ELevelCategory and mLastOpenItemId.iId2 == KVcxMvcCategoryIdCaptured
+ mTestWidget->mLastOpenItemId.iId2 = KVcxMvcCategoryIdDownloads;
+ mTestWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
+ mDummyMainWnd->mSoftKeyAction = mTestWidget->mSecSkAction;
+ QCOMPARE(mTestWidget->getType(), VideoListWidget::EDefaultColItems);
+
+
+ // level == ELevelCategory and mLastOpenItemId.iId2 is neither above
+ mTestWidget->mLastOpenItemId.iId2 = 0;
+ mTestWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
+ mDummyMainWnd->mSoftKeyAction = mTestWidget->mSecSkAction;
+ QCOMPARE(mTestWidget->getType(), VideoListWidget::EUserColItems);
+
+
+
+}
+
+// ---------------------------------------------------------------------------
+// testGetModel
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testGetModel()
+{
+ QVERIFY(&(mTestWidget->getModel()) == 0);
+
+ HbListView::mVScrollBarIsNull = false;
+ HbListView::mReturnNullPrototype = false;
+ mTestWidget->initialize(*mDummyProxyModel);
+
+ QVERIFY(&(mTestWidget->getModel()) == mDummyProxyModel);
+}
+
+// ---------------------------------------------------------------------------
+// testEmitActivated
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testEmitActivated()
+{
+ QSignalSpy spysignal(mTestWidget, SIGNAL(collectionOpened(bool, const QString&)));
+ mTestWidget->initialize(*mDummyProxyModel);
+ mTestWidget->activate();
+ hbInstance->mWindowses.append(mDummyMainWnd);
+
+ QVariant data = QString("test");
+ // correct data to index 0
+ mDummyModel->setData( Qt::DisplayRole, data);
+ mDummyModel->setRowCount(1);
+ mDummyProxyModel->mItemIds.append(TMPXItemId(0,0));
+
+ QModelIndex fetchIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+
+ // selection mode == HbAbstractItemView::MultiSelection
+ HbListView::mSelectionMode = HbAbstractItemView::MultiSelection;
+ mTestWidget->callEmiteActivated(fetchIndex);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(mDummyMainWnd->mSoftKeyAction == 0);
+ QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());
+
+ // modelIndex is not valid
+ HbListView::mSelectionMode = HbAbstractItemView::NoSelection;
+ fetchIndex = QModelIndex();
+ mTestWidget->callEmiteActivated(fetchIndex);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(mDummyMainWnd->mSoftKeyAction == 0);
+ QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());
+ QVERIFY(mTestWidget->mLastOpenItemId == TMPXItemId::InvalidId());
+
+ // current level is not ELevelCategory
+ fetchIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+ mTestWidget->callEmiteActivated(fetchIndex);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 0);
+ QVERIFY(mTestWidget->mLastOpenItemId == TMPXItemId::InvalidId());
+ VideoSortFilterProxyModel::mLastIndex = QModelIndex();
+
+ // current level is ELevelCategory
+ mTestWidget->mCurrentLevel= VideoListWidget::ELevelCategory;
+ mTestWidget->mLastOpenItemId = TMPXItemId();
+
+ // -> getType() != ECollections
+ mTestWidget->mLastOpenItemId.iId2 = 0;
+ mTestWidget->callEmiteActivated(fetchIndex);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(mDummyMainWnd->mSoftKeyAction == 0);
+ QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 0);
+ QVERIFY(mTestWidget->mLastOpenItemId != TMPXItemId::InvalidId());
+ VideoSortFilterProxyModel::mLastIndex = QModelIndex();
+
+ // -> getType() == ECollections
+ mTestWidget->mLastOpenItemId = TMPXItemId::InvalidId();
+
+ // --> variant is not valid (invalid data at row index 1)
+ fetchIndex = mDummyProxyModel->index(1, 0, QModelIndex());
+ mTestWidget->callEmiteActivated(fetchIndex);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(mDummyMainWnd->mSoftKeyAction == 0);
+ QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 1);
+ QVERIFY(mTestWidget->mLastOpenItemId == TMPXItemId::InvalidId());
+ VideoSortFilterProxyModel::mLastIndex = QModelIndex();
+
+ // --> variant is valid (correct data at index 0),5 collectionOpened -signal should be emitted
+ mDummyMainWnd->mSoftKeyAction = 0;
+ fetchIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+ mTestWidget->callEmiteActivated(fetchIndex);
+ QVERIFY(spysignal.count() == 1);
+ QVERIFY(mDummyMainWnd->mSoftKeyAction == mTestWidget->mSecSkAction);
+ QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 0);
+ QVERIFY(mTestWidget->mLastOpenItemId != TMPXItemId::InvalidId());
+ VideoSortFilterProxyModel::mLastIndex = QModelIndex();
+
+ hbInstance->mWindowses.clear();
+}
+
+
+// ---------------------------------------------------------------------------
+// testLongPressGesture
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testLongPressGesture()
+{
+ QVariant data = QString("test");
+ // correct data to index 0
+ mDummyModel->setData( Qt::DisplayRole, data);
+ mDummyModel->setRowCount(1);
+
+ QPointF point(1,1);
+
+ QSignalSpy spysignal(mTestWidget, SIGNAL(command(int)));
+ mTestWidget->initialize(*mDummyProxyModel);
+ hbInstance->mWindowses.append(mDummyMainWnd);
+
+ HbListView::mSelectionMode = HbAbstractItemView::MultiSelection;
+ // mDetailsReady is false
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 1);
+ QVERIFY(HbMenu::mExecPoint != point);
+ QVERIFY(HbListView::mLongPressedPoint != point);
+ spysignal.clear();
+
+ // multiselection is on
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::mExecPoint != point);
+
+ // current index is invalid
+ HbListView::mSelectionMode = HbAbstractItemView::NoSelection;
+ HbListView::mCurrentIndex = QModelIndex();
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::mExecPoint != point);
+ QVERIFY(HbListView::mLongPressedPoint == point);
+
+ // current index is valid
+ HbListView::mCurrentIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+
+ // model is == 0
+ VideoSortFilterProxyModel *tmp = mTestWidget->mModel;
+ mTestWidget->mModel = 0;
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::mExecPoint != point);
+ QVERIFY(HbListView::mLongPressedPoint == point);
+ mTestWidget->mModel = tmp;
+
+ // mCurrentLevel != ELevelCategory
+ mTestWidget->mCurrentLevel = VideoListWidget::ELevelVideos;
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::mExecPoint == point);
+ QVERIFY(HbListView::mLongPressedPoint == point);
+ HbMenu::mExecPoint = QPointF();
+
+ // mCurrentLevel == ELevelCategory
+ mTestWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
+
+ // --> mpxId.iId2 != 1
+ TMPXItemId itemId;
+ itemId.iId2 = 0;
+ mDummyProxyModel->mItemIds.append(itemId);
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::mExecPoint == point);
+ QVERIFY(HbListView::mLongPressedPoint == point);
+ HbMenu::mExecPoint = QPointF();
+ mDummyProxyModel->mItemIds.clear();
+
+ // --> mpxId.iId2 == 1
+ itemId.iId2 = 1;
+
+ // ---> mpxId.iId1 == KVcxMvcCategoryIdDownloads
+ itemId.iId1 = KVcxMvcCategoryIdDownloads;
+ mDummyProxyModel->mItemIds.append(itemId);
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::mExecPoint == point);
+ QVERIFY(HbListView::mLongPressedPoint == point);
+ HbMenu::mExecPoint = QPointF();
+ mDummyProxyModel->mItemIds.clear();
+
+ // ---> mpxId.iId1 == KVcxMvcCategoryIdCaptured
+ itemId.iId1 = KVcxMvcCategoryIdCaptured;
+ mDummyProxyModel->mItemIds.append(itemId);
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::mExecPoint == point);
+ QVERIFY(HbListView::mLongPressedPoint == point);
+ HbMenu::mExecPoint = QPointF();
+ mDummyProxyModel->mItemIds.clear();
+
+ // ---> mpxId.iId1 != KVcxMvcCategoryIdDownloads and mpxId.iId1 != KVcxMvcCategoryIdCaptured
+ itemId.iId1 = KVcxMvcCategoryIdAll;
+ mDummyProxyModel->mItemIds.append(itemId);
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::mExecPoint == point);
+ QVERIFY(HbListView::mLongPressedPoint == point);
+ HbMenu::mExecPoint = QPointF();
+
+ // context menu setup fails, due invalid amount of correct actions
+ QMap::iterator iter = mTestWidget->mContextMenuActions.begin();
+ iter++;
+ HbAction *nullAction = 0;
+ iter.value() = nullAction;
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::mExecPoint != point);
+ QVERIFY(HbListView::mLongPressedPoint == point);
+
+}
+
+// ---------------------------------------------------------------------------
+// testSetContextMenu
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testSetContextMenu()
+{
+ mDummyProxyModel->mItemIds.clear();
+ mTestWidget->initialize(*mDummyProxyModel);
+ hbInstance->mWindowses.append(mDummyMainWnd);
+
+ TMPXItemId itemId;
+ QPointF point(1,1);
+ itemId.iId2 = 0;
+ mDummyProxyModel->mItemIds.append(itemId);
+
+ // no context menu
+ delete mTestWidget->mContextMenu;
+ mTestWidget->mContextMenu = 0;
+
+ // mCurrentLevel == ELevelVideos
+ int visibleCount = 0;
+ mTestWidget->mCurrentLevel = VideoListWidget::ELevelVideos;
+ mTestWidget->callLongPressGesture(point);
+
+ QMap::iterator iter = mTestWidget->mContextMenuActions.begin();
+ QVERIFY(iter != mTestWidget->mContextMenuActions.end());
+
+ while(iter != mTestWidget->mContextMenuActions.end())
+ {
+ if(iter.value()->mVisible)
+ {
+ visibleCount++;
+ }
+ ++iter;
+ }
+ QVERIFY(visibleCount == 4);
+
+ // invalid amount of actions -> invalid items gets removed
+ HbAction *nullAction = 0;
+ iter = mTestWidget->mContextMenuActions.begin();
+ iter++;
+ iter.value() = nullAction;
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(!mTestWidget->mContextMenu);
+ QVERIFY(mTestWidget->mContextMenuActions.count() == 0);
+
+ // mCurrentLevel == ELevelCategory
+ mTestWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
+ // --> getType returns ECollections
+ // ---> default collection flag is on
+ mTestWidget->callLongPressGesture(point);
+ iter = mTestWidget->mContextMenuActions.begin();
+ QVERIFY(iter != mTestWidget->mContextMenuActions.end());
+ visibleCount = 0;
+ while(iter != mTestWidget->mContextMenuActions.end())
+ {
+ if(iter.value()->mVisible)
+ {
+ visibleCount++;
+ }
+ ++iter;
+ }
+ QVERIFY(visibleCount == 0);
+
+ // ---> default collection flag is off
+ mDummyProxyModel->mItemIds.clear();
+ itemId.iId2 = 1;
+ itemId.iId1 = KVcxMvcCategoryIdAll;
+ mDummyProxyModel->mItemIds.append(itemId);
+ mTestWidget->callLongPressGesture(point);
+ iter = mTestWidget->mContextMenuActions.begin();
+ QVERIFY(iter != mTestWidget->mContextMenuActions.end());
+ visibleCount = 0;
+ while(iter != mTestWidget->mContextMenuActions.end())
+ {
+ if(iter.value()->mVisible)
+ {
+ visibleCount++;
+ }
+ ++iter;
+ }
+ QVERIFY(visibleCount == 4);
+
+ // --> getType returns EUserColItems
+ mTestWidget->mLastOpenItemId.iId2 = 0;
+ mTestWidget->callLongPressGesture(point);
+ iter = mTestWidget->mContextMenuActions.begin();
+ QVERIFY(iter != mTestWidget->mContextMenuActions.end());
+ visibleCount = 0;
+ while(iter != mTestWidget->mContextMenuActions.end())
+ {
+ if(iter.value()->mVisible)
+ {
+ visibleCount++;
+ }
+ ++iter;
+ }
+ QVERIFY(visibleCount == 4);
+
+ // --> getType returns EUnknow
+ mTestWidget->mCurrentLevel = (VideoListWidget::TVideoListLevel)0;
+ mTestWidget->callLongPressGesture(point);
+ iter = mTestWidget->mContextMenuActions.begin();
+ QVERIFY(iter != mTestWidget->mContextMenuActions.end());
+ visibleCount = 0;
+ while(iter != mTestWidget->mContextMenuActions.end())
+ {
+ if(iter.value()->mVisible)
+ {
+ visibleCount++;
+ }
+ ++iter;
+ }
+ QVERIFY(visibleCount == 0);
+}
+
+// ---------------------------------------------------------------------------
+// testShareItemSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testShareItemSlot()
+{
+ // nothing to test yet
+ HbMessageBox::mLatestTxt = "";
+ mTestWidget->initialize(*mDummyProxyModel);
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(shareItemSlot()));
+ emit testSignal();
+ QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(shareItemSlot()));
+
+}
+
+// ---------------------------------------------------------------------------
+// testDeleteItemSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testDeleteItemSlot()
+{
+ HbMessageBox::mLatestTxt = "";
+ VideoSortFilterProxyModel::mLastIndex = QModelIndex();
+ mDummyModel->reset();
+ mTestWidget->initialize(*mDummyProxyModel);
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(deleteItemSlot()));
+
+ // no model
+ VideoSortFilterProxyModel *tmp = mTestWidget->mModel;
+ mTestWidget->mModel = 0;
+ emit testSignal();
+ QVERIFY(mDummyModel->dataAccessCount() == 0);
+ QVERIFY(HbMessageBox::mLatestTxt.isEmpty());
+ QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());
+ mDummyModel->reset();
+ mTestWidget->mModel = tmp;
+
+ // current index is invalid
+ mTestWidget->mCurrentIndex = QModelIndex();
+ emit testSignal();
+ QVERIFY(mDummyModel->dataAccessCount() == 1);
+ QVERIFY(HbMessageBox::mLatestTxt.isEmpty());
+ QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());
+ mDummyModel->reset();
+
+ // data fetched from item is invalid
+ mDummyModel->setRowCount(1);
+ mTestWidget->mCurrentIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+ emit testSignal();
+ QVERIFY(mDummyModel->dataAccessCount() == 1);
+ QVERIFY(HbMessageBox::mLatestTxt.isEmpty());
+ QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());
+ mDummyModel->reset();
+
+ // data is valid
+ mDummyModel->setRowCount(1);
+ QVariant data = QString("test");
+ mDummyModel->setData( Qt::DisplayRole, data);
+ mTestWidget->mCurrentIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+
+ // messagebox question returns false
+ HbMessageBox::mQuestionReturnValue = false;
+ emit testSignal();
+ QVERIFY(mDummyModel->dataAccessCount() == 1);
+ QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());;
+ HbMessageBox::mLatestTxt = "";
+ mDummyModel->reset();
+ mDummyModel->setRowCount(1);
+ data = QString("test");
+ mDummyModel->setData( Qt::DisplayRole, data);
+
+ // messagebox question returns true
+ HbMessageBox::mQuestionReturnValue = true;
+ emit testSignal();
+ QVERIFY(mDummyModel->dataAccessCount() == 1);
+ QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 0);
+
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(deleteItemSlot()));
+}
+
+// ---------------------------------------------------------------------------
+// testRenameSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testRenameSlot()
+{
+ // nothing to test yet
+ HbMessageBox::mLatestTxt = "";
+ mTestWidget->initialize(*mDummyProxyModel);
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(renameSlot()));
+ emit testSignal();
+ QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(renameSlot()));
+}
+
+// ---------------------------------------------------------------------------
+// testPlayAllSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testPlayAllSlot()
+{
+ // nothing to test yet
+ HbMessageBox::mLatestTxt = "";
+ mTestWidget->initialize(*mDummyProxyModel);
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(playAllSlot()));
+ emit testSignal();
+ QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(playAllSlot()));
+}
+
+// ---------------------------------------------------------------------------
+// testAddItemSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testAddItemSlot()
+{
+ // nothing to test yet
+ HbMessageBox::mLatestTxt = "";
+ mTestWidget->initialize(*mDummyProxyModel);
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(addItemSlot()));
+ emit testSignal();
+ QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(addItemSlot()));
+}
+
+// ---------------------------------------------------------------------------
+// testAddToCollectionSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testAddToCollectionSlot()
+{
+ // nothing to test yet
+ HbMessageBox::mLatestTxt = "";
+ mTestWidget->initialize(*mDummyProxyModel);
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(addToCollectionSlot()));
+ emit testSignal();
+ QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(addToCollectionSlot()));
+}
+
+// ---------------------------------------------------------------------------
+// testOpenDetailsSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testOpenDetailsSlot()
+{
+ QSignalSpy spysignal(mTestWidget, SIGNAL(command(int)));
+ HbMessageBox::mLatestTxt = "";
+ VideoSortFilterProxyModel::mLastIndex = QModelIndex();
+ mDummyModel->reset();
+ mTestWidget->initialize(*mDummyProxyModel);
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(openDetailsSlot()));
+
+ // no model
+ VideoSortFilterProxyModel *tmp = mTestWidget->mModel;
+ mTestWidget->mModel = 0;
+ emit testSignal();
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());
+ mTestWidget->mModel = tmp;
+
+ // detail fetch fails
+ mDummyModel->setRowCount(1);
+ QVariant data = QString("test");
+ mDummyModel->setData( Qt::DisplayRole, data);
+ mTestWidget->mCurrentIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+ VideoSortFilterProxyModel::mDetailsReturnValue = -1;
+
+ emit testSignal();
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 0);
+
+ // detail fetch succeeds
+ VideoSortFilterProxyModel::mDetailsReturnValue = 0;
+ VideoSortFilterProxyModel::mLastIndex = QModelIndex();
+ emit testSignal();
+ QVERIFY(spysignal.count() == 1);
+ QVERIFY(spysignal.at(0).at(0).isValid());
+ QVERIFY(spysignal.at(0).at(0).toInt() == MpxHbVideoCommon::ActivateVideoDetailsView);
+ QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 0);
+
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(openDetailsSlot()));
+}
+
+// ---------------------------------------------------------------------------
+// testBack
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testBack()
+{
+ QSignalSpy spysignal(mTestWidget, SIGNAL(collectionOpened(bool, const QString&)));
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(back()));
+ // no model
+ hbInstance->mWindowses.append(mDummyMainWnd);
+ emit testSignal();
+ QVERIFY(spysignal.count() == 0);
+
+ // model exist
+ mTestWidget->initialize(*mDummyProxyModel);
+ emit testSignal();
+ QVERIFY(spysignal.count() == 1);
+ QVERIFY(spysignal.value(0).at(0).isValid());
+ QVERIFY(spysignal.value(0).at(0).toBool() == false);
+ QVERIFY(spysignal.value(0).at(1).isValid());
+ QVERIFY(spysignal.value(0).at(1).toString().isEmpty());
+
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(back()));
+}
+
+// ---------------------------------------------------------------------------
+// testScrollingEndedSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testScrollingEndedSlot()
+{
+ mTestWidget->initialize(*mDummyProxyModel);
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(scrollingEndedSlot()));
+
+ // no visible items
+ HbListView::mVisibleItems.clear();
+ emit testSignal();
+ QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 0);
+ QVERIFY(!mTestWidget->mScrollPositionTimer->isActive());
+
+ // setup few "visible" items and make sure item count match at thumbnail data
+ int count = 10;
+ mDummyModel->setRowCount(count);
+ HbAbstractViewItem *item = 0;
+ for(int i = 0; i < count; ++i)
+ {
+ item = new HbAbstractViewItem();
+ item->mModelIndex = mDummyModel->index(i, 0, QModelIndex());
+ HbListView::mVisibleItems.append(item);
+ }
+
+ // Test
+ emit testSignal();
+ QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+ QVERIFY(!mTestWidget->mScrollPositionTimer->isActive());
+
+ // Test again when timer is null.
+ VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
+ QTimer *backup = mTestWidget->mScrollPositionTimer;
+ mTestWidget->mScrollPositionTimer = 0;
+ VideoThumbnailData::mStartFetchingThumbnailsThumbnailCount = 0;
+ emit testSignal();
+ QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+ mTestWidget->mScrollPositionTimer = backup;
+ backup = 0;
+
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(scrollingEndedSlot()));
+}
+
+// ---------------------------------------------------------------------------
+// testScrollingEndedSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testScrollPositionChangedSlot()
+{
+ mTestWidget->initialize(*mDummyProxyModel);
+ const QPointF point;
+
+ connect(this, SIGNAL(testSignal(const QPointF&)), mTestWidget, SLOT(scrollPositionChangedSlot(const QPointF&)));
+
+ // Test
+ emit testSignal(point);
+
+ // Test again when timer is running.
+ mTestWidget->mScrollPositionTimer->start(1000*30);
+ emit testSignal(point);
+
+ // Test when timer is null.
+ QTimer *backup = mTestWidget->mScrollPositionTimer;
+ mTestWidget->mScrollPositionTimer = 0;
+ emit testSignal(point);
+ mTestWidget->mScrollPositionTimer = backup;
+ backup = 0;
+
+ disconnect(this, SIGNAL(testSignal(const QPointF&)), mTestWidget, SLOT(scrollPositionChangedSlot(const QPointF&)));
+}
+
+// end of file
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/dummydatamodel.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/dummydatamodel.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2009 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: DummyDataModel class definition*
+*/
+
+#ifndef __DUMMYDATAMODEL_H__
+#define __DUMMYDATAMODEL_H__
+
+
+// INCLUDES
+#include
+#include
+
+
+
+// FORWARD DECLARATIONS
+
+
+class DummyDataModel : public QAbstractItemModel
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(DummyDataModel)
+
+public:
+
+ /**
+ * Default constructor
+ */
+ DummyDataModel();
+
+ /**
+ * Destructor
+ */
+ ~DummyDataModel();
+
+ /**
+ * latest accessed index
+ */
+ QModelIndex lastIndex();
+
+ /**
+ * how many time data has qbeen queried
+ */
+ int dataAccessCount();
+
+ /**
+ * reset static members
+ */
+ void reset();
+
+ /**
+ * saves data
+ */
+ void setData(int role, QVariant data);
+
+ /**
+ * sets row count
+ */
+ void setRowCount(int count);
+
+public: // from QAbstractItemModel
+
+ /**
+ * Returns video item count to the proxy cache
+ *
+ * @param parent, parent's index, not used
+ *
+ * @return int count of items
+ */
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+
+ /**
+ * dummy impl
+ *
+ * @return QMap item data
+ */
+ QMap itemData(const QModelIndex &index) const;
+
+ /**
+ * data
+ */
+ QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
+
+ /**
+ * columnCount
+ */
+ int columnCount(const QModelIndex & parent = QModelIndex()) const;
+
+ /**
+ * index
+ */
+ QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
+
+ /**
+ * Parent
+ */
+ QModelIndex parent(const QModelIndex & index) const;
+
+private:
+
+ /**
+ * data map
+ */
+ QMap mData;
+
+ /**
+ * last index
+ */
+ mutable QModelIndex mLastIndex;
+
+ /**
+ * data access count
+ */
+ mutable int mDataAccessCount;
+
+ /**
+ * row count
+ */
+ int mRowCount;
+
+};
+#endif // __DUMMYDATAMODEL_H__
+
+// End of file
+
+
+
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/hbaction.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/hbaction.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2009 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: stub hbaction
+*
+*/
+
+#ifndef HBACTION_H
+#define HBACTION_H
+
+#include
+#include
+#include
+#include "hbwidget.h"
+
+
+class HbAction : public HbWidget
+{
+ Q_OBJECT
+public:
+ /**
+ * Contructor.
+ */
+ HbAction( const QString &txt, QGraphicsItem *parent = 0) : mTxt(txt), HbWidget(0)
+ {
+ Q_UNUSED(parent);
+ initializeCount++;
+ };
+
+ /**
+ * Contructor.
+ */
+ HbAction( Hb::ActionTypes actType, QGraphicsItem *parent = 0) : mTxt(""), HbWidget(0)
+ {
+ Q_UNUSED(parent);
+ Q_UNUSED(actType);
+ initializeCount++;
+ };
+
+ /**
+ * destructor
+ */
+ virtual ~HbAction(){initializeCount--;}
+
+ /**
+ * sets mDisable;
+ */
+ void setDisabled(bool disable){mDisable = disable;}
+
+ /**
+ * sets mVisible;
+ */
+ void setVisible(bool visible){mVisible = visible;}
+
+ /**
+ * dummy member
+ */
+ bool mDisable;
+
+ /**
+ * dummy member
+ */
+ bool mVisible;
+
+ /**
+ * text setted
+ */
+ QString mTxt;
+
+ /**
+ * counter to make sure alloc dealloc match
+ */
+ static int initializeCount;
+
+signals:
+
+ /**
+ * dummy triggered
+ */
+ void triggered();
+
+};
+
+#endif
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/hbinstance.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/hbinstance.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2009 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: stub hbinstance
+*
+*/
+
+#ifndef HBINSTANCE_H
+#define HBINSTANCE_H
+
+
+#include "hbmainwindow.h"
+
+
+#define hbInstance (HbInstance::instance())
+
+class HbInstance
+{
+public:
+
+ /**
+ * returns static instance
+ */
+ static HbInstance *instance()
+ {
+ static HbInstance __instance;
+ return &__instance;
+ }
+
+ /**
+ * returns list of windowses
+ */
+ QList allMainWindows()
+ {
+ return mWindowses;
+ }
+
+ /**
+ * list of windowses
+ */
+ QList mWindowses;
+
+private:
+ /**
+ * no copy contructor
+ */
+ Q_DISABLE_COPY(HbInstance)
+
+ /**
+ * default constuctor
+ */
+ HbInstance(){};
+
+ /**
+ * destructor
+ */
+ ~HbInstance(){};
+};
+
+#endif
diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/hblistview.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/hblistview.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,308 @@
+/*
+* Copyright (c) 2008-2009 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: stub hbview
+*
+*/
+
+
+#ifndef HBLISTVIEW_H
+#define HBLISTVIEW_H
+
+#include