# HG changeset patch # User hgs # Date 1286356779 -19800 # Node ID 27f2d7aec52a93880c037e7d180c2fbdbc5bd2ea # Parent 45459746d5e8febb4d66d023d66678626ab71492 201039_01 diff -r 45459746d5e8 -r 27f2d7aec52a data/listview.docml --- a/data/listview.docml Mon Sep 27 15:13:20 2010 +0530 +++ b/data/listview.docml Wed Oct 06 14:49:39 2010 +0530 @@ -1,9 +1,9 @@ - + - + @@ -15,17 +15,25 @@ + + + + + - - - - + + + + + + + - + diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/manager/group/glxdatasourcemanager.mmp --- a/engine/collectionframework/datasource/manager/group/glxdatasourcemanager.mmp Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/datasource/manager/group/glxdatasourcemanager.mmp Wed Oct 06 14:49:39 2010 +0530 @@ -48,7 +48,7 @@ // System includes from the source tree SYSTEMINCLUDE ../../../../../commonutilities/common/inc SYSTEMINCLUDE ../../../../../inc -SYSTEMINCLUDE ../../../thumbnailcreator/inc +SYSTEMINCLUDE ../../plugins/glxdatasourcemde2.5/inc SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/data/20000A16.rss --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/data/20000A16.rss Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2006 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: Resource definitions -* -*/ - - - -// INCLUDES - -#include -#include "glxdatasourcemde.hrh" - -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = KGlxDataSourceMdePluginDllUid; - - interfaces = - { - INTERFACE_INFO - { - interface_uid = 0x20000A0F; // KGlxDataSourceInterfaceUid - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = KGlxDataSourceMdeImplementationUid; - version_no = 1; - display_name = ""; - default_data = ""; - opaque_data = ""; - } - }; - } - }; - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/group/bld.inf --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/group/bld.inf Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -/* -* Copyright (c) 2006 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: Build information file for project glxcollectionpluginbase. -* -*/ - - - -PRJ_MMPFILES -glxdatasourcemde.mmp \ No newline at end of file diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/group/glxdatasourcemde.mmp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/group/glxdatasourcemde.mmp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2006 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: Project definition file for project glxdatasourcemanager. -* -*/ - - - -/** - * @internal reviewed 11/07/2007 by M Byrne - */ - -#include -#include -#include //APP_LAYER_SYSTEMINCLUDE - -#include "../../../../../../group/glxbuildcommon.mmh" - - -TARGET glxdatasourcemde.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x20000A16 - -#ifndef WINSCW -EPOCALLOWDLLDATA -#endif -CAPABILITY CAP_ECOM_PLUGIN - -SOURCEPATH ../src -SOURCE glxdatasourcemde.cpp -SOURCE glxdatasourcemdeproxy.cpp -SOURCE glxdatasourcetaskmde.cpp -SOURCE glxdatasourcetaskmdeattribute.cpp -SOURCE glxdatasourcetaskmdecommand.cpp -SOURCE glxdatasourcetaskmdeidlist.cpp -SOURCE glxdatasourcetaskmdethumbnail.cpp - -// System includes from the source tree -SYSTEMINCLUDE ../../../../../../commonutilities/common/inc -SYSTEMINCLUDE ../../../../../../inc -SYSTEMINCLUDE ../../../../thumbnailcreator/inc -SYSTEMINCLUDE ../../../manager/inc -SYSTEMINCLUDE ../inc - -// System includes from epoc32/include -APP_LAYER_SYSTEMINCLUDE - -SYSTEMINCLUDE /epoc32/include/caf -SYSTEMINCLUDE /epoc32/include/ecom - -SOURCEPATH ../data -START RESOURCE 20000A16.rss -TARGET glxdatasourcemde.rsc -END - -LIBRARY bafl.lib -LIBRARY caf.lib -LIBRARY ecom.lib -LIBRARY efsrv.lib -LIBRARY estor.lib -LIBRARY euser.lib -LIBRARY fbscli.lib -LIBRARY glxcommon.lib -LIBRARY glxdatasourcemanager.lib -LIBRARY glxthumbnailcreator.lib -LIBRARY inetprotutil.lib -LIBRARY lbs.lib -LIBRARY mdeclient.lib -LIBRARY mpxcommon.lib -LIBRARY platformenv.lib -LIBRARY iclextjpegapi.lib -LIBRARY imageconversion.lib - -SMPSAFE -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcemde.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcemde.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,334 +0,0 @@ -/* -* Copyright (c) 2006 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: -* -*/ - - - -/** - * @author Simon Brooks, Alex Birkett - */ - -/** - * @internal reviewed 10/07/2007 by M Byrne - */ - -#ifndef _C_GLXDATASOURCEMDE_H_ -#define _C_GLXDATASOURCEMDE_H_ - -// INCLUDES -#include -#include - -#include -#include -#include - -#include "glxdatasource.h" - -// FORWARD DECLARATIONS -class CGlxRequest; -class CGlxtnThumbnailCreator; -class CGlxtnThumbnailDatabase; - -// CONSTANTS - -// CLASS DECLARATION - -/** - * CGlxDataSourceMde class - * - * Data Source Mde is a Meta Data Data Source. - * @lib GlxDataSourceMde.lib - * @ingroup collection_component_design - */ -class CGlxDataSourceMde : public CGlxDataSource, - public MMdESessionObserver, - public MGlxtnThumbnailStorageObserver, - public MMdEObjectObserver, - public MMdEObjectPresentObserver, - public MMdERelationObserver, - public MMdERelationPresentObserver - { -public: - static CGlxDataSourceMde* NewL(); - -private: - ~CGlxDataSourceMde(); - - CGlxDataSourceMde(); - - void ConstructL(); - -public: // from CGlxDataSource - CGlxDataSourceTask* CreateTaskL(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver); - -private: - /** - * from MMdESessionObserver - */ - void HandleSessionOpened(CMdESession& aSession, TInt aError); - - void HandleSessionError(CMdESession& aSession, TInt aError); - -private: // from MGlxtnThumbnailStorageObserver - /** - * Notify that a given thumbnail is available in storage. - * @param aId Media item ID. - * @param aSize Requested thumbnail size. - */ - void ThumbnailAvailable(const TGlxMediaId& aId, const TSize& aSize); - /** - * Notify that a given thumbnail is available in storage. - * @param aId Media item ID. - * @param aSize Thumbnail size. - */ - void BackgroundThumbnailError(const TGlxMediaId& aId, TInt aError); - -private: // MMdEObjectObserver - /** - * Called to notify the observer that new objects has been added to - * the metadata engine database. - * - * @param aSession session - * @param aObjectIdArray IDs of added object - */ - void HandleObjectAdded(CMdESession& aSession, const RArray& aObjectIdArray); - - /** - * Called to notify the observer that objects has been modified in - * the metadata engine database. - * - * @param aSession session - * @param aObjectIdArray IDs of modified object - */ - void HandleObjectModified(CMdESession& aSession, const RArray& aObjectIdArray); - - /** - * Called to notify the observer that objects has been removed from - * the metadata engine database. - * - * @param aSession session - * @param aObjectIdArray IDs of removed object - */ - void HandleObjectRemoved(CMdESession& aSession, const RArray& aObjectIdArray); - -private: // MMdEObjectPresentObserver - /** - * Called to notify the observer that objects has been set to present state in - * the metadata engine database. - * - * @param aSession session - * @param aObjectIdArray object IDs which are set to present state - */ - void HandleObjectPresent(CMdESession& aSession, const RArray& aObjectIdArray); - - /** - * Called to notify the observer that objects has been set to not present state in - * the metadata engine database. - * - * @param aSession session - * @param aObjectIdArray object IDs which are set to not present state - */ - void HandleObjectNotPresent(CMdESession& aSession, const RArray& aObjectIdArray); - -private: // MMdERelationObserver - /** - * Called to notify the observer that new relations has been added to - * the metadata engine database. - * - * @param aSession session - * @param aRelationIdArray IDs of added relations - */ - void HandleRelationAdded(CMdESession& aSession, const RArray& aRelationIdArray); - - /** - * Called to notify the observer that relations has been removed from - * the metadata engine database. - * - * @param aSession session - * @param aRelationIdArray IDs of removed relations - */ - void HandleRelationRemoved(CMdESession& aSession, const RArray& aRelationIdArray); - - /** - * Called to notify the observer that relations has been modified from - * the metadata engine database. - * - * @param aSession session - * @param aRelationIdArray IDs of modified relations - */ - void HandleRelationModified(CMdESession& aSession, const RArray& aRelationIdArray); - -private: //MMdERelationPresentObserver - /** - * Called to notify the observer that objects has been set to present state in - * the metadata engine database. - * - * @param aSession session - * @param aObjectIdArray object IDs which are set to present state - */ - void HandleRelationPresent(CMdESession& aSession, const RArray& aRelationIdArray); - - /** - * Called to notify the observer that objects has been set to not present state in - * the metadata engine database. - * - * @param aSession session - * @param aObjectIdArray object IDs which are set to not present state - */ - void HandleRelationNotPresent(CMdESession& aSession, const RArray& aRelationIdArray); - -private: - - void BackgroundThumbnailMessageL(const TGlxMediaId& aId, const TSize& aSize, TInt aError); - - void DoSessionInitL(); - - void AddMdEObserversL(); - - void ProcessUpdateArray(const RArray& aArray, TMPXChangeEventType aType, TBool aIsObject); - - void ProcessItemUpdateL(); - - static TInt ProcessItemUpdate(TAny* aPtr); - - void CreateSessionL(); - - static TInt CreateSession(TAny* aPtr); - - void PrepareMonthsL(); - - void TaskCompletedL(); - - void TaskStartedL(); - -public: - inline CMdESession& Session() const; - - inline CGlxtnThumbnailCreator& ThumbnailCreator() const; - - inline CGlxtnThumbnailDatabase& ThumbnailDatabase() const; - - inline RFs& FileServerSession(); - - inline const TGlxMediaId& CameraAlbumId() const; - - inline const TGlxMediaId& FavoritesId() const; - - inline CMdENamespaceDef* NamespaceDef() const; - - inline CMdEObjectDef& ObjectDef() const; - - inline CMdEObjectDef& ImageDef() const; - - inline CMdEObjectDef& VideoDef() const; - - inline CMdEObjectDef& AlbumDef() const; - - inline CMdEObjectDef& MediaDef() const; - inline CMdEObjectDef& TagDef() const; - - /** - * Return object definition used to describe months. - * @return object definition used to describe months. - */ - inline CMdEObjectDef& MonthDef() const; - - inline CMdERelationDef& ContainsDef() const; - - /** - * Get the location definition. - * @return location definition. - */ - inline CMdEObjectDef& LocationDef() const; - - TContainerType ContainerType(CMdEObject* aObject); - - TContainerType ContainerType(CMdEObjectDef* aObjectDef); - - TItemType ItemType(CMdEObject* aObject); - - const TGlxMediaId GetMonthIdL(const TTime& aMonth); - - TBool SameMonth(const TTime& aOldDate, const TTime& aNewDate); - - TBool ContainerIsLeft(CMdEObjectDef& aObjectDef); - -private: - - CGlxtnThumbnailCreator* iThumbnailCreator; - - CGlxtnThumbnailDatabase* iThumbnailDatabase; - - CMdESession* iSession; - - RFs iFs; - - TBool iSessionOpen; - - TGlxMediaId iCameraAlbumId; - - TGlxMediaId iFavoritesId; - - - CMdENamespaceDef* iNameSpaceDef; - - CMdEObjectDef* iObjectDef; - - CMdEObjectDef* iImageDef; - - CMdEObjectDef* iVideoDef; - - CMdEObjectDef* iAlbumDef; - - CMdEObjectDef* iMediaDef; - CMdEObjectDef* iTagDef; - - CMdEObjectDef* iMonthDef; - - /** - * Location object definition. - */ - CMdEObjectDef* iLocationDef; - CMdERelationDef* iContainsDef; - - - RArray iMonthArray; - - RArray iMonthList; - - TTime iFirstMonth; - - TTime iLastMonth; - - CAsyncCallBack* iUpdateCallback; - - CAsyncCallBack* iCreateSessionCallback; - - struct TUpdateData - { - TItemId iId; - TMPXChangeEventType iType; - TBool iIsObject; - }; - - RArray iUpdateData; - TBool iPauseUpdate; - }; - -#include "glxdatasourcemde.inl" - -#endif //_C_GLXDATASOURCEMDE_H_ diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcemde.hrh --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcemde.hrh Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2006 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: Resource headers -* -*/ - - - -/** - * @internal reviewed 10/07/2007 by M Byrne - */ - -#ifndef GLXDATASOURCEMDE_HRH -#define GLXDATASOURCEMDE_HRH - -// CONSTANTS - -#define KGlxDataSourceMdePluginDllUid 0x20000A16 -#define KGlxDataSourceMdeImplementationUid 0x20000A10 - -#endif // GLXDATASOURCEMDE_HRH - -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcemde.inl --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcemde.inl Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +0,0 @@ -/* -* Copyright (c) 2006 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: -* -*/ - - - -/** - * @internal reviewed 10/07/2007 by M Byrne - */ - -#include - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::Session -// ---------------------------------------------------------------------------- -// -CMdESession& CGlxDataSourceMde::Session() const - { - __ASSERT_DEBUG(iSessionOpen, Panic(EGlxPanicDatasourceMdeSessionNotOpen)); - return *iSession; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::ThumbnailCreator -// ---------------------------------------------------------------------------- -// -CGlxtnThumbnailCreator& CGlxDataSourceMde::ThumbnailCreator() const - { - return *iThumbnailCreator; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::ThumbnailDatabase -// ---------------------------------------------------------------------------- -// -CGlxtnThumbnailDatabase& CGlxDataSourceMde::ThumbnailDatabase() const - { - return *iThumbnailDatabase; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::FileServerSession -// ---------------------------------------------------------------------------- -// -RFs& CGlxDataSourceMde::FileServerSession() - { - return iFs; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::CameraAlbumId -// ---------------------------------------------------------------------------- -// -const TGlxMediaId& CGlxDataSourceMde::CameraAlbumId() const - { - return iCameraAlbumId; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::FavoritesId -// ---------------------------------------------------------------------------- -// -const TGlxMediaId& CGlxDataSourceMde::FavoritesId() const - { - return iFavoritesId; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::NamespaceDef -// ---------------------------------------------------------------------------- -// -CMdENamespaceDef* CGlxDataSourceMde::NamespaceDef() const - { - return iNameSpaceDef; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::ObjectDef -// ---------------------------------------------------------------------------- -// -CMdEObjectDef& CGlxDataSourceMde::ObjectDef() const - { - return *iObjectDef; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::ImageDef -// ---------------------------------------------------------------------------- -// -CMdEObjectDef& CGlxDataSourceMde::ImageDef() const - { - return *iImageDef; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::VideoDef -// ---------------------------------------------------------------------------- -// -CMdEObjectDef& CGlxDataSourceMde::VideoDef() const - { - return *iVideoDef; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::MediaDef -// ---------------------------------------------------------------------------- -// -CMdEObjectDef& CGlxDataSourceMde::MediaDef() const - { - return *iMediaDef; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::AlbumDef -// ---------------------------------------------------------------------------- -// -CMdEObjectDef& CGlxDataSourceMde::AlbumDef() const - { - return *iAlbumDef; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::TagDef -// ---------------------------------------------------------------------------- -// -CMdEObjectDef& CGlxDataSourceMde::TagDef() const - { - return *iTagDef; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::MonthDef -// ---------------------------------------------------------------------------- -// -CMdEObjectDef& CGlxDataSourceMde::MonthDef() const - { - return *iMonthDef; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::ContainsDef -// ---------------------------------------------------------------------------- -// -CMdERelationDef& CGlxDataSourceMde::ContainsDef() const - { - return *iContainsDef; - } - -// --------------------------------------------------------------------------- -// CGlxDataSourceMde::LocationDef -// --------------------------------------------------------------------------- -// -CMdEObjectDef& CGlxDataSourceMde::LocationDef() const - { - return *iLocationDef; - } - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmde.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmde.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2006 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 _C_GLXDATASOURCETASKMDE_H_ -#define _C_GLXDATASOURCETASKMDE_H_ - -/** - * @author Simon Brooks, Alex Birkett - */ - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include - -// FORWARD DECLARATIONS -class CGlxDataSourceMde; -class CGlxRequest; -class CGlxtnThumbnailCreator; -class CMdEObjectDef; -class CMdEObjectQuery; -class CMdESession; - - -/** - * Query types supported by subclasses of CGlxDataSourceTaskMde - */ -enum TGlxQueryType - { - EContainerFirstItemQuery, // CGlxDataSourceTaskMdeThumbnail+ - EIdListQuery, // GlxDataSourceTaskMdeIdList - EAttributeQuery, // CGlxDataSourceTaskMdeAttribute - ELocationAttributeQuery, // CGlxDataSourceTaskMdeAttribute - EImageVideoQuery, // CGlxDataSourceTaskMdeAttribute (but should be general) - ECommandRemoveFromContainer, // CGlxDataSourceTaskMdeCommand - ECommandAddToContainer, // CGlxDataSourceTaskMdeCommand - ECommandRemoveLocation, // CGlxDataSourceTaskMdeCommand - ECommandAddContainer, // CGlxDataSourceTaskMdeCommand adds a container - ECommandDeleteContainers, // CGlxDataSourceTaskMdeCommand deletes containers objects - ECommandDeleteItems, // CGlxDataSourceTaskMdeCommand deletes containers objects - ECommandRenameContainer, - ECommandRename - }; - -/** - * CGlxDataSourceTaskMde class - * Base class for mde tasks: provides task generic functionality. - */ -NONSHARABLE_CLASS(CGlxDataSourceTaskMde) : public CGlxDataSourceTask, public MMdEQueryObserver - { -public: - /** - * Constructor. - * @param aRequest request to be executed. - * @param aObserver observer to be informed when task has completed. - * @param aDataSource data source to be used by this object. - */ - CGlxDataSourceTaskMde(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, - CGlxDataSource* aDataSource); - - /** - * Destructor. - */ - ~CGlxDataSourceTaskMde(); - - /** - * Second stage constructor - */ - virtual void ConstructL(); - -protected: // to be implemented by deriving classes - /** - * See @ref CGlxDataSourceTask::ExecuteRequestL - */ - virtual void ExecuteRequestL() = 0; - - /** - * Must be implemented by deriving classes. To handle query completion - * @param aQuery Query that has been completed. - */ - virtual void DoHandleQueryCompletedL(CMdEQuery& aQuery) = 0; - - /** - * Optionally implemented by deriving classes. Used if the deriving class has - * to run more than one query. Should start the next query or call HandleRequestComplete() - * if no futher queries are required to be run. If the deriving class only has a single query, - * HandleRequestComplete() can be called from DoHandleQueryCompletedL() - */ - virtual void DoNextQueryL() {} - -public: // From CGlxDataSourceTask - /** - * See @ref CGlxDataSourceTask::CancelRequest - */ - void CancelRequest(); - -private: // from MMdEQueryObserver - /** - * See @ref MMdEQueryObserver::HandleQueryNewResults - */ - void HandleQueryNewResults( CMdEQuery& aQuery, - TInt aFirstNewItemIndex, - TInt aNewItemCount ); - /** - * See @ref MMdEQueryObserver::HandleQueryNewResults - */ - void HandleQueryNewResults( CMdEQuery& aQuery, - TInt aNewObjectItemCount, - TInt aNewRelationItemCount, - TInt aNewEventItemCount); - /** - * See @ref MMdEQueryObserver::HandleQueryCompleted - */ - void HandleQueryCompleted( CMdEQuery& aQuery, TInt aError); - -protected: - - /** - * Returns a pointer to the CGlxDataSourceMde object passed in on instantiation. - * @return a pointer to the CGlxDataSourceMde object passed in on instantiation. - */ - CGlxDataSourceMde* DataSource(); - - void AddMonthFilterL(const TGlxMediaId& aContainerId, TGlxFilterProperties& aFilterProperties); - - void AddMonthFilterL(CMdEObject* aMonth, TGlxFilterProperties& aFilterProperties); - - /** - * Set query contditions by container id and filter properties. - * @param aLogicCondition logic condition to add conditions to - * @param aContainerId Id of the container - * @param aContainerIsLeft. This should be set to to ETrue if the container is on the left side of the releation, or - * EFalse if the container is on the right side of the relation - * - */ - void SetQueryConditionsL(CMdEQuery& aQuery, const TGlxFilterProperties& aFilterProperties, const TGlxMediaId aContainerId, CMdEObjectDef& aObjectDef); - - void SetQueryFilterConditionsL(CMdELogicCondition& aLogicCondition, CMdEObjectDef& aObjectDef, const TGlxFilterProperties& aFilterProperties); - - void SetSortOrderL(CMdEQuery& aQuery, CMdEObjectDef& aObjectDef, const TGlxFilterProperties& aFilterProperties); - - /** - * Returns the maximum number of items that a query should find. - * @return Maximum number of results - */ - TInt MaxQueryResultsCount(const TGlxFilterProperties& aFilterProperties) const; - - /** - * Removes and destroys the oldest query in iQueries. - */ - void RemoveQuery(); - - void DoQueryL(CMdEObjectDef& aObjectDef, TBool aIsContent, TGlxQueryType aQueryType, TQueryResultMode aResultMode, const TGlxMediaId& aContainerId); - - /** - * Adds queries for images and or videos to the query queue. The queries will return objects - * of type image or video that have ids specified by aObjectIds. - * @param aObjectIds A list of the ids of the required objects. - * @param aFilterProperties TGlxFilterProperties.iItemType is used to determine if only - * image or video queries are required if iItemType is not set to EGlxFilterImage or - * EGlxFitlerVideo a query for images will be queued first followed by a query for videos. - */ - void QueueImageVideoObjectQueriesL(const RArray& aObjectIds, const TGlxFilterProperties& aFilterProperties); - - /** - * Adds a query for tag objects that have ids specified by aObjectIds - * to the query queue. - * @param aObjectIds A list of the ids of the required objects. - */ - void QueueTagObjectQueryL(const RArray& aObjectIds); - - /** - * Adds a query for album objects that have ids specified by aObjectIds - * to the query queue. - * @param aObjectIds A list of the ids of the required objects. - */ - void QueueAlbumObjectQueryL(const RArray& aObjectIds); - - /** - * Adds a query for "month" objects that have ids specified by aObjectIds - * to the query queue. - * @param aObjectIds A list of the ids of the required objects. - */ - void QueueMonthObjectQueryL(const RArray& aObjectIds); - - /** - * Adds a query for objects of type specified by aObjectDef - * that have ids specified by aObjectIds to the query queue. - * @param aObjectDef type of objects required. - * @param aObjectIds A list of the ids of the required objects. - * @param aQueryType The query type. - */ - void QueueObjectQueryL(CMdEObjectDef& aObjectDef, - const RArray& aObjectIds, const TGlxQueryType& aQueryType); - - /** - * Appends a query to the query queue. (the ownership of the query is transferred) - * @param aQuery query to append to the query queue ownership is transferred to - * the query queue. It is expected that aQuery is not on the cleanupstack before the - * call to AppendQueryL is made - * @param aQueryType the query type. - */ - void AppendQueryL(CMdEQuery* aQuery, const TGlxQueryType& aQueryType); - - /** - * Executes the query at ordinal 0 in the - * query list implementation can be overidden by - * deriving classes. - */ - virtual void ExecuteQueryL(); - -private: - /* - * Helper function TRAPed and called by HandleQueryCompleted() - * @param aQuery the query that has been completed - */ - void HandleQueryCompletedL(CMdEQuery& aQuery); - - /** - * Removes the observer from any existing queries, cancels and destroys them - */ - void DestroyQueries(); - -private: - /** - * Default namespace def (not owned) - */ - CMdENamespaceDef* iDefaultNameSpaceDef; - -protected: - /** - * Outstanding queries array (owned) - */ - RPointerArray iQueries; - - /** - * Query types array (owned) - */ - RArray iQueryTypes; - - /** - * Filter properties - */ - TGlxFilterProperties iFilterProperties; - }; - -#endif //_C_GLXDATASOURCETASKMDE_H_ \ No newline at end of file diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdeattribute.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdeattribute.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2006 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 _C_GLXDATASOURCETASKMDEATTRIBUTETASK_H_ -#define _C_GLXDATASOURCETASKMDEATTRIBUTETASK_H_ - -/** - * @author Simon Brooks, Alex Birkett - */ - -#include -#include "glxdatasourcetaskmde.h" - - -// CLASS DECLARATION - -class CGlxGetRequest; - -NONSHARABLE_CLASS(TGlxQueryAttribute) - { -public: - TGlxQueryAttribute( - TMPXAttribute aAttribute, - CMPXMedia* aMedia, - TGlxFilterProperties aFilterProperties - ) : - iAttribute(aAttribute), - iMedia(aMedia), - iFilterProperties(aFilterProperties) - { - - }; -public: - TMPXAttribute iAttribute; - CMPXMedia* iMedia; - TGlxFilterProperties iFilterProperties; - }; - -/** - * Attribute retrieval task. - */ -NONSHARABLE_CLASS(CGlxDataSourceTaskMdeAttribute) : public CGlxDataSourceTaskMde - { -public: - /** - * Constructor. - * @param aRequest request to be executed. - * @param aObserver observer to be informed when task has completed. - * @param aDataSource data source to be used by this object. - */ - CGlxDataSourceTaskMdeAttribute(CGlxGetRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource); - - /** - * Destructor. - */ - ~CGlxDataSourceTaskMdeAttribute(); - -private: // From CGlxDataSourceTask - /** - * See @ref CGlxDataSourceTask::ExecuteRequestL - */ - void ExecuteRequestL(); - -private: // From CGlxDataSourceTaskMde - /** - * See @ref CGlxDataSourceTaskMde::DoHandleQueryCompletedL - */ - void DoHandleQueryCompletedL(CMdEQuery& aQuery); - - /** - * See @ref CGlxDataSourceTaskMde::DoNextQueryL - */ - void DoNextQueryL(); - -private: - - void AddAttributesL(CMdEObject& aObject, CMPXMedia* aEntry); - - void AddCollectionAttributesL(CMPXMedia* aEntry); - - void AddContainerAttributesL(CMPXMedia* aEntry, CMdEObject* aContainer, CGlxDataSource::TContainerType aType); - - void AddItemAttributesL(CMPXMedia* aEntry, CMdEObject* aItem, CGlxDataSource::TItemType aType); - - /** - * Add location information to a media object from MDS. - * @param aLocationId the id of a location object. - * @param aMedia media object to add a location attribute to. - */ - void AddLocationAttributeToMediaL(CMPXMedia& aMedia, const TItemId& aLocationId); - - - void DoHandleAttributeQueryCompletedL(); - - /** - * Handles the completion of a query of type ELocationQuery. - */ - void DoHandleLocationQueryCompletedL(); - - - void DoHandleImageVideoQueryCompletedL(); - - /** - * Creates a location query and adds it to the queue of queries. - */ - void QueueLocaitonQueryL(); - - /** - * @param aObjectDef object definition which defines objects which will be queried - * @param aIsContent If ETrue, the definition of the objects being queried is set by the item type filter property, if EFalse, the definition - * of the object being queried is provided by the aObjectDef parameter - * - */ - void QueueObjectQueryL(CMdEObjectDef& aObjectDef, TBool aIsContent, TGlxQueryType aQueryType, TQueryResultMode aResultMode, - const TGlxMediaId& aContainerId, TMPXAttribute aAttribute, CMPXMedia* aEntry, - const TGlxFilterProperties& aFilterProperties); - - - void DoHandleAttributeResponseCompleteL(); - - - /** - * Determines if the request contains the KGlxMediaGeneralLocation attribtue. - * @return ETrue if the the KGlxMediaGeneralLocation attribute is requrested else EFalse - */ - TBool LocationAttributeRequested(); - - /** - * Executes the next query in the queue of queries. - */ - void ExecuteQueryL(); - -private: - /** - * Results media array (owned) - */ - CMPXMediaArray* iMediaArray; - - /** - * Attributes associated with outstanding queries - */ - RArray< TGlxQueryAttribute > iQueryAttributes; - }; - - -#endif // _C_GLXDATASOURCETASKMDEATTRIBUTETASK_H_ diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdecommand.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdecommand.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,315 +0,0 @@ -/* -* Copyright (c) 2006 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 _C_GLXDATASOURCETASKMDECOMMAND_H_ -#define _C_GLXDATASOURCETASKMDECOMMAND_H_ - -/** - * @internal reviewed 10/07/2007 by M Byrne - */ - - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include "glxdatasourcetaskmde.h" - -// FORWARD DECLARATIONS -class CGlxDataSourceMde; -class CGlxRequest; -class CMdENamespaceDef; -class CMdEObjectDef; -class CMdEObjectQuery; -class CMdERelationDef; -class CMdERelationQuery; -class CMdESession; - -// CONSTANTS - -// CLASS DECLARATION - -/** - * CGlxDataSourceTaskMdeCommand class - * - */ -NONSHARABLE_CLASS( CGlxDataSourceTaskMdeCommand ) : public CGlxDataSourceTaskMde, - public MGlxCommandParserCallback - - { -public: // Constructors / Destructors - /** - * Constructor. - * @param aRequest request to be executed. - * @param aObserver observer to be informed when task has completed. - * @param aDataSource data source to be used by this object. - */ - CGlxDataSourceTaskMdeCommand(CGlxCommandRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, - CGlxDataSource* aDataSource); - - /** - * Symbian 2nd stage constructor - * See @ref CGlxDataSourceTaskMde::ConstructL - */ - void ConstructL(); - - /** - * Destructor - */ - ~CGlxDataSourceTaskMdeCommand(); - -private: // From MGlxCommandParserCallback - - /** - * See @ref MGlxCommandParserCallback::AddContainerL - */ - void AddContainerL(const TDesC& aContainerName); - - /** - * See @ref MGlxCommandParserCallback::AddToContainerL - */ - void AddToContainerL(const RArray& aSourceIds, const RArray& aTargetContainers); - - /** - * See @ref MGlxCommandParserCallback::AddToContainerL - */ - void AddToContainerL(const TDesC& aSourceUri, const RArray& aTargetContainers); - - /** - * See @ref MGlxCommandParserCallback::CopyL - */ - void CopyL(const RArray& aSourceIds, const TDesC& aDrive); - - /** - * See @ref MGlxCommandParserCallback::MoveL - */ - void MoveL(const RArray& aSourceIds, const TDesC& aDrive); - - /** - * See @ref MGlxCommandParserCallback::RemoveFromContainerL - */ - void RemoveFromContainerL(const RArray& aItemIds, const TGlxMediaId& aContainerId); - - /** - * See @ref MGlxCommandParserCallback::DeleteL - */ - void DeleteL(const RArray& aItemIds); - - /** - * See @ref MGlxCommandParserCallback::RenameL - */ - void RenameL(const TGlxMediaId& aSourceItemId, const TDesC& aTitle); - - /** - * See @ref MGlxCommandParserCallback::SetDescriptionL - */ - void SetDescriptionL(const RArray& aItemIds, const TDesC& aDescription); - - /** - * See @ref MGlxCommandParserCallback::SetCaptureLocationL - */ - void SetCaptureLocationL(const RArray& aItemIds, const TCoordinate& aCoordinate); - - /** - * See @ref MGlxCommandParserCallback::ThumbnailCleanupL - */ - void ThumbnailCleanupL(); - -private: // from CGlxDataSourceTaskMde - - /** - * See @ref CGlxDataSourceTaskMde::DoHandleQueryCompletedL - */ - void DoHandleQueryCompletedL(CMdEQuery& aQuery); - - /** - * See @ref CGlxDataSourceTaskMde::DoNextQueryL - */ - void DoNextQueryL(); - -private: - - /** - * Enumeration to describe file operations - * (Copy or Move) - */ - enum TFileOperation - { - ECopy, - EMove - }; - - /** - * Perform a file operation (copy or move). - * @param aSourceIds an array of media ids to copy or move. - * @param aDrive destination drive. - * @param aFileOperation file operation to perform (either a copy or a move) - */ - void FileOperationL(const TArray& aSourceIds, const TDesC& aDrive, TFileOperation aFileOperation); - - /** - * Gets the container id for a given media id. - * If aMedia id is KGlxCollectionRootId (0) then container id - * is determined using the collection id. E.g. if the aMediaId - * is KGlxCollectionRootId and the collection uid is - * KGlxCollectionPluginCameraImplementationUid - * then the camera album id is returned by the method. - * When aMedia id is not equal to KGlxCollectionRootId, (the - * vast majority of cases) the container id returned by the method - * will be the same as the media id passed in. - * - * @param aMediaId should be either a valid container id or KGlxCollectionRootId - * @return a container id. - */ - TMdEItemId ContainerItemId(const TGlxMediaId& aMediaId); - - /** - * Uses the PathInfo class to determine the 'root' path for - * a given drive. The 'root' path is C:\data for the C drive and - * x:\ for all other drives (where x is a drive letter) - * @param aDrive the drive for which the root path is required. - * @param aRootPath on return contains the root path. - */ - void RootPath(const TDesC& aDrive, TDes& aRootPath); - - /** - * Copies items from a TGlxMedia array to a TItemId array. - * @param aDestArray destination array. (It is the callers responsibility to ensure that aDestArray is on - * the cleanup stack should this be required) - * @param aSourceArray source array. - */ - void CopyArrayL(RArray& aDestArray, const RArray& aSourceArray); - - /** - * Sends progress messages to the client - * @param aCurrentStep number of currently completed steps. - * @param aStepCount number of total steps to completion. - */ - void SendProgressMessageL(TInt aCurrentStep, TInt aStepCount); - - /** - * Returns the container object definition (either album or tag) - * the container object definition is calculated based on the - * collection plug-in id associated with the task. - * @param aContainerObjectDef a pointer to the container object - * definition associated with the collection plugin if the - * function completes with out error. The caller does not take - * ownership of the pointer. - * @return KErrNone if the collection plug-in has a container - * object definition associated with it or a system wide - * error code. - */ - TInt ContainerObjectDef(CMdEObjectDef*& aContainerObjectDef); - - /** - * Handle the completion of a 'add to container' query. - * @param aQuery Query that has been completed. - */ - void DoHandleAddToContainerQueryCompletedL(CMdEQuery& aQuery); - - /** - * Handle the completion of a 'add container' query. - * @param aQuery Query that has been completed. - */ - void DoHandleAddContainerQueryCompletedL(CMdEQuery& aQuery); - - /** - * Handle the completion of a 'delete containers' query. - * @param aQuery Query that has been completed. - */ - void DoHandleDeleteContainersQueryCompletedL(CMdEQuery& aQuery); - - /** - * Handle the completion of a 'delete items' query. - * @param aQuery Query that has been completed. - */ - void DoHandleDeleteItemsQueryCompletedL(CMdEQuery& aQuery); - - - /** - * Handle the completion of a 'rename' query. - * @param aQuery Query that has been completed. - */ - void DoHandleRenameQueryCompletedL(CMdEQuery& aQuery); - - /** - * Handle the completion of a 'rename container' query. - * @param aQuery Query that has been completed. - */ - void DoHandleRenameConainerQueryCompletedL(CMdEQuery& aQuery); - - /** - * Appends a query to the query queue that determines the number - * of container objects that have the title aTitle. This - * method is used to check to see if a container with a - * specific title exists. The container type is determined - * using the ContainerObjectDef() method - * @aQueryType the query type. - * @aTitle title to search for. - */ - void AppendContainerTitleCountQueryL(const TGlxQueryType& aQueryType, const TDesC& aTitle); - -private: // from CGlxDataSourceTask - /** - * See @ref CGlxDataSourceTask::ExecuteRequestL - */ - void ExecuteRequestL(); - -private: - /** - * Default name space definition. - */ - CMdENamespaceDef* iDefaultNameSpaceDef; - - /** - * Collection uid. - */ - TUid iCollectionUid; - - /** - * Before new relations are added to the database, a check must be made to see if - * identical relations already exist. This is done asynchronously so they need to - * be stored temporarily as a member variable. - */ - RArray iLeftIds; - - /** - * Before new relations are added to the database, a check must be made to see if - * identical relations already exist. This is done asynchronously so they need to - * be stored temporarily as a member variable. - */ - RArray iRightIds; - - /** - * Used to store object titles while asynchronous operations are in progress. - * (owned) - */ - HBufC* iTitle; - - /** - * Used to store the object to rename while asynchronous operations are in progress. - * (owned) - */ - CMdEObject* iObjectToRename; - }; - -#endif //_C_GLXDATASOURCETASKMDECOMMAND_H_ diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdeidlist.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdeidlist.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* -* Copyright (c) 2006 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 GLXDATASOURCETASKMDEIDLIST_H_ -#define GLXDATASOURCETASKMDEIDLIST_H_ - -/** - * @author Simon Brooks, Alex Birkett - */ - -// INCLUDES -#include -#include - -#include -#include -#include -#include -#include -#include -#include "glxdatasourcetaskmde.h" -// FORWARD DECLARATIONS -class CGlxDataSourceMde; -class CGlxIdListRequest; -class CGlxtnThumbnailCreator; -class CMdEObjectDef; -class CMdEObjectQuery; -class CMdESession; - -/** - * CGlxDataSourceTaskMdeIdList class - * Task to handle id list requests. - */ -NONSHARABLE_CLASS(CGlxDataSourceTaskMdeIdList) : public CGlxDataSourceTaskMde, public MGlxtnThumbnailCreatorClient - - { -public: - /** - * Constructor. - * @param aRequest request to be executed. - * @param aObserver observer to be informed when task has completed. - * @param aDataSource data source to be used by this object. - */ - CGlxDataSourceTaskMdeIdList(CGlxIdListRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource); - - /** - * Destructor. - */ - ~CGlxDataSourceTaskMdeIdList(); - -private: // from MGlxtnThumbnailCreatorClient - /** - * Not used (pure virtual stubbed) - * See @ref MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete - */ - void ThumbnailFetchComplete(const TGlxMediaId& /*aItemId*/, - TGlxThumbnailQuality /*aQuality*/, TInt /*aErrorCode*/) {}; - - /** - * Not used (pure virtual stubbed) - * See @ref MGlxtnThumbnailCreatorClient::ThumbnailDeletionComplete - */ - void ThumbnailDeletionComplete(const TGlxMediaId& /*aItemId*/, - TInt /*aErrorCode*/) {}; - - /** - * See @ref MGlxtnThumbnailCreatorClient::FilterAvailableComplete - */ - void FilterAvailableComplete(const RArray& aIdArray, - TInt aErrorCode); - /** - * Not used (pure virtual stubbed) - * See @ref MGlxtnThumbnailCreatorClient::FetchFileInfoL - */ - void FetchFileInfoL(CGlxtnFileInfo* /*aInfo*/, - const TGlxMediaId& /*aItemId*/, TRequestStatus* /*aStatus*/) {}; - - /** - * Not used (pure virtual stubbed) - * See @ref MGlxtnThumbnailCreatorClient::CancelFetchUri - */ - void CancelFetchUri(const TGlxMediaId& /*aItemId*/) {}; - - /** - * Not used (pure virtual stubbed) - * See @ref MGlxtnThumbnailCreatorClient::ThumbnailStorage - */ - MGlxtnThumbnailStorage* ThumbnailStorage() { return NULL; }; - -public: // From CGlxDataSourceTask - /** - * See @ref CGlxDataSourceTask::ExecuteRequestL - */ - void ExecuteRequestL(); - -private: // from CGlxDataSourceTaskMde - /** - * See @ref CGlxDataSourceTask::DoHandleQueryCompletedL - */ - void DoHandleQueryCompletedL(CMdEQuery& aQuery); - -private: - void DoHandleListQueryCompletedL(); - - void DoMonthListCreationL(CMdEQuery& aQuery, const TGlxFilterProperties& aFilterProperties); - - void DoPostFilterComplete(const RArray& aIdArray, TInt aErrorCode); - - void PostFilterL(const RArray& aFilteredList, const TGlxFilterProperties& aFilterProperties); - }; - -#endif // GLXDATASOURCETASKMDEIDLIST_H_ diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdethumbnail.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdethumbnail.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* -* Copyright (c) 2006 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 GLXDATASOURCETASKMDETHUMBNAIL_H_ -#define GLXDATASOURCETASKMDETHUMBNAIL_H_ - -/** - * @author Simon Brooks, Alex Birkett - */ - -#include "glxdatasourcetaskmdeattribute.h" - -#include -#include - -/** - * CGlxDataSourceTaskMdeThumnail class - * Services thumbnail requests - */ -NONSHARABLE_CLASS(CGlxDataSourceTaskMdeThumbnail) : public CGlxDataSourceTaskMde, - public MGlxtnThumbnailCreatorClient - - { -public: - /** - * Constructor - * @param aRequest thumbnail request to service - * @param aObserver observer - * @param aDataSource data source - */ - CGlxDataSourceTaskMdeThumbnail(CGlxThumbnailRequest* aRequest, - MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource); - - /** - * Destructor - */ - ~CGlxDataSourceTaskMdeThumbnail(); - -private: // From CGlxDataSourceTask - /** - * See @ref CGlxDataSourceTask::ExecuteRequestL - */ - void ExecuteRequestL(); - - /** - * See @ref CGlxDataSourceTask::HandleRequestComplete - */ - void HandleRequestComplete(TInt aError); - -private: // From CGlxDataSourceTaskMde - /** - * See @ref CGlxDataSourceTaskMde::DoHandleQueryCompletedL - */ - void DoHandleQueryCompletedL(CMdEQuery& aQuery); - -private: // From MGlxtnThumbnailCreatorClient - /** - * See @ref MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete - */ - void ThumbnailFetchComplete(const TGlxMediaId& aItemId, - TGlxThumbnailQuality aQuality, TInt aErrorCode); - - /** - * See @ref MGlxtnThumbnailCreatorClient::ThumbnailDeletionComplete - */ - void ThumbnailDeletionComplete(const TGlxMediaId& aItemId, TInt aErrorCode); - - /** - * See @ref MGlxtnThumbnailCreatorClient::FilterAvailableComplete - */ - void FilterAvailableComplete(const RArray& aIdArray, TInt aErrorCode); - - /** - * See @ref MGlxtnThumbnailCreatorClient::FetchFileInfoL - */ - void FetchFileInfoL(CGlxtnFileInfo* aInfo, const TGlxMediaId& aItemId, - TRequestStatus* aStatus); - - /** - * See @ref MGlxtnThumbnailCreatorClient::CancelFetchUri - */ - void CancelFetchUri(const TGlxMediaId& aItemId); - - /** - * See @ref MGlxtnThumbnailCreatorClient::ThumbnailStorage - */ - MGlxtnThumbnailStorage* ThumbnailStorage(); - - void HandleThumbnailFetchCompleteL(const TGlxMediaId& aId, - TGlxThumbnailQuality aQuality); - - void DoHandleContainerFirstItemQueryCompletedL(); - - void CompleteFetchFileInfoL(CMdEObject* aItem); - -private: - void CompleteThumbnailRequest(TInt aError); - -private: - CGlxtnFileInfo* iTnFileInfo; - - TRequestStatus* iTnRequestStatus; - - TBool iTnRequestInProgress; - }; - -#endif // GLXDATASOURCETASKMDETHUMBNAIL_H_ diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcemde.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcemde.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,661 +0,0 @@ -/* -* Copyright (c) 2006 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: -* -*/ - - - -/** - * @internal reviewed 11/07/2007 by M Byrne - */ - - -// INCLUDE FILES -#include "glxdatasourcemde.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "glxdatasourcetaskmde.h" -#include "glxdatasourcetaskmdeattribute.h" -#include "glxdatasourcetaskmdecommand.h" -#include "glxdatasourcetaskmdeidlist.h" -#include "glxdatasourcetaskmdethumbnail.h" - -_LIT(KGlxMdeDataSourceThumbnailDatabase, "glxmdstn"); - -_LIT(KObjectDefLocation, "Location"); -_LIT(KObjectDefNameAlbum, "Album"); -_LIT(KObjectDefNameImage, "Image"); -_LIT(KObjectDefNameMedia, "MediaObject"); -_LIT(KObjectDefNameObject, "Object"); -_LIT(KObjectDefNameTag, "Tag"); -_LIT(KObjectDefNameVideo, "Video"); -_LIT(KPropertyDefNameCreationDate, "CreationDate"); -_LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); -_LIT(KPropertyDefNameSize, "Size"); -_LIT(KPropertyDefNameTitle, "Title"); -_LIT(KRelationDefNameContains, "Contains"); - -_LIT(KObjectDefNameMonth, "MediaObject");/// @todo nasty hack remove and use base object - -_LIT(KGlxMdeCameraAlbumUri, "Camera album"); -_LIT(KGlxMdeFavoritesUri, "Favorites"); - -#undef __USING_INTELLIGENT_UPDATE_FILTERING - -// ============================ MEMBER FUNCTIONS ============================== - -CGlxDataSourceMde* CGlxDataSourceMde::NewL() - { - GLX_LOG_ENTRY_EXIT("CGlxDataSourceMde* CGlxDataSourceMde::NewL()"); - CGlxDataSourceMde* ds = new (ELeave) CGlxDataSourceMde(); - CleanupStack::PushL(ds); - ds->ConstructL(); - CleanupStack::Pop(ds); - return ds; - } - -CGlxDataSourceMde::~CGlxDataSourceMde() - { - GLX_LOG_ENTRY_EXIT("CGlxDataSourceMde::~CGlxDataSourceMde()"); - delete iSession; - if (iThumbnailCreator) - { - iThumbnailCreator->Close(iThumbnailDatabase); - } - delete iThumbnailDatabase; - iFs.Close(); - RFbsSession::Disconnect(); - iMonthArray.Close(); - iMonthList.Close(); - iUpdateData.Close(); - delete iUpdateCallback; - delete iCreateSessionCallback; - } - -CGlxDataSourceMde::CGlxDataSourceMde() - { - GLX_LOG_ENTRY_EXIT("CGlxDataSourceMde::CGlxDataSourceMde()"); - } - -void CGlxDataSourceMde::ConstructL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::ConstructL()"); - iDataSourceReady = EFalse; - User::LeaveIfError(iFs.Connect()); - iSession = CMdESession::NewL( *this ); - - User::LeaveIfError(RFbsSession::Connect()); - iThumbnailCreator = CGlxtnThumbnailCreator::InstanceL(); - iThumbnailDatabase = CGlxtnThumbnailDatabase::NewL( - KGlxMdeDataSourceThumbnailDatabase, this); - iCreateSessionCallback = new ( ELeave ) - CAsyncCallBack( TCallBack( CreateSession, this ), CActive::EPriorityHigh ); - iUpdateCallback = new ( ELeave ) - CAsyncCallBack( TCallBack( ProcessItemUpdate, this ), CActive::EPriorityLow ); - iUpdateData.Reserve(100); // ignore if it fails - } - -// ---------------------------------------------------------------------------- -// from MMdESessionObserver -// CMPXCollectionMdEPlugin::HandleSessionOpened -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceMde::HandleSessionOpened( CMdESession& aSession, TInt aError ) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleSessionOpened(CMdESession& aSession, TInt aError)"); - if( KErrNone != aError ) - { - HandleSessionError(aSession, aError); - } - TRAPD(err, DoSessionInitL()); - if( KErrNone != err ) - { - HandleSessionError(aSession, err); - } - - iSessionOpen = ETrue; - iDataSourceReady = ETrue; - TryStartTask(ETrue); - } - -// ---------------------------------------------------------------------------- -// from MMdESessionObserver -// CMPXCollectionMdEPlugin::HandleSessionError -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceMde::HandleSessionError(CMdESession& /*aSession*/, TInt /*aError*/ ) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleSessionError(CMdESession& /*aSession*/, TInt /*aError*/)"); - iSession = NULL; - iDataSourceReady = EFalse; - iSessionOpen = EFalse; - iCreateSessionCallback->CallBack(); - } - - -CGlxDataSourceTask* CGlxDataSourceMde::CreateTaskL(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver) - { - GLX_LOG_ENTRY_EXIT("CGlxDataSourceTask* CGlxDataSourceMde::CreateTaskL(CGlxRequest* aRequest, MGlxDataSourceRequestObserver& aObserver)"); - if(dynamic_cast(aRequest)) - { - CleanupStack::PushL(aRequest); - CGlxDataSourceTaskMdeCommand* task = new (ELeave) CGlxDataSourceTaskMdeCommand(static_cast(aRequest), aObserver, this); - CleanupStack::Pop(aRequest); // now owned by task - CleanupStack::PushL(task); - task->ConstructL(); - CleanupStack::Pop(task); - return task; - } - else if (dynamic_cast< CGlxGetRequest *>(aRequest)) - { - CleanupStack::PushL(aRequest); - CGlxDataSourceTaskMdeAttribute* task = new (ELeave) CGlxDataSourceTaskMdeAttribute(static_cast(aRequest), aObserver, this); - CleanupStack::Pop(aRequest); // now owned by task - CleanupStack::PushL(task); - task->ConstructL(); - CleanupStack::Pop(task); - return task; - } - else if (dynamic_cast< CGlxIdListRequest *>(aRequest)) - { - CleanupStack::PushL(aRequest); - CGlxDataSourceTaskMdeIdList* task = new (ELeave) CGlxDataSourceTaskMdeIdList(static_cast(aRequest), aObserver, this); - CleanupStack::Pop(aRequest); // now owned by task - CleanupStack::PushL(task); - task->ConstructL(); - CleanupStack::Pop(task); - return task; - } - else if (dynamic_cast< CGlxThumbnailRequest *>(aRequest)) - { - CleanupStack::PushL(aRequest); - CGlxDataSourceTaskMdeThumbnail* task = new (ELeave) CGlxDataSourceTaskMdeThumbnail(static_cast(aRequest), aObserver, this); - CleanupStack::Pop(aRequest); // now owned by task - CleanupStack::PushL(task); - task->ConstructL(); - CleanupStack::Pop(task); - return task; - } - else - { - User::Leave(KErrNotSupported); - return NULL; // stops compiler warning - } - } - -void CGlxDataSourceMde::ThumbnailAvailable(const TGlxMediaId& /*aId*/, const TSize& /*aSize*/) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::ThumbnailAvailable()"); - // no implementation - } - -void CGlxDataSourceMde::BackgroundThumbnailError(const TGlxMediaId& aId, TInt aError) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::BackgroundThumbnailError()"); - TSize size(0, 0); - TRAP_IGNORE(BackgroundThumbnailMessageL(aId, size, aError)); - } - -void CGlxDataSourceMde::BackgroundThumbnailMessageL(const TGlxMediaId& aId, const TSize& aSize, TInt aError) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::BackgroundThumbnailMessageL()"); - CMPXMessage* message = CMPXMessage::NewL(); - CleanupStack::PushL(message); - message->SetTObjectValueL(KMPXMessageGeneralId, KGlxMessageIdBackgroundThumbnail); - message->SetTObjectValueL(KGlxBackgroundThumbnailMediaId, aId.Value()); - message->SetTObjectValueL(KGlxBackgroundThumbnailSize, aSize); - message->SetTObjectValueL(KGlxBackgroundThumbnailError, aError); - BroadcastMessage(*message); - CleanupStack::PopAndDestroy(message); - } - -void CGlxDataSourceMde::DoSessionInitL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::DoSessionInitL()"); - /// @todo check schema version number - iNameSpaceDef = iSession->GetDefaultNamespaceDefL(); - if ( !iNameSpaceDef ) - { - User::Leave(KErrCorrupt); - } - - CMdEObject* cameraAlbum = iSession->GetObjectL(KGlxMdeCameraAlbumUri); - if ( !cameraAlbum ) - { - User::Leave(KErrCorrupt); - } - iCameraAlbumId = (TGlxMediaId)cameraAlbum->Id(); - delete cameraAlbum; - - CMdEObject* favorites = iSession->GetObjectL(KGlxMdeFavoritesUri); - if ( !favorites ) - { - User::Leave(KErrCorrupt); - } - iFavoritesId = (TGlxMediaId)favorites->Id(); - delete favorites; - - iContainsDef = iNameSpaceDef->GetRelationDefL(KRelationDefNameContains); - - iObjectDef = iNameSpaceDef->GetObjectDefL(KObjectDefNameObject); - iImageDef = iNameSpaceDef->GetObjectDefL(KObjectDefNameImage); - iVideoDef = iNameSpaceDef->GetObjectDefL(KObjectDefNameVideo); - iMediaDef = iNameSpaceDef->GetObjectDefL(KObjectDefNameMedia); - iAlbumDef = iNameSpaceDef->GetObjectDefL(KObjectDefNameAlbum); - iTagDef = iNameSpaceDef->GetObjectDefL(KObjectDefNameTag); - iMonthDef = iNameSpaceDef->GetObjectDefL(KObjectDefNameMonth); - iLocationDef = iNameSpaceDef->GetObjectDefL(KObjectDefLocation); - - AddMdEObserversL(); - - PrepareMonthsL(); - } - -void CGlxDataSourceMde::AddMdEObserversL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::AddMdEObserversL()"); - iSession->AddRelationObserverL(*this); - iSession->AddRelationPresentObserverL(*this); - - iSession->AddObjectObserverL(*this); - iSession->AddObjectPresentObserverL(*this); - } - -void CGlxDataSourceMde::HandleObjectAdded(CMdESession& /*aSession*/, const RArray& aObjectIdArray) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleObjectAdded()"); - ProcessUpdateArray(aObjectIdArray, EMPXItemInserted, ETrue); - } - -void CGlxDataSourceMde::HandleObjectModified(CMdESession& /*aSession*/, const RArray& aObjectIdArray) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleObjectModified()"); - ProcessUpdateArray(aObjectIdArray, EMPXItemModified, ETrue); - } - -void CGlxDataSourceMde::HandleObjectRemoved(CMdESession& /*aSession*/, const RArray& aObjectIdArray) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleObjectRemoved()"); - ProcessUpdateArray(aObjectIdArray, EMPXItemDeleted, ETrue); - } - -void CGlxDataSourceMde::HandleObjectPresent(CMdESession& /*aSession*/, const RArray& aObjectIdArray) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleObjectPresent()"); - ProcessUpdateArray(aObjectIdArray, EMPXItemInserted, ETrue); - } -void CGlxDataSourceMde::HandleObjectNotPresent(CMdESession& /*aSession*/, const RArray& aObjectIdArray) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleObjectNotPresent()"); - ProcessUpdateArray(aObjectIdArray, EMPXItemDeleted, ETrue); - } -void CGlxDataSourceMde::HandleRelationAdded(CMdESession& /*aSession*/, const RArray& aRelationIdArray) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleRelationAdded()"); - ProcessUpdateArray(aRelationIdArray, EMPXItemInserted, EFalse); - } -void CGlxDataSourceMde::HandleRelationRemoved(CMdESession& /*aSession*/, const RArray& aRelationIdArray) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleRelationRemoved()"); - ProcessUpdateArray(aRelationIdArray, EMPXItemDeleted, EFalse); - } -void CGlxDataSourceMde::HandleRelationModified(CMdESession& /*aSession*/, const RArray& /*aRelationIdArray*/) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleRelationModified()"); - // not used until ordinals are required - } -void CGlxDataSourceMde::HandleRelationPresent(CMdESession& /*aSession*/, const RArray& aRelationIdArray) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleRelationPresent()"); - ProcessUpdateArray(aRelationIdArray, EMPXItemInserted, EFalse); - } -void CGlxDataSourceMde::HandleRelationNotPresent(CMdESession& /*aSession*/, const RArray& aRelationIdArray) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::HandleRelationNotPresent()"); - ProcessUpdateArray(aRelationIdArray, EMPXItemDeleted, EFalse); - } -void CGlxDataSourceMde::ProcessUpdateArray(const RArray& aArray, TMPXChangeEventType aType, TBool aIsObject) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::ProcessUpdateArray()"); - // only need one message so process first item - TUpdateData update; - update.iId = aArray[0]; - update.iType = aType; - update.iIsObject = aIsObject; - if( iUpdateData.Count() ) - { - if( ( iUpdateData[0].iType == aType ) && ( iUpdateData[0].iIsObject ) ) - { - return; - } - } - if( iUpdateData.Append(update) == KErrNone ) // if we can't allocate space for the update, ignore it - { - iUpdateCallback->CallBack(); - } - } -TInt CGlxDataSourceMde::CreateSession(TAny* aPtr) - { - GLX_LOG_ENTRY_EXIT("TInt CGlxDataSourceMde::CreateSession(TAny* aPtr)"); - CGlxDataSourceMde* self - = reinterpret_cast( aPtr ); - TRAP_IGNORE(self->CreateSessionL()); - return 0; - } - -void CGlxDataSourceMde::CreateSessionL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::CreateSessionL()"); - iSession = CMdESession::NewL( *this ); - } - - -TInt CGlxDataSourceMde::ProcessItemUpdate(TAny* aPtr) - { - GLX_LOG_ENTRY_EXIT("TInt CGlxDataSourceMde::ProcessItemUpdate(TAny* aPtr)"); - CGlxDataSourceMde* self - = reinterpret_cast( aPtr ); - TRAP_IGNORE(self->ProcessItemUpdateL()); - return 0; - } - -void CGlxDataSourceMde::ProcessItemUpdateL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::ProcessItemUpdateL()"); - if ( !iUpdateData.Count() || iPauseUpdate ) - { - return; - } - - CMPXMessage* message = CMPXMessage::NewL(); - CleanupStack::PushL(message); - message->SetTObjectValueL(KMPXMessageGeneralId, KMPXMessageIdItemChanged); - message->SetTObjectValueL(KMPXMessageChangeEventType, iUpdateData[0].iType); - TMPXGeneralCategory category = EMPXNoCategory; - TMPXItemId id = iUpdateData[0].iId; - - GLX_LOG_INFO2("CGlxDataSourceMde::ProcessItemUpdateL() cat%d, item id %d", category, id.iId1); -#ifdef __USING_INTELLIGENT_UPDATE_FILTERING - if ( !iUpdateData[0].iIsObject ) - { - TMPXGeneralCategory containerCategory = EMPXNoCategory; - TMPXItemId containerId; - - CMdERelation* relation = iSession->GetRelationL(id); - if( relation ) - { - TItemId rightId = relation->RightObjectId(); - TItemId leftId = relation->LeftObjectId(); - delete relation; - - CMdEObject* contObject = iSession->GetObjectL(leftId); - __ASSERT_DEBUG(contObject, Panic(EGlxPanicIllegalState)); - TContainerType container = ContainerType(contObject); - delete contObject; - __ASSERT_DEBUG(( EContainerTypeTag != container), Panic(EGlxPanicIllegalState)); - if( EContainerTypeNotAContainer == container ) - { - CMdEObject* rightObject = iSession->GetObjectL(rightId); - __ASSERT_DEBUG(rightObject, Panic(EGlxPanicIllegalState)); - TContainerType rightContainer = ContainerType(rightObject); - delete rightObject; - __ASSERT_DEBUG(( EContainerTypeAlbum != rightContainer), Panic(EGlxPanicIllegalState)); - if( EContainerTypeTag == rightContainer ) - { - id = leftId; - containerId = rightId; - containerCategory = EMPXTag; - } - else if( EContainerTypeNotAContainer == rightContainer ) - { - User::Leave(KErrNotSupported); // Not a gallery relation. - } - } - else if( EContainerTypeAlbum == container) - { - id = rightId; - containerId = leftId; - containerCategory = EMPXAlbum; - } - message->SetTObjectValueL(KGlxCollectionMessageContainerCategory, containerCategory); - message->SetTObjectValueL(KGlxCollectionMessageContainerId, containerId); - } - else - { - // use id 0 to identify to ML that we don't know what was deleted - id = 0; - } - } - - if ( id != 0 ) - { - CMdEObject* object = iSession->GetObjectL(id); - if( object ) - { - TContainerType container = ContainerType(object); - if( EContainerTypeAlbum == container) - { - category = EMPXAlbum; - } - else if( EContainerTypeTag == container) - { - category = EMPXTag; - } - else - { - TItemType item = ItemType(object); - if( EItemTypeImage == item) - { - category = EMPXImage; - } - else if( EItemTypeVideo == item) - { - category = EMPXVideo; - } - } - delete object; - } - } -#endif // __USING_INTELLIGENT_UPDATE_FILTERING - message->SetTObjectValueL(KMPXMessageMediaGeneralCategory, category); - message->SetTObjectValueL(KMPXMessageMediaGeneralId, id); - BroadcastMessage(*message); - CleanupStack::PopAndDestroy(message); - iUpdateData.Remove(0); - } - -CGlxDataSource::TContainerType CGlxDataSourceMde::ContainerType(CMdEObject* aObject) - { - GLX_LOG_ENTRY_EXIT("TContainerType CGlxDataSourceMde::ContainerType()"); - TContainerType containerType = EContainerTypeNotAContainer; - - if( 0 == aObject->Def().Compare(*iAlbumDef) ) - { - containerType = EContainerTypeAlbum; - } - else if( 0 == aObject->Def().Compare(*iTagDef) ) - { - containerType = EContainerTypeTag; - } - else if( 0 == aObject->Def().Compare(*iMonthDef) ) - { - containerType = EContainerTypeMonth; - } - - return containerType; - } - -CGlxDataSource::TContainerType CGlxDataSourceMde::ContainerType(CMdEObjectDef* aObjectDef) - { - GLX_LOG_ENTRY_EXIT("TContainerType CGlxDataSourceMde::ContainerType()"); - TContainerType containerType = EContainerTypeNotAContainer; - - if( 0 == aObjectDef->Compare(*iAlbumDef) ) - { - containerType = EContainerTypeAlbum; - } - else if( 0 == aObjectDef->Compare(*iTagDef) ) - { - containerType = EContainerTypeTag; - } - else if( 0 == aObjectDef->Compare(*iMonthDef) ) - { - containerType = EContainerTypeMonth; - } - - return containerType; - } -CGlxDataSource::TItemType CGlxDataSourceMde::ItemType(CMdEObject* aObject) - { - GLX_LOG_ENTRY_EXIT("TItemType CGlxDataSourceMde::ItemType()"); - TItemType itemType = EItemTypeNotAnItem; - - if( 0 == aObject->Def().Compare(*iImageDef) ) - { - itemType = EItemTypeImage; - } - else if(0 == aObject->Def().Compare(*iVideoDef) ) - { - itemType = EItemTypeVideo; - } - - return itemType; - } -void CGlxDataSourceMde::PrepareMonthsL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceMde::PrepareMonthsL()"); - TTime month(0); - iFirstMonth = month; - } -const TGlxMediaId CGlxDataSourceMde::GetMonthIdL(const TTime& aMonth) - { - GLX_LOG_ENTRY_EXIT("TGlxMediaId CGlxDataSourceMde::GetMonthIdL()"); - TTime monthStart = iFirstMonth + aMonth.MonthsFrom(iFirstMonth); - const TTimeIntervalMonths KGlxOneMonth = 1; - const TTimeIntervalMicroSeconds KGlxOneMicrosecond = 1; - - TGlxMediaId monthId; - TInt monthIndex = iMonthArray.Find(monthStart); - if( monthIndex != KErrNotFound ) - { - monthId = iMonthList[monthIndex]; - } - else - { - _LIT(KGlxMonthTitleFormat, "%F%Y%M%D:"); - const TInt KGlxMonthTitleLength = 12; - TBuf title; - monthStart.FormatL(title, KGlxMonthTitleFormat); - - CMdEObject* month = iSession->GetObjectL(title); - if( month ) - { - monthId = (TGlxMediaId)month->Id(); - iMonthArray.AppendL(monthStart); - iMonthList.AppendL(monthId); - delete month; - } - else - { - TTime monthEnd = monthStart + KGlxOneMonth - KGlxOneMicrosecond; - month = iSession->NewObjectLC(*iMonthDef, title); - - // A title property def of type text is required. - CMdEPropertyDef* titlePropertyDef = iObjectDef->GetPropertyDefL(KPropertyDefNameTitle); - if (!titlePropertyDef || titlePropertyDef->PropertyType() != EPropertyText) - { - User::Leave(KErrCorrupt); - } - // Set the object title. - month->AddTextPropertyL (*titlePropertyDef, title); - - // A size property is required. - CMdEPropertyDef* sizePropertyDef = iObjectDef->GetPropertyDefL(KPropertyDefNameSize); - if (!sizePropertyDef || sizePropertyDef->PropertyType() != EPropertyUint32) - { - User::Leave(KErrCorrupt); - } - month->AddUint32PropertyL(*sizePropertyDef,0); - - - // A creation date property is required. - CMdEPropertyDef* creationDateDef = iObjectDef->GetPropertyDefL(KPropertyDefNameCreationDate); - if (!creationDateDef || creationDateDef->PropertyType() != EPropertyTime) - { - User::Leave(KErrCorrupt); - } - month->AddTimePropertyL(*creationDateDef, monthStart); - - // A last modified date property is required. - CMdEPropertyDef* lmDateDef = iObjectDef->GetPropertyDefL(KPropertyDefNameLastModifiedDate); - if (!lmDateDef || lmDateDef->PropertyType() != EPropertyTime) - { - User::Leave(KErrCorrupt); - } - - month->AddTimePropertyL(*lmDateDef, monthEnd); - - monthId = (TGlxMediaId)iSession->AddObjectL(*month); - CleanupStack::PopAndDestroy(month); - iMonthArray.AppendL(monthStart); - iMonthList.AppendL(monthId); - } - } - return monthId; - } -TBool CGlxDataSourceMde::SameMonth(const TTime& aOldDate, const TTime& aNewDate) - { - GLX_LOG_ENTRY_EXIT("TBool CGlxDataSourceMde::SameMonth(const TTime& aOldDate, const TTime& aNewDate)"); - return ( aOldDate.MonthsFrom(iFirstMonth) == aNewDate.MonthsFrom(iFirstMonth) ); - } - -TBool CGlxDataSourceMde::ContainerIsLeft(CMdEObjectDef& aObjectDef) - { - GLX_LOG_ENTRY_EXIT("TBool CGlxDataSourceMde::ContainerIsLeft(CMdEObjectDef& aObjectDef)"); - TBool containerLeft = EFalse; - if ( 0 == aObjectDef.Compare(AlbumDef()) ) - { - containerLeft = ETrue; - } - return containerLeft; - } - -void CGlxDataSourceMde::TaskCompletedL() - { - iPauseUpdate = EFalse; - iUpdateCallback->CallBack(); - } - -void CGlxDataSourceMde::TaskStartedL() - { - iPauseUpdate = ETrue; - } - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcemdeproxy.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcemdeproxy.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2006 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: Standard proxy of the ECOM plugin -* -*/ - - - - -/** - * @internal reviewed 11/07/2007 by M Byrne - */ - -#include -#include "glxdatasourcemde.h" -#include "glxdatasourcemde.hrh" - -// ---------------------------------------------------------------------------- -// The list of implementations -// ---------------------------------------------------------------------------- -// -const TImplementationProxy ImplementationTable[] = - { IMPLEMENTATION_PROXY_ENTRY(KGlxDataSourceMdeImplementationUid, - CGlxDataSourceMde::NewL) }; - -// ---------------------------------------------------------------------------- -// The proxy of implementations -// ---------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - return ImplementationTable; - } - -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmde.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmde.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,663 +0,0 @@ -/* -* Copyright (c) 2006 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: -* -*/ - - - -/** - * @internal reviewed 11/07/2007 by M Byrne - * @internal reviewed 24/07/2007 by K Hoikka, SCO 403-8472 removal of all view - */ - - -#include "glxdatasourcetaskmde.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "glxdatasourcemde.h" -#include "glxdatasourcemde.hrh" - -// CONSTANTS -_LIT(KPropertyDefNameCreationDate, "CreationDate"); -_LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); -_LIT(KPropertyDefNameTitle, "Title"); -_LIT(KPropertyDefNameDRM, "DRM"); -_LIT(KPropertyDefNameUsageCount, "UsageCount"); -_LIT(KPropertyDefNameFrameCount, "FrameCount"); -_LIT(KPropertyDefNameOrigin, "Origin"); - -// ---------------------------------------------------------------------------- -// Constructor -// ---------------------------------------------------------------------------- -// -CGlxDataSourceTaskMde:: CGlxDataSourceTaskMde(CGlxRequest* aRequest, - MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) - : CGlxDataSourceTask(aRequest, aObserver, aDataSource) - { - GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMde::CGlxDataSourceTaskMde()"); - // No implementation required - } - -// ---------------------------------------------------------------------------- -// Destructor -// ---------------------------------------------------------------------------- -// -CGlxDataSourceTaskMde::~CGlxDataSourceTaskMde() - { - GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMde::~CGlxDataSourceTaskMde()"); - DestroyQueries(); - } - -// ---------------------------------------------------------------------------- -// Second stage constructor -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::ConstructL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::ConstructL()"); - CreateResponseL(); - DataSource()->ThumbnailCreator().CancelRequest( TGlxMediaId(0) ); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::CancelRequest -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::CancelRequest() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::CancelRequest()"); - DestroyQueries(); - iCancelled = ETrue; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::HandleQueryNewResults -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::HandleQueryNewResults( CMdEQuery& /*aQuery*/, - TInt /*aFirstNewItemIndex*/, - TInt /*aNewItemCount*/ ) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::HandleQueryNewResults()"); - // Not used. - } - - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::HandleQueryNewResults -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::HandleQueryNewResults( CMdEQuery& /*aQuery*/, - TInt /*aNewObjectItemCount*/, - TInt /*aNewRelationItemCount*/, - TInt /*aNewEventItemCount*/) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::HandleQueryNewResults()"); - // Not used. - } - - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::HandleQueryCompleted -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::HandleQueryCompleted(CMdEQuery& aQuery, TInt aError) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::HandleQueryCompleted()"); - __ASSERT_ALWAYS(&aQuery == iQueries[0], Panic(EGlxPanicQueryLogicError)); - - TInt err = aError; - if (err == KErrNone) - { - TRAP(err, HandleQueryCompletedL(aQuery)); - } - - if (err != KErrNone) - { - HandleRequestComplete(err); - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::DataSource -// ---------------------------------------------------------------------------- -// -CGlxDataSourceMde* CGlxDataSourceTaskMde::DataSource() - { - GLX_LOG_ENTRY_EXIT("CGlxDataSourceMde* CGlxDataSourceTaskMde::DataSource()"); - return static_cast(iDataSource); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::AddMonthFilterL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::AddMonthFilterL(const TGlxMediaId& aContainerId, TGlxFilterProperties& aFilterProperties) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::AddMonthFilterL()"); - CMdEObject* month = DataSource()->Session().GetObjectL(aContainerId.Value()); - if( !month ) - { - User::Leave(KErrNotFound); - } - CleanupStack::PushL(month); - - AddMonthFilterL(month, aFilterProperties); - - CleanupStack::PopAndDestroy(month); - } - - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::AddMonthFilterL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::AddMonthFilterL(CMdEObject* aMonth, TGlxFilterProperties& aFilterProperties) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::AddMonthFilterL()"); - CMdEPropertyDef* creationDateDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameCreationDate); - if (!creationDateDef || creationDateDef->PropertyType() != EPropertyTime) - { - User::Leave(KErrCorrupt); - } - - CMdEPropertyDef* lmDateDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameLastModifiedDate); - if (!lmDateDef || lmDateDef->PropertyType() != EPropertyTime) - { - User::Leave(KErrCorrupt); - } - - CMdEProperty* startDate; - TInt startDateIndex = aMonth->Property(*creationDateDef, startDate); - if( KErrNotFound == startDateIndex) - { - User::Leave(KErrCorrupt); - } - aFilterProperties.iStartDate = static_cast(startDate)->Value(); - - CMdEProperty* endDate; - TInt endDateIndex = aMonth->Property(*lmDateDef, endDate); - if( KErrNotFound == endDateIndex) - { - User::Leave(KErrCorrupt); - } - aFilterProperties.iEndDate = static_cast(endDate)->Value(); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::SetQueryConditionsL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::SetQueryConditionsL(CMdEQuery& aQuery, const TGlxFilterProperties& aFilterProperties, const TGlxMediaId aContainerId, CMdEObjectDef& aObjectDef) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::SetQueryConditionsL()"); - CMdELogicCondition& rootCondition = aQuery.Conditions(); - CMdEObjectDef* objectDef = &aObjectDef; - - SetQueryFilterConditionsL(rootCondition, *objectDef, aFilterProperties); - SetSortOrderL(aQuery, aObjectDef, aFilterProperties); - - if( KGlxCollectionRootId != aContainerId.Value() ) - { - CMdELogicCondition* containerCondition = NULL; - CMdERelationCondition* relationCondition = NULL; - objectDef = &DataSource()->ObjectDef(); - if( DataSource()->ContainerIsLeft(aObjectDef) ) - { - relationCondition = &rootCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideRight); - containerCondition = &relationCondition->LeftL(); - } - else - { - relationCondition = &rootCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideLeft); - containerCondition = &relationCondition->RightL(); - } - containerCondition->AddObjectConditionL(aContainerId.Value()); - } - - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::SetQueryFilterConditionsL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::SetQueryFilterConditionsL(CMdELogicCondition& - aLogicCondition, CMdEObjectDef& aObjectDef, - const TGlxFilterProperties& aFilterProperties) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::SetQueryFilterConditionsL()"); - - if( aFilterProperties.iUri ) - { - aLogicCondition.AddObjectConditionL(EObjectConditionCompareUri, - *aFilterProperties.iUri); - } - - if( 0 == aObjectDef.Compare(DataSource()->ObjectDef()) ) - { - // Filter on content type - if ( EGlxFilterVideoAndImages == aFilterProperties.iItemType ) - { - CMdELogicCondition& logicCondition = - aLogicCondition.AddLogicConditionL(ELogicConditionOperatorOr); - logicCondition.AddObjectConditionL( DataSource()->ImageDef() ); - logicCondition.AddObjectConditionL( DataSource()->VideoDef() ); - } - } - - if( ( aFilterProperties.iMinCount > 0 ) && ( CGlxDataSource::EContainerTypeNotAContainer != DataSource()->ContainerType(&aObjectDef) ) ) - { - CMdEPropertyDef* itemCountProperty = - aObjectDef.GetPropertyDefL(KPropertyDefNameUsageCount); - aLogicCondition.AddPropertyConditionL(*itemCountProperty, - TMdEIntGreaterEqual(aFilterProperties.iMinCount)); - } - - if( 0 != aFilterProperties.iContainsItem.Value() ) - { - - if( DataSource()->ContainerIsLeft(aObjectDef) ) - { - CMdERelationCondition& relationCondition = - aLogicCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideLeft); - relationCondition.RightL().AddObjectConditionL(aFilterProperties.iContainsItem.Value()); - } - else - { - CMdERelationCondition& relationCondition = aLogicCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideRight); - relationCondition.LeftL().AddObjectConditionL(aFilterProperties.iContainsItem.Value()); - } - } - - if( EGlxFilterOriginNotUsed != aFilterProperties.iOrigin ) - { - CMdEPropertyDef* originProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameOrigin); - if(originProperty) - { - if( EGlxFilterOriginDownload == aFilterProperties.iOrigin ) - { -#ifdef GLX_NO_ALL_VIEW - // The download collection shows all but captured items - aLogicCondition.AddPropertyConditionL(*originProperty, TMdEUintNotEqual(MdeConstants::Object::ECamera)); -#else - // The download collection shows only downloaded items - aLogicCondition.AddPropertyConditionL(*originProperty, TMdEUintEqual(MdeConstants::Object::EDownloaded)); -#endif - } - } - } - - if( aFilterProperties.iExcludeAnimation ) - { - //__ASSERT_DEBUG((EGlxFilterImage == aFilterProperties.iItemType), Panic(EGlxPanicIllegalArgument)); - // Exclude any image with a frame count > 1 - const TInt excludeAllImagesAboveOrEqualToThisFrameCount = 2; - CMdEPropertyDef* frameCountProperty = DataSource()->ImageDef().GetPropertyDefL(KPropertyDefNameFrameCount); - if( frameCountProperty ) - { - aLogicCondition.AddPropertyConditionL(*frameCountProperty, TMdEIntLess(excludeAllImagesAboveOrEqualToThisFrameCount)); - } - } - - if( aFilterProperties.iNoDRM ) - { - __ASSERT_DEBUG((EGlxFilterImage == aFilterProperties.iItemType), Panic(EGlxPanicIllegalArgument)); - // Exclude any image which is DRM protected - CMdEPropertyDef* drmProperty = DataSource()->ImageDef().GetPropertyDefL(KPropertyDefNameDRM); - if( drmProperty ) - { - aLogicCondition.AddPropertyConditionL(*drmProperty, EFalse); - } - } - - if( aFilterProperties.iPath ) // If this is set. Then we need to filter on the Ids it supplies - { - TArray selection = aFilterProperties.iPath->Selection(); - TInt selectionCount = selection.Count(); - RArray itemList; - CleanupClosePushL(itemList); - GLX_DEBUG2("Reading Ids from Path, count = %d", selectionCount); - if( selectionCount ) - { - for( TInt i = 0; i < selectionCount; i++ ) - { - const TMPXItemId& itemId = aFilterProperties.iPath->IdOfIndex(selection[i]); - itemList.AppendL(itemId); - } - aLogicCondition.AddObjectConditionL(itemList); - } - CleanupStack::Pop(&itemList); - } - - if( !aFilterProperties.iIncludeCameraAlbum ) - { - CMdEObjectCondition& objectCondition = aLogicCondition.AddObjectConditionL(DataSource()->CameraAlbumId().Value()); - objectCondition.SetNegate(ETrue); - } - - if( TTime(0) != aFilterProperties.iStartDate ) - { - CMdEPropertyDef* creationDateDef = aObjectDef.GetPropertyDefL(KPropertyDefNameCreationDate); - if (!creationDateDef || creationDateDef->PropertyType() != EPropertyTime) - { - User::Leave(KErrCorrupt); - } - - aLogicCondition.AddPropertyConditionL(*creationDateDef, TMdETimeBetween(aFilterProperties.iStartDate, aFilterProperties.iEndDate)); - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::SetSortOrderL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::SetSortOrderL(CMdEQuery& aQuery, CMdEObjectDef& aObjectDef, - const TGlxFilterProperties& aFilterProperties) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::SetSortOrderL()"); - switch(aFilterProperties.iSortOrder) - { - case EGlxFilterSortOrderAlphabetical: - { - CMdEPropertyDef* titleProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameTitle); - TMdEOrderRule orderRule(*titleProperty, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); - orderRule.SetType(EOrderRuleTypeProperty); - orderRule.SetCaseSensitive(EFalse); - aQuery.AppendOrderRuleL(orderRule); - break; - } - case EGlxFilterSortOrderItemCount: - { - CMdEPropertyDef* itemCountProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameUsageCount); - TMdEOrderRule orderRule(*itemCountProperty, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); - orderRule.SetType(EOrderRuleTypeProperty); - aQuery.AppendOrderRuleL(orderRule); - break; - } - case EGlxFilterSortOrderCaptureDate: - { - CMdEPropertyDef* creationDateProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameCreationDate); - TMdEOrderRule orderRule(*creationDateProperty, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); - orderRule.SetType(EOrderRuleTypeProperty); - aQuery.AppendOrderRuleL(orderRule); - TMdEOrderRule orderRule2(EOrderRuleTypeItemID, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); - aQuery.AppendOrderRuleL(orderRule2); - break; - } - case EGlxFilterSortOrderModifiedDate: - { - CMdEPropertyDef* modifiedDateProperty = aObjectDef.GetPropertyDefL(KPropertyDefNameLastModifiedDate); - TMdEOrderRule orderRule(*modifiedDateProperty, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); - orderRule.SetType(EOrderRuleTypeProperty); - aQuery.AppendOrderRuleL(orderRule); - TMdEOrderRule orderRule2(EOrderRuleTypeItemID, aFilterProperties.iSortDirection == EGlxFilterSortDirectionAscending); - aQuery.AppendOrderRuleL(orderRule2); - break; - } - case EGlxFilterSortOrderNotUsed: - { - break; - } - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::MaxQueryResultsCount -// ---------------------------------------------------------------------------- -// -TInt CGlxDataSourceTaskMde::MaxQueryResultsCount(const TGlxFilterProperties& aFilterProperties) const - { - GLX_LOG_ENTRY_EXIT("TInt CGlxDataSourceTaskMde::MaxQueryResultsCount()"); - TInt ret = KMdEQueryDefaultMaxCount; - if (aFilterProperties.iLastCaptureDate) - { - ret = 1; - } - return ret; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::RemoveQuery -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::RemoveQuery() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::RemoveQuery()"); - CMdEQuery* query = iQueries[0]; - iQueryTypes.Remove(0); - iQueries.Remove(0); - query->RemoveObserver(*this); - delete query; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::DoQueryL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::DoQueryL(CMdEObjectDef& aObjectDef, - TBool aIsContent, TGlxQueryType aQueryType, TQueryResultMode aResultMode, - const TGlxMediaId& aContainerId) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::DoQueryL()"); - - CMdEObjectDef* queryBaseObject = &aObjectDef; - if( aIsContent ) - { - switch(iFilterProperties.iItemType) - { - case EGlxFilterImage: - { - queryBaseObject = &DataSource()->ImageDef(); - break; - } - case EGlxFilterVideo: - { - queryBaseObject = &DataSource()->VideoDef(); - break; - } - default: - { - queryBaseObject = &DataSource()->ObjectDef(); - break; - } - } - } - - CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), *queryBaseObject, this); - CleanupStack::PushL(query); - - SetQueryConditionsL(*query, iFilterProperties, aContainerId, aObjectDef); - query->SetResultMode(aResultMode); - - CleanupStack::Pop(query); - - AppendQueryL(query, aQueryType); - - query->FindL(MaxQueryResultsCount(iFilterProperties)); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTask::QueueImageVideoObjectQueriesL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::QueueImageVideoObjectQueriesL(const RArray& aObjectIds, - const TGlxFilterProperties& aFilterProperties) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::QueueImageVideoObjectQueriesL()"); - if (aFilterProperties.iItemType == EGlxFilterImage) - { - // Only perform the image query - QueueObjectQueryL(DataSource()->ImageDef(), aObjectIds, EImageVideoQuery); - } - else if (aFilterProperties.iItemType == EGlxFilterVideo) - { - // Only perform the video query - QueueObjectQueryL(DataSource()->VideoDef(), aObjectIds, EImageVideoQuery); - } - else - { - QueueObjectQueryL(DataSource()->ImageDef(), aObjectIds, EImageVideoQuery); - QueueObjectQueryL(DataSource()->VideoDef(), aObjectIds, EImageVideoQuery); - // Perform both the image and video queries - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTask::QueueTagObjectQueryL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::QueueTagObjectQueryL(const RArray& aObjectIds) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::QueueTagObjectQueryL()"); - QueueObjectQueryL(DataSource()->TagDef(), aObjectIds, EImageVideoQuery); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTask::QueueAlbumObjectQueryL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::QueueAlbumObjectQueryL(const RArray& aObjectIds) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::QueueAlbumObjectQueryL()"); - QueueObjectQueryL(DataSource()->AlbumDef(), aObjectIds, EImageVideoQuery); - } - - -void CGlxDataSourceTaskMde::QueueMonthObjectQueryL(const RArray& aObjectIds) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::QueueMonthObjectQueryL()"); - QueueObjectQueryL(DataSource()->MonthDef(), aObjectIds, EImageVideoQuery); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTask::QueueObjectQueryL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::QueueObjectQueryL(CMdEObjectDef& aObjectDef, - const RArray& aObjectIds, const TGlxQueryType& aQueryType) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::QueueObjectQueryL()"); - CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), aObjectDef, this); - CleanupStack::PushL(query); - - CMdELogicCondition& lc = query->Conditions(); - lc.AddObjectConditionL(aObjectIds); - - query->SetResultMode(EQueryResultModeObjectWithoutFreetexts); - - CleanupStack::Pop(query); - AppendQueryL(query, aQueryType); - - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::AppendQueryL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::AppendQueryL(CMdEQuery* aQuery, const TGlxQueryType& aQueryType) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::AppendQueryL()"); - CleanupStack::PushL(aQuery); - - TInt err = iQueryTypes.Append(aQueryType); - - if (KErrNone == err) - { - iQueries.AppendL(aQuery); - CleanupStack::Pop(aQuery); - } - else - { - User::Leave(err); - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::ExecuteQueryL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::ExecuteQueryL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::ExecuteQueryL()"); - __ASSERT_DEBUG(iQueries.Count(), Panic(EGlxPanicQueryLogicError)); - iQueries[0]->FindL(); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::HandleQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::HandleQueryCompletedL(CMdEQuery& aQuery) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::HandleQueryCompletedL()"); - DoHandleQueryCompletedL(aQuery); - RemoveQuery(); - DoNextQueryL(); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::DestroyQueries -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMde::DestroyQueries() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMde::DestroyQueries()"); - for (TInt i = 0; i < iQueries.Count(); i++) - { - // Ensure that there are not any running queries - iQueries[i]->RemoveObserver(*this); - iQueries[i]->Cancel(); - } - iQueries.ResetAndDestroy(); - iQueryTypes.Close(); - } - - - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdeattribute.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdeattribute.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1277 +0,0 @@ -/* -* Copyright (c) 2006 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 "glxdatasourcetaskmdeattribute.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "glxdatasourcemde.h" -#include "glxdatasourcemde.h" -#include "glxdatasourcemde.hrh" - -// CONSTANTS - -_LIT(KPropertyDefNameAlbumType, "Type"); -_LIT(KPropertyDefNameComment, "Comment"); -_LIT(KPropertyDefNameCreationDate, "CreationDate"); -_LIT(KPropertyDefNameDRM, "DRM"); -_LIT(KPropertyDefNameDuration, "Duration"); -_LIT(KPropertyDefNameFrameCount, "FrameCount"); -_LIT(KPropertyDefNameHeight, "Height"); -_LIT(KPropertyDefNameItemType, "ItemType"); -_LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); -_LIT(KPropertyDefNameLatitude, "Latitude"); -_LIT(KPropertyDefNameLongitude, "Longitude"); -_LIT(KPropertyDefNameSize, "Size"); -_LIT(KPropertyDefNameTitle, "Title"); -_LIT(KPropertyDefNameUsageCount, "UsageCount"); -_LIT(KPropertyDefNameWidth, "Width"); - -// ---------------------------------------------------------------------------- -// Constructor -// ---------------------------------------------------------------------------- -// -CGlxDataSourceTaskMdeAttribute::CGlxDataSourceTaskMdeAttribute(CGlxGetRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) - : CGlxDataSourceTaskMde(aRequest, aObserver, aDataSource) - { - GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeAttribute::CGlxDataSourceTaskMdeAttribute()"); - iFilterProperties = TGlxFilterFactory::ExtractAttributes(iRequest->Filter()); - } - -// ---------------------------------------------------------------------------- -// Destructor -// ---------------------------------------------------------------------------- -// -CGlxDataSourceTaskMdeAttribute::~CGlxDataSourceTaskMdeAttribute() - { - GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeAttribute::~CGlxDataSourceTaskMdeAttribute()"); - delete iMediaArray; - iQueryAttributes.Close(); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeAttribute::ExecuteRequestL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeAttribute::ExecuteRequestL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::ExecuteRequestL()"); - CGlxGetRequest* request = static_cast(iRequest); - - __ASSERT_DEBUG(request->MediaIds().Count() > 0, User::Invariant()); - - if (request->MediaIds().Count() > 1) - { - iMediaArray = CMPXMediaArray::NewL(); - } - - if (request->MediaIds()[0] == KGlxCollectionRootId) - { - __ASSERT_DEBUG(request->MediaIds().Count() == 1, User::Invariant()); - AddCollectionAttributesL(iResponse); - } - else - { - - __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); - CGlxGetRequest* request = static_cast(iRequest); - - const RArray& mediaIds = reinterpret_cast&>(request->MediaIds()); - - switch(iFilterProperties.iItemType) - { - case EGlxFilterVideoAndImages: - case EGlxFilterImage: - case EGlxFilterVideo: - { - QueueImageVideoObjectQueriesL(mediaIds, iFilterProperties); - if (LocationAttributeRequested()) - { - QueueLocaitonQueryL(); - } - break; - } - case EGlxFilterAlbum: - { - QueueAlbumObjectQueryL(mediaIds); - break; - } - case EGlxFilterTag: - { - QueueTagObjectQueryL(mediaIds); - break; - } - case EGlxFilterMonth: - { - QueueMonthObjectQueryL(mediaIds); - break; - } - } - - } - - DoNextQueryL(); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::DoHandleQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeAttribute::DoHandleQueryCompletedL(CMdEQuery& /*aQuery*/) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::DoHandleQueryCompletedL()"); - switch (iQueryTypes[0]) - { - case ELocationAttributeQuery: - DoHandleLocationQueryCompletedL(); - break; - case EAttributeQuery: - DoHandleAttributeQueryCompletedL(); - break; - case EImageVideoQuery: - DoHandleImageVideoQueryCompletedL(); - break; - case EContainerFirstItemQuery: - // Fall through to panic, DoHandleQueryCompletedL can't handle this query type. - default: - Panic(EGlxPanicLogicError); - break; - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeAttribute::DoNextQueryL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeAttribute::DoNextQueryL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::DoNextQueryL()"); - if (iQueries.Count()) - { - ExecuteQueryL(); - } - else - { - DoHandleAttributeResponseCompleteL(); - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeAttribute::DoHandleAttributeResponseCompleteL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeAttribute::DoHandleAttributeResponseCompleteL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::DoHandleAttributeResponseCompleteL()"); - __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); - CGlxGetRequest* request = static_cast(iRequest); - if(request->MediaIds().Count() > 1) - { - iResponse->SetCObjectValueL(KMPXMediaArrayContents, iMediaArray); - iResponse->SetTObjectValueL(KMPXMediaArrayCount, iMediaArray->Count()); - delete iMediaArray; - iMediaArray = NULL; - } - HandleRequestComplete(KErrNone); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeAttribute::AddAttributesLC -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeAttribute::AddAttributesL(CMdEObject& aObject, CMPXMedia* aEntry) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::AddAttributesL(CMdEObject& aObject, CMPXMedia* aEntry)"); - __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); - - CGlxDataSource::TContainerType containerType = DataSource()->ContainerType(&aObject); - if( containerType != CGlxDataSource::EContainerTypeNotAContainer ) - { - AddContainerAttributesL(aEntry, &aObject, containerType); - } - else - { - CGlxDataSource::TItemType itemType = DataSource()->ItemType(&aObject); - if ( itemType != CGlxDataSource::EItemTypeNotAnItem ) - { - AddItemAttributesL(aEntry, &aObject, itemType); - } - else - { - User::Leave(KErrNotSupported); - } - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeAttribute::AddCollectionAttributesL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeAttribute::AddCollectionAttributesL(CMPXMedia* aEntry) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::AddCollectionAttributesL(CMPXMedia* aEntry)"); - __ASSERT_DEBUG(aEntry, Panic(EGlxPanicLogicError)); - __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); - CGlxGetRequest* request = static_cast(iRequest); - - for ( TInt i = 0; i < request->Attributes().Count(); i++ ) - { - if ( request->Attributes()[i] == KMPXMediaGeneralId ) - { - aEntry->SetTObjectValueL(KMPXMediaGeneralId, (TMPXItemId)request->CollectionPluginUid().iUid); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralType ) - { - aEntry->SetTObjectValueL(KMPXMediaGeneralType, EMPXNoType); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralCategory ) - { - aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXCollection); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralTitle ) - { - request->AppendCpiAttributeL(KMPXMediaGeneralTitle); - } - else if ( request->Attributes()[i] == KGlxMediaGeneralSystemItem ) - { - aEntry->SetTObjectValueL(KGlxMediaGeneralSystemItem, ETrue); - } - - - #ifdef GLX_SUB_TITLE_REL8 - - //Attributes to get the Count of Images in Container - else if ( request->Attributes()[i] == KGlxMediaItemTypeImage ) - { - TGlxMediaId container = TGlxMediaId(KGlxCollectionRootId); - CMdEObjectDef* objectDef = &DataSource()->ObjectDef(); - TBool isContent = ETrue; - TGlxFilterProperties filterProperties = iFilterProperties; - - switch(iRequest->CollectionPluginUid().iUid) - { - case KGlxCollectionPluginCameraImplementationUid: - { - container = DataSource()->CameraAlbumId(); - objectDef = &DataSource()->AlbumDef(); - filterProperties.iItemType = EGlxFilterImage; - QueueObjectQueryL(*objectDef, isContent, EAttributeQuery, EQueryResultModeCount, container, request->Attributes()[i], aEntry, filterProperties); - break; - } - default: - { - break; - } - } - } - - - //Attributes to get the Count of Videos in Container - else if ( request->Attributes()[i] == KGlxMediaItemTypeVideo ) - { - TGlxMediaId container = TGlxMediaId(KGlxCollectionRootId); - CMdEObjectDef* objectDef = &DataSource()->ObjectDef(); - TBool isContent = ETrue; - TGlxFilterProperties filterProperties = iFilterProperties; - - switch(iRequest->CollectionPluginUid().iUid) - { - case KGlxCollectionPluginCameraImplementationUid: - { - container = DataSource()->CameraAlbumId(); - objectDef = &DataSource()->AlbumDef(); - filterProperties.iItemType = EGlxFilterVideo; - QueueObjectQueryL(*objectDef, isContent, EAttributeQuery, EQueryResultModeCount, container, request->Attributes()[i], aEntry, filterProperties); - break; - } - default: - { - break; - } - } - } - -#endif - - - else if ( ( request->Attributes()[i] == KMPXMediaGeneralCount ) || ( request->Attributes()[i] == KGlxMediaCollectionInternalUsageCount ) ) - { - TGlxMediaId container = TGlxMediaId(KGlxCollectionRootId); - CMdEObjectDef* objectDef = &DataSource()->ObjectDef(); - TBool isContent = ETrue; - TGlxFilterProperties filterProperties = iFilterProperties; - - switch(iRequest->CollectionPluginUid().iUid) - { - - case KGlxCollectionPluginAlbumsImplementationUid: - { - isContent = EFalse; - objectDef = &DataSource()->AlbumDef(); - break; - } - case KGlxCollectionPluginCameraImplementationUid: - { - container = DataSource()->CameraAlbumId(); - objectDef = &DataSource()->AlbumDef(); - break; - } - case KGlxTagCollectionPluginImplementationUid: - { - isContent = EFalse; - objectDef = &DataSource()->TagDef(); - break; - } - case KGlxCollectionPluginMonthsImplementationUid: - { - container = DataSource()->CameraAlbumId(); - objectDef = &DataSource()->AlbumDef(); - break; - } - default: - { - // default gallery query returns all objects as per filter - break; - } - } - QueueObjectQueryL(*objectDef, isContent, EAttributeQuery, EQueryResultModeCount, container, request->Attributes()[i], aEntry, filterProperties); - } - else if ( request->Attributes()[i] == KMPXMediaColDetailSpaceId ) - { - aEntry->SetTObjectValueL(KMPXMediaColDetailSpaceId, KGlxDataSourceMdeImplementationUid); - } - else if ( request->Attributes()[i] == KGlxMediaCollectionInternalStartDate ) - { - TGlxFilterProperties filterProperties = iFilterProperties; - filterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; - filterProperties.iSortDirection = EGlxFilterSortDirectionAscending; - - QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, EQueryResultModeObjectWithoutFreetexts, DataSource()->CameraAlbumId(), KGlxMediaCollectionInternalStartDate, aEntry, filterProperties); - } - else if ( request->Attributes()[i] == KGlxMediaCollectionInternalEndDate ) - { - // not necessary to be requested, returned when StartDate requested - } - else if ( request->Attributes()[i] == KGlxMediaGeneralSlideshowableContent ) - { - aEntry->SetTObjectValueL(KGlxMediaGeneralSlideshowableContent, 0); - } - else if ( request->Attributes()[i] == KMPXMediaDrmProtected ) - { - // collection itself is not protected - aEntry->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); - } - else - { - User::Leave(KErrNotSupported); - } - } - } - - - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeAttribute::AddContainerAttributesL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeAttribute::AddContainerAttributesL(CMPXMedia* aEntry, CMdEObject* aContainer, CGlxDataSource::TContainerType aType) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::AddContainerAttributesL()"); - __ASSERT_DEBUG(aEntry, Panic(EGlxPanicLogicError)); - __ASSERT_DEBUG(aContainer, Panic(EGlxPanicLogicError)); - __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); - CGlxGetRequest* request = static_cast(iRequest); - - /// @todo check property defs are valid and type is correct - for ( TInt i = 0; i < request->Attributes().Count(); i++ ) - { - if ( request->Attributes()[i] == KMPXMediaGeneralId ) - { - aEntry->SetTObjectValueL(KMPXMediaGeneralId, (TMPXItemId)aContainer->Id()); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralType ) - { - aEntry->SetTObjectValueL(KMPXMediaGeneralType, EMPXGroup); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralCategory ) - { - if( CGlxDataSource::EContainerTypeAlbum == aType) - { - aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXAlbum); - } - else if( CGlxDataSource::EContainerTypeTag == aType) - { - aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXTag); - } - else if( CGlxDataSource::EContainerTypeMonth == aType) - { - aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXMonth); - } - else - { - User::Leave(KErrNotSupported); - } - } - else if ( request->Attributes()[i] == KMPXMediaGeneralUri ) - { - aEntry->SetTextValueL(KMPXMediaGeneralUri, aContainer->Uri()); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralTitle ) - { - CMdEProperty* title; - CMdEPropertyDef* titleProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameTitle); - TInt titleIndex = aContainer->Property(*titleProperty, title); - if(titleIndex == KErrNotFound) - { - TParsePtrC parser(aContainer->Uri()); - aEntry->SetTextValueL(KMPXMediaGeneralTitle, parser.Name()); - } - else - { - aEntry->SetTextValueL(KMPXMediaGeneralTitle, static_cast(title)->Value()); - } - switch (aType) - { - case CGlxDataSource::EContainerTypeAlbum: - { - CMdEProperty* albumType; - CMdEPropertyDef* albumTypeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameAlbumType); - TInt albumTypeIndex = aContainer->Property(*albumTypeProperty, albumType); - if( KErrNotFound != albumTypeIndex ) - { - TUint16 albumTypeValue = static_cast(albumType)->Value(); - if ( albumTypeValue != MdeConstants::Album::EAlbumUser ) - { - request->AppendCpiAttributeL(KMPXMediaGeneralTitle); - aEntry->SetTObjectValueL(KGlxMediaCollectionInternalSystemItemType, albumTypeValue); - } - } - break; - } - case CGlxDataSource::EContainerTypeTag: - { - break; - } - case CGlxDataSource::EContainerTypeMonth: - { - request->AppendCpiAttributeL(KMPXMediaGeneralTitle); - CMdEProperty* time; - CMdEPropertyDef* timeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameCreationDate); - TInt timeIndex = aContainer->Property(*timeProperty, time); - if( KErrNotFound == timeIndex ) - { - User::Leave(KErrCorrupt); - } - - aEntry->SetTObjectValueL(KGlxMediaCollectionInternalStartDate, static_cast(time)->Value()); - break; - } - } - } - else if ( request->Attributes()[i] == KMPXMediaGeneralDate ) - { - CMdEProperty* time; - CMdEPropertyDef* timeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameCreationDate); - TInt timeIndex = aContainer->Property(*timeProperty, time); - if( KErrNotFound == timeIndex ) - { - User::Leave(KErrCorrupt); - } - - aEntry->SetTObjectValueL(KMPXMediaGeneralDate, static_cast(time)->Value()); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralSize ) - { - CMdEProperty* size; - CMdEPropertyDef* sizeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameSize); - TInt sizeIndex = aContainer->Property(*sizeProperty, size); - TInt sizeValue; - if(sizeIndex == KErrNotFound) - { - sizeValue = 0; - } - else - { - sizeValue = static_cast(size)->Value(); - } - aEntry->SetTObjectValueL(KMPXMediaGeneralSize, sizeValue); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralDrive ) - { - TParsePtrC parser(aContainer->Uri()); - aEntry->SetTextValueL(KMPXMediaGeneralDrive, parser.Drive()); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralMimeType ) - { - CMdEProperty* mimeType; - CMdEPropertyDef* mimeTypeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameItemType); - TInt mimeTypeIndex = aContainer->Property(*mimeTypeProperty, mimeType); - if( KErrNotFound == mimeTypeIndex) - { - aEntry->SetTextValueL(KMPXMediaGeneralMimeType, KNullDesC); - } - else - { - aEntry->SetTextValueL(KMPXMediaGeneralMimeType, static_cast(mimeType)->Value()); - } - } - else if ( ( request->Attributes()[i] == KMPXMediaGeneralCount ) || ( request->Attributes()[i] == KGlxMediaCollectionInternalUsageCount ) ) - { - switch (aType) - { - case CGlxDataSource::EContainerTypeAlbum: - case CGlxDataSource::EContainerTypeTag: - { - CMdEProperty* countType; - CMdEPropertyDef* countTypeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameUsageCount); - TInt countTypeIndex = aContainer->Property(*countTypeProperty, countType); - if( KErrNotFound != countTypeIndex ) - { - TUint count = static_cast(countType)->Value(); - aEntry->SetTObjectValueL(request->Attributes()[i], count); - } - else - { - aEntry->SetTObjectValueL(request->Attributes()[i], 0); - } - break; - } - case CGlxDataSource::EContainerTypeMonth: - { - TGlxFilterProperties filterProperties = iFilterProperties; - AddMonthFilterL(aContainer, filterProperties); - QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, EQueryResultModeCount, DataSource()->CameraAlbumId(), request->Attributes()[i], aEntry, filterProperties); - break; - } - } - } - else if ( request->Attributes()[i] == KGlxMediaGeneralSystemItem ) - { - TBool systemItem = EFalse; - switch (aType) - { - case CGlxDataSource::EContainerTypeAlbum: - { - CMdEProperty* albumType; - CMdEPropertyDef* albumTypeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameAlbumType); - TInt albumTypeIndex = aContainer->Property(*albumTypeProperty, albumType); - if( KErrNotFound != albumTypeIndex ) - { - TInt albumTypeValue = static_cast(albumType)->Value(); - if( (albumTypeValue == MdeConstants::Album::EAlbumSystemCamera) || (albumTypeValue == MdeConstants::Album::EAlbumSystemFavourite ) ) - { - systemItem = ETrue; - } - } - break; - } - case CGlxDataSource::EContainerTypeTag: - { - systemItem = EFalse; - break; - } - case CGlxDataSource::EContainerTypeMonth: - { - systemItem = ETrue; - break; - } - } - aEntry->SetTObjectValueL(KGlxMediaGeneralSystemItem, systemItem); - } - - //Attributes to get the Count of Images in Container - else if ( request->Attributes()[i] == KGlxMediaItemTypeImage ) - { - switch (aType) - { - case CGlxDataSource::EContainerTypeMonth: - { - TGlxFilterProperties filterProperties = iFilterProperties; - AddMonthFilterL(aContainer, filterProperties); - filterProperties.iItemType = EGlxFilterImage; - QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, EQueryResultModeCount, DataSource()->CameraAlbumId(), request->Attributes()[i], aEntry, filterProperties); - break; - } - default: - { - break; - } - } - } - - // Attributes to get the Count of Videos in Container - - else if ( request->Attributes()[i] == KGlxMediaItemTypeVideo ) - { - switch (aType) - { - case CGlxDataSource::EContainerTypeMonth: - { - TGlxFilterProperties filterProperties = iFilterProperties; - AddMonthFilterL(aContainer, filterProperties); - filterProperties.iItemType = EGlxFilterVideo; - QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, EQueryResultModeCount, DataSource()->CameraAlbumId(), request->Attributes()[i], aEntry, filterProperties); - break; - } - default: - { - break; - } - } - } - - else if ( request->Attributes()[i] == KMPXMediaColDetailSpaceId ) - { - aEntry->SetTObjectValueL(KMPXMediaColDetailSpaceId, KGlxDataSourceMdeImplementationUid); - } - else if ( request->Attributes()[i] == KGlxMediaCollectionInternalStartDate ) - { - // nothing returned for container but is valid for CPI to request - } - else if ( request->Attributes()[i] == KGlxMediaCollectionInternalEndDate ) - { - // nothing returned for container but is valid for CPI to request - } - else if ( request->Attributes()[i] == KGlxMediaGeneralDimensions ) - { - // return zero size for container (thumbnail only used in preview list) - aEntry->SetTObjectValueL(KGlxMediaGeneralDimensions, TSize(0,0)); - } - else if ( request->Attributes()[i] == KMPXMediaDrmProtected ) - { - // container itself is not protected - aEntry->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); - } - else if ( request->Attributes()[i] == KGlxMediaGeneralFramecount ) - { - aEntry->SetTObjectValueL(KGlxMediaGeneralFramecount, 1); - } - else if ( request->Attributes()[i] == KGlxMediaGeneralSlideshowableContent ) - { - TGlxFilterProperties filterProperties = iFilterProperties; - filterProperties.iItemType = EGlxFilterImage; - filterProperties.iNoDRM = ETrue; - filterProperties.iExcludeAnimation = ETrue; - switch (aType) - { - case CGlxDataSource::EContainerTypeAlbum: - case CGlxDataSource::EContainerTypeTag: - { - QueueObjectQueryL(aContainer->Def(), ETrue, EAttributeQuery, EQueryResultModeCount, TGlxMediaId(aContainer->Id()), request->Attributes()[i], aEntry, filterProperties); - break; - } - case CGlxDataSource::EContainerTypeMonth: - { - AddMonthFilterL(aContainer, filterProperties); - QueueObjectQueryL(DataSource()->AlbumDef(), ETrue, EAttributeQuery, EQueryResultModeCount, DataSource()->CameraAlbumId(), request->Attributes()[i], aEntry, filterProperties); - break; - } - } - } - else if ( request->Attributes()[i] == KGlxMediaGeneralLastModifiedDate ) - { - CMdEProperty* time; - CMdEPropertyDef* timeProperty = aContainer->Def().GetPropertyDefL(KPropertyDefNameLastModifiedDate); - TInt timeIndex = aContainer->Property(*timeProperty, time); - if( KErrNotFound == timeIndex) - { - User::Leave(KErrCorrupt); - } - aEntry->SetTObjectValueL(KGlxMediaGeneralLastModifiedDate, static_cast(time)->Value()); - } - else if ( request->Attributes()[i] == KGlxMediaGeneralDimensions ) - { - TSize dimensions(0,0); - - aEntry->SetTObjectValueL(KGlxMediaGeneralDimensions, dimensions); - } - else - { - User::Leave(KErrNotSupported); - } - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeAttribute::AddItemAttributesL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeAttribute::AddItemAttributesL(CMPXMedia* aEntry, CMdEObject* aItem, CGlxDataSource::TItemType aType) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::AddItemAttributesL(CMPXMedia* aEntry, CMdEObject* aItem, CGlxDataSource::TItemType aType)"); - __ASSERT_DEBUG(aEntry, Panic(EGlxPanicLogicError)); - __ASSERT_DEBUG(aItem, Panic(EGlxPanicLogicError)); - __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); - CGlxGetRequest* request = static_cast(iRequest); - - /// @todo check property defs are valid and type is correct - for ( TInt i = 0; i < request->Attributes().Count(); i++ ) - { - if ( request->Attributes()[i] == KMPXMediaGeneralId ) - { - aEntry->SetTObjectValueL(KMPXMediaGeneralId, (TMPXItemId)aItem->Id()); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralType ) - { - aEntry->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralCategory ) - { - if( CGlxDataSource::EItemTypeImage == aType) - { - aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXImage); - } - else if( CGlxDataSource::EItemTypeVideo == aType) - { - aEntry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXVideo); - } - else - { - User::Leave(KErrNotSupported); - } - } - else if ( request->Attributes()[i] == KMPXMediaGeneralUri ) - { - aEntry->SetTextValueL(KMPXMediaGeneralUri, aItem->Uri()); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralTitle ) - { - CMdEProperty* title; - CMdEPropertyDef* titleProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameTitle); - TInt titleIndex = aItem->Property(*titleProperty, title); - if( KErrNotFound == titleIndex ) - { - TParsePtrC parser(aItem->Uri()); - aEntry->SetTextValueL(KMPXMediaGeneralTitle, parser.Name()); - } - else - { - aEntry->SetTextValueL(KMPXMediaGeneralTitle, static_cast(title)->Value()); - } - } - else if ( request->Attributes()[i] == KMPXMediaGeneralDate ) - { - CMdEProperty* time; - CMdEPropertyDef* timeProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameCreationDate); - TInt timeIndex = aItem->Property(*timeProperty, time); - if( KErrNotFound == timeIndex) - { - User::Leave(KErrCorrupt); - } - aEntry->SetTObjectValueL(KMPXMediaGeneralDate, static_cast(time)->Value()); - } - else if ( request->Attributes()[i] == KGlxMediaGeneralLastModifiedDate ) - { - CMdEProperty* time; - CMdEPropertyDef* timeProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameLastModifiedDate); - TInt timeIndex = aItem->Property(*timeProperty, time); - if( KErrNotFound == timeIndex) - { - User::Leave(KErrCorrupt); - } - aEntry->SetTObjectValueL(KGlxMediaGeneralLastModifiedDate, static_cast(time)->Value()); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralSize ) - { - CMdEProperty* size; - CMdEPropertyDef* sizeProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameSize); - TInt sizeIndex = aItem->Property(*sizeProperty, size); - User::LeaveIfError(sizeIndex); - - aEntry->SetTObjectValueL(KMPXMediaGeneralSize, static_cast(size)->Value()); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralDrive ) - { - TParsePtrC parser(aItem->Uri()); - aEntry->SetTextValueL(KMPXMediaGeneralDrive, parser.Drive()); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralMimeType ) - { - CMdEProperty* mimeType; - CMdEPropertyDef* mimeTypeProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameItemType); - TInt mimeTypeIndex = aItem->Property(*mimeTypeProperty, mimeType); - - User::LeaveIfError(mimeTypeIndex); - aEntry->SetTextValueL(KMPXMediaGeneralMimeType, static_cast(mimeType)->Value()); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralDuration ) - { - if( CGlxDataSource::EItemTypeImage == aType ) - { - aEntry->SetTObjectValueL(KMPXMediaGeneralDuration, 0); - } - else - { - CMdEProperty* duration; - CMdEPropertyDef* durationProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameDuration); - TInt durationIndex = aItem->Property(*durationProperty, duration); - User::LeaveIfError(durationIndex); - - aEntry->SetTObjectValueL(KMPXMediaGeneralDuration, static_cast(duration)->Value()); - } - } - else if ( request->Attributes()[i] == KGlxMediaGeneralSystemItem) - { - aEntry->SetTObjectValueL(KGlxMediaGeneralSystemItem, EFalse); - } - else if ( request->Attributes()[i] == KGlxMediaGeneralDimensions ) - { - TSize dimensions(0,0); - - CMdEProperty* xDim; - CMdEPropertyDef* xDimProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameWidth); - TInt xDimIndex = aItem->Property(*xDimProperty, xDim); - if( KErrNotFound == xDimIndex ) - { - //User::Leave(KErrCorrupt); - } - else - { - dimensions.iWidth = static_cast(xDim)->Value(); - } - - CMdEProperty* yDim; - CMdEPropertyDef* yDimProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameHeight); - TInt yDimIndex = aItem->Property(*yDimProperty, yDim); - if( KErrNotFound == yDimIndex ) - { - //User::Leave(KErrCorrupt); - } - else - { - dimensions.iHeight = static_cast(yDim)->Value(); - } - if ( ( dimensions.iWidth == 0 ) || ( dimensions.iHeight == 0 ) ) - { - if( CGlxDataSource::EItemTypeImage == aType) - { - // EXIF header is corrupt, must read size from file. - CImageDecoder* decoder = NULL; - - TRAPD(err, decoder = CImageDecoder::FileNewL( DataSource()->FileServerSession(), aItem->Uri(), CImageDecoder::EOptionNone )); - if (err == KErrNone) - { - dimensions = decoder->FrameInfo().iOverallSizeInPixels; - } - delete decoder; - } - } - - aEntry->SetTObjectValueL(KGlxMediaGeneralDimensions, dimensions); - } - else if ( request->Attributes()[i] == KGlxMediaGeneralFramecount ) - { - CMdEProperty* framecount; - TInt fcount = 1; - CMdEPropertyDef* framecountProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameFrameCount); - if( framecountProperty ) - { - TInt framecountIndex = aItem->Property(*framecountProperty, framecount); - if( KErrNotFound != framecountIndex ) - { - fcount = static_cast(framecount)->Value(); - } - } - aEntry->SetTObjectValueL(KGlxMediaGeneralFramecount, fcount); - } - else if ( request->Attributes()[i] == KMPXMediaGeneralComment ) - { - CMdEProperty* comment; - CMdEPropertyDef* commentProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameComment); /// @todo using Exif Comment field for comment as spec is not clear - TInt commentIndex = aItem->Property(*commentProperty, comment); - if( KErrNotFound == commentIndex) - { - aEntry->SetTextValueL(KMPXMediaGeneralComment, KNullDesC); - } - else - { - aEntry->SetTextValueL(KMPXMediaGeneralComment, static_cast(comment)->Value()); - } - } - else if ( request->Attributes()[i] == KMPXMediaDrmProtected ) - { - CMdEProperty* drmProtected; - CMdEPropertyDef* drmProtectedProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameDRM); - TInt drmProtectedIndex = aItem->Property(*drmProtectedProperty, drmProtected); - if( KErrNotFound == drmProtectedIndex) - { - aEntry->SetTObjectValueL(KMPXMediaDrmProtected, EFalse); - } - else - { - aEntry->SetTObjectValueL(KMPXMediaDrmProtected, static_cast(drmProtected)->Value()); - } - } - else if ( request->Attributes()[i] == KMPXMediaGeneralCount ) - { - aEntry->SetTObjectValueL(KMPXMediaGeneralCount, 1); - } - else if ( request->Attributes()[i] == KMPXMediaColDetailSpaceId ) - { - aEntry->SetTObjectValueL(KMPXMediaColDetailSpaceId, KGlxDataSourceMdeImplementationUid); - } - else if ( request->Attributes()[i] == KGlxMediaGeneralSlideshowableContent ) - { - aEntry->SetTObjectValueL(KGlxMediaGeneralSlideshowableContent, -1); - } - else if ( request->Attributes()[i] == KGlxMediaGeneralLocation) - { - // Set the attribute to a TCoordinate initialised to NaN. - aEntry->SetTObjectValueL(KGlxMediaGeneralLocation, TCoordinate()); - } - else - { - User::Leave(KErrNotSupported); - } - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::AddLocationAttributeToMediaL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeAttribute::AddLocationAttributeToMediaL(CMPXMedia& aMedia, const TItemId& aLocationId) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::AddLocationAttributeToMediaL(CMPXMedia& aMedia, const TItemId& aLocationId)"); - CMdEObject* location = DataSource()->Session().GetObjectL(aLocationId, DataSource()->LocationDef()); - if(!location) - { - User::Leave(KErrNotFound); - } - CleanupStack::PushL(location); - CMdEProperty* longitude = NULL; - CMdEPropertyDef* longitudePropertyDef = location->Def().GetPropertyDefL(KPropertyDefNameLongitude); - TInt longitudeIndex = location->Property(*longitudePropertyDef, longitude); - CMdEProperty* latitude = NULL; - CMdEPropertyDef* latitudePropertyDef = location->Def().GetPropertyDefL(KPropertyDefNameLatitude); - TInt latitudeIndex = location->Property(*latitudePropertyDef, latitude); - - if (longitudeIndex > KErrNotFound && latitudeIndex > KErrNotFound) - { - TCoordinate coordinate(static_cast< CMdEReal64Property *>(latitude)->Value(),static_cast< CMdEReal64Property *>(longitude)->Value()); - aMedia.SetTObjectValueL(KGlxMediaGeneralLocation, coordinate); - } - - CleanupStack::PopAndDestroy(location); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeAttribute::DoHandleAttributeQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeAttribute::DoHandleAttributeQueryCompletedL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::DoHandleAttributeQueryCompletedL()"); - __ASSERT_DEBUG(iQueryAttributes.Count(), Panic(EGlxPanicIllegalState)); - CMdEQuery* query = iQueries[0]; - - if( EQueryResultModeObjectWithoutFreetexts == query->ResultMode() ) - { - __ASSERT_DEBUG(( iQueryAttributes[0].iAttribute == KGlxMediaCollectionInternalStartDate ), Panic(EGlxPanicIllegalState)); - CMdEPropertyDef* creationDateDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameCreationDate); - if (!creationDateDef || creationDateDef->PropertyType() != EPropertyTime) - { - User::Leave(KErrCorrupt); - } - TTime startMonth(0); - TTime endMonth(0); - if(iQueries[0]->Count() ) - { - CMdEProperty* startTime; - CMdEObject& startObject = (CMdEObject&)query->ResultItem(0); - TInt timeIndex = startObject.Property(*creationDateDef, startTime); - if( KErrNotFound == timeIndex ) - { - User::Leave(KErrCorrupt); - } - startMonth = static_cast(startTime)->Value(); - CMdEProperty* endTime; - CMdEObject& endObject = (CMdEObject&)query->ResultItem(query->Count()-1); - timeIndex = endObject.Property(*creationDateDef, endTime); - if( KErrNotFound == timeIndex ) - { - User::Leave(KErrCorrupt); - } - endMonth = static_cast(endTime)->Value(); - } - iQueryAttributes[0].iMedia->SetTObjectValueL(KGlxMediaCollectionInternalStartDate, startMonth); - iQueryAttributes[0].iMedia->SetTObjectValueL(KGlxMediaCollectionInternalEndDate, endMonth); - } - else if( EQueryResultModeCount == query->ResultMode() ) - { - iQueryAttributes[0].iMedia->SetTObjectValueL(iQueryAttributes[0].iAttribute, query->Count()); - } - else - { - Panic(EGlxPanicIllegalState); - } - iQueryAttributes.Remove(0); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::DoHandleLocationQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeAttribute::DoHandleLocationQueryCompletedL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::DoHandleLocationQueryCompletedL()"); - TInt queryResultsCount = iQueries[0]->Count(); - - for (TInt queryResultsPos = 0; queryResultsPos < queryResultsCount; queryResultsPos++) - { - CMdERelation& relation = static_cast(iQueries[0]->ResultItem(queryResultsPos)); - CMPXMedia* targetMedia = NULL; - if (iMediaArray) - { - TInt mediaArrayCount = iMediaArray->Count(); - for (TInt mediaArrayPos = 0; mediaArrayPos < mediaArrayCount; mediaArrayPos++) - { - CMPXMedia* media = (*iMediaArray)[mediaArrayPos]; - TMPXItemId id = media->ValueTObjectL(KMPXMediaGeneralId); - if (id.iId1 == relation.LeftObjectId()) - { - targetMedia = media; - break; - } - } - } - else - { - targetMedia = iResponse; -#ifdef _DEBUG - TMPXItemId id = targetMedia->ValueTObjectL(KMPXMediaGeneralId); - __ASSERT_DEBUG(id.iId1 == relation.LeftObjectId(), Panic(EGlxPanicLogicError)); -#endif - } - - __ASSERT_DEBUG(targetMedia, Panic(EGlxPanicLogicError)); - AddLocationAttributeToMediaL(*targetMedia, relation.RightObjectId()); - - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeAttribute::DoHandleImageVideoQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeAttribute::DoHandleImageVideoQueryCompletedL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::DoHandleImageVideoQueryCompletedL()"); - CMdEQuery* query = iQueries[0]; - - TInt queryResultsCount = query->Count(); - - if( ( queryResultsCount == 1 ) && ( !iMediaArray ) ) - { - CMdEObject& object = static_cast(query->ResultItem(0)); - - delete iResponse; - // setiing iResponse to NULL to remove CodeScanner warning - iResponse = NULL; - iResponse = CMPXMedia::NewL(); - AddAttributesL(object, iResponse); - } - else - { - for (TInt i = 0; i < queryResultsCount; i++) - { - CMdEObject& object = static_cast(query->ResultItem(i)); - - CMPXMedia* entry = CMPXMedia::NewL(); - CleanupStack::PushL(entry); - iMediaArray->AppendL(entry); - CleanupStack::Pop(entry); - AddAttributesL(object, (*iMediaArray)[iMediaArray->Count() - 1]); - } - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeAttribute::QueueLocaitonQueryL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeAttribute::QueueLocaitonQueryL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::QueueLocaitonQueryL()"); - __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); - CGlxGetRequest* request = static_cast(iRequest); - - CMdEQuery* query = DataSource()->Session().NewRelationQueryL(*DataSource()->NamespaceDef(), this); - CleanupStack::PushL(query); - - CMdELogicCondition& rootCondition = query->Conditions(); - CMdERelationCondition& containerRelationCondition = rootCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideRight); - CMdELogicCondition& itemLogicCondition = containerRelationCondition.LeftL(); - CMdELogicCondition& locationLogicCondition = containerRelationCondition.RightL(); - locationLogicCondition.AddObjectConditionL(DataSource()->LocationDef()); - locationLogicCondition.SetOperator(ELogicConditionOperatorOr); - itemLogicCondition.SetOperator(ELogicConditionOperatorOr); - - TInt mediaIdCount = request->MediaIds().Count(); - - RArray mediaIdArray; - CleanupClosePushL(mediaIdArray); - - for (TInt i = 0; i < mediaIdCount; i++) - { - mediaIdArray.AppendL(request->MediaIds()[i].Value()); - } - - itemLogicCondition.AddObjectConditionL(mediaIdArray); - CleanupStack::PopAndDestroy(&mediaIdArray); - - query->SetResultMode(EQueryResultModeItem); - - CleanupStack::Pop(query); - AppendQueryL(query, ELocationAttributeQuery); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTask::ExecuteQueryL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeAttribute::ExecuteQueryL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::ExecuteQueryL()"); - switch (iQueryTypes[0]) - { - case EAttributeQuery: - { - iQueries[0]->FindL(MaxQueryResultsCount(iQueryAttributes[0].iFilterProperties)); - } - break; - case EImageVideoQuery: // fall through - case ELocationAttributeQuery: - { - iQueries[0]->FindL(); - } - break; - default: - { - Panic(EGlxPanicUnsupportedQueryType); - } - break; - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeAttribute::LocationAttributeRequested -// ---------------------------------------------------------------------------- -// -TBool CGlxDataSourceTaskMdeAttribute::LocationAttributeRequested() - { - GLX_LOG_ENTRY_EXIT("TBool CGlxDataSourceTaskMdeAttribute::LocationAttributeRequested()"); - __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); - CGlxGetRequest* request = static_cast(iRequest); - - TInt attributeArrayCount = request->Attributes().Count(); - for (TInt i = 0; i < attributeArrayCount; i++) - { - if (request->Attributes()[i] == KGlxMediaGeneralLocation) - { - return ETrue; - } - } - return EFalse; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTask::QueueObjectQueryL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeAttribute::QueueObjectQueryL(CMdEObjectDef& aObjectDef, TBool aIsContent, TGlxQueryType aQueryType, - TQueryResultMode aResultMode, const TGlxMediaId& aContainerId, TMPXAttribute aAttribute, CMPXMedia* aEntry, - const TGlxFilterProperties& aFilterProperties) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeAttribute::QueueObjectQueryL()"); - CMdEObjectDef* queryBaseObject = &aObjectDef; - if( aIsContent ) - { - switch(aFilterProperties.iItemType) - { - case EGlxFilterImage: - { - queryBaseObject = &DataSource()->ImageDef(); - break; - } - case EGlxFilterVideo: - { - queryBaseObject = &DataSource()->VideoDef(); - break; - } - default: - { - queryBaseObject = &DataSource()->ObjectDef(); - break; - } - } - } - - CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), *queryBaseObject, this); - CleanupStack::PushL(query); - SetQueryConditionsL(*query, aFilterProperties, aContainerId, aObjectDef); - query->SetResultMode(aResultMode); - - iQueryAttributes.AppendL(TGlxQueryAttribute(aAttribute, aEntry, aFilterProperties)); - - CleanupStack::Pop(query); - - TRAPD(err, AppendQueryL(query,aQueryType)); - - if (err != KErrNone) - { - iQueryAttributes.Remove(iQueryAttributes.Count() - 1); - } - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdecommand.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdecommand.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1150 +0,0 @@ -/* -* Copyright (c) 2006 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: -* -*/ - - - -/** - * @internal reviewed 11/07/2007 by M Byrne - */ - - -#include "glxdatasourcetaskmdecommand.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "glxdatasourcemde.h" -#include "glxdatasourcemde.hrh" - -// CONSTANTS -_LIT(KPropertyDefNameDescription, "Comment"); -_LIT(KPropertyDefNameTitle, "Title" ); -_LIT(KPropertyDefNameSize, "Size"); -_LIT(KPropertyDefNameCreationDate, "CreationDate"); -_LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); -_LIT(KPropertyDefNameAlbumType, "Type"); -_LIT(KPropertyDefItemType, "ItemType"); -// Item type for Album -_LIT( KAlbumItemType, "application/vnd.nokia.mde.album" ); -// Item type for Tag -_LIT( KTagItemType, "application/vnd.nokia.mde.tag" ); - -const TInt KDriveLetterLength = 1; -_LIT(KColonBackslash, ":\\"); -_LIT(KFileNameFormatString, "(%+02u)"); - -// ---------------------------------------------------------------------------- -// Destructor -// ---------------------------------------------------------------------------- -// -CGlxDataSourceTaskMdeCommand::~CGlxDataSourceTaskMdeCommand() - { - GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeCommand::~CGlxDataSourceTaskMdeCommand()"); - iLeftIds.Close(); - iRightIds.Close(); - delete iTitle; - delete iObjectToRename; - } - - -// ---------------------------------------------------------------------------- -// Constructor -// ---------------------------------------------------------------------------- -// -CGlxDataSourceTaskMdeCommand::CGlxDataSourceTaskMdeCommand( - CGlxCommandRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, - CGlxDataSource* aDataSource) - : CGlxDataSourceTaskMde(aRequest, aObserver, aDataSource) - { - GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeCommand::CGlxDataSourceTaskMdeCommand()"); - // No implementation required - } - -// ---------------------------------------------------------------------------- -// Second phase constructor -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::ConstructL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::ConstructL()"); - iResponse = CMPXCommand::NewL(static_cast(iRequest)->Command()); - DataSource()->ThumbnailCreator().CancelRequest( TGlxMediaId(0) ); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::ExecuteRequestL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::ExecuteRequestL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::ExecuteRequestL()"); - __ASSERT_DEBUG(DataSource()->NamespaceDef(), Panic(EGlxPanicIllegalState)); - - const CMPXCommand& command = static_cast(iRequest)->Command(); - - if ( command.IsSupported(KMPXCommandGeneralCollectionId) ) - { - iCollectionUid = command.ValueTObjectL(KMPXCommandGeneralCollectionId); - } - else - { - // if the collection Uid has not been set on the command, use the Ud of the plugin in use. - iCollectionUid = iRequest->CollectionPluginUid(); - } - - TGlxCommandParser::ParseL(*this, command); - } - -// ---------------------------------------------------------------------------- -// Add container -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::AddContainerL(const TDesC& aContainerName) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::AddContainerL(const TDesC& aContainerName)"); - iTitle = aContainerName.AllocL(); - AppendContainerTitleCountQueryL(ECommandAddContainer, aContainerName); - ExecuteQueryL(); - } - -// ---------------------------------------------------------------------------- -// Add items to container by id -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::AddToContainerL(const RArray& aSourceIds, const RArray& aTargetContainers) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::AddToContainerL()"); - __ASSERT_DEBUG(aSourceIds.Count() && aTargetContainers.Count(), Panic(EGlxPanicEmptyArray)); - - iLeftIds.Reset(); - iRightIds.Reset(); - - CMdEQuery* query = DataSource()->Session().NewRelationQueryL(*DataSource()->NamespaceDef(), this); - AppendQueryL(query, ECommandAddToContainer); - - CMdELogicCondition& rootCondition = query->Conditions(); - CMdERelationCondition& containerRelationCondition = rootCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideLeft); - CMdELogicCondition& leftLogicCondition = containerRelationCondition.LeftL(); - CMdELogicCondition& rightLogicCondition = containerRelationCondition.RightL(); - leftLogicCondition.SetOperator(ELogicConditionOperatorOr); - rightLogicCondition.SetOperator(ELogicConditionOperatorOr); - - TMdEItemId containerId = ContainerItemId(aTargetContainers[0]); - // It is currenly a safe assumption that all containers are of the same type (either albums or tags) - // and thus they will either all be on the left or all be on the right of the logic condition. Therefore, - // we only need to test the first container to see if it is on the left or on the right. - CMdEObject* container = DataSource()->Session().GetObjectL(containerId); - if (!container) - { - User::Leave(KErrNotFound); - } - TBool containerIsLeft = DataSource()->ContainerIsLeft(container->Def()); - - delete container; - container = NULL; - - - if (containerIsLeft) - { - // the container is on the left - CopyArrayL(iLeftIds, aTargetContainers); - CopyArrayL(iRightIds, aSourceIds); - } - else - { - // the container is on the right - CopyArrayL(iRightIds, aTargetContainers); - CopyArrayL(iLeftIds, aSourceIds); - } - - leftLogicCondition.AddObjectConditionL(iLeftIds); - rightLogicCondition.AddObjectConditionL(iRightIds); - - query->SetResultMode(EQueryResultModeItem); - - ExecuteQueryL(); - - } - -// ---------------------------------------------------------------------------- -// Add item to containers by URI. -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::AddToContainerL(const TDesC& aSourceUri, - const RArray< TGlxMediaId >& aTargetContainers) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::AddToContainerL()"); - CMdEObject* sourceObject = DataSource()->Session().GetObjectL(aSourceUri); - if (!sourceObject) - { - User::Leave(KErrNotFound); - } - RArray sourceIds; - CleanupClosePushL(sourceIds); - sourceIds.AppendL(TGlxMediaId(sourceObject->Id())); - - AddToContainerL(sourceIds, aTargetContainers); - CleanupStack::PopAndDestroy(&sourceIds); - } - -// ---------------------------------------------------------------------------- -// Copy files to another drive. -// ---------------------------------------------------------------------------- -// -/// @todo minor: Rowland Cook 12/06/2007 Has this method been tested? If so remove comments -void CGlxDataSourceTaskMdeCommand::CopyL(const RArray& aSourceIds, const TDesC& aDrive) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::CopyL()"); - FileOperationL(aSourceIds.Array(), aDrive, ECopy); - } - -// ---------------------------------------------------------------------------- -// Move files to another drive. -// ---------------------------------------------------------------------------- -// -/// @todo minor: Rowland Cook 12/06/2007 Has this method been tested? If so remove comments -void CGlxDataSourceTaskMdeCommand::MoveL(const RArray& aSourceIds, const TDesC& aDrive) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::MoveL()"); - FileOperationL(aSourceIds.Array(), aDrive, EMove); - } - -// ---------------------------------------------------------------------------- -// Remove items from a container. -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::RemoveFromContainerL(const RArray& aItemIds, const TGlxMediaId& aContainerId) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::RemoveFromContainerL()"); - // Answer to question in @bug above: No - - CMdEObject* object = NULL; - object = DataSource()->Session().GetObjectL(aContainerId.Value()); - CleanupStack::PushL(object); - if (!object) - { - User::Leave(KErrNotFound); - } - - CMdEQuery* query = DataSource()->Session().NewRelationQueryL(*DataSource()->NamespaceDef(), this); - AppendQueryL(query, ECommandRemoveFromContainer); // query is now owned by the query array. - - CMdELogicCondition& rootCondition = query->Conditions(); - - CMdERelationCondition& containerRelationCondition = rootCondition.AddRelationConditionL(DataSource()->ContainsDef(), ERelationConditionSideLeft); - CMdELogicCondition* containerLogicCondition = NULL; - CMdELogicCondition* itemLogicCondition = NULL; - // Containers are on the left for albums, right for tags - if ( DataSource()->ContainerIsLeft(object->Def()) ) - { - containerLogicCondition = &containerRelationCondition.LeftL(); - itemLogicCondition = &containerRelationCondition.RightL(); - } - else - { - containerLogicCondition = &containerRelationCondition.RightL(); - itemLogicCondition = &containerRelationCondition.LeftL(); - } - - containerLogicCondition->AddObjectConditionL(aContainerId.Value()); - - itemLogicCondition->SetOperator(ELogicConditionOperatorOr); - itemLogicCondition->AddObjectConditionL(reinterpret_cast&>(aItemIds)); - - query->SetResultMode(EQueryResultModeId); - CleanupStack::PopAndDestroy(object); - ExecuteQueryL(); - } - -// ---------------------------------------------------------------------------- -// Delete files, Remove container. -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::DeleteL(const RArray& aItemIds) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DeleteL()"); - CMdEObjectDef* containerObjectDef = NULL; - TInt err = ContainerObjectDef(containerObjectDef); - if (err == KErrNone) - { - QueueObjectQueryL(*containerObjectDef, - reinterpret_cast&>(aItemIds), ECommandDeleteContainers); - } - // Assume that only items are left - QueueObjectQueryL(DataSource()->ObjectDef(), - reinterpret_cast&>(aItemIds), ECommandDeleteItems); - - ExecuteQueryL(); - } - -// ---------------------------------------------------------------------------- -// Rename files, Rename container. -// -/// @todo test this method. -// -// ---------------------------------------------------------------------------- -// -/// @todo minor: Rowland Cook 12/06/2007 Has this method been tested? If so remove comments -void CGlxDataSourceTaskMdeCommand::RenameL(const TGlxMediaId& aSourceItemId, const TDesC& aTitle) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::RenameL()"); - delete iTitle; - iTitle = NULL; - iTitle = aTitle.AllocL(); - - RArray sourceIdArray; - CleanupClosePushL(sourceIdArray); - sourceIdArray.AppendL(aSourceItemId.Value()); - - QueueObjectQueryL(DataSource()->ObjectDef(), sourceIdArray , ECommandRename); - CleanupStack::PopAndDestroy(&sourceIdArray); - - ExecuteQueryL(); - } - -// ---------------------------------------------------------------------------- -// Set description. -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::SetDescriptionL(const RArray& aItemIds, const TDesC& aDescription) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::SetDescriptionL()"); - CMdEPropertyDef* descriptionPropertyDef = DataSource()->MediaDef().GetPropertyDefL(KPropertyDefNameDescription); - if (!descriptionPropertyDef || descriptionPropertyDef->PropertyType() != EPropertyText) - { - User::Leave(KErrCorrupt); - } - - TInt count = aItemIds.Count(); - for (TInt i = 0; i < count; i++) - { - TMdEItemId itemId = aItemIds[i].Value(); - CMdEObject* object = DataSource()->Session().OpenFullObjectL(itemId); - if (!object) - { - User::Leave(KErrNotFound); - } - CleanupStack::PushL(object); - CMdEProperty* descriptionProperty = NULL; - TInt index = object->Property(*descriptionPropertyDef, descriptionProperty); - if (index < KErrNotFound) - { - User::Leave(index); - } - if (index != KErrNotFound) - { - // Check whether the description string is empty - if( aDescription.Length() ) - { - static_cast(descriptionProperty)->SetValueL(aDescription); - } - - //if entered description string is blank then remove the old property - else - { - object->RemoveProperty(index); - } - } - else - { - if( aDescription.Length() ) - { - object->AddTextPropertyL(*descriptionPropertyDef, aDescription); - } - } - DataSource()->Session().CommitObjectL(*object); - CleanupStack::PopAndDestroy(object); - } - - HandleRequestComplete(KErrNone); - } - - -// ---------------------------------------------------------------------------- -// Set capture location. -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::SetCaptureLocationL(const RArray& aItemIds, const TCoordinate& aCoordinate) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::SetCaptureLocationL()"); - if (!Math::IsNaN(aCoordinate.Latitude()) || !Math::IsNaN(aCoordinate.Longitude())) - { - User::Leave(KErrArgument); - } - - CMdEQuery* query = DataSource()->Session().NewRelationQueryL(*DataSource()->NamespaceDef(), this); - AppendQueryL(query, ECommandRemoveLocation); // query is now owned by the query array. - - CMdELogicCondition& rootCondition = query->Conditions(); - - CMdERelationCondition& containerRelationCondition = rootCondition.AddRelationConditionL(ERelationConditionSideLeft); - CMdELogicCondition& locationLogicCondition = containerRelationCondition.RightL(); - CMdELogicCondition& itemLogicCondition = containerRelationCondition.LeftL(); - locationLogicCondition.AddObjectConditionL(DataSource()->LocationDef()); - - itemLogicCondition.SetOperator(ELogicConditionOperatorOr); - - itemLogicCondition.AddObjectConditionL(reinterpret_cast&>(aItemIds)); - - query->SetResultMode(EQueryResultModeId); - ExecuteQueryL(); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::ThumbnailCleanupL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::ThumbnailCleanupL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::ThumbnailCleanupL()"); - CGlxDataSourceMde* ds = DataSource(); - ds->ThumbnailCreator().CleanupThumbnailsL(&ds->ThumbnailDatabase()); - HandleRequestComplete(KErrNone); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::HandleQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::DoHandleQueryCompletedL(CMdEQuery& aQuery) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoHandleQueryCompletedL()"); - TGlxQueryType queryType = iQueryTypes[0]; - - switch (queryType) - { - - case ECommandRemoveFromContainer: // don't break - case ECommandRemoveLocation: - { - TInt queryCount = aQuery.Count(); - RArray relationsToRemove; - CleanupClosePushL(relationsToRemove); - User::LeaveIfError(relationsToRemove.Reserve(queryCount)); - - RArray successfullyRemovedReleations; - CleanupClosePushL(successfullyRemovedReleations); - User::LeaveIfError(successfullyRemovedReleations.Reserve(queryCount)); - - for(TInt i = queryCount - 1; i >= 0; i--) - { - relationsToRemove.AppendL(aQuery.ResultId(i)); - } - - if (queryCount) - { - User::LeaveIfError(DataSource()->Session().RemoveRelationsL(relationsToRemove, successfullyRemovedReleations)); - } - - CleanupStack::PopAndDestroy(&successfullyRemovedReleations); - CleanupStack::PopAndDestroy(&relationsToRemove); - } - break; - case ECommandAddToContainer: - { - DoHandleAddToContainerQueryCompletedL(aQuery); - } - break; - case ECommandAddContainer: - { - DoHandleAddContainerQueryCompletedL(aQuery); - } - break; - case ECommandDeleteContainers: - { - DoHandleDeleteContainersQueryCompletedL(aQuery); - } - break; - case ECommandDeleteItems: - { - DoHandleDeleteItemsQueryCompletedL(aQuery); - } - break; - case ECommandRename: - { - DoHandleRenameQueryCompletedL(aQuery); - } - break; - case ECommandRenameContainer: - { - DoHandleRenameConainerQueryCompletedL(aQuery); - } - break; - } - } -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::DoNextQueryL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::DoNextQueryL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoNextQueryL()"); - if (iQueries.Count()) - { - ExecuteQueryL(); - } - else - { - HandleRequestComplete(KErrNone); - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::FileOperationL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::FileOperationL(const TArray& aSourceIds, const TDesC& aDrive, TFileOperation aFileOperation) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::FileOperationL()"); - ContentAccess::CManager *manager = ContentAccess::CManager::NewL(); - CleanupStack::PushL(manager); - // The following line causes a code scanner warning advising use of EikonEnv RFs instance. - // We don't have an EikonEnv as we are running in a server process. - RFs rfs; // used for BaflUtils::FileExists - - CleanupClosePushL(rfs); - User::LeaveIfError(rfs.Connect()); - for (TInt i = 0; i < aSourceIds.Count(); i++) - { - CMdEObject* sourceObject = DataSource()->Session().GetObjectL(aSourceIds[i].Value()); - if (!sourceObject) - { - User::Leave(KErrNotFound); - } - - CleanupStack::PushL(sourceObject); - - const TDesC& sourceFileName = sourceObject->Uri(); - TFileName sourceRootPath; - - RootPath(sourceFileName, sourceRootPath); - TPtrC fileNameWithoutRoot(NULL,0); - if (sourceFileName.Left(sourceRootPath.Length()).CompareF(sourceRootPath) == 0) - // This is the expected case. The file to be copied is under the 'root' of - // the drive that it is located on. (For the C:, the root is C:\data, - // for the D: the root is D:\) - { - fileNameWithoutRoot.Set(sourceFileName.Right(sourceFileName.Length() - sourceRootPath.Length())); - } - else - { - fileNameWithoutRoot.Set(sourceFileName); - } - - TFileName destinationFileName; - // Set destination file name to destination 'root' path - RootPath(aDrive, destinationFileName); - // Append the file name - destinationFileName.Append(fileNameWithoutRoot); - -/// @todo minor: Rowland Cook 12/06/2007 majic number. - if (destinationFileName.CompareF(sourceFileName) != 0) - { - // If source and destination are not identical, perform the copy. - if (BaflUtils::FileExists(rfs, destinationFileName)) - { - // If the destination file name already exists find an available file name. - TParse destinationFileNameParse; - destinationFileNameParse.Set(destinationFileName,NULL,NULL); // this is a copy of the data - TInt destinationFileNameWithoutExtensionLength = destinationFileName.Length() - destinationFileNameParse.Ext().Length(); - TInt i = 1; - do - { - destinationFileName.SetLength(destinationFileNameWithoutExtensionLength); - destinationFileName.AppendFormat(KFileNameFormatString,i++); - destinationFileName.Append(destinationFileNameParse.Ext()); - } - while (BaflUtils::FileExists(rfs, destinationFileName)); - } - - // Ensure the path that we are copying to exists. - // Fixed error ID: ELLZ-798BP3 Lumiere 07.46.08_MC Photo: - // "System: System error." is displayed when copying/moving image which is saved in a user created folder. - BaflUtils::EnsurePathExistsL(rfs,destinationFileName); - - if (aFileOperation == ECopy) - { - User::LeaveIfError(manager->CopyFile(sourceFileName, destinationFileName)); - } - else - { - User::LeaveIfError(manager->RenameFile(sourceFileName, destinationFileName)); - } - - } - - CleanupStack::PopAndDestroy(sourceObject); - } - - CleanupStack::PopAndDestroy(&rfs); - CleanupStack::PopAndDestroy(manager); - - HandleRequestComplete(KErrNone); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::ContainerItemId -// ---------------------------------------------------------------------------- -// -TMdEItemId CGlxDataSourceTaskMdeCommand::ContainerItemId(const TGlxMediaId& aMediaId) - { - GLX_LOG_ENTRY_EXIT("TMdEItemId CGlxDataSourceTaskMdeCommand::ContainerItemId()"); - TMdEItemId containerId = aMediaId.Value(); - if (aMediaId == KGlxCollectionRootId) - { - // Check the collection plugin uid - if (iCollectionUid == TUid::Uid(KGlxCollectionPluginCameraImplementationUid)) - { - containerId = DataSource()->CameraAlbumId().Value(); - } - } - return containerId; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::ContainerItemId -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::RootPath(const TDesC& aDrive, TDes& aRootPath) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::RootPath(const TDesC& aDrive, TDes& aRootPath)"); - if (aDrive.Left(KDriveLetterLength).CompareF(PathInfo::PhoneMemoryRootPath().Left(KDriveLetterLength)) == 0) - { - aRootPath = PathInfo::PhoneMemoryRootPath(); - } - else if (aDrive.Left(KDriveLetterLength).CompareF(PathInfo::MemoryCardRootPath().Left(KDriveLetterLength)) == 0) - { - aRootPath = PathInfo::MemoryCardRootPath(); - } - else if (aDrive.Left(KDriveLetterLength).CompareF(PathInfo::RomRootPath().Left(KDriveLetterLength)) == 0) - { - aRootPath = PathInfo::RomRootPath(); - } - else - { - aRootPath = aDrive.Left(KDriveLetterLength); - aRootPath.Append(KColonBackslash); - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::CopyArrayL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::CopyArrayL(RArray& aDestArray, const RArray& aSourceArray) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::CopyArrayL()"); - TInt count = aSourceArray.Count(); - User::LeaveIfError(aDestArray.Reserve(count)); - for (TInt i = 0; i < count; i++) - { - aDestArray.AppendL(ContainerItemId(aSourceArray[i])); - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::SendProgressMessageL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::SendProgressMessageL(TInt aCurrentStep, TInt aStepCount) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::SendProgressMessageL(TInt aCurrentStep, TInt aStepCount)"); - MGlxDataSourceUpdateObserver& observer = static_cast(iRequest)->DataSourceUpdateObserver(); - - const CMPXCommand& command = static_cast(iRequest)->Command(); - __ASSERT_DEBUG(command.IsSupported(KMPXCommandGeneralSessionId), Panic(EGlxPanicCommandHasNoGeneralSessionId)); - - TAny* sessionId = command.ValueTObjectL(KMPXCommandGeneralSessionId); - - CMPXMessage* progressMessage = CMPXMessage::NewL(); - CleanupStack::PushL(progressMessage); - progressMessage->SetTObjectValueL(KMPXMessageGeneralId, KMPXMessageContentIdProgress); - progressMessage->SetTObjectValueL(TMPXAttribute(KMPXMessageContentIdProgress, EMPXMessageProgressCurrentCount), aCurrentStep); - progressMessage->SetTObjectValueL(TMPXAttribute(KMPXMessageContentIdProgress, EMPXMessageProgressTotalCount), aStepCount); - progressMessage->SetTObjectValueL(KMPXCommandGeneralSessionId, sessionId); - - observer.HandleMessage(*progressMessage); - - CleanupStack::PopAndDestroy(progressMessage); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::ContainerObjectDef -// ---------------------------------------------------------------------------- -// -TInt CGlxDataSourceTaskMdeCommand::ContainerObjectDef(CMdEObjectDef*& aContainerObjectDef) -{ - GLX_LOG_ENTRY_EXIT("TInt CGlxDataSourceTaskMdeCommand::ContainerObjectDef(CMdEObjectDef*& aContainerObjectDef)"); - //__ASSERT_DEBUG( (iCollectionUid == TUid::Uid(KGlxTagCollectionPluginImplementationUid) || iCollectionUid == TUid::Uid(KGlxCollectionPluginAlbumsImplementationUid)), Panic(EGlxPanicInvalidCollectionUid)); - TInt err = KErrNone; - if (iCollectionUid == TUid::Uid(KGlxTagCollectionPluginImplementationUid)) - { - aContainerObjectDef = &DataSource()->TagDef(); - } - else if (iCollectionUid == TUid::Uid(KGlxCollectionPluginAlbumsImplementationUid)) - { - aContainerObjectDef = &DataSource()->AlbumDef(); - } - else - { - err = KErrNotFound; - } - return err; -} - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::DoHandleAddToContainerQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::DoHandleAddToContainerQueryCompletedL - (CMdEQuery& aQuery) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoHandleAddToContainerQueryCompletedL(CMdEQuery& aQuery)"); - RPointerArray relations; - CleanupClosePushL(relations); - - TInt leftCount = iLeftIds.Count(); - TInt rightCount = iRightIds.Count(); - User::LeaveIfError(relations.Reserve(leftCount*rightCount)); // this is a bigest reservation that could be required. - for (TInt leftPos = 0; leftPos < leftCount; leftPos++) - { - for (TInt rightPos = 0; rightPos < rightCount; rightPos++) - { - // Check to see if id already exists - TBool alreadyExists = EFalse; - for(TInt queryPos = aQuery.Count() - 1; queryPos >= 0; queryPos--) - { - CMdERelation& relation = static_cast(aQuery.ResultItem(queryPos)); - if (relation.LeftObjectId() == iLeftIds[leftPos] - && relation.RightObjectId() == iRightIds[rightPos]) - { - alreadyExists = ETrue; - break; - } - } - - if (!alreadyExists) - { - CMdERelation* relation = DataSource()->Session().NewRelationL(DataSource()->ContainsDef(), iLeftIds[leftPos], iRightIds[rightPos]); - CleanupStack::PushL(relation); - relations.AppendL(relation); - CleanupStack::Pop(relation); - } - } - - } - - if (relations.Count()) - { - User::LeaveIfError(DataSource()->Session().AddItemsL(relations)); - } - - CleanupStack::PopAndDestroy(&relations); - - iLeftIds.Reset(); - iRightIds.Reset(); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::DoHandleAddContainerQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::DoHandleAddContainerQueryCompletedL - (CMdEQuery& aQuery) - - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoHandleAddContainerQueryCompletedL()"); - if (aQuery.Count()) - { - // An object (or more strickly objects) with the given container name already exist - User::Leave(KErrAlreadyExists); - } - - CMdEObject* object = NULL; - CMdEObjectDef* containerObjectDef = NULL; - TInt err = ContainerObjectDef(containerObjectDef ); - __ASSERT_ALWAYS(err == KErrNone, Panic(EGlxPanicInvalidCollectionUid)); - - object = DataSource()->Session().NewObjectLC(*containerObjectDef, KNullDesC); - - // A title property def of type text is required. - CMdEPropertyDef* titlePropertyDef = containerObjectDef->GetPropertyDefL(KPropertyDefNameTitle); - if (!titlePropertyDef || titlePropertyDef->PropertyType() != EPropertyText) - { - User::Leave(KErrCorrupt); - } - // Set the object title. - object->AddTextPropertyL (*titlePropertyDef, *iTitle); - - //ItemType property def of type text is required. - CMdEPropertyDef* itemTypePropertyDef = containerObjectDef->GetPropertyDefL(KPropertyDefItemType); - if (!itemTypePropertyDef || itemTypePropertyDef->PropertyType() != EPropertyText) - { - User::Leave(KErrCorrupt); - } - - // Checks the Container type whether it is Tag or Album - if (iCollectionUid == TUid::Uid(KGlxTagCollectionPluginImplementationUid)) - { - object->AddTextPropertyL (*itemTypePropertyDef, KTagItemType); - } - else - { - object->AddTextPropertyL (*itemTypePropertyDef, KAlbumItemType); - } - - - // A size property is required. - - CMdEPropertyDef* sizePropertyDef = containerObjectDef->GetPropertyDefL(KPropertyDefNameSize); - if (!sizePropertyDef || sizePropertyDef->PropertyType() != EPropertyUint32) - { - User::Leave(KErrCorrupt); - } - object->AddUint32PropertyL(*sizePropertyDef,0); - - - // A creation date property is required. - CMdEPropertyDef* creationDateDef = containerObjectDef->GetPropertyDefL(KPropertyDefNameCreationDate); - if (!creationDateDef || creationDateDef->PropertyType() != EPropertyTime) - { - User::Leave(KErrCorrupt); - } - - // A last modified date property is required. - CMdEPropertyDef* lmDateDef = containerObjectDef->GetPropertyDefL(KPropertyDefNameLastModifiedDate); - if (!lmDateDef || lmDateDef->PropertyType() != EPropertyTime) - { - User::Leave(KErrCorrupt); - } - - TTime uTime; - uTime.UniversalTime(); - object->AddTimePropertyL(*creationDateDef, uTime); - object->AddTimePropertyL(*lmDateDef, uTime); - - TMdEItemId id = DataSource()->Session().AddObjectL(*object); - CleanupStack::PopAndDestroy(object); - - iResponse->SetTObjectValueL(KMPXMediaGeneralId, id); - iResponse->SetTObjectValueL(KMPXMessageMediaGeneralId, id); - iResponse->SetTObjectValueL(KMPXMessageChangeEventType, EMPXItemInserted); - } -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::DoHandleDeleteContainersQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::DoHandleDeleteContainersQueryCompletedL - (CMdEQuery& aQuery) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoHandleDeleteContainersQueryCompletedL()"); - CMdEPropertyDef* albumTypeProperty = DataSource()->AlbumDef().GetPropertyDefL(KPropertyDefNameAlbumType); - TInt queryCount = aQuery.Count(); - - RArray objectsForRemoval; - CleanupClosePushL(objectsForRemoval); - User::LeaveIfError(objectsForRemoval.Reserve(queryCount)); - - RArray sucessfullyRemovedObjects; - CleanupClosePushL(sucessfullyRemovedObjects); - User::LeaveIfError(sucessfullyRemovedObjects.Reserve(queryCount)); - - // Ensure that deletion is legal and that deletion - for(TInt queryPos = 0; queryPos < queryCount; queryPos++) - { - CMdEObject& object = static_cast(aQuery.ResultItem(queryPos)); - - CMdEProperty* albumType; - TInt albumTypeIndex = object.Property(*albumTypeProperty, albumType); - if (KErrNotFound != albumTypeIndex) - { - TInt albumTypeValue = static_cast(albumType)->Value(); - if ((albumTypeValue == MdeConstants::Album::EAlbumSystemFavourite) || (albumTypeValue == MdeConstants::Album::EAlbumSystemCamera)) - { - User::Leave(KErrAccessDenied); - } - } - objectsForRemoval.AppendL(object.Id()); - } - - if (queryCount) - { - User::LeaveIfError(DataSource()->Session().RemoveObjectsL(objectsForRemoval, sucessfullyRemovedObjects)); - } - - CleanupStack::PopAndDestroy(&sucessfullyRemovedObjects); - CleanupStack::PopAndDestroy(&objectsForRemoval); - } -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::DoHandleDeleteItemsContainersQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::DoHandleDeleteItemsQueryCompletedL - (CMdEQuery& aQuery) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoHandleDeleteItemsQueryCompletedL()"); - ContentAccess::CManager *manager = ContentAccess::CManager::NewL(); - CleanupStack::PushL(manager); - TInt queryCount = aQuery.Count(); - RArray objectsForRemoval; - CleanupClosePushL(objectsForRemoval); - User::LeaveIfError(objectsForRemoval.Reserve(queryCount)); - - RArray sucessfullyRemovedObjects; - CleanupClosePushL(sucessfullyRemovedObjects); - User::LeaveIfError(sucessfullyRemovedObjects.Reserve(queryCount)); - - TInt lastErr = KErrNone; - for(TInt queryPos = queryCount - 1; queryPos >= 0; queryPos--) - { - CMdEObject& object = static_cast(aQuery.ResultItem(queryPos)); - TInt err = manager->DeleteFile(object.Uri()); - if (err != KErrNone) - { - lastErr = err; - } - objectsForRemoval.AppendL(object.Id()); - } - - User::LeaveIfError(lastErr); - - if (queryCount) - { - // Some objects may have already been removed by the harvester - DataSource()->Session().RemoveObjectsL(objectsForRemoval, sucessfullyRemovedObjects); - } - - CleanupStack::PopAndDestroy(&sucessfullyRemovedObjects); - CleanupStack::PopAndDestroy(&objectsForRemoval); - - CleanupStack::PopAndDestroy(manager); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::DoHandleRenameConainerQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::DoHandleRenameConainerQueryCompletedL - (CMdEQuery& aQuery) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoHandleRenameConainerQueryCompletedL()"); - __ASSERT_DEBUG(iObjectToRename, Panic(EGlxPanicLogicError)); - if (aQuery.Count()) - { - User::Leave(KErrAlreadyExists); - } - - CMdEObject* object = DataSource()->Session().OpenObjectL(iObjectToRename->Id(), iObjectToRename->Def()); - CleanupStack::PushL(object); - CMdEProperty* albumType; - CMdEPropertyDef* albumTypeProperty = object->Def().GetPropertyDefL(KPropertyDefNameAlbumType); - TInt albumTypeIndex = KErrNotFound; - // Must guard against non-existance of albumTypeProperty (e.g. when renaming a tag) - if (albumTypeProperty) - { - albumTypeIndex = object->Property(*albumTypeProperty, albumType); - } - if( KErrNotFound != albumTypeIndex ) - { - TInt albumTypeValue = static_cast(albumType)->Value(); - if ( albumTypeValue == MdeConstants::Album::EAlbumUserPredefined ) - { - // Want to rename a predefined, localised album name so reclassify - // the type to be a non-localised user defined album - static_cast(albumType)->SetValueL(MdeConstants::Album::EAlbumUser); - } - else if ((albumTypeValue == MdeConstants::Album::EAlbumSystemFavourite) || (albumTypeValue == MdeConstants::Album::EAlbumSystemCamera)) - { - // Cannot rename system albums - User::Leave(KErrAccessDenied); - } - } - - - CMdEPropertyDef* titlePropertyDef = object->Def().GetPropertyDefL(KPropertyDefNameTitle); - if (!titlePropertyDef || titlePropertyDef->PropertyType() != EPropertyText) - { - User::Leave(KErrCorrupt); - } - - CMdEProperty* titleProperty = NULL; - TInt index = object->Property(*titlePropertyDef, titleProperty); - if (index < KErrNotFound) - { - User::Leave(index); - } - if (index != KErrNotFound) - { - // Remove the old property - object->RemoveProperty(index); - } - // Set the object title - object->AddTextPropertyL(*titlePropertyDef, *iTitle); - - // Get time propertydef of current session object - CMdEPropertyDef* timePropertyDef = object->Def().GetPropertyDefL( - KPropertyDefNameLastModifiedDate); - - // Check the validty of the time def - if (!timePropertyDef || timePropertyDef->PropertyType() != EPropertyTime) - { - User::Leave(KErrCorrupt); - } - - // Get index and check the validity - CMdEProperty* timeProperty = NULL; - index = object->Property(*timePropertyDef, timeProperty); - - if (index < KErrNotFound) - { - User::Leave(index); - } - - if (index != KErrNotFound) - { - // Remove the old property - object->RemoveProperty(index); - } - - // Take current universal time - TTime currentTime; - currentTime.UniversalTime(); - - // Set the object current time - object->AddTimePropertyL(*timePropertyDef, currentTime); - - DataSource()->Session().CommitObjectL(*object); - CleanupStack::PopAndDestroy(object); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::DoHandleRenameConainerQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::DoHandleRenameQueryCompletedL - (CMdEQuery& aQuery) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::DoHandleRenameQueryCompletedL()"); - __ASSERT_DEBUG(aQuery.Count() == 1, Panic(EGlxPanicUnexpectedQueryResultCount )); - delete iObjectToRename; - iObjectToRename = static_cast(aQuery.TakeOwnershipOfResult(0)); - - CMdEObjectDef* containerObjectDef = NULL; - TInt err = ContainerObjectDef(containerObjectDef); - - if (err == KErrNone && 0 == iObjectToRename->Def().Compare(*containerObjectDef)) - { - AppendContainerTitleCountQueryL(ECommandRenameContainer, *iTitle); - } - else - // The object is an image or video; Rename the file using CAF and let the harvester detect the changes. - { - TParsePtrC parsePtr(iObjectToRename->Uri()); - - TFileName destinationFileName; - destinationFileName.Append(parsePtr.DriveAndPath()); - destinationFileName.Append(*iTitle); - destinationFileName.Append(parsePtr.Ext()); - - // If the destination file already exists, leave with KErrAlreadyExists - // It is up to the client to handle this error - // This check is explicitly needed because manager->RenameFile calls - // CFileMan Rename() with default behaviour of overwriting existing files - // See EDKZ-79UDW3 - RFs fs; - CleanupClosePushL( fs ); - - User::LeaveIfError( fs.Connect() ); - - if ( BaflUtils::FileExists( fs, destinationFileName ) ) - { - User::Leave( KErrAlreadyExists ); - } - - CleanupStack::PopAndDestroy( &fs ); - - if(destinationFileName.CompareF(iObjectToRename->Uri())) - { - ContentAccess::CManager *manager = ContentAccess::CManager::NewL(); - CleanupStack::PushL(manager); - - User::LeaveIfError(manager->RenameFile(iObjectToRename->Uri(), destinationFileName)); - - CleanupStack::PopAndDestroy(manager); - } - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeCommand::AppendContainerTitleCountQueryL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeCommand::AppendContainerTitleCountQueryL - (const TGlxQueryType& aQueryType, const TDesC& aTitle) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeCommand::AppendContainerTitleCountQueryL(const TGlxQueryType& aQueryType, const TDesC& aTitle)"); - // Test to see if a container alerady exists in the database with aContainerName - CMdEObjectDef* containerObjectDef = NULL; - TInt err = ContainerObjectDef(containerObjectDef); - __ASSERT_ALWAYS(err == KErrNone, Panic(EGlxPanicInvalidCollectionUid)); - - CMdEQuery* query = DataSource()->Session().NewObjectQueryL(*DataSource()->NamespaceDef(), *containerObjectDef, this); - CleanupStack::PushL(query); - - CMdEPropertyDef* titlePropertyDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameTitle); - - query->SetResultMode(EQueryResultModeCount); - - query->Conditions().AddPropertyConditionL(*titlePropertyDef, ETextPropertyConditionCompareEquals, aTitle); - - CleanupStack::Pop(query); - - AppendQueryL(query, aQueryType); - } - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdeidlist.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdeidlist.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,308 +0,0 @@ -/* -* Copyright (c) 2006 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: -* -*/ - - - -/** - * @internal reviewed 11/07/2007 by M Byrne - */ - -#include "glxdatasourcetaskmdeidlist.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "glxdatasourcemde.h" -#include "glxdatasourcemde.hrh" - -// CONSTANTS -const TInt KGlxAlbumPromotionPosition = 0; - -_LIT(KPropertyDefNameCreationDate, "CreationDate"); - -// ---------------------------------------------------------------------------- -// Constructor -// ---------------------------------------------------------------------------- -// -CGlxDataSourceTaskMdeIdList::CGlxDataSourceTaskMdeIdList(CGlxIdListRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) - : CGlxDataSourceTaskMde(aRequest, aObserver, aDataSource) - { - GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeIdList::CGlxDataSourceTaskMdeIdList()"); - iFilterProperties = TGlxFilterFactory::ExtractAttributes(iRequest->Filter()); - } - -// ---------------------------------------------------------------------------- -// Destructor -// ---------------------------------------------------------------------------- -// -CGlxDataSourceTaskMdeIdList::~CGlxDataSourceTaskMdeIdList() - { - GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeIdList::~CGlxDataSourceTaskMdeIdList()"); - // No implementation required - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::FilterAvailableComplete -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeIdList::FilterAvailableComplete( - const RArray& aIdArray, TInt aErrorCode) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeIdList::FilterAvailableComplete()"); - DoPostFilterComplete(aIdArray, aErrorCode); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeIdList::ExecuteRequestL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeIdList::ExecuteRequestL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeIdList::ExecuteRequestL()"); - CGlxIdListRequest* request = static_cast(iRequest); - TGlxMediaId container = request->ContainerId(); - TGlxQueryType queryType = EIdListQuery; - TQueryResultMode resultMode = EQueryResultModeId; - CMdEObjectDef* objectDef = &DataSource()->ObjectDef(); - TBool isContent = ETrue; - - if( KGlxCollectionRootId == container.Value() ) // The root. - { - switch(request->CollectionPluginUid().iUid) - { - - case KGlxCollectionPluginAlbumsImplementationUid: - { - isContent = EFalse; - objectDef = &DataSource()->AlbumDef(); - break; - } - case KGlxCollectionPluginCameraImplementationUid: - { - container = DataSource()->CameraAlbumId(); - objectDef = &DataSource()->AlbumDef(); - break; - } - case KGlxTagCollectionPluginImplementationUid: - { - isContent = EFalse; - objectDef = &DataSource()->TagDef(); - break; - } - case KGlxCollectionPluginMonthsImplementationUid: - { - container = DataSource()->CameraAlbumId(); - objectDef = &DataSource()->AlbumDef(); - resultMode = EQueryResultModeObjectWithoutFreetexts; - break; - } - default: - { - // default gallery query returns all objects as per filter - break; - } - } - } - else // return the content of a container - { - switch(request->CollectionPluginUid().iUid) - { - case KGlxCollectionPluginAlbumsImplementationUid: - { - objectDef = &DataSource()->AlbumDef(); - break; - } - case KGlxTagCollectionPluginImplementationUid: - { - objectDef = &DataSource()->TagDef(); - break; - } - case KGlxCollectionPluginMonthsImplementationUid: - { - AddMonthFilterL(container, iFilterProperties); - container = DataSource()->CameraAlbumId(); - objectDef = &DataSource()->AlbumDef(); - break; - } - default: - { - User::Leave(KErrNotSupported); - break; - } - } - } - - DoQueryL(*objectDef, isContent, queryType, resultMode, container); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::DoHandleQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeIdList::DoHandleQueryCompletedL(CMdEQuery& /*aQuery*/) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeIdList::DoHandleQueryCompletedL()"); - __ASSERT_DEBUG(iQueryTypes[0] == EIdListQuery, Panic(EGlxPanicLogicError)); - DoHandleListQueryCompletedL(); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeIdList::DoHandleListQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeIdList::DoHandleListQueryCompletedL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeIdList::DoHandleListQueryCompletedL()"); - if( EQueryResultModeObjectWithoutFreetexts == iQueries[0]->ResultMode() ) - { - DoMonthListCreationL(*iQueries[0], iFilterProperties); - } - else // only id or item supported - { - const RArray& localList = reinterpret_cast&>(iQueries[0]->ResultIds()); - PostFilterL(localList, iFilterProperties); - - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeIdList::DoMonthListCreationL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeIdList::DoMonthListCreationL(CMdEQuery& aQuery, - const TGlxFilterProperties& aFilterProperties) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeIdList::DoMonthListCreationL()"); - CMdEProperty* time; - CMdEPropertyDef* creationDateDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameCreationDate); - if (!creationDateDef || creationDateDef->PropertyType() != EPropertyTime) - { - User::Leave(KErrCorrupt); - } - RArray monthList; - CleanupClosePushL(monthList); - TTime lastMonth; - TTime currentMonth; - TInt count = aQuery.Count(); - for( TInt i = 0 ; i < count ; i++ ) - { - CMdEObject& object = (CMdEObject&)aQuery.ResultItem(i); - TInt timeIndex = object.Property(*creationDateDef, time); - if( KErrNotFound == timeIndex ) - { - User::Leave(KErrCorrupt); - } - currentMonth = static_cast(time)->Value(); - if( !DataSource()->SameMonth(lastMonth, currentMonth) ) - { - const TGlxMediaId monthId = DataSource()->GetMonthIdL(currentMonth); - monthList.AppendL(monthId); - lastMonth = currentMonth; - } - } - PostFilterL(monthList, aFilterProperties); - CleanupStack::PopAndDestroy(&monthList); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeIdList::DoPostFilterComplete -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeIdList::DoPostFilterComplete( - const RArray& aIdArray, TInt aErrorCode) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeIdList::DoPostFilterComplete()"); - if (aErrorCode == KErrNone) - { - TRAP(aErrorCode, ListToMediaL(aIdArray)); - } - - HandleRequestComplete(aErrorCode); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::PostFilterL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeIdList::PostFilterL(const RArray& - aFilteredList, const TGlxFilterProperties& aFilterProperties) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeIdList::PostFilterL()"); -/* if( TSize(0,0) != aFilterProperties.iThumbnailLoadability ) - { - DataSource()->ThumbnailCreator().FilterAvailableThumbnailsL - (aFilteredList.Array(), iFilterProperties.iThumbnailLoadability, *this); - } - else - { -*/ if( aFilterProperties.iPromoteSystemItems ) - { - RArray list = aFilteredList; - TInt favoritesIndex = list.Find(DataSource()->FavoritesId()); - if( KErrNotFound != favoritesIndex ) - { - list.Remove(favoritesIndex); - list.Insert(DataSource()->FavoritesId(), KGlxAlbumPromotionPosition); - } - TInt cameraAlbumIndex = list.Find(DataSource()->CameraAlbumId()); - if( KErrNotFound != cameraAlbumIndex ) - { - list.Remove(cameraAlbumIndex); - list.Insert(DataSource()->CameraAlbumId(), KGlxAlbumPromotionPosition); - } - DoPostFilterComplete(list, KErrNone); - } - else - { - DoPostFilterComplete(aFilteredList, KErrNone); - } -// } - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdethumbnail.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde/src/glxdatasourcetaskmdethumbnail.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,464 +0,0 @@ -/* -* Copyright (c) 2006 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 "glxdatasourcetaskmdethumbnail.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "glxdatasourcemde.h" -#include "glxdatasourcemde.hrh" - -// CONSTANTS - -_LIT(KPropertyDefNameDRM, "DRM"); -_LIT(KPropertyDefNameItemType, "ItemType"); -_LIT(KPropertyDefNameLastModifiedDate, "LastModifiedDate"); -_LIT(KPropertyDefNameSize, "Size"); -_LIT(KUnsupportedItemType, "video/x-pn-realvideo"); -_LIT(KUnsupportedItemType1, "video/x-pn-multirate-realvideo"); -_LIT(KUnsupportedItemType2, "video/vnd.rn-realvideo"); -_LIT(KUnsupportedItemType3, "video/x-ms-wmv"); - -// ---------------------------------------------------------------------------- -// IsUnsupportedL -// Tests to see if an item type is unsupported -// ---------------------------------------------------------------------------- -// -TBool IsUnsupportedL(CMdESession& aSession, TItemId aItemId) - { - GLX_LOG_ENTRY_EXIT("IsUnsupportedL()"); - TBool isUnsupported = EFalse; - CMdEObject* item = aSession.GetObjectL(aItemId); - - if (!item) - { - User::Leave(KErrNotFound); - } - - CleanupStack::PushL(item); - CMdEProperty* itemType = NULL; - CMdEPropertyDef* itemTypeProperty = item->Def().GetPropertyDefL(KPropertyDefNameItemType); - - TInt itemTypeIndex = item->Property(*itemTypeProperty, itemType); - if (itemTypeIndex > KErrNotFound) - { - const TDesC& des = static_cast< CMdETextProperty *>(itemType)->Value(); - if (des.Compare(KUnsupportedItemType) == 0 || - des.Compare(KUnsupportedItemType1) == 0 || - des.Compare(KUnsupportedItemType2) == 0 || - des.Compare(KUnsupportedItemType3) == 0) - { - // The item is unsupported - isUnsupported = ETrue; - } - } - CleanupStack::PopAndDestroy(item); - - return isUnsupported; - } - -// ---------------------------------------------------------------------------- -// Constructor -// ---------------------------------------------------------------------------- -// -CGlxDataSourceTaskMdeThumbnail:: CGlxDataSourceTaskMdeThumbnail(CGlxThumbnailRequest* aRequest, - MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource) - : CGlxDataSourceTaskMde(aRequest, aObserver, aDataSource) - { - GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeThumbnail::CGlxDataSourceTaskMdeThumbnail()"); - iFilterProperties = TGlxFilterFactory::ExtractAttributes(iRequest->Filter()); - } - -// ---------------------------------------------------------------------------- -// Destructor -// ---------------------------------------------------------------------------- -// -CGlxDataSourceTaskMdeThumbnail::~CGlxDataSourceTaskMdeThumbnail() - { - GLX_LOG_ENTRY_EXIT("CGlxDataSourceTaskMdeThumbnail::~CGlxDataSourceTaskMdeThumbnail()"); - if( iTnRequestStatus ) - { - CancelFetchUri(TGlxMediaId()); - } - if( iTnRequestInProgress ) - { - CGlxThumbnailRequest* request = static_cast(iRequest); - - TGlxThumbnailRequest tnReq; - request->ThumbnailRequest(tnReq); - DataSource()->ThumbnailCreator().CancelRequest(tnReq.iId); - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::ExecuteRequest -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::ExecuteRequestL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::ExecuteRequestL()"); - CGlxThumbnailRequest* request = static_cast(iRequest); - - TGlxThumbnailRequest tnReq; - request->ThumbnailRequest(tnReq); - iTnRequestInProgress = ETrue; - DataSource()->ThumbnailCreator().FetchThumbnailL(tnReq, *this); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::HandleRequestComplete -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::HandleRequestComplete(TInt aError) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::HandleRequestComplete()"); - CGlxThumbnailRequest* request = static_cast(iRequest); - if(request && !(aError == KErrNone || aError == KErrNoMemory)) - { - // An error has occured. - TBool isUnsupported = EFalse; - // If the item type is unsupported the we want to display the default - // icon rather than the corrupt icon. - TRAPD(err, isUnsupported = IsUnsupportedL(DataSource()->Session(), - TItemId(request->ItemId().Value()))); - if (isUnsupported) - { - aError = KErrNotSupported; - } - else if (err != KErrNone) - { - aError = err; - } - } - CGlxDataSourceTask::HandleRequestComplete(aError); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::DoHandleQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::DoHandleQueryCompletedL(CMdEQuery& /*aQuery*/) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::DoHandleQueryCompletedL()"); - if (EContainerFirstItemQuery == iQueryTypes[0]) - { - TRAPD(err, DoHandleContainerFirstItemQueryCompletedL()); - - if (err != KErrNone) - { - CompleteThumbnailRequest(err); - } - } - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::HandleThumbnailFetchCompleteL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::HandleThumbnailFetchCompleteL(const TGlxMediaId& aId, - TGlxThumbnailQuality aQuality) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::HandleThumbnailFetchCompleteL()"); - __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); - CGlxThumbnailRequest* req = static_cast(iRequest); - delete iResponse; - iResponse = NULL; - iResponse = CMPXMedia::NewL(); - CGlxThumbnailAttribute* tnAttribute = new (ELeave) CGlxThumbnailAttribute; - CleanupStack::PushL(tnAttribute); - TGlxThumbnailRequest tnRequest; - req->ThumbnailRequest(tnRequest); - TSize size(tnRequest.iSizeClass); - tnAttribute->iDimensions = size; - tnAttribute->iCroppingRect = tnRequest.iCroppingRect; - tnAttribute->iThumbnailQuality = aQuality; - - TUint attributeId = req->AttributeId(); - if ( GlxIsFullThumbnailAttribute(attributeId) ) - { - TBool quality = (EGlxThumbnailQualityHigh == aQuality); - attributeId = GlxFullThumbnailAttributeId(quality, - size.iWidth, size.iHeight); - } - - iResponse->SetTObjectValueL(KMPXMediaGeneralId, aId.Value()); - iResponse->SetNoNewLCObjectL( - TMPXAttribute(KGlxMediaIdThumbnail, attributeId), tnAttribute); - CleanupStack::PopAndDestroy(tnAttribute); - } - -// ----------------------------------------------------------------------------- -// ThumbnailFetchComplete -// Notifies that a thumbnail for a given item is available, or that -// thumbnail generation failed. -// ----------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete( - const TGlxMediaId& aItemId, TGlxThumbnailQuality aQuality, TInt aErrorCode) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete()"); - iTnRequestInProgress = EFalse; - TInt err = aErrorCode; - if(!err) - { - TRAP(err, HandleThumbnailFetchCompleteL(aItemId, aQuality)); - } - HandleRequestComplete(err); - } - - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::ThumbnailDeletionComplete -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::ThumbnailDeletionComplete( - const TGlxMediaId& /*aItemId*/, TInt /*aErrorCode*/) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::ThumbnailDeletionComplete()"); - } - - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::FilterAvailableComplete -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::FilterAvailableComplete( - const RArray& /*aIdArray*/, TInt /*aErrorCode*/) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::FilterAvailableComplete()"); - // No implementation - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL(CGlxtnFileInfo* aInfo, - const TGlxMediaId& aItemId, TRequestStatus* aStatus) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL()"); - __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); - CGlxThumbnailRequest* request = static_cast(iRequest); - if(request->ThumbnailInfo()) - { - aInfo->CopyInfoL(*request->ThumbnailInfo()); - *aStatus = KRequestPending; - User::RequestComplete(aStatus, KErrNone); - return; - } - - CMdEObject* item = DataSource()->Session().GetObjectL((TMdEItemId)aItemId.Value()); - if(!item) - { - User::Leave(KErrNotFound); - } - - CleanupStack::PushL(item); - iTnRequestStatus = aStatus; - iTnFileInfo = aInfo; - *iTnRequestStatus = KRequestPending; - - CGlxDataSource::TContainerType containerType = DataSource()->ContainerType(item); - if( CGlxDataSource::EContainerTypeNotAContainer != containerType ) - { - iTnFileInfo->iTemporary = ETrue; - - TGlxMediaId container = aItemId; - CMdEObjectDef* objectDef = &item->Def(); - - /// @todo: use default filter so we can ensure we always get correct first item if filters change - iFilterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; - iFilterProperties.iSortDirection = EGlxFilterSortDirectionDescending; - iFilterProperties.iLastCaptureDate = ETrue; - - if( CGlxDataSource::EContainerTypeMonth == containerType ) - { - AddMonthFilterL(item, iFilterProperties); - container = DataSource()->CameraAlbumId(); - objectDef = &DataSource()->AlbumDef(); - } - - DoQueryL(*objectDef, ETrue, EContainerFirstItemQuery, EQueryResultModeObjectWithoutFreetexts, container); - } - else - { - CompleteFetchFileInfoL(item); - } - - CleanupStack::PopAndDestroy(item); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::CompleteFetchFileInfoL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::CompleteFetchFileInfoL(CMdEObject* aItem) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::CompleteFetchFileInfoL()"); - TParsePtrC parser(aItem->Uri()); - iTnFileInfo->SetFilePathL(parser.FullName()); - - CMdEProperty* size; - CMdEPropertyDef* sizeProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameSize); - TInt sizeIndex = aItem->Property(*sizeProperty, size); - if( KErrNotFound == sizeIndex ) - { - iTnFileInfo->iFileSize = 0; - } - else - { - iTnFileInfo->iFileSize = static_cast< CMdEInt32Property *>(size)->Value(); - } - - CMdEProperty* lastModifiedDateProperty; - CMdEPropertyDef* lastModifiedDatePropertyDef = aItem->Def().GetPropertyDefL(KPropertyDefNameLastModifiedDate); - -#ifdef _DEBUG - TInt index = // This variable is only required for the assert debug below. If it is not wrapped in an - // #ifdef _DEBUG, it will cause a warning in non debug builds. -#endif - aItem->Property(*lastModifiedDatePropertyDef, lastModifiedDateProperty); - __ASSERT_DEBUG(index > KErrNotFound, Panic(EGlxPanicRequiredPropertyNotFound)); - - iTnFileInfo->iFileTime = static_cast(lastModifiedDateProperty)->Value(); - - CGlxDataSource::TItemType itemType = DataSource()->ItemType(aItem); - iTnFileInfo->iIsVideo = ( CGlxDataSource::EItemTypeVideo == itemType ); - - CMdEProperty* drmProtected; - CMdEPropertyDef* drmProtectedProperty = aItem->Def().GetPropertyDefL(KPropertyDefNameDRM); - TInt drmProtectedIndex = aItem->Property(*drmProtectedProperty, drmProtected); - TInt err = KErrNone; - if( KErrNotFound == drmProtectedIndex) - { - // should be present for all normally harvested images - // so this should only be where we didn't pre-fetch the attributes - // i.e. background thumbnail generation - // so we get status from CAF to avoid forcing second stage harvest - TRAP(err, - ContentAccess::CContent* content = ContentAccess::CContent::NewLC(iTnFileInfo->FilePath()); - content->GetAttribute(ContentAccess::EIsProtected, iTnFileInfo->iIsProtected); - CleanupStack::PopAndDestroy(content); - ); - } - else - { - iTnFileInfo->iIsProtected = static_cast(drmProtected)->Value(); - } - - CompleteThumbnailRequest(err); - iTnFileInfo = NULL; - iTnRequestStatus = NULL; - } - - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::CancelFetchUri -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::CancelFetchUri(const TGlxMediaId& /*aItemId*/) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::CancelFetchUri()"); - CompleteThumbnailRequest(KErrCancel); - } - - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::ThumbnailStorage -// ---------------------------------------------------------------------------- -// -MGlxtnThumbnailStorage* CGlxDataSourceTaskMdeThumbnail::ThumbnailStorage() - { - GLX_LOG_ENTRY_EXIT("MGlxtnThumbnailStorage* CGlxDataSourceTaskMdeThumbnail::ThumbnailStorage()"); - return &DataSource()->ThumbnailDatabase(); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::DoHandleContainerFirstItemQueryCompletedL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::DoHandleContainerFirstItemQueryCompletedL() - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::DoHandleContainerFirstItemQueryCompletedL()"); - if( !iQueries[0]->Count() ) - { - User::Leave(KErrGlxEmptyContainer); // leave with a specific Error code so UI can display empty folder icon - } - - CMdEObject* item = static_cast(iQueries[0]->TakeOwnershipOfResult(0)); - if(!item) - { - User::Leave(KErrNotFound); - } - - CleanupStack::PushL(item); - CompleteFetchFileInfoL(item); - CleanupStack::PopAndDestroy(item); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest(TInt aError) - { - GLX_LOG_ENTRY_EXIT("void CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest()"); - if (iTnRequestStatus) - { - *iTnRequestStatus = KRequestPending; - User::RequestComplete(iTnRequestStatus, aError); - iTnFileInfo = NULL; - iTnRequestStatus = NULL; - } - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/group/glxdatasourcemde.mmp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/group/glxdatasourcemde.mmp Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/group/glxdatasourcemde.mmp Wed Oct 06 14:49:39 2010 +0530 @@ -46,15 +46,11 @@ SOURCE glxdatasourcetaskmdscommand.cpp SOURCE glxdatasourcetaskmdsidlist.cpp SOURCE glxdatasourcetaskmdsthumbnail.cpp - -// if you comment the lines below out, Photos dB will be used for thumbnail fetching -MACRO USE_S60_TNM -#define USE_S60_TNM +SOURCE glxtnfileinfo.cpp // System includes from the source tree SYSTEMINCLUDE ../../../../../../commonutilities/common/inc SYSTEMINCLUDE ../../../../../../inc -SYSTEMINCLUDE ../../../../thumbnailcreator/inc SYSTEMINCLUDE ../../../manager/inc SYSTEMINCLUDE ../inc @@ -81,12 +77,8 @@ LIBRARY fbscli.lib LIBRARY glxcommon.lib LIBRARY glxdatasourcemanager.lib -#ifdef USE_S60_TNM LIBRARY thumbnailmanager.lib LIBRARY bitgdi.lib -#else -LIBRARY glxthumbnailcreator.lib -#endif LIBRARY inetprotutil.lib LIBRARY lbs.lib LIBRARY mdeclient.lib diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.h Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.h Wed Oct 06 14:49:39 2010 +0530 @@ -40,26 +40,17 @@ #include #include - -#include #include - -#ifdef USE_S60_TNM #include #include #include #include #include "mthumbnailfetchrequestobserver.h" -#endif #include "glxdatasource.h" // FORWARD DECLARATIONS class CGlxRequest; -#ifndef USE_S60_TNM -class CGlxtnThumbnailCreator; -class CGlxtnThumbnailDatabase; -#endif class CGlxDataSourceMde ; const TUid KHarvesterPSShutdown = { 0x200009F5 } ; @@ -169,12 +160,8 @@ public MMdEObjectPresentObserver, public MMdERelationObserver, public MMdERelationPresentObserver, - public MHarvesterEventObserver -#ifdef USE_S60_TNM - , public MThumbnailManagerObserver -#else - , public MGlxtnThumbnailStorageObserver -#endif + public MHarvesterEventObserver, + public MThumbnailManagerObserver { public: static CGlxDataSourceMde* NewL(); @@ -197,27 +184,10 @@ HarvesterEventState aHarvesterEventState, TInt aItemsLeft ); -#ifdef USE_S60_TNM public: void FetchThumbnailL(CGlxRequest* aRequest, MThumbnailFetchRequestObserver& aObserver); TInt CancelFetchThumbnail(); -#else -private: - // from MGlxtnThumbnailStorageObserver - /** - * Notify that a given thumbnail is available in storage. - * @param aId Media item ID. - * @param aSize Requested thumbnail size. - */ - void ThumbnailAvailable(const TGlxMediaId& aId, const TSize& aSize); - /** - * Notify that a given thumbnail is available in storage. - * @param aId Media item ID. - * @param aSize Thumbnail size. - */ - void BackgroundThumbnailError(const TGlxMediaId& aId, TInt aError); -#endif private: /** @@ -257,14 +227,12 @@ void HandleRelationPresentNotification(CMdESession& aSession, TBool aPresent, const RArray& aRelationIdArray); -#ifdef USE_S60_TNM // from MThumbnailManagerObserver void ThumbnailPreviewReady( MThumbnailData& aThumbnail, TThumbnailRequestId aId ); void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId ); -#endif private: void BackgroundThumbnailMessageL(const TGlxMediaId& aId, const TSize& aSize, @@ -289,13 +257,11 @@ void TaskStartedL(); -#ifdef USE_S60_TNM /* * This function doesnt add up any value, added to reduce compiler warnings */ void ThumbnailReadyL( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId, TBool aQuality ); -#endif public: @@ -303,12 +269,6 @@ inline CMdESession& Session() const; -#ifndef USE_S60_TNM - inline CGlxtnThumbnailCreator& ThumbnailCreator() const; - - inline CGlxtnThumbnailDatabase& ThumbnailDatabase() const; -#endif - inline RFs& FileServerSession(); inline const TGlxMediaId& CameraAlbumId() const; @@ -360,7 +320,6 @@ void ShutdownNotification(TInt aShutdownState); private: -#ifdef USE_S60_TNM MThumbnailFetchRequestObserver* iTnFetchObserver; CThumbnailManager* iTnEngine; CFbsBitmap* iTnThumbnail; @@ -370,11 +329,6 @@ TInt iTnHandle; TGlxMediaId iMediaId; -#else - CGlxtnThumbnailCreator* iThumbnailCreator; - CGlxtnThumbnailDatabase* iThumbnailDatabase; -#endif - CMdESession* iSession; RFs iFs; TBool iSessionOpen; diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.inl --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.inl Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcemds.inl Wed Oct 06 14:49:39 2010 +0530 @@ -33,26 +33,6 @@ return *iSession; } -#ifndef USE_S60_TNM -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::ThumbnailCreator -// ---------------------------------------------------------------------------- -// -CGlxtnThumbnailCreator& CGlxDataSourceMde::ThumbnailCreator() const - { - return *iThumbnailCreator; - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceMde::ThumbnailDatabase -// ---------------------------------------------------------------------------- -// -CGlxtnThumbnailDatabase& CGlxDataSourceMde::ThumbnailDatabase() const - { - return *iThumbnailDatabase; - } -#endif - // ---------------------------------------------------------------------------- // CGlxDataSourceMde::FileServerSession // ---------------------------------------------------------------------------- diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmds.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmds.h Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmds.h Wed Oct 06 14:49:39 2010 +0530 @@ -31,13 +31,11 @@ #include #include #include -#include #include // FORWARD DECLARATIONS class CGlxDataSourceMde; class CGlxRequest; -class CGlxtnThumbnailCreator; class CMdEObjectDef; class CMdEObjectQuery; class CMdESession; diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdscommand.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdscommand.h Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdscommand.h Wed Oct 06 14:49:39 2010 +0530 @@ -30,7 +30,6 @@ #include #include #include -#include #include #include "glxdatasourcetaskmds.h" diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsidlist.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsidlist.h Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsidlist.h Wed Oct 06 14:49:39 2010 +0530 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: Data Source Task MDS IDlist class * */ @@ -31,14 +31,12 @@ #include #include #include -#include #include #include #include "glxdatasourcetaskmds.h" // FORWARD DECLARATIONS class CGlxDataSourceMde; class CGlxIdListRequest; -class CGlxtnThumbnailCreator; class CMdEObjectDef; class CMdEObjectQuery; class CMdESession; @@ -47,9 +45,7 @@ * CGlxDataSourceTaskMdeIdList class * Task to handle id list requests. */ -NONSHARABLE_CLASS(CGlxDataSourceTaskMdeIdList) : public CGlxDataSourceTaskMde, - public MGlxtnThumbnailCreatorClient - +NONSHARABLE_CLASS(CGlxDataSourceTaskMdeIdList) : public CGlxDataSourceTaskMde { public: /** @@ -65,46 +61,7 @@ * Destructor. */ ~CGlxDataSourceTaskMdeIdList(); - -private: // from MGlxtnThumbnailCreatorClient - /** - * Not used (pure virtual stubbed) - * See @ref MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete - */ - void ThumbnailFetchComplete(const TGlxMediaId& /*aItemId*/, - TGlxThumbnailQuality /*aQuality*/, TInt /*aErrorCode*/) {}; - /** - * Not used (pure virtual stubbed) - * See @ref MGlxtnThumbnailCreatorClient::ThumbnailDeletionComplete - */ - void ThumbnailDeletionComplete(const TGlxMediaId& /*aItemId*/, - TInt /*aErrorCode*/) {}; - - /** - * See @ref MGlxtnThumbnailCreatorClient::FilterAvailableComplete - */ - void FilterAvailableComplete(const RArray& aIdArray, - TInt aErrorCode); - /** - * Not used (pure virtual stubbed) - * See @ref MGlxtnThumbnailCreatorClient::FetchFileInfoL - */ - void FetchFileInfoL(CGlxtnFileInfo* /*aInfo*/, - const TGlxMediaId& /*aItemId*/, TRequestStatus* /*aStatus*/) {}; - - /** - * Not used (pure virtual stubbed) - * See @ref MGlxtnThumbnailCreatorClient::CancelFetchUri - */ - void CancelFetchUri(const TGlxMediaId& /*aItemId*/) {}; - - /** - * Not used (pure virtual stubbed) - * See @ref MGlxtnThumbnailCreatorClient::ThumbnailStorage - */ - MGlxtnThumbnailStorage* ThumbnailStorage() { return NULL; }; - public: // From CGlxDataSourceTask /** * See @ref CGlxDataSourceTask::ExecuteRequestL diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsthumbnail.h --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsthumbnail.h Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxdatasourcetaskmdsthumbnail.h Wed Oct 06 14:49:39 2010 +0530 @@ -25,24 +25,16 @@ */ #include "glxdatasourcetaskmdsattribute.h" +#include "mthumbnailfetchrequestobserver.h" -#ifdef USE_S60_TNM -#include "mthumbnailfetchrequestobserver.h" -#endif - -#include #include /** * CGlxDataSourceTaskMdeThumnail class * Services thumbnail requests */ -NONSHARABLE_CLASS(CGlxDataSourceTaskMdeThumbnail) : public CGlxDataSourceTaskMde -#ifdef USE_S60_TNM - , public MThumbnailFetchRequestObserver -#else - , public MGlxtnThumbnailCreatorClient -#endif +NONSHARABLE_CLASS(CGlxDataSourceTaskMdeThumbnail) : public CGlxDataSourceTaskMde, + public MThumbnailFetchRequestObserver { public: /** @@ -75,44 +67,9 @@ */ void DoHandleQueryCompletedL(CMdEQuery& aQuery); -#ifdef USE_S60_TNM private: //MThumbnailFetchRequestObserver void ThumbnailFetchComplete(TInt aError, TBool aQuality); void FetchFileInfoL(); -#endif - -private: // From MGlxtnThumbnailCreatorClient - /** - * See @ref MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete - */ - void ThumbnailFetchComplete(const TGlxMediaId& aItemId, - TGlxThumbnailQuality aQuality, TInt aErrorCode); - - /** - * See @ref MGlxtnThumbnailCreatorClient::ThumbnailDeletionComplete - */ - void ThumbnailDeletionComplete(const TGlxMediaId& aItemId, TInt aErrorCode); - - /** - * See @ref MGlxtnThumbnailCreatorClient::FilterAvailableComplete - */ - void FilterAvailableComplete(const RArray& aIdArray, TInt aErrorCode); - - /** - * See @ref MGlxtnThumbnailCreatorClient::FetchFileInfoL - */ - void FetchFileInfoL(CGlxtnFileInfo* aInfo, const TGlxMediaId& aItemId, - TRequestStatus* aStatus); - - /** - * See @ref MGlxtnThumbnailCreatorClient::CancelFetchUri - */ - void CancelFetchUri(const TGlxMediaId& aItemId); - - /** - * See @ref MGlxtnThumbnailCreatorClient::ThumbnailStorage - */ - MGlxtnThumbnailStorage* ThumbnailStorage(); private: void HandleThumbnailFetchCompleteL(const TGlxMediaId& aId, diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxtnfileinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxtnfileinfo.h Wed Oct 06 14:49:39 2010 +0530 @@ -0,0 +1,81 @@ +/* +* 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 C_GLXTNFILEINFO_H +#define C_GLXTNFILEINFO_H + +#include + +/** + * Object holding information about a file to be thumbnailed. + * + */ +class CGlxtnFileInfo : public CBase + { +public: + inline CGlxtnFileInfo(); + inline ~CGlxtnFileInfo(); + + /** + * Copy info from one object to another. + */ + inline void CopyInfoL(CGlxtnFileInfo& aInfo); + + /** + * Get the full path to the media file. + * @return Media file path. + */ + inline const TDesC& FilePath() const; + + /** + * Set the full path to the media file. + * @param aPath Media file path (takes ownership). + */ + inline void SetFilePath(HBufC* aPath); + + /** + * Set the full path to the media file. + * @param aPath Media file path. + */ + inline void SetFilePathL(const TDesC& aPath); + + /** + * Set the full path to the media file. + * @param aIsVideo Set to true if the file is a video. + * @param aIsProtected Set to true if the file is DRM protected. + */ + void IdentifyFileL(TBool& aIsVideo, TBool& aIsProtected); + +public: + /** Size of the media file */ + TInt iFileSize; + /** Last modified time of the media file */ + TTime iFileTime; + /** True if the thumbnail is temporary and should not be stored */ + TBool iTemporary; + TBool iIsVideo; + TBool iIsProtected; + +private: + /** Full path of the media file */ + HBufC* iFilePath; + }; + +#include "glxtnfileinfo.inl" + +#endif // C_GLXTNFILEINFO_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxtnfileinfo.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxtnfileinfo.inl Wed Oct 06 14:49:39 2010 +0530 @@ -0,0 +1,81 @@ +/* +* 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: +* +*/ + + +// ----------------------------------------------------------------------------- +// Constructor +// ----------------------------------------------------------------------------- +// +inline CGlxtnFileInfo::CGlxtnFileInfo() + { + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +inline CGlxtnFileInfo::~CGlxtnFileInfo() + { + delete iFilePath; + } + +// ----------------------------------------------------------------------------- +// CopyInfoL +// ----------------------------------------------------------------------------- +// +inline void CGlxtnFileInfo::CopyInfoL(CGlxtnFileInfo& aInfo) + { + SetFilePathL(aInfo.FilePath()); + iFileSize = aInfo.iFileSize; + iFileTime = aInfo.iFileTime; + iTemporary = aInfo.iTemporary; + iIsVideo = aInfo.iIsVideo; + iIsProtected = aInfo.iIsProtected; + } + +// ----------------------------------------------------------------------------- +// FilePath +// Get the full path to the media file. +// ----------------------------------------------------------------------------- +// +inline const TDesC& CGlxtnFileInfo::FilePath() const + { + return *iFilePath; + } + +// ----------------------------------------------------------------------------- +// SetFilePathL +// Set the full path to the media file. +// ----------------------------------------------------------------------------- +// +inline void CGlxtnFileInfo::SetFilePath(HBufC* aPath) + { + delete iFilePath; + iFilePath = aPath; + } + +// ----------------------------------------------------------------------------- +// SetFilePathL +// Set the full path to the media file. +// ----------------------------------------------------------------------------- +// +inline void CGlxtnFileInfo::SetFilePathL(const TDesC& aPath) + { + delete iFilePath; + iFilePath = NULL; + iFilePath = aPath.AllocL(); + } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxtnthumbnailrequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxtnthumbnailrequest.h Wed Oct 06 14:49:39 2010 +0530 @@ -0,0 +1,57 @@ +/* +* 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 T_GLXTHUMBNAILREQUEST_H +#define T_GLXTHUMBNAILREQUEST_H + +#include "glxmediaid.h" +#include "glxthumbnailinfo.h" + +class TGlxThumbnailRequest + { +public: + enum TPriorityMode + { + EPrioritizeSpeed, // Speed of thumbnail provisioning is mode important that quality + EPrioritizeQuality, // Quality of thumbnail provisioning is mode important that speed + }; + +public: + inline TGlxThumbnailRequest(); + + inline TGlxThumbnailRequest(TGlxMediaId aId, + const TSize& aSizeClass, TPriorityMode aPriorityMode, + TInt aBitmapHandle, TBool aDrmAllowed); + + inline TGlxThumbnailRequest(TGlxMediaId aId, + const TSize& aSizeClass, TPriorityMode aPriorityMode, + TInt aBitmapHandle, TBool aDrmAllowed, + const TRect& aCroppingRect, TGlxThumbnailFilter aFilter); + +public: + TGlxMediaId iId; + TSize iSizeClass; + TPriorityMode iPriorityMode; + TInt iBitmapHandle; // Handle of target bitmap for the thumbnail + TBool iDrmAllowed; // True if client has DRM capability + TRect iCroppingRect; + TGlxThumbnailFilter iFilter; + }; + +#include "glxtnthumbnailrequest.inl" + +#endif // T_GLXTHUMBNAILREQUEST_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxtnthumbnailrequest.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/inc/glxtnthumbnailrequest.inl Wed Oct 06 14:49:39 2010 +0530 @@ -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 "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: +* +*/ + + +inline TGlxThumbnailRequest::TGlxThumbnailRequest() : + iPriorityMode(EPrioritizeQuality), iBitmapHandle(0), + iDrmAllowed(EFalse), iFilter(EGlxThumbnailFilterNone) + { + } + +inline TGlxThumbnailRequest::TGlxThumbnailRequest(TGlxMediaId aId, + const TSize& aSizeClass, TPriorityMode aPriorityMode, + TInt aBitmapHandle, TBool aDrmAllowed) : + iId(aId), iSizeClass(aSizeClass), iPriorityMode(aPriorityMode), + iBitmapHandle(aBitmapHandle), iDrmAllowed(aDrmAllowed), + iFilter(EGlxThumbnailFilterNone) + { + } + +inline TGlxThumbnailRequest::TGlxThumbnailRequest(TGlxMediaId aId, + const TSize& aSizeClass, TPriorityMode aPriorityMode, + TInt aBitmapHandle, TBool aDrmAllowed, + const TRect& aCroppingRect, TGlxThumbnailFilter aFilter) : + iId(aId), iSizeClass(aSizeClass), iPriorityMode(aPriorityMode), + iBitmapHandle(aBitmapHandle), iDrmAllowed(aDrmAllowed), + iCroppingRect(aCroppingRect), iFilter(aFilter) + { + } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcemds.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcemds.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcemds.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -29,12 +29,6 @@ #include #include #include - -#ifndef USE_S60_TNM -#include -#include -#endif - #include #include #include @@ -49,13 +43,7 @@ #include "glxdatasourcetaskmdsidlist.h" #include "glxdatasourcetaskmdsthumbnail.h" -#ifdef USE_S60_TNM const TInt KMaxGridThumbnailWidth = 200; -#else -const TInt KGlxThumbnailCleanupAfterDeletions = 200; - -_LIT(KGlxMdeDataSourceThumbnailDatabase, "glxmdstn"); -#endif _LIT(KObjectDefLocation, "Location"); _LIT(KObjectDefNameAlbum, "Album"); @@ -234,7 +222,6 @@ TRACER("CGlxDataSourceMde::~CGlxDataSourceMde()"); delete iSession; -#ifdef USE_S60_TNM delete iTnThumbnail; iTnThumbnail = NULL; @@ -243,13 +230,7 @@ delete iTnEngine; iTnEngine = NULL; -#else - if (iThumbnailCreator) - { - iThumbnailCreator->Close(iThumbnailDatabase); - } - delete iThumbnailDatabase; -#endif + iFs.Close(); iHC.Close(); RFbsSession::Disconnect(); @@ -287,15 +268,9 @@ User::LeaveIfError(RFbsSession::Connect()); -#ifdef USE_S60_TNM iTnEngine = CThumbnailManager::NewL( *this); iTnEngine->SetDisplayModeL( EColor16M ); iTnRequestInProgress = EFalse; -#else - iThumbnailCreator = CGlxtnThumbnailCreator::InstanceL(); - iThumbnailDatabase = CGlxtnThumbnailDatabase::NewL( - KGlxMdeDataSourceThumbnailDatabase, this); -#endif iCreateSessionCallback = new ( ELeave ) CAsyncCallBack( TCallBack( CreateSession, this ), CActive::EPriorityHigh ); @@ -422,30 +397,6 @@ } } -#ifndef USE_S60_TNM -// --------------------------------------------------------------------------- -// ThumbnailAvailable -// --------------------------------------------------------------------------- -// -void CGlxDataSourceMde::ThumbnailAvailable(const TGlxMediaId& - /*aId*/, const TSize& /*aSize*/) - { - TRACER("CGlxDataSourceMde::ThumbnailAvailable(const TGlxMediaId& /*aId*/, const TSize& /*aSize*/)"); - //No implementation - } - -// --------------------------------------------------------------------------- -// BackgroundThumbnailError -// --------------------------------------------------------------------------- -// -void CGlxDataSourceMde::BackgroundThumbnailError(const TGlxMediaId& aId, TInt aError) - { - TRACER("CGlxDataSourceMde::BackgroundThumbnailError(const TGlxMediaId& aId, TInt aError)"); - TSize size(0, 0); - TRAP_IGNORE(BackgroundThumbnailMessageL(aId, size, aError)); - } -#endif - // --------------------------------------------------------------------------- // BackgroundThumbnailMessageL // --------------------------------------------------------------------------- @@ -580,29 +531,6 @@ GLX_DEBUG1("HandleObjectNotification - ProcessUpdateArray"); ProcessUpdateArray(aObjectIdArray, MPXChangeEventType(aType), ETrue); -#ifndef USE_S60_TNM - if(MPXChangeEventType(aType) == EMPXItemDeleted ) - { - TInt count = aObjectIdArray.Count(); - iDeletedCount += count; - GLX_DEBUG3("EMPXItemDeleted - aObjectIdArray.Count()=%d, iDeletedCount=%d", - count, iDeletedCount); - if(iDeletedCount > KGlxThumbnailCleanupAfterDeletions) - { - TRAPD(err, ThumbnailCreator().CleanupThumbnailsL(iThumbnailDatabase)); - if(!err) - { - iDeletedCount = 0; - } - } - } - - if(MPXChangeEventType(aType) == EMPXItemModified ) - { - GLX_DEBUG1("HandleObjectNotification - EMPXItemModified"); - TRAP_IGNORE(ThumbnailCreator().CleanupThumbnailsL(iThumbnailDatabase)); - } -#endif } // --------------------------------------------------------------------------- @@ -1058,7 +986,6 @@ iPauseUpdate = ETrue; } -#ifdef USE_S60_TNM void CGlxDataSourceMde::FetchThumbnailL(CGlxRequest* aRequest, MThumbnailFetchRequestObserver& aObserver) { @@ -1210,7 +1137,6 @@ iTnRequestInProgress = EFalse; } } -#endif // --------------------------------------------------------------------------- // CGlxDataSourceMde diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmds.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmds.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmds.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -40,9 +40,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -103,11 +101,7 @@ { TRACER("CGlxDataSourceTaskMde::ConstructL()"); CreateResponseL(); -#ifdef USE_S60_TNM DataSource()->CancelFetchThumbnail(); -#else - DataSource()->ThumbnailCreator().CancelRequest( TGlxMediaId(0) ); -#endif } // ---------------------------------------------------------------------------- diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsattribute.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsattribute.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsattribute.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -36,9 +36,7 @@ #include #include #include -#include #include -#include #include #include #include diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdscommand.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdscommand.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdscommand.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -28,8 +28,6 @@ #include #include #include -#include -#include #include #include #include @@ -136,11 +134,7 @@ { TRACER("CGlxDataSourceTaskMdeCommand::ConstructL()"); iResponse = CMPXCommand::NewL(static_cast(iRequest)->Command()); -#ifdef USE_S60_TNM DataSource()->CancelFetchThumbnail(); -#else - DataSource()->ThumbnailCreator().CancelRequest( TGlxMediaId(0) ); -#endif iTimer = CPeriodic::NewL(CActive::EPriorityStandard); iSchedulerWait = new (ELeave) CActiveSchedulerWait(); @@ -490,10 +484,6 @@ void CGlxDataSourceTaskMdeCommand::ThumbnailCleanupL() { TRACER("CGlxDataSourceTaskMdeCommand::ThumbnailCleanupL()"); -#ifndef USE_S60_TNM - CGlxDataSourceMde* ds = DataSource(); - ds->ThumbnailCreator().CleanupThumbnailsL(&ds->ThumbnailDatabase()); -#endif HandleRequestComplete(KErrNone); } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsidlist.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsidlist.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsidlist.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -42,9 +42,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -96,17 +94,6 @@ } // ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMde::FilterAvailableComplete -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeIdList::FilterAvailableComplete( - const RArray& aIdArray, TInt aErrorCode) - { - TRACER("CGlxDataSourceTaskMdeIdList::FilterAvailableComplete()") - DoPostFilterComplete(aIdArray, aErrorCode); - } - -// ---------------------------------------------------------------------------- // CGlxDataSourceTaskMdeIdList::ExecuteRequestL // ---------------------------------------------------------------------------- // @@ -246,6 +233,10 @@ const TGlxFilterProperties& aFilterProperties) { TRACER("CGlxDataSourceTaskMdeIdList::DoMonthListCreationL()") +#ifdef _DEBUG + TTime startTime; + startTime.HomeTime(); +#endif CMdEProperty* time; CMdEPropertyDef& creationDateDef = DataSource()->ObjectDef().GetPropertyDefL(KPropertyDefNameCreationDate); if (creationDateDef.PropertyType() != EPropertyTime) @@ -280,6 +271,12 @@ GLX_DEBUG2("CGlxDataSourceTaskMdeIdList::DoMonthListCreationL monthList.Count=%d", monthList.Count()); PostFilterL(monthList, aFilterProperties); CleanupStack::PopAndDestroy(&monthList); +#ifdef _DEBUG + TTime stopTime; + stopTime.HomeTime(); + GLX_DEBUG2("GlxDataSrcTaskMdeIdList:DoMonthListCreationL() took %d us", + (TInt)stopTime.MicroSecondsFrom(startTime).Int64()); +#endif } // ---------------------------------------------------------------------------- diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsthumbnail.cpp --- a/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsthumbnail.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxdatasourcetaskmdsthumbnail.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -36,9 +36,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -129,24 +127,9 @@ CGlxDataSourceTaskMdeThumbnail::~CGlxDataSourceTaskMdeThumbnail() { TRACER("CGlxDataSourceTaskMdeThumbnail::~CGlxDataSourceTaskMdeThumbnail()") -#ifdef USE_S60_TNM DataSource()->CancelFetchThumbnail(); delete iTnFileInfo; iTnFileInfo = NULL; -#else - if( iTnRequestStatus ) - { - CancelFetchUri(TGlxMediaId()); - } - if( iTnRequestInProgress ) - { - CGlxThumbnailRequest* request = static_cast(iRequest); - - TGlxThumbnailRequest tnReq; - request->ThumbnailRequest(tnReq); - DataSource()->ThumbnailCreator().CancelRequest(tnReq.iId); - } -#endif } // ---------------------------------------------------------------------------- @@ -167,7 +150,6 @@ tnReq.iSizeClass.iWidth, tnReq.iSizeClass.iHeight); GLX_DEBUG2("CGlxDataSourceTaskMdeThumbnail::ExecuteRequestL() iPriorityMode=%d", tnReq.iPriorityMode); -#ifdef USE_S60_TNM if(request->ThumbnailInfo()) { if (tnReq.iSizeClass.iWidth > 0 && tnReq.iSizeClass.iHeight > 0 ) @@ -183,10 +165,6 @@ { FetchFileInfoL(); } -#else - iTnRequestInProgress = ETrue; - DataSource()->ThumbnailCreator().FetchThumbnailL(tnReq, *this); -#endif } // ---------------------------------------------------------------------------- @@ -278,7 +256,6 @@ CleanupStack::PopAndDestroy(tnAttribute); } -#ifdef USE_S60_TNM void CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete(TInt aError, TBool aQuality) { @@ -298,131 +275,6 @@ } HandleRequestComplete(err); } -#else -// ----------------------------------------------------------------------------- -// ThumbnailFetchComplete -// Notifies that a thumbnail for a given item is available, or that -// thumbnail generation failed. -// ----------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete( - const TGlxMediaId& aItemId, TGlxThumbnailQuality aQuality, TInt aErrorCode) - { - TRACER("CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete()") - GLX_DEBUG2("CGlxDataSourceTaskMdeThumbnail::ThumbnailFetchComplete() aErrorCode=%d", aErrorCode); - iTnRequestInProgress = EFalse; - TInt err = aErrorCode; - if(!err) - { - TRAP(err, HandleThumbnailFetchCompleteL(aItemId, aQuality)); - } - HandleRequestComplete(err); - } - - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::ThumbnailDeletionComplete -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::ThumbnailDeletionComplete( - const TGlxMediaId& /*aItemId*/, TInt /*aErrorCode*/) - { - TRACER("CGlxDataSourceTaskMdeThumbnail::ThumbnailDeletionComplete()") - } - - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::FilterAvailableComplete -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::FilterAvailableComplete( - const RArray& /*aIdArray*/, TInt /*aErrorCode*/) - { - TRACER("CGlxDataSourceTaskMdeThumbnail::FilterAvailableComplete()") - // No implementation - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL(CGlxtnFileInfo* aInfo, - const TGlxMediaId& aItemId, TRequestStatus* aStatus) - { - TRACER("CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL()") - __ASSERT_DEBUG(dynamic_cast(iRequest), Panic(EGlxPanicLogicError)); - CGlxThumbnailRequest* request = static_cast(iRequest); - if(request->ThumbnailInfo()) - { - aInfo->CopyInfoL(*request->ThumbnailInfo()); - *aStatus = KRequestPending; - User::RequestComplete(aStatus, KErrNone); - return; - } - - CMdEObject* item = DataSource()->Session().GetObjectL((TItemId)aItemId.Value()); - if(!item) - { - User::Leave(KErrNotFound); - } - - CleanupStack::PushL(item); - iTnRequestStatus = aStatus; - iTnFileInfo = aInfo; - *iTnRequestStatus = KRequestPending; - - CGlxDataSource::TContainerType containerType = DataSource()->ContainerType(item); - if( CGlxDataSource::EContainerTypeNotAContainer != containerType ) - { - iTnFileInfo->iTemporary = ETrue; - - TGlxMediaId container = aItemId; - CMdEObjectDef* objectDef = &item->Def(); - - /// @todo: use default filter so we can ensure we always get correct first item if filters change - iFilterProperties.iSortOrder = EGlxFilterSortOrderCaptureDate; - iFilterProperties.iSortDirection = EGlxFilterSortDirectionOverrideToDescendingIfDate; - iFilterProperties.iLastCaptureDate = ETrue; - - if( CGlxDataSource::EContainerTypeMonth == containerType ) - { - iFilterProperties.iOrigin = EGlxFilterOriginAll; - AddMonthFilterL(item, iFilterProperties); - container = TGlxMediaId(KGlxCollectionRootId); - objectDef = &DataSource()->ObjectDef(); - } - - DoQueryL(*objectDef, ETrue, EContainerFirstItemQuery, - EQueryResultModeItem, container); - } - else - { - CompleteFetchFileInfoL(item); - } - - CleanupStack::PopAndDestroy(item); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::CancelFetchUri -// ---------------------------------------------------------------------------- -// -void CGlxDataSourceTaskMdeThumbnail::CancelFetchUri(const TGlxMediaId& /*aItemId*/) - { - TRACER("CGlxDataSourceTaskMdeThumbnail::CancelFetchUri()") - CompleteThumbnailRequest(KErrCancel); - } - -// ---------------------------------------------------------------------------- -// CGlxDataSourceTaskMdeThumbnail::ThumbnailStorage -// ---------------------------------------------------------------------------- -// -MGlxtnThumbnailStorage* CGlxDataSourceTaskMdeThumbnail::ThumbnailStorage() - { - TRACER("CGlxDataSourceTaskMdeThumbnail::ThumbnailStorage()") - return &DataSource()->ThumbnailDatabase(); - } -#endif // ---------------------------------------------------------------------------- // CGlxDataSourceTaskMdeThumbnail::CompleteFetchFileInfoL @@ -529,7 +381,6 @@ { TRACER("CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest(TInt aError)") GLX_DEBUG2("CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest aError=%d", aError); -#ifdef USE_S60_TNM if (aError != KErrNone) { ThumbnailFetchComplete(aError, EFalse); @@ -553,17 +404,9 @@ GLX_LOG_INFO("CGlxDataSourceTaskMdeThumbnail::CompleteThumbnailRequest KErrArgument"); ThumbnailFetchComplete(KErrArgument, EFalse); } - } -#else - if (iTnRequestStatus) - { - *iTnRequestStatus = KRequestPending; - User::RequestComplete(iTnRequestStatus, aError); - } -#endif + } } -#ifdef USE_S60_TNM // ---------------------------------------------------------------------------- // CGlxDataSourceTaskMdeThumbnail::FetchFileInfoL // ---------------------------------------------------------------------------- @@ -616,5 +459,3 @@ CleanupStack::PopAndDestroy(item); } - -#endif diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxtnfileinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/engine/collectionframework/datasource/plugins/glxdatasourcemde2.5/src/glxtnfileinfo.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -0,0 +1,33 @@ +/* +* 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: Implementation of CGlxtnFileInfo +* +*/ + + +#include "glxtnfileinfo.h" + +#include +// ----------------------------------------------------------------------------- +// IdentifyFileL +// ----------------------------------------------------------------------------- +// +void CGlxtnFileInfo::IdentifyFileL(TBool& aIsVideo, TBool& aIsProtected) + { + TRACER("void CGlxtnFileInfo::IdentifyFileL()"); + User::LeaveIfNull(iFilePath); + + aIsVideo = iIsVideo; + aIsProtected = iIsProtected; + } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/datasource/plugins/group/bld.inf --- a/engine/collectionframework/datasource/plugins/group/bld.inf Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/datasource/plugins/group/bld.inf Wed Oct 06 14:49:39 2010 +0530 @@ -18,9 +18,4 @@ PRJ_MMPFILES - -#ifdef GLX_USE_MDS_2_0 -#include "../glxdatasourcemde/group/bld.inf" -#else #include "../glxdatasourcemde2.5/group/bld.inf" -#endif diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/group/bld.inf --- a/engine/collectionframework/group/bld.inf Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/group/bld.inf Wed Oct 06 14:49:39 2010 +0530 @@ -17,7 +17,6 @@ -#include "../thumbnailcreator/group/bld.inf" #include //APP_LAYER_DOMAIN_EXPORT_PATH PRJ_TESTEXPORTS diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/plugins/glxcollectionpluginall/group/glxcollectionpluginall.mmp --- a/engine/collectionframework/plugins/glxcollectionpluginall/group/glxcollectionpluginall.mmp Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/plugins/glxcollectionpluginall/group/glxcollectionpluginall.mmp Wed Oct 06 14:49:39 2010 +0530 @@ -43,7 +43,6 @@ SYSTEMINCLUDE ../../../../../inc SYSTEMINCLUDE ../../../../../gallery/loc SYSTEMINCLUDE ../../../datasource/manager/inc -SYSTEMINCLUDE ../../../thumbnailcreator/inc // System includes from epoc32/include APP_LAYER_SYSTEMINCLUDE diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/plugins/glxcollectionplugincamera/group/glxcollectionplugincamera.mmp --- a/engine/collectionframework/plugins/glxcollectionplugincamera/group/glxcollectionplugincamera.mmp Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/plugins/glxcollectionplugincamera/group/glxcollectionplugincamera.mmp Wed Oct 06 14:49:39 2010 +0530 @@ -45,7 +45,6 @@ SYSTEMINCLUDE ../../../../../inc SYSTEMINCLUDE ../../../../../gallery/loc SYSTEMINCLUDE ../../../datasource/manager/inc -SYSTEMINCLUDE ../../../thumbnailcreator/inc // System includes from epoc32/include APP_LAYER_SYSTEMINCLUDE diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/plugins/glxcollectionplugincamera/src/glxcollectionplugincamera.cpp --- a/engine/collectionframework/plugins/glxcollectionplugincamera/src/glxcollectionplugincamera.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/plugins/glxcollectionplugincamera/src/glxcollectionplugincamera.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -371,7 +371,7 @@ // TGlxFilterProperties CGlxCollectionPluginCamera::DefaultFilter(TInt aLevel) { - TRACER("CGlxCollectionPluginDownloads::DefaultFilter"); + TRACER("CGlxCollectionPluginCamera::DefaultFilter"); __ASSERT_DEBUG(( (aLevel == KGlxCollectionRootLevel) || (aLevel == KGlxCollectionRootLevel+1) || (aLevel == KGlxCollectionRootLevel+2) ), Panic(EGlxPanicInvalidPathLevel)); diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/plugins/glxcollectionplugindownloads/group/glxcollectionplugindownloads.mmp --- a/engine/collectionframework/plugins/glxcollectionplugindownloads/group/glxcollectionplugindownloads.mmp Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/plugins/glxcollectionplugindownloads/group/glxcollectionplugindownloads.mmp Wed Oct 06 14:49:39 2010 +0530 @@ -45,7 +45,6 @@ SYSTEMINCLUDE ../../../../../inc SYSTEMINCLUDE ../../../../../gallery/loc SYSTEMINCLUDE ../../../datasource/manager/inc -SYSTEMINCLUDE ../../../thumbnailcreator/inc // System includes for epoc32/include diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/plugins/glxcollectionpluginmonths/group/glxcollectionpluginmonths.mmp --- a/engine/collectionframework/plugins/glxcollectionpluginmonths/group/glxcollectionpluginmonths.mmp Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/plugins/glxcollectionpluginmonths/group/glxcollectionpluginmonths.mmp Wed Oct 06 14:49:39 2010 +0530 @@ -43,7 +43,6 @@ SYSTEMINCLUDE ../../../../../inc SYSTEMINCLUDE ../../../../../gallery/loc SYSTEMINCLUDE ../../../datasource/manager/inc -SYSTEMINCLUDE ../../../thumbnailcreator/inc // System includes for epoc32/include APP_LAYER_SYSTEMINCLUDE diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/plugins/tagcollectionplugin/group/glxcollectionplugintags.mmp --- a/engine/collectionframework/plugins/tagcollectionplugin/group/glxcollectionplugintags.mmp Mon Sep 27 15:13:20 2010 +0530 +++ b/engine/collectionframework/plugins/tagcollectionplugin/group/glxcollectionplugintags.mmp Wed Oct 06 14:49:39 2010 +0530 @@ -58,7 +58,6 @@ SYSTEMINCLUDE ../../../../../gallery/loc //Gallery Loc SYSTEMINCLUDE ../../../datasource/manager/inc //DataSource Include SYSTEMINCLUDE ../../../../../commonutilities/common/inc -SYSTEMINCLUDE ../../../thumbnailcreator/inc // System includes from epoc32/include diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/Cenrep/02000A09.cre Binary file engine/collectionframework/thumbnailcreator/Cenrep/02000A09.cre has changed diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/Cenrep/02000A09.txt Binary file engine/collectionframework/thumbnailcreator/Cenrep/02000A09.txt has changed diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/Cenrep/keys_thumbnailcreator.xls Binary file engine/collectionframework/thumbnailcreator/Cenrep/keys_thumbnailcreator.xls has changed diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/bwins/glxthumbnailcreatoru.def --- a/engine/collectionframework/thumbnailcreator/bwins/glxthumbnailcreatoru.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -EXPORTS - ?CancelRequest@CGlxtnThumbnailCreator@@QAEXABVTGlxMediaId@@@Z @ 1 NONAME ; void CGlxtnThumbnailCreator::CancelRequest(class TGlxMediaId const &) - ?CleanupThumbnailsL@CGlxtnThumbnailCreator@@QAEXPAVMGlxtnThumbnailStorage@@@Z @ 2 NONAME ; void CGlxtnThumbnailCreator::CleanupThumbnailsL(class MGlxtnThumbnailStorage *) - ?Close@CGlxtnThumbnailCreator@@QAEXPAVMGlxtnThumbnailStorage@@@Z @ 3 NONAME ; void CGlxtnThumbnailCreator::Close(class MGlxtnThumbnailStorage *) - ?DeleteThumbnailsL@CGlxtnThumbnailCreator@@QAEXABVTGlxMediaId@@AAVMGlxtnThumbnailCreatorClient@@@Z @ 4 NONAME ; void CGlxtnThumbnailCreator::DeleteThumbnailsL(class TGlxMediaId const &, class MGlxtnThumbnailCreatorClient &) - ?FetchThumbnailL@CGlxtnThumbnailCreator@@QAEXABVTGlxThumbnailRequest@@AAVMGlxtnThumbnailCreatorClient@@@Z @ 5 NONAME ; void CGlxtnThumbnailCreator::FetchThumbnailL(class TGlxThumbnailRequest const &, class MGlxtnThumbnailCreatorClient &) - ?FilterAvailableThumbnailsL@CGlxtnThumbnailCreator@@QAEXABV?$TArray@VTGlxMediaId@@@@ABVTSize@@AAVMGlxtnThumbnailCreatorClient@@@Z @ 6 NONAME ; void CGlxtnThumbnailCreator::FilterAvailableThumbnailsL(class TArray const &, class TSize const &, class MGlxtnThumbnailCreatorClient &) - ?InstanceL@CGlxtnThumbnailCreator@@SAPAV1@XZ @ 7 NONAME ; class CGlxtnThumbnailCreator * CGlxtnThumbnailCreator::InstanceL(void) - ?NewL@CGlxtnThumbnailDatabase@@SAPAV1@ABVTDesC16@@PAVMGlxtnThumbnailStorageObserver@@@Z @ 8 NONAME ; class CGlxtnThumbnailDatabase * CGlxtnThumbnailDatabase::NewL(class TDesC16 const &, class MGlxtnThumbnailStorageObserver *) - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/conf/thumbnailcreator.confml Binary file engine/collectionframework/thumbnailcreator/conf/thumbnailcreator.confml has changed diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/conf/thumbnailcreator_02000A09.crml Binary file engine/collectionframework/thumbnailcreator/conf/thumbnailcreator_02000A09.crml has changed diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/eabi/glxthumbnailcreatoru.def --- a/engine/collectionframework/thumbnailcreator/eabi/glxthumbnailcreatoru.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -EXPORTS - _ZN22CGlxtnThumbnailCreator13CancelRequestERK11TGlxMediaId @ 1 NONAME - _ZN22CGlxtnThumbnailCreator15FetchThumbnailLERK20TGlxThumbnailRequestR28MGlxtnThumbnailCreatorClient @ 2 NONAME - _ZN22CGlxtnThumbnailCreator17DeleteThumbnailsLERK11TGlxMediaIdR28MGlxtnThumbnailCreatorClient @ 3 NONAME - _ZN22CGlxtnThumbnailCreator18CleanupThumbnailsLEP22MGlxtnThumbnailStorage @ 4 NONAME - _ZN22CGlxtnThumbnailCreator26FilterAvailableThumbnailsLERK6TArrayI11TGlxMediaIdERK5TSizeR28MGlxtnThumbnailCreatorClient @ 5 NONAME - _ZN22CGlxtnThumbnailCreator5CloseEP22MGlxtnThumbnailStorage @ 6 NONAME - _ZN22CGlxtnThumbnailCreator9InstanceLEv @ 7 NONAME - _ZN23CGlxtnThumbnailDatabase4NewLERK7TDesC16P30MGlxtnThumbnailStorageObserver @ 8 NONAME - _ZTI22CGlxtnThumbnailCreator @ 9 NONAME ; ## - _ZTI23CGlxtnThumbnailDatabase @ 10 NONAME ; ## - _ZTV22CGlxtnThumbnailCreator @ 11 NONAME ; ## - _ZTV23CGlxtnThumbnailDatabase @ 12 NONAME ; ## - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/group/bld.inf --- a/engine/collectionframework/thumbnailcreator/group/bld.inf Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* 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: Build information file for project glxthumbnailcreator. -* -*/ - - -// Lines removed while reverting task 8396 -//#include - -PRJ_MMPFILES -../group/glxthumbnailcreator.mmp -../thumbnailcomposerplugin/glxthumbnailcomposerplugin.mmp - -PRJ_TESTEXPORTS -../../../../gallery/data/Battle.jpg /epoc32/winscw/c/TncTest/test.jpg -../../../../gallery/data/Image1.jpg /epoc32/winscw/c/TncTest/no_exif.jpg -../test/data/tall.jpg /epoc32/winscw/c/TncTest/tall.jpg -../test/data/wide.jpg /epoc32/winscw/c/TncTest/wide.jpg -../test/data/red_1x1.jpg /epoc32/winscw/c/TncTest/red_1x1.jpg -../test/data/corrupt.jpg /epoc32/winscw/c/TncTest/corrupt.jpg - -// Lines removed while reverting task 8396 -//PRJ_EXPORTS -//../cenrep/02000A09.txt /epoc32/data/z/private/10202be9/02000A09.txt -//../cenrep/02000A09.txt /epoc32/release/winscw/udeb/z/private/10202be9/02000A09.txt -//../conf/thumbnailcreator.confml CONFML_EXPORT_PATH(thumbnailcreator.confml,customsw) -//../conf/thumbnailcreator_02000A09.crml CRML_EXPORT_PATH(thumbnailcreator_02000A09.crml,customsw) - -// Generic configuration interface for component cenrep settings -// component_1000292B implementation specifics for cenrep data -// component_12345678 implementation specifics for genconf ml data - -//gnumakefile bld_cenrep_entry.mk - - -PRJ_TESTMMPFILES -../test/group/ut_cglxtndeletethumbnailstask.mmp -../test/group/ut_cglxtnfilteravailabletask.mmp -../test/group/ut_cglxtngeneratethumbnailtask.mmp -../test/group/ut_cglxtnquickthumbnailtask.mmp -../test/group/ut_cglxtnzoomedimagetask.mmp diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/group/create-ut_cglxtngeneratethumbnailtask-sis.bat --- a/engine/collectionframework/thumbnailcreator/group/create-ut_cglxtngeneratethumbnailtask-sis.bat Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: -rem - - - -@echo off -echo. -echo ==================================== -echo. -echo Digia EUnit - Test -echo. -echo This BAT copies Test DLL -echo to local folder and makes SIS file -echo. -echo ==================================== -echo. - -:CHECK_EPOCROOT -echo. -echo - verify epoc root -set EPOCROOT -if errorlevel == 1 goto END_ERROR - -:COPY_DLL -echo. -echo - copy test dll to current directory -copy %EPOCROOT%epoc32\release\thumb\urel\ut_cglxtngeneratethumbnailtask.dll . -if errorlevel == 1 goto END_ERROR - -:CREATE_DIR -echo. -echo - create Sis folder (created only if needed) -mkdir ..\Sis - -:MAKESIS -echo. -echo - makesis ut_cglxtngeneratethumbnailtask.pkg ..\sis\ut_cglxtngeneratethumbnailtask.sis -call makesis ut_cglxtngeneratethumbnailtask.pkg ..\sis\ut_cglxtngeneratethumbnailtask.sis -if errorlevel == 1 goto END_ERROR - -:DELETE_DLL -echo. -echo - remove the copied dll from current folder -del ut_cglxtngeneratethumbnailtask.dll -goto END - -:END_ERROR -echo. -echo Sis creation failed. -goto FINAL_END - -:END -echo. -echo Sis file created succesfully -echo ============================ - -:FINAL_END -echo. - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/group/create-ut_cglxtnquickthumbnailtask-sis.bat --- a/engine/collectionframework/thumbnailcreator/group/create-ut_cglxtnquickthumbnailtask-sis.bat Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: -rem - - - - -@echo off -echo. -echo ==================================== -echo. -echo Digia EUnit - Test -echo. -echo This BAT copies Test DLL -echo to local folder and makes SIS file -echo. -echo ==================================== -echo. - -:CHECK_EPOCROOT -echo. -echo - verify epoc root -set EPOCROOT -if errorlevel == 1 goto END_ERROR - -:COPY_DLL -echo. -echo - copy test dll to current directory -copy %EPOCROOT%epoc32\release\thumb\urel\ut_cglxtnquickthumbnailtask.dll . -if errorlevel == 1 goto END_ERROR - -:CREATE_DIR -echo. -echo - create Sis folder (created only if needed) -mkdir ..\Sis - -:MAKESIS -echo. -echo - makesis ut_cglxtnquickthumbnailtask.pkg ..\sis\ut_cglxtnquickthumbnailtask.sis -call makesis ut_cglxtnquickthumbnailtask.pkg ..\sis\ut_cglxtnquickthumbnailtask.sis -if errorlevel == 1 goto END_ERROR - -:DELETE_DLL -echo. -echo - remove the copied dll from current folder -del ut_cglxtnquickthumbnailtask.dll -goto END - -:END_ERROR -echo. -echo Sis creation failed. -goto FINAL_END - -:END -echo. -echo Sis file created succesfully -echo ============================ - -:FINAL_END -echo. - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/group/glxthumbnailcreator.mmp --- a/engine/collectionframework/thumbnailcreator/group/glxthumbnailcreator.mmp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* 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: -* -*/ - - - -#include -#include -#include //APP_LAYER_SYSTEMINCLUDE - -#include "../../../../group/glxbuildcommon.mmh" - - -TARGET glxthumbnailcreator.dll -TARGETTYPE dll -UID 0x1000008d 0x02000A09 - -#ifndef WINSCW -EPOCALLOWDLLDATA -#endif -CAPABILITY CAP_GENERAL_DLL - -SOURCEPATH ../src - -SOURCE glxtnbackgroundgenerationtask.cpp -SOURCE glxtncleanuptask.cpp -SOURCE glxtndatabase.cpp -SOURCE glxtndeletethumbnailstask.cpp -SOURCE glxtnfileinfo.cpp -SOURCE glxtnfileutility.cpp -SOURCE glxtnfilteravailabletask.cpp -SOURCE glxtngeneratethumbnailtask.cpp -SOURCE glxtnimagedecoderfactory.cpp -SOURCE glxtnimageutility.cpp -SOURCE glxtnloadthumbnailtask.cpp -SOURCE glxtnquickthumbnailtask.cpp -SOURCE glxtnsavethumbnailtask.cpp -SOURCE glxtntaskmanager.cpp -SOURCE glxtntask.cpp -SOURCE glxtnthumbnailcreator.cpp -SOURCE glxtnvideoutility.cpp -SOURCE glxtnvolumedatabase.cpp -SOURCE glxtnzoomedimagetask.cpp - -USERINCLUDE ../inc -// System includes from the source tree -SYSTEMINCLUDE ../../../../inc -SYSTEMINCLUDE ../../../../commonutilities/common/inc - - -// System includes from epoc32/include -APP_LAYER_SYSTEMINCLUDE - - -LIBRARY ihl.lib // For IHL Library -LIBRARY bitgdi.lib -LIBRARY caf.lib -//Line removed while reverting task 8396 -//LIBRARY bafl.lib -LIBRARY edbms.lib -LIBRARY efsrv.lib -LIBRARY estor.lib -LIBRARY euser.lib -LIBRARY exiflib.lib -LIBRARY fbscli.lib -LIBRARY glxcommon.lib -LIBRARY iclextjpegapi.lib -LIBRARY imageconversion.lib -LIBRARY platformenv.lib -//Line removed while reverting task 8396 -//LIBRARY centralrepository.lib -LIBRARY flogger.lib // For Logging Tracer -#ifdef ENABLE_VED -LIBRARY vedengine.lib -#else -LIBRARY tneengine.lib -#endif - -SMPSAFE -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/group/ut_cglxtngeneratethumbnailtask.pkg --- a/engine/collectionframework/thumbnailcreator/group/ut_cglxtngeneratethumbnailtask.pkg Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -; -; Copyright (c) 2004 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: -; - -; Supported languages -&en - -; Package header (one name for each supported language) -#{"ut_cglxtngeneratethumbnailtask"},(0x01700000),0,10,0 - -; Package signature - - -; Options line not supported currently - -; Conditions blocks not supported currently - -; Language independent files that are always installed -"ut_cglxtngeneratethumbnailtask.dll"-"!:\DigiaEUnit\Tests\ut_cglxtngeneratethumbnailtask.dll" - -; Language dependent files - - -; Requisites (of type: (UID),Major,Minor,Build-Number,{"Requisite Name1", "Requisite Name2"}) -(0x101F6F88), 0, 0, 0, {"Series60ProductID"} diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/group/ut_cglxtnquickthumbnailtask.pkg --- a/engine/collectionframework/thumbnailcreator/group/ut_cglxtnquickthumbnailtask.pkg Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -; -; Copyright (c) 2004 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: -; - -; Supported languages -&en - -; Package header (one name for each supported language) -#{"ut_cglxtnquickthumbnailtask"},(0x01700000),0,10,0 - -; Package signature - - -; Options line not supported currently - -; Conditions blocks not supported currently - -; Language independent files that are always installed -"ut_cglxtnquickthumbnailtask.dll"-"!:\DigiaEUnit\Tests\ut_cglxtnquickthumbnailtask.dll" - -; Language dependent files - - -; Requisites (of type: (UID),Major,Minor,Build-Number,{"Requisite Name1", "Requisite Name2"}) -(0x101F6F88), 0, 0, 0, {"Series60ProductID"} diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnbackgroundgenerationtask.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtnbackgroundgenerationtask.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -/* -* 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: Thumbnail background generation task implementation -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef GLXTNBACKGROUNDGENERATIONTASK_H -#define GLXTNBACKGROUNDGENERATIONTASK_H - -// INCLUDES - -#include "glxtnsavethumbnailtask.h" -#include - -// CONSTANTS - -// MACROS - -// DATA TYPES - -// FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -class CGlxtnFileUtility; -class CGlxtnImageUtility; -class CGlxtnVideoUtility; - -// CLASS DECLARATION - -/** -* Background task to generate a thumbnail. -* -* @author Dan Rhodes -* @ingroup glx_thumbnail_creator -*/ -NONSHARABLE_CLASS(CGlxtnBackgroundGenerationTask) : public CGlxtnSaveThumbnailTask - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param iItemId Media ID of item to thumbnail. - * @param aFileUtility File utility for use by the task. - * @param aClient Client initiating the request. - */ - static CGlxtnBackgroundGenerationTask* NewL( - const TGlxMediaId& iItemId, CGlxtnFileUtility& aFileUtility, - MGlxtnThumbnailCreatorClient& aClient, - CGlxSettingsModel::TSupportedOrientations aSupportedOrientations); - - /** - * Destructor. - */ - virtual ~CGlxtnBackgroundGenerationTask(); - - private: // From CGlxtnTask - TBool DoStartL(TRequestStatus& aStatus); - void DoCancel(); - TBool DoRunL(TRequestStatus& aStatus); - TBool DoRunError(TInt aError); - - private: - /** - * C++ default constructor. - * @param iItemId Media ID of item to thumbnail. - * @param aFileUtility File utility for use by the task. - * @param aClient Client initiating the request. - */ - CGlxtnBackgroundGenerationTask(const TGlxMediaId& iItemId, - CGlxtnFileUtility& aFileUtility, - MGlxtnThumbnailCreatorClient& aClient, - CGlxSettingsModel::TSupportedOrientations aSupportedOrientations); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Check whether next size already exists or needs to be generated. - * @param aStatus Request status for the asynchronous operation. - * @return ETrue if the task has issued an asyncronous request. - */ - TBool CheckNextL(TRequestStatus& aStatus); - - /** - * Create the next size to be generated. - * @param aStatus Request status for the asynchronous operation. - * @return ETrue if the task has issued an asyncronous request. - */ - TBool ProcessNextL(TRequestStatus& aStatus); - - /** - * Filter the thumbnail for the next required size. - * @param aStatus Request status for the asynchronous operation. - */ - void FilterThumbnailL(TRequestStatus& aStatus); - - /** - * Scale the thumbnail to the next required size. - * @param aStatus Request status for the asynchronous operation. - */ - void ScaleThumbnailL(TRequestStatus& aStatus); - - /** - * Decode the image for the required size. - * @param aStatus Request status for the asynchronous operation. - */ - void DecodeImageL(TRequestStatus& aStatus); - - private: // Data - /** Pointer to client, or NULL after client goes away */ - MGlxtnThumbnailCreatorClient* iClient; - /** File utility */ - CGlxtnFileUtility& iFileUtility; - /** Array of sizes to check if need to generate */ - RArray iSizes; - /** Array of sizes to generate */ - RArray iTodoSizes; - /** Utility to get thumbnail from image */ - CGlxtnImageUtility* iImageUtility; - /** Utility to get thumbnail from video */ - CGlxtnVideoUtility* iVideoUtility; - /** Image loaded from file */ - CFbsBitmap* iImage; - /** Image loaded from file */ - CFbsBitmap* iFilteredImage; - /** Flag to show BadFileMarker not created so no need to delete **/ - TBool iBadFileMarkerNotNeededFlag; - /** Flag to show whether image has been decoded yet **/ - TBool iImageDecoded; - /** Flag to show which orientations are supported **/ - CGlxSettingsModel::TSupportedOrientations iSupportedOrientations; - - }; - -#endif // GLXTNBACKGROUNDGENERATIONTASK_H - -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtncleanuptask.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtncleanuptask.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* -* 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: Thumbnail storage cleanup task implementation -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef GLXTNCLEANUPTASK_H -#define GLXTNCLEANUPTASK_H - -// INCLUDES - -#include "glxtntask.h" - -// CONSTANTS - -// MACROS - -// DATA TYPES - -// FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// CLASS DECLARATION - -/** -* Background task to clean thumbnail storage of thumbnails for files which no -* longer exist. -* -* @author Dan Rhodes -* @ingroup glx_thumbnail_creator -*/ -NONSHARABLE_CLASS(CGlxtnCleanupTask) : public CGlxtnTask - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aStorage Client's storage interface. - */ - static CGlxtnCleanupTask* NewL(MGlxtnThumbnailStorage* aStorage); - - /** - * Destructor. - */ - virtual ~CGlxtnCleanupTask(); - - private: // From CGlxtnTask - TBool DoStartL(TRequestStatus& aStatus); - void DoCancel(); - TBool DoRunL(TRequestStatus& aStatus); - TBool DoRunError(TInt aError); - - private: - /** - * C++ default constructor. - * @param aStorage Client's storage interface. - */ - CGlxtnCleanupTask(MGlxtnThumbnailStorage* aStorage); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Data - }; - -#endif // GLXTNCLEANUPTASK_H - -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtndatabase.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtndatabase.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +0,0 @@ -/* -* 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: Thumbnail storage implementation -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef GLXTNDATABASE_H -#define GLXTNDATABASE_H - -// INCLUDES - -#include -#include -#include "mglxtnstorage.h" -#include "mglxtnvolumedatabaseobserver.h" - -// CONSTANTS - -// MACROS - -// DATA TYPES - -// FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -class CGlxtnVolumeDatabase; - -// CLASS DECLARATION - -/** -* Default implementation of thumbnail storage. -* -* @author Dan Rhodes -* @ingroup glx_thumbnail_creator -*/ -class CGlxtnThumbnailDatabase : public CBase, public MGlxtnThumbnailStorage, - public MGlxtnVolumeDatabaseObserver - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aDbFilename Filename (without path) for database. - * @param aStorageObserver Observer of storage operations. - */ - IMPORT_C static CGlxtnThumbnailDatabase* NewL(const TDesC& aDbFilename, - MGlxtnThumbnailStorageObserver* aStorageObserver = NULL); - - /** - * Destructor. - */ - virtual ~CGlxtnThumbnailDatabase(); - - public: // New functions - - public: // Functions from MGlxtnThumbnailStorage - void LoadThumbnailDataL(HBufC8*& aData, TGlxImageDataFormat& aFormat, - const TGlxMediaId& aId, const CGlxtnFileInfo& aFileInfo, - const TSize& aSize, TRequestStatus* aStatus); - void SaveThumbnailDataL(const TDesC8& aData, - TGlxImageDataFormat aFormat, const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, const TSize& aSize, - TRequestStatus* aStatus); - void DeleteThumbnailsL(const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, TRequestStatus* aStatus); - void CleanupThumbnailsL(TRequestStatus* aStatus); - void IsThumbnailAvailableL(const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, - const TSize& aSize, TRequestStatus* aStatus); - void StorageCancel(); - void NotifyBackgroundError(const TGlxMediaId& aId, TInt aError); - - private: // From MGlxtnVolumeDatabaseObserver - void HandleDatabaseError(TInt aError); - void HandleThumbnailIdFromMediaIdL( - const TGlxtnThumbnailId& aThumbId ); - void HandleThumbnailIdFromFilenameL( - const TGlxtnThumbnailId& aThumbId ); - void HandleThumbnailIdStoredL(); - void HandleThumbnail(TGlxImageDataFormat aFormat, HBufC8* aData); - void HandleThumbnailStored(); - void HandleMediaIdDeletedL(); - void HandleThumbnailsDeletedL(); - void HandleItemDeletedL(); - void HandleAvailabilityChecked(TInt aResult); - void HandleDatabaseCleanedL(); - - private: - - /** - * C++ default constructor. - */ - CGlxtnThumbnailDatabase(); - - /** - * By default Symbian 2nd phase constructor is private. - * @param aDbFilename Filename (without path) for database. - * @param aStorageObserver Observer of storage operations. - */ - void ConstructL(const TDesC& aDbFilename, - MGlxtnThumbnailStorageObserver* aStorageObserver); - - /** - * Continue current operation after receiving the thumbnail ID. - */ - void DoHandleThumbnailIdL(); - - /** - * Open a volume database on the specified drive. - * @param aDrive String beginnning with drive letter and colon. - */ - CGlxtnVolumeDatabase* OpenDatabaseL(const TDesC& aDrive); - - private: // Data - enum TDatabaseOperation - { - ELoading, ESaving, EDeleting, ECleaning, ECheckingAvailable - }; - - /** Pointer to a storage observer */ - MGlxtnThumbnailStorageObserver* iStorageObserver; - /** File server session */ - RFs iFs; - /** Path to the database files (excluding drive letter) */ - TFileName iDatabasePath; - /** Drive name of the phone memory drive */ - TDriveName iInternalDrive; - /** Array of open databases (one per volume) */ - RPointerArray iDatabaseArray; - /** Request status for asynchronous operation */ - TRequestStatus* iClientStatus; - /** Operation currently being carried out by the database */ - TDatabaseOperation iCurrentOperation; - /** Media ID for request */ - TGlxMediaId iMediaId; - /** URI for request (not owned) */ - const CGlxtnFileInfo* iFileInfo; - /** Thumbnail size for request */ - TSize iSize; - /** Data buffer for load request */ - HBufC8** iLoadData; - /** Data buffer for save request */ - TPtrC8 iSaveData; - /** Thumbnail format for load request */ - TGlxImageDataFormat* iLoadFormat; - /** Thumbnail format for save request */ - TGlxImageDataFormat iSaveFormat; - /** ID for thumbnail */ - TGlxtnThumbnailId iThumbId; - /** Index to count through iDatabaseArray */ - TInt iDatabaseIndex; - }; - -#endif // GLXTNDATABASE_H - -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtndeletethumbnailstask.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtndeletethumbnailstask.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* -* 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: Definition of CGlxtnDeleteThumbnailsTask -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef C_GLXTNDELETETHUMBNAILSTASK_H -#define C_GLXTNDELETETHUMBNAILSTASK_H - -// INCLUDES - -#include "glxtntask.h" - -// CONSTANTS - -// MACROS - -// DATA TYPES - -// FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -class CGlxtnFileInfo; - -// CLASS DECLARATION - -/** -* Task to delete all stored thumbnails for a media item. -* -* @author Dan Rhodes -* @ingroup glx_thumbnail_creator -*/ -NONSHARABLE_CLASS(CGlxtnDeleteThumbnailsTask) : public CGlxtnClientTask - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param iItemId Media ID of item whose thumbnails should be deleted. - * @param aClient Client initiating the request. - */ - static CGlxtnDeleteThumbnailsTask* NewL(const TGlxMediaId& aItemId, - MGlxtnThumbnailCreatorClient& aClient); - - /** - * Destructor. - */ - virtual ~CGlxtnDeleteThumbnailsTask(); - - protected: // From CGlxtnTask - - TBool DoStartL(TRequestStatus& aStatus); - void DoCancel(); - TBool DoRunL(TRequestStatus& aStatus); - TBool DoRunError(TInt aError); - - private: - - /** - * C++ default constructor. - * @param iItemId Media ID of item whose thumbnails should be deleted. - * @param aClient Client initiating the request. - */ - CGlxtnDeleteThumbnailsTask(const TGlxMediaId& aItemId, - MGlxtnThumbnailCreatorClient& aClient); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Data - /** File information for item whose thumbnails are to be deleted */ - CGlxtnFileInfo* iInfo; - /** Whether delete operation has been started */ - TBool iDeleting; - }; - -#endif // C_GLXTNDELETETHUMBNAILSTASK_H - -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnfileinfo.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtnfileinfo.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* -* 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: Definition of CGlxtnFileInfo -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef C_GLXTNFILEINFO_H -#define C_GLXTNFILEINFO_H - -#include - -/** - * Object holding information about a file to be thumbnailed. - * - * @author Dan Rhodes - * @ingroup glx_thumbnail_creator - */ -class CGlxtnFileInfo : public CBase - { -public: - inline CGlxtnFileInfo(); - inline ~CGlxtnFileInfo(); - - /** - * Copy info from one object to another. - */ - inline void CopyInfoL(CGlxtnFileInfo& aInfo); - - /** - * Get the full path to the media file. - * @return Media file path. - */ - inline const TDesC& FilePath() const; - - /** - * Set the full path to the media file. - * @param aPath Media file path (takes ownership). - */ - inline void SetFilePath(HBufC* aPath); - - /** - * Set the full path to the media file. - * @param aPath Media file path. - */ - inline void SetFilePathL(const TDesC& aPath); - - /** - * Set the full path to the media file. - * @param aIsVideo Set to true if the file is a video. - * @param aIsProtected Set to true if the file is DRM protected. - */ - void IdentifyFileL(TBool& aIsVideo, TBool& aIsProtected); - -public: - /** Size of the media file */ - TInt iFileSize; - /** Last modified time of the media file */ - TTime iFileTime; - /** True if the thumbnail is temporary and should not be stored */ - TBool iTemporary; - TBool iIsVideo; - TBool iIsProtected; - -private: - /** Full path of the media file */ - HBufC* iFilePath; - }; - -#include "glxtnfileinfo.inl" - -#endif // C_GLXTNFILEINFO_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnfileinfo.inl --- a/engine/collectionframework/thumbnailcreator/inc/glxtnfileinfo.inl Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* 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: Definition of CGlxtnFileInfo -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -// ----------------------------------------------------------------------------- -// Constructor -// ----------------------------------------------------------------------------- -// -inline CGlxtnFileInfo::CGlxtnFileInfo() - { - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -inline CGlxtnFileInfo::~CGlxtnFileInfo() - { - delete iFilePath; - } - -// ----------------------------------------------------------------------------- -// CopyInfoL -// ----------------------------------------------------------------------------- -// -inline void CGlxtnFileInfo::CopyInfoL(CGlxtnFileInfo& aInfo) - { - SetFilePathL(aInfo.FilePath()); - iFileSize = aInfo.iFileSize; - iFileTime = aInfo.iFileTime; - iTemporary = aInfo.iTemporary; - iIsVideo = aInfo.iIsVideo; - iIsProtected = aInfo.iIsProtected; - } - -// ----------------------------------------------------------------------------- -// FilePath -// Get the full path to the media file. -// ----------------------------------------------------------------------------- -// -inline const TDesC& CGlxtnFileInfo::FilePath() const - { - return *iFilePath; - } - -// ----------------------------------------------------------------------------- -// SetFilePathL -// Set the full path to the media file. -// ----------------------------------------------------------------------------- -// -inline void CGlxtnFileInfo::SetFilePath(HBufC* aPath) - { - delete iFilePath; - iFilePath = aPath; - } - -// ----------------------------------------------------------------------------- -// SetFilePathL -// Set the full path to the media file. -// ----------------------------------------------------------------------------- -// -inline void CGlxtnFileInfo::SetFilePathL(const TDesC& aPath) - { - delete iFilePath; - iFilePath = NULL; - iFilePath = aPath.AllocL(); - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnfileutility.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtnfileutility.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* 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: Utility for thumbnail tasks handling files -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef GLXTNFILEUTILITY_H -#define GLXTNFILEUTILITY_H - -#include -#include - -/** - * Utility for thumbnail tasks handling files. - * - * @author Dan Rhodes - * @ingroup glx_thumbnail_creator - */ -NONSHARABLE_CLASS(CGlxtnFileUtility) : public CBase - { -public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CGlxtnFileUtility* NewL(); - - /** - * Destructor. - */ - ~CGlxtnFileUtility(); - - /** - * Provide file server session for opening images from files. - */ - RFs& FsSession(); - - /** - * Test whether a file is on the bad file list. If so this method leaves. - * If not the bad file marker is set to the filename, so that if a panic - * occurs the file will be added to the bad file list. - * @param aFilename Path of file for which a thumbnail is to be generated. - */ - void CheckBadFileListL(const TDesC& aFilename); - - /** - * Clear the bad file marker. Called when processing a file is complete (no - * panic occurred). - */ - void ClearBadFileMarker(); - - /** - * Test whether a generated thumbnail should be stored in persistent storage. - * @param aSize Requested size of thumbnail. - */ - TBool IsPersistentSize(const TSize& aSize); - -private: - - /** - * C++ default constructor. - */ - CGlxtnFileUtility(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Read bad file list from file and add file from marker, if present. - */ - void ReadBadFileListL(); - /** - * Write bad file list to file. - */ - void WriteBadFileListL(); - -private: - /** File server session for opening images from files */ - RFs iFs; - /** Directory in which to store bad file list and marker */ - TFileName iBadFileDir; - /** Filenames of media files which cause panics when decoding */ - RPointerArray iBadFileArray; - /** Persistent thumbnail size classes */ - RArray iPersistentSizeClasses; - }; - -#endif // GLXTNFILEUTILITY_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnfilteravailabletask.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtnfilteravailabletask.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* -* 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: Task used for thumbnail availability filter. -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef C_GLXTNFILTERAVAILABLETASK_H -#define C_GLXTNFILTERAVAILABLETASK_H - -#include "glxtntask.h" - -// Forward declarations -class CGlxtnFileInfo; - -/** - * Task to filter a list of media item IDs to include only those which don't - * have a high quality thumbnail of a given size. - * - * @author Dan Rhodes - * @ingroup glx_thumbnail_creator - */ -NONSHARABLE_CLASS(CGlxtnFilterAvailableTask) : public CGlxtnClientTask - { -public: - /** - * Two-phased constructor. - * @param aItemArray Array of item IDs, from which those with thumbnails - * should be removed. - * @param aSize Size of thumbnail required. - * @param aClient Client initiating the request. - */ - static CGlxtnFilterAvailableTask* NewL( - const TArray& aItemArray, const TSize& aSize, - MGlxtnThumbnailCreatorClient& aClient); - /** - * Destructor. - */ - ~CGlxtnFilterAvailableTask(); - -protected: // From CGlxtnTask - - TBool DoStartL(TRequestStatus& aStatus); - void DoCancel(); - TBool DoRunL(TRequestStatus& aStatus); - TBool DoRunError(TInt aError); - -private: - /** - * C++ default constructor. - * @param aSize Size of thumbnail required. - * @param aClient Client initiating the request. - */ - CGlxtnFilterAvailableTask(const TSize& aSize, - MGlxtnThumbnailCreatorClient& aClient); - /** - * Symbian 2nd phase constructor. - * @param aItemArray Array of item IDs, from which those with thumbnails - * should be removed. - */ - void ConstructL(const TArray& aItemArray); - - /** - * Start asynchronous request for file information for an item. - * @param aStatus Request status for the asynchronous operation. - */ - TBool GetFileInfoL(TRequestStatus& aStatus); - /** - * Start asynchronous check for thumbnail in persistent storage. - * @param aStatus Request status for the asynchronous operation. - */ - TBool CheckIdL(TRequestStatus& aStatus); - -private: - enum TFilterState - { - EStateFetchingUri, EStateChecking - }; - - /** Size of thumbnail for which to check */ - TSize iSize; - /** Array of media IDs from which those with thumbnails are removed */ - RArray iIdArray; - /** Current task state */ - TFilterState iState; - /** Current index in Id array */ - TInt iIndex; - /** File info for current item */ - CGlxtnFileInfo* iFileInfo; - }; - -#endif // C_GLXTNFILTERAVAILABLETASK_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtngeneratethumbnailtask.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtngeneratethumbnailtask.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* 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: Classes for thumbnail-related tasks. -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef C_GLXTNGENERATETHUMBNAILTASK_H -#define C_GLXTNGENERATETHUMBNAILTASK_H - -#include "glxtnloadthumbnailtask.h" - -class CGlxtnFileInfo; -class CGlxtnFileUtility; -class CGlxtnImageUtility; -class CGlxtnVideoUtility; -class CFbsBitmap; -class CImageDecoder; -class RFs; - -/** - * Task to generate a high quality thumbnail for a media item. - * - * An instance of CImageDecoder is constructed to produce a bitmap from the - * image file, scaling to the smallest possible size not smaller than the - * required size. - * - * The task then uses ADIS to scale to the exact size required, and also uses - * the sharpening and IETD algorithms to enhance the image. - * - * @ingroup glx_thumbnail_creator - */ -NONSHARABLE_CLASS( CGlxtnGenerateThumbnailTask ) - : public CGlxtnLoadThumbnailTask - { -public: - /** - * Two-phased constructor. - * @param aRequestInfo Parameters for the thumbnail request. - * @param aFileUtility File utility for use by the task. - * @param aClient Client initiating the request. - */ - static CGlxtnGenerateThumbnailTask* NewL( - const TGlxThumbnailRequest& aRequestInfo, - CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient); - /** - * Destructor. - */ - ~CGlxtnGenerateThumbnailTask(); - -protected: // From CGlxtnTask - void SetManager(CGlxtnTaskManager* aManager); - virtual TBool DoStartL(TRequestStatus& aStatus); - virtual void DoCancel(); - virtual TBool DoRunL(TRequestStatus& aStatus); - TBool DoRunError(TInt aError); - -private: - /** - * C++ default constructor. - * @param aRequestInfo Parameters for the thumbnail request. - * @param aFileUtility File utility for use by the task. - * @param aClient Client initiating the request. - */ - CGlxtnGenerateThumbnailTask(const TGlxThumbnailRequest& aRequestInfo, - CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient); - /** - * Symbian 2nd phase constructor. - * @param aBitmapHandle Handle to bitmap in which to store the thumbnail. - */ - void ConstructL(TInt aBitmapHandle); - - /** - * Start asynchronous decoding process for a high quality thumbnail. - * @param aStatus Request status for the asynchronous operation. - */ - void HighQualityDecodeL( TRequestStatus& aStatus ); - /** - * @return ETrue if viewing the requested thumbnail size would require - * DRM rights. - */ - TBool SizeRequiresDrmRights(); - -private: - /** Pointer to task manager (not owned) */ - CGlxtnTaskManager* iTaskManager; - /** Utility to get thumbnail from image (owned) */ - CGlxtnImageUtility* iImageUtility; - /** Utility to get thumbnail from video (owned) */ - CGlxtnVideoUtility* iVideoUtility; - /** Image loaded from file (owned) */ - CFbsBitmap* iImage; - /** Whether current item is a video */ - TBool iVideo; - /** Whether current file is DRM protected */ - TBool iProtected; - /** Flag to show BadFileMarker not created so no need to delete **/ - TBool iBadFileMarkerNotNeededFlag; - }; - -#endif // C_GLXTNGENERATETHUMBNAILTASK_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnimagedecoderfactory.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtnimagedecoderfactory.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* 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: Definition of GlxtnImageDecoderFactory -* -*/ - - - -#ifndef GLXTNIMAGEDECODERFACTORY_H -#define GLXTNIMAGEDECODERFACTORY_H - -#include - -class CImageDecoder; -class RFs; - -/** - * Factory to create appropriate decoder for a given image. - * - * @author Dan Rhodes - * @ingroup glx_thumbnail_creator - */ -class GlxtnImageDecoderFactory - { -public: - /** - * Create a decoder for an image file. If the file is a JPEG, the function - * will first try to create a hardware decoder. If that fails a software - * decoder will be created. - * @param aFs File server session. - * @param aFilename Full path of the file. - * @return Pointer to image decoder (caller takes ownership). - */ - static CImageDecoder* NewL( RFs& aFs, const TDesC& aFilename ); - /** - * Create a decoder for JPEG image data. - * @param aFs File server session. - * @param aData Buffer containing the image to be decoded. - * @return Pointer to image decoder (caller takes ownership). - */ - static CImageDecoder* NewL( RFs& aFs, const TDesC8& aData ); - }; - -#endif // GLXTNIMAGEDECODERFACTORY_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnimageutility.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtnimageutility.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -/* -* 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: Utility for creating bitmaps from image files -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef GLXTNIMAGEUTILITY_H -#define GLXTNIMAGEUTILITY_H - -#include -#include // For TDisplayMode - -class MIHLScaler; -class CFbsBitmap; -class CFbsBitGc; -class CImageDecoder; -class RFs; - -/** - * Utility for creating bitmaps from image files - * - * @ingroup glx_thumbnail_creator - */ -NONSHARABLE_CLASS(CGlxtnImageUtility) : public CBase - { -public: - CGlxtnImageUtility(RFs& aFs); - ~CGlxtnImageUtility(); - - void Cancel(); - - /** - * Reduce target size to same aspect ratio as source image. - */ - void AdjustSize(TSize& aTargetSize, const TSize& aSourceSize); - - /** - * Start asynchronous decoding process for a high quality thumbnail. - * @param aStatus Request status for the asynchronous operation. - * @param aFileName Full path of image file. - * @param aTargetSize Size for the image - modified by this function to - * preserve the aspect ratio. - * @param aMode Display mode for the image. - */ - CFbsBitmap* DecodeImageL(TRequestStatus& aStatus, const TDesC& aFileName, - RArray& aTargetSizes, TDisplayMode aMode); - - /** - * Free resources used by decoding. - */ - void FreeDecoder(); - - /** - * Get the original size of the image decoded. - */ - const TSize& OriginalSize() const; - - /** - * Start asynchronous filtering process for a high quality thumbnail. - * @param aStatus Request status for the asynchronous operation. - * @param aSource Source image bitmap. - * @param aFilteredSource Filtered image bitmap. - * @param aTarget Target thumbnail bitmap. - */ - void FilterImageL(TRequestStatus* aStatus, CFbsBitmap* aSource, CFbsBitmap*& aFilteredSource, CFbsBitmap* aTarget); - - /** - * Start asynchronous scaling process for a high quality thumbnail. - * @param aStatus Request status for the asynchronous operation. - * @param aSrcBitmap Source image bitmap. - * @param aSrcRect Source image rectangle. - * @param aDstBitmap Destination thumbnail bitmap. - * @param aDstRect Destination image rectangle. - */ - void ScaleImageL(TRequestStatus& aStatus, CFbsBitmap& aSrcBitmap, const TRect& aSrcRect, CFbsBitmap& aDstBitmap, const TRect& aDstRect); - - /** - * Start asynchronous scaling process for a high quality thumbnail. - * @param aStatus Request status for the asynchronous operation. - * @param aSource Source image bitmap. - * @param aFilteredSource Filtered Source image bitmap. - * @param aTarget Target thumbnail bitmap. - */ - void ScaleImage64kL(TRequestStatus* aStatus, CFbsBitmap* aSource, CFbsBitmap* aFilteredSource, CFbsBitmap* aTarget); - -private: - - void ScaleColor64K( TUint16* aSrc, TInt aSrcStride, TInt aSrcCols, TInt aSrcRows, - TInt aX, TInt aY, TInt aW, TInt aH, - TUint16* aDst, TInt aDstStride, TInt aDstCols, TInt aDstRows ); - - void FilterL( CFbsBitmap* aSource, CFbsBitmap*& aFilteredSource, TInt aFilterPercent ); - - void FIRFiltering( - TUint16* aDst, TUint aDstStridep, TUint aDstCols, TUint aDstRows ); - - void FIRFiltering4( - TUint16* aDst, TUint aDstStridep, TUint aDstCols, TUint aDstRows ); - - void FIRFiltering8( - TUint16* aDst, TUint aDstStridep, TUint aDstCols, TUint aDstRows ); - -private: - // File server session - RFs& iFs; - // Decoder used to read image from file - CImageDecoder* iDecoder; - // Bitmap scaler - MIHLScaler* iScaler; - /** Size of the image in the file being decoded */ - TSize iOriginalSize; - CFbsBitmap* iImage; - TUint16* iAddress; - CFbsBitGc* iBitGc; - }; - -#endif // GLXTNIMAGEUTILITY_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnloadthumbnailtask.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtnloadthumbnailtask.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Base class for tasks which load thumbnails -* -*/ - - - -#ifndef C_GLXTNLOADTHUMBNAILTASK_H -#define C_GLXTNLOADTHUMBNAILTASK_H - -#include "glxtntask.h" -#include "glxtnstd.h" - -// Forward declarations -class CGlxtnFileInfo; -class CGlxtnFileUtility; -class CFbsBitmap; -class CImageDecoder; -class TGlxThumbnailRequest; - -/** - * Base class for tasks which load thumbnails. - * - * @author Dan Rhodes - * @ingroup glx_thumbnail_creator - */ -NONSHARABLE_CLASS( CGlxtnLoadThumbnailTask ) : public CGlxtnClientTask - { -public: - /** - * Destructor. - */ - ~CGlxtnLoadThumbnailTask(); - -protected: // From CGlxtnTask - void DoCancel(); - -protected: - /** - * C++ default constructor. - * @param aId Task type ID. - * @param aRequestInfo Parameters for the thumbnail request. - * @param aFileUtility File utility for use by the task. - * @param aClient Client initiating the request. - */ - CGlxtnLoadThumbnailTask( const TGlxtnTaskId& aId, - const TGlxThumbnailRequest& aRequestInfo, - CGlxtnFileUtility& aFileUtility, - MGlxtnThumbnailCreatorClient& aClient ); - /** - * Symbian 2nd phase constructor. - * @param aBitmapHandle Handle to bitmap in which to store the thumbnail. - */ - void ConstructL( TInt aBitmapHandle ); - - /** - * Start asynchronous loading. - * @param aStatus Request status for the asynchronous operation. - * @return ETrue if an asynchronous operation has been started. - */ - TBool LoadThumbnailL( TRequestStatus& aStatus ); - /** - * Create bitmap from loaded thumbnail data. - * @param aStatus Request status for the asynchronous operation. - * @return ETrue if an asynchronous operation has been started. - */ - TBool HandleLoadedThumbnailL( TRequestStatus& aStatus ); - /** - * Start asynchronous decoding. iDecoder should point to a valid decoder. - * @param aStatus Request status for the asynchronous operation. - * @param aScaleBitmap If true, scale the loaded bitmap close to - * requested size. - */ - void DecodeThumbnailL( TRequestStatus& aStatus, TBool aScaleBitmap ); - -protected: - enum TGeneratorState - { - EStateFetchingUri, EStateLoading, EStateDecodingThumbnail, - EStateDecodingImage, EStateScaling, EStateFiltering - }; - - /** File utility */ - CGlxtnFileUtility& iFileUtility; - /** Current state for task state machine */ - TGeneratorState iState; - /** File information for item to thumbnail (owned) */ - CGlxtnFileInfo* iInfo; - /** Requested thumbnail size */ - TSize iRequestedSize; - /** Thumbnail image data (owned) */ - HBufC8* iThumbData; - /** Thumbnail data format */ - TGlxImageDataFormat iFormat; - /** Decoder to decode the thumbnail data (owned) */ - CImageDecoder* iDecoder; - /** Bitmap to decode image into (owned) */ - CFbsBitmap* iThumbnail; - /** DRM allowed flag passed from thumbnail request */ - TBool iDrmAllowed; - }; - -#endif // C_GLXTNLOADTHUMBNAILTASK_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnquickthumbnailtask.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtnquickthumbnailtask.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2006-2006 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: Quick thumbnail generation task. -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef C_GLXTNQUICKTHUMBNAILTASK_H -#define C_GLXTNQUICKTHUMBNAILTASK_H - -#include "glxtnloadthumbnailtask.h" -#include "glxthumbnailinfo.h" - -// Forward declarations -class CGlxtnFileUtility; -class CGlxtnVideoUtility; -class CFbsBitmap; - -/** - * Task to quickly produce a thumbnail for an item, usually from the EXIF - * thumbnail. - * - * The task first attempts to extract the EXIF thumbnail data from the file - * using ExifLib. If this succeeds, an instance of CImageDecoder is constructed - * from the data and used to produce a bitmap. - * - * If this fails, an instance of CImageDecoder is constructed from the file, - * and set to use the thumbnail. If this fails, it is assumed that there is no - * EXIF thumbnail in the file, and the decoder is set to scale the main image - * as close as possible to the required thumbnail size. - * - * No scaling or image enhancement is applied to the decoded bitmap. - * - * @author Dan Rhodes - * @ingroup glx_thumbnail_creator - */ -NONSHARABLE_CLASS( CGlxtnQuickThumbnailTask ) : public CGlxtnLoadThumbnailTask - { -public: - /** - * Two-phased constructor. - * @param aRequestInfo Parameters for the thumbnail request. - * @param aFileUtility File utility for use by the task. - * @param aClient Client initiating the request. - */ - static CGlxtnQuickThumbnailTask* NewL( - const TGlxThumbnailRequest& aRequestInfo, - CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient); - /** - * Destructor. - */ - ~CGlxtnQuickThumbnailTask(); - -protected: // From CGlxtnTask - - TBool DoStartL(TRequestStatus& aStatus); - void DoCancel(); - TBool DoRunL(TRequestStatus& aStatus); - TBool DoRunError(TInt aError); - -private: - /** - * C++ default constructor. - * @param aRequestInfo Parameters for the thumbnail request. - * @param aFileUtility File utility for use by the task. - * @param aClient Client initiating the request. - */ - CGlxtnQuickThumbnailTask(const TGlxThumbnailRequest& aRequestInfo, - CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient); - - /** - * Start asynchronous decoding process for a low quality thumbnail. - * @param aStatus Request status for the asynchronous operation. - */ - void QuickDecodeL(TRequestStatus& aStatus); - /** - * Decode an image file using thumbnail embedded in the file if possible. - * @param aStatus Request status for the asynchronous operation. - */ - void ReadThumbnailL(TRequestStatus& aStatus); - /** - * Read thumbnail data from the file using ExifLib. - */ - void ReadExifThumbnailL(); - void QuickScaleL(); - -private: - /** Quality of thumbnail (high if loaded, low if generated) */ - TGlxThumbnailQuality iQuality; - /** Utility to get thumbnail from video (owned) */ - CGlxtnVideoUtility* iUtility; - /** Bitmap to hold video frame (owned) */ - CFbsBitmap* iVideoFrame; - /** Whether the media file is a video */ - TBool iVideo; - /** Flag to show BadFileMarker not created so no need to delete **/ - TBool iBadFileMarkerNotNeededFlag; - }; - -#endif // C_GLXTNQUICKTHUMBNAILTASK_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnsavethumbnailtask.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtnsavethumbnailtask.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -/* -* 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: Thumbnail save task implementation -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef GLXTNSAVETHUMBNAILTASK_H -#define GLXTNSAVETHUMBNAILTASK_H - -// INCLUDES - -#include "glxtntask.h" - -// CONSTANTS - -// MACROS - -// DATA TYPES - -// FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -class CFbsBitmap; -class CImageEncoder; -class CGlxtnFileInfo; - -// CLASS DECLARATION - -/** -* Task to save a generated thumbnail in persistent storage. -* -* @author Dan Rhodes -* @ingroup glx_thumbnail_creator -*/ -NONSHARABLE_CLASS(CGlxtnSaveThumbnailTask) : public CGlxtnTask - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param iItemId Media ID of item whose thumbnail is to be saved. - * @param aFileInfo Information about the media file. - * @param aSize Requested thumbnail size. - * @param aThumbnail Thumbnail bitmap to save. - * @param aStorage Client's storage interface. - */ - static CGlxtnSaveThumbnailTask* NewL( - const TGlxMediaId& aItemId, - CGlxtnFileInfo* aFileInfo, const TSize& aSize, - CFbsBitmap* aThumbnail, MGlxtnThumbnailStorage* aStorage); - - /** - * Destructor. - */ - virtual ~CGlxtnSaveThumbnailTask(); - - protected: // From CGlxtnTask - TBool DoStartL(TRequestStatus& aStatus); - void DoCancel(); - TBool DoRunL(TRequestStatus& aStatus); - TBool DoRunError(TInt aError); - - protected: - /** - * Constructor for derived classes. - * @param aId Task type ID. - * @param iItemId Media ID of item whose thumbnail is to be saved. - * @param aStorage Client's storage interface. - */ - CGlxtnSaveThumbnailTask(const TGlxtnTaskId& aId, - const TGlxMediaId& aItemId, MGlxtnThumbnailStorage* aStorage); - - /** - * Encode the bitmap to a data buffer. - * @param aStatus Request status for the asynchronous operation. - */ - void EncodeThumbnailL(TRequestStatus& aStatus); - /** - * Save buffer to storage. - * @param aStatus Request status for the asynchronous operation. - */ - void SaveThumbnailL(TRequestStatus& aStatus); - - private: - /** - * Constructor. - * @param iItemId Media ID of item whose thumbnail is to be saved. - * @param aSize Requested thumbnail size. - * @param aStorage Client's storage interface. - */ - CGlxtnSaveThumbnailTask(const TGlxMediaId& aItemId, const TSize& aSize, - MGlxtnThumbnailStorage* aStorage); - - /** - * By default Symbian 2nd phase constructor is private. - * @param aFileInfo Information about the media file. - * @param aThumbnail Thumbnail bitmap to save. - */ - void ConstructL(CGlxtnFileInfo* aFileInfo, CFbsBitmap* aThumbnail); - - protected: // Data - /** - * States for the task's state machine. - */ - enum TSaveState - { - EStateEncoding, EStateSaving, EStateFetchingUri, - EStateDecoding, EStateChecking, EStateScaling, EStateFiltering - }; - - /** Requested thumbnail size */ - TSize iSize; - /** Information about the item's media file */ - CGlxtnFileInfo* iFileInfo; - /** Thumbnail bitmap to save (owned) */ - CFbsBitmap* iThumbnail; - /** Current task state */ - TSaveState iState; - - private: // Data - /** Format in which the bitmap was encoded */ - TGlxImageDataFormat iFormat; - /** Encoder for the bitmap (owned) */ - CImageEncoder* iEncoder; - /** Buffer for encoded data (owned) */ - HBufC8* iData; - }; - -#endif // GLXTNSAVETHUMBNAILTASK_H - -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnstd.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtnstd.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* 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: Global defs -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - - -#ifndef _GLXTNSTD_H -#define _GLXTNSTD_H - -#include "glxid.h" -#include -class TGlxTasktnIdTypeBase {}; // Don't use this -typedef TGlxId TGlxtnTaskId; // Use this - -// Thumbnail task Ids -const TUint KGlxtnTaskIdGenerateThumbnail = 1; -const TUint KGlxtnTaskIdSaveThumbnail = 2; -const TUint KGlxtnTaskIdBackgroundThumbnailGeneration = 3; -const TUint KGlxtnTaskIdQuickThumbnail = 4; -const TUint KGlxtnTaskIdDeleteThumbnails = 5; -const TUint KGlxtnTaskIdFilterAvailable = 6; -const TUint KGlxtnTaskIdCleanupThumbnails = 7; -const TUint KGlxtnTaskIdZoomedThumbnail = 8; - -// Task priorities -const TInt KGlxTaskPriorityCreateList = CActive::EPriorityStandard + 1; -const TInt KGlxTaskPriorityFetchProperties = KGlxTaskPriorityCreateList - 1; -const TInt KGlxTaskPriorityForegroundThumbnailProvisioning = KGlxTaskPriorityFetchProperties - 1; -const TInt KGlxTaskPriorityFileSystemScan = KGlxTaskPriorityForegroundThumbnailProvisioning - 1; -const TInt KGlxTaskPriorityBackgroundThumbnailProvisioning = EPriorityLow; -const TInt KGlxTaskPriorityBackgroundThumbnailGenerator = EPriorityLow - 1; - -// Thumbnail availablity -const TInt KGlxThumbnailAvailable = 0; -const TInt KGlxThumbnailNotAvailable = 1; - - - -/** - * Thumbnail image formats - */ -enum TGlxImageDataFormat - { - EGlxIDF_Bitmap, // Externalised CFbsBitmap - EGlxIDF_JPEG // Encoded with JPEG format - }; - -#endif // _GLXTNSTD_H \ No newline at end of file diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtntask.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtntask.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,219 +0,0 @@ -/* -* 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: Base classes for multi-purpose tasks. -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef C_GLXTNTASK_H -#define C_GLXTNTASK_H - -#include "glxtnstd.h" -#include -#include - -// Forward declarations -class CGlxtnTaskManager; -class MGlxtnThumbnailCreatorClient; -class MGlxtnThumbnailStorage; - -/** - * Base class for thumbnail tasks. - * - * @ingroup glx_thumbnail_creator - */ -NONSHARABLE_CLASS(CGlxtnTask) : public CBase - { - friend class CGlxtnTaskManager; -public: - /** - * Different state a task can go through - */ - enum TState - { - EIdle, /**< Task is not ready to start */ - EStarting, /**< Task is ready to start */ - ERunning, /**< Task is currently running */ - ECanceled, /**< Task has been cancelled, and can be deleted */ - EComplete /**< Task has finished, and can be deleted */ - }; - -public: - CGlxtnTask(const TGlxtnTaskId& aId, const TGlxMediaId& aItemId, - MGlxtnThumbnailStorage* aStorage); - ~CGlxtnTask(); - - /** - * Gets the current task specific state - * @returns TState The task current state. - */ - inline TState State() const; - - /** - * Gets the type of task this is. - * @returns TGlxtnTaskId Task type ID. - */ - inline TGlxtnTaskId Id() const; - - /** - * Gets the media ID of the item to which this task relates. - * @returns TGlxMediaId Media ID. - */ - inline TGlxMediaId ItemId() const; - - /** - * Sets the priority of the task. By default it is set to - * EPriorityStandard. - */ - inline void SetPriority(TInt aPriority); - /** - * Gets the task priority. - * @returns TInt Task priority. - */ - inline TInt Priority() const; - - /** - * Get thumbnail storage for the task to use, if any. - * @returns Pointer to thumbnail storage, or NULL if none. - */ - inline MGlxtnThumbnailStorage* Storage() const; - - /** - * Provides a pointer to the task manager. - * @param aManager Pointer to the task manager. - */ - virtual void SetManager(CGlxtnTaskManager* aManager); - -private: // For CGlxTaskManager only - /** - * Starts the task - */ - void StartL(TRequestStatus& aStatus); - - /** - * Cancels the task - */ - void Cancel(); - - /** - * Runs a bit of the task - */ - void RunL(TRequestStatus& aStatus); - - /** - * Handle a leave in StartL or RunL. - */ - void RunError(TInt aError); - -protected: - /** - * Starts the task. - * @param aStatus Request status for asynchronous operations - * @returns -ETrue if the task has issued an asyncronous request. - * CActive::SetActive() will be called in this case and the - * task state will be ERunning. - * -EFalse if the task has not issued a request. - * SetActive will not be called and the task state will be - * EComplete. - */ - virtual TBool DoStartL(TRequestStatus& aStatus) = 0; - - /** - * Cancels the task. The task's state will be set to ECanceled. - */ - virtual void DoCancel() = 0; - - /** - * Runs a bit of the task - * @param aStatus Request status for asynchronous operations - * @returns -ETrue if the task has issued an asyncronous request. - * CActive::SetActive() will be called in this case and the - * task state will be ERunning. - * -EFalse if the task has not issued a request. - * SetActive will not be called and the task state will be - * EComplete. - */ - virtual TBool DoRunL(TRequestStatus& aStatus) = 0; - - /** - * Handle a leave in StartL or RunL. - * @param aError The error that occurred. - * @returns -ETrue if the task has issued an asyncronous request. - * CActive::SetActive() will be called in this case and the - * task state will be ERunning. - * -EFalse if the task has not issued a request. - * SetActive will not be called and the task state will be - * EComplete. - */ - virtual TBool DoRunError(TInt aError) = 0; - -protected: - /** - * Issues a request and sets the aStatus as KRequestPending - * Use this to make a synchronous operation asynchronous. - */ - void SelfComplete(TRequestStatus& aStatus); - -private: - /** Task state */ - TState iState; - - /** Task id */ - TGlxtnTaskId iId; - - /** Media item id */ - TGlxMediaId iItemId; - - /** - * Priority of this task. - * The task schedule will execute tasks based on this priority - * When this task is run, the execution priority in CActiveScheduler - * will be this priority. (So it is comparable to priorities of active - * objects in the system.) - */ - TInt iPriority; - - /** Thumbnail storage for the task to use (can be NULL) */ - MGlxtnThumbnailStorage* iStorage; - }; - -/** - * Base class for thumbnail tasks which return results to a client. - * - * @ingroup glx_thumbnail_creator - */ -NONSHARABLE_CLASS(CGlxtnClientTask) : public CGlxtnTask - { -protected: - CGlxtnClientTask(const TGlxtnTaskId& aId, const TGlxMediaId& aItemId, - MGlxtnThumbnailCreatorClient& aClient); - - /** - * Get the client for this task. - */ - inline MGlxtnThumbnailCreatorClient& Client(); - -private: - /** Client for this task */ - MGlxtnThumbnailCreatorClient& iClient; - }; - -#include "glxtntask.inl" - -#endif // C_GLXTNTASK_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtntask.inl --- a/engine/collectionframework/thumbnailcreator/inc/glxtntask.inl Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* -* 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: Base classes for multi-purpose tasks. -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -// ----------------------------------------------------------------------------- -// SetPriority -// Gets the current task specific state -// ----------------------------------------------------------------------------- -// -inline CGlxtnTask::TState CGlxtnTask::State() const - { - return iState; - } - -// ----------------------------------------------------------------------------- -// SetPriority -// Gets the type of task this is. -// ----------------------------------------------------------------------------- -// -inline TGlxtnTaskId CGlxtnTask::Id() const - { - return iId; - } - -// ----------------------------------------------------------------------------- -// SetPriority -// Gets the media ID of the item to which this task relates. -// ----------------------------------------------------------------------------- -// -inline TGlxMediaId CGlxtnTask::ItemId() const - { - return iItemId; - } - -// ----------------------------------------------------------------------------- -// SetPriority -// Sets the priority of the task. By default it is set to EPriorityStandard. -// ----------------------------------------------------------------------------- -// -inline void CGlxtnTask::SetPriority(TInt aPriority) - { - iPriority = aPriority; - } - -// ----------------------------------------------------------------------------- -// Priority -// Gets the task priority. -// ----------------------------------------------------------------------------- -// -inline TInt CGlxtnTask::Priority() const - { - return iPriority; - } - -// ----------------------------------------------------------------------------- -// Storage -// Get the thumbnail storage for this task to use, if any. -// ----------------------------------------------------------------------------- -// -inline MGlxtnThumbnailStorage* CGlxtnTask::Storage() const - { - return iStorage; - } - -// ----------------------------------------------------------------------------- -// Client -// Get the client for this task. -// ----------------------------------------------------------------------------- -// -inline MGlxtnThumbnailCreatorClient& CGlxtnClientTask::Client() - { - return iClient; - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtntaskmanager.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtntaskmanager.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +0,0 @@ -/* -* 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: Task manager for multiple tasks. Allows asynchronosity and -* tracking/callback for long running tasks. -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef C_GLXTNTASKMANAGER_H -#define C_GLXTNTASKMANAGER_H - -#include "glxtnstd.h" -#include -#include - -// Forward declarations -class CGlxtnTask; -class MGlxtnThumbnailStorage; - -/** - * Active object which maintains a priority queue of long running tasks, and - * provides callback upon task completion or error. - * - * The highest priority task in the queue which has @ref CGlxtnTask::TState "state" - * EStarting is started and the task manager's RunL then delegates to the task's - * RunL until the task is complete, or is cancelled. The task is then deleted - * and another task is started, if any are ready to start. - * - * The task manager's DoCancel and RunError methods also delegate to the current - * task, if any. - * - * @ingroup glx_thumbnail_creator - */ -NONSHARABLE_CLASS(CGlxtnTaskManager) : public CActive - { -public: - enum TExecutionOrder - { - ELastOut, // Old tasks with the same priority get executed before the new task - EFirstOut // New task gets executed before other tasks with the same priority - }; -public: - /** - * Static constructor. - */ - static CGlxtnTaskManager* NewL(); - - /** - * Destructor. - */ - ~CGlxtnTaskManager(); - -public: - /** - * @returns CVieTask task at an index - */ - - inline CGlxtnTask* Task(TInt aIndex) const { return iTasks[aIndex]; }; - - /** - * Returns the highest priority task with the id. - * If there are multiple tasks with same id and priority, - * returns the one of those that will be executed first - */ - CGlxtnTask* Task(const TGlxtnTaskId& aId) const; - - /** - * Adds a task to the task list. If no task is currently running, the task - * is started. - * - * @param aTask Task to add. Takes ownership, task is deleted if a leave occurs. - * - * @param aExecutionOrder -if ELastOut, the tast gets added to the bottom - * of the queue of the tasks with the same priority - * as the new tasks. This means that the task is - * executed after the previously added tasks (with - * same priority) have been run. - * -if EFirstOut, the task gets added to the top, - * and will be executed before the other tasks - * with the same priority (unless more tasks added - * later, of course) - */ - void AddTaskL(CGlxtnTask* aTask, TExecutionOrder aExecutionOrder = ELastOut); - - /** - * Cancel all tasks relating to a given media item. - * @param aItemId ID of media item. - */ - void CancelTasks(const TGlxMediaId& aItemId); - - /** - * Cancel all tasks using a given storage. - * @param aClient Reference to thumbnail storage. - */ - void CancelTasks(MGlxtnThumbnailStorage* aStorage); - - /** - * Gets the total task count - * - * @return TInt task count - */ - inline TInt TaskCount() const { return iTasks.Count(); }; - -protected: - /** - * Constructors - */ - CGlxtnTaskManager(); - void ConstructL(); - -private: // From CActive - void RunL(); - void DoCancel(); - TInt RunError(TInt aError); - -private: - /** - * Issue a self-completing request causing RunL to be called. - */ - void AsyncRun(); - -private: - /** - * Task list in priority order - */ - RPointerArray iTasks; - - /** - * Task that is currently being run. - */ - CGlxtnTask* iCurrentTask; - }; - -#endif // C_GLXTNTASKMANAGER_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnthumbnailcreator.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtnthumbnailcreator.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* -* 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: Thumbnail creator: provides thumbnails and generates on background -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef C_GLXTNTHUMBNAILCREATOR_H -#define C_GLXTNTHUMBNAILCREATOR_H - -#include "glxtnstd.h" -#include "glxtntask.h" -#include -#include -#include - -class CGlxtnFileUtility; -class CGlxSettingsModel; -class MGlxtnThumbnailCreatorClient; -class MGlxtnThumbnailStorage; -class TGlxThumbnailRequest; - -/** - * CGlxtnThumbnailCreator - * - * Thumbnail creator is the thumbnail engine, and it loads and generates - * thumbnails on the foreground and generates non-created thumbnails on - * the background - * - * @ingroup glx_thumbnail_creator - */ -class CGlxtnThumbnailCreator : public CBase - { -public: - /** - * Starts the provisioning of a thumbnail. This will result in a callback - * to MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete(). - */ - IMPORT_C static CGlxtnThumbnailCreator* InstanceL(); - /** - * Decrement the reference count, and delete the instance if the count - * becomes zero. Ensures any tasks using the given storage are cancelled. - * @param aStorage Pointer to storage used by client, or NULL. - */ - IMPORT_C void Close(MGlxtnThumbnailStorage* aStorage); - - /** - * Destructor. - */ - ~CGlxtnThumbnailCreator(); - - /** - * Starts the provisioning of a thumbnail. This will result in a callback - * to MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete(). - * @param aRequestInfo Parameters for required thumbnail. - * @param aClient Client initiating the request. - */ - IMPORT_C void FetchThumbnailL(const TGlxThumbnailRequest& aRequestInfo, - MGlxtnThumbnailCreatorClient& aClient); - - /** - * Starts deleting all stored thumbnails for a given item. This will result - * in a callback to MGlxtnThumbnailCreatorClient::ThumbnailDeletionComplete(). - * @param aItemId ID of the media item. - * @param aClient Client initiating the request. - */ - IMPORT_C void DeleteThumbnailsL(const TGlxMediaId& aItemId, - MGlxtnThumbnailCreatorClient& aClient); - - /** - * Starts the filtering of items for which a thumbnail is available from a - * list of item IDs. This will result in a callback to - * MGlxtnThumbnailCreatorClient::FilterAvailableComplete(). - * @param aItemArray Array of item IDs, from which those with thumbnails - * should be removed. - * @param aSize Size of thumbnail required. - * @param aClient Client initiating the request. - */ - IMPORT_C void FilterAvailableThumbnailsL( - const TArray& aItemArray, const TSize& aSize, - MGlxtnThumbnailCreatorClient& aClient); - - /** - * Starts the cleanup of obsolete thumbnails from storage. There is no - * callback indicating completion of the request. - * @param aStorage Pointer to storage used by client. - */ - IMPORT_C void CleanupThumbnailsL(MGlxtnThumbnailStorage* aStorage); - - /** - * Cancel any ongoing tasks for a given item. This ensures the TNC is not - * locking the media file. - * @param aItemId ID of the media item. - */ - IMPORT_C void CancelRequest(const TGlxMediaId& aItemId); - -private: - CGlxtnThumbnailCreator(); - void ConstructL(); - -private: - /** Task manager */ - CGlxtnTaskManager* iTaskManager; - /** File utility used by the tasks */ - CGlxtnFileUtility* iFileUtility; - /** Reference count of the single instance */ - TInt iReferenceCount; - /** Settings Model used by the background tasks */ - CGlxSettingsModel* iSettingsModel; - }; - -#endif // C_GLXTNTHUMBNAILCREATOR_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnthumbnailrequest.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtnthumbnailrequest.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* -* 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: Represents a thumbnail request -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef T_GLXTHUMBNAILREQUEST_H -#define T_GLXTHUMBNAILREQUEST_H - -#include "glxmediaid.h" -#include "glxthumbnailinfo.h" - -class TGlxThumbnailRequest - { -public: - enum TPriorityMode - { - EPrioritizeSpeed, // Speed of thumbnail provisioning is mode important that quality - EPrioritizeQuality, // Quality of thumbnail provisioning is mode important that speed - }; - -public: - inline TGlxThumbnailRequest(); - - inline TGlxThumbnailRequest(TGlxMediaId aId, - const TSize& aSizeClass, TPriorityMode aPriorityMode, - TInt aBitmapHandle, TBool aDrmAllowed); - - inline TGlxThumbnailRequest(TGlxMediaId aId, - const TSize& aSizeClass, TPriorityMode aPriorityMode, - TInt aBitmapHandle, TBool aDrmAllowed, - const TRect& aCroppingRect, TGlxThumbnailFilter aFilter); - -public: - TGlxMediaId iId; - TSize iSizeClass; - TPriorityMode iPriorityMode; - TInt iBitmapHandle; // Handle of target bitmap for the thumbnail - TBool iDrmAllowed; // True if client has DRM capability - TRect iCroppingRect; - TGlxThumbnailFilter iFilter; - }; - -#include "glxtnthumbnailrequest.inl" - -#endif // T_GLXTHUMBNAILREQUEST_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnthumbnailrequest.inl --- a/engine/collectionframework/thumbnailcreator/inc/glxtnthumbnailrequest.inl Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* 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: Represents a thumbnail request -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -inline TGlxThumbnailRequest::TGlxThumbnailRequest() : - iPriorityMode(EPrioritizeQuality), iBitmapHandle(0), - iDrmAllowed(EFalse), iFilter(EGlxThumbnailFilterNone) - { - } - -inline TGlxThumbnailRequest::TGlxThumbnailRequest(TGlxMediaId aId, - const TSize& aSizeClass, TPriorityMode aPriorityMode, - TInt aBitmapHandle, TBool aDrmAllowed) : - iId(aId), iSizeClass(aSizeClass), iPriorityMode(aPriorityMode), - iBitmapHandle(aBitmapHandle), iDrmAllowed(aDrmAllowed), - iFilter(EGlxThumbnailFilterNone) - { - } - -inline TGlxThumbnailRequest::TGlxThumbnailRequest(TGlxMediaId aId, - const TSize& aSizeClass, TPriorityMode aPriorityMode, - TInt aBitmapHandle, TBool aDrmAllowed, - const TRect& aCroppingRect, TGlxThumbnailFilter aFilter) : - iId(aId), iSizeClass(aSizeClass), iPriorityMode(aPriorityMode), - iBitmapHandle(aBitmapHandle), iDrmAllowed(aDrmAllowed), - iCroppingRect(aCroppingRect), iFilter(aFilter) - { - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnvideoutility.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtnvideoutility.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* -* 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: Utility for creating bitmaps from video files -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef GLXTNVIDEOUTILITY_H -#define GLXTNVIDEOUTILITY_H - -#include -#ifdef ENABLE_VED -#include -#else -#include -#endif - -class CFbsBitmap; - -/** - * Utility for creating bitmaps from video files - * - * @author Dan Rhodes - * @ingroup glx_thumbnail_creator - */ -NONSHARABLE_CLASS( CGlxtnVideoUtility ) : public CBase, -#ifdef ENABLE_VED - public MVedVideoClipInfoObserver, public MVedVideoClipFrameObserver -#else - public MTNEVideoClipInfoObserver, public MTNEVideoClipThumbObserver -#endif - { -public: - /** - * Default constructor. - */ - CGlxtnVideoUtility(); - /** - * Destructor. - */ - ~CGlxtnVideoUtility(); - - /** - * Start asynchronous frame decoding. - * @param aRequestStatus Request status for the asynchronous operation. - * @param aDestination Bitmap in which to store the frame. - * @param aFileName Full name of video file. - */ - void GetVideoFrameL( TRequestStatus* aRequestStatus, - CFbsBitmap*& aDestination, const TDesC& aFileName, - RArray& aTargetSizes, TDisplayMode aMode ); - /** - * Cancel asynchronous frame decoding. - */ - void Cancel(); - -#ifdef ENABLE_VED -private: // From MVedVideoClipInfoObserver - void NotifyVideoClipInfoReady( CVedVideoClipInfo& aInfo, TInt aError ); - -private: // From MVedVideoClipFrameObserver - void NotifyVideoClipFrameCompleted( CVedVideoClipInfo& aInfo, - TInt aError, CFbsBitmap* aFrame ); -#else -private: // From MTNEVideoClipInfoObserver - void NotifyVideoClipInfoReady( CTNEVideoClipInfo& aInfo, TInt aError ); - -private: // From MTNEVideoClipThumbObserver - void NotifyVideoClipThumbCompleted( CTNEVideoClipInfo& aInfo, - TInt aError, CFbsBitmap* aFrame ); -#endif - -private: -#ifdef ENABLE_VED - CVedVideoClipInfo* iVideoInfo; -#else - CTNEVideoClipInfo* iVideoInfo; -#endif - /** Client's request status */ - TRequestStatus* iRequestStatus; - /** Pointer to variable to hold returned frame */ - CFbsBitmap** iDestination; - TSize iSize; - TDisplayMode iDisplayMode; - }; - -#endif // GLXTNVIDEOUTILITY_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnvolumedatabase.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtnvolumedatabase.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,231 +0,0 @@ -/* -* 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: Definition of CGlxtnVolumeDatabase -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef GLXTNVOLUMEDATABASE_H -#define GLXTNVOLUMEDATABASE_H - -#include -#include // For RDbStoreDatabase -#include // For TDriveName - -#include -#include "glxtnstd.h" // For TGlxImageDataFormat -#include "mglxtnvolumedatabaseobserver.h" // For TGlxtnThumbnailId - -class CFileStore; -class CGlxtnFileInfo; -class MGlxtnVolumeDatabaseObserver; - -/** - * CGlxtnVolumeDatabase implements the database for a single volume. - * - * @author Dan Rhodes - * @ingroup glx_thumbnail_creator - */ -NONSHARABLE_CLASS(CGlxtnVolumeDatabase) : public CActive - { -public: - /** - * Static constructor. - * @param aObserver Observer of database operations. - * @param aFs File server handle. - * @param aPath Full path to the database file to use. - */ - static CGlxtnVolumeDatabase* NewLC(MGlxtnVolumeDatabaseObserver& aObserver, - RFs& aFs, - const TDesC& aPath); - - /** - * Destructor - */ - ~CGlxtnVolumeDatabase(); - - /** - * Get the drive this database is stored on - */ - const TDesC& Drive() const; - - /** - * Look up thumbnail ID from Ids table - * @param aMediaId Media item ID. - */ - void GetThumbnailIdL( const TGlxMediaId& aMediaId ); - /** - * Look up thumbnail ID from Items table. If not found, add new record. - * @param aInfo File info for media item. - */ - void GetThumbnailIdL(const CGlxtnFileInfo* aInfo); - /** - * Add record to Ids table - * @param aMediaId Media item ID. - * @param aThumbId Thumbnail ID. - */ - void StoreThumbnailIdL( const TGlxMediaId& aMediaId, - const TGlxtnThumbnailId& aThumbId ); - /** - * Look up thumbnail from Thumbnails table - * @param aThumbId Thumbnail ID. - * @param aSize Thumbnail size. - */ - void GetThumbnailL( const TGlxtnThumbnailId& aThumbId, const TSize& aSize ); - /** - * Check if a particular thumbnail is in Thumbnails table - * @param aThumbId Thumbnail ID. - * @param aSize Thumbnail size. - */ - void CheckAvailableL( const TGlxtnThumbnailId& aThumbId, const TSize& aSize ); - /** - * Add record to Thumbnails table - * @param aThumbId Thumbnail ID. - * @param aSize Thumbnail size. - * @param aFormat Thumbnail data format. - * @param aData Thumbnail binary data. - */ - void StoreThumbnailL( const TGlxtnThumbnailId& aThumbId, const TSize& aSize, - TGlxImageDataFormat aFormat, const TDesC8& aData ); - - /** - * Delete a record from the Ids table - * @param aMediaId MediaId of record to delete. - */ - void DeleteIdL( const TGlxMediaId& aMediaId ); - - /** - * Delete a record from the Thumbnails table - * @param aThumbId ThumbId of records to delete. - */ - void DeleteThumbnailsL( const TGlxtnThumbnailId& aThumbId ); - - /** - * Delete a record from the Items table - * @param aThumbId ThumbId of record to delete. - */ - void DeleteItemL( const TGlxtnThumbnailId& aThumbId ); - - /** - * Cleanup Database (remove entries that do not have corresponding file) - */ - void CleanupDatabaseL(); - -protected: // From CActive - void DoCancel(); - void RunL(); - TInt RunError(TInt aError); - -private: - /** - * Default constructor. - * @param aObserver Observer of database operations. - * @param aFs File server handle. - */ - CGlxtnVolumeDatabase(MGlxtnVolumeDatabaseObserver& aObserver, RFs& aFs); - /** - * 2nd phase constructor. - * @param aPath Full path to the database file to use. - */ - void ConstructL(const TDesC& aPath); - - /** - * Open an existing database. - * @param aFs File server handle. - * @param aPath Full path to the database file to use. - */ - void OpenDbL(RFs& aFs, const TDesC& aFilename); - - /** - * Create a new database. - * @param aFs File server handle. - * @param aPath Full path to the database file to use. - */ - void CreateDbL(RFs& aFs, const TDesC& aFilename); - - /** - * Add record to Items table - * @return Thumbnail ID of new record. - */ - TGlxtnThumbnailId DoAddItemL(); - - /** - * Evaluate a view based on a SQL query. - * @param aQuery The SQL select statement. - */ - void EvaluateQueryL( const TDbQuery &aQuery ); - - /** - * Execute a SQL data update statement. - * @param aSql The SQL statement. - */ - void UpdateDataL( const TDesC& aSql ); - - /** - * Test and cleanup a row in Items table - */ - void CleanupRowL(); - - /** - * Modify SQL string to handle quotes correctly - * @param aText String to be modified - * @return New HBufC containing modified string - */ - HBufC* QuoteSqlStringLC(const TDesC& aText); - -private: - enum TDatabaseState - { - EStateIdle, - EStateGettingIdFromMediaId, - EStateGettingIdFromFilename, - EStateGettingThumbnail, - EStateDeletingId, - EStateDeletingThumbnails, - EStateDeletingItem, - EStateCheckingAvailability, - EStateCleaning, - EStateCleaningDeletingThumbnails - }; - - /** Observer of this database */ - MGlxtnVolumeDatabaseObserver& iObserver; - /** File server session */ - RFs& iFs; - /** Drive name of the volume */ - TDriveName iDrive; - /** Handle to the database */ - RDbStoreDatabase iDatabase; - /** Store used by the database */ - CFileStore* iStore; - /** ID for next stored thumbnail */ - TUint iNextThumbId; - /** File info for media item current query relates to (not owned) */ - const CGlxtnFileInfo* iInfo; - /** Current state */ - TDatabaseState iState; - /** View used for current query */ - RDbView iView; - /** Updater to update a table */ - RDbUpdate iDbUpdater; - /** Table used for query/deletion of rows in table */ - RDbTable iTable; - }; - -#endif // GLXTNVOLUMEDATABASE_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/glxtnzoomedimagetask.h --- a/engine/collectionframework/thumbnailcreator/inc/glxtnzoomedimagetask.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* 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: Task to generate a cropped thumbnail for a JPEG image. -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - - -#ifndef C_GLXTNZOOMEDIMAGETASK_H -#define C_GLXTNZOOMEDIMAGETASK_H - -#include "glxtntask.h" - -#include // For TGlxThumbnailFilter - -class CGlxtnFileInfo; -class CGlxtnFileUtility; -class TGlxThumbnailRequest; -class CFbsBitmap; -class CExtJpegDecoder; - -/** - * Task to generate a cropped thumbnail for a JPEG image. - * - * @ingroup glx_thumbnail_creator - */ -NONSHARABLE_CLASS(CGlxtnZoomedImageTask) : public CGlxtnClientTask - { -public: - /** - * Two-phased constructor. - */ - static CGlxtnZoomedImageTask* NewL( - const TGlxThumbnailRequest& aRequestInfo, - CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient); - ~CGlxtnZoomedImageTask(); - -protected: // From CGlxtnTask - virtual TBool DoStartL(TRequestStatus& aStatus); - virtual void DoCancel(); - virtual TBool DoRunL(TRequestStatus& aStatus); - TBool DoRunError(TInt aError); - -private: - CGlxtnZoomedImageTask(const TGlxThumbnailRequest& aRequestInfo, - CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient); - void ConstructL(TInt aBitmapHandle); - - void DecodePartialImageL(TRequestStatus& aStatus); - void CreateDecoderL(TInt aDecoderType); - -private: - enum TTaskState - { - EStateFetchingUri, EStateDecoding, EStateProcessing - }; - - /** File utility (not owned) */ - CGlxtnFileUtility& iFileUtility; - /** File information for item to thumbnail */ - CGlxtnFileInfo* iInfo; - /** Current state for task state machine */ - TTaskState iState; - /** Bitmap for the generated thumbnail */ - CFbsBitmap* iThumbnail; - /** Decoder for the JPEG file */ - CExtJpegDecoder* iDecoder; - /** Requested thumbnail size */ - TSize iRequestedSize; - /** Part of image to keep */ - TRect iCroppingRect; - /** Filtering to apply to generated image */ - TGlxThumbnailFilter iFilter; - /** DRM allowed flag passed from thumbnail request */ - TBool iDrmAllowed; - /** Whether current file is DRM protected */ - TBool iProtected; - }; - -#endif // C_GLXTNZOOMEDIMAGETASK_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/mglxtnstorage.h --- a/engine/collectionframework/thumbnailcreator/inc/mglxtnstorage.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* -* 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: Thumbnail storage interface -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef M_GLXTNSTORAGE_H -#define M_GLXTNSTORAGE_H - -// INCLUDES - -#include -#include -#include "glxtnstd.h" - -class CGlxtnFileInfo; - -// CLASS DECLARATION - -/** -* Interface for thumbnail persistent storage. -* -* @ingroup glx_thumbnail_creator -*/ -class MGlxtnThumbnailStorage - { -public: - /** - * Start asynchronous loading of thumbnail data. - * @param aData Buffer pointer for the loaded data. Memory is allocated - internally and ownership passed to the caller. - * @param aFormat Format of the thumbnail in aData. - * @param aId Media item ID. - * @param aFileInfo File info for media item. - * @param aSize Requested thumbnail size. - * @param aStatus Request status for the asynchronous operation. - */ - virtual void LoadThumbnailDataL(HBufC8*& aData, - TGlxImageDataFormat& aFormat, const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, const TSize& aSize, - TRequestStatus* aStatus) = 0; - /** - * Start asynchronous saving of thumbnail data. - * @param aData Buffer containing the data to be saved. - * @param aFormat Format of the thumbnail in aData. - * @param aId Media item ID. - * @param aFileInfo File info for media item. - * @param aSize Requested thumbnail size. - * @param aStatus Request status for the asynchronous operation. - */ - virtual void SaveThumbnailDataL(const TDesC8& aData, - TGlxImageDataFormat aFormat, const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, const TSize& aSize, - TRequestStatus* aStatus) = 0; - /** - * Start asynchronous deletion of all saved thumbnails for an item. - * @param aId Media item ID. - * @param aFileInfo File info for media item. - * @param aStatus Request status for the asynchronous operation. - */ - virtual void DeleteThumbnailsL(const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, TRequestStatus* aStatus) = 0; - /** - * Start asynchronous deletion of all saved thumbnails for items which no - * longer exist. - * @param aStatus Request status for the asynchronous operation. - */ - virtual void CleanupThumbnailsL(TRequestStatus* aStatus) = 0; - /** - * Test whether a given thumbnail is available in storage. - * @param aId Media item ID. - * @param aFileInfo File info for media item. - * @param aSize Requested thumbnail size. - * @param aStatus Request status for the asynchronous operation. - */ - virtual void IsThumbnailAvailableL(const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, - const TSize& aSize, TRequestStatus* aStatus) = 0; - /** - * Cancel an ongoing asynchronous operation. - */ - virtual void StorageCancel() = 0; - /** - * Notify that an error occurred in background generation. - * @param aId Media item ID. - * @param aError Error code. - */ - virtual void NotifyBackgroundError(const TGlxMediaId& aId, TInt aError) = 0; - }; - -/** -* Interface for notification of thumbnails becoming available in storage. -* -* @ingroup glx_thumbnail_creator -*/ -class MGlxtnThumbnailStorageObserver - { -public: - /** - * Notify that a given thumbnail is available in storage. - * @param aId Media item ID. - * @param aSize Requested thumbnail size. - */ - virtual void ThumbnailAvailable(const TGlxMediaId& aId, const TSize& aSize) = 0; - /** - * Notify that an error occurred in background generation. - * @param aId Media item ID. - * @param aError Error code. - */ - virtual void BackgroundThumbnailError(const TGlxMediaId& aId, TInt aError) = 0; - }; - -#endif // M_GLXTNSTORAGE_H - -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/mglxtnthumbnailcreatorclient.h --- a/engine/collectionframework/thumbnailcreator/inc/mglxtnthumbnailcreatorclient.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* -* 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: Thumbnail creator client interface -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef M_GLXTNTHUMBNAILCREATORCLIENT_H -#define M_GLXTNTHUMBNAILCREATORCLIENT_H - -// INCLUDES - -#include -#include - -// FUNCTION PROTOTYPES - -class CGlxtnFileInfo; -class MGlxtnThumbnailStorage; -class TGlxMediaId; - -// CLASS DECLARATION - -/** -* Interface for clients of the TNC. -* -* @ingroup glx_thumbnail_creator -*/ -class MGlxtnThumbnailCreatorClient - { -public: - /** - * Notifies that a thumbnail for a given item is available, or that - * thumbnail generation failed. - * @param aItemId The item for which the thumbnail was required. - * @param aQuality quality of the thumbnail - * @param aErrorCode KErrNone if successful, otherwise an error code. - */ - virtual void ThumbnailFetchComplete(const TGlxMediaId& aItemId, - TGlxThumbnailQuality aQuality, TInt aErrorCode) = 0; - /** - * Notifies that deletion of thumbnails for a given item is complete, or - * the operation failed. - * @param aItemId The item whose thumbnails were deleted. - * @param aErrorCode KErrNone if successful, otherwise an error code. - */ - virtual void ThumbnailDeletionComplete(const TGlxMediaId& aItemId, - TInt aErrorCode) = 0; - /** - * Notifies that filtering items with available thumbnails from a list is - * complete, or the operation failed. - * @param aIdArray Array of IDs of items which don't have a thumbnail - * available. - * @param aErrorCode KErrNone if successful, otherwise an error code. - */ - virtual void FilterAvailableComplete(const RArray& aIdArray, - TInt aErrorCode) = 0; - /** - * Called by a task to request file information for an item. The - * information is returned asynchronously. - * @param aInfo Buffer to hold the information. - * @param aItemId The item for which the URI is required. - * @param aStatus Request status for the asynchronous operation. - */ - virtual void FetchFileInfoL(CGlxtnFileInfo* aInfo, - const TGlxMediaId& aItemId, TRequestStatus* aStatus) = 0; - /** - * Cancel the request for an URI. - * @param aItemId The item for which the URI was required. - */ - virtual void CancelFetchUri(const TGlxMediaId& aItemId) = 0; - /** - * Get the thumbnail storage used by this client. - * @return Pointer to the storage. - */ - virtual MGlxtnThumbnailStorage* ThumbnailStorage() = 0; - }; - -#endif // M_GLXTNTHUMBNAILCREATORCLIENT_H - -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/inc/mglxtnvolumedatabaseobserver.h --- a/engine/collectionframework/thumbnailcreator/inc/mglxtnvolumedatabaseobserver.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* 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: Definition of CGlxtnVolumeDatabase -* -*/ - - - -/** - * @internal reviewed 30/07/2007 by Simon Brooks - */ - -#ifndef M_GLXTNVOLUMEDATABASEOBSERVER_H -#define M_GLXTNVOLUMEDATABASEOBSERVER_H - -#include "glxtnstd.h" // For TGlxImageDataFormat - -/** - * Typesafe thumbnail ID. - */ -class TGlxtnThumbnailIdTypeBase {}; // Don't use this -typedef TGlxId TGlxtnThumbnailId; // Use this - -/** - * Interface to receive callbacks from a CGlxtnVolumeDatabase. - * - * @author Dan Rhodes - * @ingroup glx_thumbnail_creator - */ -class MGlxtnVolumeDatabaseObserver - { -public: - /** - * Called when a database operation cannot be completed. - * @param aError Error code. - */ - virtual void HandleDatabaseError(TInt aError) = 0; - /** - * Called when a thumbnail ID has been found in the Ids table. - * @param aThumbId Thumbnail ID for the media item. - */ - virtual void HandleThumbnailIdFromMediaIdL( - const TGlxtnThumbnailId& aThumbId ) = 0; - /** - * Called when a thumbnail ID has been found in the Items table. - * @param aThumbId Thumbnail ID for the media item. - */ - virtual void HandleThumbnailIdFromFilenameL( - const TGlxtnThumbnailId& aThumbId ) = 0; - /** - * Called when a thumbnail ID has been saved in the Ids table. - */ - virtual void HandleThumbnailIdStoredL() = 0; - /** - * Called when a thumbnail has been found in the Thumbnails table. - * @param aFormat Thumbnail data format. - * @param aData Thumbnail binary data (ownership passed). - */ - virtual void HandleThumbnail(TGlxImageDataFormat aFormat, HBufC8* aData) = 0; - /** - * Called when a thumbnail has been saved in the Thumbnails table. - */ - virtual void HandleThumbnailStored() = 0; - /** - * Called when a record has been deleted from a Ids table. - */ - virtual void HandleMediaIdDeletedL() = 0; - /** - * Called when records have been deleted from a Thumbnails table. - */ - virtual void HandleThumbnailsDeletedL() = 0; - /** - * Called when a record has been deleted from a Items table. - */ - virtual void HandleItemDeletedL() = 0; - /** - * Called when availability has been chaecked. - * @param aResult The result of the check. - */ - virtual void HandleAvailabilityChecked(TInt aResult) = 0; - /** - * Called after the database has been cleaned up. - */ - virtual void HandleDatabaseCleanedL() = 0; - }; - -#endif // M_GLXTNVOLUMEDATABASEOBSERVER_H diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtnbackgroundgenerationtask.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtnbackgroundgenerationtask.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,376 +0,0 @@ -/* -* 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: Thumbnail background generation task implementation -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - -// INCLUDE FILES - -#include "glxtnbackgroundgenerationtask.h" - -#include -#include -#include -#include - -#include "glxtnfileinfo.h" -#include "glxscreenresolutions.h" -#include "glxtnfileutility.h" -#include "glxtnimageutility.h" -#include "glxtnvideoutility.h" -#include "mglxtnstorage.h" -#include "mglxtnthumbnailcreatorclient.h" - - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGlxtnBackgroundGenerationTask::CGlxtnBackgroundGenerationTask -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -// -CGlxtnBackgroundGenerationTask::CGlxtnBackgroundGenerationTask( - const TGlxMediaId& iItemId, CGlxtnFileUtility& aFileUtility, - MGlxtnThumbnailCreatorClient& aClient, - CGlxSettingsModel::TSupportedOrientations aSupportedOrientations) : - CGlxtnSaveThumbnailTask(KGlxtnTaskIdBackgroundThumbnailGeneration, - iItemId, aClient.ThumbnailStorage()), - iClient(&aClient), iFileUtility(aFileUtility), - iSupportedOrientations(aSupportedOrientations) - { - TRACER("CGlxtnBackgroundGenerationTask::CGlxtnBackgroundGenerationTask()"); - // Background task is always low priority - SetPriority(EPriorityLow); - } - -// ----------------------------------------------------------------------------- -// CGlxtnBackgroundGenerationTask::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CGlxtnBackgroundGenerationTask::ConstructL() - { - TRACER("void CGlxtnBackgroundGenerationTask::ConstructL()"); - iImageUtility = new (ELeave) CGlxtnImageUtility(iFileUtility.FsSession()); - } - -// ----------------------------------------------------------------------------- -// CGlxtnBackgroundGenerationTask::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CGlxtnBackgroundGenerationTask* CGlxtnBackgroundGenerationTask::NewL( - const TGlxMediaId& iItemId, CGlxtnFileUtility& aFileUtility, - MGlxtnThumbnailCreatorClient& aClient, - CGlxSettingsModel::TSupportedOrientations aSupportedOrientations) - { - TRACER("CGlxtnBackgroundGenerationTask* CGlxtnBackgroundGenerationTask::NewL()"); - CGlxtnBackgroundGenerationTask* self - = new (ELeave) CGlxtnBackgroundGenerationTask( - iItemId, aFileUtility, aClient, - aSupportedOrientations); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// Destructor -CGlxtnBackgroundGenerationTask::~CGlxtnBackgroundGenerationTask() - { - TRACER("Destructor CGlxtnBackgroundGenerationTask::~CGlxtnBackgroundGenerationTask()"); - delete iImageUtility; - delete iVideoUtility; - delete iImage; - delete iFilteredImage; - iSizes.Close(); - } - -// ----------------------------------------------------------------------------- -// DoStartL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnBackgroundGenerationTask::DoStartL(TRequestStatus& aStatus) - { - TRACER("CGlxtnBackgroundGenerationTask::DoStartL()"); - // Sizes to generate, largest first - iSizes.AppendL(TSize(KGlxThumbnailLargeWidth, KGlxThumbnailLargeHeight)); - iSizes.AppendL(TSize(KGlxThumbnailSmallWidth, KGlxThumbnailSmallHeight)); - if( CGlxSettingsModel::ELandscapeAndPortrait == iSupportedOrientations ) - { - iSizes.AppendL(TSize(KGlxThumbnailPortraitWidth, KGlxThumbnailPortraitHeight)); - } - - iFileInfo = new (ELeave) CGlxtnFileInfo; - iClient->FetchFileInfoL(iFileInfo, ItemId(), &aStatus); - iState = EStateFetchingUri; - - return ETrue; // Request has been issued - } - -// ----------------------------------------------------------------------------- -// DoCancel -// ----------------------------------------------------------------------------- -// -void CGlxtnBackgroundGenerationTask::DoCancel() - { - TRACER("void CGlxtnBackgroundGenerationTask::DoCancel()"); - CGlxtnSaveThumbnailTask::DoCancel(); - - Storage()->NotifyBackgroundError(ItemId(), KErrCancel); - - if ( iClient && EStateFetchingUri == iState ) - { - iClient->CancelFetchUri(ItemId()); - } - - iImageUtility->Cancel(); - - if ( iVideoUtility ) - { - iVideoUtility->Cancel(); - } - - iFileUtility.ClearBadFileMarker(); - } - -// ----------------------------------------------------------------------------- -// DoRunL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnBackgroundGenerationTask::DoRunL(TRequestStatus& aStatus) - { - TRACER("TBool CGlxtnBackgroundGenerationTask::DoRunL()"); - User::LeaveIfError(aStatus.Int()); - - TBool active = EFalse; - - switch ( iState ) - { - case EStateFetchingUri: - { - iImageDecoded = EFalse; - iBadFileMarkerNotNeededFlag = ETrue; - // Client is no longer needed - iClient->ThumbnailFetchComplete(ItemId(), - EGlxThumbnailQualityHigh, KErrNone); - iClient = NULL; - - User::LeaveIfNull(iFileInfo); - - TBool isVideo, isProtected; - iFileInfo->IdentifyFileL(isVideo, isProtected); - // if DRM protected leave - // assume DRM capablity not present - if(isProtected) - { - User::Leave(KErrAccessDenied); - } - - active = CheckNextL(aStatus); - } - break; - - case EStateDecoding: - iImageUtility->FreeDecoder(); - iImageDecoded = ETrue; - FilterThumbnailL(aStatus); - active = ETrue; - break; - - case EStateFiltering: - ScaleThumbnailL(aStatus); - active = ETrue; - break; - - case EStateSaving: - active = ProcessNextL(aStatus); - break; - - case EStateChecking: - if ( KGlxThumbnailNotAvailable == aStatus.Int() ) - { - iTodoSizes.AppendL(iSize); - } - active = CheckNextL(aStatus); - break; - - case EStateScaling: - EncodeThumbnailL(aStatus); - active = ETrue; - break; - - case EStateEncoding: - SaveThumbnailL(aStatus); - active = ETrue; - break; - - default: - GLX_ASSERT_ALWAYS( EFalse, Panic( EGlxPanicIllegalState ), - "CGlxtnBackgroundGenerationTask: Illegal state" ); - break; - } - - if ( !active ) - { - if( !iBadFileMarkerNotNeededFlag ) - { - iFileUtility.ClearBadFileMarker(); - } - // Send notification that we've finished - Storage()->NotifyBackgroundError( ItemId(), KErrNone ); - } - - return active; // Task is complete - } - -// ----------------------------------------------------------------------------- -// DoRunError -// ----------------------------------------------------------------------------- -// -TBool CGlxtnBackgroundGenerationTask::DoRunError(TInt aError) - { - TRACER("CGlxtnBackgroundGenerationTask::DoRunError()"); - if( !iBadFileMarkerNotNeededFlag ) - { - iFileUtility.ClearBadFileMarker(); - } - if ( iClient ) - { - iClient->ThumbnailFetchComplete( - ItemId(), EGlxThumbnailQualityHigh, aError); - } - else - { - Storage()->NotifyBackgroundError(ItemId(), aError); - } - - return EFalse; // Task is complete - } - -// ----------------------------------------------------------------------------- -// CheckNextL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnBackgroundGenerationTask::CheckNextL(TRequestStatus& aStatus) - { - TRACER("CGlxtnBackgroundGenerationTask::CheckNextL()"); - if ( iSizes.Count() == 0 ) - { - return ProcessNextL(aStatus); - } - - iSize = iSizes[0]; - iSizes.Remove(0); - - Storage()->IsThumbnailAvailableL(ItemId(), *iFileInfo, iSize, &aStatus); - iState = EStateChecking; - return ETrue; - } - -// ----------------------------------------------------------------------------- -// ProcessNextL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnBackgroundGenerationTask::ProcessNextL(TRequestStatus& aStatus) - { - TRACER("TBool CGlxtnBackgroundGenerationTask::ProcessNextL()"); - if ( iTodoSizes.Count() == 0 ) - { - return EFalse; - } - - iSize = iTodoSizes[0]; - if( iImageDecoded ) - { - FilterThumbnailL(aStatus); - } - else - { - DecodeImageL(aStatus); - } - return ETrue; - } - -// ----------------------------------------------------------------------------- -// FilterThumbnailL -// ----------------------------------------------------------------------------- -// -void CGlxtnBackgroundGenerationTask::FilterThumbnailL(TRequestStatus& aStatus) - { - TRACER("void CGlxtnBackgroundGenerationTask::FilterThumbnailL()"); - // Create thumbnail bitmap of required size - TSize targetSize(iTodoSizes[0]); - iTodoSizes.Remove(0); - iImageUtility->AdjustSize(targetSize, iImage->SizeInPixels()); - - delete iThumbnail; - iThumbnail = NULL; - iThumbnail = new (ELeave) CFbsBitmap; - User::LeaveIfError(iThumbnail->Create(targetSize, KGlxThumbnailDisplayMode)); - - iImageUtility->FilterImageL(&aStatus, iImage, iFilteredImage, iThumbnail); - iState = EStateFiltering; - } - -// ----------------------------------------------------------------------------- -// ScaleThumbnailL -// ----------------------------------------------------------------------------- -// -void CGlxtnBackgroundGenerationTask::ScaleThumbnailL(TRequestStatus& aStatus) - { - TRACER("void CGlxtnBackgroundGenerationTask::ScaleThumbnailL()"); - TSize targetSize(iSize); - const TSize srcSize = iImage->SizeInPixels(); - iImageUtility->AdjustSize(targetSize, iImage->SizeInPixels()); - iImageUtility->ScaleImageL(aStatus, *iImage, srcSize, *iThumbnail, targetSize); - iState = EStateScaling; - } - -// ----------------------------------------------------------------------------- -// DecodeImageL -// ----------------------------------------------------------------------------- -// -void CGlxtnBackgroundGenerationTask::DecodeImageL(TRequestStatus& aStatus) - { - TRACER("void CGlxtnBackgroundGenerationTask::DecodeImageL()"); - iBadFileMarkerNotNeededFlag = EFalse; - iFileUtility.CheckBadFileListL( iFileInfo->FilePath() ); - TBool isVideo, isProtected; - iFileInfo->IdentifyFileL(isVideo, isProtected); - if ( isVideo ) - { - iVideoUtility = new (ELeave) CGlxtnVideoUtility; - iVideoUtility->GetVideoFrameL(&aStatus, iImage, - iFileInfo->FilePath(), iTodoSizes, KGlxThumbnailDisplayMode); - } - else - { - iImage = iImageUtility->DecodeImageL(aStatus, - iFileInfo->FilePath(), iTodoSizes, KGlxThumbnailDisplayMode); - } - delete iFilteredImage; - iFilteredImage = NULL; - iState = EStateDecoding; - } - -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtncleanuptask.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtncleanuptask.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -/* -* 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: Thumbnail storage cleanup task implementation -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - -// INCLUDE FILES - -#include "glxtncleanuptask.h" - -#include -#include - -#include "mglxtnstorage.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGlxtnCleanupTask::CGlxtnCleanupTask -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -// -CGlxtnCleanupTask::CGlxtnCleanupTask(MGlxtnThumbnailStorage* aStorage) : - CGlxtnTask(KGlxtnTaskIdCleanupThumbnails, KGlxIdNone, aStorage) - { - TRACER("CGlxtnCleanupTask::CGlxtnCleanupTask(MGlxtnThumbnailStorage* aStorage)"); - GLX_ASSERT_ALWAYS( aStorage, Panic( EGlxPanicIllegalArgument ), - "CGlxtnCleanupTask created without storage" ); - - // Background task is always low priority - SetPriority(EPriorityLow); - } - -// ----------------------------------------------------------------------------- -// CGlxtnCleanupTask::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CGlxtnCleanupTask::ConstructL() - { - TRACER("void CGlxtnCleanupTask::ConstructL()"); - } - -// ----------------------------------------------------------------------------- -// CGlxtnCleanupTask::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CGlxtnCleanupTask* CGlxtnCleanupTask::NewL(MGlxtnThumbnailStorage* aStorage) - { - TRACER("CGlxtnCleanupTask* CGlxtnCleanupTask::NewL(MGlxtnThumbnailStorage* aStorage)"); - CGlxtnCleanupTask* self = new (ELeave) CGlxtnCleanupTask(aStorage); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - - return self; - } - -// Destructor -CGlxtnCleanupTask::~CGlxtnCleanupTask() - { - TRACER("Destructor CGlxtnCleanupTask::~CGlxtnCleanupTask()"); - } - -// ----------------------------------------------------------------------------- -// DoStartL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnCleanupTask::DoStartL(TRequestStatus& aStatus) - { - TRACER("TBool CGlxtnCleanupTask::DoStartL(TRequestStatus& aStatus)"); - Storage()->CleanupThumbnailsL(&aStatus); - - return ETrue; - } - -// ----------------------------------------------------------------------------- -// DoCancel -// ----------------------------------------------------------------------------- -// -void CGlxtnCleanupTask::DoCancel() - { - TRACER("void CGlxtnCleanupTask::DoCancel()"); - Storage()->StorageCancel(); - } - -// ----------------------------------------------------------------------------- -// DoRunL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnCleanupTask::DoRunL(TRequestStatus& /*aStatus*/) - { - TRACER("TBool CGlxtnCleanupTask::DoRunL(TRequestStatus& /*aStatus*/)"); - return EFalse; // Task is complete - } - -// ----------------------------------------------------------------------------- -// DoRunError -// ----------------------------------------------------------------------------- -// -TBool CGlxtnCleanupTask::DoRunError(TInt /*aError*/) - { - TRACER("TBool CGlxtnCleanupTask::DoRunError(TInt /*aError*/)"); - return EFalse; // Task is complete - } - -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtndatabase.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtndatabase.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,499 +0,0 @@ -/* -* 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: Thumbnail storage implementation -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - -// INCLUDE FILES - -#include "glxtndatabase.h" - -#include -#include -#include - -#include "glxtnfileinfo.h" -#include "glxtnvolumedatabase.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGlxtnThumbnailDatabase::CGlxtnThumbnailDatabase -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -// -CGlxtnThumbnailDatabase::CGlxtnThumbnailDatabase() - { - TRACER("CGlxtnThumbnailDatabase::CGlxtnThumbnailDatabase()"); - iInternalDrive = PathInfo::PhoneMemoryRootPath().Left( KMaxDriveName ); - } - -// ----------------------------------------------------------------------------- -// CGlxtnThumbnailDatabase::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::ConstructL(const TDesC& aDbFilename, - MGlxtnThumbnailStorageObserver* aStorageObserver) - { - TRACER("void CGlxtnThumbnailDatabase::ConstructL()"); - User::LeaveIfError(iFs.Connect()); - - User::LeaveIfError(iFs.PrivatePath(iDatabasePath)); - iDatabasePath.Append(aDbFilename); - iStorageObserver = aStorageObserver; - } - -// ----------------------------------------------------------------------------- -// CGlxtnThumbnailDatabase::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -EXPORT_C CGlxtnThumbnailDatabase* CGlxtnThumbnailDatabase::NewL( - const TDesC& aDbFilename, - MGlxtnThumbnailStorageObserver* aStorageObserver) - { - TRACER("CGlxtnThumbnailDatabase* CGlxtnThumbnailDatabase::NewL()"); - CGlxtnThumbnailDatabase* self = new (ELeave) CGlxtnThumbnailDatabase; - - CleanupStack::PushL(self); - self->ConstructL(aDbFilename, aStorageObserver); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CGlxtnThumbnailDatabase::~CGlxtnThumbnailDatabase() - { - TRACER("CGlxtnThumbnailDatabase::~CGlxtnThumbnailDatabase()"); - iDatabaseArray.ResetAndDestroy(); - iFs.Close(); - } - -// ----------------------------------------------------------------------------- -// LoadThumbnailDataL -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::LoadThumbnailDataL(HBufC8*& aData, - TGlxImageDataFormat& aFormat, const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, const TSize& aSize, - TRequestStatus* aStatus) - { - TRACER("void CGlxtnThumbnailDatabase::LoadThumbnailDataL()"); - if ( iClientStatus ) - { - User::Leave(KErrNotReady); - } - - iCurrentOperation = ELoading; - iLoadData = &aData; - iLoadFormat = &aFormat; - iMediaId = aId; - iFileInfo = &aFileInfo; - iSize = aSize; - - OpenDatabaseL( iInternalDrive )->GetThumbnailIdL( iMediaId ); - - iClientStatus = aStatus; - *iClientStatus = KRequestPending; - } - -// ----------------------------------------------------------------------------- -// SaveThumbnailDataL -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::SaveThumbnailDataL(const TDesC8& aData, - TGlxImageDataFormat aFormat, const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, const TSize& aSize, - TRequestStatus* aStatus) - { - TRACER("void CGlxtnThumbnailDatabase::SaveThumbnailDataL()"); - if ( iClientStatus ) - { - User::Leave(KErrNotReady); - } - - iCurrentOperation = ESaving; - iSaveData.Set(aData); - ASSERT(iSaveData.Length() == aData.Length()); - iSaveFormat = aFormat; - iMediaId = aId; - iFileInfo = &aFileInfo; - iSize = aSize; - - OpenDatabaseL( iInternalDrive )->GetThumbnailIdL( iMediaId ); - - iClientStatus = aStatus; - *iClientStatus = KRequestPending; - } - -// ----------------------------------------------------------------------------- -// DeleteThumbnailsL -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::DeleteThumbnailsL(const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, TRequestStatus* aStatus) - { - TRACER("void CGlxtnThumbnailDatabase::DeleteThumbnailsL()"); - if ( iClientStatus ) - { - User::Leave(KErrNotReady); - } - iCurrentOperation = EDeleting; - iMediaId = aId; - iFileInfo = &aFileInfo; - - OpenDatabaseL( iInternalDrive )->GetThumbnailIdL( iMediaId ); - - iClientStatus = aStatus; - *iClientStatus = KRequestPending; - } - -// ----------------------------------------------------------------------------- -// CleanupThumbnailsL -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::CleanupThumbnailsL(TRequestStatus* aStatus) - { - TRACER("void CGlxtnThumbnailDatabase::CleanupThumbnailsL()"); - if ( iClientStatus ) - { - User::Leave(KErrNotReady); - } - - OpenDatabaseL( iInternalDrive ); - GLX_ASSERT_ALWAYS( iDatabaseArray.Count() > 0, - Panic( EGlxPanicLogicError ), "No databases to clean" ); - - iDatabaseIndex = 0; - iDatabaseArray[iDatabaseIndex]->CleanupDatabaseL(); - - iClientStatus = aStatus; - *iClientStatus = KRequestPending; - } - -// ----------------------------------------------------------------------------- -// IsThumbnailAvailableL -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::IsThumbnailAvailableL(const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, - const TSize& aSize, TRequestStatus* aStatus) - { - TRACER("void CGlxtnThumbnailDatabase::IsThumbnailAvailableL()"); - if ( iClientStatus ) - { - User::Leave(KErrNotReady); - } - - iCurrentOperation = ECheckingAvailable; - iMediaId = aId; - iFileInfo = &aFileInfo; - iSize = aSize; - - OpenDatabaseL( iInternalDrive )->GetThumbnailIdL( iMediaId ); - - iClientStatus = aStatus; - *iClientStatus = KRequestPending; - } - -// ----------------------------------------------------------------------------- -// StorageCancel -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::StorageCancel() - { - TRACER("void CGlxtnThumbnailDatabase::StorageCancel()"); - TInt count = iDatabaseArray.Count(); - for ( TInt i = 0; i < count; i++ ) - { - iDatabaseArray[i]->Cancel(); - } - - if ( iClientStatus ) - { - User::RequestComplete(iClientStatus, KErrCancel); - } - } - -// ----------------------------------------------------------------------------- -// NotifyBackgroundError -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::NotifyBackgroundError( - const TGlxMediaId& aId, TInt aError ) - { - TRACER("void CGlxtnThumbnailDatabase::NotifyBackgroundError()"); - if ( iStorageObserver ) - { - iStorageObserver->BackgroundThumbnailError(aId, aError); - } - } - -// ----------------------------------------------------------------------------- -// HandleDatabaseError -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::HandleDatabaseError(TInt aError) - { - TRACER("void CGlxtnThumbnailDatabase::HandleDatabaseError()"); - __ASSERT_DEBUG(KErrNone != aError, Panic(EGlxPanicIllegalArgument)); - __ASSERT_DEBUG(iClientStatus, Panic(EGlxPanicNotInitialised)); - if ( iClientStatus ) - { - User::RequestComplete(iClientStatus, aError); - } - } - -// ----------------------------------------------------------------------------- -// HandleThumbnailIdFromMediaIdL -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::HandleThumbnailIdFromMediaIdL( - const TGlxtnThumbnailId& aThumbId ) - { - TRACER("void CGlxtnThumbnailDatabase::HandleThumbnailIdFromMediaIdL()"); - if ( aThumbId == KGlxIdNone ) - { - // Not found in Ids table - check the Items table - OpenDatabaseL(iFileInfo->FilePath())->GetThumbnailIdL(iFileInfo); - } - else - { - iThumbId = aThumbId; - if(iCurrentOperation == EDeleting) - { - OpenDatabaseL( iInternalDrive )->DeleteIdL( iMediaId ); - } - else - { - DoHandleThumbnailIdL(); - } - } - } - -// ----------------------------------------------------------------------------- -// HandleMediaIdDeletedL -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::HandleMediaIdDeletedL() - { - TRACER("void CGlxtnThumbnailDatabase::HandleMediaIdDeletedL()"); - OpenDatabaseL(iFileInfo->FilePath())->DeleteThumbnailsL(iThumbId); - } - -// ----------------------------------------------------------------------------- -// HandleThumbnailsDeletedL -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::HandleThumbnailsDeletedL() - { - TRACER("void CGlxtnThumbnailDatabase::HandleThumbnailsDeletedL()"); - OpenDatabaseL(iFileInfo->FilePath())->DeleteItemL(iThumbId); - } - -// ----------------------------------------------------------------------------- -// HandleItemsDeletedL -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::HandleItemDeletedL() - { - TRACER("void CGlxtnThumbnailDatabase::HandleItemDeletedL()"); - __ASSERT_DEBUG(iClientStatus, Panic(EGlxPanicNotInitialised)); - if ( iClientStatus ) - { - User::RequestComplete(iClientStatus, KErrNone); - } - } - -// ----------------------------------------------------------------------------- -// HandleThumbnailIdFromFilenameL -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::HandleThumbnailIdFromFilenameL( - const TGlxtnThumbnailId& aThumbId ) - { - TRACER("void CGlxtnThumbnailDatabase::HandleThumbnailIdFromFilenameL()"); - iThumbId = aThumbId; - if(iCurrentOperation == EDeleting) - { - GLX_LOG_INFO1("GlxtnThumbnailDatabase::HandleThumbnailIdFromFilenameL Current Operation Deleting. aThumbId = %d", aThumbId.Value()); - OpenDatabaseL(iFileInfo->FilePath())->DeleteThumbnailsL(iThumbId); - } - else - { - GLX_LOG_INFO1("GlxtnThumbnailDatabase::HandleThumbnailIdFromFilenameL Current Operation NOT Deleting. aThumbId = %d", aThumbId.Value()); - // Store thumbnail ID to speed up future lookups - OpenDatabaseL( iInternalDrive )->StoreThumbnailIdL( - iMediaId, iThumbId ); - } - } - -// ----------------------------------------------------------------------------- -// HandleThumbnailIdStoredL -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::HandleThumbnailIdStoredL() - { - TRACER("void CGlxtnThumbnailDatabase::HandleThumbnailIdStoredL()"); - DoHandleThumbnailIdL(); - } - -// ----------------------------------------------------------------------------- -// HandleThumbnail -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::HandleThumbnail( - TGlxImageDataFormat aFormat, HBufC8* aData ) - { - TRACER("void CGlxtnThumbnailDatabase::HandleThumbnail()"); - __ASSERT_DEBUG(iClientStatus, Panic(EGlxPanicNotInitialised)); - if ( iClientStatus ) - { - *iLoadData = aData; - *iLoadFormat = aFormat; - User::RequestComplete(iClientStatus, KErrNone); - } - else - { - // Data loaded, but client doesn't want it (shouldn't ever happen) - delete aData; - } - } - -// ----------------------------------------------------------------------------- -// HandleThumbnailStored -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::HandleThumbnailStored() - { - TRACER("void CGlxtnThumbnailDatabase::HandleThumbnailStored()"); - if ( iStorageObserver ) - { - iStorageObserver->ThumbnailAvailable(iMediaId, iSize); - } - - __ASSERT_DEBUG(iClientStatus, Panic(EGlxPanicNotInitialised)); - if ( iClientStatus ) - { - User::RequestComplete(iClientStatus, KErrNone); - } - } - -// ----------------------------------------------------------------------------- -// HandleAvailabilityChecked -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::HandleAvailabilityChecked(TInt aResult) - { - TRACER("void CGlxtnThumbnailDatabase::HandleAvailabilityChecked()"); - __ASSERT_DEBUG(iClientStatus, Panic(EGlxPanicNotInitialised)); - if ( iClientStatus ) - { - User::RequestComplete(iClientStatus, aResult); - } - } - -// ----------------------------------------------------------------------------- -// HandleDatabaseCleanedL -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::HandleDatabaseCleanedL() - { - TRACER("void CGlxtnThumbnailDatabase::HandleDatabaseCleanedL()"); - - iDatabaseIndex++; - if(iDatabaseIndex < iDatabaseArray.Count()) - { - // cleanup next database - iDatabaseArray[iDatabaseIndex]->CleanupDatabaseL(); - } - else - { - // Finished cleanup - __ASSERT_DEBUG(iClientStatus, Panic(EGlxPanicNotInitialised)); - if ( iClientStatus ) - { - User::RequestComplete(iClientStatus, KErrNone); - } - } - } - -// ----------------------------------------------------------------------------- -// DoHandleThumbnailIdL -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailDatabase::DoHandleThumbnailIdL() - { - TRACER("void CGlxtnThumbnailDatabase::DoHandleThumbnailIdL()"); - CGlxtnVolumeDatabase* db = OpenDatabaseL(iFileInfo->FilePath()); - - switch ( iCurrentOperation ) - { - case ELoading: - db->GetThumbnailL(iThumbId, iSize); - break; - case ESaving: - db->StoreThumbnailL(iThumbId, iSize, iSaveFormat, iSaveData); - break; - case ECheckingAvailable: - db->CheckAvailableL(iThumbId, iSize); - break; - default: - Panic(EGlxPanicIllegalState); - break; - } - } - -// ----------------------------------------------------------------------------- -// OpenDatabaseL -// ----------------------------------------------------------------------------- -// -CGlxtnVolumeDatabase* CGlxtnThumbnailDatabase::OpenDatabaseL(const TDesC& aDrive) - { - TRACER("CGlxtnVolumeDatabase* CGlxtnThumbnailDatabase::OpenDatabaseL()"); - TPtrC drive(aDrive.Left(KMaxDriveName)); - - TInt count = iDatabaseArray.Count(); - for ( TInt i = 0; i < count; i++ ) - { - if ( 0 == drive.CompareF(iDatabaseArray[i]->Drive()) ) - { - return iDatabaseArray[i]; - } - } - - // Get path of DB on specified drive - TFileName path(drive); - path.Append(iDatabasePath); - - CGlxtnVolumeDatabase* database = CGlxtnVolumeDatabase::NewLC(*this, iFs, path); - iDatabaseArray.AppendL(database); - CleanupStack::Pop(database); - - return database; - } - - -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtndeletethumbnailstask.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtndeletethumbnailstask.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,146 +0,0 @@ -/* -* 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: Implementation of CGlxtnDeleteThumbnailsTask -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - -// INCLUDE FILES - -#include "glxtndeletethumbnailstask.h" - -#include -#include "glxtnfileinfo.h" -#include "mglxtnstorage.h" -#include "mglxtnthumbnailcreatorclient.h" -#include - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -// -CGlxtnDeleteThumbnailsTask::CGlxtnDeleteThumbnailsTask( - const TGlxMediaId& aItemId, MGlxtnThumbnailCreatorClient& aClient) : - CGlxtnClientTask(KGlxtnTaskIdDeleteThumbnails, aItemId, aClient) - { - TRACER("CGlxtnDeleteThumbnailsTask::CGlxtnDeleteThumbnailsTask()"); - GLX_ASSERT_ALWAYS( Storage(), Panic( EGlxPanicIllegalArgument ), - "CGlxtnDeleteThumbnailsTask created without storage" ); - } - -// ----------------------------------------------------------------------------- -// ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CGlxtnDeleteThumbnailsTask::ConstructL() - { - TRACER("void CGlxtnDeleteThumbnailsTask::ConstructL()"); - } - -// ----------------------------------------------------------------------------- -// NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CGlxtnDeleteThumbnailsTask* CGlxtnDeleteThumbnailsTask::NewL( - const TGlxMediaId& aItemId, MGlxtnThumbnailCreatorClient& aClient) - { - TRACER("CGlxtnDeleteThumbnailsTask::NewL()"); - CGlxtnDeleteThumbnailsTask* self = new (ELeave) CGlxtnDeleteThumbnailsTask( - aItemId, aClient); - - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// Destructor -CGlxtnDeleteThumbnailsTask::~CGlxtnDeleteThumbnailsTask() - { - TRACER("Destructor CGlxtnDeleteThumbnailsTask::~CGlxtnDeleteThumbnailsTask()"); - delete iInfo; - } - -// ----------------------------------------------------------------------------- -// DoStartL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnDeleteThumbnailsTask::DoStartL(TRequestStatus& aStatus) - { - TRACER("CGlxtnDeleteThumbnailsTask::DoStartL()"); - iInfo = new (ELeave) CGlxtnFileInfo; - Client().FetchFileInfoL(iInfo, ItemId(), &aStatus); - - return ETrue; - } - -// ----------------------------------------------------------------------------- -// DoCancel -// ----------------------------------------------------------------------------- -// -void CGlxtnDeleteThumbnailsTask::DoCancel() - { - TRACER("CGlxtnDeleteThumbnailsTask::DoCancel()"); - Storage()->StorageCancel(); - } - -// ----------------------------------------------------------------------------- -// DoRunL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnDeleteThumbnailsTask::DoRunL(TRequestStatus& aStatus) - { - TRACER("CGlxtnDeleteThumbnailsTask::DoRunL()"); - User::LeaveIfError(aStatus.Int()); - - TBool active = EFalse; - - if ( iDeleting ) - { - Client().ThumbnailDeletionComplete(ItemId(), KErrNone); - } - else - { - User::LeaveIfNull(iInfo); - Storage()->DeleteThumbnailsL(ItemId(), *iInfo, &aStatus); - iDeleting = ETrue; - active = ETrue; - } - - return active; - } - -// ----------------------------------------------------------------------------- -// DoRunError -// ----------------------------------------------------------------------------- -// -TBool CGlxtnDeleteThumbnailsTask::DoRunError(TInt aError) - { - TRACER("CGlxtnDeleteThumbnailsTask::DoRunError()"); - Client().ThumbnailDeletionComplete(ItemId(), aError); - - return EFalse; - } - -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtnfileinfo.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtnfileinfo.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* 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: Implementation of CGlxtnFileInfo -* -*/ - - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ -#include "glxtnfileinfo.h" - -#include -// ----------------------------------------------------------------------------- -// IdentifyFileL -// ----------------------------------------------------------------------------- -// -void CGlxtnFileInfo::IdentifyFileL(TBool& aIsVideo, TBool& aIsProtected) - { - TRACER("void CGlxtnFileInfo::IdentifyFileL()"); - User::LeaveIfNull(iFilePath); - - aIsVideo = iIsVideo; - aIsProtected = iIsProtected; - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtnfileutility.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtnfileutility.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,257 +0,0 @@ -/* -* 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: Utility for thumbnail tasks handling files -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - -#include "glxtnfileutility.h" -#include "glxscreenresolutions.h" -#include -#include -#include -#include -#include - -_LIT(KGlxBadFileList, "glxbadfilelist.dat"); -_LIT(KGlxBadFileMarker, "glxbadfilemarker.dat"); - -// ----------------------------------------------------------------------------- -// Constructor -// ----------------------------------------------------------------------------- -// -CGlxtnFileUtility::CGlxtnFileUtility() - { - TRACER("CGlxtnFileUtility::CGlxtnFileUtility()"); - } - -// ----------------------------------------------------------------------------- -// ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CGlxtnFileUtility::ConstructL() - { - TRACER("CGlxtnFileUtility::ConstructL()"); - User::LeaveIfError(iFs.Connect()); - - iFs.PrivatePath(iBadFileDir); - iBadFileDir.Insert( - 0, PathInfo::PhoneMemoryRootPath().Left( KMaxDriveName ) ); - - TRAP_IGNORE(ReadBadFileListL()); - - iPersistentSizeClasses.AppendL( - TSize(KGlxThumbnailSmallWidth, KGlxThumbnailSmallHeight)); - iPersistentSizeClasses.AppendL( - TSize(KGlxThumbnailLargeWidth, KGlxThumbnailLargeHeight)); - iPersistentSizeClasses.AppendL( - TSize(KGlxThumbnailPortraitWidth, KGlxThumbnailPortraitHeight)); - } - -// ----------------------------------------------------------------------------- -// NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CGlxtnFileUtility* CGlxtnFileUtility::NewL() - { - TRACER("CGlxtnFileUtility::NewL()"); - CGlxtnFileUtility* self = new (ELeave) CGlxtnFileUtility; - - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - - return self; - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CGlxtnFileUtility::~CGlxtnFileUtility() - { - TRACER("CGlxtnFileUtility::~CGlxtnFileUtility()"); - iFs.Close(); - iBadFileArray.ResetAndDestroy(); - iPersistentSizeClasses.Close(); - } - -// ----------------------------------------------------------------------------- -// FsSession -// Provide file server session for opening images from files. -// ----------------------------------------------------------------------------- -// -RFs& CGlxtnFileUtility::FsSession() - { - TRACER("RFs& CGlxtnFileUtility::FsSession()"); - return iFs; - } - -// ----------------------------------------------------------------------------- -// CheckBadFileListL -// Test whether a file is on the bad file list. If not the bad file marker -// is set to the filename, so that if a panic occurs it will be added to the -// bad file list. -// ----------------------------------------------------------------------------- -// -void CGlxtnFileUtility::CheckBadFileListL(const TDesC& aFilename) - { - TRACER("0CGlxtnFileUtility::CheckBadFileListL(const TDesC& aFilename)"); - for ( TInt i = 0; i < iBadFileArray.Count(); i++ ) - { - if ( 0 == iBadFileArray[i]->CompareF(aFilename) ) - { - // File is bad - User::Leave( KErrCorrupt ); - } - } - - // Set bad file marker - TPath path(iBadFileDir); - path.Append(KGlxBadFileMarker); - - // Ensure directory exists - TInt err = iFs.MkDirAll(path); - if ( err != KErrAlreadyExists ) - { - User::LeaveIfError(err); - } - - RFileWriteStream stream; - CleanupClosePushL(stream); - User::LeaveIfError(stream.Replace( - iFs, path, EFileWrite | EFileShareExclusive)); - stream << aFilename; - stream.CommitL(); - CleanupStack::PopAndDestroy(&stream); - } - -// ----------------------------------------------------------------------------- -// ClearBadFileMarker -// Clear the bad file marker. Called when processing a file is complete (no -// panic occurred). -// ----------------------------------------------------------------------------- -// -void CGlxtnFileUtility::ClearBadFileMarker() - { - TRACER("void CGlxtnFileUtility::ClearBadFileMarker()"); - TPath path(iBadFileDir); - path.Append(KGlxBadFileMarker); - - ( void )iFs.Delete( path ); // Ignore error - } - -// ----------------------------------------------------------------------------- -// IsPersistentSize -// Test whether a generated thumbnail should be stored in persistent storage. -// ----------------------------------------------------------------------------- -// -TBool CGlxtnFileUtility::IsPersistentSize(const TSize& aSize) - { - TRACER("CGlxtnFileUtility::IsPersistentSize()"); - for ( TInt i = 0; i < iPersistentSizeClasses.Count(); i++ ) - { - if ( iPersistentSizeClasses[i] == aSize ) - { - return ETrue; - } - } - - return EFalse; - } - -// ----------------------------------------------------------------------------- -// ReadBadFileListL -// ----------------------------------------------------------------------------- -// -void CGlxtnFileUtility::ReadBadFileListL() - { - TRACER("void CGlxtnFileUtility::ReadBadFileListL()"); - TPath pathList(iBadFileDir); - pathList.Append(KGlxBadFileList); - TPath pathMarker(iBadFileDir); - pathMarker.Append(KGlxBadFileMarker); - - RFileReadStream stream; - CleanupClosePushL(stream); - - // Check bad file list - if ( KErrNone == stream.Open( - iFs, pathList, EFileRead | EFileShareReadersOnly) ) - { - TInt err; - // Loop until end of file - do - { - TRAP(err, - HBufC* file = HBufC::NewLC(stream, KMaxTInt); - iBadFileArray.AppendL(file); - CleanupStack::Pop(file); - ) - } while ( KErrNone == err ); - - stream.Close(); - // NOTE: We always get KErrEof even if the file is corrupted - } - - // Check bad file marker - if ( KErrNone == stream.Open( - iFs, pathMarker, EFileRead | EFileShareReadersOnly) ) - { - // File exists, file in marker must be bad - HBufC* file = HBufC::NewLC(stream, KMaxTInt); - iBadFileArray.AppendL(file); - CleanupStack::Pop(file); - - // Save the list for next gallery session - // Recreate whole file in case existing file is corrupted - WriteBadFileListL(); - - stream.Close(); - ClearBadFileMarker(); - } - - CleanupStack::Pop(&stream); // Stream already closed - } - -// ----------------------------------------------------------------------------- -// WriteBadFileListL -// ----------------------------------------------------------------------------- -// -void CGlxtnFileUtility::WriteBadFileListL() - { - TRACER("void CGlxtnFileUtility::WriteBadFileListL()"); - TPath path(iBadFileDir); - path.Append(KGlxBadFileList); - - RFileWriteStream stream; - CleanupClosePushL(stream); - User::LeaveIfError(stream.Replace( - iFs, path, EFileWrite | EFileShareExclusive)); - - for ( TInt i = 0; i < iBadFileArray.Count() ; i++ ) - { - stream << *iBadFileArray[i]; - } - stream.CommitL(); - - CleanupStack::PopAndDestroy(&stream); - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtnfilteravailabletask.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtnfilteravailabletask.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,188 +0,0 @@ -/* -* 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: Task used for thumbnail availability filter. -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - -#include "glxtnfilteravailabletask.h" - -#include -#include - -#include "glxtnfileinfo.h" -#include "mglxtnstorage.h" -#include "mglxtnthumbnailcreatorclient.h" - -// ----------------------------------------------------------------------------- -// NewL -// ----------------------------------------------------------------------------- -// -CGlxtnFilterAvailableTask* CGlxtnFilterAvailableTask::NewL( - const TArray& aItemArray, const TSize& aSize, - MGlxtnThumbnailCreatorClient& aClient) - { - TRACER("CGlxtnFilterAvailableTask* CGlxtnFilterAvailableTask::NewL()"); - CGlxtnFilterAvailableTask* task = new (ELeave) CGlxtnFilterAvailableTask( - aSize, aClient); - CleanupStack::PushL(task); - task->ConstructL(aItemArray); - CleanupStack::Pop(task); - return task; - } - -// ----------------------------------------------------------------------------- -// Constructor -// ----------------------------------------------------------------------------- -// -CGlxtnFilterAvailableTask::CGlxtnFilterAvailableTask(const TSize& aSize, - MGlxtnThumbnailCreatorClient& aClient) : - CGlxtnClientTask(KGlxtnTaskIdFilterAvailable, KGlxIdNone, aClient), - iSize(aSize) - { - TRACER("CGlxtnFilterAvailableTask::CGlxtnFilterAvailableTask()"); - } - -// ----------------------------------------------------------------------------- -// ConstructL -// ----------------------------------------------------------------------------- -// -void CGlxtnFilterAvailableTask::ConstructL( - const TArray& aItemArray) - { - TRACER("void CGlxtnFilterAvailableTask::ConstructL()"); - TInt count = aItemArray.Count(); - for ( TInt i = 0; i < count; i++ ) - { - iIdArray.AppendL(aItemArray[i]); - } - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CGlxtnFilterAvailableTask::~CGlxtnFilterAvailableTask() - { - TRACER("CGlxtnFilterAvailableTask::~CGlxtnFilterAvailableTask()"); - delete iFileInfo; - iIdArray.Close(); - } - -// ----------------------------------------------------------------------------- -// DoStartL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnFilterAvailableTask::DoStartL(TRequestStatus& aStatus) - { - TRACER("TBool CGlxtnFilterAvailableTask::DoStartL()"); - iIndex = 0; - - GLX_ASSERT_DEBUG( !iFileInfo, Panic( EGlxPanicAlreadyInitialised ), - "iFileInfo not NULL" ); - iFileInfo = new (ELeave) CGlxtnFileInfo; - - return GetFileInfoL(aStatus); - } - -// ----------------------------------------------------------------------------- -// DoCancel -// ----------------------------------------------------------------------------- -// -void CGlxtnFilterAvailableTask::DoCancel() - { - TRACER("void CGlxtnFilterAvailableTask::DoCancel()"); - Storage()->StorageCancel(); - } - -// ----------------------------------------------------------------------------- -// DoRunL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnFilterAvailableTask::DoRunL(TRequestStatus& aStatus) - { - TRACER("TBool CGlxtnFilterAvailableTask::DoRunL()"); - TInt result = aStatus.Int(); - User::LeaveIfError(result); - - TBool active = EFalse; - - switch ( iState ) - { - case EStateFetchingUri: - Storage()->IsThumbnailAvailableL(iIdArray[iIndex], *iFileInfo, - iSize, &aStatus); - iState = EStateChecking; - active = ETrue; - break; - - case EStateChecking: - if ( KGlxThumbnailNotAvailable == result ) - { - iIndex++; - } - else - { - iIdArray.Remove(iIndex); - } - - active = GetFileInfoL(aStatus); - break; - - default: - GLX_ASSERT_ALWAYS( EFalse, Panic( EGlxPanicIllegalState ), - "CGlxtnFilterAvailableTask: Illegal state" ); - break; - } - - return active; - } - -// ----------------------------------------------------------------------------- -// DoRunError -// ----------------------------------------------------------------------------- -// -TBool CGlxtnFilterAvailableTask::DoRunError(TInt aError) - { - TRACER("CGlxtnFilterAvailableTask::DoRunError()"); - Client().FilterAvailableComplete(iIdArray, aError); - - return EFalse; - } - -// ----------------------------------------------------------------------------- -// GetFileInfoL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnFilterAvailableTask::GetFileInfoL(TRequestStatus& aStatus) - { - TRACER("CGlxtnFilterAvailableTask::GetFileInfoL()"); - if ( iIndex < iIdArray.Count() ) - { - Client().FetchFileInfoL(iFileInfo, iIdArray[iIndex], &aStatus); - iState = EStateFetchingUri; - - return ETrue; - } - - // Finished checking the array - Client().FilterAvailableComplete(iIdArray, KErrNone); - - return EFalse; - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtngeneratethumbnailtask.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtngeneratethumbnailtask.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,335 +0,0 @@ -/* -* 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: Classes for thumbnail-related tasks. -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - -#include "glxtngeneratethumbnailtask.h" - -#include -#include -#include -#include -#include -#include - -#include "glxtnfileinfo.h" -#include "glxtnfileutility.h" -#include "glxtnimageutility.h" -#include "glxtnsavethumbnailtask.h" -#include "glxtntaskmanager.h" -#include "glxtnthumbnailrequest.h" -#include "glxtnvideoutility.h" -#include "mglxtnthumbnailcreatorclient.h" - -// ----------------------------------------------------------------------------- -// NewL -// ----------------------------------------------------------------------------- -// -CGlxtnGenerateThumbnailTask* CGlxtnGenerateThumbnailTask::NewL( - const TGlxThumbnailRequest& aRequestInfo, - CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient) - { - TRACER("CGlxtnGenerateThumbnailTask::NewL()"); - CGlxtnGenerateThumbnailTask* task - = new (ELeave) CGlxtnGenerateThumbnailTask( - aRequestInfo, aFileUtility, aClient); - CleanupStack::PushL(task); - task->ConstructL(aRequestInfo.iBitmapHandle); - CleanupStack::Pop( task ); - return task; - } - -// ----------------------------------------------------------------------------- -// Constructor -// ----------------------------------------------------------------------------- -// -CGlxtnGenerateThumbnailTask::CGlxtnGenerateThumbnailTask( - const TGlxThumbnailRequest& aRequestInfo, - CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient) : - CGlxtnLoadThumbnailTask( KGlxtnTaskIdGenerateThumbnail, - aRequestInfo, aFileUtility, aClient ) - { - TRACER("CGlxtnGenerateThumbnailTask::CGlxtnGenerateThumbnailTask()"); - } - -// ----------------------------------------------------------------------------- -// ConstructL -// ----------------------------------------------------------------------------- -// -void CGlxtnGenerateThumbnailTask::ConstructL(TInt aBitmapHandle) - { - TRACER("CGlxtnGenerateThumbnailTask::ConstructL()"); - CGlxtnLoadThumbnailTask::ConstructL( aBitmapHandle ); - - iImageUtility = new (ELeave) CGlxtnImageUtility(iFileUtility.FsSession()); - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CGlxtnGenerateThumbnailTask::~CGlxtnGenerateThumbnailTask() - { - TRACER("CGlxtnGenerateThumbnailTask::~CGlxtnGenerateThumbnailTask()"); - delete iImageUtility; - delete iVideoUtility; - delete iImage; - } - -// ----------------------------------------------------------------------------- -// SetManager -// ----------------------------------------------------------------------------- -// -void CGlxtnGenerateThumbnailTask::SetManager(CGlxtnTaskManager* aManager) - { - TRACER("void CGlxtnGenerateThumbnailTask::SetManager()"); - iTaskManager = aManager; - } - -// ----------------------------------------------------------------------------- -// DoStartL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnGenerateThumbnailTask::DoStartL(TRequestStatus& aStatus) - { - TRACER("CGlxtnGenerateThumbnailTask::DoStartL()"); - iInfo = new (ELeave) CGlxtnFileInfo; - Client().FetchFileInfoL(iInfo, ItemId(), &aStatus); - iState = EStateFetchingUri; - - return ETrue; // Request has been issued - } - -// ----------------------------------------------------------------------------- -// DoCancel -// ----------------------------------------------------------------------------- -// -void CGlxtnGenerateThumbnailTask::DoCancel() - { - TRACER("void CGlxtnGenerateThumbnailTask::DoCancel()"); - CGlxtnLoadThumbnailTask::DoCancel(); - - iImageUtility->Cancel(); - - if ( iVideoUtility ) - { - iVideoUtility->Cancel(); - } - - iFileUtility.ClearBadFileMarker(); - } - -// ----------------------------------------------------------------------------- -// DoRunL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnGenerateThumbnailTask::DoRunL(TRequestStatus& aStatus) - { - TRACER("TBool CGlxtnGenerateThumbnailTask::DoRunL()"); - TInt error = aStatus.Int(); - - TBool active = EFalse; - - if ( KErrNone == error ) - { - switch ( iState ) - { - case EStateFetchingUri: - { - User::LeaveIfNull(iInfo); - iBadFileMarkerNotNeededFlag = ETrue; - - iInfo->IdentifyFileL(iVideo, iProtected); - // leave if file is DRM protected and client has no DRM - // capablity - if ( iProtected && !iDrmAllowed ) - { - User::Leave(KErrAccessDenied); - } - - if ( !LoadThumbnailL( aStatus ) ) - { - iBadFileMarkerNotNeededFlag = EFalse; - iFileUtility.CheckBadFileListL( iInfo->FilePath() ); - HighQualityDecodeL( aStatus ); - } - active = ETrue; - } - break; - - case EStateLoading: - active = HandleLoadedThumbnailL( aStatus ); - break; - - case EStateDecodingThumbnail: - // Nothing to do - break; - - case EStateDecodingImage: - { - iImageUtility->FreeDecoder(); - - // Resize empty bitmap to required size - TSize targetSize(iRequestedSize); - iImageUtility->AdjustSize(targetSize, iImage->SizeInPixels()); - User::LeaveIfError(iThumbnail->Resize(targetSize)); - - iImageUtility->FilterImageL(&aStatus, iImage, iImage, iThumbnail); - iState = EStateFiltering; - active = ETrue; - } - break; - - case EStateFiltering: - { - TSize targetSize(iRequestedSize); - const TSize srcSize = iImage->SizeInPixels(); - iImageUtility->AdjustSize(targetSize, iImage->SizeInPixels()); - iImageUtility->ScaleImageL(aStatus, *iImage, srcSize, *iThumbnail, targetSize); - iState = EStateScaling; - active = ETrue; - } - break; - - case EStateScaling: - { - User::LeaveIfError(iThumbnail->SetDisplayMode(KGlxThumbnailDisplayMode)); - - // Create task to save generated thumbnail - if ( Storage() && !iInfo->iTemporary - && !SizeRequiresDrmRights() - && iFileUtility.IsPersistentSize(iRequestedSize) ) - { - CGlxtnSaveThumbnailTask* task - = CGlxtnSaveThumbnailTask::NewL(ItemId(), iInfo, - iRequestedSize, iThumbnail, Storage()); - iThumbnail = NULL; // Task has ownership - iInfo = NULL; // Task has ownership - iTaskManager->AddTaskL(task); - } - break; - } - - default: - GLX_ASSERT_ALWAYS( EFalse, Panic( EGlxPanicIllegalState ), - "CGlxtnGenerateThumbnailTask: Illegal state" ); - break; - } - } - else - { - if ( EStateLoading == iState ) - { - // Loading failed - generate new thumbnail instead - HighQualityDecodeL( aStatus ); - active = ETrue; - } - } - - if ( !active ) - { - if ( !iBadFileMarkerNotNeededFlag ) - { - iFileUtility.ClearBadFileMarker(); - } - Client().ThumbnailFetchComplete(ItemId(), - EGlxThumbnailQualityHigh, error); - } - - return active; - } - -// ----------------------------------------------------------------------------- -// DoRunError -// ----------------------------------------------------------------------------- -// -TBool CGlxtnGenerateThumbnailTask::DoRunError(TInt aError) - { - TRACER("TBool CGlxtnGenerateThumbnailTask::DoRunError(TInt aError)"); - iFileUtility.ClearBadFileMarker(); - Client().ThumbnailFetchComplete(ItemId(), EGlxThumbnailQualityHigh, aError); - - return EFalse; - } - -// --------------------------------------------------------------------------- -// HighQualityDecodeL -// --------------------------------------------------------------------------- -// -void CGlxtnGenerateThumbnailTask::HighQualityDecodeL( - TRequestStatus& aStatus ) - { - TRACER("void CGlxtnGenerateThumbnailTask::HighQualityDecodeL()"); - RArray targetSizes; - CleanupClosePushL(targetSizes); - targetSizes.AppendL( TSize(iRequestedSize) ); - if ( iVideo ) - { - iVideoUtility = new (ELeave) CGlxtnVideoUtility; - iVideoUtility->GetVideoFrameL( &aStatus, iImage, iInfo->FilePath(), targetSizes, KGlxThumbnailDisplayMode ); - } - else - { - iImage = iImageUtility->DecodeImageL( aStatus, iInfo->FilePath(), - targetSizes, KGlxThumbnailDisplayMode ); - } - CleanupStack::PopAndDestroy(&targetSizes); - iState = EStateDecodingImage; - } - -// ----------------------------------------------------------------------------- -// SizeRequiresDrmRights -// ----------------------------------------------------------------------------- -// -TBool CGlxtnGenerateThumbnailTask::SizeRequiresDrmRights() - { - TRACER("TBool CGlxtnGenerateThumbnailTask::SizeRequiresDrmRights()"); - if ( iProtected ) - { - if ( iVideo ) - { - return ETrue; - } - - // Rights are required if thumbnail doesn't fit in KGlxThumbnailDrmWidth - // by KGlxThumbnailDrmHeight box either portrait or landscape - if ( (iRequestedSize.iWidth > KGlxThumbnailDrmWidth - || iRequestedSize.iHeight > KGlxThumbnailDrmHeight) - && (iRequestedSize.iWidth > KGlxThumbnailDrmHeight - || iRequestedSize.iHeight > KGlxThumbnailDrmWidth) ) - { - return ETrue; - } - - const TSize& imageSize(iImageUtility->OriginalSize()); - - // Rights are required if thumbnail is greater than 25% of image size - // Due to preserving aspect ratio, this will only happen if both width - // and height are greater than half the image width and height - if ( iRequestedSize.iWidth > imageSize.iWidth / 2 - && iRequestedSize.iHeight> imageSize.iHeight / 2 ) - { - return ETrue; - } - } - - return EFalse; - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtnimagedecoderfactory.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtnimagedecoderfactory.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* 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: Implementation of GlxtnImageDecoderFactory -* -*/ - - - -#include "glxtnimagedecoderfactory.h" - -#include -#include // For CExtJpegDecoder - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -CImageDecoder* GlxtnImageDecoderFactory::NewL( RFs& aFs, - const TDesC& aFilename ) - { - TRACER("CImageDecoder* GlxtnImageDecoderFactory::NewL()"); - CImageDecoder* decoder = NULL; - - // Use extended JPEG decoder - TRAPD( err, decoder = CExtJpegDecoder::FileNewL( - CExtJpegDecoder::EHwImplementation, aFs, aFilename, CImageDecoder::EOptionNone ) ); - if ( KErrNone != err ) - { - TRAP(err,decoder = CExtJpegDecoder::FileNewL( - CExtJpegDecoder::ESwImplementation, aFs, aFilename, CImageDecoder::EOptionNone ) ); - if ( KErrNone != err ) - { - // Not a JPEG - use standard decoder - decoder = CImageDecoder::FileNewL( aFs, aFilename, CImageDecoder::EOptionNone ); - } - } - - return decoder; - } - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -CImageDecoder* GlxtnImageDecoderFactory::NewL( RFs& aFs, const TDesC8& aData ) - { - TRACER("CImageDecoder* GlxtnImageDecoderFactory::NewL()"); - CImageDecoder* decoder = NULL; - - TRAPD( err, decoder = CExtJpegDecoder::DataNewL( - CExtJpegDecoder::EHwImplementation, aFs, aData ) ); - if ( KErrNone != err ) - { - TRAP(err, decoder = CExtJpegDecoder::DataNewL( - CExtJpegDecoder::ESwImplementation, aFs, aData ) ); - if ( KErrNone != err ) - { - // Not a JPEG - use standard decoder - decoder = CImageDecoder::DataNewL( aFs, aData, CImageDecoder::EOptionNone ); - } - } - - return decoder; - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtnimageutility.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtnimageutility.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,626 +0,0 @@ -/* -* 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: Utility for creating bitmaps from video files -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - -#include "glxtnimageutility.h" - -#include // MIHLScaler -#include -#include -#include -#include -#include - -#include "glxtnimagedecoderfactory.h" - -// ----------------------------------------------------------------------------- -// Constructor -// ----------------------------------------------------------------------------- -// -CGlxtnImageUtility::CGlxtnImageUtility(RFs& aFs) : iFs(aFs) - { - TRACER("CGlxtnImageUtility::CGlxtnImageUtility()"); - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CGlxtnImageUtility::~CGlxtnImageUtility() - { - TRACER("CGlxtnImageUtility::~CGlxtnImageUtility()"); - delete iDecoder; - delete iScaler; - delete iBitGc; - } - -// ----------------------------------------------------------------------------- -// Cancel -// ----------------------------------------------------------------------------- -// -void CGlxtnImageUtility::Cancel() - { - TRACER("void CGlxtnImageUtility::Cancel()"); - if ( iDecoder ) - { - iDecoder->Cancel(); - } - if ( iScaler && iScaler->IsBusy()) - { - iScaler->CancelProcess(); - } - } - -// ----------------------------------------------------------------------------- -// AdjustSize -// ----------------------------------------------------------------------------- -// -void CGlxtnImageUtility::AdjustSize(TSize& aTargetSize, const TSize& aSourceSize) - { - TRACER("void CGlxtnImageUtility::AdjustSize()"); - if ( aTargetSize.iHeight * aSourceSize.iWidth - < aTargetSize.iWidth * aSourceSize.iHeight ) - { - // Source has taller aspect than target so reduce target width - aTargetSize.iWidth = ( ( aTargetSize.iHeight * aSourceSize.iWidth ) - / ( aSourceSize.iHeight ) ); - } - else - { - // Source has wider aspect than target so reduce target height - aTargetSize.iHeight = (aTargetSize.iWidth * aSourceSize.iHeight) - / aSourceSize.iWidth; - } - } - -// ----------------------------------------------------------------------------- -// DecodeImageL -// ----------------------------------------------------------------------------- -// -CFbsBitmap* CGlxtnImageUtility::DecodeImageL(TRequestStatus& aStatus, - const TDesC& aFileName, RArray& aTargetSizes, TDisplayMode aMode) - { - TRACER("CFbsBitmap* CGlxtnImageUtility::DecodeImageL()"); - delete iDecoder; - iDecoder = NULL; - iDecoder = GlxtnImageDecoderFactory::NewL( iFs, aFileName ); - - iOriginalSize = iDecoder->FrameInfo().iOverallSizeInPixels; - if ( 0 == iOriginalSize.iWidth || 0 == iOriginalSize.iHeight ) - { - User::Leave(KErrCorrupt); - } - - TInt count = aTargetSizes.Count(); - TSize testSize; - TSize targetSize; - for ( TInt i = 0 ; i < count ; i++ ) - { - testSize = aTargetSizes[i]; - AdjustSize(testSize, iOriginalSize); - if( ( testSize.iWidth > targetSize.iWidth ) || ( testSize.iHeight > targetSize.iHeight ) ) - { - targetSize = testSize; - } - } - - // Find max scaling factor which won't make image smaller than target size - TInt shift = 3; - while ( shift - && ((iOriginalSize.iWidth >> shift) < targetSize.iWidth - || (iOriginalSize.iHeight >> shift) < targetSize.iHeight ) ) - { - shift--; - } - TInt roundUp = (1 << shift) - 1; - TSize loadSize((iOriginalSize.iWidth + roundUp) >> shift, - (iOriginalSize.iHeight + roundUp) >> shift); - - CFbsBitmap* image = new (ELeave) CFbsBitmap; - CleanupStack::PushL(image); - User::LeaveIfError(image->Create(loadSize, aMode)); - - iDecoder->Convert(&aStatus, *image); - - CleanupStack::Pop(image); - return image; - } - -// ----------------------------------------------------------------------------- -// FreeDecoder -// ----------------------------------------------------------------------------- -// -void CGlxtnImageUtility::FreeDecoder() - { - TRACER("void CGlxtnImageUtility::FreeDecoder()"); - delete iDecoder; - iDecoder = NULL; - } - -// ----------------------------------------------------------------------------- -// OriginalSize -// ----------------------------------------------------------------------------- -// -const TSize& CGlxtnImageUtility::OriginalSize() const - { - TRACER("TSize& CGlxtnImageUtility::OriginalSize()"); - return iOriginalSize; - } - -//--------------------------------------------------------------------------- -/** - K-Nearest neighbour scaling for EColor64K. - Code originally inherited from t_display.cpp by Toni Hemminki. - Added windowing and further optimized by Jarmo Nikula 2006-2007. - - @param aSrc Source buffer pointer - @param aSrcStride Source buffer stride in bytes - @param aSrcCols Source columns - @param aSrcRows Source rows - @param aX Source window top-left X-coordinate - @param aY Source window top-left Y-coordinate - @param aW Source window width - @param aH Source window height - @param aDst Destination buffer pointer - @param aDstStride Destination buffer stride in bytes - @param aDstCols Destination columns, must be even - @param aDstRows Destination rows -*/ -// OPTION's for MMP file: -// Interleave assembly code with C, output can be found on txt-files on some BUILD directory: -// OPTION ARMCC --asm --interleave -// Modify optimization for ARM insturcion set and for maximum speed -// OPTION_REPLACE ARMCC --arm -Otime -/* aSource->LockHeap(); - TUint16* sourceAddress = (TUint16*)aSource->DataAddress(); - aSource->UnlockHeap(); - aTarget->LockHeap(); - TUint16* targetAddress = (TUint16*)aTarget->DataAddress(); - aTarget->UnlockHeap(); - ScaleColor64K(sourceAddress, aSource->DataStride(), - sourceSize.iWidth, sourceSize.iHeight, 0, 0, sourceSize.iWidth, sourceSize.iHeight, - targetAddress, aTarget->DataStride(), - targetSize.iWidth, targetSize.iHeight); -*/ - -void CGlxtnImageUtility::FilterImageL(TRequestStatus* aStatus, CFbsBitmap* aSource, CFbsBitmap*& aFilteredSource, CFbsBitmap* aTarget) - { - TRACER("void CGlxtnImageUtility::FilterImageL()"); - TSize sourceSize(aSource->SizeInPixels()); - TSize targetSize(aTarget->SizeInPixels()); - TInt scalePercent = ((100*sourceSize.iWidth)/targetSize.iWidth) - 100; - - // no need to filter if close enough or smaller - if ( scalePercent >= 2 && ( aTarget->DisplayMode() == EColor64K ) ) - { - FilterL(aSource, aFilteredSource, scalePercent); - } - - *aStatus = KRequestPending; - User::RequestComplete(aStatus, KErrNone); - } - -// ----------------------------------------------------------------------------- -// ScaleImageL -// ----------------------------------------------------------------------------- -// -void CGlxtnImageUtility::ScaleImageL(TRequestStatus& aStatus, CFbsBitmap& aSrcBitmap, - const TRect& aSrcRect, CFbsBitmap& aDstBitmap, - const TRect& aDstRect) - { - TRACER("void CGlxtnImageUtility::ScaleImageL(IHL)"); - if (!iScaler) - { - TInt option = MIHLScaler::EOptionUseBilinearInterpolation; - - iScaler = IHLScaler::CreateL(option); - } - User::LeaveIfError(iScaler->Scale(aStatus, aSrcBitmap, aSrcRect, aDstBitmap, aDstRect)); - } - -void CGlxtnImageUtility::ScaleImage64kL(TRequestStatus* aStatus, CFbsBitmap* aSource, CFbsBitmap* aFilteredSource, CFbsBitmap* aTarget) - { - TRACER("void CGlxtnImageUtility::ScaleImage64kL()"); - TSize sourceSize(aSource->SizeInPixels()); - TSize targetSize(aTarget->SizeInPixels()); - TInt scalePercent = ((100*sourceSize.iWidth)/targetSize.iWidth) - 100; - TRect targetRect(targetSize); - TRect sourceRect(sourceSize); - - CFbsBitmap* sourceImage = aFilteredSource; - if ( !aFilteredSource ) - { - sourceImage = aSource; - } - if ( scalePercent < 2 ) - { - if ( scalePercent > 0 ) - { - sourceRect = targetRect; - } - sourceImage = aSource; - } - sourceImage->LockHeap(); - TUint16* sourceAddress = (TUint16*)sourceImage->DataAddress(); - sourceImage->UnlockHeap(); - aTarget->LockHeap(); - TUint16* targetAddress = (TUint16*)aTarget->DataAddress(); - aTarget->UnlockHeap(); - ScaleColor64K(sourceAddress, sourceImage->DataStride(), - sourceImage->SizeInPixels().iWidth, sourceImage->SizeInPixels().iHeight, 0, 0, sourceImage->SizeInPixels().iWidth, sourceImage->SizeInPixels().iHeight, - targetAddress, aTarget->DataStride(), - targetSize.iWidth, targetSize.iHeight); - -/* if ( !iBitGc ) - { - iBitGc = CFbsBitGc::NewL(); - } - CFbsBitmapDevice *bitmapDevice = CFbsBitmapDevice::NewL(aTarget); - CleanupStack::PushL(bitmapDevice); - iBitGc->Activate(bitmapDevice); - iBitGc->DrawBitmap(targetRect, sourceImage, sourceRect); - CleanupStack::PopAndDestroy(bitmapDevice); -*/ - *aStatus = KRequestPending; - User::RequestComplete(aStatus, KErrNone); - } - -void CGlxtnImageUtility::ScaleColor64K( TUint16* aSrc, TInt aSrcStride, TInt /*aSrcCols*/, TInt /*aSrcRows*/, - TInt aX, TInt aY, TInt aW, TInt aH, - TUint16* aDst, TInt aDstStride, TInt aDstCols, TInt aDstRows ) - { - TRACER("void CGlxtnImageUtility::ScaleColor64K()"); - const TUint KPrecision = 16; - TUint hInc = ( aW<< KPrecision ) / aDstCols; - TUint vInc = ( aH << KPrecision ) / aDstRows; - TUint v = 0; - for ( TUint row = aDstRows; row > 0; --row ) - { - TInt h = hInc * (aDstCols - 1); - TUint linestart = aSrcStride * ( aY + ( v >> KPrecision ) ) / sizeof(TUint16) + aX; - TUint16* src = &aSrc[ linestart ]; - TUint32* dst = (TUint32*)aDst + aDstCols / 2; - TUint32 pxl2x; - // This loop generates 11 assembly instructions per round - // when using "--arm --Otime" options. Since two pixels are handled per round, - // it means 5.5 instructions per pixel on average. - do { - pxl2x = src[ h >> KPrecision ]<<16; - h -= hInc; - pxl2x |= src[ h >> KPrecision ]; - *--dst = pxl2x; - // Compiler eliminates CMP instruction when substraction - // is done inside the while () statement. - } while ( ( h -= hInc ) >= 0 ); - v += vInc; - aDst += aDstStride / sizeof(TUint16); - } - } - -void CGlxtnImageUtility::FilterL( CFbsBitmap* aSource, CFbsBitmap*& aFilteredSource, TInt aFilterPercent ) - { - TRACER("void CGlxtnImageUtility::FilterL()"); - if ( !aFilteredSource ) - { - TSize imageSize = aSource->SizeInPixels(); - aFilteredSource = new (ELeave) CFbsBitmap; - aFilteredSource->Create(imageSize, aSource->DisplayMode()); - - CFbsBitmapDevice *bitmapDevice = CFbsBitmapDevice::NewL(aFilteredSource); - if ( !iBitGc ) - { - iBitGc = CFbsBitGc::NewL(); - } - iBitGc->Activate(bitmapDevice); - iBitGc->BitBlt(TPoint(), aSource, imageSize); - delete bitmapDevice; - } - - TSize imageSize = aFilteredSource->SizeInPixels(); - aFilteredSource->LockHeap(); - TUint16* sourceAddress = (TUint16*)aFilteredSource->DataAddress(); - aFilteredSource->UnlockHeap(); - const TInt KGlxScalingNeeds4Filtering = 80; // if scaling more than 1.8 need to filter by 4 - const TInt KGlxScalingNeeds8Filtering = 260; // if scaling more than 3.6 need to filter by 8 - if ( KGlxScalingNeeds8Filtering < aFilterPercent ) - { - FIRFiltering8( - sourceAddress, aFilteredSource->DataStride() / sizeof(TUint16), - imageSize.iWidth, imageSize.iHeight ); - } - else if ( KGlxScalingNeeds4Filtering < aFilterPercent ) - { - FIRFiltering4( - sourceAddress, aFilteredSource->DataStride() / sizeof(TUint16), - imageSize.iWidth, imageSize.iHeight ); - } - else - { - FIRFiltering( - sourceAddress, aFilteredSource->DataStride() / sizeof(TUint16), - imageSize.iWidth, imageSize.iHeight ); - } - } - -#define rmask565 0xf800 -#define gmask565 0x07e0 -#define bmask565 0x001f -#define rbmask565 (rmask565|bmask565) -#define rm565( rgb ) ((rgb) & rmask565) -#define gm565( rgb ) ((rgb) & gmask565) -#define bm565( rgb ) ((rgb) & bmask565) -#define rbm565( rgb ) ((rgb) & rbmask565) -#define r565( rgb ) ((rgb)>>11) -#define g565( rgb ) (gm565(rgb)>>5) -#define b565( rgb ) (bm565(rgb)) -#define rgb565( r, g, b ) (((r)<<11)|((g)<<5)|(b)) - -#define mask32gbr655 0x07e0f81f - -// Keep below three defs in sync with each other! -#define KFIRLen 2 -#define KFIRCen (KFIRLen / 2) -#define incFIRIndex( i ) i = (i + 1) & (KFIRLen - 1) -// Keep above three defs in sync with each other! - -void CGlxtnImageUtility::FIRFiltering( - TUint16* aDst, TUint aDstStridep, TUint aDstCols, TUint aDstRows ) - { - TRACER("void CGlxtnImageUtility::FIRFiltering( )"); - TUint firFifo[ KFIRLen ]; - TUint i; // index for fifo in&out - TUint16 *p; - TUint32 px; - TInt row, col; - TUint FIRsum; - // Horizontal scan. - p = aDst; - for ( row = aDstRows - 1; row >= 0; row-- ) - { - // read for cache - //for ( col = aDstCols - 1; col >= 0; col-- ) TInt temp = p[ col ]; - // Fill in the FIR first. - // TODO: Fill in with extrapolated values at edges! - FIRsum = ((KFIRLen / 2)<<21) | ((KFIRLen / 2)<<11) | (KFIRLen / 2); // for correct rounding - i = 0; - TUint32 mask1 = mask32gbr655; - for ( col = 0; col < KFIRLen; col++ ) - { - px = p[ col ]; - px = ((px<<16) | px) & mask1; - firFifo[ i ] = px; - FIRsum += px; - incFIRIndex( i ); - } - TUint32 ave; - for ( ; col < aDstCols; col++ ) - { - ave = ( FIRsum / KFIRLen ) & mask1; - p[ col - KFIRCen ] = TUint16( ave | (ave>>16) ); - FIRsum -= firFifo[ i ]; - px = p[ col ]; - px = ((px<<16) | px) & mask1; - firFifo[ i ] = px; - FIRsum += px; - incFIRIndex( i ); - } - p += aDstStridep; - } - // Vertical scan. - for ( col = aDstCols - 1; col >= 0; col-- ) - { - // Fill in the FIR first. - FIRsum = ((KFIRLen / 2)<<21) | ((KFIRLen / 2)<<11) | (KFIRLen / 2); // for correct rounding - TUint32 mask1 = mask32gbr655; - i = 0; - p = aDst + col; - for ( row = 0; row < KFIRLen; row++ ) - { - px = *p; - px = ((px<<16) | px) & mask1; - firFifo[ i ] = px; - FIRsum += px; - incFIRIndex( i ); - p += aDstStridep; - } - TUint32 ave; - p -= aDstStridep * KFIRCen; - for ( ; row < aDstRows; row++ ) - { - ave = ( FIRsum / KFIRLen ) & mask1; - p[0] = TUint16( ave | (ave>>16) ); - FIRsum -= firFifo[ i ]; - px = p[ aDstStridep * KFIRCen ]; - px = ((px<<16) | px) & mask1; - firFifo[ i ] = px; - FIRsum += px; - incFIRIndex( i ); - p += aDstStridep; - } - } - } -// -// Keep below three defs in sync with each other! -#define KFIRLen4 4 -#define KFIRCen4 (KFIRLen4 / 2) -#define incFIRIndex4( i ) i = (i + 1) & (KFIRLen4 - 1) -// Keep above three defs in sync with each other! - -void CGlxtnImageUtility::FIRFiltering4( - TUint16* aDst, TUint aDstStridep, TUint aDstCols, TUint aDstRows ) - { - TRACER("void CGlxtnImageUtility::FIRFiltering4()"); - TUint firFifo[ KFIRLen4 ]; - TUint i; // index for fifo in&out - TUint16 *p; - TUint32 px; - TInt row, col; - TUint FIRsum; - // Horizontal scan. - p = aDst; - for ( row = aDstRows - 1; row >= 0; row-- ) - { - // read for cache - //for ( col = aDstCols - 1; col >= 0; col-- ) TInt temp = p[ col ]; - // Fill in the FIR first. - // TODO: Fill in with extrapolated values at edges! - FIRsum = ((KFIRLen4 / 2)<<21) | ((KFIRLen4 / 2)<<11) | (KFIRLen4 / 2); // for correct rounding - i = 0; - TUint32 mask1 = mask32gbr655; - for ( col = 0; col < KFIRLen4; col++ ) - { - px = p[ col ]; - px = ((px<<16) | px) & mask1; - firFifo[ i ] = px; - FIRsum += px; - incFIRIndex4( i ); - } - TUint32 ave; - for ( ; col < aDstCols; col++ ) - { - ave = ( FIRsum / KFIRLen4 ) & mask1; - p[ col - KFIRCen4 ] = TUint16( ave | (ave>>16) ); - FIRsum -= firFifo[ i ]; - px = p[ col ]; - px = ((px<<16) | px) & mask1; - firFifo[ i ] = px; - FIRsum += px; - incFIRIndex4( i ); - } - p += aDstStridep; - } - // Vertical scan. - for ( col = aDstCols - 1; col >= 0; col-- ) - { - // Fill in the FIR first. - FIRsum = ((KFIRLen4 / 2)<<21) | ((KFIRLen4 / 2)<<11) | (KFIRLen4 / 2); // for correct rounding - TUint32 mask1 = mask32gbr655; - i = 0; - p = aDst + col; - for ( row = 0; row < KFIRLen4; row++ ) - { - px = *p; - px = ((px<<16) | px) & mask1; - firFifo[ i ] = px; - FIRsum += px; - incFIRIndex4( i ); - p += aDstStridep; - } - TUint32 ave; - p -= aDstStridep * KFIRCen4; - for ( ; row < aDstRows; row++ ) - { - ave = ( FIRsum / KFIRLen4 ) & mask1; - p[0] = TUint16( ave | (ave>>16) ); - FIRsum -= firFifo[ i ]; - px = p[ aDstStridep * KFIRCen4 ]; - px = ((px<<16) | px) & mask1; - firFifo[ i ] = px; - FIRsum += px; - incFIRIndex4( i ); - p += aDstStridep; - } - } - } - -// Keep below three defs in sync with each other! -#define KFIRLen8 8 -#define KFIRCen8 (KFIRLen8 / 2) -#define incFIRIndex8( i ) i = (i + 1) & (KFIRLen8 - 1) -// Keep above three defs in sync with each other! - -void CGlxtnImageUtility::FIRFiltering8( - TUint16* aDst, TUint aDstStridep, TUint aDstCols, TUint aDstRows ) - { - TRACER("void CGlxtnImageUtility::FIRFiltering8()"); - TUint firFifo[ KFIRLen8 ]; - TUint i; // index for fifo in&out - TUint16 *p; - TUint32 px; - TInt row, col; - TUint FIRsum; - // Horizontal scan. - p = aDst; - for ( row = aDstRows - 1; row >= 0; row-- ) - { - // read for cache - //for ( col = aDstCols - 1; col >= 0; col-- ) TInt temp = p[ col ]; - // Fill in the FIR first. - // TODO: Fill in with extrapolated values at edges! - FIRsum = ((KFIRLen8 / 2)<<21) | ((KFIRLen8 / 2)<<11) | (KFIRLen8 / 2); // for correct rounding - i = 0; - TUint32 mask1 = mask32gbr655; - for ( col = 0; col < KFIRLen8; col++ ) - { - px = p[ col ]; - px = ((px<<16) | px) & mask1; - firFifo[ i ] = px; - FIRsum += px; - incFIRIndex8( i ); - } - TUint32 ave; - for ( ; col < aDstCols; col++ ) - { - ave = ( FIRsum / KFIRLen8 ) & mask1; - p[ col - KFIRCen8 ] = TUint16( ave | (ave>>16) ); - FIRsum -= firFifo[ i ]; - px = p[ col ]; - px = ((px<<16) | px) & mask1; - firFifo[ i ] = px; - FIRsum += px; - incFIRIndex8( i ); - } - p += aDstStridep; - } - // Vertical scan. - for ( col = aDstCols - 1; col >= 0; col-- ) - { - // Fill in the FIR first. - FIRsum = ((KFIRLen8 / 2)<<21) | ((KFIRLen8 / 2)<<11) | (KFIRLen8 / 2); // for correct rounding - TUint32 mask1 = mask32gbr655; - i = 0; - p = aDst + col; - for ( row = 0; row < KFIRLen8; row++ ) - { - px = *p; - px = ((px<<16) | px) & mask1; - firFifo[ i ] = px; - FIRsum += px; - incFIRIndex8( i ); - p += aDstStridep; - } - TUint32 ave; - p -= aDstStridep * KFIRCen8; - for ( ; row < aDstRows; row++ ) - { - ave = ( FIRsum / KFIRLen8 ) & mask1; - p[0] = TUint16( ave | (ave>>16) ); - FIRsum -= firFifo[ i ]; - px = p[ aDstStridep * KFIRCen8 ]; - px = ((px<<16) | px) & mask1; - firFifo[ i ] = px; - FIRsum += px; - incFIRIndex8( i ); - p += aDstStridep; - } - } - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtnloadthumbnailtask.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtnloadthumbnailtask.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +0,0 @@ -/* -* 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: Base class for tasks which load thumbnails -* -*/ - - - -#include "glxtnloadthumbnailtask.h" - -#include -#include -#include -#include -#include - -#include "glxtnfileinfo.h" -#include "glxtnfileutility.h" -#include "glxtnimagedecoderfactory.h" -#include "glxtnthumbnailrequest.h" -#include "mglxtnstorage.h" - - - -// --------------------------------------------------------------------------- -// Constructor -// --------------------------------------------------------------------------- -// -CGlxtnLoadThumbnailTask::CGlxtnLoadThumbnailTask( const TGlxtnTaskId& aId, - const TGlxThumbnailRequest& aRequestInfo, - CGlxtnFileUtility& aFileUtility, - MGlxtnThumbnailCreatorClient& aClient) : - CGlxtnClientTask( aId, aRequestInfo.iId, aClient ), - iFileUtility( aFileUtility ), iRequestedSize( aRequestInfo.iSizeClass ), - iDrmAllowed( aRequestInfo.iDrmAllowed ) - { - TRACER("CGlxtnLoadThumbnailTask::CGlxtnLoadThumbnailTask()"); - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -// -CGlxtnLoadThumbnailTask::~CGlxtnLoadThumbnailTask() - { - TRACER("CGlxtnLoadThumbnailTask::~CGlxtnLoadThumbnailTask()"); - delete iDecoder; - delete iThumbnail; - delete iThumbData; - delete iInfo; - } - -// ----------------------------------------------------------------------------- -// ConstructL -// ----------------------------------------------------------------------------- -// -void CGlxtnLoadThumbnailTask::ConstructL( TInt aBitmapHandle ) - { - TRACER("void CGlxtnLoadThumbnailTask::ConstructL()"); - // Duplicate the client's bitmap - iThumbnail = new (ELeave) CFbsBitmap(); - User::LeaveIfError( iThumbnail->Duplicate( aBitmapHandle ) ); - } - -// --------------------------------------------------------------------------- -// DoCancel -// --------------------------------------------------------------------------- -// -void CGlxtnLoadThumbnailTask::DoCancel() - { - TRACER("void CGlxtnLoadThumbnailTask::DoCancel()"); - if ( iDecoder ) - { - iDecoder->Cancel(); - } - - Storage()->StorageCancel(); - } - -// --------------------------------------------------------------------------- -// LoadThumbnailL -// --------------------------------------------------------------------------- -// -TBool CGlxtnLoadThumbnailTask::LoadThumbnailL( TRequestStatus& aStatus ) - { - TRACER("TBool CGlxtnLoadThumbnailTask::LoadThumbnailL()"); - GLX_ASSERT_DEBUG( iInfo, Panic( EGlxPanicNullPointer ), "No file info" ); - - if ( Storage() && iFileUtility.IsPersistentSize( iRequestedSize ) ) - { - Storage()->LoadThumbnailDataL( iThumbData, iFormat, ItemId(), - *iInfo, iRequestedSize, &aStatus ); - iState = EStateLoading; - - return ETrue; - } - - return EFalse; - } - -// --------------------------------------------------------------------------- -// HandleLoadedThumbnailL -// --------------------------------------------------------------------------- -// -TBool CGlxtnLoadThumbnailTask::HandleLoadedThumbnailL(TRequestStatus& aStatus) - { - TRACER("CGlxtnLoadThumbnailTask::HandleLoadedThumbnailL()"); - TBool active = EFalse; - - User::LeaveIfNull( iThumbData ); - - switch ( iFormat ) - { - case EGlxIDF_Bitmap: - { - CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; - CleanupStack::PushL( bitmap ); - - RDesReadStream stream( *iThumbData ); - CleanupClosePushL( stream ); - stream >> *bitmap; - CleanupStack::PopAndDestroy( &stream ); - - User::LeaveIfError( iThumbnail->Resize( bitmap->SizeInPixels() ) ); - - CFbsBitmapDevice* device = CFbsBitmapDevice::NewL( iThumbnail ); - CleanupStack::PushL( device ); - CFbsBitGc* context = NULL; - User::LeaveIfError( device->CreateContext( context ) ); - CleanupStack::PushL( context ); - - context->BitBlt( TPoint(), bitmap ); - - CleanupStack::PopAndDestroy( context ); - CleanupStack::PopAndDestroy( device ); - - CleanupStack::PopAndDestroy( bitmap ); - } - break; - - case EGlxIDF_JPEG: - iDecoder = GlxtnImageDecoderFactory::NewL( - iFileUtility.FsSession(), *iThumbData ); - DecodeThumbnailL( aStatus, EFalse ); - active = ETrue; - break; - - default: - User::Leave( KErrNotSupported ); - break; - } - - return active; - } - -// --------------------------------------------------------------------------- -// DecodeThumbnailL -// --------------------------------------------------------------------------- -// -void CGlxtnLoadThumbnailTask::DecodeThumbnailL( TRequestStatus& aStatus, - TBool aScaleBitmap ) - { - TRACER("CGlxtnLoadThumbnailTask::DecodeThumbnailL()"); - GLX_ASSERT_DEBUG( iDecoder, Panic( EGlxPanicNullPointer ), "No decoder" ); - - // Resize empty bitmap to required size - TSize thumbSize( iDecoder->FrameInfo().iOverallSizeInPixels ); - if ( aScaleBitmap ) - { - // Find scaling factor which makes the image closest to requested size - // Use biggest size less than 150% of the requested size - TInt maxWidth = iRequestedSize.iWidth * 3 / 2; - TInt maxHeight = iRequestedSize.iHeight * 3 / 2; - TInt shift = 0; - while ( shift < 3 - && ((thumbSize.iWidth >> shift) > maxWidth - || (thumbSize.iHeight >> shift) > maxHeight) ) - { - shift++; - } - TInt fudge = (1 << shift) - 1; // Used to "round up" the scaled values - thumbSize.SetSize((thumbSize.iWidth + fudge) >> shift, - (thumbSize.iHeight + fudge) >> shift); - } - User::LeaveIfError( iThumbnail->Resize(thumbSize) ); - - iDecoder->Convert( &aStatus, *iThumbnail ); - iState = EStateDecodingThumbnail; - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtnquickthumbnailtask.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtnquickthumbnailtask.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,350 +0,0 @@ -/* -* 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: Classes for thumbnail-related tasks. -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - -#include "glxtnquickthumbnailtask.h" - -#include -#include -#include -#include - -#include "glxtnfileinfo.h" -#include "glxtnfileutility.h" -#include "glxtnimagedecoderfactory.h" -#include "glxtnthumbnailrequest.h" -#include "glxtnvideoutility.h" -#include "mglxtnthumbnailcreatorclient.h" - - -// All EXIF data is within the first KGlxMaxExifSize bytes of the file -const TInt KGlxMaxExifSize = 0x10000; - -// ----------------------------------------------------------------------------- -// NewL -// ----------------------------------------------------------------------------- -// -CGlxtnQuickThumbnailTask* CGlxtnQuickThumbnailTask::NewL( - const TGlxThumbnailRequest& aRequestInfo, - CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient) - { - TRACER("CGlxtnQuickThumbnailTask::NewL()"); - CGlxtnQuickThumbnailTask* task = new (ELeave) CGlxtnQuickThumbnailTask( - aRequestInfo, aFileUtility, aClient); - CleanupStack::PushL(task); - task->ConstructL(aRequestInfo.iBitmapHandle); - CleanupStack::Pop( task ); - return task; - } - -// ----------------------------------------------------------------------------- -// Constructor -// ----------------------------------------------------------------------------- -// -CGlxtnQuickThumbnailTask::CGlxtnQuickThumbnailTask( - const TGlxThumbnailRequest& aRequestInfo, - CGlxtnFileUtility& aFileUtility, - MGlxtnThumbnailCreatorClient& aClient ) : - CGlxtnLoadThumbnailTask( KGlxtnTaskIdQuickThumbnail, - aRequestInfo, aFileUtility, aClient ), - iQuality( EGlxThumbnailQualityLow ) - { - TRACER("CGlxtnQuickThumbnailTask::CGlxtnQuickThumbnailTask()"); - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CGlxtnQuickThumbnailTask::~CGlxtnQuickThumbnailTask() - { - TRACER("CGlxtnQuickThumbnailTask::~CGlxtnQuickThumbnailTask()"); - delete iUtility; - delete iVideoFrame; - } - -// ----------------------------------------------------------------------------- -// DoStartL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnQuickThumbnailTask::DoStartL(TRequestStatus& aStatus) - { - TRACER("TBool CGlxtnQuickThumbnailTask::DoStartL()"); - iInfo = new (ELeave) CGlxtnFileInfo; - Client().FetchFileInfoL(iInfo, ItemId(), &aStatus); - iState = EStateFetchingUri; - - return ETrue; - } - -// ----------------------------------------------------------------------------- -// DoCancel -// ----------------------------------------------------------------------------- -// -void CGlxtnQuickThumbnailTask::DoCancel() - { - TRACER("void CGlxtnQuickThumbnailTask::DoCancel()"); - CGlxtnLoadThumbnailTask::DoCancel(); - - if ( EStateFetchingUri == iState ) - { - Client().CancelFetchUri( ItemId() ); - } - - if ( iUtility ) - { - iUtility->Cancel(); - } - - iFileUtility.ClearBadFileMarker(); - } - -// ----------------------------------------------------------------------------- -// DoRunL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnQuickThumbnailTask::DoRunL(TRequestStatus& aStatus) - { - TRACER("TBool CGlxtnQuickThumbnailTask::DoRunL()"); - TInt error = aStatus.Int(); - TBool active = EFalse; - - if ( KErrNone == error ) - { - switch ( iState ) - { - case EStateFetchingUri: - User::LeaveIfNull(iInfo); - iBadFileMarkerNotNeededFlag = ETrue; - - TBool protectedFile; - iInfo->IdentifyFileL(iVideo, protectedFile); - - // leave if file is DRM protected and client has no DRM - // capablity - if ( protectedFile && !iDrmAllowed ) - { - User::Leave(KErrAccessDenied); - } - - if ( !LoadThumbnailL( aStatus ) ) - { - iBadFileMarkerNotNeededFlag = EFalse; - iFileUtility.CheckBadFileListL( iInfo->FilePath() ); - QuickDecodeL(aStatus); - } - active = ETrue; - break; - - case EStateLoading: - iQuality = EGlxThumbnailQualityHigh; - active = HandleLoadedThumbnailL(aStatus); - break; - - case EStateDecodingThumbnail: - // Nothing to do - break; - - case EStateDecodingImage: - QuickScaleL(); - break; - - default: - GLX_ASSERT_ALWAYS( EFalse, Panic( EGlxPanicIllegalState ), - "CGlxtnQuickThumbnailTask: Illegal state" ); - break; - } - } - else - { - if ( EStateLoading == iState ) - { - // Loading failed - generate low quality thumbnail instead - iBadFileMarkerNotNeededFlag = EFalse; - iFileUtility.CheckBadFileListL( iInfo->FilePath() ); - QuickDecodeL(aStatus); - active = ETrue; - } - } - - if ( !active ) - { - if ( !iBadFileMarkerNotNeededFlag ) - { - iFileUtility.ClearBadFileMarker(); - } - Client().ThumbnailFetchComplete(ItemId(), iQuality, error); - } - - return active; - } - -// ----------------------------------------------------------------------------- -// DoRunError -// ----------------------------------------------------------------------------- -// -TBool CGlxtnQuickThumbnailTask::DoRunError(TInt aError) - { - TRACER("TBool CGlxtnQuickThumbnailTask::DoRunError(TInt aError)"); - iFileUtility.ClearBadFileMarker(); - Client().ThumbnailFetchComplete(ItemId(), iQuality, aError); - - return EFalse; - } - -// ----------------------------------------------------------------------------- -// QuickDecodeL -// ----------------------------------------------------------------------------- -// -void CGlxtnQuickThumbnailTask::QuickDecodeL(TRequestStatus& aStatus) - { - TRACER("void CGlxtnQuickThumbnailTask::QuickDecodeL(TRequestStatus& aStatus)"); - iQuality = EGlxThumbnailQualityLow; - - if ( iVideo ) - { - RArray targetSizes; - CleanupClosePushL(targetSizes); - targetSizes.AppendL( TSize(iRequestedSize) ); - iUtility = new (ELeave) CGlxtnVideoUtility; - iUtility->GetVideoFrameL(&aStatus, iVideoFrame, iInfo->FilePath(), targetSizes, iThumbnail->DisplayMode() ); - iState = EStateDecodingImage; - CleanupStack::PopAndDestroy(&targetSizes); - } - else - { - ReadThumbnailL(aStatus); - } - } - -// ----------------------------------------------------------------------------- -// ReadThumbnailL -// ----------------------------------------------------------------------------- -// -void CGlxtnQuickThumbnailTask::ReadThumbnailL(TRequestStatus& aStatus) - { - TRACER("void CGlxtnQuickThumbnailTask::ReadThumbnailL(TRequestStatus& aStatus)"); - TBool scaleBitmap = EFalse; - - TRAPD(error, ReadExifThumbnailL()); - if ( KErrNotFound == error || KErrCorrupt == error - || KErrNotSupported == error ) - { - // Use CImageDecoder to get the EXIF thumbnail instead - iDecoder = GlxtnImageDecoderFactory::NewL( - iFileUtility.FsSession(), iInfo->FilePath() ); - - TRAPD( error2, iDecoder->SetImageTypeL( - CImageDecoder::EImageTypeThumbnail ) ); - if ( KErrNotFound == error2 ) - { - // No EXIF thumbnail - load whole image and scale quickly - scaleBitmap = ETrue; - } - else - { - User::LeaveIfError( error2 ); - } - } - else - { - User::LeaveIfError(error); - iDecoder = GlxtnImageDecoderFactory::NewL( - iFileUtility.FsSession(), *iThumbData ); - } - - DecodeThumbnailL(aStatus, scaleBitmap); - } - -// ----------------------------------------------------------------------------- -// ReadExifThumbnailL -// ----------------------------------------------------------------------------- -// -void CGlxtnQuickThumbnailTask::ReadExifThumbnailL() - { - TRACER("void CGlxtnQuickThumbnailTask::ReadExifThumbnailL()"); - __ASSERT_ALWAYS(iInfo, Panic(EGlxPanicNullPointer)); - - RFile file; - CleanupClosePushL(file); - User::LeaveIfError(file.Open(iFileUtility.FsSession(), - iInfo->FilePath(), EFileRead)); - TInt size; - User::LeaveIfError(file.Size(size)); - if ( KGlxMaxExifSize < size ) - { - size = KGlxMaxExifSize; - } - - HBufC8* exifData = HBufC8::NewLC(size); - TPtr8 ptr(exifData->Des()); - User::LeaveIfError(file.Read(ptr)); - - CExifRead* exifReader = CExifRead::NewL(*exifData, CExifRead::ENoJpeg); - CleanupStack::PushL(exifReader); - delete iThumbData; - iThumbData = NULL; - iThumbData = exifReader->GetThumbnailL(); - - CleanupStack::PopAndDestroy(exifReader); - CleanupStack::PopAndDestroy(exifData); - CleanupStack::PopAndDestroy(&file); - } - -// ----------------------------------------------------------------------------- -// QuickScaleL -// ----------------------------------------------------------------------------- -// -void CGlxtnQuickThumbnailTask::QuickScaleL() - { - TRACER("void CGlxtnQuickThumbnailTask::QuickScaleL()"); - User::LeaveIfNull(iVideoFrame); - - TSize frameSize(iVideoFrame->SizeInPixels()); - TSize thumbSize(iRequestedSize); - - // Reduce target thumbSize to same aspect ratio as source image - if ( thumbSize.iHeight * frameSize.iWidth < thumbSize.iWidth * frameSize.iHeight ) - { - // Source has taller aspect than target so reduce target width - thumbSize.iWidth = (thumbSize.iHeight * frameSize.iWidth) / frameSize.iHeight; - } - else - { - // Source has wider aspect than target so reduce target height - thumbSize.iHeight = (thumbSize.iWidth * frameSize.iHeight) / frameSize.iWidth; - } - - // Resize empty bitmap to required size - User::LeaveIfError( iThumbnail->Resize( thumbSize ) ); - - CFbsBitmapDevice* device = CFbsBitmapDevice::NewL( iThumbnail ); - CleanupStack::PushL(device); - CFbsBitGc* context = NULL; - User::LeaveIfError(device->CreateContext(context)); - CleanupStack::PushL(context); - - context->DrawBitmap(TRect(thumbSize), iVideoFrame); - - CleanupStack::PopAndDestroy(context); - CleanupStack::PopAndDestroy(device); - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtnsavethumbnailtask.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtnsavethumbnailtask.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,244 +0,0 @@ -/* -* 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: Thumbnail save task implementation -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - -// INCLUDE FILES - -#include "glxtnsavethumbnailtask.h" - -#include -#include -#include -#include -#include - -#include "glxtnfileinfo.h" -#include "mglxtnstorage.h" - -// Minimum size of thumbnail to be saved as JPEG rather than bitmap -const TInt KGlxMinPixelsForJpeg = 30000; - -const TInt KGlxBitmapBufferGranularity = 1024; - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGlxtnSaveThumbnailTask::CGlxtnSaveThumbnailTask -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -// -CGlxtnSaveThumbnailTask::CGlxtnSaveThumbnailTask(const TGlxMediaId& aItemId, - const TSize& aSize, MGlxtnThumbnailStorage* aStorage) : - CGlxtnTask(KGlxtnTaskIdSaveThumbnail, aItemId, aStorage), iSize(aSize) - { - TRACER("CGlxtnSaveThumbnailTask::CGlxtnSaveThumbnailTask()"); - GLX_ASSERT_ALWAYS( aStorage, Panic( EGlxPanicIllegalArgument ), - "CGlxtnSaveThumbnailTask created without storage" ); - - // Save task is always low priority - SetPriority(EPriorityLow); - } - -// ----------------------------------------------------------------------------- -// CGlxtnSaveThumbnailTask::CGlxtnSaveThumbnailTask -// Constructor for derived classes. -// ----------------------------------------------------------------------------- -// -CGlxtnSaveThumbnailTask::CGlxtnSaveThumbnailTask(const TGlxtnTaskId& aId, - const TGlxMediaId& aItemId, MGlxtnThumbnailStorage* aStorage) : - CGlxtnTask(aId, aItemId, aStorage) - { - TRACER("CGlxtnSaveThumbnailTask::CGlxtnSaveThumbnailTask()"); - GLX_ASSERT_ALWAYS( aStorage, Panic( EGlxPanicIllegalArgument ), - "CGlxtnSaveThumbnailTask created without storage" ); - } - -// ----------------------------------------------------------------------------- -// CGlxtnSaveThumbnailTask::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CGlxtnSaveThumbnailTask::ConstructL(CGlxtnFileInfo* aFileInfo, - CFbsBitmap* aThumbnail) - { - TRACER("void CGlxtnSaveThumbnailTask::ConstructL()"); - // Shouldn't create save task if client doesn't use storage - if ( !(Storage() && aFileInfo && aThumbnail) ) - { - User::Leave(KErrArgument); - } - - // Must not leave after taking ownership of these - iFileInfo = aFileInfo; - iThumbnail = aThumbnail; - } - -// ----------------------------------------------------------------------------- -// CGlxtnSaveThumbnailTask::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CGlxtnSaveThumbnailTask* CGlxtnSaveThumbnailTask::NewL( - const TGlxMediaId& aItemId, - CGlxtnFileInfo* aFileInfo, const TSize& aSize, - CFbsBitmap* aThumbnail, MGlxtnThumbnailStorage* aStorage) - { - TRACER("CGlxtnSaveThumbnailTask* CGlxtnSaveThumbnailTask::NewL()"); - CGlxtnSaveThumbnailTask* self = new (ELeave) CGlxtnSaveThumbnailTask( - aItemId, aSize, aStorage); - CleanupStack::PushL(self); - self->ConstructL(aFileInfo, aThumbnail); - CleanupStack::Pop( self ); - - return self; - } - -// Destructor -CGlxtnSaveThumbnailTask::~CGlxtnSaveThumbnailTask() - { - TRACER("Destructor CGlxtnSaveThumbnailTask::~CGlxtnSaveThumbnailTask()"); - delete iEncoder; - delete iThumbnail; - delete iData; - delete iFileInfo; - } - -// ----------------------------------------------------------------------------- -// DoStartL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnSaveThumbnailTask::DoStartL(TRequestStatus& aStatus) - { - TRACER("CGlxtnSaveThumbnailTask::DoStartL()"); - EncodeThumbnailL(aStatus); - - return ETrue; - } - -// ----------------------------------------------------------------------------- -// DoCancel -// ----------------------------------------------------------------------------- -// -void CGlxtnSaveThumbnailTask::DoCancel() - { - TRACER("CGlxtnSaveThumbnailTask::DoCancel()"); - if ( iEncoder ) - { - iEncoder->Cancel(); - } - - Storage()->StorageCancel(); - } - -// ----------------------------------------------------------------------------- -// DoRunL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnSaveThumbnailTask::DoRunL(TRequestStatus& aStatus) - { - TRACER("TBool CGlxtnSaveThumbnailTask::DoRunL()"); - if ( KErrNone == aStatus.Int() && EStateEncoding == iState ) - { - SaveThumbnailL(aStatus); - return ETrue; - } - - return EFalse; // Task is complete - } - -// ----------------------------------------------------------------------------- -// DoRunError -// ----------------------------------------------------------------------------- -// -TBool CGlxtnSaveThumbnailTask::DoRunError(TInt /*aError*/) - { - TRACER("CGlxtnSaveThumbnailTask::DoRunError()"); - delete iEncoder; - iEncoder = NULL; - - return EFalse; // Task is complete - } - -// ----------------------------------------------------------------------------- -// EncodeThumbnailL -// ----------------------------------------------------------------------------- -// -void CGlxtnSaveThumbnailTask::EncodeThumbnailL(TRequestStatus& aStatus) - { - TRACER("CGlxtnSaveThumbnailTask::EncodeThumbnailL()"); - TSize size(iThumbnail->SizeInPixels()); - User::LeaveIfError(iThumbnail->SetDisplayMode(KGlxThumbnailDisplayMode)); - - delete iData; - iData = NULL; - - if ( KGlxMinPixelsForJpeg <= size.iWidth * size.iHeight ) - { - // Encode as JPEG - iFormat = EGlxIDF_JPEG; - delete iEncoder; - iEncoder = NULL; - iEncoder = CImageEncoder::DataNewL(iData, CImageEncoder::EOptionNone, - KImageTypeJPGUid); - iState = EStateEncoding; - iEncoder->Convert(&aStatus, *iThumbnail); - } - else - { - // Externalise bitmap into buffer - iFormat = EGlxIDF_Bitmap; - CBufBase* buffer = CBufSeg::NewL(KGlxBitmapBufferGranularity); - CleanupStack::PushL(buffer); - - RBufWriteStream stream(*buffer); - CleanupClosePushL(stream); - stream << *iThumbnail; - stream.CommitL(); - CleanupStack::PopAndDestroy(&stream); - - TInt length = buffer->Size(); - iData = HBufC8::NewL(length); - TPtr8 ptr(iData->Des()); - buffer->Read(0, ptr, length); - - CleanupStack::PopAndDestroy(buffer); - - SaveThumbnailL(aStatus); - } - } - -// ----------------------------------------------------------------------------- -// SaveThumbnailL -// ----------------------------------------------------------------------------- -// -void CGlxtnSaveThumbnailTask::SaveThumbnailL(TRequestStatus& aStatus) - { - TRACER("CGlxtnSaveThumbnailTask::SaveThumbnailL()"); - delete iEncoder; - iEncoder = NULL; - - iState = EStateSaving; - Storage()->SaveThumbnailDataL(*iData, iFormat, ItemId(), - *iFileInfo, iSize, &aStatus); - } - -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtntask.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtntask.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +0,0 @@ -/* -* 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: Base classes for multi-purpuse tasks -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - - -#include "glxtntask.h" - -#include - -#include "mglxtnthumbnailcreatorclient.h" - -// ----------------------------------------------------------------------------- -// Constructor -// ----------------------------------------------------------------------------- -// -CGlxtnTask::CGlxtnTask(const TGlxtnTaskId& aId, const TGlxMediaId& aItemId, - MGlxtnThumbnailStorage* aStorage) - : iState(EStarting), iId(aId), iItemId(aItemId), iStorage(aStorage) - { - TRACER("CGlxtnTask::CGlxtnTask()"); - iPriority = CActive::EPriorityStandard; - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CGlxtnTask::~CGlxtnTask() - { - TRACER("CGlxtnTask::~CGlxtnTask()"); - } - -// ----------------------------------------------------------------------------- -// SetManager -// ----------------------------------------------------------------------------- -// -void CGlxtnTask::SetManager(CGlxtnTaskManager* /*aManager*/) - { - TRACER("CGlxtnTask::SetManager()"); - // No implementation - can be overridden by subclasses - } - -// ----------------------------------------------------------------------------- -// StartL -// ----------------------------------------------------------------------------- -// -void CGlxtnTask::StartL(TRequestStatus& aStatus) - { - TRACER("CGlxtnTask::StartL()"); - __ASSERT_DEBUG(iState == EIdle || iState == EStarting, Panic(EGlxPanicIllegalState)); - - iState = EStarting; - - TBool active = DoStartL(aStatus); - - if (active) - { - iState = ERunning; - } - else - { - iState = EComplete; // Well, that was quick - } - } - -// ----------------------------------------------------------------------------- -// Cancel -// ----------------------------------------------------------------------------- -// -void CGlxtnTask::Cancel() - { - TRACER("CGlxtnTask::Cancel()"); - if ( ERunning == iState ) - { - DoCancel(); - } - - iState = ECanceled; - } - -// ----------------------------------------------------------------------------- -// RunL -// ----------------------------------------------------------------------------- -// -void CGlxtnTask::RunL(TRequestStatus& aStatus) - { - TRACER("void CGlxtnTask::RunL()"); - __ASSERT_DEBUG(iState == ERunning, Panic(EGlxPanicIllegalState)); - - TBool active = DoRunL(aStatus); - - if (!active) - { - iState = EComplete; // The task is done - } - } - -// ----------------------------------------------------------------------------- -// RunError -// ----------------------------------------------------------------------------- -// -void CGlxtnTask::RunError(TInt aError) - { - TRACER("void CGlxtnTask::RunError()"); - if ( !DoRunError(aError) ) - { - iState = EComplete; // The task is done - } - } - -// ----------------------------------------------------------------------------- -// SelfComplete -// ----------------------------------------------------------------------------- -// -void CGlxtnTask::SelfComplete(TRequestStatus& aStatus) - { - TRACER("CGlxtnTask::SelfComplete()"); - aStatus = KRequestPending; - TRequestStatus* status = &aStatus; - User::RequestComplete(status, KErrNone); - } - -// ----------------------------------------------------------------------------- -// Constructor -// ----------------------------------------------------------------------------- -// -CGlxtnClientTask::CGlxtnClientTask(const TGlxtnTaskId& aId, - const TGlxMediaId& aItemId, MGlxtnThumbnailCreatorClient& aClient) : - CGlxtnTask(aId, aItemId, aClient.ThumbnailStorage()), iClient(aClient) - { - TRACER("CGlxtnClientTask::CGlxtnClientTask()"); - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtntaskmanager.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtntaskmanager.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,345 +0,0 @@ -/* -* 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: Task manager for multiple tasks. Allows asynchronosity and -* tracking/callback for long running tasks. -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - -#include "glxtntaskmanager.h" - -#include - -#include "glxtnbackgroundgenerationtask.h" -#include "glxtntask.h" - -const TInt KGlxTMMaxTasksToRunInOneRound = 4; -// ----------------------------------------------------------------------------- -// Static Constructor -// ----------------------------------------------------------------------------- -// -CGlxtnTaskManager* CGlxtnTaskManager::NewL() - { - TRACER("CGlxtnTaskManager::NewL()"); - CGlxtnTaskManager* self = new (ELeave) CGlxtnTaskManager(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// ----------------------------------------------------------------------------- -// Constructor -// ----------------------------------------------------------------------------- -// -CGlxtnTaskManager::CGlxtnTaskManager() - : CActive(EPriorityStandard) - { - TRACER("CGlxtnTaskManager::CGlxtnTaskManager()"); - } - -// ----------------------------------------------------------------------------- -// ConstructL -// ----------------------------------------------------------------------------- -// -void CGlxtnTaskManager::ConstructL() - { - TRACER("void CGlxtnTaskManager::ConstructL()"); - CActiveScheduler::Add(this); - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CGlxtnTaskManager::~CGlxtnTaskManager() - { - TRACER("CGlxtnTaskManager::~CGlxtnTaskManager()"); - Cancel(); - iTasks.ResetAndDestroy(); - } - -// ----------------------------------------------------------------------------- -// Task by id -// ----------------------------------------------------------------------------- -// -CGlxtnTask* CGlxtnTaskManager::Task(const TGlxtnTaskId& aId) const - { - TRACER("CGlxtnTaskManager::Task(const TGlxtnTaskId& aId)"); - TInt count = iTasks.Count(); - for (TInt i = 0; i < count; i++) - { - CGlxtnTask* task = iTasks[i]; - if (task->Id() == aId) - { - return task; - } - } - - // Not found - return NULL; - } - -// ----------------------------------------------------------------------------- -// AddTaskL -// ----------------------------------------------------------------------------- -// -void CGlxtnTaskManager::AddTaskL(CGlxtnTask* aTask, TExecutionOrder aExecutionOrder) - { - TRACER("CGlxtnTaskManager::AddTaskL()"); - __ASSERT_DEBUG(aTask, Panic(EGlxPanicNullPointer)); - __ASSERT_DEBUG(iTasks.Find(aTask) == KErrNotFound, Panic(EGlxPanicIllegalArgument)); // Task already added - CleanupStack::PushL(aTask); - - // Order manually to allow full control over placement of tasks when - // priorities are the same - TInt priority = aTask->Priority(); - TInt count = iTasks.Count(); - - TInt pos = 0; - while ( pos < count ) - { - TInt compPriority = iTasks[pos]->Priority(); - if ( compPriority < priority - || (compPriority == priority && EFirstOut == aExecutionOrder) ) - { - break; - } - - pos++; - } - - iTasks.InsertL(aTask, pos); - CleanupStack::Pop(aTask); - - aTask->SetManager(this); - - // Start processing the task if this active object is not already doing something else - if ( !iCurrentTask ) - { - AsyncRun(); - } - else if( dynamic_cast(iCurrentTask) && (!dynamic_cast(aTask)) ) - { - iCurrentTask->Cancel(); - } - } - -// ----------------------------------------------------------------------------- -// CancelTasks -// Cancel all tasks relating to a given media item. -// ----------------------------------------------------------------------------- -// -void CGlxtnTaskManager::CancelTasks(const TGlxMediaId& aItemId) - { - TRACER("CGlxtnTaskManager::CancelTasks()"); - TInt count = iTasks.Count(); - - if( aItemId == TGlxMediaId(0) ) - { - if( dynamic_cast(iCurrentTask) ) - { - iCurrentTask->Cancel(); - } - } - - for ( TInt i = 0; i < count; i++ ) - { - CGlxtnTask* task = iTasks[i]; - - if ( task->ItemId() == aItemId ) - { - task->Cancel(); - } - } - } - -// ----------------------------------------------------------------------------- -// CancelTasks -// Cancel all tasks using a given storage. -// ----------------------------------------------------------------------------- -// -void CGlxtnTaskManager::CancelTasks(MGlxtnThumbnailStorage* aStorage) - { - TRACER("void CGlxtnTaskManager::CancelTasks()"); - TInt count = iTasks.Count(); - - for ( TInt i = 0; i < count; i++ ) - { - CGlxtnTask* task = iTasks[i]; - - if ( task->Storage() == aStorage ) - { - task->Cancel(); - } - } - } - -// ----------------------------------------------------------------------------- -// RunL -// ----------------------------------------------------------------------------- -// -void CGlxtnTaskManager::RunL() - { - TRACER("void CGlxtnTaskManager::RunL()"); - TInt taskIndex = 0; - TInt tasksRun = 0; - while ( taskIndex < iTasks.Count() ) - { - if ( iCurrentTask ) - { - if ( CGlxtnTask::EStarting == iCurrentTask->State() ) - { - // Start the task - iCurrentTask->StartL(iStatus); - } - else if ( CGlxtnTask::ERunning == iCurrentTask->State() ) - { - // Let the task run - iCurrentTask->RunL(iStatus); - } - - if ( CGlxtnTask::ERunning == iCurrentTask->State() ) - { - SetActive(); - return; - } - - // Task completed or cancelled, delete the task immediately - __ASSERT_DEBUG(iStatus != KRequestPending, Panic(EGlxPanicIllegalState)); - __ASSERT_DEBUG(CGlxtnTask::EComplete == iCurrentTask->State() - || CGlxtnTask::ECanceled == iCurrentTask->State(), Panic(EGlxPanicIllegalState)); - - // Search for the task again, since the processing of the task might have added new tasks to the queue - TInt index = iTasks.Find(iCurrentTask); - __ASSERT_DEBUG(index != KErrNotFound, Panic(EGlxPanicLogicError)); - iTasks.Remove(index); - delete iCurrentTask; - iCurrentTask = NULL; - - // Start from top, since the task might have added another task - taskIndex = 0; - } - else - { - CGlxtnTask* task = iTasks[taskIndex]; - CGlxtnTask::TState state = task->State(); - - switch ( state ) - { - case CGlxtnTask::EIdle: - // Task not started. Ignore and try next task - taskIndex++; // Skip - break; - case CGlxtnTask::EStarting: - { - // Start the task - iCurrentTask = task; - - // Update active object priority to match task priority - TInt priority = task->Priority(); - if ( priority != Priority() ) - { - SetPriority(priority); - } - - // Check if too many tasks have been run during this call to RunL. - // This check exist to make sure a blocking loop does not occur, in which - // a task creates another task which completes immediately, which creates - // another task, which also completes immediately. (Task don't have to - // be asynchronous.) - tasksRun++; - if ( tasksRun >= KGlxTMMaxTasksToRunInOneRound ) - { - AsyncRun(); - return; - } - } - break; - case CGlxtnTask::ECanceled: - // Task is canceled, remove from queue - delete task; - iTasks.Remove(taskIndex); - break; - default: - Panic(EGlxPanicIllegalState); // Unknown or wrong state - break; - } - } - } - } - -// ----------------------------------------------------------------------------- -// DoCancel -// ----------------------------------------------------------------------------- -// -void CGlxtnTaskManager::DoCancel() - { - TRACER("CGlxtnTaskManager::DoCancel()"); - TInt count = iTasks.Count(); - for (TInt i = 0; i < count; i++) - { - CGlxtnTask* task = iTasks[i]; - CGlxtnTask::TState state = task->State(); - if (state == CGlxtnTask::ERunning) - { - task->Cancel(); - } - } - } - -// ----------------------------------------------------------------------------- -// RunError -// ----------------------------------------------------------------------------- -// -TInt CGlxtnTaskManager::RunError(TInt aError) - { - TRACER("CGlxtnTaskManager::RunError()"); - if ( iCurrentTask ) - { - iCurrentTask->RunError(aError); - - if ( CGlxtnTask::ERunning == iCurrentTask->State() ) - { - SetActive(); - } - else - { - AsyncRun(); - } - - return KErrNone; - } - - return aError; - } - -// ----------------------------------------------------------------------------- -// AsyncRun -// ----------------------------------------------------------------------------- -// -void CGlxtnTaskManager::AsyncRun() - { - TRACER("CGlxtnTaskManager::AsyncRun()"); - // Issue a self-completing request. - iStatus = KRequestPending; - SetActive(); - TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtnthumbnailcreator.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtnthumbnailcreator.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,219 +0,0 @@ -/* -* 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: Classes for thumbnail-related tasks. -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - -#include "glxtnthumbnailcreator.h" - -#include "glxpanic.h" -#include "glxtnbackgroundgenerationtask.h" -#include "glxtncleanuptask.h" -#include "glxtndeletethumbnailstask.h" -#include "glxtnfileutility.h" -#include "glxtnfilteravailabletask.h" -#include "glxtngeneratethumbnailtask.h" -#include "glxtnquickthumbnailtask.h" -#include "glxtntaskmanager.h" -#include "glxtnthumbnailrequest.h" -#include "glxtnzoomedimagetask.h" -#include "mglxtnthumbnailcreatorclient.h" - -#include -#include - -// ----------------------------------------------------------------------------- -// InstanceL -// ----------------------------------------------------------------------------- -// -EXPORT_C CGlxtnThumbnailCreator* CGlxtnThumbnailCreator::InstanceL() - { - TRACER("CGlxtnThumbnailCreator::InstanceL()"); - CGlxtnThumbnailCreator* instance - = reinterpret_cast(Dll::Tls()); - - // Create instance if does not exist - if ( !instance ) - { - instance = new (ELeave) CGlxtnThumbnailCreator(); - CleanupStack::PushL(instance); - instance->ConstructL(); - CleanupStack::Pop(instance); - - Dll::SetTls(instance); - } - - // Add user - instance->iReferenceCount++; - - return instance; - } - -// ----------------------------------------------------------------------------- -// Close -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGlxtnThumbnailCreator::Close(MGlxtnThumbnailStorage* aStorage) - { - TRACER("CGlxtnThumbnailCreator::Close()"); - // Cancel any tasks using the client's storage - if ( aStorage ) - { - iTaskManager->CancelTasks(aStorage); - } - - __ASSERT_DEBUG(iReferenceCount > 0, Panic(EGlxPanicIllegalState)); - iReferenceCount--; - if ( iReferenceCount < 1 ) - { - Dll::SetTls(NULL); - delete this; - } - } - -// ----------------------------------------------------------------------------- -// Constructor -// ----------------------------------------------------------------------------- -// -CGlxtnThumbnailCreator::CGlxtnThumbnailCreator() - { - TRACER("CGlxtnThumbnailCreator::CGlxtnThumbnailCreator()"); - } - -// ----------------------------------------------------------------------------- -// ConstructL -// ----------------------------------------------------------------------------- -// -void CGlxtnThumbnailCreator::ConstructL() - { - TRACER("CGlxtnThumbnailCreator::ConstructL()"); - iFileUtility = CGlxtnFileUtility::NewL(); - iTaskManager = CGlxtnTaskManager::NewL(); - iSettingsModel = CGlxSettingsModel::InstanceL(); - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CGlxtnThumbnailCreator::~CGlxtnThumbnailCreator() - { - TRACER("CGlxtnThumbnailCreator::~CGlxtnThumbnailCreator()"); - delete iTaskManager; - delete iFileUtility; - if (iSettingsModel) - { - iSettingsModel->Close(); - } - } - -// ----------------------------------------------------------------------------- -// FetchThumbnailL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGlxtnThumbnailCreator::FetchThumbnailL( - const TGlxThumbnailRequest& aRequestInfo, - MGlxtnThumbnailCreatorClient& aClient) - { - TRACER("void CGlxtnThumbnailCreator::FetchThumbnailL()"); - // Create the task - CGlxtnTask* task = NULL; - - if ( 0 == aRequestInfo.iBitmapHandle ) - { - task = CGlxtnBackgroundGenerationTask::NewL(aRequestInfo.iId, - *iFileUtility, aClient, iSettingsModel->SupportedOrientations() ); - } - else if ( ( 0 == aRequestInfo.iSizeClass.iWidth) || ( 0 == aRequestInfo.iSizeClass.iHeight ) ) - { - User::Leave(KErrArgument); - } - else if ( !aRequestInfo.iCroppingRect.IsEmpty() ) - { - task = CGlxtnZoomedImageTask::NewL(aRequestInfo, - *iFileUtility, aClient); - } - else if ( TGlxThumbnailRequest::EPrioritizeQuality == aRequestInfo.iPriorityMode ) - { - task = CGlxtnGenerateThumbnailTask::NewL(aRequestInfo, - *iFileUtility, aClient); - } - else - { - task = CGlxtnQuickThumbnailTask::NewL(aRequestInfo, - *iFileUtility, aClient); - } - - iTaskManager->AddTaskL(task); // Takes ownership - } - -// ----------------------------------------------------------------------------- -// DeleteThumbnailsL -// Starts deleting all stored thumbnails for a given item. This will result -// in a callback to MGlxtnThumbnailCreatorClient::ThumbnailDeletionComplete(). -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGlxtnThumbnailCreator::DeleteThumbnailsL( - const TGlxMediaId& aItemId, MGlxtnThumbnailCreatorClient& aClient) - { - TRACER("void CGlxtnThumbnailCreator::DeleteThumbnailsL()"); - iTaskManager->AddTaskL(CGlxtnDeleteThumbnailsTask::NewL(aItemId, aClient)); - } - -// ----------------------------------------------------------------------------- -// FilterAvailableThumbnailsL -// Starts the filtering of items for which a thumbnail is available from a -// list of item IDs. This will result in a callback to -// MGlxtnThumbnailCreatorClient::FilterAvailableComplete(). -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGlxtnThumbnailCreator::FilterAvailableThumbnailsL( - const TArray& aItemArray, const TSize& aSize, - MGlxtnThumbnailCreatorClient& aClient) - { - TRACER("void CGlxtnThumbnailCreator::FilterAvailableThumbnailsL()"); - iTaskManager->AddTaskL(CGlxtnFilterAvailableTask::NewL(aItemArray, aSize, - aClient)); - } - -// ----------------------------------------------------------------------------- -// CleanupThumbnailsL -// Starts the cleanup of obsolete thumbnails from storage. There is no -// callback indicating completion of the request. -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGlxtnThumbnailCreator::CleanupThumbnailsL( - MGlxtnThumbnailStorage* aStorage) - { - TRACER("void CGlxtnThumbnailCreator::CleanupThumbnailsL()"); - iTaskManager->AddTaskL(CGlxtnCleanupTask::NewL(aStorage)); - } - -// ----------------------------------------------------------------------------- -// CancelRequest -// Cancel any ongoing tasks for a given item. This ensures the TNC is not -// locking the media file. -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGlxtnThumbnailCreator::CancelRequest(const TGlxMediaId& aItemId) - { - TRACER("void CGlxtnThumbnailCreator::CancelRequest()"); - iTaskManager->CancelTasks(aItemId); - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtnvideoutility.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtnvideoutility.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +0,0 @@ -/* -* 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: Utility for creating bitmaps from video files -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - -#include "glxtnvideoutility.h" - -#include -#include -#include - -// ----------------------------------------------------------------------------- -// Constructor -// ----------------------------------------------------------------------------- -// -CGlxtnVideoUtility::CGlxtnVideoUtility() : iDestination(NULL) - { - TRACER("CGlxtnVideoUtility::CGlxtnVideoUtility()"); - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CGlxtnVideoUtility::~CGlxtnVideoUtility() - { - TRACER("CGlxtnVideoUtility::~CGlxtnVideoUtility()"); - delete iVideoInfo; - } - -// ----------------------------------------------------------------------------- -// GetVideoFrameL -// ----------------------------------------------------------------------------- -// -void CGlxtnVideoUtility::GetVideoFrameL(TRequestStatus* aRequestStatus, - CFbsBitmap*& aDestination, const TDesC& aFileName, - RArray& aTargetSizes, TDisplayMode aMode) - { - TRACER("void CGlxtnVideoUtility::GetVideoFrameL(TRequestStatus* aRequestStatus, CFbsBitmap*& aDestination, const TDesC& aFileName, RArray& aTargetSizes, TDisplayMode aMode)"); - if ( iRequestStatus ) - { - User::Leave(KErrNotReady); - } - - iDisplayMode = aMode; - iSize = aTargetSizes[0]; - - iRequestStatus = aRequestStatus; - *iRequestStatus = KRequestPending; - - iDestination = &aDestination; - delete *iDestination; - *iDestination = NULL; - - delete iVideoInfo; - iVideoInfo = NULL; -#ifdef ENABLE_VED - iVideoInfo = CVedVideoClipInfo::NewL(aFileName, *this); -#else - iVideoInfo = CTNEVideoClipInfo::NewL(aFileName, *this); -#endif - } - -// ----------------------------------------------------------------------------- -// Cancel -// ----------------------------------------------------------------------------- -// -void CGlxtnVideoUtility::Cancel() - { - TRACER("void CGlxtnVideoUtility::Cancel()"); - if ( iVideoInfo ) - { -#ifdef ENABLE_VED - iVideoInfo->CancelFrame(); -#else - iVideoInfo->CancelThumb(); -#endif - delete iVideoInfo; - iVideoInfo = NULL; - } - } - -// ----------------------------------------------------------------------------- -// NotifyVideoClipInfoReady -// ----------------------------------------------------------------------------- -// -#ifdef ENABLE_VED -void CGlxtnVideoUtility::NotifyVideoClipInfoReady( CVedVideoClipInfo& aInfo, - TInt aError ) -#else -void CGlxtnVideoUtility::NotifyVideoClipInfoReady( CTNEVideoClipInfo& aInfo, - TInt aError ) -#endif - { - TRACER("void CGlxtnVideoUtility::NotifyVideoClipInfoReady( CVedVideoClipInfo& aInfo, TInt aError )"); - __ASSERT_DEBUG(&aInfo == iVideoInfo, Panic(EGlxPanicIllegalArgument)); - - //adding a check if the callback is for iVideoInfo - if ( KErrNone == aError && (&aInfo == iVideoInfo)) - { -#ifdef ENABLE_VED - TRAP(aError, iVideoInfo->GetFrameL(*this, KFrameIndexBestThumb, - NULL /*aResolution*/, iDisplayMode)); -#else - TRAP(aError, iVideoInfo->GetThumbL(*this, KBestThumbIndex, - &iSize, iDisplayMode)); -#endif - } - - if ( KErrNone != aError ) - { - User::RequestComplete(iRequestStatus, aError); - } - } - -// ----------------------------------------------------------------------------- -// NotifyVideoClipFrameCompleted -// ----------------------------------------------------------------------------- -// -#ifdef ENABLE_VED -void CGlxtnVideoUtility::NotifyVideoClipFrameCompleted( - CVedVideoClipInfo& /*aInfo*/, TInt aError, CFbsBitmap* aFrame ) -#else -void CGlxtnVideoUtility::NotifyVideoClipThumbCompleted( - CTNEVideoClipInfo& /*aInfo*/, TInt aError, CFbsBitmap* aFrame ) -#endif - { - TRACER("void CGlxtnVideoUtility::NotifyVideoClipFrameCompleted( CVedVideoClipInfo& aInfo, TInt aError, CFbsBitmap* aFrame )"); - //removing as this is not used anymore - // __ASSERT_DEBUG(&aInfo == iVideoInfo, Panic(EGlxPanicIllegalArgument)); - *iDestination = aFrame; - - User::RequestComplete(iRequestStatus, aError); - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtnvolumedatabase.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtnvolumedatabase.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,820 +0,0 @@ -/* -* 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: Implementation of CGlxtnVolumeDatabase -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - -#include "glxtnvolumedatabase.h" - -#include -#include -#include - -#include "glxtnfileinfo.h" -#include "mglxtnvolumedatabaseobserver.h" - -#include -_LIT(KGlxCreateTableIds, "CREATE TABLE Ids (MediaId UNSIGNED INTEGER NOT NULL, ThumbId UNSIGNED INTEGER NOT NULL)"); -_LIT(KGlxCreateTableItems, "CREATE TABLE Items (Uri VARCHAR NOT NULL, ThumbId UNSIGNED INTEGER NOT NULL, FileSize INTEGER, ModTime TIME)"); -_LIT(KGlxCreateTableThumbnails, "CREATE TABLE Thumbnails (ThumbId UNSIGNED INTEGER NOT NULL, Width INTEGER NOT NULL, Height INTEGER NOT NULL, Format INTEGER NOT NULL, ImageData LONG VARBINARY NOT NULL)"); -_LIT(KGlxCreateIndexIds, "CREATE UNIQUE INDEX IdIndex ON Ids (MediaId)"); -_LIT(KGlxCreateIndexItems, "CREATE UNIQUE INDEX ItemIndex ON Items (ThumbId ASC)"); -_LIT(KGlxCreateIndexThumbnails, "CREATE UNIQUE INDEX ThumbnailIndex ON Thumbnails (ThumbId, Width, Height)"); - -_LIT(KGlxTableIds, "Ids"); -_LIT(KGlxTableItems, "Items"); -_LIT(KGlxTableThumbnails, "Thumbnails"); -_LIT(KGlxIndexItems, "ItemIndex"); - -const TInt KGlxColIdMediaId = 1; -const TInt KGlxColIdThumbId = 2; - -const TInt KGlxColItemUri = 1; -const TInt KGlxColItemId = 2; -const TInt KGlxColItemFileSize = 3; -const TInt KGlxColItemModTime = 4; - -const TInt KGlxColThumbnailId = 1; -const TInt KGlxColThumbnailWidth = 2; -const TInt KGlxColThumbnailHeight = 3; -const TInt KGlxColThumbnailFormat = 4; -const TInt KGlxColThumbnailData = 5; - -_LIT(KGlxQueryThumbIdFromIds, "SELECT * FROM Ids WHERE MediaId = "); -_LIT(KGlxQueryThumbIdFromItems, "SELECT * FROM Items WHERE Uri = "); -_LIT(KGlxQueryThumbnail, "SELECT * FROM Thumbnails WHERE ThumbId = %d AND Width = %d AND Height = %d"); -_LIT(KGlxQueryAvailable, "SELECT ThumbId, Width, Height FROM Thumbnails WHERE ThumbId = %d AND Width = %d AND Height = %d"); - -_LIT(KGlxDeleteId, "DELETE FROM Ids WHERE MediaId = %d"); -_LIT(KGlxDeleteThumbnails, "DELETE FROM Thumbnails WHERE ThumbId = %d"); -_LIT(KGlxDeleteItem, "DELETE FROM Items WHERE ThumbId = %d"); - -const TInt KGlxTIntMaxDigits = 11; - -const TUint KGlxFirstThumbnailId = 1; - -// ----------------------------------------------------------------------------- -// NewL -// ----------------------------------------------------------------------------- -// -CGlxtnVolumeDatabase* CGlxtnVolumeDatabase::NewLC( - MGlxtnVolumeDatabaseObserver& aObserver, RFs& aFs, const TDesC& aPath) - { - TRACER("CGlxtnVolumeDatabase* CGlxtnVolumeDatabase::NewLC( MGlxtnVolumeDatabaseObserver& aObserver, RFs& aFs, const TDesC& aPath)"); - CGlxtnVolumeDatabase* self = - new (ELeave) CGlxtnVolumeDatabase(aObserver, aFs); - CleanupStack::PushL(self); - self->ConstructL(aPath); - return self; - } - -// ----------------------------------------------------------------------------- -// Constructor -// ----------------------------------------------------------------------------- -// -CGlxtnVolumeDatabase::CGlxtnVolumeDatabase( - MGlxtnVolumeDatabaseObserver& aObserver, - RFs& aFs) - : CActive(EPriorityStandard), - iObserver(aObserver), iFs(aFs), iState(EStateIdle) - { - TRACER("CGlxtnVolumeDatabase::CGlxtnVolumeDatabase( MGlxtnVolumeDatabaseObserver& aObserver, RFs& aFs)"); - } - -// ----------------------------------------------------------------------------- -// ConstructL -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::ConstructL(const TDesC& aPath) - { - TRACER("void CGlxtnVolumeDatabase::ConstructL(const TDesC& aPath)"); - iDrive = aPath.Left(KMaxDriveName); - - TRAPD(error, OpenDbL(iFs, aPath)); - if ( KErrNone != error ) - { - iDatabase.Close(); - delete iStore; - iStore = NULL; - CreateDbL(iFs, aPath); - } - - CActiveScheduler::Add(this); - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CGlxtnVolumeDatabase::~CGlxtnVolumeDatabase() - { - TRACER("CGlxtnVolumeDatabase::~CGlxtnVolumeDatabase()"); - Cancel(); - iView.Close(); - iTable.Close(); - iDbUpdater.Close(); - iDatabase.Close(); - delete iStore; - } - -// ----------------------------------------------------------------------------- -// Drive -// ----------------------------------------------------------------------------- -// -const TDesC& CGlxtnVolumeDatabase::Drive() const - { - TRACER("TDesC& CGlxtnVolumeDatabase::Drive()"); - return iDrive; - } - -// ----------------------------------------------------------------------------- -// GetThumbnailIdL -// Look up thumbnail ID from Ids table -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::GetThumbnailIdL( const TGlxMediaId& aMediaId ) - { - TRACER("void CGlxtnVolumeDatabase::GetThumbnailIdL( const TGlxMediaId& aMediaId )"); - if ( EStateIdle != iState ) - { - User::Leave(KErrNotReady); - } - - GLX_LOG_INFO1("CGlxtnVolumeDatabase::GetThumbnailIdL() Media Id= %d",aMediaId.Value()); - HBufC* sql = HBufC::NewLC( - KGlxQueryThumbIdFromIds().Length() + KGlxTIntMaxDigits ); - *sql = KGlxQueryThumbIdFromIds; - sql->Des().AppendNum( aMediaId.Value() ); - - EvaluateQueryL( *sql ); - iState = EStateGettingIdFromMediaId; - - CleanupStack::PopAndDestroy(sql); - } - -// ----------------------------------------------------------------------------- -// GetThumbnailIdL -// Look up thumbnail ID from Items table. If not found, add new record. -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::GetThumbnailIdL(const CGlxtnFileInfo* aInfo) - { - TRACER("void CGlxtnVolumeDatabase::GetThumbnailIdL(const CGlxtnFileInfo* aInfo)"); - if ( EStateIdle != iState ) - { - User::Leave(KErrNotReady); - } - - iInfo = aInfo; - HBufC* uri = QuoteSqlStringLC(iInfo->FilePath()); - HBufC* sql = HBufC::NewLC( - KGlxQueryThumbIdFromItems().Length() + uri->Length()); - *sql = KGlxQueryThumbIdFromItems; - sql->Des().Append(*uri); - - EvaluateQueryL( *sql ); - iState = EStateGettingIdFromFilename; - - CleanupStack::PopAndDestroy(sql); - CleanupStack::PopAndDestroy(uri); - } - -// ----------------------------------------------------------------------------- -// StoreThumbnailIdL -// Add record to Ids table -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::StoreThumbnailIdL( const TGlxMediaId& aMediaId, - const TGlxtnThumbnailId& aThumbId ) - { - TRACER("void CGlxtnVolumeDatabase::StoreThumbnailIdL( const TGlxMediaId& aMediaId, const TGlxtnThumbnailId& aThumbId )"); - if ( EStateIdle != iState ) - { - User::Leave(KErrNotReady); - } - GLX_LOG_INFO1("StoreThumbnailIdL():- Media Id = %d",aMediaId.Value()); - GLX_LOG_INFO1("StoreThumbnailIdL():- aThumbId = %d",aThumbId.Value()); - RDbTable table; - CleanupClosePushL(table); - User::LeaveIfError( table.Open( - iDatabase, KGlxTableIds, RDbRowSet::EInsertOnly ) ); - - table.InsertL(); - table.SetColL( KGlxColIdMediaId, aMediaId.Value() ); - table.SetColL( KGlxColIdThumbId, aThumbId.Value() ); - table.PutL(); - - CleanupStack::PopAndDestroy(&table); - - iObserver.HandleThumbnailIdStoredL(); - } - -// ----------------------------------------------------------------------------- -// GetThumbnailL -// Look up thumbnail from Thumbnails table -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::GetThumbnailL( const TGlxtnThumbnailId& aThumbId, - const TSize& aSize ) - { - TRACER("void CGlxtnVolumeDatabase::GetThumbnailL( const TGlxtnThumbnailId& aThumbId, const TSize& aSize )"); - if ( EStateIdle != iState ) - { - User::Leave(KErrNotReady); - } - - GLX_LOG_INFO1("GetThumbnailL():- ThumbId Id = %d",aThumbId.Value()); - GLX_LOG_INFO2("GetThumbnailL Width=%d, Height=%d", aSize.iWidth, aSize.iHeight); - HBufC* sql = HBufC::NewLC( KGlxQueryThumbnail().Length() - + 3 * KGlxTIntMaxDigits); - sql->Des().Format( KGlxQueryThumbnail, - aThumbId.Value(), aSize.iWidth, aSize.iHeight ); - - EvaluateQueryL( *sql ); - iState = EStateGettingThumbnail; - - CleanupStack::PopAndDestroy(sql); - } - -// ----------------------------------------------------------------------------- -// CheckAvailableL -// Check if thumbnail is in Thumbnails table -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::CheckAvailableL( const TGlxtnThumbnailId& aThumbId, - const TSize& aSize ) - { - TRACER("void CGlxtnVolumeDatabase::CheckAvailableL( const TGlxtnThumbnailId& aThumbId, const TSize& aSize )"); - if ( EStateIdle != iState ) - { - User::Leave(KErrNotReady); - } - GLX_LOG_INFO1("CheckAvailableL():- ThumbId = %d", aThumbId.Value()); - - HBufC* sql = HBufC::NewLC( KGlxQueryAvailable().Length() - + 3 * KGlxTIntMaxDigits); - sql->Des().Format( KGlxQueryAvailable, - aThumbId.Value(), aSize.iWidth, aSize.iHeight ); - - EvaluateQueryL( *sql ); - iState = EStateCheckingAvailability; - - CleanupStack::PopAndDestroy(sql); - } - -// ----------------------------------------------------------------------------- -// StoreThumbnailL -// Add record to Thumbnails table -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::StoreThumbnailL( const TGlxtnThumbnailId& aThumbId, - const TSize& aSize, - TGlxImageDataFormat aFormat, - const TDesC8& aData ) - { - TRACER("void CGlxtnVolumeDatabase::StoreThumbnailL( const TGlxtnThumbnailId& aThumbId, const TSize& aSize, TGlxImageDataFormat aFormat, const TDesC8& aData )"); - if ( EStateIdle != iState ) - { - User::Leave(KErrNotReady); - } - GLX_LOG_INFO1("StoreThumbnailL():- aThumbId = %d",aThumbId.Value()); - GLX_LOG_INFO2("StoreThumbnailL Width=%d, Height=%d", aSize.iWidth, aSize.iHeight); - - RDbTable table; - CleanupClosePushL(table); - User::LeaveIfError( table.Open( - iDatabase, KGlxTableThumbnails, RDbRowSet::EInsertOnly ) ); - - table.InsertL(); - table.SetColL( KGlxColThumbnailId, aThumbId.Value() ); - table.SetColL( KGlxColThumbnailWidth, aSize.iWidth ); - table.SetColL( KGlxColThumbnailHeight, aSize.iHeight ); - table.SetColL( KGlxColThumbnailFormat, aFormat ); - table.SetColL( KGlxColThumbnailData, aData ); - table.PutL(); - - CleanupStack::PopAndDestroy(&table); - - iObserver.HandleThumbnailStored(); - } - -// ----------------------------------------------------------------------------- -// DeleteFromIdsL -// Delete from IDs table -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::DeleteIdL( const TGlxMediaId& aMediaId ) - { - TRACER("void CGlxtnVolumeDatabase::DeleteIdL( const TGlxMediaId& aMediaId )"); - if ( EStateIdle != iState ) - { - User::Leave(KErrNotReady); - } - - GLX_LOG_INFO1("DeleteIdL():- Media Id = %d",aMediaId.Value()); - HBufC* sql = HBufC::NewLC( KGlxDeleteId().Length() + KGlxTIntMaxDigits); - - sql->Des().Format( KGlxDeleteId, aMediaId.Value() ); - - UpdateDataL( *sql ); - iState = EStateDeletingId; - - CleanupStack::PopAndDestroy(sql); - } - -// ----------------------------------------------------------------------------- -// DeleteThumbnailsL -// Delete Thumbnails from Thumbnail table -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::DeleteThumbnailsL( - const TGlxtnThumbnailId& aThumbId ) - { - TRACER("void CGlxtnVolumeDatabase::DeleteThumbnailsL( const TGlxtnThumbnailId& aThumbId )"); - if ( EStateIdle != iState ) - { - User::Leave(KErrNotReady); - } - GLX_LOG_INFO1("DeleteThumbnailsL():- aThumbId = %d",aThumbId.Value()); - - HBufC* sql = HBufC::NewLC(KGlxDeleteThumbnails().Length() + - KGlxTIntMaxDigits); - - sql->Des().Format( KGlxDeleteThumbnails, aThumbId.Value() ); - - UpdateDataL( *sql ); - iState = EStateDeletingThumbnails; - - CleanupStack::PopAndDestroy(sql); - } - -// ----------------------------------------------------------------------------- -// DeleteItemL -// Delete Item from Items table -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::DeleteItemL( const TGlxtnThumbnailId& aThumbId ) - { - TRACER("void CGlxtnVolumeDatabase::DeleteItemL( const TGlxtnThumbnailId& aThumbId )"); - if ( EStateIdle != iState ) - { - User::Leave(KErrNotReady); - } - - GLX_LOG_INFO1("DeleteItemL():- aThumbId = %d",aThumbId.Value()); - HBufC* sql = HBufC::NewLC( KGlxDeleteItem().Length() + KGlxTIntMaxDigits); - - sql->Des().Format( KGlxDeleteItem, aThumbId.Value() ); - - UpdateDataL( *sql ); - iState = EStateDeletingItem; - - CleanupStack::PopAndDestroy(sql); - } - -// ----------------------------------------------------------------------------- -// CleanupDatabaseL -// Clean from database entries that do not have a corresponding media file -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::CleanupDatabaseL() - { - TRACER("void CGlxtnVolumeDatabase::CleanupDatabaseL()"); - if ( EStateIdle != iState ) - { - User::Leave(KErrNotReady); - } - User::LeaveIfError( iTable.Open( - iDatabase, KGlxTableItems, RDbRowSet::EUpdatable ) ); - iTable.BeginningL(); - - SetActive(); - TRequestStatus* ts = &iStatus; - User::RequestComplete(ts, KErrNone); - - iState = EStateCleaning; - } - - -// ----------------------------------------------------------------------------- -// CleanupRowL -// Test entry in one row in Items table to see if file is available. If it is -// not, delete this row and start process of deleting corresponding entries -// from Ids table and Thumbnails table -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::CleanupRowL() - { - TRACER("void CGlxtnVolumeDatabase::CleanupRowL()"); - // Get filename - iTable.GetL(); - TPtrC filename = iTable.ColDes(KGlxColItemUri); - - // does file exist - TTime time; - TInt err = iFs.Modified(filename, time); - if(err == KErrNone) - { - //yes, file exists, so complete to go to next row - SetActive(); - TRequestStatus* ts = &iStatus; - User::RequestComplete(ts, KErrNone); - iState = EStateCleaning; - } - else - { - // Problem accessing file, so delete database entries - // First delete row in Items table - TUint thumbId = iTable.ColUint( KGlxColItemId ); - //Delete the row (entry in Items) - iTable.DeleteL(); - - // Now delete from Thumbnails - HBufC* sql = HBufC::NewLC(KGlxDeleteThumbnails().Length() + - KGlxTIntMaxDigits); - - sql->Des().Format( KGlxDeleteThumbnails, thumbId ); - UpdateDataL( *sql ); - iState = EStateCleaningDeletingThumbnails; - CleanupStack::PopAndDestroy(sql); - } - } - -// ----------------------------------------------------------------------------- -// DoCancel -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::DoCancel() - { - TRACER("void CGlxtnVolumeDatabase::DoCancel()"); - iView.Cancel(); - iTable.Close(); - iDbUpdater.Close(); - iState = EStateIdle; - } - -// ----------------------------------------------------------------------------- -// RunL -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::RunL() - { - TRACER("void CGlxtnVolumeDatabase::RunL()"); - User::LeaveIfError(iStatus.Int()); - - // Continue any database operations which aren't finished - switch ( iState ) - { - case EStateGettingIdFromMediaId: - case EStateGettingIdFromFilename: - case EStateGettingThumbnail: - case EStateCheckingAvailability: - if ( iView.Unevaluated() ) - { - iView.Evaluate(iStatus); - SetActive(); - return; - } - break; - case EStateDeletingId: - case EStateDeletingThumbnails: - case EStateDeletingItem: - case EStateCleaningDeletingThumbnails: - if(iStatus.Int() != 0) - { - iDbUpdater.Next(iStatus); - SetActive(); - return; - } - break; - case EStateCleaning: - // do nothing - break; - default: - Panic(EGlxPanicIllegalState); - break; - } - - // Handle results of database operation - switch ( iState ) - { - case EStateGettingIdFromMediaId: - { - TGlxtnThumbnailId thumbId; - if ( iView.FirstL() ) - { - iView.GetL(); - thumbId = iView.ColUint(KGlxColIdThumbId); - GLX_LOG_INFO1("RunL - EStateGettingIdFromMediaId IF (iView.FirstL()): ThumbId = %d", thumbId.Value()); - } - iView.Close(); - iState = EStateIdle; - GLX_LOG_INFO1("RunL - EStateGettingIdFromMediaId - aThumbId = %d", thumbId.Value()); - iObserver.HandleThumbnailIdFromMediaIdL(thumbId); - } - break; - - case EStateGettingIdFromFilename: - { - TGlxtnThumbnailId thumbId; - if ( iView.FirstL() ) - { - iView.GetL(); - thumbId = iView.ColUint(KGlxColItemId); - iView.Close(); - } - else - { - iView.Close(); - thumbId = DoAddItemL(); - } - iState = EStateIdle; - iInfo = NULL; - GLX_LOG_INFO1("RunL - EStateGettingIdFromFilename - aThumbId = %d", thumbId.Value()); - iObserver.HandleThumbnailIdFromFilenameL(thumbId); - } - break; - - case EStateGettingThumbnail: - if ( iView.FirstL() ) - { - iView.GetL(); - TGlxImageDataFormat format = static_cast( - iView.ColInt(KGlxColThumbnailFormat)); - TInt size = iView.ColSize(KGlxColThumbnailData); - - RDbColReadStream stream; - stream.OpenLC(iView, KGlxColThumbnailData); - HBufC8* data = HBufC8::NewLC(size); - TPtr8 ptr(data->Des()); - // Need to specify amount to read, as the HBufC8 can be bigger - // than requested - stream.ReadL(ptr, size); - - CleanupStack::Pop(data); - CleanupStack::PopAndDestroy(&stream); - - iView.Close(); - iState = EStateIdle; - iObserver.HandleThumbnail(format, data); - } - else - { - iView.Close(); - iState = EStateIdle; - GLX_LOG_INFO("RunL: HandleDatabaseError - KErrNotFound"); - iObserver.HandleDatabaseError(KErrNotFound); - } - break; - - case EStateDeletingId: - iState = EStateIdle; - iDbUpdater.Close(); - iObserver.HandleMediaIdDeletedL(); - break; - - case EStateDeletingThumbnails: - iState = EStateIdle; - iDbUpdater.Close(); - iObserver.HandleThumbnailsDeletedL(); - break; - - case EStateDeletingItem: - iState = EStateIdle; - iDbUpdater.Close(); - iObserver.HandleItemDeletedL(); - break; - - case EStateCheckingAvailability: - { - TInt result = KGlxThumbnailAvailable; - if ( iView.IsEmptyL() ) - { - result = KGlxThumbnailNotAvailable; - } - iView.Close(); - iState = EStateIdle; - GLX_LOG_INFO1("RunL - EStateCheckingAvailability - result = %d", result); - iObserver.HandleAvailabilityChecked(result); - } - break; - - case EStateCleaningDeletingThumbnails: - iState = EStateCleaning; - iDbUpdater.Close(); // deliberate fall through to next row - case EStateCleaning: - if(iTable.NextL()) - { - // next row - CleanupRowL(); - } - else - { - // no more rows - iTable.Close(); - iState = EStateIdle; - iObserver.HandleDatabaseCleanedL(); - } - break; - default: - Panic(EGlxPanicIllegalState); - break; - } - } - -// ----------------------------------------------------------------------------- -// RunError -// ----------------------------------------------------------------------------- -// -TInt CGlxtnVolumeDatabase::RunError(TInt aError) - { - TRACER("TInt CGlxtnVolumeDatabase::RunError(TInt aError)"); - iTable.Close(); - iView.Close(); - iDbUpdater.Close(); - iState = EStateIdle; - iInfo = NULL; - GLX_LOG_INFO1("RunL: HandleDatabaseError - error=%d", aError); - iObserver.HandleDatabaseError(aError); - - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// OpenDbL -// Open an existing database. -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::OpenDbL(RFs& aFs, const TDesC& aFilename) - { - GLX_LOG_ENTRY_EXIT("void CGlxtnVolumeDatabase::OpenDbL(RFs& aFs, const TDesC& aFilename)"); - iStore = CFileStore::OpenL(aFs, aFilename, EFileRead | EFileWrite); - iDatabase.OpenL(iStore, iStore->Root()); - - // Get next available thumbnail ID (synchronous) - RDbTable table; - CleanupClosePushL(table); - User::LeaveIfError( table.Open( - iDatabase, KGlxTableItems, RDbRowSet::EReadOnly ) ); - User::LeaveIfError(table.SetIndex(KGlxIndexItems)); - - // Find highest thumbnail ID in use. New entries are added to the Items - // table first, and deleted from the Items table last, so all IDs in use - // will always be found there. - // Thumbnail IDs are only unique within a volume. - if ( table.LastL() ) - { - table.GetL(); - iNextThumbId = table.ColUint(KGlxColItemId) + 1; - } - else - { - // Database is empty - iNextThumbId = KGlxFirstThumbnailId; - } - - CleanupStack::PopAndDestroy(&table); - } - -// ----------------------------------------------------------------------------- -// CreateDbL -// Create a new database. -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::CreateDbL(RFs& aFs, const TDesC& aFilename) - { - TRACER("void CGlxtnVolumeDatabase::CreateDbL(RFs& aFs, const TDesC& aFilename)"); - // Create database, overwriting any existing file - TInt err = aFs.MkDirAll(aFilename); - if ( err != KErrAlreadyExists ) - { - User::LeaveIfError(err); - } - iStore = CPermanentFileStore::ReplaceL(aFs, aFilename, - EFileRead | EFileWrite); - iStore->SetTypeL(KPermanentFileStoreLayoutUid); - iStore->SetRootL(iDatabase.CreateL(iStore)); - iStore->CommitL(); - - User::LeaveIfError(iDatabase.Execute(KGlxCreateTableIds)); - User::LeaveIfError(iDatabase.Execute(KGlxCreateTableItems)); - User::LeaveIfError(iDatabase.Execute(KGlxCreateTableThumbnails)); - User::LeaveIfError(iDatabase.Execute(KGlxCreateIndexIds)); - User::LeaveIfError(iDatabase.Execute(KGlxCreateIndexItems)); - User::LeaveIfError(iDatabase.Execute(KGlxCreateIndexThumbnails)); - - iNextThumbId = KGlxFirstThumbnailId; - } - -// ----------------------------------------------------------------------------- -// DoAddItemL -// ----------------------------------------------------------------------------- -// -TGlxtnThumbnailId CGlxtnVolumeDatabase::DoAddItemL() - { - TRACER("TGlxtnThumbnailId CGlxtnVolumeDatabase::DoAddItemL()"); - __ASSERT_ALWAYS(iInfo, Panic(EGlxPanicNullPointer)); - RDbTable table; - CleanupClosePushL(table); - User::LeaveIfError(table.Open(iDatabase, KGlxTableItems, RDbRowSet::EInsertOnly)); - TGlxtnThumbnailId thumbId( iNextThumbId ); - - table.InsertL(); - table.SetColL( KGlxColItemUri, iInfo->FilePath() ); - table.SetColL( KGlxColItemId, thumbId.Value() ); - table.SetColL( KGlxColItemFileSize, iInfo->iFileSize ); - table.SetColL( KGlxColItemModTime, iInfo->iFileTime ); - table.PutL(); - - iNextThumbId++; - CleanupStack::PopAndDestroy(&table); - - return thumbId; - } - -// ----------------------------------------------------------------------------- -// EvaluateQueryL -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::EvaluateQueryL( const TDbQuery &aQuery ) - { - TRACER("void CGlxtnVolumeDatabase::EvaluateQueryL( const TDbQuery &aQuery )"); - User::LeaveIfError( iView.Prepare( - iDatabase, aQuery, RDbRowSet::EReadOnly ) ); - iView.Evaluate( iStatus ); - SetActive(); - } - -// ----------------------------------------------------------------------------- -// UpdateDataL -// ----------------------------------------------------------------------------- -// -void CGlxtnVolumeDatabase::UpdateDataL( const TDesC& aSql ) - { - TRACER("void CGlxtnVolumeDatabase::UpdateDataL( const TDesC& aSql )"); - TInt result = iDbUpdater.Execute( iDatabase, aSql ); - - if ( result < KErrNone ) - { - iDbUpdater.Close(); - User::Leave( result ); - } - - // According to documentation a result of 0 should indicate complete - // but this does not seem to be the case - iDbUpdater.Next( iStatus ); - SetActive(); - } - -// ----------------------------------------------------------------------------- -// QuoteSqlStringLC -// ----------------------------------------------------------------------------- -// -HBufC* CGlxtnVolumeDatabase::QuoteSqlStringLC(const TDesC& aText) - { - TRACER("HBufC* CGlxtnVolumeDatabase::QuoteSqlStringLC(const TDesC& aText)"); - const TText quote('\''); - TInt length = aText.Length() + 2; - - for ( TInt i = 0; i < aText.Length(); i++ ) - { - if ( quote == aText[i] ) - { - length++; - } - } - - HBufC* text = HBufC::NewLC(length); - TPtr ptr(text->Des()); - - ptr.Append(quote); - for ( TInt i = 0; i < aText.Length(); i++ ) - { - TText chr = aText[i]; - ptr.Append(chr); - if ( quote == chr ) - { - ptr.Append(quote); - } - } - ptr.Append(quote); - - return text; - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/src/glxtnzoomedimagetask.cpp --- a/engine/collectionframework/thumbnailcreator/src/glxtnzoomedimagetask.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,256 +0,0 @@ -/* -* 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: Task to generate a cropped thumbnail for a JPEG image. -* -*/ - - - -/** - * @internal reviewed 31/07/2007 by Simon Brooks - */ - -#include "glxtnzoomedimagetask.h" - -#include -#include -#include -#include // For CExtJpegDecoder -#include - -#include "glxtnfileinfo.h" -#include "glxtnfileutility.h" -#include "glxtnthumbnailrequest.h" -#include "mglxtnthumbnailcreatorclient.h" - -// ----------------------------------------------------------------------------- -// NewL -// ----------------------------------------------------------------------------- -// -CGlxtnZoomedImageTask* CGlxtnZoomedImageTask::NewL( - const TGlxThumbnailRequest& aRequestInfo, - CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient) - { - TRACER("CGlxtnZoomedImageTask* CGlxtnZoomedImageTask::NewL( const TGlxThumbnailRequest& aRequestInfo, CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient)"); - CGlxtnZoomedImageTask* task = new (ELeave) CGlxtnZoomedImageTask( - aRequestInfo, aFileUtility, aClient); - CleanupStack::PushL(task); - task->ConstructL(aRequestInfo.iBitmapHandle); - CleanupStack::Pop( task ); - return task; - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CGlxtnZoomedImageTask::~CGlxtnZoomedImageTask() - { - TRACER("CGlxtnZoomedImageTask::~CGlxtnZoomedImageTask()"); - delete iDecoder; - delete iInfo; - delete iThumbnail; - } - -// ----------------------------------------------------------------------------- -// Constructor -// ----------------------------------------------------------------------------- -// -CGlxtnZoomedImageTask::CGlxtnZoomedImageTask( - const TGlxThumbnailRequest& aRequestInfo, - CGlxtnFileUtility& aFileUtility, - MGlxtnThumbnailCreatorClient& aClient) : - CGlxtnClientTask(KGlxtnTaskIdZoomedThumbnail, aRequestInfo.iId, aClient), - iFileUtility(aFileUtility), iRequestedSize(aRequestInfo.iSizeClass), - iCroppingRect(aRequestInfo.iCroppingRect), iFilter(aRequestInfo.iFilter), - iDrmAllowed(aRequestInfo.iDrmAllowed) - { - TRACER("CGlxtnZoomedImageTask::CGlxtnZoomedImageTask( const TGlxThumbnailRequest& aRequestInfo, CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient)"); - } - -// ----------------------------------------------------------------------------- -// ConstructL -// ----------------------------------------------------------------------------- -// -void CGlxtnZoomedImageTask::ConstructL(TInt aBitmapHandle) - { - TRACER("void CGlxtnZoomedImageTask::ConstructL(TInt aBitmapHandle)"); - // Duplicate the client's bitmap - iThumbnail = new (ELeave) CFbsBitmap(); - User::LeaveIfError(iThumbnail->Duplicate(aBitmapHandle)); - } - -// ----------------------------------------------------------------------------- -// DoStartL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnZoomedImageTask::DoStartL(TRequestStatus& aStatus) - { - TRACER("TBool CGlxtnZoomedImageTask::DoStartL(TRequestStatus& aStatus)"); - iInfo = new (ELeave) CGlxtnFileInfo; - Client().FetchFileInfoL(iInfo, ItemId(), &aStatus); - iState = EStateFetchingUri; - - return ETrue; - } - -// ----------------------------------------------------------------------------- -// DoCancel -// ----------------------------------------------------------------------------- -// -void CGlxtnZoomedImageTask::DoCancel() - { - TRACER("void CGlxtnZoomedImageTask::DoCancel()"); - if ( EStateFetchingUri == iState ) - { - Client().CancelFetchUri(ItemId()); - } - if ( iDecoder ) - { - iDecoder->Cancel(); - } - - iFileUtility.ClearBadFileMarker(); - } - -// ----------------------------------------------------------------------------- -// DoRunL -// ----------------------------------------------------------------------------- -// -TBool CGlxtnZoomedImageTask::DoRunL(TRequestStatus& aStatus) - { - TRACER("TBool CGlxtnZoomedImageTask::DoRunL(TRequestStatus& aStatus)"); - TInt error = aStatus.Int(); - TBool active = EFalse; - - if ( KErrNone == error ) - { - switch ( iState ) - { - case EStateFetchingUri: - { - User::LeaveIfNull(iInfo); - iFileUtility.CheckBadFileListL( iInfo->FilePath() ); - - TBool video; - iInfo->IdentifyFileL(video, iProtected); - if ( iProtected && !iDrmAllowed ) - { - User::Leave(KErrAccessDenied); - } - - DecodePartialImageL(aStatus); - active = ETrue; - iState = EStateDecoding; - } - break; - - case EStateDecoding: - // Nothing to do - break; - - default: - GLX_ASSERT_ALWAYS( EFalse, Panic( EGlxPanicIllegalState ), - "CGlxtnZoomedImageTask: Illegal state" ); - break; - } - } - - if ( !active ) - { - iFileUtility.ClearBadFileMarker(); - Client().ThumbnailFetchComplete(ItemId(), - EGlxThumbnailQualityHigh, error); - } - - return active; - } - -// ----------------------------------------------------------------------------- -// DoRunError -// ----------------------------------------------------------------------------- -// -TBool CGlxtnZoomedImageTask::DoRunError(TInt aError) - { - TRACER("TBool CGlxtnZoomedImageTask::DoRunError(TInt aError)"); - iFileUtility.ClearBadFileMarker(); - Client().ThumbnailFetchComplete(ItemId(), EGlxThumbnailQualityHigh, aError); - - return EFalse; - } - -// ----------------------------------------------------------------------------- -// DecodePartialImageL -// ----------------------------------------------------------------------------- -// -void CGlxtnZoomedImageTask::DecodePartialImageL(TRequestStatus& aStatus) - { - TRACER("void CGlxtnZoomedImageTask::DecodePartialImageL(TRequestStatus& aStatus)"); - TRAPD(err, CreateDecoderL(CExtJpegDecoder::EHwImplementation)); - if ( KErrNone != err ) - { - CreateDecoderL(CExtJpegDecoder::ESwImplementation); - } - - TSize sourceSize(iDecoder->FrameInfo().iOverallSizeInPixels); - if ( 0 == sourceSize.iWidth || 0 == sourceSize.iHeight ) - { - User::Leave(KErrCorrupt); - } - - iCroppingRect.Intersection(TRect(sourceSize)); - if ( iCroppingRect.IsEmpty() ) - { - User::Leave(KErrArgument); - } - - // Find max scaling factor which won't make image smaller than target size - TInt shift = 3; - while ( shift - && (sourceSize.iWidth >> shift) < iRequestedSize.iWidth - && (sourceSize.iHeight >> shift) < iRequestedSize.iHeight ) - { - shift--; - } - TInt fudge = (1 << shift) - 1; // Used to "round up" the scaled values - TSize loadSize((iCroppingRect.Width() + fudge) >> shift, - (iCroppingRect.Height() + fudge) >> shift); - - // Resize empty bitmap to required size - User::LeaveIfError(iThumbnail->Resize(loadSize)); - - iDecoder->SetCroppingL(iCroppingRect); - iDecoder->Convert(&aStatus, *iThumbnail); - } - -// ----------------------------------------------------------------------------- -// CreateDecoderL -// ----------------------------------------------------------------------------- -// -void CGlxtnZoomedImageTask::CreateDecoderL(TInt aDecoderType) - { - TRACER("void CGlxtnZoomedImageTask::CreateDecoderL(TInt aDecoderType)"); - delete iDecoder; - iDecoder = NULL; - iDecoder = CExtJpegDecoder::FileNewL( - static_cast(aDecoderType), - iFileUtility.FsSession(), iInfo->FilePath()); - - if ( !(CExtJpegDecoder::ECapCropping & iDecoder->CapabilitiesL()) ) - { - User::Leave(KErrNotSupported); - } - } - -// End of File diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/BMARM/ut_cglxtndeletethumbnailstasku.def --- a/engine/collectionframework/thumbnailcreator/test/BMARM/ut_cglxtndeletethumbnailstasku.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -EXPORTS - CreateTestSuiteL__Fv @ 1 NONAME R3UNUSED ; CreateTestSuiteL(void) diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/BMARM/ut_cglxtnfilteravailabletasku.def --- a/engine/collectionframework/thumbnailcreator/test/BMARM/ut_cglxtnfilteravailabletasku.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -EXPORTS - CreateTestSuiteL__Fv @ 1 NONAME R3UNUSED ; CreateTestSuiteL(void) diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/BMARM/ut_cglxtngeneratethumbnailtasku.def --- a/engine/collectionframework/thumbnailcreator/test/BMARM/ut_cglxtngeneratethumbnailtasku.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -EXPORTS - CreateTestSuiteL__Fv @ 1 NONAME R3UNUSED ; CreateTestSuiteL(void) diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/BMARM/ut_cglxtnquickthumbnailtasku.def --- a/engine/collectionframework/thumbnailcreator/test/BMARM/ut_cglxtnquickthumbnailtasku.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -EXPORTS - CreateTestSuiteL__Fv @ 1 NONAME R3UNUSED ; CreateTestSuiteL(void) diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/BWINS/ut_cglxtndeletethumbnailstasku.def --- a/engine/collectionframework/thumbnailcreator/test/BWINS/ut_cglxtndeletethumbnailstasku.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/BWINS/ut_cglxtnfilteravailabletasku.def --- a/engine/collectionframework/thumbnailcreator/test/BWINS/ut_cglxtnfilteravailabletasku.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void) - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/BWINS/ut_cglxtngeneratethumbnailtasku.def --- a/engine/collectionframework/thumbnailcreator/test/BWINS/ut_cglxtngeneratethumbnailtasku.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -EXPORTS - ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * __cdecl CreateTestSuiteL(void) - ??1CAdisDisplayChain@@UAE@XZ @ 2 NONAME ; CAdisDisplayChain::~CAdisDisplayChain(void) - ?Cancel@CAdisDisplayChain@@QAEXXZ @ 3 NONAME ; void CAdisDisplayChain::Cancel(void) - ?GetParL@CAdisDisplayChain@@QAEXPAXW4TADCPar@1@@Z @ 4 NONAME ; void CAdisDisplayChain::GetParL(void *, enum CAdisDisplayChain::TADCPar) - ?IsSupported@CAdisDisplayChain@@QAEHW4TADCPar@1@@Z @ 5 NONAME ; int CAdisDisplayChain::IsSupported(enum CAdisDisplayChain::TADCPar) - ?NewL@CAdisDisplayChain@@SAPAV1@H@Z @ 6 NONAME ; class CAdisDisplayChain * CAdisDisplayChain::NewL(int) - ?NewL@CGlxtnSaveThumbnailTask@@SAPAV1@ABVTGlxMediaId@@PAVCGlxtnFileInfo@@ABVTSize@@PAVCFbsBitmap@@PAVMGlxtnThumbnailStorage@@@Z @ 7 NONAME ; class CGlxtnSaveThumbnailTask * CGlxtnSaveThumbnailTask::NewL(class TGlxMediaId const &, class CGlxtnFileInfo *, class TSize const &, class CFbsBitmap *, class MGlxtnThumbnailStorage *) - ?NewLC@CAdisDisplayChain@@SAPAV1@H@Z @ 8 NONAME ; class CAdisDisplayChain * CAdisDisplayChain::NewLC(int) - ?ParSetsAvailable@CAdisDisplayChain@@SAHXZ @ 9 NONAME ; int CAdisDisplayChain::ParSetsAvailable(void) - ?ProcessL@CAdisDisplayChain@@QAEXAAVTRequestStatus@@PBVCFbsBitmap@@AAV3@@Z @ 10 NONAME ; void CAdisDisplayChain::ProcessL(class TRequestStatus &, class CFbsBitmap const *, class CFbsBitmap &) - ?ProcessL@CAdisDisplayChain@@QAEXPBVCFbsBitmap@@AAV2@@Z @ 11 NONAME ; void CAdisDisplayChain::ProcessL(class CFbsBitmap const *, class CFbsBitmap &) - ?SetParL@CAdisDisplayChain@@QAEXPBXW4TADCPar@1@@Z @ 12 NONAME ; void CAdisDisplayChain::SetParL(void const *, enum CAdisDisplayChain::TADCPar) - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/BWINS/ut_cglxtnquickthumbnailtasku.def --- a/engine/collectionframework/thumbnailcreator/test/BWINS/ut_cglxtnquickthumbnailtasku.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -EXPORTS - ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * __cdecl CreateTestSuiteL(void) diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/BWINS/ut_cglxtnzoomedimagetasku.def --- a/engine/collectionframework/thumbnailcreator/test/BWINS/ut_cglxtnzoomedimagetasku.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -EXPORTS - ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * __cdecl CreateTestSuiteL(void) diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/data/corrupt.jpg --- a/engine/collectionframework/thumbnailcreator/test/data/corrupt.jpg Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -this is not a valid jpeg file \ No newline at end of file diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/data/red_1x1.jpg Binary file engine/collectionframework/thumbnailcreator/test/data/red_1x1.jpg has changed diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/data/tall.jpg Binary file engine/collectionframework/thumbnailcreator/test/data/tall.jpg has changed diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/data/wide.jpg Binary file engine/collectionframework/thumbnailcreator/test/data/wide.jpg has changed diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/eabi/ut_cglxtndeletethumbnailstasku.def --- a/engine/collectionframework/thumbnailcreator/test/eabi/ut_cglxtndeletethumbnailstasku.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z16CreateTestSuiteLv @ 1 NONAME - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/eabi/ut_cglxtnfilteravailabletasku.def --- a/engine/collectionframework/thumbnailcreator/test/eabi/ut_cglxtnfilteravailabletasku.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z16CreateTestSuiteLv @ 1 NONAME - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/eabi/ut_cglxtngeneratethumbnailtasku.def --- a/engine/collectionframework/thumbnailcreator/test/eabi/ut_cglxtngeneratethumbnailtasku.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -EXPORTS - _Z16CreateTestSuiteLv @ 1 NONAME - _ZN17CAdisDisplayChain11IsSupportedENS_7TADCParE @ 2 NONAME - _ZN17CAdisDisplayChain16ParSetsAvailableEv @ 3 NONAME - _ZN17CAdisDisplayChain4NewLEi @ 4 NONAME - _ZN17CAdisDisplayChain5NewLCEi @ 5 NONAME - _ZN17CAdisDisplayChain6CancelEv @ 6 NONAME - _ZN17CAdisDisplayChain7GetParLEPvNS_7TADCParE @ 7 NONAME - _ZN17CAdisDisplayChain7SetParLEPKvNS_7TADCParE @ 8 NONAME - _ZN17CAdisDisplayChain8ProcessLEPK10CFbsBitmapRS0_ @ 9 NONAME - _ZN17CAdisDisplayChain8ProcessLER14TRequestStatusPK10CFbsBitmapRS2_ @ 10 NONAME - _ZN17CAdisDisplayChainD0Ev @ 11 NONAME - _ZN17CAdisDisplayChainD1Ev @ 12 NONAME - _ZN17CAdisDisplayChainD2Ev @ 13 NONAME - _ZN23CGlxtnSaveThumbnailTask4NewLERK11TGlxMediaIdP14CGlxtnFileInfoRK5TSizeP10CFbsBitmapP22MGlxtnThumbnailStorage @ 14 NONAME - _ZTI17CAdisDisplayChain @ 15 NONAME ; ## - _ZTV17CAdisDisplayChain @ 16 NONAME ; ## - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/eabi/ut_cglxtnquickthumbnailtasku.def --- a/engine/collectionframework/thumbnailcreator/test/eabi/ut_cglxtnquickthumbnailtasku.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z16CreateTestSuiteLv @ 1 NONAME - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/eabi/ut_cglxtnzoomedimagetasku.def --- a/engine/collectionframework/thumbnailcreator/test/eabi/ut_cglxtnzoomedimagetasku.def Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z16CreateTestSuiteLv @ 1 NONAME - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/group/ut_cglxtndeletethumbnailstask.mmp --- a/engine/collectionframework/thumbnailcreator/test/group/ut_cglxtndeletethumbnailstask.mmp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2007 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: Delete thumbnails task unit tests. -* -*/ - - - -#include "../../../../../group/glxbuildcommon.mmh" - -TARGET ut_cglxtndeletethumbnailstask.dll -TARGETTYPE dll -UID 0x1000af5a 0x01700000 - -CAPABILITY ALL -TCB - -SOURCEPATH ../ut_cglxtndeletethumbnailstask -SOURCE ut_cglxtndeletethumbnailstaskdllmain.cpp -SOURCE ut_cglxtndeletethumbnailstask.cpp - -// Sources needed by the test -SOURCEPATH ../../src -SOURCE glxtndeletethumbnailstask.cpp -SOURCE glxtntask.cpp - -USERINCLUDE ../inc -USERINCLUDE ../ut_cglxtndeletethumbnailstask -// System includes from the source tree -SYSTEMINCLUDE ../../../../../inc -SYSTEMINCLUDE ../../inc -// System includes from epoc32/include -APP_LAYER_SYSTEMINCLUDE - -SYSTEMINCLUDE /epoc32/include/Digia/EUnit - -LIBRARY efsrv.lib -LIBRARY EUnit.lib -LIBRARY EUnitUtil.lib -LIBRARY euser.lib -SMPSAFE -// End of file diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/group/ut_cglxtnfilteravailabletask.mmp --- a/engine/collectionframework/thumbnailcreator/test/group/ut_cglxtnfilteravailabletask.mmp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2006-2006 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: Thumbnail availability filter task unit tests. -* -*/ - - - -#include "../../../../../group/glxbuildcommon.mmh" - -TARGET ut_cglxtnfilteravailabletask.dll -TARGETTYPE dll -UID 0x1000af5a 0x01700000 - -CAPABILITY ALL -TCB - -SOURCEPATH ../ut_cglxtnfilteravailabletask -SOURCE ut_cglxtnfilteravailabletaskdllmain.cpp -SOURCE ut_cglxtnfilteravailabletask.cpp - -// Sources needed by the test -SOURCEPATH ../../src -SOURCE glxtnfilteravailabletask.cpp -SOURCE glxtntask.cpp - -USERINCLUDE ../inc -USERINCLUDE ../ut_cglxtnfilteravailabletask -// System includes from the source tree -SYSTEMINCLUDE ../../../../../inc -SYSTEMINCLUDE ../../inc -// System includes from epoc32/include -APP_LAYER_SYSTEMINCLUDE - -SYSTEMINCLUDE /epoc32/include/Digia/EUnit - -LIBRARY efsrv.lib -LIBRARY EUnit.lib -LIBRARY EUnitUtil.lib -LIBRARY euser.lib - -SMPSAFE -// End of file diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/group/ut_cglxtngeneratethumbnailtask.mmp --- a/engine/collectionframework/thumbnailcreator/test/group/ut_cglxtngeneratethumbnailtask.mmp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Thumbnail generation task unit tests. -* -*/ - - - -MACRO ENABLE_VED -#define ENABLE_VED - -#include "../../../../../group/glxbuildcommon.mmh" - -TARGET ut_cglxtngeneratethumbnailtask.dll -TARGETTYPE dll -UID 0x1000af5a 0x01700000 - -CAPABILITY ALL -TCB - -SOURCEPATH ../ut_cglxtngeneratethumbnailtask -SOURCE ut_cglxtngeneratethumbnailtaskdllmain.cpp -SOURCE ut_cglxtngeneratethumbnailtask.cpp - -SOURCEPATH ../stubs -SOURCE glxadisstub.cpp -SOURCE glxtnfileutilitystub.cpp - -// Sources needed by the test -SOURCEPATH ../../src -SOURCE glxtnfileinfo.cpp -SOURCE glxtngeneratethumbnailtask.cpp -SOURCE glxtnimagedecoderfactory.cpp -SOURCE glxtnimageutility.cpp -SOURCE glxtnloadthumbnailtask.cpp -SOURCE glxtntask.cpp -SOURCE glxtnvideoutility.cpp - -USERINCLUDE ../inc -USERINCLUDE ../ut_cglxtngeneratethumbnailtask -// System includes from the source tree -SYSTEMINCLUDE ../../../../../inc -SYSTEMINCLUDE ../../inc -// System includes from epoc32/include -APP_LAYER_SYSTEMINCLUDE - -SYSTEMINCLUDE /epoc32/include/Digia/EUnit - -LIBRARY bitgdi.lib -LIBRARY caf.lib -LIBRARY efsrv.lib -LIBRARY estor.lib -LIBRARY EUnit.lib -LIBRARY EUnitUtil.lib -LIBRARY euser.lib -LIBRARY fbscli.lib -LIBRARY iclextjpegapi.lib -LIBRARY imageconversion.lib -LIBRARY ecom.lib -#ifdef ENABLE_VED -LIBRARY vedengine.lib -#else -LIBRARY tneengine.lib -#endif -SMPSAFE -// End of file diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/group/ut_cglxtnquickthumbnailtask.mmp --- a/engine/collectionframework/thumbnailcreator/test/group/ut_cglxtnquickthumbnailtask.mmp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Quick thumbnail generation task unit tests. -* -*/ - - - -MACRO ENABLE_VED -#define ENABLE_VED - -#include "../../../../../group/glxbuildcommon.mmh" - -TARGET ut_cglxtnquickthumbnailtask.dll -TARGETTYPE dll -UID 0x1000af5a 0x01700000 - -CAPABILITY ALL -TCB - -SOURCEPATH ../ut_cglxtnquickthumbnailtask -SOURCE ut_cglxtnquickthumbnailtaskDllMain.cpp -SOURCE UT_CGlxtnQuickThumbnailTask.cpp - -SOURCEPATH ../stubs -SOURCE glxtnfileutilitystub.cpp - -// Sources needed by the test -SOURCEPATH ../../src -SOURCE glxtnfileinfo.cpp -SOURCE glxtnimagedecoderfactory.cpp -SOURCE glxtnloadthumbnailtask.cpp -SOURCE glxtnquickthumbnailtask.cpp -SOURCE glxtntask.cpp -SOURCE glxtnvideoutility.cpp - -USERINCLUDE ../inc -USERINCLUDE ../ut_cglxtnquickthumbnailtask -// System includes from the source tree -SYSTEMINCLUDE ../../../../../inc -SYSTEMINCLUDE ../../inc -// System includes from epoc32/include -APP_LAYER_SYSTEMINCLUDE - -SYSTEMINCLUDE /epoc32/include/Digia/EUnit - - -LIBRARY adis.lib -LIBRARY bitgdi.lib -LIBRARY caf.lib -LIBRARY efsrv.lib -LIBRARY EUnit.lib -LIBRARY EUnitUtil.lib -LIBRARY estor.lib -LIBRARY euser.lib -LIBRARY exiflib.lib -LIBRARY fbscli.lib -LIBRARY iclextjpegapi.lib -LIBRARY imageconversion.lib -LIBRARY ecom.lib -#ifdef ENABLE_VED -LIBRARY vedengine.lib -#else -LIBRARY tneengine.lib -#endif -SMPSAFE -// End of file diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/group/ut_cglxtnzoomedimagetask.mmp --- a/engine/collectionframework/thumbnailcreator/test/group/ut_cglxtnzoomedimagetask.mmp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Cropped thumbnail generation task unit tests. -* -*/ - - - -#include "../../../../../group/glxbuildcommon.mmh" - -TARGET ut_cglxtnzoomedimagetask.dll -TARGETTYPE dll -UID 0x1000af5a 0x01700000 - -CAPABILITY ALL -TCB - -SOURCEPATH ../ut_cglxtnzoomedimagetask -SOURCE ut_cglxtnzoomedimagetaskdllmain.cpp -SOURCE ut_cglxtnzoomedimagetask.cpp - -SOURCEPATH ../stubs -SOURCE glxtnfileutilitystub.cpp - -// Sources needed by the test -SOURCEPATH ../../src -SOURCE glxtnfileinfo.cpp -SOURCE glxtnimagedecoderfactory.cpp -SOURCE glxtnimageutility.cpp -SOURCE glxtnzoomedimagetask.cpp -SOURCE glxtntask.cpp - -USERINCLUDE ../inc -USERINCLUDE ../ut_cglxtnzoomedimagetask -// System includes from the source tree -SYSTEMINCLUDE ../../../../../inc -SYSTEMINCLUDE ../../inc -// System includes from epoc32/include -APP_LAYER_SYSTEMINCLUDE - -SYSTEMINCLUDE /epoc32/include/Digia/EUnit - -LIBRARY adis.lib -LIBRARY caf.lib -LIBRARY efsrv.lib -LIBRARY estor.lib -LIBRARY EUnit.lib -LIBRARY EUnitUtil.lib -LIBRARY euser.lib -LIBRARY fbscli.lib -LIBRARY iclextjpegapi.lib -LIBRARY imageconversion.lib -LIBRARY ecom.lib - -LIBRARY flogger.lib // for logging to file -SMPSAFE -// End of file diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/inc/dummytaskmanager.h --- a/engine/collectionframework/thumbnailcreator/test/inc/dummytaskmanager.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* -* Copyright (c) 2006-2006 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: Thumbnail task unit tests. -* -*/ - - - -#ifndef __DUMMYTASKMANAGER_H__ -#define __DUMMYTASKMANAGER_H__ - -// HACK: Make CDummyTaskManager a friend of CGlxtnTask -#define CDummyTaskManager CGlxtnTaskManager - -// CLASS DEFINITION - -/** -* Dummy task manager to run a single task within a unit test. -*/ -NONSHARABLE_CLASS( CDummyTaskManager ) : public CActive - { -public: - enum TExecutionOrder - { - ELastOut, // Old tasks with the same priority get executed before the new task - EFirstOut // New task gets executed before other tasks with the same priority - }; - - CDummyTaskManager(CGlxtnTask* aTask); - void StartTaskL(); - void AddTaskL(CGlxtnTask* aTask, TExecutionOrder aExecutionOrder = ELastOut); - -private: // From CActive - void RunL(); - void DoCancel(); - TInt RunError(TInt aError); - -private: - CGlxtnTask* iTask; // Not owned - }; - -// --------------------------------------------------------------------------- - -CDummyTaskManager::CDummyTaskManager(CGlxtnTask* aTask) - : CActive(EPriorityStandard), iTask(aTask) - { - CActiveScheduler::Add(this); - } - -void CDummyTaskManager::StartTaskL() - { - iTask->StartL(iStatus); - if ( iTask->State() != CGlxtnTask::EComplete ) - { - SetActive(); - CActiveScheduler::Start(); - } - } - -void CDummyTaskManager::AddTaskL(CGlxtnTask* /*aTask*/, TExecutionOrder /*aExecutionOrder*/) - { - User::Leave(KErrNotSupported); - } - -void CDummyTaskManager::RunL() - { - iTask->RunL(iStatus); - if ( iTask->State() == CGlxtnTask::EComplete ) - { - CActiveScheduler::Stop(); - } - else - { - SetActive(); - } - } - -void CDummyTaskManager::DoCancel() - { - iTask->Cancel(); - } - -TInt CDummyTaskManager::RunError(TInt aError) - { - EUNIT_PRINT(_L("CDummyTaskManager RunError(%d)"), aError); - iTask->RunError(aError); - if ( CGlxtnTask::ERunning == iTask->State() ) - { - SetActive(); - } - else - { - CActiveScheduler::Stop(); - } - return KErrNone; - } - -#endif // __DUMMYTASKMANAGER_H__ - -// End of file diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/stubs/glxadisstub.cpp --- a/engine/collectionframework/thumbnailcreator/test/stubs/glxadisstub.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* Copyright (c) 2006-2007 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 for ADIS processing methods -* -*/ - - - -#include - -EXPORT_C TInt CAdisDisplayChain::ParSetsAvailable() - { - return 2; - } - -EXPORT_C CAdisDisplayChain* CAdisDisplayChain::NewL( - TInt aParSetIndex ) - { - CAdisDisplayChain* self = NewLC(aParSetIndex); - CleanupStack::Pop(self); - return self; - } - -EXPORT_C CAdisDisplayChain* CAdisDisplayChain::NewLC( - TInt /*aParSetIndex*/ ) - { - CAdisDisplayChain* self = new (ELeave) CAdisDisplayChain; - CleanupStack::PushL(self); - return self; - } - -CAdisDisplayChain::CAdisDisplayChain() - { - } - -EXPORT_C CAdisDisplayChain::~CAdisDisplayChain() - { - } - -EXPORT_C TBool CAdisDisplayChain::IsSupported( TADCPar /*aParID*/ ) - { - return ETrue; - } - -EXPORT_C void CAdisDisplayChain::ProcessL( - const CFbsBitmap* /*aScalerInputBitmap*/, - CFbsBitmap& /*aBitmap*/ ) - { - // Do nothing - } - -EXPORT_C void CAdisDisplayChain::ProcessL( - TRequestStatus& aRequestStatus, - const CFbsBitmap* aScalerInputBitmap, - CFbsBitmap& aBitmap ) - { - aRequestStatus = KRequestPending; - - ProcessL(aScalerInputBitmap, aBitmap); - - TRequestStatus* status = &aRequestStatus; - User::RequestComplete(status, KErrNone); - } - -EXPORT_C void CAdisDisplayChain::Cancel() - { - // Do nothing - } - -EXPORT_C void CAdisDisplayChain::SetParL( const TAny* /*aPar*/, TADCPar /*aParID*/ ) - { - // Do nothing - } - -EXPORT_C void CAdisDisplayChain::GetParL( TAny* /*aPar*/, TADCPar /*aParID*/ ) - { - // Do nothing - } - -// END OF FILE diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/stubs/glxtnfileutilitystub.cpp --- a/engine/collectionframework/thumbnailcreator/test/stubs/glxtnfileutilitystub.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2006-2006 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: Utility for thumbnail tasks handling files -* -*/ - - - -#include - -/*static*/ CGlxtnFileUtility* CGlxtnFileUtility::NewL() - { - CGlxtnFileUtility* self = new (ELeave) CGlxtnFileUtility; - - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - - return self; - } - -CGlxtnFileUtility::~CGlxtnFileUtility() - { - iFs.Close(); - } - -RFs& CGlxtnFileUtility::FsSession() - { - return iFs; - } - -void CGlxtnFileUtility::CheckBadFileListL(const TDesC& /*aFilename*/) - { - } - -void CGlxtnFileUtility::ClearBadFileMarker() - { - } - -TBool CGlxtnFileUtility::IsPersistentSize(const TSize& /*aSize*/) - { - return EFalse; - } - -CGlxtnFileUtility::CGlxtnFileUtility() - { - } - -void CGlxtnFileUtility::ConstructL() - { - User::LeaveIfError(iFs.Connect()); - } - -// END OF FILE diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/ut_cglxtndeletethumbnailstask/ut_cglxtndeletethumbnailstask.cpp --- a/engine/collectionframework/thumbnailcreator/test/ut_cglxtndeletethumbnailstask/ut_cglxtndeletethumbnailstask.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,219 +0,0 @@ -/* -* Copyright (c) 2007 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: Delete thumbnails task unit tests. -* -*/ - - - -// CLASS HEADER -#include "ut_cglxtndeletethumbnailstask.h" - -// EXTERNAL INCLUDES -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include "glxtndeletethumbnailstask.h" -#include "dummytaskmanager.h" - -const TUint KTestMediaId = 27; - -// --------------------------------------------------------------------------- - -// CONSTRUCTION -UT_CGlxtnDeleteThumbnailsTask* UT_CGlxtnDeleteThumbnailsTask::NewL() - { - UT_CGlxtnDeleteThumbnailsTask* self = UT_CGlxtnDeleteThumbnailsTask::NewLC(); - CleanupStack::Pop(); - - return self; - } - -UT_CGlxtnDeleteThumbnailsTask* UT_CGlxtnDeleteThumbnailsTask::NewLC() - { - UT_CGlxtnDeleteThumbnailsTask* self = new( ELeave ) UT_CGlxtnDeleteThumbnailsTask(); - CleanupStack::PushL( self ); - - self->ConstructL(); - - return self; - } - -// Destructor (virtual by CBase) -UT_CGlxtnDeleteThumbnailsTask::~UT_CGlxtnDeleteThumbnailsTask() - { - } - -// Default constructor -UT_CGlxtnDeleteThumbnailsTask::UT_CGlxtnDeleteThumbnailsTask() - { - } - -// Second phase construct -void UT_CGlxtnDeleteThumbnailsTask::ConstructL() - { - // The ConstructL from the base class CEUnitTestSuiteClass must be called. - // It generates the test case table. - CEUnitTestSuiteClass::ConstructL(); - } - -// METHODS - -void UT_CGlxtnDeleteThumbnailsTask::ThumbnailFetchComplete( - const TGlxMediaId& /*aItemId*/, TGlxThumbnailQuality /*aQuality*/, TInt /*aErrorCode*/) - { - EUNIT_FAIL_TEST("ThumbnailFetchComplete() called"); - } - -void UT_CGlxtnDeleteThumbnailsTask::ThumbnailDeletionComplete( - const TGlxMediaId& aItemId, TInt aErrorCode) - { - EUNIT_ASSERT_EQUALS( iIdDeleted, aItemId.Value() ); - iError = aErrorCode; - } - -void UT_CGlxtnDeleteThumbnailsTask::FilterAvailableComplete( - const RArray& /*aIdArray*/, TInt /*aErrorCode*/ ) - { - EUNIT_FAIL_TEST("FilterAvailableComplete() called"); - } - -void UT_CGlxtnDeleteThumbnailsTask::FetchFileInfoL(CGlxtnFileInfo* /*aInfo*/, - const TGlxMediaId& /*aItemId*/, TRequestStatus* aStatus) - { - *aStatus = KRequestPending; - User::RequestComplete(aStatus, KErrNone); - } - -void UT_CGlxtnDeleteThumbnailsTask::CancelFetchUri(const TGlxMediaId& /*aItemId*/) - { - } - -MGlxtnThumbnailStorage* UT_CGlxtnDeleteThumbnailsTask::ThumbnailStorage() - { - return this; - } - -void UT_CGlxtnDeleteThumbnailsTask::LoadThumbnailDataL(HBufC8*& /*aData*/, TGlxImageDataFormat& /*aFormat*/, - const TGlxMediaId& /*aId*/, const CGlxtnFileInfo& /*aFileInfo*/, - const TSize& /*aSize*/, TRequestStatus* /*aStatus*/) - { - EUNIT_FAIL_TEST("LoadThumbnailDataL() called"); - } - -void UT_CGlxtnDeleteThumbnailsTask::SaveThumbnailDataL(const TDesC8& /*aData*/, - TGlxImageDataFormat /*aFormat*/, const TGlxMediaId& /*aId*/, - const CGlxtnFileInfo& /*aFileInfo*/, const TSize& /*aSize*/, - TRequestStatus* /*aStatus*/) - { - EUNIT_FAIL_TEST("SaveThumbnailDataL() called"); - } - -void UT_CGlxtnDeleteThumbnailsTask::DeleteThumbnailsL(const TGlxMediaId& aId, - const CGlxtnFileInfo& /*aFileInfo*/, TRequestStatus* aStatus) - { - iIdDeleted = aId.Value(); - - *aStatus = KRequestPending; - User::RequestComplete(aStatus, KErrNone); - } - -void UT_CGlxtnDeleteThumbnailsTask::CleanupThumbnailsL(TRequestStatus* /*aStatus*/) - { - EUNIT_FAIL_TEST("CleanupThumbnailsL() called"); - } - -void UT_CGlxtnDeleteThumbnailsTask::IsThumbnailAvailableL(const TGlxMediaId& /*aId*/, - const CGlxtnFileInfo& /*aFileInfo*/, - const TSize& /*aSize*/, TRequestStatus* /*aStatus*/) - { - EUNIT_FAIL_TEST("IsThumbnailAvailableL() called"); - } - -void UT_CGlxtnDeleteThumbnailsTask::StorageCancel() - { - } - -void UT_CGlxtnDeleteThumbnailsTask::NotifyBackgroundError( - const TGlxMediaId& /*aId*/, TInt /*aError*/) - { - EUNIT_FAIL_TEST("NotifyBackgroundError() called"); - } - -void UT_CGlxtnDeleteThumbnailsTask::SetupL() - { - TGlxMediaId id(KTestMediaId); - iDeleteThumbnailsTask = CGlxtnDeleteThumbnailsTask::NewL(id, *this); - } - -void UT_CGlxtnDeleteThumbnailsTask::Teardown() - { - delete iDeleteThumbnailsTask; - } - -void UT_CGlxtnDeleteThumbnailsTask::UT_CGlxtnDeleteThumbnailsTask_ConstructL() - { - // Check the task was correctly constructed - EUNIT_ASSERT( NULL != iDeleteThumbnailsTask ); - EUNIT_ASSERT_EQUALS( iDeleteThumbnailsTask->Id().Value(), KGlxtnTaskIdDeleteThumbnails ); - EUNIT_ASSERT_EQUALS( iDeleteThumbnailsTask->Storage(), this ); - } - -void UT_CGlxtnDeleteThumbnailsTask::UT_CGlxtnDeleteThumbnailsTask_DeleteL() - { - iIdDeleted = KGlxInvalidIdValue; - - CDummyTaskManager* tm = new (ELeave) CDummyTaskManager(iDeleteThumbnailsTask); - CleanupStack::PushL(tm); - tm->StartTaskL(); - User::LeaveIfError(iError); - CleanupStack::PopAndDestroy(tm); - - EUNIT_ASSERT_EQUALS( iIdDeleted, KTestMediaId ); - } - -// TEST TABLE - -EUNIT_BEGIN_TEST_TABLE( - UT_CGlxtnDeleteThumbnailsTask, - "Unit tests for CGlxtnDeleteThumbnailsTask.", - "UNIT" ) - -EUNIT_TEST( - "Test construction of CGlxtnDeleteThumbnailsTask", - "CGlxtnDeleteThumbnailsTask", - "NewL", - "FUNCTIONALITY", - SetupL, UT_CGlxtnDeleteThumbnailsTask_ConstructL, Teardown) - -EUNIT_TEST( - "Test deleting thumbnails", - "CGlxtnDeleteThumbnailsTask", - "StartL", - "FUNCTIONALITY", - SetupL, UT_CGlxtnDeleteThumbnailsTask_DeleteL, Teardown) - -EUNIT_ALLOC_TEST( - "Test alloc failures", - "CGlxtnDeleteThumbnailsTask", - "StartL", - "ERRORHANDLING", - SetupL, UT_CGlxtnDeleteThumbnailsTask_DeleteL, Teardown) - -EUNIT_END_TEST_TABLE - -// END OF FILE diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/ut_cglxtndeletethumbnailstask/ut_cglxtndeletethumbnailstask.h --- a/engine/collectionframework/thumbnailcreator/test/ut_cglxtndeletethumbnailstask/ut_cglxtndeletethumbnailstask.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2007 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: Delete thumbnails task unit tests. -* -*/ - - - -#ifndef __UT_CGLXTNDELETETHUMBNAILSTASK_H__ -#define __UT_CGLXTNDELETETHUMBNAILSTASK_H__ - -// EXTERNAL INCLUDES - -#include -#include - -// INTERNAL INCLUDES - -#include "mglxtnstorage.h" -#include "mglxtnthumbnailcreatorclient.h" - -// FORWARD DECLARATIONS - -class CGlxtnDeleteThumbnailsTask; - -#include -#ifndef NONSHARABLE_CLASS - #define NONSHARABLE_CLASS(x) class x -#endif - -// CLASS DEFINITION -/** - * - * EUnitWizard generated test class. - * - */ -NONSHARABLE_CLASS( UT_CGlxtnDeleteThumbnailsTask ) - : public CEUnitTestSuiteClass, public MGlxtnThumbnailCreatorClient, - public MGlxtnThumbnailStorage - { - public: // Constructors and destructors - - /** - * Two phase construction - */ - static UT_CGlxtnDeleteThumbnailsTask* NewL(); - static UT_CGlxtnDeleteThumbnailsTask* NewLC(); - /** - * Destructor - */ - ~UT_CGlxtnDeleteThumbnailsTask(); - - private: // Constructors and destructors - - UT_CGlxtnDeleteThumbnailsTask(); - void ConstructL(); - - private: // From MGlxtnThumbnailCreatorClient - void ThumbnailFetchComplete(const TGlxMediaId& aItemId, - TGlxThumbnailQuality aQuality, TInt aErrorCode); - void ThumbnailDeletionComplete(const TGlxMediaId& aItemId, TInt aErrorCode); - void FilterAvailableComplete( const RArray& aIdArray, - TInt aErrorCode ); - void FetchFileInfoL(CGlxtnFileInfo* aInfo, const TGlxMediaId& aItemId, - TRequestStatus* aStatus); - void CancelFetchUri(const TGlxMediaId& aItemId); - MGlxtnThumbnailStorage* ThumbnailStorage(); - - public: // Functions from MGlxtnThumbnailStorage - void LoadThumbnailDataL(HBufC8*& aData, TGlxImageDataFormat& aFormat, - const TGlxMediaId& aId, const CGlxtnFileInfo& aFileInfo, - const TSize& aSize, TRequestStatus* aStatus); - void SaveThumbnailDataL(const TDesC8& aData, - TGlxImageDataFormat aFormat, const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, const TSize& aSize, - TRequestStatus* aStatus); - void DeleteThumbnailsL(const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, TRequestStatus* aStatus); - void CleanupThumbnailsL(TRequestStatus* aStatus); - void IsThumbnailAvailableL(const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, - const TSize& aSize, TRequestStatus* aStatus); - void StorageCancel(); - void NotifyBackgroundError(const TGlxMediaId& aId, TInt aError); - - private: // New methods - - void SetupL(); - void Teardown(); - - void UT_CGlxtnDeleteThumbnailsTask_ConstructL(); - void UT_CGlxtnDeleteThumbnailsTask_DeleteL(); - - private: // Data - - CGlxtnDeleteThumbnailsTask* iDeleteThumbnailsTask; - TUint iIdDeleted; - TInt iError; - - EUNIT_DECLARE_TEST_TABLE; - }; - -#endif // __UT_CGLXTNDELETETHUMBNAILSTASK_H__ - -// End of file diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/ut_cglxtndeletethumbnailstask/ut_cglxtndeletethumbnailstaskdllmain.cpp --- a/engine/collectionframework/thumbnailcreator/test/ut_cglxtndeletethumbnailstask/ut_cglxtndeletethumbnailstaskdllmain.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2007 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: Delete thumbnails task unit tests. -* -*/ - - - -// CLASS HEADER -#include "ut_cglxtndeletethumbnailstask.h" - -// EXTERNAL INCLUDES -#include - -/** - * Test suite factory function. - */ -EXPORT_C MEUnitTest* CreateTestSuiteL() - { - return UT_CGlxtnDeleteThumbnailsTask::NewL(); - } - -// END OF FILE - - - - - - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/ut_cglxtnfilteravailabletask/ut_cglxtnfilteravailabletask.cpp --- a/engine/collectionframework/thumbnailcreator/test/ut_cglxtnfilteravailabletask/ut_cglxtnfilteravailabletask.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -/* -* Copyright (c) 2006-2006 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: Thumbnail availability filter task unit tests. -* -*/ - - - -// CLASS HEADER -#include "ut_cglxtnfilteravailabletask.h" - -// EXTERNAL INCLUDES -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include "glxtnfilteravailabletask.h" -#include "dummytaskmanager.h" - -const TUint KGlxMediaIdWithThumbnail = 1; -const TUint KGlxMediaIdWithoutThumbnail = 2; -const TInt KTestSizeWidth = 320; -const TInt KTestSizeHeight = 240; - -// --------------------------------------------------------------------------- - -// CONSTRUCTION -UT_CGlxtnFilterAvailableTask* UT_CGlxtnFilterAvailableTask::NewL() - { - UT_CGlxtnFilterAvailableTask* self = UT_CGlxtnFilterAvailableTask::NewLC(); - CleanupStack::Pop(); - - return self; - } - -UT_CGlxtnFilterAvailableTask* UT_CGlxtnFilterAvailableTask::NewLC() - { - UT_CGlxtnFilterAvailableTask* self = new( ELeave ) UT_CGlxtnFilterAvailableTask(); - CleanupStack::PushL( self ); - - self->ConstructL(); - - return self; - } - -// Destructor (virtual by CBase) -UT_CGlxtnFilterAvailableTask::~UT_CGlxtnFilterAvailableTask() - { - } - -// Default constructor -UT_CGlxtnFilterAvailableTask::UT_CGlxtnFilterAvailableTask() - { - } - -// Second phase construct -void UT_CGlxtnFilterAvailableTask::ConstructL() - { - // The ConstructL from the base class CEUnitTestSuiteClass must be called. - // It generates the test case table. - CEUnitTestSuiteClass::ConstructL(); - } - -// METHODS - -void UT_CGlxtnFilterAvailableTask::ThumbnailFetchComplete( - const TGlxMediaId& /*aItemId*/, TGlxThumbnailQuality /*aQuality*/, TInt /*aErrorCode*/) - { - EUNIT_FAIL_TEST("ThumbnailFetchComplete() called"); - } - -void UT_CGlxtnFilterAvailableTask::ThumbnailDeletionComplete( - const TGlxMediaId& /*aItemId*/, TInt /*aErrorCode*/) - { - EUNIT_FAIL_TEST("ThumbnailDeletionComplete() called"); - } - -void UT_CGlxtnFilterAvailableTask::FilterAvailableComplete( - const RArray& aIdArray, TInt aErrorCode ) - { - EUNIT_ASSERT( KErrNotFound == aIdArray.Find( - TGlxMediaId(KGlxMediaIdWithThumbnail)) ); - EUNIT_ASSERT( KErrNotFound != aIdArray.Find( - TGlxMediaId(KGlxMediaIdWithoutThumbnail)) ); - iError = aErrorCode; - } - -void UT_CGlxtnFilterAvailableTask::FetchFileInfoL(CGlxtnFileInfo* /*aInfo*/, - const TGlxMediaId& /*aItemId*/, TRequestStatus* aStatus) - { - *aStatus = KRequestPending; - User::RequestComplete(aStatus, KErrNone); - } - -void UT_CGlxtnFilterAvailableTask::CancelFetchUri(const TGlxMediaId& /*aItemId*/) - { - } - -MGlxtnThumbnailStorage* UT_CGlxtnFilterAvailableTask::ThumbnailStorage() - { - return this; - } - -void UT_CGlxtnFilterAvailableTask::LoadThumbnailDataL(HBufC8*& /*aData*/, TGlxImageDataFormat& /*aFormat*/, - const TGlxMediaId& /*aId*/, const CGlxtnFileInfo& /*aFileInfo*/, - const TSize& /*aSize*/, TRequestStatus* /*aStatus*/) - { - EUNIT_FAIL_TEST("FilterAvailableComplete() called"); - } - -void UT_CGlxtnFilterAvailableTask::SaveThumbnailDataL(const TDesC8& /*aData*/, - TGlxImageDataFormat /*aFormat*/, const TGlxMediaId& /*aId*/, - const CGlxtnFileInfo& /*aFileInfo*/, const TSize& /*aSize*/, - TRequestStatus* /*aStatus*/) - { - EUNIT_FAIL_TEST("FilterAvailableComplete() called"); - } - -void UT_CGlxtnFilterAvailableTask::DeleteThumbnailsL(const TGlxMediaId& /*aId*/, - const CGlxtnFileInfo& /*aFileInfo*/, TRequestStatus* /*aStatus*/) - { - EUNIT_FAIL_TEST("FilterAvailableComplete() called"); - } - -void UT_CGlxtnFilterAvailableTask::CleanupThumbnailsL(TRequestStatus* /*aStatus*/) - { - EUNIT_FAIL_TEST("FilterAvailableComplete() called"); - } - -void UT_CGlxtnFilterAvailableTask::IsThumbnailAvailableL(const TGlxMediaId& aId, - const CGlxtnFileInfo& /*aFileInfo*/, - const TSize& aSize, TRequestStatus* aStatus) - { - TInt result = (KGlxMediaIdWithThumbnail == aId.Value()) - ? KGlxThumbnailAvailable : KGlxThumbnailNotAvailable; - EUNIT_ASSERT_EQUALS( aSize, iSize ); - *aStatus = KRequestPending; - User::RequestComplete(aStatus, result); - } - -void UT_CGlxtnFilterAvailableTask::StorageCancel() - { - } - -void UT_CGlxtnFilterAvailableTask::NotifyBackgroundError( - const TGlxMediaId& /*aId*/, TInt /*aError*/) - { - EUNIT_FAIL_TEST("NotifyBackgroundError() called"); - } - -void UT_CGlxtnFilterAvailableTask::SetupL() - { - iSize.SetSize(KTestSizeWidth, KTestSizeHeight); - - RArray array; - CleanupClosePushL(array); - array.AppendL(TGlxMediaId(KGlxMediaIdWithThumbnail)); - array.AppendL(TGlxMediaId(KGlxMediaIdWithoutThumbnail)); - iFilterAvailableTask = CGlxtnFilterAvailableTask::NewL(array.Array(), - iSize, *this); - CleanupStack::PopAndDestroy(&array); - } - -void UT_CGlxtnFilterAvailableTask::Teardown() - { - delete iFilterAvailableTask; - } - -void UT_CGlxtnFilterAvailableTask::UT_CGlxtnFilterAvailableTask_ConstructL() - { - // Check the task was correctly constructed - EUNIT_ASSERT( NULL != iFilterAvailableTask ); - EUNIT_ASSERT_EQUALS( iFilterAvailableTask->Id().Value(), KGlxtnTaskIdFilterAvailable ); - EUNIT_ASSERT_EQUALS( iFilterAvailableTask->Storage(), this ); - } - -void UT_CGlxtnFilterAvailableTask::UT_CGlxtnFilterAvailableTask_FilterL() - { - CDummyTaskManager* tm = new (ELeave) CDummyTaskManager(iFilterAvailableTask); - CleanupStack::PushL(tm); - tm->StartTaskL(); - User::LeaveIfError(iError); - CleanupStack::PopAndDestroy(tm); - } - -// TEST TABLE - -EUNIT_BEGIN_TEST_TABLE( - UT_CGlxtnFilterAvailableTask, - "Unit tests for CGlxtnFilterAvailableTask.", - "UNIT" ) - -EUNIT_TEST( - "Test construction of CGlxtnFilterAvailableTask", - "CGlxtnFilterAvailableTask", - "NewL", - "FUNCTIONALITY", - SetupL, UT_CGlxtnFilterAvailableTask_ConstructL, Teardown) - -EUNIT_TEST( - "Test filtering of ID array", - "CGlxtnFilterAvailableTask", - "StartL", - "FUNCTIONALITY", - SetupL, UT_CGlxtnFilterAvailableTask_FilterL, Teardown) - -EUNIT_ALLOC_TEST( - "Test alloc failures", - "CGlxtnFilterAvailableTask", - "StartL", - "ERRORHANDLING", - SetupL, UT_CGlxtnFilterAvailableTask_FilterL, Teardown) - -EUNIT_END_TEST_TABLE - -// END OF FILE diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/ut_cglxtnfilteravailabletask/ut_cglxtnfilteravailabletask.h --- a/engine/collectionframework/thumbnailcreator/test/ut_cglxtnfilteravailabletask/ut_cglxtnfilteravailabletask.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2006-2006 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: Thumbnail availability filter task unit tests. -* -*/ - - - -#ifndef __UT_CGLXTNFILTERAVAILABLETASK_H__ -#define __UT_CGLXTNFILTERAVAILABLETASK_H__ - -// EXTERNAL INCLUDES - -#include -#include - -// INTERNAL INCLUDES - -#include "mglxtnstorage.h" -#include "mglxtnthumbnailcreatorclient.h" - -// FORWARD DECLARATIONS - -class CGlxtnFilterAvailableTask; - -#include -#ifndef NONSHARABLE_CLASS - #define NONSHARABLE_CLASS(x) class x -#endif - -// CLASS DEFINITION -/** - * - * EUnitWizard generated test class. - * - */ -NONSHARABLE_CLASS( UT_CGlxtnFilterAvailableTask ) - : public CEUnitTestSuiteClass, public MGlxtnThumbnailCreatorClient, - public MGlxtnThumbnailStorage - { - public: // Constructors and destructors - - /** - * Two phase construction - */ - static UT_CGlxtnFilterAvailableTask* NewL(); - static UT_CGlxtnFilterAvailableTask* NewLC(); - /** - * Destructor - */ - ~UT_CGlxtnFilterAvailableTask(); - - private: // Constructors and destructors - - UT_CGlxtnFilterAvailableTask(); - void ConstructL(); - - private: // From MGlxtnThumbnailCreatorClient - void ThumbnailFetchComplete(const TGlxMediaId& aItemId, - TGlxThumbnailQuality aQuality, TInt aErrorCode); - void ThumbnailDeletionComplete(const TGlxMediaId& aItemId, TInt aErrorCode); - void FilterAvailableComplete( const RArray& aIdArray, - TInt aErrorCode ); - void FetchFileInfoL(CGlxtnFileInfo* aInfo, const TGlxMediaId& aItemId, - TRequestStatus* aStatus); - void CancelFetchUri(const TGlxMediaId& aItemId); - MGlxtnThumbnailStorage* ThumbnailStorage(); - - public: // Functions from MGlxtnThumbnailStorage - void LoadThumbnailDataL(HBufC8*& aData, TGlxImageDataFormat& aFormat, - const TGlxMediaId& aId, const CGlxtnFileInfo& aFileInfo, - const TSize& aSize, TRequestStatus* aStatus); - void SaveThumbnailDataL(const TDesC8& aData, - TGlxImageDataFormat aFormat, const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, const TSize& aSize, - TRequestStatus* aStatus); - void DeleteThumbnailsL(const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, TRequestStatus* aStatus); - void CleanupThumbnailsL(TRequestStatus* aStatus); - void IsThumbnailAvailableL(const TGlxMediaId& aId, - const CGlxtnFileInfo& aFileInfo, - const TSize& aSize, TRequestStatus* aStatus); - void StorageCancel(); - void NotifyBackgroundError(const TGlxMediaId& aId, TInt aError); - - private: // New methods - - void SetupL(); - void Teardown(); - - void UT_CGlxtnFilterAvailableTask_ConstructL(); - void UT_CGlxtnFilterAvailableTask_FilterL(); - - private: // Data - - CGlxtnFilterAvailableTask* iFilterAvailableTask; - TSize iSize; - TInt iError; - - EUNIT_DECLARE_TEST_TABLE; - }; - -#endif // __UT_CGLXTNFILTERAVAILABLETASK_H__ - -// End of file diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/ut_cglxtnfilteravailabletask/ut_cglxtnfilteravailabletaskdllmain.cpp --- a/engine/collectionframework/thumbnailcreator/test/ut_cglxtnfilteravailabletask/ut_cglxtnfilteravailabletaskdllmain.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2006-2006 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: Thumbnail availability filter task unit tests. -* -*/ - - - -// CLASS HEADER -#include "ut_cglxtnfilteravailabletask.h" - -// EXTERNAL INCLUDES -#include - -/** - * Test suite factory function. - */ -EXPORT_C MEUnitTest* CreateTestSuiteL() - { - return UT_CGlxtnFilterAvailableTask::NewL(); - } - -// END OF FILE - - - - - - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/ut_cglxtngeneratethumbnailtask/ut_cglxtngeneratethumbnailtask.cpp --- a/engine/collectionframework/thumbnailcreator/test/ut_cglxtngeneratethumbnailtask/ut_cglxtngeneratethumbnailtask.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,294 +0,0 @@ -/* -* Copyright (c) 2006-2006 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: Thumbnail generation task unit tests. -* -*/ - - - -// CLASS HEADER -#include "UT_CGlxtnGenerateThumbnailTask.h" - -// EXTERNAL INCLUDES -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include "glxtngeneratethumbnailtask.h" -#include "glxtnsavethumbnailtask.h" -#include "dummytaskmanager.h" -#include -#include -#include "glxtnfileutility.h" -#include "glxtnthumbnailrequest.h" - -EUNIT_DECLARE_PRINTABLE_AS_TINT( TGlxThumbnailQuality ) - -const TUint KTestMediaId = 1; -const TInt KTestWidth = 320; -const TInt KTestHeight = 240; -const TDisplayMode KTestThumbDisplayMode = KGlxThumbnailDisplayMode; - -_LIT(KTestImageUri, "C:\\TncTest\\test.jpg"); -_LIT(KTallImageUri, "C:\\TncTest\\tall.jpg"); -_LIT(KWideImageUri, "C:\\TncTest\\wide.jpg"); -_LIT(KCorruptImageUri, "C:\\TncTest\\corrupt.jpg"); -_LIT(KMissingImageUri, "C:\\TncTest\\does_not_exist.jpg"); - -// ----------------------------------------------------------------------------- -// CGlxtnSaveThumbnailTask::NewL -// Dummy implementation. -// ----------------------------------------------------------------------------- -// -EXPORT_C CGlxtnSaveThumbnailTask* CGlxtnSaveThumbnailTask::NewL( - const TGlxMediaId& /*aItemId*/, - CGlxtnFileInfo* /*aFileInfo*/, const TSize& /*aSize*/, - CFbsBitmap* /*aThumbnail*/, MGlxtnThumbnailStorage* /*aStorage*/) - { - User::Leave(KErrNotSupported); - return NULL; - } - -// --------------------------------------------------------------------------- - -// CONSTRUCTION -UT_CGlxtnGenerateThumbnailTask* UT_CGlxtnGenerateThumbnailTask::NewL() - { - UT_CGlxtnGenerateThumbnailTask* self = UT_CGlxtnGenerateThumbnailTask::NewLC(); - CleanupStack::Pop(); - - return self; - } - -UT_CGlxtnGenerateThumbnailTask* UT_CGlxtnGenerateThumbnailTask::NewLC() - { - UT_CGlxtnGenerateThumbnailTask* self = new( ELeave ) UT_CGlxtnGenerateThumbnailTask(); - CleanupStack::PushL( self ); - - self->ConstructL(); - - return self; - } - -// Destructor (virtual by CBase) -UT_CGlxtnGenerateThumbnailTask::~UT_CGlxtnGenerateThumbnailTask() - { - } - -// Default constructor -UT_CGlxtnGenerateThumbnailTask::UT_CGlxtnGenerateThumbnailTask() - { - } - -// Second phase construct -void UT_CGlxtnGenerateThumbnailTask::ConstructL() - { - // The ConstructL from the base class CEUnitTestSuiteClass must be called. - // It generates the test case table. - CEUnitTestSuiteClass::ConstructL(); - - // Need to free ecom resources before running tests - REComSession::FinalClose(); - } - -// METHODS - -void UT_CGlxtnGenerateThumbnailTask::ThumbnailFetchComplete( - const TGlxMediaId& aItemId, TGlxThumbnailQuality aQuality, TInt aErrorCode) - { - EUNIT_ASSERT_EQUALS( KTestMediaId, aItemId.Value() ); - iQuality = aQuality; - iError = aErrorCode; - } - -void UT_CGlxtnGenerateThumbnailTask::ThumbnailDeletionComplete( - const TGlxMediaId& /*aItemId*/, TInt /*aErrorCode*/) - { - EUNIT_FAIL_TEST("ThumbnailDeletionComplete() called"); - } - -void UT_CGlxtnGenerateThumbnailTask::FilterAvailableComplete( - const RArray& /*aIdArray*/, TInt /*aErrorCode*/ ) - { - EUNIT_FAIL_TEST("FilterAvailableComplete() called"); - } - -void UT_CGlxtnGenerateThumbnailTask::FetchFileInfoL(CGlxtnFileInfo* aInfo, - const TGlxMediaId& aItemId, TRequestStatus* aStatus) - { - EUNIT_ASSERT( NULL != aInfo ); - EUNIT_ASSERT_EQUALS( KTestMediaId, aItemId.Value() ); - aInfo->SetFilePathL(iUri); - - *aStatus = KRequestPending; - User::RequestComplete(aStatus, KErrNone); - } - -void UT_CGlxtnGenerateThumbnailTask::CancelFetchUri(const TGlxMediaId& /*aItemId*/) - { - } - -MGlxtnThumbnailStorage* UT_CGlxtnGenerateThumbnailTask::ThumbnailStorage() - { - return NULL; - } - -void UT_CGlxtnGenerateThumbnailTask::SetupL() - { - iFileUtility = CGlxtnFileUtility::NewL(); - User::LeaveIfError(RFbsSession::Connect(iFileUtility->FsSession())); - - TGlxMediaId id(KTestMediaId); - - iSizeClass.SetSize(KTestWidth, KTestHeight); - - iBitmap = new (ELeave) CFbsBitmap; - User::LeaveIfError(iBitmap->Create(TSize(), KTestThumbDisplayMode)); - - TGlxThumbnailRequest request(id, iSizeClass, - TGlxThumbnailRequest::EPrioritizeQuality, - iBitmap->Handle(), ETrue); - iGenerateTask = CGlxtnGenerateThumbnailTask::NewL(request, - *iFileUtility, *this); - } - -void UT_CGlxtnGenerateThumbnailTask::Teardown() - { - delete iGenerateTask; - iGenerateTask = NULL; - delete iBitmap; - iBitmap = NULL; - if ( RFbsSession::GetSession() ) - { - RFbsSession::Disconnect(); - } - delete iFileUtility; - REComSession::FinalClose(); - } - -void UT_CGlxtnGenerateThumbnailTask::UT_CGlxtnGenerateThumbnailTask_ConstructL() - { - // Check the task was correctly constructed - EUNIT_ASSERT( NULL != iGenerateTask ); - EUNIT_ASSERT_EQUALS( iGenerateTask->Id().Value(), KGlxtnTaskIdGenerateThumbnail ); - EUNIT_ASSERT_EQUALS( iGenerateTask->ItemId().Value(), KTestMediaId ); - } - -void UT_CGlxtnGenerateThumbnailTask::UT_CGlxtnGenerateThumbnailTask_GenerateL() - { - DoGenerateL(KTestImageUri); - } - -void UT_CGlxtnGenerateThumbnailTask::UT_CGlxtnGenerateThumbnailTask_GenerateTallL() - { - DoGenerateL(KTallImageUri); - - // Preserving aspect ratio should give TN narrower but same height as size class - EUNIT_ASSERT( iBitmap->SizeInPixels().iWidth < iSizeClass.iWidth ); - EUNIT_ASSERT_EQUALS( iBitmap->SizeInPixels().iHeight, iSizeClass.iHeight ); - } - -void UT_CGlxtnGenerateThumbnailTask::UT_CGlxtnGenerateThumbnailTask_GenerateWideL() - { - DoGenerateL(KWideImageUri); - - // Preserving aspect ratio should give TN less tall but same width as size class - EUNIT_ASSERT_EQUALS( iBitmap->SizeInPixels().iWidth, iSizeClass.iWidth ); - EUNIT_ASSERT( iBitmap->SizeInPixels().iHeight < iSizeClass.iHeight ); - } - -void UT_CGlxtnGenerateThumbnailTask::UT_CGlxtnGenerateThumbnailTask_ErrorCorruptFileL() - { - EUNIT_ASSERT_LEAVE(DoGenerateL(KCorruptImageUri)); - } - -void UT_CGlxtnGenerateThumbnailTask::UT_CGlxtnGenerateThumbnailTask_ErrorFileNotFoundL() - { - EUNIT_ASSERT_SPECIFIC_LEAVE(DoGenerateL(KMissingImageUri), KErrNotFound); - } - -void UT_CGlxtnGenerateThumbnailTask::DoGenerateL(const TDesC& aUri) - { - iUri.Set(aUri); - - CDummyTaskManager* tm = new (ELeave) CDummyTaskManager(iGenerateTask); - CleanupStack::PushL(tm); - tm->StartTaskL(); - User::LeaveIfError(iError); - CleanupStack::PopAndDestroy(tm); - - EUNIT_ASSERT_EQUALS( iQuality, EGlxThumbnailQualityHigh ); - } - -// TEST TABLE - -EUNIT_BEGIN_TEST_TABLE( - UT_CGlxtnGenerateThumbnailTask, - "Unit tests for CGlxtnGenerateThumbnailTask.", - "UNIT" ) - -EUNIT_TEST( - "Test construction of CGlxtnGenerateThumbnailTask", - "CGlxtnGenerateThumbnailTask", - "NewL", - "FUNCTIONALITY", - SetupL, UT_CGlxtnGenerateThumbnailTask_ConstructL, Teardown) - -EUNIT_TEST( - "Generate a thumbnail", - "CGlxtnGenerateThumbnailTask", - "HandleThumbnailTaskCompleteL", - "FUNCTIONALITY", - SetupL, UT_CGlxtnGenerateThumbnailTask_GenerateL, Teardown) - -EUNIT_TEST( - "Generate thumbnail of a tall image", - "CGlxtnGenerateThumbnailTask", - "HandleThumbnailTaskCompleteL", - "FUNCTIONALITY", - SetupL, UT_CGlxtnGenerateThumbnailTask_GenerateTallL, Teardown) - -EUNIT_TEST( - "Generate thumbnail of a wide image", - "CGlxtnGenerateThumbnailTask", - "HandleThumbnailTaskCompleteL", - "FUNCTIONALITY", - SetupL, UT_CGlxtnGenerateThumbnailTask_GenerateWideL, Teardown) - -EUNIT_TEST( - "Attempting to thumbnail corrupt image", - "CGlxtnGenerateThumbnailTask", - "DoStartL", - "ERRORHANDLING", - SetupL, UT_CGlxtnGenerateThumbnailTask_ErrorCorruptFileL, Teardown) - -EUNIT_TEST( - "Attempting to thumbnail missing file", - "CGlxtnGenerateThumbnailTask", - "DoStartL", - "ERRORHANDLING", - SetupL, UT_CGlxtnGenerateThumbnailTask_ErrorFileNotFoundL, Teardown) - -EUNIT_ALLOC_TEST( - "Test alloc failures", - "CGlxtnGenerateThumbnailTask", - "HandleThumbnailTaskCompleteL", - "ERRORHANDLING", - SetupL, UT_CGlxtnGenerateThumbnailTask_GenerateL, Teardown) - -EUNIT_END_TEST_TABLE - -// END OF FILE diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/ut_cglxtngeneratethumbnailtask/ut_cglxtngeneratethumbnailtask.h --- a/engine/collectionframework/thumbnailcreator/test/ut_cglxtngeneratethumbnailtask/ut_cglxtngeneratethumbnailtask.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* -* Copyright (c) 2006-2006 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: Thumbnail generation task unit tests. -* -*/ - - - -#ifndef __UT_CGLXTNGENERATETHUMBNAILTASK_H__ -#define __UT_CGLXTNGENERATETHUMBNAILTASK_H__ - -// EXTERNAL INCLUDES - -#include -#include - -// INTERNAL INCLUDES - -#include "mglxtnthumbnailcreatorclient.h" - -// FORWARD DECLARATIONS - -class CGlxtnFileUtility; -class CGlxtnGenerateThumbnailTask; -class CFbsBitmap; - -#include -#ifndef NONSHARABLE_CLASS - #define NONSHARABLE_CLASS(x) class x -#endif - -// CLASS DEFINITION -/** - * - * EUnitWizard generated test class. - * - */ -NONSHARABLE_CLASS( UT_CGlxtnGenerateThumbnailTask ) - : public CEUnitTestSuiteClass, public MGlxtnThumbnailCreatorClient - { - public: // Constructors and destructors - - /** - * Two phase construction - */ - static UT_CGlxtnGenerateThumbnailTask* NewL(); - static UT_CGlxtnGenerateThumbnailTask* NewLC(); - /** - * Destructor - */ - ~UT_CGlxtnGenerateThumbnailTask(); - - private: // Constructors and destructors - - UT_CGlxtnGenerateThumbnailTask(); - void ConstructL(); - - private: // From MGlxtnThumbnailCreatorClient - void ThumbnailFetchComplete(const TGlxMediaId& aItemId, - TGlxThumbnailQuality aQuality, TInt aErrorCode); - void ThumbnailDeletionComplete(const TGlxMediaId& aItemId, TInt aErrorCode); - void FilterAvailableComplete( const RArray& aIdArray, - TInt aErrorCode ); - void FetchFileInfoL(CGlxtnFileInfo* aInfo, const TGlxMediaId& aItemId, - TRequestStatus* aStatus); - void CancelFetchUri(const TGlxMediaId& aItemId); - MGlxtnThumbnailStorage* ThumbnailStorage(); - - private: // New methods - - void SetupL(); - - void Teardown(); - - void UT_CGlxtnGenerateThumbnailTask_ConstructL(); - void UT_CGlxtnGenerateThumbnailTask_GenerateL(); - void UT_CGlxtnGenerateThumbnailTask_GenerateTallL(); - void UT_CGlxtnGenerateThumbnailTask_GenerateWideL(); - void UT_CGlxtnGenerateThumbnailTask_ErrorCorruptFileL(); - void UT_CGlxtnGenerateThumbnailTask_ErrorFileNotFoundL(); - - void DoGenerateL(const TDesC& aUri); - - private: // Data - - CGlxtnFileUtility* iFileUtility; - CGlxtnGenerateThumbnailTask* iGenerateTask; - CFbsBitmap* iBitmap; - TPtrC iUri; - TSize iSizeClass; - TGlxThumbnailQuality iQuality; - TInt iError; - - EUNIT_DECLARE_TEST_TABLE; - - }; - -#endif // __UT_CGLXTNGENERATETHUMBNAILTASK_H__ - -// End of file diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/ut_cglxtngeneratethumbnailtask/ut_cglxtngeneratethumbnailtaskdllmain.cpp --- a/engine/collectionframework/thumbnailcreator/test/ut_cglxtngeneratethumbnailtask/ut_cglxtngeneratethumbnailtaskdllmain.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2006-2006 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: Thumbnail generation task unit tests. -* -*/ - - - -// CLASS HEADER -#include "UT_CGlxtnGenerateThumbnailTask.h" - -// EXTERNAL INCLUDES -#include - -/** - * Test suite factory function. - */ -EXPORT_C MEUnitTest* CreateTestSuiteL() - { - return UT_CGlxtnGenerateThumbnailTask::NewL(); - } - -// END OF FILE - - - - - - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/ut_cglxtnquickthumbnailtask/ut_cglxtnquickthumbnailtask.cpp --- a/engine/collectionframework/thumbnailcreator/test/ut_cglxtnquickthumbnailtask/ut_cglxtnquickthumbnailtask.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,253 +0,0 @@ -/* -* Copyright (c) 2006-2006 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: Quick thumbnail generation task unit tests. -* -*/ - - - -// CLASS HEADER -#include "UT_CGlxtnQuickThumbnailTask.h" - -// EXTERNAL INCLUDES -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include "glxtnquickthumbnailtask.h" -#include "dummytaskmanager.h" -#include -#include "glxtnfileutility.h" -#include "glxtnthumbnailrequest.h" -#include - -const TUint KTestMediaId = 1; -const TInt KTestWidth = 320; -const TInt KTestHeight = 240; -const TDisplayMode KTestThumbDisplayMode = KGlxThumbnailCreationMode; - -_LIT(KTestImageUri, "C:\\TncTest\\tall.jpg"); -_LIT(KNoExifImageUri, "C:\\TncTest\\no_exif.jpg"); -_LIT(KCorruptImageUri, "C:\\TncTest\\corrupt.jpg"); -_LIT(KMissingImageUri, "C:\\TncTest\\does_not_exist.jpg"); - -// CONSTRUCTION -UT_CGlxtnQuickThumbnailTask* UT_CGlxtnQuickThumbnailTask::NewL() - { - UT_CGlxtnQuickThumbnailTask* self = UT_CGlxtnQuickThumbnailTask::NewLC(); - CleanupStack::Pop(); - - return self; - } - -UT_CGlxtnQuickThumbnailTask* UT_CGlxtnQuickThumbnailTask::NewLC() - { - UT_CGlxtnQuickThumbnailTask* self = new( ELeave ) UT_CGlxtnQuickThumbnailTask(); - CleanupStack::PushL( self ); - - self->ConstructL(); - - return self; - } - -// Destructor (virtual by CBase) -UT_CGlxtnQuickThumbnailTask::~UT_CGlxtnQuickThumbnailTask() - { - } - -// Default constructor -UT_CGlxtnQuickThumbnailTask::UT_CGlxtnQuickThumbnailTask() - { - } - -// Second phase construct -void UT_CGlxtnQuickThumbnailTask::ConstructL() - { - // The ConstructL from the base class CEUnitTestSuiteClass must be called. - // It generates the test case table. - CEUnitTestSuiteClass::ConstructL(); - - // Need to free ecom resources before running tests - REComSession::FinalClose(); - } - -// METHODS - -void UT_CGlxtnQuickThumbnailTask::ThumbnailFetchComplete( - const TGlxMediaId& aItemId, TGlxThumbnailQuality aQuality, TInt aErrorCode) - { - EUNIT_ASSERT_EQUALS( KTestMediaId, aItemId.Value() ); - iQuality = aQuality; - iError = aErrorCode; - } - -void UT_CGlxtnQuickThumbnailTask::ThumbnailDeletionComplete( - const TGlxMediaId& /*aItemId*/, TInt /*aErrorCode*/) - { - EUNIT_FAIL_TEST("ThumbnailDeletionComplete() called"); - } - -void UT_CGlxtnQuickThumbnailTask::FilterAvailableComplete( - const RArray& /*aIdArray*/, TInt /*aErrorCode*/ ) - { - EUNIT_FAIL_TEST("FilterAvailableComplete() called"); - } - -void UT_CGlxtnQuickThumbnailTask::FetchFileInfoL(CGlxtnFileInfo* aInfo, - const TGlxMediaId& aItemId, TRequestStatus* aStatus) - { - EUNIT_ASSERT( NULL != aInfo ); - EUNIT_ASSERT_EQUALS( KTestMediaId, aItemId.Value() ); - aInfo->SetFilePathL(iUri); - - *aStatus = KRequestPending; - User::RequestComplete(aStatus, KErrNone); - } - -void UT_CGlxtnQuickThumbnailTask::CancelFetchUri(const TGlxMediaId& /*aItemId*/) - { - } - -MGlxtnThumbnailStorage* UT_CGlxtnQuickThumbnailTask::ThumbnailStorage() - { - return NULL; - } - -void UT_CGlxtnQuickThumbnailTask::SetupL() - { - iFileUtility = CGlxtnFileUtility::NewL(); - User::LeaveIfError(RFbsSession::Connect(iFileUtility->FsSession())); - - TGlxMediaId id(KTestMediaId); - - iSizeClass.SetSize(KTestWidth, KTestHeight); - iBitmap = new (ELeave) CFbsBitmap; - User::LeaveIfError(iBitmap->Create(TSize(), KTestThumbDisplayMode)); - - TGlxThumbnailRequest request(id, iSizeClass, - TGlxThumbnailRequest::EPrioritizeSpeed, - iBitmap->Handle(), ETrue); - iQuickThumbnailTask = CGlxtnQuickThumbnailTask::NewL(request, - *iFileUtility, *this); - } - -void UT_CGlxtnQuickThumbnailTask::Teardown() - { - delete iQuickThumbnailTask; - iQuickThumbnailTask = NULL; - delete iBitmap; - iBitmap = NULL; - if ( RFbsSession::GetSession() ) - { - RFbsSession::Disconnect(); - } - delete iFileUtility; - REComSession::FinalClose(); - } - -void UT_CGlxtnQuickThumbnailTask::UT_CGlxtnQuickThumbnailTask_ConstructL() - { - // Check the task was correctly constructed - EUNIT_ASSERT( NULL != iQuickThumbnailTask ); - EUNIT_ASSERT_EQUALS( iQuickThumbnailTask->Id().Value(), KGlxtnTaskIdQuickThumbnail ); - EUNIT_ASSERT_EQUALS( iQuickThumbnailTask->ItemId().Value(), KTestMediaId ); - } - -void UT_CGlxtnQuickThumbnailTask::UT_CGlxtnQuickThumbnailTask_GenerateL() - { - DoGenerateL(KTestImageUri); - } - -void UT_CGlxtnQuickThumbnailTask::UT_CGlxtnQuickThumbnailTask_GenerateNoExifL() - { - DoGenerateL(KNoExifImageUri); - } - -void UT_CGlxtnQuickThumbnailTask::UT_CGlxtnQuickThumbnailTask_ErrorCorruptFileL() - { - EUNIT_ASSERT_LEAVE(DoGenerateL(KCorruptImageUri)); - } - -void UT_CGlxtnQuickThumbnailTask::UT_CGlxtnQuickThumbnailTask_ErrorFileNotFoundL() - { - EUNIT_ASSERT_SPECIFIC_LEAVE(DoGenerateL(KMissingImageUri), KErrNotFound); - } - -void UT_CGlxtnQuickThumbnailTask::DoGenerateL(const TDesC& aUri) - { - iUri.Set(aUri); - - CDummyTaskManager* tm = new (ELeave) CDummyTaskManager(iQuickThumbnailTask); - CleanupStack::PushL(tm); - tm->StartTaskL(); - User::LeaveIfError(iError); - CleanupStack::PopAndDestroy(tm); - - EUNIT_ASSERT_EQUALS( iQuality, EGlxThumbnailQualityLow ); - } - -// TEST TABLE - -EUNIT_BEGIN_TEST_TABLE( - UT_CGlxtnQuickThumbnailTask, - "Add test suite description here.", - "UNIT" ) - -EUNIT_TEST( - "NewL - test ", - "CGlxtnQuickThumbnailTask", - "NewL", - "FUNCTIONALITY", - SetupL, UT_CGlxtnQuickThumbnailTask_ConstructL, Teardown) - -EUNIT_TEST( - "Generate a thumbnail", - "CGlxtnQuickThumbnailTask", - "HandleThumbnailTaskCompleteL", - "FUNCTIONALITY", - SetupL, UT_CGlxtnQuickThumbnailTask_GenerateL, Teardown) - -EUNIT_TEST( - "Generate a thumbnail from image without EXIF data", - "CGlxtnQuickThumbnailTask", - "HandleThumbnailTaskCompleteL", - "FUNCTIONALITY", - SetupL, UT_CGlxtnQuickThumbnailTask_GenerateNoExifL, Teardown) - -EUNIT_TEST( - "Attempting to thumbnail corrupt image", - "CGlxtnQuickThumbnailTask", - "DoStartL", - "ERRORHANDLING", - SetupL, UT_CGlxtnQuickThumbnailTask_ErrorCorruptFileL, Teardown) - -EUNIT_TEST( - "Attempting to thumbnail missing file", - "CGlxtnQuickThumbnailTask", - "DoStartL", - "ERRORHANDLING", - SetupL, UT_CGlxtnQuickThumbnailTask_ErrorFileNotFoundL, Teardown) - -EUNIT_ALLOC_TEST( - "Test alloc failures", - "CGlxtnQuickThumbnailTask", - "HandleThumbnailTaskCompleteL", - "ERRORHANDLING", - SetupL, UT_CGlxtnQuickThumbnailTask_GenerateL, Teardown) - -EUNIT_END_TEST_TABLE - -// END OF FILE diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/ut_cglxtnquickthumbnailtask/ut_cglxtnquickthumbnailtask.h --- a/engine/collectionframework/thumbnailcreator/test/ut_cglxtnquickthumbnailtask/ut_cglxtnquickthumbnailtask.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* -* Copyright (c) 2006-2006 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: Quick thumbnail generation task unit tests. -* -*/ - - - -#ifndef __UT_CGLXTNQUICKTHUMBNAILTASK_H__ -#define __UT_CGLXTNQUICKTHUMBNAILTASK_H__ - -// EXTERNAL INCLUDES - -#include -#include - -// INTERNAL INCLUDES - -#include "mglxtnthumbnailcreatorclient.h" - -// FORWARD DECLARATIONS - -class CGlxtnFileUtility; -class CGlxtnQuickThumbnailTask; -class CFbsBitmap; - -#include -#ifndef NONSHARABLE_CLASS - #define NONSHARABLE_CLASS(x) class x -#endif - -// CLASS DEFINITION -/** - * - * EUnitWizard generated test class. - * - */ -NONSHARABLE_CLASS( UT_CGlxtnQuickThumbnailTask ) - : public CEUnitTestSuiteClass, public MGlxtnThumbnailCreatorClient - { - public: // Constructors and destructors - - /** - * Two phase construction - */ - static UT_CGlxtnQuickThumbnailTask* NewL(); - static UT_CGlxtnQuickThumbnailTask* NewLC(); - /** - * Destructor - */ - ~UT_CGlxtnQuickThumbnailTask(); - - private: // Constructors and destructors - - UT_CGlxtnQuickThumbnailTask(); - void ConstructL(); - - private: // From MGlxtnThumbnailCreatorClient - void ThumbnailFetchComplete(const TGlxMediaId& aItemId, - TGlxThumbnailQuality aQuality, TInt aErrorCode); - void ThumbnailDeletionComplete(const TGlxMediaId& aItemId, TInt aErrorCode); - void FilterAvailableComplete( const RArray& aIdArray, - TInt aErrorCode ); - void FetchFileInfoL(CGlxtnFileInfo* aInfo, const TGlxMediaId& aItemId, - TRequestStatus* aStatus); - void CancelFetchUri(const TGlxMediaId& aItemId); - MGlxtnThumbnailStorage* ThumbnailStorage(); - - private: // New methods - - void SetupL(); - - void Teardown(); - - void UT_CGlxtnQuickThumbnailTask_ConstructL(); - void UT_CGlxtnQuickThumbnailTask_GenerateL(); - void UT_CGlxtnQuickThumbnailTask_GenerateNoExifL(); - void UT_CGlxtnQuickThumbnailTask_ErrorCorruptFileL(); - void UT_CGlxtnQuickThumbnailTask_ErrorFileNotFoundL(); - - void DoGenerateL(const TDesC& aUri); - - private: // Data - - CGlxtnFileUtility* iFileUtility; - CGlxtnQuickThumbnailTask* iQuickThumbnailTask; - CFbsBitmap* iBitmap; - TPtrC iUri; - TSize iSizeClass; - TGlxThumbnailQuality iQuality; - TInt iError; - - EUNIT_DECLARE_TEST_TABLE; - - }; - -#endif // __UT_CGLXTNQUICKTHUMBNAILTASK_H__ - -// End of file diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/ut_cglxtnquickthumbnailtask/ut_cglxtnquickthumbnailtaskdllmain.cpp --- a/engine/collectionframework/thumbnailcreator/test/ut_cglxtnquickthumbnailtask/ut_cglxtnquickthumbnailtaskdllmain.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2006-2006 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: Quick thumbnail generation task unit tests. -* -*/ - - - -// CLASS HEADER -#include "UT_CGlxtnQuickThumbnailTask.h" - -// EXTERNAL INCLUDES -#include - -/** - * Test suite factory function. - */ -EXPORT_C MEUnitTest* CreateTestSuiteL() - { - return UT_CGlxtnQuickThumbnailTask::NewL(); - } - -// END OF FILE - - - - - - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/ut_cglxtnzoomedimagetask/ut_cglxtnzoomedimagetask.cpp --- a/engine/collectionframework/thumbnailcreator/test/ut_cglxtnzoomedimagetask/ut_cglxtnzoomedimagetask.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,215 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Cropped thumbnail generation task unit tests. -* -*/ - - - -// CLASS HEADER -#include "ut_cglxtnzoomedimagetask.h" - -// EXTERNAL INCLUDES -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include "glxtngeneratethumbnailtask.h" -#include "dummytaskmanager.h" -#include -#include "glxtnfileutility.h" -#include "glxtnthumbnailrequest.h" -#include "glxtnzoomedimagetask.h" -#include - -EUNIT_DECLARE_PRINTABLE_AS_TINT( TGlxThumbnailQuality ) - -const TUint KTestMediaId = 1; -const TInt KTestWidth = 320; -const TInt KTestHeight = 240; -const TDisplayMode KTestThumbDisplayMode = KGlxThumbnailDisplayMode; - -_LIT(KTestImageUri, "C:\\TncTest\\test.jpg"); - -// --------------------------------------------------------------------------- - -// CONSTRUCTION -UT_CGlxtnZoomedImageTask* UT_CGlxtnZoomedImageTask::NewL() - { - UT_CGlxtnZoomedImageTask* self = UT_CGlxtnZoomedImageTask::NewLC(); - CleanupStack::Pop(); - - return self; - } - -UT_CGlxtnZoomedImageTask* UT_CGlxtnZoomedImageTask::NewLC() - { - UT_CGlxtnZoomedImageTask* self = new( ELeave ) UT_CGlxtnZoomedImageTask(); - CleanupStack::PushL( self ); - - self->ConstructL(); - - return self; - } - -// Destructor (virtual by CBase) -UT_CGlxtnZoomedImageTask::~UT_CGlxtnZoomedImageTask() - { - } - -// Default constructor -UT_CGlxtnZoomedImageTask::UT_CGlxtnZoomedImageTask() - { - } - -// Second phase construct -void UT_CGlxtnZoomedImageTask::ConstructL() - { - // The ConstructL from the base class CEUnitTestSuiteClass must be called. - // It generates the test case table. - CEUnitTestSuiteClass::ConstructL(); - - // Need to free ecom resources before running tests - REComSession::FinalClose(); - } - -// METHODS - -void UT_CGlxtnZoomedImageTask::ThumbnailFetchComplete( - const TGlxMediaId& aItemId, TGlxThumbnailQuality aQuality, TInt aErrorCode) - { - EUNIT_ASSERT_EQUALS( KTestMediaId, aItemId.Value() ); - iQuality = aQuality; - iError = aErrorCode; - } - -void UT_CGlxtnZoomedImageTask::ThumbnailDeletionComplete( - const TGlxMediaId& /*aItemId*/, TInt /*aErrorCode*/) - { - EUNIT_FAIL_TEST("ThumbnailDeletionComplete() called"); - } - -void UT_CGlxtnZoomedImageTask::FilterAvailableComplete( - const RArray& /*aIdArray*/, TInt /*aErrorCode*/ ) - { - EUNIT_FAIL_TEST("FilterAvailableComplete() called"); - } - -void UT_CGlxtnZoomedImageTask::FetchFileInfoL(CGlxtnFileInfo* aInfo, - const TGlxMediaId& aItemId, TRequestStatus* aStatus) - { - EUNIT_ASSERT( NULL != aInfo ); - EUNIT_ASSERT_EQUALS( KTestMediaId, aItemId.Value() ); - aInfo->SetFilePathL(iUri); - - *aStatus = KRequestPending; - User::RequestComplete(aStatus, KErrNone); - } - -void UT_CGlxtnZoomedImageTask::CancelFetchUri(const TGlxMediaId& /*aItemId*/) - { - } - -MGlxtnThumbnailStorage* UT_CGlxtnZoomedImageTask::ThumbnailStorage() - { - return NULL; - } - -void UT_CGlxtnZoomedImageTask::SetupL() - { - iFileUtility = CGlxtnFileUtility::NewL(); - User::LeaveIfError(RFbsSession::Connect(iFileUtility->FsSession())); - - TGlxMediaId id(KTestMediaId); - TSize size(KTestWidth, KTestHeight); - TRect croppingRect(50, 50, 150, 150); - - iBitmap = new (ELeave) CFbsBitmap; - User::LeaveIfError(iBitmap->Create(TSize(), KTestThumbDisplayMode)); - - TGlxThumbnailRequest request(id, size, - TGlxThumbnailRequest::EPrioritizeQuality, iBitmap->Handle(), - ETrue, croppingRect, EGlxThumbnailFilterNone); - iZoomedImageTask = CGlxtnZoomedImageTask::NewL(request, - *iFileUtility, *this); - } - -void UT_CGlxtnZoomedImageTask::Teardown() - { - delete iZoomedImageTask; - iZoomedImageTask = NULL; - delete iBitmap; - iBitmap = NULL; - if ( RFbsSession::GetSession() ) - { - RFbsSession::Disconnect(); - } - delete iFileUtility; - REComSession::FinalClose(); - } - -void UT_CGlxtnZoomedImageTask::UT_CGlxtnZoomedImageTask_ConstructL() - { - // Check the task was correctly constructed - EUNIT_ASSERT( NULL != iZoomedImageTask ); - EUNIT_ASSERT_EQUALS( iZoomedImageTask->Id().Value(), KGlxtnTaskIdZoomedThumbnail ); - EUNIT_ASSERT_EQUALS( iZoomedImageTask->ItemId().Value(), KTestMediaId ); - } - -void UT_CGlxtnZoomedImageTask::UT_CGlxtnZoomedImageTask_GenerateL() - { - // NOTE: This test currently fails on the emulator, as the extended JPEG - // codec is not present in the environment - DoGenerateL(KTestImageUri); - } - -void UT_CGlxtnZoomedImageTask::DoGenerateL(const TDesC& aUri) - { - iUri.Set(aUri); - - CDummyTaskManager* tm = new (ELeave) CDummyTaskManager(iZoomedImageTask); - CleanupStack::PushL(tm); - tm->StartTaskL(); - User::LeaveIfError(iError); - CleanupStack::PopAndDestroy(tm); - - EUNIT_ASSERT_EQUALS( iQuality, EGlxThumbnailQualityHigh ); - } - -// TEST TABLE - -EUNIT_BEGIN_TEST_TABLE( - UT_CGlxtnZoomedImageTask, - "Unit tests for CGlxtnZoomedImageTask.", - "UNIT" ) - -EUNIT_TEST( - "Test construction of CGlxtnZoomedImageTask", - "CGlxtnZoomedImageTask", - "NewL", - "FUNCTIONALITY", - SetupL, UT_CGlxtnZoomedImageTask_ConstructL, Teardown) - -EUNIT_TEST( - "Generate a cropped thumbnail", - "CGlxtnZoomedImageTask", - "HandleThumbnailTaskCompleteL", - "FUNCTIONALITY", - SetupL, UT_CGlxtnZoomedImageTask_GenerateL, Teardown) - -EUNIT_END_TEST_TABLE - -// END OF FILE diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/ut_cglxtnzoomedimagetask/ut_cglxtnzoomedimagetask.h --- a/engine/collectionframework/thumbnailcreator/test/ut_cglxtnzoomedimagetask/ut_cglxtnzoomedimagetask.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Cropped thumbnail generation task unit tests. -* -*/ - - - -#ifndef __UT_CGLXTNZOOMEDIMAGETASK_H__ -#define __UT_CGLXTNZOOMEDIMAGETASK_H__ - -// EXTERNAL INCLUDES - -#include -#include - -// INTERNAL INCLUDES - -#include "mglxtnthumbnailcreatorclient.h" - -// FORWARD DECLARATIONS - -class CGlxtnFileUtility; -class CGlxtnZoomedImageTask; -class CFbsBitmap; - -#include -#ifndef NONSHARABLE_CLASS - #define NONSHARABLE_CLASS(x) class x -#endif - -// CLASS DEFINITION -/** - * - * EUnitWizard generated test class. - * - */ -NONSHARABLE_CLASS( UT_CGlxtnZoomedImageTask ) - : public CEUnitTestSuiteClass, public MGlxtnThumbnailCreatorClient - { - public: // Constructors and destructors - - /** - * Two phase construction - */ - static UT_CGlxtnZoomedImageTask* NewL(); - static UT_CGlxtnZoomedImageTask* NewLC(); - /** - * Destructor - */ - ~UT_CGlxtnZoomedImageTask(); - - private: // Constructors and destructors - - UT_CGlxtnZoomedImageTask(); - void ConstructL(); - - private: // From MGlxtnThumbnailCreatorClient - void ThumbnailFetchComplete(const TGlxMediaId& aItemId, - TGlxThumbnailQuality aQuality, TInt aErrorCode); - void ThumbnailDeletionComplete(const TGlxMediaId& aItemId, TInt aErrorCode); - void FilterAvailableComplete( const RArray& aIdArray, - TInt aErrorCode ); - void FetchFileInfoL(CGlxtnFileInfo* aInfo, const TGlxMediaId& aItemId, - TRequestStatus* aStatus); - void CancelFetchUri(const TGlxMediaId& aItemId); - MGlxtnThumbnailStorage* ThumbnailStorage(); - - private: // New methods - - void SetupL(); - void Teardown(); - - void UT_CGlxtnZoomedImageTask_ConstructL(); - void UT_CGlxtnZoomedImageTask_GenerateL(); - - void DoGenerateL(const TDesC& aUri); - - private: // Data - - CGlxtnFileUtility* iFileUtility; - CGlxtnZoomedImageTask* iZoomedImageTask; - CFbsBitmap* iBitmap; - TPtrC iUri; - TGlxThumbnailQuality iQuality; - TInt iError; - - EUNIT_DECLARE_TEST_TABLE; - - }; - -#endif // __UT_CGLXTNZOOMEDIMAGETASK_H__ - -// End of file diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/test/ut_cglxtnzoomedimagetask/ut_cglxtnzoomedimagetaskdllmain.cpp --- a/engine/collectionframework/thumbnailcreator/test/ut_cglxtnzoomedimagetask/ut_cglxtnzoomedimagetaskdllmain.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Cropped thumbnail generation task unit tests. -* -*/ - - - -// CLASS HEADER -#include "ut_cglxtnzoomedimagetask.h" - -// EXTERNAL INCLUDES -#include - -/** - * Test suite factory function. - */ -EXPORT_C MEUnitTest* CreateTestSuiteL() - { - return UT_CGlxtnZoomedImageTask::NewL(); - } - -// END OF FILE diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/thumbnailcomposerplugin/200071D4.rss --- a/engine/collectionframework/thumbnailcreator/thumbnailcomposerplugin/200071D4.rss Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2006-2007 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: Resource definitions -* -*/ - - - -/** - * @internal reviewed 12/07/2007 by Simon Brooks - */ - -#include -#include "glxthumbnailcomposerplugin.hrh" - -/** - * @author David Holland - */ -RESOURCE REGISTRY_INFO theInfo - { - // UID for the DLL - dll_uid = 0x200071D4; - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = 0x2000717E; - implementations = - { - // Info for CGlxThumbnailComposerPlugin - IMPLEMENTATION_INFO - { - implementation_uid = KGlxThumbnailComposerImplementationId; - version_no = 1; - display_name = "Thumbnail Composer plugin"; - default_data = "ThumbnailComposer"; - // We for now use just extension - now way to convert MIME-type to file extensio -// opaque_data = "jpg,3gp"; - opaque_data = "jpg"; - } - }; - } - }; - } - diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.cpp --- a/engine/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,630 +0,0 @@ -/* -* 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: Thumbnail Composer plugin -* -*/ - - - -/** - * @internal reviewed 12/07/2007 by Simon Brooks - */ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "glxthumbnailcomposerplugin.h" - -// This can be any number other than zero -const TUint KGlxBackgroundThumbnailAttributeId = 1; -const TInt KGlxThumbnailComposerInactivityTimeout = 30; // seconds -const TInt KGlxThumbnailComposerDelay = 10000; // microseconds -const TInt KGlxThumbnailComposerHarvestDelay = 5000000; // microseconds -const TInt KGlxThumbnailComposerLargeDelay = 30000000; // microseconds - -// --------------------------------------------------------------------------- -// destructor -// --------------------------------------------------------------------------- -// -CGlxThumbnailCompeserInactivityTimer::~CGlxThumbnailCompeserInactivityTimer() - { - // no implementation - } - - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -CGlxThumbnailCompeserInactivityTimer* CGlxThumbnailCompeserInactivityTimer::NewL(TInt aPriority, CGlxThumbnailComposerPlugin& aCallback) - { - TRACER("CGlxThumbnailCompeserInactivityTimer::NewL"); - CGlxThumbnailCompeserInactivityTimer* self = - new (ELeave) CGlxThumbnailCompeserInactivityTimer(aPriority, aCallback); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - CActiveScheduler::Add(self); - return self; - } - -// --------------------------------------------------------------------------- -// After -// --------------------------------------------------------------------------- -// -void CGlxThumbnailCompeserInactivityTimer::After( TTimeIntervalMicroSeconds32 aInterval ) - { - TRACER("CGlxThumbnailCompeserInactivityTimer::RunL"); - - // Fix for ELLZ-7DBBDZ and JPKN-7M2AYJ: to prevent a KERN EXEC 15 panic that occurs - // if a timer request is made while one is already outstanding. - Cancel(); - // Forward the call on to the base class. - CTimer::After( aInterval ); - } - -// --------------------------------------------------------------------------- -// constructor -// --------------------------------------------------------------------------- -// -CGlxThumbnailCompeserInactivityTimer::CGlxThumbnailCompeserInactivityTimer(TInt aPriority, CGlxThumbnailComposerPlugin& aCallback) - : CTimer(aPriority), iCallback(aCallback) - { - // no implementation - } - -// --------------------------------------------------------------------------- -// RunL -// --------------------------------------------------------------------------- -// -void CGlxThumbnailCompeserInactivityTimer::RunL() - { - TRACER("CGlxThumbnailCompeserInactivityTimer::RunL"); - switch (iCallback.iState) - { - case CGlxThumbnailComposerPlugin::EStateFirstOpening: - case CGlxThumbnailComposerPlugin::EStateOpening: - { - iCallback.DoOpenCollectionL(); - break; - } - case CGlxThumbnailComposerPlugin::EStateActiveSmall: - case CGlxThumbnailComposerPlugin::EStateActiveLarge: - { - iCallback.DoRequestItemL(); - break; - } - case CGlxThumbnailComposerPlugin::EStateClosing: - { - iCallback.CloseCollection(); - break; - } - } - } - -// --------------------------------------------------------------------------- -// DoCancel -// --------------------------------------------------------------------------- -// -void CGlxThumbnailCompeserInactivityTimer::DoCancel() - { - // no implementation - } - -// --------------------------------------------------------------------------- -// RunError -// --------------------------------------------------------------------------- -// -TInt CGlxThumbnailCompeserInactivityTimer::RunError(TInt /*aError*/) - { - TRACER("CGlxThumbnailCompeserInactivityTimer::RunError"); - iCallback.ReturnToIdle(); - return KErrNone; - } - - - -// --------------------------------------------------------------------------- -// NewL -// --------------------------------------------------------------------------- -// -CGlxThumbnailComposerPlugin* CGlxThumbnailComposerPlugin::NewL() - { - TRACER("CGlxThumbnailComposerPlugin::NewL"); - CGlxThumbnailComposerPlugin* self = - new (ELeave) CGlxThumbnailComposerPlugin(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// --------------------------------------------------------------------------- -// ~CGlxThumbnailComposerPlugin -// --------------------------------------------------------------------------- -// -CGlxThumbnailComposerPlugin::~CGlxThumbnailComposerPlugin() - { - delete iPath; - delete iCollectionUtility; - if ( iInactivityTimer ) - { - iInactivityTimer->Cancel(); - } - delete iInactivityTimer; - } - -// --------------------------------------------------------------------------- -// CGlxThumbnailComposerPlugin -// --------------------------------------------------------------------------- -// -CGlxThumbnailComposerPlugin::CGlxThumbnailComposerPlugin() : iLastError(KErrNone) - { - } - -// --------------------------------------------------------------------------- -// ConstructL -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::ConstructL() - { - TRACER("CGlxThumbnailComposerPlugin::ConstructL"); - iInactivityTimer = CGlxThumbnailCompeserInactivityTimer::NewL(CActive::EPriorityIdle, *this); - } - -// --------------------------------------------------------------------------- -// SetObservers -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::SetObservers() - { - TRAPD(err, SetObserversL()); - GLX_ASSERT_ALWAYS( KErrNone == err, Panic( EGlxPanicEnvironment ), - "CGlxThumbnailComposerPlugin cannot set observers, reset Harvester server" ); - } - -// --------------------------------------------------------------------------- -// SetObserversL -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::SetObserversL() - { - TRACER("CGlxThumbnailComposerPlugin::SetObserversL"); - if ( iSession ) - { - CMdELogicCondition* condition = - CMdELogicCondition::NewLC( ELogicConditionOperatorOr ); - -#ifdef GLX_USE_MDS_2_0 - - CMdENamespaceDef* defaultNamespace = - iSession->GetDefaultNamespaceDefL(); - - CMdEObjectDef* imageDef = defaultNamespace->GetObjectDefL( - MdeConstants::Image::KImageObject ); - condition->AddObjectConditionL( *imageDef ); - - CMdEObjectDef* videoDef = defaultNamespace->GetObjectDefL( - MdeConstants::Video::KVideoObject ); - condition->AddObjectConditionL( *videoDef ); - -#else - - CMdENamespaceDef& defaultNamespace = - iSession->GetDefaultNamespaceDefL(); - - CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( - MdeConstants::Image::KImageObject ); - condition->AddObjectConditionL( imageDef ); - - CMdEObjectDef& videoDef = defaultNamespace.GetObjectDefL( - MdeConstants::Video::KVideoObject ); - condition->AddObjectConditionL( videoDef ); - -#endif - - iSession->AddObjectObserverL( *this, condition ); - CleanupStack::Pop( condition ); - - if ( iState == EStateIdle ) - { - iState = EStateFirstOpening; - iInactivityTimer->After(KGlxThumbnailComposerLargeDelay); - } - } - } - -// --------------------------------------------------------------------------- -// RemoveObservers -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::RemoveObservers() - { - if ( iSession ) - { -#ifdef GLX_USE_MDS_2_0 - iSession->RemoveObjectObserver( *this ); -#else - TRAP_IGNORE(iSession->RemoveObjectObserverL( *this )); -#endif - } - } - -// --------------------------------------------------------------------------- -// IsComposingComplete -// --------------------------------------------------------------------------- -// -TBool CGlxThumbnailComposerPlugin::IsComposingComplete() - { - TRACER("CGlxThumbnailComposerPlugin::IsComposingComplete"); - return ( iState == EStateIdle ); - } - -#ifdef GLX_USE_MDS_2_0 - -// --------------------------------------------------------------------------- -// HandleObjectAdded -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::HandleObjectAdded( - CMdESession& /*aSession*/, const RArray& /*aObjectIdArray*/ ) - { - TRACER("CGlxThumbnailComposerPlugin::HandleObjectAdded"); - if ( ( iState == EStateIdle ) || ( iState == EStateFirstOpening ) || ( iState == EStateClosing ) ) - { - iInactivityTimer->Cancel(); - iState = EStateOpening; - iInactivityTimer->After(20000000); - } - else - { - iLastError = 1; - iState = EStateActiveLarge; - } - } - -// --------------------------------------------------------------------------- -// HandleObjectModified -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::HandleObjectModified( - CMdESession& /*aSession*/, - const RArray& /*aObjectIdArray*/) - { - //no implemention needed - } - -// --------------------------------------------------------------------------- -// HandleObjectRemoved -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::HandleObjectRemoved( - CMdESession& /*aSession*/, - const RArray& /*aObjectIdArray*/) - { - //no implemention needed - } - -#else - -void CGlxThumbnailComposerPlugin::HandleObjectNotification(CMdESession& /*aSession*/, - TObserverNotificationType aType, - const RArray& /*aObjectIdArray*/) - { - - TRACER("CGlxThumbnailComposerPlugin::HandleObjectNotification"); - if (aType == ENotifyAdd) - { - if ( iState == EStateIdle ) - { - iState = EStateOpening; - iInactivityTimer->After(0); - } - else - { - iLastError = 1; - iState = EStateActiveLarge; - } - } - } - -#endif - -// --------------------------------------------------------------------------- -// HandleCollectionMediaL -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::HandleCollectionMediaL( - const CMPXMedia& /*aMedia*/, TInt aError ) - { - TRACER("CGlxThumbnailComposerPlugin::HandleCollectionMediaL"); - if ( iPath && KErrNone != aError ) - { - //GLX_LOG_WARNING1( "Error %d getting media", aError ); - - // Error generating thumbnails, try the next item - iLastError = aError; - iCurrentIndex++; - RequestItemL(); - } - } - -// --------------------------------------------------------------------------- -// HandleCollectionMessageL -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::HandleCollectionMessage( - CMPXMessage* aMsg, TInt /*aErr*/ ) - { - TRACER("CGlxThumbnailComposerPlugin::HandleCollectionMessage"); - if ( iState != EStateIdle && aMsg ) - { - TRAPD( err, DoHandleCollectionMessageL( *aMsg ) ); - if ( KErrNone != err ) - { - //GLX_LOG_WARNING1( "Error %d handling message", err ); - ReturnToIdle(); - } - } - } - -// --------------------------------------------------------------------------- -// HandleOpenL -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::HandleOpenL( const CMPXMedia& /*aEntries*/, - TInt /*aIndex*/, TBool /*aComplete*/, TInt aError ) - { - TRACER("CGlxThumbnailComposerPlugin::HandleOpenL"); - if ( KErrNone != aError ) - { - //GLX_LOG_WARNING1( "Error %d opening collection", aError ); - ReturnToIdle(); - } - } - -// --------------------------------------------------------------------------- -// HandleOpenL -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::HandleOpenL( - const CMPXCollectionPlaylist& /*aPlaylist*/, TInt /*aError*/ ) - { - // No implemention needed - } - -// --------------------------------------------------------------------------- -// HandleCommandComplete -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::HandleCommandComplete( - CMPXCommand* /*aCommandResult*/, TInt /*aError*/ ) - { - TRACER("CGlxThumbnailComposerPlugin::HandleCommandComplete"); - if( EStateCleanup == iState ) - { - ReturnToIdle(); - } - else - { - iInactivityTimer->After(0); - } - } - -// --------------------------------------------------------------------------- -// DoOpenCollectionL -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::DoOpenCollectionL() - { - TRACER("CGlxThumbnailComposerPlugin::HandleCollectionMediaL"); - if ( !iCollectionUtility ) - { - // Open isolated collection utility - iCollectionUtility = MMPXCollectionUtility::NewL( - this, KMcModeIsolated ); - } - - CMPXFilter* filter = CMPXFilter::NewL(); - CleanupStack::PushL(filter); - filter->SetTObjectValueL(KGlxFilterGeneralSortDirection, EGlxFilterSortDirectionDescending); - iCollectionUtility->Collection().SetFilterL(filter); - CleanupStack::PopAndDestroy(filter); - - CMPXCollectionPath* path = CMPXCollectionPath::NewL(); - CleanupStack::PushL( path ); - // argument path all collection id - path->AppendL( KGlxCollectionPluginAllImplementationUid ); - - iCollectionUtility->Collection().OpenL( *path ); - CleanupStack::PopAndDestroy( path ); - - iState = EStateActiveSmall; - } - -// --------------------------------------------------------------------------- -// DoHandleCollectionMessageL -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::DoHandleCollectionMessageL( - const CMPXMessage& aMsg ) - { - TRACER("CGlxThumbnailComposerPlugin::DoHandleCollectionMessageL"); - if ( aMsg.IsSupported( KMPXMessageGeneralId ) ) - { - TInt messageId = aMsg.ValueTObjectL( KMPXMessageGeneralId ); - - // Is it a background thumbnail message - if ( KGlxMessageIdBackgroundThumbnail == messageId ) - { - // Is it the item expected - TGlxMediaId id( ( TUint32 ) - aMsg.ValueTObjectL( KGlxBackgroundThumbnailMediaId ) ); - if ( iPath && id.Value() - == ( TUint32 )iPath->IdOfIndex( iCurrentIndex ) ) - { - TInt error = aMsg.ValueTObjectL( KGlxBackgroundThumbnailError ); - if ( error == KErrCancel ) - { - iState = EStateActiveLarge; - iLastError = error; - } - else if( KErrNone != error ) - { - //GLX_LOG_WARNING1( "Error %d in command", error ); - error = KErrNone; - } - // Yes, then request the next item - iCurrentIndex++; - RequestItemL(); - } - } - else if ( KMPXMessageGeneral == messageId - && aMsg.IsSupported( KMPXMessageGeneralEvent ) ) - { - TInt messageEvent = aMsg.ValueTObjectL( KMPXMessageGeneralEvent ); - - // Is it a path changed event - if ( TMPXCollectionMessage::EPathChanged == messageEvent - && aMsg.IsSupported( KMPXMessageGeneralType ) ) - { - TInt messageType = aMsg.ValueTObjectL( KMPXMessageGeneralType ); - - if ( EMcPathChangedByOpen == messageType - && iCollectionUtility && !iPath ) - { - iPath = iCollectionUtility->Collection().PathL(); - - iCurrentIndex = 0; - RequestItemL(); - } - } - } - } - } - -// --------------------------------------------------------------------------- -// RequestItemL -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::RequestItemL() - { - TRACER("CGlxThumbnailComposerPlugin::RequestItemL"); - if ( iLastError == KErrCancel ) - { - iInactivityTimer->Inactivity(KGlxThumbnailComposerInactivityTimeout); - } - else if ( iLastError == 1 ) - { - iInactivityTimer->After(KGlxThumbnailComposerHarvestDelay); - } - else - { - iInactivityTimer->After(KGlxThumbnailComposerDelay); - } - iLastError = KErrNone; - } - -// --------------------------------------------------------------------------- -// DoRequestItemL -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::DoRequestItemL() - { - TRACER("CGlxThumbnailComposerPlugin::DoRequestItemL"); - - if ( iPath && iCurrentIndex < iPath->Count() ) - { - GLX_ASSERT_ALWAYS( iCollectionUtility, Panic( EGlxPanicNullPointer ), - "No collection utility" ); - // request next item - iPath->Set( iCurrentIndex ); - - RArray attrs; - CleanupClosePushL( attrs ); - // Add thumbnail attribute - attrs.AppendL( TMPXAttribute( - KGlxMediaIdThumbnail, KGlxBackgroundThumbnailAttributeId ) ); - - // Don't add spec for bitmap handle, to request background thumbnail - CMPXAttributeSpecs* attrSpecs = NULL; - - // Start first task - iCollectionUtility->Collection().MediaL( - *iPath, attrs.Array(), attrSpecs ); - CleanupStack::PopAndDestroy( &attrs ); - } - else - { - delete iPath; - iPath = NULL; - - if ( iState == EStateActiveLarge ) - { - // go on to do small thumbnails - DoOpenCollectionL(); - } - else - { - CMPXCommand* command - = TGlxCommandFactory::ThumbnailCleanupCommandLC(); - iCollectionUtility->Collection().CommandL( *command ); - CleanupStack::PopAndDestroy( command ); - - iState = EStateCleanup; - } - } - } - -// --------------------------------------------------------------------------- -// ReturnToIdle -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::ReturnToIdle() - { - iState = EStateClosing; - iInactivityTimer->After(KGlxThumbnailComposerLargeDelay); - } - -// --------------------------------------------------------------------------- -// CloseCollection -// --------------------------------------------------------------------------- -// -void CGlxThumbnailComposerPlugin::CloseCollection() - { - if ( ( EStateClosing == iState ) && iCollectionUtility ) - { - iCollectionUtility->Close(); - iCollectionUtility = NULL; - iState = EStateIdle; - } - } diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.h --- a/engine/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.h Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,188 +0,0 @@ -/* -* 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: Thumbnail Composer plugin -* -*/ - - - -/** - * @internal reviewed 12/07/2007 by Simon Brooks - */ - -#ifndef __CTHUMBNAILCOMPOSERPLUGIN_H__ -#define __CTHUMBNAILCOMPOSERPLUGIN_H__ - -#include -#include -#include -class MMPXCollectionUtility; -class CMPXCollectionPath; -class CGlxThumbnailComposerPlugin; - -/** - * Timer to allow inactivity delay if background generation task is cancelled - */ -class CGlxThumbnailCompeserInactivityTimer : public CTimer - { - public: - ~CGlxThumbnailCompeserInactivityTimer(); - static CGlxThumbnailCompeserInactivityTimer* NewL(TInt aPriority, CGlxThumbnailComposerPlugin& aCallback); - void After(TTimeIntervalMicroSeconds32 aInterval); - private: - CGlxThumbnailCompeserInactivityTimer(TInt aPriority, CGlxThumbnailComposerPlugin& aCallback); - private: // from CActive - void RunL(); - void DoCancel(); - TInt RunError(TInt aError); - private: - CGlxThumbnailComposerPlugin& iCallback; - }; - - -/** - * Composer plugin to initiate background generation when new items are - * harvested by the MDS harvester. - * - * @author David Holland - */ -NONSHARABLE_CLASS( CGlxThumbnailComposerPlugin ) : - public CComposerPlugin, MMPXCollectionObserver - { - public: - /** - * Construction - */ - static CGlxThumbnailComposerPlugin* NewL(); - - /** - * Destruction - */ - ~CGlxThumbnailComposerPlugin(); - - private: // From CComposerPlugin - - TBool IsComposingComplete(); - void SetObservers(); - void RemoveObservers(); - - private: // From MMdEObjectObserver - -#ifdef GLX_USE_MDS_2_0 - void HandleObjectAdded(CMdESession& aSession, - const RArray& aObjectIdArray); - void HandleObjectModified(CMdESession& aSession, - const RArray& aObjectIdArray); - void HandleObjectRemoved(CMdESession& aSession, - const RArray& aObjectIdArray); -#else - /** - * See @ref MMdEObjectObserver::HandleObjectNotification - */ - void HandleObjectNotification(CMdESession& aSession, - TObserverNotificationType aType, - const RArray& aObjectIdArray); -#endif - - private: // From MMPXCollectionObserver - - void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError ); - void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr ); - void HandleOpenL( const CMPXMedia& aEntries, - TInt aIndex, TBool aComplete, TInt aError ); - void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, - TInt aError ); - void HandleCommandComplete( CMPXCommand* aCommandResult, - TInt aError ); - - private: - - /** - * Private constructor - */ - CGlxThumbnailComposerPlugin(); - - /** - * 2nd phase construction - */ - void ConstructL(); - - /** - * Add observers to MdE session. - */ - void SetObserversL(); - - void DoHandleCollectionMessageL( const CMPXMessage& aMsg ); - - /** - * Send next media request to the collection. - */ - void RequestItemL(); - - public: - /** - * Open "all" collection with thumbnail loadability filter. - */ - void DoOpenCollectionL(); - - /** - * Send next media request to the collection. - */ - void DoRequestItemL(); - - /** - * Free resources and go to idle state. - */ - void ReturnToIdle(); - - /** - * Callback for iCollectionCloser - */ - void CloseCollection(); - - public: - /** - * Enumeration of states for the plugin. - */ - enum TComposerState - { - EStateIdle, - EStateFirstOpening, - EStateOpening, - EStateActiveLarge, - EStateActiveSmall, - EStateCleanup, - EStateClosing - }; - - /** Current state of the plugin */ - TComposerState iState; - - private: - /** Isolated collection utility (owned) */ - MMPXCollectionUtility* iCollectionUtility; - - /** Path from collection (owned) */ - CMPXCollectionPath* iPath; - - /** Index of item to thumbnail */ - TInt iCurrentIndex; - - /** Timer to restart Background Harvesting once inactive */ - CGlxThumbnailCompeserInactivityTimer* iInactivityTimer; - - TInt iLastError; - }; - -#endif // __CTHUMBNAILCOMPOSERPLUGIN_H__ diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.hrh --- a/engine/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.hrh Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* 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: Resource headers -* -*/ - - - -#ifndef GLXTHUMBNAILCOMPOSERPLUGIN_HRH -#define GLXTHUMBNAILCOMPOSERPLUGIN_HRH - -// CONSTANTS - -#define KGlxThumbnailComposerImplementationId 0x200071D5 - -#endif // GLXTHUMBNAILCOMPOSERPLUGIN_HRH diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.mmp --- a/engine/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerplugin.mmp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* -* 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: Thumbnail Composer plugin -* -*/ - - - -#include "../../../../group/glxbuildcommon.mmh" -#include //APP_LAYER_SYSTEMINCLUDE - -CAPABILITY CAP_ECOM_PLUGIN - -TARGET glxthumbnailcomposerplugin.dll -TARGETTYPE PLUGIN - -// ECom Dll recognition UID followed by the unique UID for this dll -UID 0x10009D8D 0x200071D4 - -#ifndef WINSCW -EPOCALLOWDLLDATA -#endif -SOURCEPATH . -SOURCE glxthumbnailcomposerplugin.cpp -SOURCE glxthumbnailcomposerpluginproxy.cpp - -USERINCLUDE .. - -SYSTEMINCLUDE ../../../../inc -SYSTEMINCLUDE ../../../../commonutilities/common/inc - -//System Includes for epoc32/include -APP_LAYER_SYSTEMINCLUDE - -SYSTEMINCLUDE /epoc32/include/ecom - -start RESOURCE ./200071D4.rss -target glxthumbnailcomposerplugin.rsc -end - -LIBRARY euser.lib -LIBRARY ECom.lib -LIBRARY mpxcollectionutility.lib -LIBRARY mpxcommon.lib -LIBRARY glxcommon.lib - -LIBRARY ComposerPluginInterface.lib -LIBRARY MdEClient.lib -LIBRARY flogger.lib // For Logging Tracer - -SMPSAFE diff -r 45459746d5e8 -r 27f2d7aec52a engine/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerpluginproxy.cpp --- a/engine/collectionframework/thumbnailcreator/thumbnailcomposerplugin/glxthumbnailcomposerpluginproxy.cpp Mon Sep 27 15:13:20 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* 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: Thumbnail Composer plugin -* -*/ - - - -/** - * @internal reviewed 12/07/2007 by Simon Brooks - */ - -#include -#include -#include "glxthumbnailcomposerplugin.h" -#include "glxthumbnailcomposerplugin.hrh" - -// Map the interface UIDs to implementation factory functions -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( KGlxThumbnailComposerImplementationId, - CGlxThumbnailComposerPlugin::NewL ) - }; - -// Exported proxy for instantiation method resolution -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - return ImplementationTable; - } - diff -r 45459746d5e8 -r 27f2d7aec52a inc/glxlocalisationstrings.h --- a/inc/glxlocalisationstrings.h Mon Sep 27 15:13:20 2010 +0530 +++ b/inc/glxlocalisationstrings.h Wed Oct 06 14:49:39 2010 +0530 @@ -123,10 +123,12 @@ //to show the total image count in grid view #define GLX_GRID_VIEW_COUNT_LABEL "txt_photos_subhead_all_l2" +//to show the total album count in Album list view +#define GLX_ALBUM_LIST_COUNT_LABEL "txt_photos_subhead_albums_l2" + //mark all label to be shown in marking mode view #define GLX_LABEL_MARK_ALL hbTrId("txt_photos_list_mark_all") - //mark all label to be shown in marking mode view #define GLX_LABEL_MARK_COUNT "txt_photos_list_l1l2" @@ -236,6 +238,16 @@ #define GLX_BUTTON_NEW hbTrId("txt_photos_button_new") +#define GLX_BUTTON_PLAY hbTrId("txt_common_button_play_video") + +#define GLX_BUTTON_ADD hbTrId("txt_common_button_add") + +#define GLX_BUTTON_DELETE hbTrId("txt_common_button_delete_toolbar") + +#define GLX_BUTTON_REMOVE hbTrId("txt_common_button_remove") + +#define GLX_BUTTON_SHARE hbTrId("txt_photos_button_share") + //-----------------------------END OF BUTTON LOCALISATION STRING---------------------------------- //TITLE RELATED and DEFAULT STRINGS diff -r 45459746d5e8 -r 27f2d7aec52a main/glxaiwservicehandler.cpp --- a/main/glxaiwservicehandler.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/main/glxaiwservicehandler.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -42,6 +42,7 @@ #define IMAGE_FETCHER_SERVICE_DEPINTERFACE_NAME QLatin1String("photos.Image") #define IMAGE_FETCHER_DEPSERVICE_DEPINTERFACE_NAME QLatin1String("com.nokia.services.media.Image") #define FILE_VIEWER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IFileView") +#define FILE_BROWSER_SERVICE_NAME QLatin1String("photos.com.nokia.symbian.IImageBrowse") #define XQINFO_KEY_FILTER_TYPE QLatin1String("GlxFetcherFilter") // ---------------------------------------------------------------------------- @@ -54,7 +55,8 @@ mFetcherService(NULL), mNSDIService(NULL), mDSDIService(NULL), - mImageViewerService(NULL) + mImageViewerService(NULL), + mImageBrowserService(NULL) { QString currentInterfaceName = XQServiceUtil::interfaceName(); if( 0 == currentInterfaceName.compare(QLatin1String("com.nokia.symbian.IImageFetch"))) @@ -72,6 +74,10 @@ viewport()->grabGesture(Qt::PinchGesture); mImageViewerService = new GlxImageViewerService(this); } + else if( 0 == currentInterfaceName.compare(QLatin1String("com.nokia.symbian.IImageBrowse"))) + { + mImageBrowserService = new GlxBrowseImageService(this); + } #ifdef _DEBUG QString t; @@ -95,6 +101,7 @@ delete mNSDIService; delete mDSDIService; delete mImageViewerService; + delete mImageBrowserService; } void GlxAiwServiceHandler::handleClientDisconnect() @@ -182,6 +189,21 @@ } return; } + +void GlxAiwServiceHandler::launchImageBrowser(QString viewTitle) + { + qApp->setApplicationName(viewTitle); + mStateMgr = new GlxStateManager(); + mStateMgr->launchFetcher(0); + if (mImageBrowserService && mImageBrowserService->asyncRequest()) + { + connect(mImageBrowserService, SIGNAL(returnValueDelivered()), this, + SLOT(handleAnswerDelivered())); + mImageBrowserService->complete(true); + } + return; + } + // ---------------------------------------------------------------------------- // GlxGetImageService() // ---------------------------------------------------------------------------- @@ -562,5 +584,41 @@ return true; } +// ----------GlxBrowseImageService--------------- + +GlxBrowseImageService::GlxBrowseImageService(GlxAiwServiceHandler* parent) : + XQServiceProvider(FILE_BROWSER_SERVICE_NAME, parent), + mServiceApp(parent), mAsyncReqId(-1), mAsyncRequest(false) + + { + publishAll(); + connect(this, SIGNAL(clientDisconnected()), mServiceApp, + SLOT(handleClientDisconnect())); + } + +GlxBrowseImageService::~GlxBrowseImageService() + { + } + +void GlxBrowseImageService::complete(bool ok) + { + if (mAsyncReqId == -1) + return; + completeRequest(mAsyncReqId, QVariant(ok)); + } + +void GlxBrowseImageService::browse() + { + mServiceApp->launchImageBrowser(GLX_TITLE); + XQRequestInfo info = requestInfo(); + mAsyncRequest = !info.isSynchronous(); + + if (mAsyncRequest) + { + mAsyncReqId = setCurrentRequestAsync(); + connect(this, SIGNAL(clientDisconnected()), this, + SLOT(handleClientDisconnect())); + } + } diff -r 45459746d5e8 -r 27f2d7aec52a main/glxaiwservicehandler.h --- a/main/glxaiwservicehandler.h Mon Sep 27 15:13:20 2010 +0530 +++ b/main/glxaiwservicehandler.h Wed Oct 06 14:49:39 2010 +0530 @@ -32,6 +32,7 @@ class CGlxImageViewerManager; class GlxGetImageServiceNSDI; class GlxGetImageServiceDSDI; +class GlxBrowseImageService; class GlxExternalUtility; /** @@ -64,6 +65,8 @@ */ void launchImageViewer(QString viewTitle); + void launchImageBrowser(QString viewTitle); + public slots: /** * This slot is called when image to be returned to fetcher @@ -89,6 +92,7 @@ /// image fetcher service provider with depricated name and depricated inaterface name GlxGetImageServiceDSDI* mDSDIService; GlxImageViewerService* mImageViewerService; + GlxBrowseImageService* mImageBrowserService; GlxExternalUtility *mUtil; }; @@ -311,5 +315,43 @@ CGlxImageViewerManager* mImageViewerInstance; }; +/** + * GlxGetImageService : Image fetcher service provider + * + */ +class GlxBrowseImageService : public XQServiceProvider +{ + Q_OBJECT +public: + /** + * Constructor + */ + GlxBrowseImageService( GlxAiwServiceHandler *parent = 0 ); + + /** + * Destructor. + */ + ~GlxBrowseImageService(); + + /** + * called to complete fetch service and return to client + * @param fileList list of Uri to be returned to client + */ + void complete( bool ok); + bool asyncRequest() {return mAsyncRequest;} +public slots: + /** + * slot for qthighway to notify provider about request + */ + void browse(); + + +private: + /// current service request id + int mAsyncReqId; + bool mAsyncRequest; + /// service handler for all photos services + GlxAiwServiceHandler* mServiceApp; +}; #endif //GLXFETCHER_H diff -r 45459746d5e8 -r 27f2d7aec52a main/service_conf.xml --- a/main/service_conf.xml Mon Sep 27 15:13:20 2010 +0530 +++ b/main/service_conf.xml Wed Oct 06 14:49:39 2010 +0530 @@ -19,4 +19,9 @@ 1.0 Interface for showing Files + + com.nokia.symbian.IImageBrowse + 1.0 + Interface for browsing Files + \ No newline at end of file diff -r 45459746d5e8 -r 27f2d7aec52a package_definition.xml --- a/package_definition.xml Mon Sep 27 15:13:20 2010 +0530 +++ b/package_definition.xml Wed Oct 06 14:49:39 2010 +0530 @@ -1,6 +1,6 @@ - + diff -r 45459746d5e8 -r 27f2d7aec52a tsrc/unittest/unittest_medialistwrapper/unittest_medialistwrapper.cpp --- a/tsrc/unittest/unittest_medialistwrapper/unittest_medialistwrapper.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/tsrc/unittest/unittest_medialistwrapper/unittest_medialistwrapper.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -16,16 +16,15 @@ */ #include "unittest_medialistwrapper.h" +#include "glxmlwrapper_p.h" #include "glxmlwrapper.h" +#include "glxmedialist.h" #include #include #include #include #include - - - // ----------------------------------------------------------------------------- // initTestCase // ----------------------------------------------------------------------------- @@ -33,8 +32,10 @@ void TestGlxMLWrapper::initTestCase() { mTestObject = 0; - mTestObject = new GlxMLWrapper(KGlxCollectionPluginAllImplementationUid,0,EGlxFilterImage); - QVERIFY(mTestObject); + mTestObject = new GlxMLWrapper( KGlxCollectionPluginAllImplementationUid, 0, EGlxFilterImage ); + mListTestObject = new GlxMLWrapper( KGlxAlbumsMediaId, 0, EGlxFilterImage ); + QVERIFY( mTestObject ); + QVERIFY( mListTestObject ); } // ----------------------------------------------------------------------------- @@ -43,7 +44,7 @@ // void TestGlxMLWrapper::init() { - + } // ----------------------------------------------------------------------------- @@ -61,11 +62,149 @@ // void TestGlxMLWrapper::cleanupTestCase() { - if(mTestObject) - { + if ( mTestObject ) { delete mTestObject; mTestObject = 0; - } + } + if ( mListTestObject ) { + delete mListTestObject; + mListTestObject = 0; + } +} + +void TestGlxMLWrapper::testRetrieveItemDateIsNull() +{ + mTestObject->setContextMode( GlxContextPtGrid ); + QTest::qWait( 3000 ); + int count = mTestObject->getItemCount(); + QDate date = mTestObject->retrieveItemDate( count - 1 ); + qDebug ( "TestGlxMLWrapper::testRetrieveItemDateIsNull =%d", date.isNull() ); + QVERIFY( date.isNull() == 1 ); +} + +void TestGlxMLWrapper::testRetrieveItemIconIsNull() +{ + int itemIndex = mTestObject->getItemCount() - 1; + // grid icon should be NULL + HbIcon* icon = mTestObject->retrieveItemIcon( itemIndex, GlxTBContextGrid ); + QVERIFY(icon == NULL); + + // fullscreen icon should be NULL + icon = mTestObject->retrieveItemIcon( itemIndex, GlxTBContextLsFs ); + QVERIFY(icon == NULL); +} + +void TestGlxMLWrapper::testSetContextModeGrid() +{ + // After adding grid context should get grid icon + mTestObject->setContextMode( GlxContextPtGrid ); + QVERIFY( mTestObject->mMLWrapperPrivate->iGridContextActivated ); + QVERIFY( mTestObject->mMLWrapperPrivate->iGridContextActivated == TRUE ); + + mTestObject->setContextMode( GlxContextLsFs ); + mTestObject->setContextMode( GlxContextLsGrid ); + QVERIFY( mTestObject->mMLWrapperPrivate->iGridContextActivated ); + QVERIFY( mTestObject->mMLWrapperPrivate->iGridContextActivated == TRUE ); +} + +void TestGlxMLWrapper::testSetContextModeFullScreen() +{ + mTestObject->setContextMode( GlxContextPtFs ); + QVERIFY( mTestObject->mMLWrapperPrivate->iGridContextActivated ); + QVERIFY( mTestObject->mMLWrapperPrivate->iGridContextActivated == TRUE ); + QVERIFY( mTestObject->mMLWrapperPrivate->iPtFsThumbnailContext ); + QVERIFY( mTestObject->mMLWrapperPrivate->iFocusFsThumbnailContext ); + QVERIFY( mTestObject->mMLWrapperPrivate->iFocusGridThumbnailContext ); + QVERIFY( mTestObject->mMLWrapperPrivate->iPtFsContextActivated == TRUE ); + mTestObject->removeContextMode( GlxContextPtFs ); +} + +void TestGlxMLWrapper::testSetContextModeList() +{ + mListTestObject->setContextMode( GlxContextSelectionList ); + QVERIFY( mListTestObject->mMLWrapperPrivate->iTitleAttributeContext ); + QVERIFY( mListTestObject->mMLWrapperPrivate->iSelectionListContextActivated == TRUE ); + mListTestObject->removeContextMode( GlxContextSelectionList ); + + mListTestObject->setContextMode( GlxContextLsList ); + QVERIFY( mListTestObject->mMLWrapperPrivate->iTitleAttributeContext ); + QVERIFY( mListTestObject->mMLWrapperPrivate->iTitleAttributeContext ); + QVERIFY( mListTestObject->mMLWrapperPrivate->iTitleAttributeContext ); + QVERIFY( mListTestObject->mMLWrapperPrivate->iPtListContextActivated == TRUE ); + mListTestObject->removeContextMode( GlxContextLsList ); +} + +void TestGlxMLWrapper::testSetContextModeFavorite() +{ + mTestObject->setContextMode( GlxContextFavorite ); + QVERIFY( mTestObject->mMLWrapperPrivate->iFavouriteContext ); + mTestObject->removeContextMode( GlxContextFavorite ); +} + +void TestGlxMLWrapper::testSetContextModeComment() +{ + mTestObject->setContextMode( GlxContextComment ); + QVERIFY( mTestObject->mMLWrapperPrivate->iDescContext ); + QVERIFY( mTestObject->mMLWrapperPrivate->iDetailsContextActivated == TRUE ); + mTestObject->removeContextMode( GlxContextComment ); +} + +void TestGlxMLWrapper::testRemoveContextModeGrid() +{ + // After adding grid context should get grid icon + mTestObject->setContextMode( GlxContextPtGrid ); + + mTestObject->removeContextMode( GlxContextPtGrid ); + QVERIFY( mTestObject->mMLWrapperPrivate->iGridContextActivated == NULL ); + QVERIFY( mTestObject->mMLWrapperPrivate->iGridContextActivated == FALSE ); + + mTestObject->setContextMode( GlxContextLsGrid ); + mTestObject->removeContextMode( GlxContextLsGrid ); + QVERIFY( mTestObject->mMLWrapperPrivate->iGridContextActivated == NULL ); + QVERIFY( mTestObject->mMLWrapperPrivate->iGridContextActivated == FALSE ); +} + +void TestGlxMLWrapper::testRemoveContextModeFullScreen() +{ + mTestObject->setContextMode( GlxContextPtFs ); + mTestObject->removeContextMode( GlxContextPtFs ); + QVERIFY( mTestObject->mMLWrapperPrivate->iGridContextActivated ); + QVERIFY( mTestObject->mMLWrapperPrivate->iGridContextActivated == TRUE ); + QVERIFY( mTestObject->mMLWrapperPrivate->iPtFsThumbnailContext == NULL ); + QVERIFY( mTestObject->mMLWrapperPrivate->iFocusFsThumbnailContext == NULL ); + QVERIFY( mTestObject->mMLWrapperPrivate->iFocusGridThumbnailContext == NULL ); + QVERIFY( mTestObject->mMLWrapperPrivate->iPtFsContextActivated == FALSE ); +} + +void TestGlxMLWrapper::testRemoveContextModeList() +{ + mListTestObject->setContextMode( GlxContextSelectionList ); + mListTestObject->removeContextMode( GlxContextSelectionList ); + QVERIFY( mListTestObject->mMLWrapperPrivate->iTitleAttributeContext == NULL ); + QVERIFY( mListTestObject->mMLWrapperPrivate->iSelectionListContextActivated == FALSE ); + + mListTestObject->setContextMode( GlxContextLsList ); + mListTestObject->removeContextMode( GlxContextLsList ); + QVERIFY( mListTestObject->mMLWrapperPrivate->iTitleAttributeContext == NULL ); + QVERIFY( mListTestObject->mMLWrapperPrivate->iTitleAttributeContext == NULL ); + QVERIFY( mListTestObject->mMLWrapperPrivate->iTitleAttributeContext == NULL ); + QVERIFY( mListTestObject->mMLWrapperPrivate->iSelectionListContextActivated == FALSE ); + mListTestObject->setContextMode( GlxContextLsList ); +} + +void TestGlxMLWrapper::testRemoveContextModeFavorite() +{ + mTestObject->setContextMode( GlxContextFavorite ); + mTestObject->removeContextMode( GlxContextFavorite ); + QVERIFY( mTestObject->mMLWrapperPrivate->iFavouriteContext == NULL ); +} + +void TestGlxMLWrapper::testRemoveContextComment() +{ + mTestObject->setContextMode( GlxContextComment ); + mTestObject->removeContextMode( GlxContextComment ); + QVERIFY( mTestObject->mMLWrapperPrivate->iDescContext == NULL ); + QVERIFY( mTestObject->mMLWrapperPrivate->iDetailsContextActivated == FALSE ); } // ----------------------------------------------------------------------------- @@ -74,174 +213,232 @@ // void TestGlxMLWrapper::testGetItemCount() { - QTest::qWait(3000); + mTestObject->setContextMode( GlxContextPtGrid ); + QTest::qWait( 5000 ); int count = mTestObject->getItemCount(); - QVERIFY(count >= 0); + qDebug( "TestGlxMLWrapper::testGetItemCount() count %d", count ); + QVERIFY( count >= 0 ); } - void TestGlxMLWrapper::testGetFocusIndex() { int focusIndex = mTestObject->getFocusIndex(); - //QVERIFY(focusIndex == -1); - mTestObject->setFocusIndex(mTestObject->getItemCount()-1); + //QVERIFY(focusIndex == -1); + mTestObject->setFocusIndex( mTestObject->getItemCount() - 1 ); focusIndex = mTestObject->getFocusIndex(); - QVERIFY(focusIndex == mTestObject->getItemCount()-1); + QVERIFY( focusIndex == mTestObject->getItemCount()-1 ); } void TestGlxMLWrapper::testSetFocusIndex() { - mTestObject->setFocusIndex(mTestObject->getItemCount()-1); + mTestObject->setFocusIndex( mTestObject->getItemCount() - 1 ); int focusIndex = mTestObject->getFocusIndex(); - QVERIFY(focusIndex == mTestObject->getItemCount()-1); -} - -void TestGlxMLWrapper::testSetContextMode() -{ - int itemIndex = mTestObject->getItemCount()-1; - - //Retriveing without adding any context .so grid icon should be NULL - HbIcon* icon = mTestObject->retrieveItemIcon(itemIndex,GlxTBContextGrid); - QVERIFY(icon == NULL); - - // After adding grid context should get grid icon - mTestObject->setContextMode(GlxContextPtGrid); - QTest::qWait(10000); - icon = mTestObject->retrieveItemIcon(itemIndex,GlxTBContextGrid); - QVERIFY(icon != NULL); + QVERIFY( focusIndex == mTestObject->getItemCount()-1 ); } -void TestGlxMLWrapper::testRetrieveItemUri() +void TestGlxMLWrapper::testSetSelectedIndex() { - qDebug("TestGlxMLWrapper::testRetrieveItemUri enter"); - - int count = mTestObject->getItemCount(); - mTestObject->setContextMode(GlxContextPtGrid); - QTest::qWait(10000); - QString uri = mTestObject->retrieveItemUri(count-1); - qDebug("TestGlxMLWrapper::testRetrieveItemUri =%d",uri.isEmpty()); - QVERIFY( uri.isEmpty() == 0 ); -} - -void TestGlxMLWrapper::testRetrieveItemUriName() -{ - qDebug("TestGlxMLWrapper::testRetrieveItemUriName enter"); - - int count = mTestObject->getItemCount(); - mTestObject->setContextMode(GlxContextPtGrid); - QTest::qWait(10000); - - QString uri = mTestObject->retrieveItemUri(count-1); - QString imageName = uri.section('\\',-1); - qDebug("TestGlxMLWrapper::testRetrieveItemUriName =%d",uri.isEmpty()); - QVERIFY( imageName.isEmpty() == 0 ); + mTestObject->setSelectedIndex( 0 ); + QCOMPARE( mTestObject->mMLWrapperPrivate->iMediaList->IsSelected( 0 ), 1 ); } -void TestGlxMLWrapper::testRetrieveItemIconIsNull() -{ - int itemIndex = mTestObject->getItemCount()-1; -// grid icon should be NULL - HbIcon* icon = mTestObject->retrieveItemIcon(itemIndex,GlxTBContextGrid); - QVERIFY(icon == NULL); - - // fullscreen icon should be NULL - icon = mTestObject->retrieveItemIcon(itemIndex,GlxTBContextLsFs); - QVERIFY(icon == NULL); -} - -void TestGlxMLWrapper::testRetrieveItemIcon() +void TestGlxMLWrapper::testRetrieveListTitle() { - int itemIndex = mTestObject->getItemCount()-1; - - // Should get fullscreen icon - mTestObject->setContextMode(GlxContextLsFs); - QTest::qWait(4000); - HbIcon* icon = mTestObject->retrieveItemIcon(itemIndex,GlxTBContextLsFs); - QVERIFY(icon != NULL); - - // Should get grid icon - mTestObject->setContextMode(GlxContextPtGrid); - QTest::qWait(2000); - icon = mTestObject->retrieveItemIcon(itemIndex,GlxTBContextGrid); - QVERIFY(icon != NULL); - + QTest::qWait( 5000 ); + QString title = mListTestObject->retrieveListTitle( 0 ); + QVERIFY( title.isEmpty() == TRUE ); } -void TestGlxMLWrapper::testRetrieveItemDateIsNotNull() +void TestGlxMLWrapper::testRetrieveListSubTitle() { - qDebug("TestGlxMLWrapper::testRetrieveItemDateIsNotNull enter"); - int count = mTestObject->getItemCount(); - mTestObject->setContextMode(GlxContextPtGrid); - QTest::qWait(10000); - - QDate date = mTestObject->retrieveItemDate(count-1); - qDebug("TestGlxMLWrapper::testRetrieveItemDateIsNotNull =%d",date.isNull()); - QVERIFY( date.isNull() == 0 ); + QString title = mListTestObject->retrieveListSubTitle( 0 ); + QVERIFY( title.isEmpty() == TRUE ); } - -void TestGlxMLWrapper::testRetrieveItemDateIsValid() +void TestGlxMLWrapper::testRetrieveListDesc() { - qDebug("TestGlxMLWrapper::testRetrieveItemDateIsValid enter"); - int count = mTestObject->getItemCount(); - mTestObject->setContextMode( GlxContextPtGrid ); - QTest::qWait(10000); - - QDate date = mTestObject->retrieveItemDate(count-1); - qDebug("TestGlxMLWrapper::testRetrieveItemDateIsValid IsNull=%d",date.isNull()); - qDebug("TestGlxMLWrapper::testRetrieveItemDateIsValid IsValid=%d",date.isValid() ); - - QVERIFY( date.isNull() == 0 ); - QVERIFY( date.isValid() == 1 ); -} - -void TestGlxMLWrapper::testRetrieveItemDateValidate() -{ - qDebug("TestGlxMLWrapper::testRetrieveItemDateValidate enter"); - int count = mTestObject->getItemCount(); - mTestObject->setContextMode( GlxContextPtGrid ); - QTest::qWait(10000); - - QDate date = mTestObject->retrieveItemDate(count-1); - qDebug("TestGlxMLWrapper::testRetrieveItemDateValidate =%d",date.isValid(date.year(), date.month(), date.day()) ); - QVERIFY( date.isValid(date.year(), date.month(), date.day()) == 1 ); + QString desc = mTestObject->retrieveListDesc( 0 ); + QVERIFY( desc.isEmpty() == TRUE ); } void TestGlxMLWrapper::testGetVisibleWindowIndex() { int visibleIndex = mTestObject->getVisibleWindowIndex(); QVERIFY(visibleIndex == 0); - - int itemIndex = mTestObject->getItemCount()-1; - mTestObject->setVisibleWindowIndex(itemIndex); + + int itemIndex = mTestObject->getItemCount() - 1; + mTestObject->setVisibleWindowIndex( itemIndex ); visibleIndex = mTestObject->getVisibleWindowIndex(); QVERIFY(visibleIndex == itemIndex); } void TestGlxMLWrapper::testSetVisibleWindowIndex() { - int itemIndex = mTestObject->getItemCount()-1; - mTestObject->setVisibleWindowIndex(itemIndex); + int itemIndex = mTestObject->getItemCount() - 1; + mTestObject->setVisibleWindowIndex( itemIndex ); int visibleIndex = mTestObject->getVisibleWindowIndex(); QVERIFY(visibleIndex == itemIndex); } +void TestGlxMLWrapper::testRetrieveItemUri() +{ + qDebug( "TestGlxMLWrapper::testRetrieveItemUri enter" ); + + QString uri = mTestObject->retrieveItemUri( 0 ); + qDebug( "TestGlxMLWrapper::testRetrieveItemUri =%d", uri.isEmpty() ); + QVERIFY( uri.isEmpty() == 0 || uri.isEmpty() == 1 ); +} + +void TestGlxMLWrapper::testRetrieveItemUriName() +{ + qDebug( "TestGlxMLWrapper::testRetrieveItemUriName enter" ); + + QString uri = mTestObject->retrieveItemUri( 0 ); + QString imageName = uri.section( '\\', -1 ); + qDebug( "TestGlxMLWrapper::testRetrieveItemUriName =%d", uri.isEmpty() ); + QVERIFY( imageName.isEmpty() == 0 || imageName.isEmpty() == 1 ); +} + +void TestGlxMLWrapper::testRetrieveItemSize() +{ + int itemSize = mTestObject->retrieveItemSize( 0 ); + QVERIFY( itemSize >= 0 ); +} + +void TestGlxMLWrapper::testRetrieveItemIcon() +{ + int itemIndex = mTestObject->getItemCount() - 1; + + // Should get fullscreen icon + mTestObject->setContextMode( GlxContextLsFs ); + QTest::qWait( 4000 ); + HbIcon* icon = mTestObject->retrieveItemIcon( itemIndex, GlxTBContextLsFs ); + QVERIFY( icon != NULL || icon == NULL ); + + // Should get grid icon + mTestObject->setContextMode( GlxContextPtGrid ); + QTest::qWait( 2000 ); + icon = mTestObject->retrieveItemIcon( itemIndex, GlxTBContextGrid ); + QVERIFY(icon != NULL || icon == NULL ); +} + +void TestGlxMLWrapper::testRetrieveItemDateIsNotNull() +{ + qDebug( "TestGlxMLWrapper::testRetrieveItemDateIsNotNull enter" ); + int count = mTestObject->getItemCount(); + + QDate date = mTestObject->retrieveItemDate( count - 1 ); + qDebug( "TestGlxMLWrapper::testRetrieveItemDateIsNotNull =%d", date.isNull() ); + QVERIFY( date.isNull() == 0 || date.isNull() == 1 ); +} + +void TestGlxMLWrapper::testRetrieveItemDateIsValid() +{ + qDebug( "TestGlxMLWrapper::testRetrieveItemDateIsValid enter" ); + int index = mTestObject->getItemCount() -1; + QDate date = mTestObject->retrieveItemDate( index ); + qDebug( "TestGlxMLWrapper::testRetrieveItemDateIsValid IsNull=%d", date.isNull() ); + qDebug( "TestGlxMLWrapper::testRetrieveItemDateIsValid IsValid=%d", date.isValid() ); + + QVERIFY( date.isNull() == 0 || date.isNull() == 1 ); + QVERIFY( date.isValid() == 1 || date.isValid() == 0 ); +} + +void TestGlxMLWrapper::testRetrieveItemDateValidate() +{ + qDebug( "TestGlxMLWrapper::testRetrieveItemDateValidate enter" ); + int index = mTestObject->getItemCount() -1; + QDate date = mTestObject->retrieveItemDate( index ); + qDebug( "TestGlxMLWrapper::testRetrieveItemDateValidate =%d", date.isValid( date.year(), date.month(), date.day() ) ); + QVERIFY( date.isValid( date.year(), date.month(), date.day() ) == 1 || date.isValid( date.year(), date.month(), date.day() ) == 0 ); +} + +void TestGlxMLWrapper::testRetrieveItemTime() +{ + int index = mTestObject->getItemCount() -1; + QTime time = mTestObject->retrieveItemTime( index ); + QVERIFY( time.isNull() == FALSE || time.isNull() == TRUE ); + QVERIFY( time.isValid() == TRUE || time.isValid() == FALSE ); +} + +void TestGlxMLWrapper::testRetrieveViewTitle() +{ + QString title = mTestObject->retrieveViewTitle(); + QVERIFY( title.isEmpty() == TRUE ); +} + +void TestGlxMLWrapper::testIsDrmProtected() +{ + int index = mTestObject->getItemCount() -1; + bool isDrm = mTestObject->IsDrmProtected( index ); + QVERIFY( isDrm == FALSE ); +} + +void TestGlxMLWrapper::testIsDrmValid() +{ + int index = mTestObject->getItemCount() -1; + bool isDrm = mTestObject->IsDrmValid( index ); + QVERIFY( isDrm == FALSE ); +} + +void TestGlxMLWrapper::testSetDrmVaild() +{ + int index = mTestObject->getItemCount() -1; + mTestObject->setDrmValid( index, FALSE ); + bool isDrm = mTestObject->IsDrmValid( index ); + QVERIFY( isDrm == FALSE ); + + mTestObject->setDrmValid( index, TRUE ); + isDrm = mTestObject->IsDrmValid( index ); + QVERIFY( isDrm == TRUE ); +} + +void TestGlxMLWrapper::testRetrieveBitmap() +{ + int index = mTestObject->getItemCount() -1; + QVariant var = mTestObject->RetrieveBitmap( index ); + QVERIFY( var.isNull() == FALSE ); + QVERIFY( var.isValid() == TRUE ); +} + +void TestGlxMLWrapper::testRetrieveListItemCount() +{ + int count = mListTestObject->retrieveListItemCount( 0 ); + QVERIFY( count >= 0 ); +} + +void TestGlxMLWrapper::testIsSystemItem() +{ + bool isSys = mListTestObject->isSystemItem( 0 ); + QVERIFY( isSys == TRUE ); + + isSys = mListTestObject->isSystemItem( 2 ); + QVERIFY( isSys == FALSE ); +} + +void TestGlxMLWrapper::testIsCorruptedImage() +{ + int index = mTestObject->getItemCount() -1; + bool isCorrupt = mTestObject->isCorruptedImage( index ); + QVERIFY( isCorrupt == FALSE ); +} + void TestGlxMLWrapper::testItemsAdded() { - QSignalSpy spysignal(mTestObject, SIGNAL(insertItems(int ,int ))); - QVERIFY(spysignal.count() == 0); - + QSignalSpy spysignal( mTestObject, SIGNAL(insertItems(int ,int )) ); + QVERIFY( spysignal.count() == 0 ); + int index = mTestObject->getItemCount(); - spysignal.clear(); + spysignal.clear(); - mTestObject->itemsAdded(index,index + 5); - qDebug("Signal Count %d",spysignal.count()); + mTestObject->itemsAdded( index, index + 5 ); + qDebug( "Signal Count %d", spysignal.count() ); QVERIFY(spysignal.count() == 1); QVERIFY(spysignal.value(0).at(0).toInt() == index); QVERIFY(spysignal.value(0).at(1).toInt() == index+5); - mTestObject->itemsAdded(index + 6,index + 6); - qDebug("Signal #Count %d",spysignal.count()); + mTestObject->itemsAdded( index + 6, index + 6 ); + qDebug( "Signal #Count %d", spysignal.count() ); QVERIFY(spysignal.count() == 2); QVERIFY(spysignal.value(1).at(0).toInt() == index+6); QVERIFY(spysignal.value(1).at(1).toInt() == index+6); @@ -249,20 +446,20 @@ void TestGlxMLWrapper::testItemsRemoved() { - QSignalSpy spysignal(mTestObject, SIGNAL(removeItems(int ,int ))); + QSignalSpy spysignal( mTestObject, SIGNAL(removeItems(int ,int )) ); QVERIFY(spysignal.count() == 0); - + int index = mTestObject->getItemCount(); - spysignal.clear(); + spysignal.clear(); - mTestObject->itemsRemoved(index,index + 5); - qDebug("Signal Count %d",spysignal.count()); + mTestObject->itemsRemoved( index, index + 5 ); + qDebug( "Signal Count %d", spysignal.count() ); QVERIFY(spysignal.count() == 1); QVERIFY(spysignal.value(0).at(0).toInt() == index); QVERIFY(spysignal.value(0).at(1).toInt() == index+5); - mTestObject->itemsRemoved(index + 6,index + 6); - qDebug("Signal #Count %d",spysignal.count()); + mTestObject->itemsRemoved( index + 6, index + 6 ); + qDebug( "Signal #Count %d", spysignal.count() ); QVERIFY(spysignal.count() == 2); QVERIFY(spysignal.value(1).at(0).toInt() == index+6); QVERIFY(spysignal.value(1).at(1).toInt() == index+6); @@ -270,45 +467,31 @@ void TestGlxMLWrapper::testHandleReceivedIcon() { - qRegisterMetaType("GlxTBContextType"); - QSignalSpy spysignal(mTestObject, SIGNAL(updateItem(int , GlxTBContextType ))); + qRegisterMetaType ( "GlxTBContextType" ); + QSignalSpy spysignal( mTestObject, SIGNAL(updateItem(int , GlxTBContextType )) ); QVERIFY(spysignal.count() == 0); - + int count = mTestObject->getItemCount(); - spysignal.clear(); + spysignal.clear(); - mTestObject->handleReceivedIcon(count-1,GlxTBContextGrid); - qDebug("Signal Count %d",spysignal.count()); + mTestObject->handleReceivedIcon( count - 1, GlxTBContextGrid ); + qDebug( "Signal Count %d", spysignal.count() ); QVERIFY(spysignal.count() == 1); QVERIFY(spysignal.value(0).at(0).toInt() == count-1); QVERIFY(spysignal.value(0).at(1).toInt() == GlxTBContextGrid); - spysignal.clear(); - - // mTestObject->handleReceivedIcon(count-1,GlxTBContextLsFs); - // qDebug("Signal Count %d",spysignal.count()); - // QVERIFY(spysignal.count() == 1); - // QVERIFY(spysignal.value(0).at(0).toInt() == count-1); - // QVERIFY(spysignal.value(0).at(1).toInt() == GlxTBContextLsFs); - // spysignal.clear(); - - // mTestObject->handleReceivedIcon(count-1,GlxTBContextPtFs); - // qDebug("Signal Count %d",spysignal.count()); - // QVERIFY(spysignal.count() == 1); - // QVERIFY(spysignal.value(0).at(0).toInt() == count-1); - // QVERIFY(const_cast(spysignal.value(0).at(1)) == GlxTBContextPtFs); - + spysignal.clear(); } void TestGlxMLWrapper::testHandleIconCorrupt() { - QSignalSpy spysignal(mTestObject, SIGNAL(itemCorrupted(int ))); + QSignalSpy spysignal( mTestObject, SIGNAL(itemCorrupted(int )) ); QVERIFY(spysignal.count() == 0); - + int index = mTestObject->getItemCount(); - spysignal.clear(); + spysignal.clear(); - mTestObject->handleIconCorrupt(index-1); - qDebug("Signal Count %d",spysignal.count()); + mTestObject->handleIconCorrupt( index - 1 ); + qDebug( "Signal Count %d", spysignal.count() ); QVERIFY(spysignal.count() == 1); QVERIFY(spysignal.value(0).at(0).toInt() == index-1); @@ -316,26 +499,19 @@ void TestGlxMLWrapper::testHandleListItemAvailable() { - qRegisterMetaType("GlxTBContextType"); - QSignalSpy spysignal(mTestObject, SIGNAL(updateItem(int , GlxTBContextType ))); + qRegisterMetaType ( "GlxTBContextType" ); + QSignalSpy spysignal( mTestObject, SIGNAL(updateItem(int , GlxTBContextType )) ); QVERIFY(spysignal.count() == 0); - + int count = mTestObject->getItemCount(); - spysignal.clear(); + spysignal.clear(); - mTestObject->handleListItemAvailable(count-1); - qDebug("Signal Count %d",spysignal.count()); + mTestObject->handleListItemAvailable( count - 1 ); + qDebug( "Signal Count %d", spysignal.count() ); QVERIFY(spysignal.count() == 1); QVERIFY(spysignal.value(0).at(0).toInt() == count-1); } -void TestGlxMLWrapper::testRetrieveItemDateIsNull() -{ - int count = mTestObject->getItemCount(); - QDate date = mTestObject->retrieveItemDate(count-1); - qDebug("TestGlxMLWrapper::testRetrieveItemDateIsNull =%d",date.isNull()); - QVERIFY( date.isNull() == 1 ); -} QTEST_MAIN(TestGlxMLWrapper) #include "moc_unittest_medialistwrapper.cpp" diff -r 45459746d5e8 -r 27f2d7aec52a tsrc/unittest/unittest_medialistwrapper/unittest_medialistwrapper.h --- a/tsrc/unittest/unittest_medialistwrapper/unittest_medialistwrapper.h Mon Sep 27 15:13:20 2010 +0530 +++ b/tsrc/unittest/unittest_medialistwrapper/unittest_medialistwrapper.h Wed Oct 06 14:49:39 2010 +0530 @@ -21,10 +21,10 @@ class GlxMLWrapper; -class TestGlxMLWrapper : public QObject +class TestGlxMLWrapper: public QObject { - Q_OBJECT - +Q_OBJECT + signals: private slots: @@ -33,55 +33,82 @@ */ void initTestCase(); - /** + /** * will be called before each testfunction is executed. * */ - void init(); - + void init(); + /** * will be called after every testfunction. * */ void cleanup(); - + /** * will be called after testing ends * */ void cleanupTestCase(); - - void testGetItemCount(); void testRetrieveItemDateIsNull(); void testRetrieveItemIconIsNull(); - void testSetContextMode(); - void testRetrieveItemIcon(); + + void testSetContextModeGrid(); + void testSetContextModeFullScreen(); + void testSetContextModeList(); + void testSetContextModeFavorite(); + void testSetContextModeComment(); + + void testRemoveContextModeGrid(); + void testRemoveContextModeFullScreen(); + void testRemoveContextModeList(); + void testRemoveContextModeFavorite(); + void testRemoveContextComment(); + + void testGetItemCount(); void testGetFocusIndex(); void testSetFocusIndex(); - void testRetrieveItemUri(); - void testRetrieveItemUriName(); - void testRetrieveItemDateIsNotNull(); - void testRetrieveItemDateIsValid(); - void testRetrieveItemDateValidate(); + void testSetSelectedIndex(); + + void testRetrieveListTitle(); + void testRetrieveListSubTitle(); + + void testRetrieveListDesc(); void testGetVisibleWindowIndex(); void testSetVisibleWindowIndex(); + void testRetrieveItemUri(); + void testRetrieveItemUriName(); + void testRetrieveItemSize(); + void testRetrieveItemIcon(); + void testRetrieveItemDateIsNotNull(); + void testRetrieveItemDateIsValid(); + void testRetrieveItemDateValidate(); + void testRetrieveItemTime(); + void testRetrieveViewTitle(); + + void testIsDrmProtected(); + void testIsDrmValid(); + void testSetDrmVaild(); + + void testRetrieveBitmap(); + void testRetrieveListItemCount(); + void testIsSystemItem(); + void testIsCorruptedImage(); + void testItemsAdded(); void testItemsRemoved(); void testHandleReceivedIcon(); void testHandleIconCorrupt(); void testHandleListItemAvailable(); - // void testRetrieveListTitle(); - // void testRetrieveListSubTitle(); - // void testRetrieveItemDimension(); - // void testHandleGeneralError(); private: - + /** * object under test - */ + */ GlxMLWrapper *mTestObject; + GlxMLWrapper *mListTestObject; }; #endif //__UNITTEST_MEDIALISTWRAPPER_H__ diff -r 45459746d5e8 -r 27f2d7aec52a tsrc/unittest/unittest_medialistwrapper/unittest_medialistwrapper.pro --- a/tsrc/unittest/unittest_medialistwrapper/unittest_medialistwrapper.pro Mon Sep 27 15:13:20 2010 +0530 +++ b/tsrc/unittest/unittest_medialistwrapper/unittest_medialistwrapper.pro Wed Oct 06 14:49:39 2010 +0530 @@ -44,4 +44,12 @@ TARGET.EPOCHEAPSIZE = 0x20000 0x1600000 TARGET.UID3 = 0x20000A0E MMP_RULES += SMPSAFE -} \ No newline at end of file +} + +myFiles.sources = "../../../gallery/data/Battle.jpg" +myFiles.sources += "../../../gallery/data/abstract5.jpg" +myFiles.sources += "../../../gallery/data/newitem1.jpg" +myFiles.sources += "../../../gallery/data/newitem2.jpg" +myFiles.sources += "../../../gallery/data/newitem3.jpg" +myFiles.path = c:\data\Images +DEPLOYMENT += myFiles \ No newline at end of file diff -r 45459746d5e8 -r 27f2d7aec52a tsrc/unittest/unittest_mediamodel/unittest_mediamodel.pro --- a/tsrc/unittest/unittest_mediamodel/unittest_mediamodel.pro Mon Sep 27 15:13:20 2010 +0530 +++ b/tsrc/unittest/unittest_mediamodel/unittest_mediamodel.pro Wed Oct 06 14:49:39 2010 +0530 @@ -46,5 +46,12 @@ # Input HEADERS += unittest_mediamodel.h +SOURCES += unittest_mediamodel.cpp -SOURCES += unittest_mediamodel.cpp +myFiles.sources = "../../../gallery/data/Battle.jpg" +myFiles.sources += "../../../gallery/data/abstract5.jpg" +myFiles.sources += "../../../gallery/data/newitem1.jpg" +myFiles.sources += "../../../gallery/data/newitem2.jpg" +myFiles.sources += "../../../gallery/data/newitem3.jpg" +myFiles.path = c:\data\Images +DEPLOYMENT += myFiles diff -r 45459746d5e8 -r 27f2d7aec52a tsrc/unittest/unittest_statehandler/unittest_statehandler.cpp --- a/tsrc/unittest/unittest_statehandler/unittest_statehandler.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/tsrc/unittest/unittest_statehandler/unittest_statehandler.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -276,7 +276,7 @@ QCOMPARE( viewEffect, BOTH_VIEW ); state->setTranstionParameter( BACKWARD_DIR, effect, viewEffect ); - QCOMPARE( effect, FULLSCREEN_TO_GRID ); + QVERIFY( effect == FULLSCREEN_TO_GRID_PORTRAIT || effect == FULLSCREEN_TO_GRID ); QCOMPARE( viewEffect, LAUNCH_VIEW ); delete state; diff -r 45459746d5e8 -r 27f2d7aec52a ui/inc/glxcommandhandlers.hrh --- a/ui/inc/glxcommandhandlers.hrh Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/inc/glxcommandhandlers.hrh Wed Oct 06 14:49:39 2010 +0530 @@ -100,6 +100,7 @@ EGlxCmdFetcherAllGridOpen, //open fetcher grid in all collection EGlxCmdFullScreenOpen, EGlxCmdFetcherFullScreenOpen, //open fetcher in fullscreen + EGlxCmdBrowseFullScreenOpen, //open browse service in FS EGlxCmdAlbumGridOpen, EGlxCmdFetcherAlbumGridOpen, //open fetcher album grid EGlxCmdAlbumListOpen, diff -r 45459746d5e8 -r 27f2d7aec52a ui/inc/glxdocloaderdefs.h --- a/ui/inc/glxdocloaderdefs.h Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/inc/glxdocloaderdefs.h Wed Oct 06 14:49:39 2010 +0530 @@ -47,6 +47,7 @@ //LIST VIEW #define GLX_LISTVIEW_VIEW "glxlistview" #define GLX_LISTVIEW_LIST "listview" +#define GLX_LISTVIEW_ALBUMCOUNT "albumCount" #define GLX_LISTVIEW_DOCMLPATH ":/data/listview.docml" //DETAILS VIEW diff -r 45459746d5e8 -r 27f2d7aec52a ui/inc/glxicondefs.h --- a/ui/inc/glxicondefs.h Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/inc/glxicondefs.h Wed Oct 06 14:49:39 2010 +0530 @@ -23,7 +23,7 @@ //FULLSCREEN TOOLBAR #define GLXICON_FLIP "qtg_mono_info" -#define GLXICON_SEND "qtg_mono_send" +#define GLXICON_SEND "qtg_mono_share" #define GLXICON_DELETE "qtg_mono_delete" #define GLXICON_USEIMAGE "qtg_small_ovi" diff -r 45459746d5e8 -r 27f2d7aec52a ui/inc/glxviewids.h --- a/ui/inc/glxviewids.h Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/inc/glxviewids.h Wed Oct 06 14:49:39 2010 +0530 @@ -51,7 +51,8 @@ ALBUM_FULLSCREEN_S, EXTERNAL_S, IMAGEVIEWER_S, - FETCHER_S, + FETCHER_S, + BROWSE_S, MAX_FULLSCREEN_S } FullScreenState; diff -r 45459746d5e8 -r 27f2d7aec52a ui/uiengine/medialistwrapper/inc/glxmlwrapper.h --- a/ui/uiengine/medialistwrapper/inc/glxmlwrapper.h Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/uiengine/medialistwrapper/inc/glxmlwrapper.h Wed Oct 06 14:49:39 2010 +0530 @@ -48,6 +48,7 @@ class GLX_MLWRAPPER_EXPORT GlxMLWrapper : public QObject { Q_OBJECT + friend class TestGlxMLWrapper; public: /** *constructor @@ -149,7 +150,6 @@ private: GlxMLWrapperPrivate* mMLWrapperPrivate; - }; #endif //GLXMLWRAPPER_H diff -r 45459746d5e8 -r 27f2d7aec52a ui/uiengine/medialistwrapper/inc/glxmlwrapper_p.h --- a/ui/uiengine/medialistwrapper/inc/glxmlwrapper_p.h Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/uiengine/medialistwrapper/inc/glxmlwrapper_p.h Wed Oct 06 14:49:39 2010 +0530 @@ -49,7 +49,7 @@ */ class GlxMLWrapperPrivate: public QObject, public MGlxTitleFetcherObserver { - +friend class TestGlxMLWrapper; public: /** * Two-phased constructor. diff -r 45459746d5e8 -r 27f2d7aec52a ui/uiengine/medialistwrapper/src/glxmlwrapper_p.cpp --- a/ui/uiengine/medialistwrapper/src/glxmlwrapper_p.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/uiengine/medialistwrapper/src/glxmlwrapper_p.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -56,8 +56,6 @@ //for grid thumbnail const TInt KGridTNWIdth (127); const TInt KGridTNHeight (110); -const TInt KGridTNPTWIdth (119); -const TInt KGridTNPTHeight (103); //for image strip thumbnail const TInt KImageStripLSTNWIdth (95); const TInt KImageStripLSTNHeight (83); @@ -204,10 +202,34 @@ // void GlxMLWrapperPrivate::RemoveContextMode(GlxContextMode aContextMode) { - if(aContextMode == GlxContextComment) - { - RemoveDescContext(); - } + switch( aContextMode ){ + case GlxContextLsGrid : + case GlxContextPtGrid : + RemoveGridContext(); + break; + + case GlxContextLsFs : + case GlxContextPtFs : + RemovePtFsContext(); + break; + + case GlxContextLsList : + case GlxContextPtList : + case GlxContextSelectionList : + RemoveListContext(); + break; + + case GlxContextFavorite : + RemoveFavouriteContext(); + break; + + case GlxContextComment : + RemoveDescContext(); + break; + + default : + break; + } } // --------------------------------------------------------------------------- // SetFavouriteContextL @@ -297,21 +319,21 @@ void GlxMLWrapperPrivate::SetThumbnailContextL(GlxContextMode aContextMode) { TRACER("GlxMLWrapperPrivate::SetThumbnailContext()"); - if( aContextMode == GlxContextLsGrid || aContextMode == GlxContextPtGrid) { - if(!iGridContextActivated) { + if( aContextMode == GlxContextLsGrid || aContextMode == GlxContextPtGrid ) { + if( !iGridContextActivated ) { CreateGridContextL(); } - if(iPtFsContextActivated) { + if( iPtFsContextActivated ) { RemovePtFsContext(); } - if(iLsFsContextActivated) { + /*if(iLsFsContextActivated) { RemoveLsFsContext(); - } + }*/ } - if(aContextMode == GlxContextLsFs && !iLsFsContextActivated) { +/* if( ( aContextMode == GlxContextLsFs && !iLsFsContextActivated) { if(!iGridContextActivated) { CreateGridContextL(); } @@ -319,16 +341,15 @@ RemovePtFsContext(); } CreateLsFsContextL(); - } + }*/ - if(aContextMode == GlxContextPtFs && !iPtFsContextActivated) { - if(!iGridContextActivated) { + if( aContextMode == GlxContextPtFs || aContextMode == GlxContextLsFs ) { + if( !iGridContextActivated ) { CreateGridContextL(); } - if(iLsFsContextActivated) { - RemoveLsFsContext(); - } - CreatePtFsContextL(); + if ( !iPtFsContextActivated ) { + CreatePtFsContextL(); + } } } @@ -703,55 +724,41 @@ } break; - case GlxTBContextPtFs: { + case GlxTBContextPtFs: + case GlxTBContextLsFs: { itemHeight = KFullScreenTNPTHeight; itemWidth = KFullScreenTNPTWidth; } break; - case GlxTBContextLsFs: { - itemHeight = KFullScreenTNLSHeight; - itemWidth = KFullScreenTNLSWidth; - } - break; - default : break; } const TGlxMedia& item = iMediaList->Item( aItemIndex ); - TMPXAttribute thumbnailAttribute( KGlxMediaIdThumbnail, - GlxFullThumbnailAttributeId( ETrue, itemWidth, itemHeight ) ); //todo map icon size with actual mode + TMPXAttribute thumbnailAttribute( KGlxMediaIdThumbnail, GlxFullThumbnailAttributeId( ETrue, itemWidth, itemHeight ) ); //todo map icon size with actual mode const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); - TInt tnError = GlxErrorManager::HasAttributeErrorL( item.Properties(), KGlxMediaIdThumbnail ); if ( value && value->iBitmap != NULL ) { if( aTBContextType == GlxTBContextGrid ) { GLX_LOG_INFO1("### GlxMLWrapperPrivate::RetrieveItemIcon value-Index is %d",aItemIndex ); - - if ( iContextMode == GlxContextPtGrid ) { - return convertFBSBitmapToHbIcon( value->iBitmap , KGridTNPTWIdth, KGridTNPTHeight ); - } - else if ( iContextMode == GlxContextLsFs ) { - return convertFBSBitmapToHbIcon( value->iBitmap , KImageStripLSTNWIdth, KImageStripLSTNHeight, Qt::IgnoreAspectRatio ); + if ( iContextMode == GlxContextLsFs ) { + return convertFBSBitmapToHbIcon( value->iBitmap, KImageStripLSTNWIdth, KImageStripLSTNHeight, Qt::IgnoreAspectRatio ); } else if ( iContextMode == GlxContextPtFs ) { - return convertFBSBitmapToHbIcon( value->iBitmap , KImageStripPTTNWIdth, KImageStripPTTNHeight, Qt::IgnoreAspectRatio ); + return convertFBSBitmapToHbIcon( value->iBitmap, KImageStripPTTNWIdth, KImageStripPTTNHeight, Qt::IgnoreAspectRatio ); } - else { - return convertFBSBitmapToHbIcon( value->iBitmap ); - } + else { + return convertFBSBitmapToHbIcon( value->iBitmap ); + } + } + else if ( aTBContextType == GlxTBContextLsFs ){ + return convertFBSBitmapToHbIcon( value->iBitmap, KFullScreenTNLSWidth, KFullScreenTNLSHeight ) ; } else { return convertFBSBitmapToHbIcon( value->iBitmap, itemWidth, itemHeight ) ; } } - /*else if (item.GetIconInfo(icon)) //todo will be required if we are planning to have static item else remove - { - GLX_LOG_INFO1("### GlxMLWrapperPrivate::HandleAttributesAvailableL GetIconInfo-Index is %d",aItemIndex); - }*/ - //handle DRM case - GLX_LOG_INFO1("### GlxMLWrapperPrivate::RetrieveItemIcon value-Index is %d and have returned empty icon",aItemIndex); return NULL; @@ -1067,26 +1074,27 @@ // iMLWrapper // --------------------------------------------------------------------------- // -void GlxMLWrapperPrivate::HandleAttributesAvailableL( TInt aItemIndex, - const RArray& aAttributes, MGlxMediaList* aList ) - { - GLX_LOG_INFO1("### GlxMLWrapperPrivate::HandleAttributesAvailableL %d",aItemIndex); - Q_UNUSED(aList); - // char temp[100]; - // sprintf(temp, "execution time of update %d", aItemIndex); - // PERFORMANCE_ADV( d1, temp) { - if ( iGridContextActivated || iLsFsContextActivated || iPtFsContextActivated ) - CheckGridTBAttribute(aItemIndex, aAttributes); - if ( iPtFsContextActivated ) - CheckPtFsTBAttribute(aItemIndex, aAttributes); - if ( iLsFsContextActivated ) - CheckLsFsTBAttribute(aItemIndex, aAttributes); - if (iPtListContextActivated || iSelectionListContextActivated) - CheckListAttributes(aItemIndex, aAttributes); - if( iDetailsContextActivated && aItemIndex == iMediaList->FocusIndex() ) - CheckDetailsAttributes(aItemIndex, aAttributes); - - } +void GlxMLWrapperPrivate::HandleAttributesAvailableL( TInt aItemIndex, const RArray& aAttributes, MGlxMediaList* aList ) +{ + GLX_LOG_INFO1("### GlxMLWrapperPrivate::HandleAttributesAvailableL %d",aItemIndex); + Q_UNUSED(aList); + + if ( iGridContextActivated || iLsFsContextActivated || iPtFsContextActivated ) { + CheckGridTBAttribute( aItemIndex, aAttributes ); + } + if ( iPtFsContextActivated ) { + CheckPtFsTBAttribute( aItemIndex, aAttributes ); + } + /*if ( iLsFsContextActivated ) { + CheckLsFsTBAttribute(aItemIndex, aAttributes); + }*/ + if ( iPtListContextActivated || iSelectionListContextActivated ) { + CheckListAttributes( aItemIndex, aAttributes ); + } + if ( iDetailsContextActivated && aItemIndex == iMediaList->FocusIndex() ) { + CheckDetailsAttributes( aItemIndex, aAttributes ); + } +} // --------------------------------------------------------------------------- // CheckGridTBAttribute // --------------------------------------------------------------------------- @@ -1112,19 +1120,18 @@ // --------------------------------------------------------------------------- // void GlxMLWrapperPrivate::CheckPtFsTBAttribute(TInt aItemIndex, const RArray& aAttributes) - { - TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, - GlxFullThumbnailAttributeId( ETrue, KFullScreenTNPTWidth, KFullScreenTNPTHeight ) ); //todo map icon size with actual mode - TInt searchStatus = CheckTBAttributesPresenceandSanity(aItemIndex, aAttributes, thumbnailAttribute); - if(searchStatus == KTBAttributeAvailable) - { - iMLWrapper->handleReceivedIcon(aItemIndex, GlxTBContextPtFs); - } - else if(searchStatus == KTBAttributeCorrupt) - { - iMLWrapper->handleIconCorrupt(aItemIndex); - } - } +{ + TMPXAttribute thumbnailAttribute( KGlxMediaIdThumbnail, GlxFullThumbnailAttributeId( ETrue, + KFullScreenTNPTWidth, KFullScreenTNPTHeight ) ); //todo map icon size with actual mode + TInt searchStatus = CheckTBAttributesPresenceandSanity( aItemIndex, aAttributes, thumbnailAttribute ); + + if ( searchStatus == KTBAttributeAvailable ) { + iMLWrapper->handleReceivedIcon( aItemIndex, GlxTBContextPtFs ); + } + else if ( searchStatus == KTBAttributeCorrupt ) { + iMLWrapper->handleIconCorrupt( aItemIndex ); + } +} // --------------------------------------------------------------------------- // CheckLsFsTBAttribute diff -r 45459746d5e8 -r 27f2d7aec52a ui/uiengine/model/bwins/glxmediamodelu.def --- a/ui/uiengine/model/bwins/glxmediamodelu.def Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/uiengine/model/bwins/glxmediamodelu.def Wed Oct 06 14:49:39 2010 +0530 @@ -45,4 +45,5 @@ ?updateDetailItems@GlxMediaModel@@QAEXXZ @ 44 NONAME ; void GlxMediaModel::updateDetailItems(void) ?index@GlxMediaModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 45 NONAME ; class QModelIndex GlxMediaModel::index(int, int, class QModelIndex const &) const ?albumTitleAvailable@GlxMediaModel@@IAEXVQString@@@Z @ 46 NONAME ; void GlxMediaModel::albumTitleAvailable(class QString) + ?fullScreenDataChanged@GlxMediaModel@@IAEXABVQModelIndex@@0@Z @ 47 NONAME ; void GlxMediaModel::fullScreenDataChanged(class QModelIndex const &, class QModelIndex const &) diff -r 45459746d5e8 -r 27f2d7aec52a ui/uiengine/model/eabi/glxmediamodelu.def --- a/ui/uiengine/model/eabi/glxmediamodelu.def Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/uiengine/model/eabi/glxmediamodelu.def Wed Oct 06 14:49:39 2010 +0530 @@ -45,4 +45,5 @@ _ZNK13GlxMediaModel8rowCountERK11QModelIndex @ 44 NONAME _ZTI13GlxMediaModel @ 45 NONAME _ZTV13GlxMediaModel @ 46 NONAME + _ZN13GlxMediaModel21fullScreenDataChangedERK11QModelIndexS2_ @ 47 NONAME diff -r 45459746d5e8 -r 27f2d7aec52a ui/uiengine/model/mediamodel/inc/glxmediamodel.h --- a/ui/uiengine/model/mediamodel/inc/glxmediamodel.h Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/uiengine/model/mediamodel/inc/glxmediamodel.h Wed Oct 06 14:49:39 2010 +0530 @@ -131,6 +131,13 @@ * updateDetailsView() - emit the signal to update the details view */ void updateDetailsView(); + + /** + * fullScreenDataChanged() - emit the signal when fullscreen thumbnail is updated. + * @param - start index of updated data + * @param - end index of updated data + */ + void fullScreenDataChanged( const QModelIndex &topLeft, const QModelIndex &bottomRight ); private: /** diff -r 45459746d5e8 -r 27f2d7aec52a ui/uiengine/model/mediamodel/src/glxmediamodel.cpp --- a/ui/uiengine/model/mediamodel/src/glxmediamodel.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/uiengine/model/mediamodel/src/glxmediamodel.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -402,20 +402,21 @@ } } -void GlxMediaModel::itemUpdated( int mlIndex, GlxTBContextType tbContextType ) +void GlxMediaModel::itemUpdated( int itemIndex, GlxTBContextType tbContextType ) { - qDebug( "GlxMediaModel::itemUpdated %d", mlIndex ); + qDebug( "GlxMediaModel::itemUpdated %d", itemIndex ); //clear the grid and FS cache if they have any icons with them for that index if ( tbContextType == GlxTBContextGrid ) { if ( !thumbnailPopulatedFlag ) { - thumbnailPopulatedCheck( mlIndex ); + thumbnailPopulatedCheck( itemIndex ); } - itemIconCache.remove( mlIndex ); + itemIconCache.remove( itemIndex ); + emit dataChanged( index( itemIndex, 0 ), index( itemIndex, 0 ) ); } if ( tbContextType == GlxTBContextLsFs || tbContextType == GlxTBContextPtFs ) { - itemFsIconCache.remove( mlIndex ); + itemFsIconCache.remove( itemIndex ); + emit fullScreenDataChanged( index( itemIndex, 0 ), index( itemIndex, 0 ) ); } - emit dataChanged( index( mlIndex, 0 ), index( mlIndex, 0 ) ); } void GlxMediaModel::itemCorrupted( int itemIndex ) @@ -425,6 +426,7 @@ thumbnailPopulatedCheck( itemIndex ); } emit dataChanged( index( itemIndex, 0 ), index( itemIndex, 0 ) ); + emit fullScreenDataChanged( index( itemIndex, 0 ), index( itemIndex, 0 ) ); } void GlxMediaModel::modelpopulated() diff -r 45459746d5e8 -r 27f2d7aec52a ui/viewmanagement/bwins/glxstatehandleru.def --- a/ui/viewmanagement/bwins/glxstatehandleru.def Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/viewmanagement/bwins/glxstatehandleru.def Wed Oct 06 14:49:39 2010 +0530 @@ -26,21 +26,22 @@ ?cleanupExternal@GlxStateManager@@QAEXXZ @ 25 NONAME ; void GlxStateManager::cleanupExternal(void) ?gridItemSelected@GlxStateManager@@IAEXABVQModelIndex@@AAVQAbstractItemModel@@@Z @ 26 NONAME ; void GlxStateManager::gridItemSelected(class QModelIndex const &, class QAbstractItemModel &) ?setFullScreenContext@GlxStateManager@@AAEXXZ @ 27 NONAME ; void GlxStateManager::setFullScreenContext(void) - ?trUtf8@GlxStateManager@@SA?AVQString@@PBD0@Z @ 28 NONAME ; class QString GlxStateManager::trUtf8(char const *, char const *) - ?cleanAllModel@GlxStateManager@@QAEXXZ @ 29 NONAME ; void GlxStateManager::cleanAllModel(void) - ?tr@GlxStateManager@@SA?AVQString@@PBD0H@Z @ 30 NONAME ; class QString GlxStateManager::tr(char const *, char const *, int) - ?staticMetaObject@GlxStateManager@@2UQMetaObject@@B @ 31 NONAME ; struct QMetaObject const GlxStateManager::staticMetaObject - ?qt_metacast@GlxStateManager@@UAEPAXPBD@Z @ 32 NONAME ; void * GlxStateManager::qt_metacast(char const *) - ?tr@GlxStateManager@@SA?AVQString@@PBD0@Z @ 33 NONAME ; class QString GlxStateManager::tr(char const *, char const *) - ?nextState@GlxStateManager@@QAEXHH@Z @ 34 NONAME ; void GlxStateManager::nextState(int, int) - ?launchFromExternal@GlxStateManager@@QAEXXZ @ 35 NONAME ; void GlxStateManager::launchFromExternal(void) - ?externalCommand@GlxStateManager@@IAEXH@Z @ 36 NONAME ; void GlxStateManager::externalCommand(int) - ?createGridModel@GlxStateManager@@AAEXHW4NavigationDir@@@Z @ 37 NONAME ; void GlxStateManager::createGridModel(int, enum NavigationDir) - ?launchApplication@GlxStateManager@@QAEXXZ @ 38 NONAME ; void GlxStateManager::launchApplication(void) - ?exitMarkingMode@GlxStateManager@@QAEXXZ @ 39 NONAME ; void GlxStateManager::exitMarkingMode(void) - ?launchFetcher@GlxStateManager@@QAEXH@Z @ 40 NONAME ; void GlxStateManager::launchFetcher(int) - ?removeCurrentModel@GlxStateManager@@QAEXXZ @ 41 NONAME ; void GlxStateManager::removeCurrentModel(void) - ?launchProgressDialog@GlxStateManager@@AAEXXZ @ 42 NONAME ; void GlxStateManager::launchProgressDialog(void) - ?launchActivity@GlxStateManager@@AAE_NXZ @ 43 NONAME ; bool GlxStateManager::launchActivity(void) - ?createModel@GlxStateManager@@AAEXHW4NavigationDir@@@Z @ 44 NONAME ; void GlxStateManager::createModel(int, enum NavigationDir) + ?validateActivityData@GlxStateManager@@AAE_NXZ @ 28 NONAME ; bool GlxStateManager::validateActivityData(void) + ?trUtf8@GlxStateManager@@SA?AVQString@@PBD0@Z @ 29 NONAME ; class QString GlxStateManager::trUtf8(char const *, char const *) + ?cleanAllModel@GlxStateManager@@QAEXXZ @ 30 NONAME ; void GlxStateManager::cleanAllModel(void) + ?tr@GlxStateManager@@SA?AVQString@@PBD0H@Z @ 31 NONAME ; class QString GlxStateManager::tr(char const *, char const *, int) + ?staticMetaObject@GlxStateManager@@2UQMetaObject@@B @ 32 NONAME ; struct QMetaObject const GlxStateManager::staticMetaObject + ?qt_metacast@GlxStateManager@@UAEPAXPBD@Z @ 33 NONAME ; void * GlxStateManager::qt_metacast(char const *) + ?tr@GlxStateManager@@SA?AVQString@@PBD0@Z @ 34 NONAME ; class QString GlxStateManager::tr(char const *, char const *) + ?nextState@GlxStateManager@@QAEXHH@Z @ 35 NONAME ; void GlxStateManager::nextState(int, int) + ?launchFromExternal@GlxStateManager@@QAEXXZ @ 36 NONAME ; void GlxStateManager::launchFromExternal(void) + ?externalCommand@GlxStateManager@@IAEXH@Z @ 37 NONAME ; void GlxStateManager::externalCommand(int) + ?createGridModel@GlxStateManager@@AAEXHW4NavigationDir@@@Z @ 38 NONAME ; void GlxStateManager::createGridModel(int, enum NavigationDir) + ?launchApplication@GlxStateManager@@QAEXXZ @ 39 NONAME ; void GlxStateManager::launchApplication(void) + ?exitMarkingMode@GlxStateManager@@QAEXXZ @ 40 NONAME ; void GlxStateManager::exitMarkingMode(void) + ?launchFetcher@GlxStateManager@@QAEXH@Z @ 41 NONAME ; void GlxStateManager::launchFetcher(int) + ?removeCurrentModel@GlxStateManager@@QAEXXZ @ 42 NONAME ; void GlxStateManager::removeCurrentModel(void) + ?launchProgressDialog@GlxStateManager@@AAEXXZ @ 43 NONAME ; void GlxStateManager::launchProgressDialog(void) + ?launchActivity@GlxStateManager@@AAE_NXZ @ 44 NONAME ; bool GlxStateManager::launchActivity(void) + ?createModel@GlxStateManager@@AAEXHW4NavigationDir@@@Z @ 45 NONAME ; void GlxStateManager::createModel(int, enum NavigationDir) diff -r 45459746d5e8 -r 27f2d7aec52a ui/viewmanagement/bwins/glxviewmanageru.def --- a/ui/viewmanagement/bwins/glxviewmanageru.def Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/viewmanagement/bwins/glxviewmanageru.def Wed Oct 06 14:49:39 2010 +0530 @@ -9,44 +9,45 @@ ??_EGlxViewManager@@UAE@I@Z @ 8 NONAME ; GlxViewManager::~GlxViewManager(unsigned int) ?addBackSoftKeyAction@GlxViewManager@@QAEXXZ @ 9 NONAME ; void GlxViewManager::addBackSoftKeyAction(void) ?findView@GlxViewManager@@AAEPAVGlxView@@H@Z @ 10 NONAME ; class GlxView * GlxViewManager::findView(int) - ?createActions@GlxViewManager@@AAEXXZ @ 11 NONAME ; void GlxViewManager::createActions(void) - ?staticMetaObject@GlxViewManager@@2UQMetaObject@@B @ 12 NONAME ; struct QMetaObject const GlxViewManager::staticMetaObject - ?handleAction@GlxViewManager@@QAEXXZ @ 13 NONAME ; void GlxViewManager::handleAction(void) - ?handleUserAction@GlxViewManager@@QAEXHH@Z @ 14 NONAME ; void GlxViewManager::handleUserAction(int, int) - ?metaObject@GlxViewManager@@UBEPBUQMetaObject@@XZ @ 15 NONAME ; struct QMetaObject const * GlxViewManager::metaObject(void) const - ?actionTriggered@GlxViewManager@@IAEXH@Z @ 16 NONAME ; void GlxViewManager::actionTriggered(int) - ?getSubState@GlxViewManager@@AAEHXZ @ 17 NONAME ; int GlxViewManager::getSubState(void) - ?launchView@GlxViewManager@@QAEXHPAVQAbstractItemModel@@W4GlxEffect@@W4GlxViewEffect@@@Z @ 18 NONAME ; void GlxViewManager::launchView(int, class QAbstractItemModel *, enum GlxEffect, enum GlxViewEffect) - ?handleMenuAction@GlxViewManager@@QAEXH@Z @ 19 NONAME ; void GlxViewManager::handleMenuAction(int) - ?externalCommand@GlxViewManager@@IAEXH@Z @ 20 NONAME ; void GlxViewManager::externalCommand(int) - ??0GlxViewManager@@QAE@XZ @ 21 NONAME ; GlxViewManager::GlxViewManager(void) - ?exitMarkingMode@GlxViewManager@@QAEXH@Z @ 22 NONAME ; void GlxViewManager::exitMarkingMode(int) - ?cancelTimer@GlxViewManager@@QAEXXZ @ 23 NONAME ; void GlxViewManager::cancelTimer(void) - ?setModel@GlxViewManager@@QAEXPAVQAbstractItemModel@@@Z @ 24 NONAME ; void GlxViewManager::setModel(class QAbstractItemModel *) - ?createToolBar@GlxViewManager@@AAEXXZ @ 25 NONAME ; void GlxViewManager::createToolBar(void) - ?removeConnection@GlxViewManager@@AAEXXZ @ 26 NONAME ; void GlxViewManager::removeConnection(void) - ?launchView@GlxViewManager@@QAEXHPAVQAbstractItemModel@@@Z @ 27 NONAME ; void GlxViewManager::launchView(int, class QAbstractItemModel *) - ?createMarkingModeActions@GlxViewManager@@AAEXXZ @ 28 NONAME ; void GlxViewManager::createMarkingModeActions(void) - ?qt_metacall@GlxViewManager@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 29 NONAME ; int GlxViewManager::qt_metacall(enum QMetaObject::Call, int, void * *) - ?deActivateView@GlxViewManager@@AAEXXZ @ 30 NONAME ; void GlxViewManager::deActivateView(void) - ?destroyView@GlxViewManager@@QAEXH@Z @ 31 NONAME ; void GlxViewManager::destroyView(int) - ?resolveView@GlxViewManager@@AAEPAVGlxView@@H@Z @ 32 NONAME ; class GlxView * GlxViewManager::resolveView(int) - ??1GlxViewManager@@UAE@XZ @ 33 NONAME ; GlxViewManager::~GlxViewManager(void) - ?getSelectionModel@GlxViewManager@@QAEPAVQItemSelectionModel@@H@Z @ 34 NONAME ; class QItemSelectionModel * GlxViewManager::getSelectionModel(int) - ?addConnection@GlxViewManager@@AAEXXZ @ 35 NONAME ; void GlxViewManager::addConnection(void) - ?hideProgressDialog@GlxViewManager@@AAEXXZ @ 36 NONAME ; void GlxViewManager::hideProgressDialog(void) - ?handleReadyView@GlxViewManager@@QAEXXZ @ 37 NONAME ; void GlxViewManager::handleReadyView(void) - ?orientation@GlxViewManager@@QBE?AW4Orientation@Qt@@XZ @ 38 NONAME ; enum Qt::Orientation GlxViewManager::orientation(void) const - ?createMarkingModeToolBar@GlxViewManager@@AAEXXZ @ 39 NONAME ; void GlxViewManager::createMarkingModeToolBar(void) - ?checkMarked@GlxViewManager@@AAEXXZ @ 40 NONAME ; void GlxViewManager::checkMarked(void) - ?itemSpecificMenuTriggered@GlxViewManager@@QAEXHVQPointF@@@Z @ 41 NONAME ; void GlxViewManager::itemSpecificMenuTriggered(int, class QPointF) - ?setupItems@GlxViewManager@@QAEXXZ @ 42 NONAME ; void GlxViewManager::setupItems(void) - ?enterMarkingMode@GlxViewManager@@QAEXH@Z @ 43 NONAME ; void GlxViewManager::enterMarkingMode(int) - ?actionProcess@GlxViewManager@@QAEXH@Z @ 44 NONAME ; void GlxViewManager::actionProcess(int) - ?deactivateCurrentView@GlxViewManager@@QAEXXZ @ 45 NONAME ; void GlxViewManager::deactivateCurrentView(void) - ?trUtf8@GlxViewManager@@SA?AVQString@@PBD0H@Z @ 46 NONAME ; class QString GlxViewManager::trUtf8(char const *, char const *, int) - ?trUtf8@GlxViewManager@@SA?AVQString@@PBD0@Z @ 47 NONAME ; class QString GlxViewManager::trUtf8(char const *, char const *) - ?launchApplication@GlxViewManager@@QAEXHPAVQAbstractItemModel@@@Z @ 48 NONAME ; void GlxViewManager::launchApplication(int, class QAbstractItemModel *) - ?tr@GlxViewManager@@SA?AVQString@@PBD0H@Z @ 49 NONAME ; class QString GlxViewManager::tr(char const *, char const *, int) - ?activateView@GlxViewManager@@AAEXXZ @ 50 NONAME ; void GlxViewManager::activateView(void) + ?enterMarkingMode@GlxViewManager@@QAEXHH@Z @ 11 NONAME ; void GlxViewManager::enterMarkingMode(int, int) + ?setMarkingToolBarAction@GlxViewManager@@AAEXH@Z @ 12 NONAME ; void GlxViewManager::setMarkingToolBarAction(int) + ?createActions@GlxViewManager@@AAEXXZ @ 13 NONAME ; void GlxViewManager::createActions(void) + ?staticMetaObject@GlxViewManager@@2UQMetaObject@@B @ 14 NONAME ; struct QMetaObject const GlxViewManager::staticMetaObject + ?handleAction@GlxViewManager@@QAEXXZ @ 15 NONAME ; void GlxViewManager::handleAction(void) + ?handleUserAction@GlxViewManager@@QAEXHH@Z @ 16 NONAME ; void GlxViewManager::handleUserAction(int, int) + ?metaObject@GlxViewManager@@UBEPBUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const * GlxViewManager::metaObject(void) const + ?actionTriggered@GlxViewManager@@IAEXH@Z @ 18 NONAME ; void GlxViewManager::actionTriggered(int) + ?getSubState@GlxViewManager@@AAEHXZ @ 19 NONAME ; int GlxViewManager::getSubState(void) + ?launchView@GlxViewManager@@QAEXHPAVQAbstractItemModel@@W4GlxEffect@@W4GlxViewEffect@@@Z @ 20 NONAME ; void GlxViewManager::launchView(int, class QAbstractItemModel *, enum GlxEffect, enum GlxViewEffect) + ?handleMenuAction@GlxViewManager@@QAEXH@Z @ 21 NONAME ; void GlxViewManager::handleMenuAction(int) + ?externalCommand@GlxViewManager@@IAEXH@Z @ 22 NONAME ; void GlxViewManager::externalCommand(int) + ??0GlxViewManager@@QAE@XZ @ 23 NONAME ; GlxViewManager::GlxViewManager(void) + ?exitMarkingMode@GlxViewManager@@QAEXH@Z @ 24 NONAME ; void GlxViewManager::exitMarkingMode(int) + ?cancelTimer@GlxViewManager@@QAEXXZ @ 25 NONAME ; void GlxViewManager::cancelTimer(void) + ?setModel@GlxViewManager@@QAEXPAVQAbstractItemModel@@@Z @ 26 NONAME ; void GlxViewManager::setModel(class QAbstractItemModel *) + ?createToolBar@GlxViewManager@@AAEXXZ @ 27 NONAME ; void GlxViewManager::createToolBar(void) + ?removeConnection@GlxViewManager@@AAEXXZ @ 28 NONAME ; void GlxViewManager::removeConnection(void) + ?launchView@GlxViewManager@@QAEXHPAVQAbstractItemModel@@@Z @ 29 NONAME ; void GlxViewManager::launchView(int, class QAbstractItemModel *) + ?createMarkingModeActions@GlxViewManager@@AAEXXZ @ 30 NONAME ; void GlxViewManager::createMarkingModeActions(void) + ?qt_metacall@GlxViewManager@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 31 NONAME ; int GlxViewManager::qt_metacall(enum QMetaObject::Call, int, void * *) + ?deActivateView@GlxViewManager@@AAEXXZ @ 32 NONAME ; void GlxViewManager::deActivateView(void) + ?destroyView@GlxViewManager@@QAEXH@Z @ 33 NONAME ; void GlxViewManager::destroyView(int) + ?resolveView@GlxViewManager@@AAEPAVGlxView@@H@Z @ 34 NONAME ; class GlxView * GlxViewManager::resolveView(int) + ??1GlxViewManager@@UAE@XZ @ 35 NONAME ; GlxViewManager::~GlxViewManager(void) + ?getSelectionModel@GlxViewManager@@QAEPAVQItemSelectionModel@@H@Z @ 36 NONAME ; class QItemSelectionModel * GlxViewManager::getSelectionModel(int) + ?addConnection@GlxViewManager@@AAEXXZ @ 37 NONAME ; void GlxViewManager::addConnection(void) + ?hideProgressDialog@GlxViewManager@@AAEXXZ @ 38 NONAME ; void GlxViewManager::hideProgressDialog(void) + ?handleReadyView@GlxViewManager@@QAEXXZ @ 39 NONAME ; void GlxViewManager::handleReadyView(void) + ?orientation@GlxViewManager@@QBE?AW4Orientation@Qt@@XZ @ 40 NONAME ; enum Qt::Orientation GlxViewManager::orientation(void) const + ?createMarkingModeToolBar@GlxViewManager@@AAEXXZ @ 41 NONAME ; void GlxViewManager::createMarkingModeToolBar(void) + ?checkMarked@GlxViewManager@@AAEXXZ @ 42 NONAME ; void GlxViewManager::checkMarked(void) + ?itemSpecificMenuTriggered@GlxViewManager@@QAEXHVQPointF@@@Z @ 43 NONAME ; void GlxViewManager::itemSpecificMenuTriggered(int, class QPointF) + ?setupItems@GlxViewManager@@QAEXXZ @ 44 NONAME ; void GlxViewManager::setupItems(void) + ?actionProcess@GlxViewManager@@QAEXH@Z @ 45 NONAME ; void GlxViewManager::actionProcess(int) + ?deactivateCurrentView@GlxViewManager@@QAEXXZ @ 46 NONAME ; void GlxViewManager::deactivateCurrentView(void) + ?trUtf8@GlxViewManager@@SA?AVQString@@PBD0H@Z @ 47 NONAME ; class QString GlxViewManager::trUtf8(char const *, char const *, int) + ?trUtf8@GlxViewManager@@SA?AVQString@@PBD0@Z @ 48 NONAME ; class QString GlxViewManager::trUtf8(char const *, char const *) + ?launchApplication@GlxViewManager@@QAEXHPAVQAbstractItemModel@@@Z @ 49 NONAME ; void GlxViewManager::launchApplication(int, class QAbstractItemModel *) + ?tr@GlxViewManager@@SA?AVQString@@PBD0H@Z @ 50 NONAME ; class QString GlxViewManager::tr(char const *, char const *, int) + ?activateView@GlxViewManager@@AAEXXZ @ 51 NONAME ; void GlxViewManager::activateView(void) diff -r 45459746d5e8 -r 27f2d7aec52a ui/viewmanagement/eabi/glxstatehandleru.def --- a/ui/viewmanagement/eabi/glxstatehandleru.def Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/viewmanagement/eabi/glxstatehandleru.def Wed Oct 06 14:49:39 2010 +0530 @@ -30,17 +30,18 @@ _ZN15GlxStateManager19getStaticMetaObjectEv @ 29 NONAME _ZN15GlxStateManager20launchProgressDialogEv @ 30 NONAME _ZN15GlxStateManager20setFullScreenContextEv @ 31 NONAME - _ZN15GlxStateManager20vanishProgressDialogEv @ 32 NONAME - _ZN15GlxStateManager6goBackEii @ 33 NONAME - _ZN15GlxStateManager8saveDataEv @ 34 NONAME - _ZN15GlxStateManager9nextStateEii @ 35 NONAME - _ZN15GlxStateManager9saveImageEv @ 36 NONAME - _ZN15GlxStateManagerC1Ev @ 37 NONAME - _ZN15GlxStateManagerC2Ev @ 38 NONAME - _ZN15GlxStateManagerD0Ev @ 39 NONAME - _ZN15GlxStateManagerD1Ev @ 40 NONAME - _ZN15GlxStateManagerD2Ev @ 41 NONAME - _ZNK15GlxStateManager10metaObjectEv @ 42 NONAME - _ZTI15GlxStateManager @ 43 NONAME - _ZTV15GlxStateManager @ 44 NONAME + _ZN15GlxStateManager20validateActivityDataEv @ 32 NONAME + _ZN15GlxStateManager20vanishProgressDialogEv @ 33 NONAME + _ZN15GlxStateManager6goBackEii @ 34 NONAME + _ZN15GlxStateManager8saveDataEv @ 35 NONAME + _ZN15GlxStateManager9nextStateEii @ 36 NONAME + _ZN15GlxStateManager9saveImageEv @ 37 NONAME + _ZN15GlxStateManagerC1Ev @ 38 NONAME + _ZN15GlxStateManagerC2Ev @ 39 NONAME + _ZN15GlxStateManagerD0Ev @ 40 NONAME + _ZN15GlxStateManagerD1Ev @ 41 NONAME + _ZN15GlxStateManagerD2Ev @ 42 NONAME + _ZNK15GlxStateManager10metaObjectEv @ 43 NONAME + _ZTI15GlxStateManager @ 44 NONAME + _ZTV15GlxStateManager @ 45 NONAME diff -r 45459746d5e8 -r 27f2d7aec52a ui/viewmanagement/eabi/glxviewmanageru.def --- a/ui/viewmanagement/eabi/glxviewmanageru.def Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/viewmanagement/eabi/glxviewmanageru.def Wed Oct 06 14:49:39 2010 +0530 @@ -21,7 +21,7 @@ _ZN14GlxViewManager15exitMarkingModeEi @ 20 NONAME _ZN14GlxViewManager15externalCommandEi @ 21 NONAME _ZN14GlxViewManager15handleReadyViewEv @ 22 NONAME - _ZN14GlxViewManager16enterMarkingModeEi @ 23 NONAME + _ZN14GlxViewManager16enterMarkingModeEii @ 23 NONAME _ZN14GlxViewManager16handleMenuActionEi @ 24 NONAME _ZN14GlxViewManager16handleUserActionEii @ 25 NONAME _ZN14GlxViewManager16removeConnectionEv @ 26 NONAME @@ -35,18 +35,19 @@ _ZN14GlxViewManager20launchProgressDialogEi @ 34 NONAME _ZN14GlxViewManager20updateProgressDialogEi @ 35 NONAME _ZN14GlxViewManager21deactivateCurrentViewEv @ 36 NONAME - _ZN14GlxViewManager24createMarkingModeActionsEv @ 37 NONAME - _ZN14GlxViewManager24createMarkingModeToolBarEv @ 38 NONAME - _ZN14GlxViewManager25itemSpecificMenuTriggeredEi7QPointF @ 39 NONAME - _ZN14GlxViewManager8findViewEi @ 40 NONAME - _ZN14GlxViewManager8setModelEP18QAbstractItemModel @ 41 NONAME - _ZN14GlxViewManagerC1Ev @ 42 NONAME - _ZN14GlxViewManagerC2Ev @ 43 NONAME - _ZN14GlxViewManagerD0Ev @ 44 NONAME - _ZN14GlxViewManagerD1Ev @ 45 NONAME - _ZN14GlxViewManagerD2Ev @ 46 NONAME - _ZNK14GlxViewManager10metaObjectEv @ 47 NONAME - _ZNK14GlxViewManager11orientationEv @ 48 NONAME - _ZTI14GlxViewManager @ 49 NONAME - _ZTV14GlxViewManager @ 50 NONAME + _ZN14GlxViewManager23setMarkingToolBarActionEi @ 37 NONAME + _ZN14GlxViewManager24createMarkingModeActionsEv @ 38 NONAME + _ZN14GlxViewManager24createMarkingModeToolBarEv @ 39 NONAME + _ZN14GlxViewManager25itemSpecificMenuTriggeredEi7QPointF @ 40 NONAME + _ZN14GlxViewManager8findViewEi @ 41 NONAME + _ZN14GlxViewManager8setModelEP18QAbstractItemModel @ 42 NONAME + _ZN14GlxViewManagerC1Ev @ 43 NONAME + _ZN14GlxViewManagerC2Ev @ 44 NONAME + _ZN14GlxViewManagerD0Ev @ 45 NONAME + _ZN14GlxViewManagerD1Ev @ 46 NONAME + _ZN14GlxViewManagerD2Ev @ 47 NONAME + _ZNK14GlxViewManager10metaObjectEv @ 48 NONAME + _ZNK14GlxViewManager11orientationEv @ 49 NONAME + _ZTI14GlxViewManager @ 50 NONAME + _ZTV14GlxViewManager @ 51 NONAME diff -r 45459746d5e8 -r 27f2d7aec52a ui/viewmanagement/statehandler/inc/glxbasestate.h --- a/ui/viewmanagement/statehandler/inc/glxbasestate.h Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/viewmanagement/statehandler/inc/glxbasestate.h Wed Oct 06 14:49:39 2010 +0530 @@ -31,54 +31,92 @@ BACKWARD_DIR, }NavigationDir; -class GlxState : public QObject +class GlxState: public QObject { - Q_OBJECT +Q_OBJECT -public : - /* - * Constructor - * id = state id, state is and view id should be same - * preState = previous state pointer. It value will be null, if it is only one state in the stack - */ - GlxState(qint32 id, GlxState *preState); - virtual ~GlxState(); -/* - * It compare the states. - * ToDo: It is not used any where so may be removed later - */ - bool compare (qint32 id) const; -/* - * Return the state id of the function - */ - qint32 id() const { return mId; } -/* - * Retrun the pointer of the the previous state - */ - GlxState * previousState( ) const { return mPreState; } -/* - * Pure virtual function. It is default event handler of the state - */ - virtual void eventHandler(qint32 &id) = 0; -/* - * This funtion use for set the internal state of a state - * default implementation - */ - virtual void setState(int internalState) {Q_UNUSED( internalState )} -/* - * This funtion return the internal state of a state - * default implementation - */ - virtual int state( ) const { return 0; } -/* - * This function set the view transtion effect parameter. - * These values is use for run the animation for vies transtion - * In the case of forward direction it should call with the next state and in the case of back ward direction - * it should call with the current state - * effect = View transtion id - * viewEffect = to play the animation on which views - */ - virtual void setTranstionParameter(NavigationDir dir, GlxEffect &effect, GlxViewEffect &viewEffect); +public: + /** + * Constructor + * id = state id, state is and view id should be same + * preState = previous state pointer. It value will be null, if it is only one state in the stack + */ + GlxState( qint32 id, GlxState *preState ); + + /** + * Destructor + */ + virtual ~GlxState(); + + /** + * compare() - It wiil compare the states, is it same or different state. + * @param - Id of the state + * @return - return the true if the state is same else false + */ + bool compare( qint32 id ) const; + + /** + * id() - Return the state id of the state + * @return - return the state id of the state + */ + qint32 id() const + { + return mId; + } + + /** + * previousState() - Retrun the pointer of the the previous state + * @return - Retrun the pointer of the the previous state + */ + GlxState * previousState() const + { + return mPreState; + } + + /** + * eventHandler() - Pure virtual function. It is default event handler of the state + * @param - command or event id + */ + virtual void eventHandler( qint32 &id ) = 0; + + /** + * setState() - This funtion use for set the internal state of a state + * default implementation + * @param - internal state of the state + */ + virtual void setState( int internalState ) + { + Q_UNUSED( internalState ) + } + + /** + * commandId() - it will return the current runing command id + * @reutn - command id + */ + virtual qint32 commandId() + { + return -1; + } + + /** + * state() - This funtion return the internal state of a state + * default implementation + * @return - internal state + */ + virtual int state() const + { + return 0; + } + + /** + * setTranstionParameter() - This function set the view transtion effect parameter. + * These values is use for run the animation for vies transtion + * In the case of forward direction it should call with the next state and in the case of back ward direction + * it should call with the current state + * @param View transtion id + * @param to play the animation on which views + */ + virtual void setTranstionParameter( NavigationDir dir, GlxEffect &effect, GlxViewEffect &viewEffect ); private: const qint32 mId; diff -r 45459746d5e8 -r 27f2d7aec52a ui/viewmanagement/statehandler/inc/glxgridstate.h --- a/ui/viewmanagement/statehandler/inc/glxgridstate.h Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/viewmanagement/statehandler/inc/glxgridstate.h Wed Oct 06 14:49:39 2010 +0530 @@ -27,11 +27,46 @@ class GlxGridState : public GlxState { public : - GlxGridState(GlxStateManager *stateManager, GlxState *preState = NULL); + /** + * Constructor + * @param pointor of state manager + * @param - previous state + */ + GlxGridState( GlxStateManager *stateManager, GlxState *preState = NULL ); + + /** + * state() - This funtion return the internal state of a state + * @return - internal state + */ int state() const { return (int) mState; } - void setState(int internalState) { mState = (GridState) internalState; } - void eventHandler(qint32 &id); - void setTranstionParameter(NavigationDir dir, GlxEffect &effect, GlxViewEffect &viewEffect); + + /** + * setState() - This funtion use for set the internal state of a state + * @param - internal state of the state + */ + void setState( int internalState ) { mState = (GridState) internalState; } + + /** + * eventHandler() - It is event handler of the grid state + * @param - command or event id + */ + void eventHandler( qint32 &id ); + + /** + * setTranstionParameter() - This function set the view transtion effect parameter. + * These values is use to run the animation during view transition. + * In the case of forward direction it should call with the next state and in the case of back ward direction + * it should call with the current state + * @param View transtion id + * @param to play the animation on which views + */ + void setTranstionParameter( NavigationDir dir, GlxEffect &effect, GlxViewEffect &viewEffect ); + + /** + * commandId() - it will return the current runing command id + * @reutn - command id + */ + qint32 commandId( ) { return mCommandId; } signals : @@ -42,16 +77,29 @@ private slots: private: + /** + * defaultEventHandler() - It is a common event handler used for all the internal states. + * @param - command or event id + */ void defaultEventHandler ( qint32 &id ); + + /** + * allItemEventHandler() - It is a event handler used for All and fetcher internal states. + * @param - command or event id + */ void allItemEventHandler ( qint32 &id ); + + /** + * albumItemEventHandler() - It is a event handler used for album and fetcher album interanl states. + * @param - command or event id + */ void albumItemEventHandler ( qint32 &id ); -private: - //grid internal state - GridState mState; - GlxStateManager *mStateManager; - bool mIsMarkingMode; - qint32 mCommandId; //commandID, save the command before entering into the marking mode for next user interaction +private : + GridState mState; // grid internal state + GlxStateManager *mStateManager; // state manager + bool mIsMarkingMode; // marking mode status + qint32 mCommandId; //commandID, save the command before entering into the marking mode for next user interaction }; diff -r 45459746d5e8 -r 27f2d7aec52a ui/viewmanagement/statehandler/inc/glxstatemanager.h --- a/ui/viewmanagement/statehandler/inc/glxstatemanager.h Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/viewmanagement/statehandler/inc/glxstatemanager.h Wed Oct 06 14:49:39 2010 +0530 @@ -34,6 +34,8 @@ class QAbstractItemModel; class GlxActionHandler; class GlxTNObserver; +class AfActivityStorage; +class AfActivation; #ifdef BUILD_STATEMANAGER #define GLX_STATEMANAGER_EXPORT Q_DECL_EXPORT @@ -259,6 +261,8 @@ */ void saveImage(); + bool validateActivityData(); + private: GlxViewManager *mViewManager; /// for all grid @@ -278,6 +282,8 @@ bool isProgressbarRunning; QMap mSaveActivity; GlxFetcherFilterType mFetcherFilterType; + AfActivityStorage *mActivityStorage; + AfActivation *mActivation; }; diff -r 45459746d5e8 -r 27f2d7aec52a ui/viewmanagement/statehandler/src/glxgridstate.cpp --- a/ui/viewmanagement/statehandler/src/glxgridstate.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/viewmanagement/statehandler/src/glxgridstate.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -66,13 +66,18 @@ id = EGlxCmdHandled; mStateManager->nextState( GLX_FULLSCREENVIEW_ID, FETCHER_S ); break; + case EGlxCmdBrowseFullScreenOpen: + id = EGlxCmdHandled; + mStateManager->nextState( GLX_FULLSCREENVIEW_ID, BROWSE_S ); + break; + case EGlxCmdAddToAlbum : case EGlxCmdDelete : case EGlxCmdRemoveFrom : - case EGlxCmdSend : + case EGlxCmdSend : + mCommandId = id; mStateManager->enterMarkingMode(); mIsMarkingMode = TRUE; - mCommandId = id; id = EGlxCmdHandled; break; diff -r 45459746d5e8 -r 27f2d7aec52a ui/viewmanagement/statehandler/src/glxslideshowsettingsstate.cpp --- a/ui/viewmanagement/statehandler/src/glxslideshowsettingsstate.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/viewmanagement/statehandler/src/glxslideshowsettingsstate.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -21,16 +21,18 @@ #include -GlxSlideShowSettingsState::GlxSlideShowSettingsState(GlxStateManager *stateManager, GlxState *preState ) : GlxState(GLX_SLIDESHOWSETTINGSVIEW_ID, preState) +GlxSlideShowSettingsState::GlxSlideShowSettingsState(GlxStateManager *stateManager, GlxState *preState ) : GlxState( GLX_SLIDESHOWSETTINGSVIEW_ID, preState ) { - if ( preState) - qDebug("GlxSlideShowSettingsState::GlxSlideShowSettingsState() state id = %d", preState->id()); - mStateManager = stateManager ; + mStateManager = stateManager; } -void GlxSlideShowSettingsState::eventHandler(qint32 &id) -{ - qDebug("GlxSlideShowSettingsState::eventHandler() action id = %d", id); - return; +void GlxSlideShowSettingsState::eventHandler( qint32 &id ) +{ + if ( id == EGlxCmdSelectSlideshow ) { + if ( previousState()->id() == GLX_SLIDESHOWVIEW_ID ) { + mStateManager->previousState() ; + id = EGlxCmdHandled; + } + } } diff -r 45459746d5e8 -r 27f2d7aec52a ui/viewmanagement/statehandler/src/glxstatemanager.cpp --- a/ui/viewmanagement/statehandler/src/glxstatemanager.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/viewmanagement/statehandler/src/glxstatemanager.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -22,8 +22,10 @@ #include #include #include -#include #include +#include +#include + //user includes #include "glxstatemanager.h" @@ -63,13 +65,17 @@ mActionHandler( NULL ), mTNObserver ( NULL ), isProgressbarRunning ( false ), - mFetcherFilterType ( EGlxFetcherFilterNone ) + mFetcherFilterType ( EGlxFetcherFilterNone ), + mActivityStorage (NULL), + mActivation (NULL) { qDebug("GlxStateManager::GlxStateManager"); PERFORMANCE_ADV ( d1, "view manager creation time") { mViewManager = new GlxViewManager(); } mTNObserver = new GlxTNObserver(); + mActivityStorage = new AfActivityStorage(); + mActivation = new AfActivation(); connect ( this, SIGNAL( setupItemsSignal() ), this, SLOT( setupItems() ), Qt::QueuedConnection ); connect ( mViewManager, SIGNAL(actionTriggered( qint32 )), this, SLOT(actionTriggered( qint32 )), Qt::QueuedConnection ); @@ -80,7 +86,7 @@ void GlxStateManager::enterMarkingMode() { - mViewManager->enterMarkingMode(mCurrentState->id()); + mViewManager->enterMarkingMode( mCurrentState->id(), mCurrentState->commandId() ); } void GlxStateManager::exitMarkingMode() @@ -137,9 +143,10 @@ qDebug("GlxStateManager::launchApplication"); bool activitySuccess = false; //To:Do use it in future once performance code is removed nextState(GLX_GRIDVIEW_ID, ALL_ITEM_S) - HbApplication* app = qobject_cast(qApp); - if(app->activateReason() == Hb::ActivationReasonActivity) { + + if( mActivation->reason() == Af::ActivationReasonActivity ) { activitySuccess = launchActivity(); + qDebug("GlxStateManager::launchApplication as Activity"); } if( !activitySuccess ) { @@ -158,8 +165,8 @@ mTNObserver->startTNObserving() ; } - HbActivityManager* activityManager = app->activityManager(); - bool ok = activityManager->removeActivity("PhotosMainView"); + + bool ok = mActivityStorage->removeActivity("PhotosMainView"); if ( !ok ) { qDebug("launchapplication::Remove activity failed" ); @@ -168,19 +175,17 @@ bool GlxStateManager::launchActivity() { - HbApplication* app = qobject_cast(qApp); - bool ok = app->activityManager()->waitActivity(); - if ( !ok ) - { - qDebug("subscribing to activity manager failed" ); - } - QVariant data = app->activityManager()->activityData( "PhotosMainView" ); + QVariant data = mActivityStorage->activityData("PhotosMainView"); QByteArray serializedModel = data.toByteArray(); QDataStream stream(&serializedModel, QIODevice::ReadOnly); //Fetch the data from the activity Manager stream >> mSaveActivity; - qint32 stateId = mSaveActivity.value("ID"); + + if(!validateActivityData()) + return false; + + qint32 stateId = mSaveActivity.value("ID"); mCurrentState = createState(stateId); mCurrentState->setState( mSaveActivity.value("InternalState") ); createModel( stateId); @@ -193,6 +198,26 @@ return true; } +bool GlxStateManager::validateActivityData() +{ + + if( (mSaveActivity.value("ID") == GLX_GRIDVIEW_ID) || + ( (mSaveActivity.value("ID") == GLX_LISTVIEW_ID) && (mSaveActivity.value("InternalState") == ALL_ITEM_S) ) || + (mSaveActivity.value("VisibleIndex") >= 0 ) ) { + qDebug("GlxStateManager::validation passed"); + return true; + } + + qDebug("GlxStateManager::Validation failed"); + qDebug("VIEW : %u", mSaveActivity.value("ID")); + qDebug("SUB STATE: %u", mSaveActivity.value("InternalState")); + qDebug("Visible Index: %u", mSaveActivity.value("VisibleIndex")); + + return false; + +} + + void GlxStateManager::launchFromExternal() { qDebug("GlxStateManager::launchFromExternal"); @@ -276,7 +301,7 @@ mSaveActivity.insert("VisibleIndex",0); } - HbActivityManager* activityManager = qobject_cast(qApp)->activityManager(); + QVariantHash metadata; HbMainWindow *window = hbInstance->allMainWindows().first(); metadata.insert("screenshot", QPixmap::grabWidget(window, window->rect())); @@ -284,11 +309,11 @@ QByteArray serializedModel; QDataStream stream(&serializedModel, QIODevice::WriteOnly | QIODevice::Append); stream << mSaveActivity; + bool ok = mActivityStorage->saveActivity("PhotosMainView", serializedModel, metadata); - bool ok = activityManager->addActivity("PhotosMainView", serializedModel, metadata); if ( !ok ) { - qDebug("SaveData::Add activity failed" ); + qDebug("SaveData::Save activity failed" ); } } } @@ -794,6 +819,8 @@ cleanAllModel(); mSaveActivity.clear(); delete mActionHandler; + delete mActivation; + delete mActivityStorage; qDebug("GlxStateManager::~GlxStateManager delete Model"); disconnect ( mViewManager, SIGNAL(actionTriggered(qint32 )), this, SLOT(actionTriggered(qint32 )) ); diff -r 45459746d5e8 -r 27f2d7aec52a ui/viewmanagement/statehandler/statehandler.pro --- a/ui/viewmanagement/statehandler/statehandler.pro Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/viewmanagement/statehandler/statehandler.pro Wed Oct 06 14:49:39 2010 +0530 @@ -53,7 +53,8 @@ -lglxcommoncommandhandlers.dll \ -lglxlogging.dll \ -lglxcommon.dll \ - -lglximageviewermanager.dll + -lglximageviewermanager.dll \ + -lafservice.dll # Input diff -r 45459746d5e8 -r 27f2d7aec52a ui/viewmanagement/viewmanager/inc/glxviewmanager.h --- a/ui/viewmanagement/viewmanager/inc/glxviewmanager.h Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/viewmanagement/viewmanager/inc/glxviewmanager.h Wed Oct 06 14:49:39 2010 +0530 @@ -79,7 +79,7 @@ * @param id viewId * @param model model to be used for the view */ - void launchApplication(qint32 id, QAbstractItemModel *model); + void launchApplication( qint32 id, QAbstractItemModel *model ); /** * add back key action @@ -101,27 +101,27 @@ * To update the tool bar enable and disable icon * id = This should be selected toolbar tab id */ - void updateToolBarIcon(int id); + void updateToolBarIcon( int id ); /** * Enable the marking mode of the view to select multiple item */ - void enterMarkingMode(qint32 viewId); + void enterMarkingMode( qint32 viewId, qint32 commandId ); /** * Enable the normal mode of the view */ - void exitMarkingMode(qint32 viewId); + void exitMarkingMode( qint32 viewId ); /** * Pass the user action to the view */ - void handleUserAction(qint32 viewId, qint32 commandId); + void handleUserAction( qint32 viewId, qint32 commandId ); /** * Return the selection model to the user */ - QItemSelectionModel * getSelectionModel(qint32 viewId); + QItemSelectionModel * getSelectionModel( qint32 viewId ); /** * To set the model of current view @@ -132,39 +132,39 @@ /** * emit the user action */ - void actionTriggered(qint32 id); - void externalCommand(int cmdId); + void actionTriggered( qint32 id ); + void externalCommand( int cmdId ); public slots: /** * This public slot is used to launch the view */ - void launchView (qint32 id, QAbstractItemModel *model); + void launchView ( qint32 id, QAbstractItemModel *model ); /** * It is over load slot and used to run the animation for view transition and launch the view */ - void launchView (qint32 id, QAbstractItemModel *model, GlxEffect effect, GlxViewEffect viewEffect); + void launchView ( qint32 id, QAbstractItemModel *model, GlxEffect effect, GlxViewEffect viewEffect ); void launchProgressDialog( int maxValue ); - void updateProgressDialog( int currentValue); + void updateProgressDialog( int currentValue ); /** * It will removed and deleted the view. * Currently It is not used so may be in future, It will be removed. */ - void destroyView (qint32 id); + void destroyView ( qint32 id ); /** * It will pass the user action to the state manager */ - void actionProcess(qint32 id); + void actionProcess( qint32 id ); /** * It will pass the user selected menu action to state manager * check for depricated with actionProcess api */ - void handleMenuAction(qint32 commandId); + void handleMenuAction( qint32 commandId ); /** * It will pass the user action ( tool bar + back ) to state manager @@ -180,7 +180,7 @@ /** * This will open the item specifc Menu */ - void itemSpecificMenuTriggered(qint32,QPointF ); + void itemSpecificMenuTriggered( qint32, QPointF ); void handleReadyView(); @@ -193,12 +193,12 @@ /** * It will create and return the view */ - GlxView * resolveView (qint32 id); + GlxView * resolveView ( qint32 id ); /** * It will find a view from the view list and return it */ - GlxView * findView (qint32 id); + GlxView * findView ( qint32 id ); /** * It will deativate the current view @@ -229,6 +229,11 @@ * It will create the marking mode tool bar */ void createMarkingModeToolBar(); + + /** + * setMarkingToolBarAction() - set the toolbar action text + */ + void setMarkingToolBarAction( qint32 commandId ); /** * It will add all the view manager related connection diff -r 45459746d5e8 -r 27f2d7aec52a ui/viewmanagement/viewmanager/src/glxmenumanager.cpp --- a/ui/viewmanagement/viewmanager/src/glxmenumanager.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/viewmanagement/viewmanager/src/glxmenumanager.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -74,7 +74,7 @@ void GlxMenuManager::addMenu(qint32 viewId, HbMenu* menu) { int curState = viewSubState(); - if( curState == FETCHER_ITEM_S || curState == FETCHER_S || curState == FETCHER_ALBUM_S || curState == IMAGEVIEWER_S) + if( curState == FETCHER_ITEM_S || curState == BROWSE_S || curState == FETCHER_S || curState == FETCHER_ALBUM_S || curState == IMAGEVIEWER_S) return; switch(viewId) { diff -r 45459746d5e8 -r 27f2d7aec52a ui/viewmanagement/viewmanager/src/glxviewmanager.cpp --- a/ui/viewmanagement/viewmanager/src/glxviewmanager.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/viewmanagement/viewmanager/src/glxviewmanager.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -313,15 +313,17 @@ } } -void GlxViewManager::enterMarkingMode(qint32 viewId) +void GlxViewManager::enterMarkingMode( qint32 viewId, qint32 commandId ) { GlxView *view = findView ( viewId ); qDebug("GlxViewManager::enterMarkingMode view ID %d", viewId); - if ( mMarkingToolBar == NULL) { + if ( !mMarkingToolBar ) { createMarkingModeToolBar(); //Marking mode tool bar is different from normal mode tool bar } + setMarkingToolBarAction( commandId ); + if ( view ) { view->enableMarking(); view->takeToolBar(); @@ -336,7 +338,7 @@ qDebug("GlxViewManager::enterMarkingMode view ID %d exit", viewId); } -void GlxViewManager::exitMarkingMode(qint32 viewId) +void GlxViewManager::exitMarkingMode( qint32 viewId ) { GlxView *view = findView ( viewId ); qDebug("GlxViewManager::exitMarkingMode view ID %d", viewId); @@ -597,6 +599,31 @@ createMarkingModeActions(); } +void GlxViewManager::setMarkingToolBarAction( qint32 commandId ) +{ + switch( commandId ) { + case EGlxCmdAddToAlbum : + mMarkingActionList.at( 0 )->setText( GLX_BUTTON_ADD ); + break; + + case EGlxCmdDelete : + mMarkingActionList.at( 0 )->setText( GLX_BUTTON_DELETE ); + break; + + case EGlxCmdRemoveFrom : + mMarkingActionList.at( 0 )->setText( GLX_BUTTON_REMOVE ); + break; + + case EGlxCmdSend : + mMarkingActionList.at( 0 )->setText( GLX_BUTTON_SHARE ); + break; + + default : + mMarkingActionList.at( 0 )->setText( GLX_BUTTON_OK ); + break; + } +} + void GlxViewManager::addConnection() { if ( mMenuManager ) diff -r 45459746d5e8 -r 27f2d7aec52a ui/views/detailsview/inc/glxdetailsviewitemprototype.h --- a/ui/views/detailsview/inc/glxdetailsviewitemprototype.h Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/views/detailsview/inc/glxdetailsviewitemprototype.h Wed Oct 06 14:49:39 2010 +0530 @@ -111,6 +111,9 @@ //Displays the size of the image HbLabel *mSizeLabel; + + //Displays the name of the image in imageviewer + HbLabel *mImgNameLabel; }; #endif // GLXDETAILSVIEWITEMPROTOTYPE_H diff -r 45459746d5e8 -r 27f2d7aec52a ui/views/detailsview/src/glxdetailsview.cpp --- a/ui/views/detailsview/src/glxdetailsview.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/views/detailsview/src/glxdetailsview.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -158,6 +158,9 @@ //Set context mode to fetch descriptions mModel->setData(QModelIndex(), (int) GlxContextComment, GlxContextRole); + + //Set the Layout Correspondingly. + updateLayout(mWindow->orientation()); OstTraceFunctionExit0( GLXDETAILSVIEW_ACTIVATE_EXIT ); } @@ -401,6 +404,7 @@ mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, section, &loaded); showImage(); + updateGeometry(); GLX_LOG_INFO1("GlxDetailsView::updateLayout =%d\n",loaded); } diff -r 45459746d5e8 -r 27f2d7aec52a ui/views/detailsview/src/glxdetailsviewitemprototype.cpp --- a/ui/views/detailsview/src/glxdetailsviewitemprototype.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/views/detailsview/src/glxdetailsviewitemprototype.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -38,7 +38,8 @@ mDescriptionEditor( NULL ), mDateLabel( NULL ), mTimeLabel( NULL ), - mSizeLabel( NULL ) + mSizeLabel( NULL ), + mImgNameLabel( NULL ) { } @@ -53,7 +54,7 @@ case widgetNameIndex: { delete mImageNameEditor; - mImageNameEditor = NULL; + delete mImgNameLabel; break; } @@ -109,10 +110,17 @@ case widgetNameIndex: { - //create the editor - mImageNameEditor = new GlxDetailsTextEdit(this); - mImageNameEditor->setMaxRows(1); - + int substate = modelIndex().data(GlxSubStateRole).toInt(); + if(substate == IMAGEVIEWER_DETAIL_S) + { + mImgNameLabel = new HbLabel(this); + } + else + { + //create the editor + mImageNameEditor = new GlxDetailsTextEdit(this); + mImageNameEditor->setMaxRows(1); + } //retrieve the name from the model QString nameString(GLX_DETAILS_NAME); QVariant nameData = modelIndex().data(GlxUriRole).toString(); @@ -121,16 +129,20 @@ nameString.append(nameData.toString()); } } - mImageNameEditor->setItemText(nameString); + if(substate == IMAGEVIEWER_DETAIL_S) + { + mImgNameLabel->setPlainText(nameString); + mImgNameLabel->setMinimumHeight(size().height() + 50); + } + else + { + mImageNameEditor->setItemText(nameString); + } //Get the sub state of the details view - int substate = modelIndex().data(GlxSubStateRole).toInt(); if (substate != IMAGEVIEWER_DETAIL_S) { connect(mImageNameEditor, SIGNAL(editorTapped()), this, SLOT(forwardSignalsToView())); } - else { - mImageNameEditor->setTextItemReadOnly(TRUE); - } //Connect the Signals const QAbstractItemModel *model = (modelIndex().model()); @@ -139,7 +151,14 @@ //Add the Layout QGraphicsLinearLayout *widgetLayout = new QGraphicsLinearLayout(Qt::Horizontal, 0); widgetLayout->setContentsMargins(CONTENTMARGINS,CONTENTMARGINS,CONTENTMARGINS,CONTENTMARGINS); - widgetLayout->addItem(mImageNameEditor); + if(substate == IMAGEVIEWER_DETAIL_S) + { + widgetLayout->addItem(mImgNameLabel); + } + else + { + widgetLayout->addItem(mImageNameEditor); + } setLayout(widgetLayout); break; } @@ -278,7 +297,8 @@ int widgetIndex = modelIndex().row(); if (widgetIndex == GlxDetailsViewItemProtoType::widgetNameIndex) { - QString nameString(GLX_DETAILS_NAME); + int substate = modelIndex().data(GlxSubStateRole).toInt(); + QString nameString(GLX_DETAILS_NAME); QVariant nameData = modelIndex().data(GlxUriRole).toString(); if (nameData.isValid()) { @@ -286,7 +306,14 @@ nameString.append(nameData.toString()); } } - mImageNameEditor->setItemText(nameString); + if (substate == IMAGEVIEWER_DETAIL_S) + { + mImgNameLabel->setPlainText(nameString); + } + else + { + mImageNameEditor->setItemText(nameString); + } } else { QString descString(GLX_DETAILS_DESCRIPTION); diff -r 45459746d5e8 -r 27f2d7aec52a ui/views/detailsview/src/glxdetailsviewmodelwrapper.cpp --- a/ui/views/detailsview/src/glxdetailsviewmodelwrapper.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/views/detailsview/src/glxdetailsviewmodelwrapper.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -22,6 +22,7 @@ #include //User Includes +#include "glxviewids.h" #include "glxmodelroles.h" //Contains the declaration of the roles used to retrieve the data from model #include "glxlocalisationstrings.h" //contains the localisation strings #include "glxdetailsviewmodelwrapper.h" //contains the declaration of this file/class @@ -54,7 +55,17 @@ int GlxDetailsViewModelWrapper::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent); - return TOTAL_NO_FIELDS_LIST; + int substate = 0; + + if (mModel) { + QVariant variant = mModel->data(mModel->index(0, 0), GlxSubStateRole); + + if (variant.isValid() && variant.canConvert ()) { + substate = variant.value (); + } + } + //If photos app, then show the Description field, from imageviewer app - hide description field + return (substate != IMAGEVIEWER_DETAIL_S)?TOTAL_NO_FIELDS_LIST:(TOTAL_NO_FIELDS_LIST - 1); } //-------------------------------------------------------------------------------------------------------------------------------------------- diff -r 45459746d5e8 -r 27f2d7aec52a ui/views/fullscreenview/inc/glxcoverflow.h --- a/ui/views/fullscreenview/inc/glxcoverflow.h Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/views/fullscreenview/inc/glxcoverflow.h Wed Oct 06 14:49:39 2010 +0530 @@ -150,6 +150,13 @@ */ void zoomFinished( int index ); + /** + * setOrientChangeAnim() - To set the playing status of orientation change animation + * to coverflow. + * @param - focus index. + */ + void setOrientChangeAnim( bool isPlaying ) { mIsOrientChangeAnim = isPlaying ; } + signals : /** * coverFlowEvent() - To emit signal about coverflow event happen like panning, zomming ( For ui off ), @@ -375,6 +382,7 @@ int mTimerId; bool mIsInit; bool mIsAutoMoving; + bool mIsOrientChangeAnim; //To check status of orientation change animation. }; #endif /* GLXCOVERFLOW_H_ */ diff -r 45459746d5e8 -r 27f2d7aec52a ui/views/fullscreenview/src/glxcoverflow.cpp --- a/ui/views/fullscreenview/src/glxcoverflow.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/views/fullscreenview/src/glxcoverflow.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -51,7 +51,8 @@ mZoomOn( false ), mMultitouchFilter( NULL ), mTimerId( 0 ), - mIsInit( false ) + mIsInit( false ), + mIsOrientChangeAnim( false ) { qDebug( "GlxCoverFlow::GlxCoverFlow" ); mIsAutoMoving = FALSE; @@ -174,7 +175,11 @@ { qDebug("GlxCoverFlow::panGesture deltaX= %d", (int)delta.x()); - if( !mIsInit || getSubState() == IMAGEVIEWER_S || getSubState() == FETCHER_S || mIsAutoMoving == TRUE ) { + if( !mIsInit + || !mModel + || getSubState() == IMAGEVIEWER_S + || getSubState() == FETCHER_S + || mIsAutoMoving ) { return; } @@ -186,7 +191,7 @@ mMoveDir = LEFT_MOVE; } - if ( mUiOn == TRUE ) { + if ( mUiOn ) { emit coverFlowEvent( PANNING_START_EVENT ); mUiOn = FALSE; } @@ -197,6 +202,10 @@ Q_UNUSED(endIndex); qDebug("GlxCoverFlow::dataChanged startIndex = %d mSelIndex = %d ", startIndex.row(), mSelIndex ); + if ( mIsOrientChangeAnim ) { + return; + } + int index = 0; for (int i = 0; i < NBR_ICON_ITEM ; i++) { index = calculateIndex( mSelIndex + i - 2 ); @@ -481,7 +490,7 @@ { qDebug("GlxCoverFlow::clearCurrentModel "); if ( mModel ) { - disconnect( mModel, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ), this, SLOT( dataChanged( QModelIndex, QModelIndex ) ) ); + disconnect( mModel, SIGNAL( fullScreenDataChanged( QModelIndex, QModelIndex ) ), this, SLOT( dataChanged( QModelIndex, QModelIndex ) ) ); disconnect( mModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( rowsInserted( QModelIndex, int, int ) ) ); disconnect( mModel, SIGNAL( rowsRemoved( QModelIndex, int, int) ), this, SLOT( rowsRemoved( QModelIndex, int, int ) ) ); disconnect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) ); @@ -493,7 +502,7 @@ { qDebug("GlxCoverFlow::initializeNewModel" ); if ( mModel ) { - connect( mModel, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ), this, SLOT( dataChanged( QModelIndex, QModelIndex ) ) ); + connect( mModel, SIGNAL( fullScreenDataChanged( QModelIndex, QModelIndex ) ), this, SLOT( dataChanged( QModelIndex, QModelIndex ) ) ); connect( mModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( rowsInserted( QModelIndex, int, int ) ) ); connect( mModel, SIGNAL( rowsRemoved( QModelIndex, int, int) ), this, SLOT( rowsRemoved( QModelIndex, int, int ) ) ); connect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) ); diff -r 45459746d5e8 -r 27f2d7aec52a ui/views/fullscreenview/src/glxfullscreenview.cpp --- a/ui/views/fullscreenview/src/glxfullscreenview.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/views/fullscreenview/src/glxfullscreenview.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -218,7 +218,8 @@ cancelSelectionAnimation(); //cancel the image selection effect before cleaning the view //Clean up the rest of the resources allocated cleanUp(); - + //Hide ImageStrip while launching Details view + mImageStrip->hide(); //Clear the 4 icons present in the Coverflow,so that the transition between the views are smooth mCoverFlow->partiallyClean(); @@ -316,13 +317,14 @@ mUiOffTimer->start(KUiOffTime); } setModelContext(); - loadViewSection(); - setLayout(); + loadViewSection(); if ( mZoomWidget->zValue() >= mCoverFlow->zValue() ) { + mZoomWidget->setWindowSize( screenSize() ); playZoomOrientChangeAnim(); } else { + mCoverFlow->setOrientChangeAnim( true ); playOrientChangeAnim(); } @@ -344,7 +346,7 @@ if ( getSubState() != FETCHER_S ) { setViewFlags( viewFlags() | HbView::ViewTitleBarHidden | HbView::ViewStatusBarHidden ); } - if ( mImageStrip && ( getSubState() != IMAGEVIEWER_S && getSubState() != FETCHER_S ) ) { + if ( mImageStrip && ( getSubState() != IMAGEVIEWER_S && getSubState() != FETCHER_S && getSubState() != BROWSE_S) ) { HbEffect::start( mImageStrip, QString("HbGridView"), QString("TapHide"), this, "effectFinished" ); } @@ -544,13 +546,20 @@ mIconItems[ 0 ]->resetTransform(); mIconItems[ 0 ]->setVisible( false ); mBackGroundItem->setVisible( false ); + QSize sz = screenSize(); + mCoverFlow->setOrientChangeAnim( false ); + mCoverFlow->setItemSize( sz ); mCoverFlow->setVisible( true ); mZoomWidget->setVisible( true ); + mZoomWidget->setWindowSize( screenSize() ); } void GlxFullScreenView::zoomOrientChangeAnimFinished( const HbEffect::EffectStatus status ) { - mZoomWidget->resetTransform(); + Q_UNUSED( status ) + mZoomWidget->resetTransform(); + QSize sz = screenSize(); + mCoverFlow->setItemSize( sz ); } void GlxFullScreenView::handleToolBarAction() @@ -647,10 +656,10 @@ { OstTraceFunctionEntry0( GLXFULLSCREENVIEW_ACTIVATEUI_ENTRY ); - if ( mUiOff && getSubState() != FETCHER_S ){ - if( !mFullScreenToolBar ) { - loadFullScreenToolBar(); - } + if ( mUiOff && (!(getSubState() == FETCHER_S || getSubState() == BROWSE_S)) ){ + if( !mFullScreenToolBar ) { + loadFullScreenToolBar(); + } mUiOff = FALSE; QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole ); @@ -672,6 +681,12 @@ mFullScreenToolBar->setOpacity( 1 ); mFullScreenToolBar->show(); } + else if( mUiOff && getSubState() == BROWSE_S){ + mUiOff = FALSE; + setItemVisible( Hb::AllItems, TRUE ); + setViewFlags( viewFlags() &~ HbView::ViewTitleBarHidden &~ HbView::ViewStatusBarHidden ); + mUiOffTimer->start(KUiOffTime); + } else { hideUi(); } diff -r 45459746d5e8 -r 27f2d7aec52a ui/views/gridview/src/glxgridview.cpp --- a/ui/views/gridview/src/glxgridview.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/views/gridview/src/glxgridview.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -341,10 +341,10 @@ if( isItemVisible( Hb::TitleBarItem ) ) { QString text; - if(XQServiceUtil::isService()) { - showAlbumTitle(GLX_SELECT_IMAGE); - } - else if ( getSubState() == ALL_ITEM_S ) { + if(XQServiceUtil::isService() && (0 == XQServiceUtil::interfaceName().compare(QLatin1String("com.nokia.symbian.IImageFetch")))) { + showAlbumTitle(GLX_SELECT_IMAGE); + } + else if ( getSubState() == ALL_ITEM_S || ( getSubState() == FETCHER_ITEM_S)) { if (mAlbumNameHeading) { mAlbumNameHeading->hide(); } @@ -354,7 +354,7 @@ mTotalImagesCount->setGeometry(QRectF(0,0,screenSize.width(),deviceSize.height()/24)); mTotalImagesCount->show(); } - else if ( getSubState() == ALBUM_ITEM_S ) { + else if ( getSubState() == ALBUM_ITEM_S || (getSubState() == FETCHER_ALBUM_ITEM_S)) { mTotalImagesCount->hide(); QVariant variant = mModel->data(mModel->index(0,0),GlxViewTitle); if (variant.toString() != NULL) { @@ -707,12 +707,18 @@ if ( mModel ) { mModel->setData( index, index.row(), GlxFocusIndexRole ); } - if(XQServiceUtil::isService()){ - qDebug("GlxGridView::itemSelected actionTriggered( EGlxCmdFetcherSelect )" ); - emit actionTriggered( EGlxCmdFetcherSelect ); - return; + if(XQServiceUtil::isService() ){ + if(0 == XQServiceUtil::interfaceName().compare(QLatin1String("com.nokia.symbian.IImageFetch"))){ + qDebug("GlxGridView::itemSelected actionTriggered( EGlxCmdFetcherSelect )" ); + emit actionTriggered( EGlxCmdFetcherSelect ); + } + else{ + emit actionTriggered( EGlxCmdBrowseFullScreenOpen); + } } - emit actionTriggered( EGlxCmdFullScreenOpen ); + else{ + emit actionTriggered( EGlxCmdFullScreenOpen ); + } OstTraceEventStop( EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_STOP, "Fullscreen Launch Time", EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_START ); } @@ -755,7 +761,6 @@ return; } mModel->setData( index, index.row(), GlxVisualWindowIndex ); - mModel->setData( index, index.row(), GlxFocusIndexRole ); } } diff -r 45459746d5e8 -r 27f2d7aec52a ui/views/listview/inc/glxlistview.h --- a/ui/views/listview/inc/glxlistview.h Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/views/listview/inc/glxlistview.h Wed Oct 06 14:49:39 2010 +0530 @@ -26,6 +26,7 @@ class HbMainWindow; class HbAbstractViewItem; class HbDocumentLoader; +class HbGroupBox; class GlxListView : public GlxView { @@ -44,6 +45,7 @@ public slots: void itemSelected(const QModelIndex & index); void populated(); + void showAlbumCount(); private slots: void indicateLongPress( HbAbstractViewItem *item, QPointF coords ); @@ -62,6 +64,7 @@ private: HbListView *mListView; HbView *mView; + HbGroupBox *mAlbumCount; HbMainWindow *mWindow; //no ownership QAbstractItemModel *mModel ; HbDocumentLoader *mDocLoader; //Docml loader to load the widgets from docml diff -r 45459746d5e8 -r 27f2d7aec52a ui/views/listview/src/glxlistview.cpp --- a/ui/views/listview/src/glxlistview.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/views/listview/src/glxlistview.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -25,18 +25,22 @@ #include #include #include +#include +#include + //User Includes #include "glxviewids.h" #include "glxlistview.h" #include "glxmodelparm.h" #include "glxdocloaderdefs.h" #include "glxcommandhandlers.hrh" - +#include "glxlocalisationstrings.h" GlxListView::GlxListView(HbMainWindow *window) : GlxView ( GLX_LISTVIEW_ID ), mListView(NULL), mView(NULL), + mAlbumCount(NULL), mWindow(window), mModel ( NULL), mIsLongPress( false ) @@ -64,10 +68,15 @@ qDebug("GlxListView::setModel()"); if ( mModel ) { disconnect(mModel, SIGNAL(listPopulated()), this, SLOT( populated())); + disconnect( mModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( showAlbumCount() ) ); + disconnect( mModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( showAlbumCount() ) ); } mModel = model ; mListView->setModel(mModel); connect(mModel, SIGNAL(listPopulated()), this, SLOT( populated())); + connect( mModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( showAlbumCount() ) ); + connect( mModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( showAlbumCount() ) ); + showAlbumCount(); } void GlxListView::addToolBar( HbToolBar *toolBar ) @@ -139,6 +148,7 @@ //retrieve the widgets mView = static_cast(mDocLoader->findWidget(QString(GLX_LISTVIEW_VIEW))); mListView = static_cast(mDocLoader->findWidget(QString(GLX_LISTVIEW_LIST))); + mAlbumCount = static_cast(mDocLoader->findWidget(QString(GLX_LISTVIEW_ALBUMCOUNT))); if( mListView ) { //sets the widget @@ -168,6 +178,11 @@ removeViewConnection(); + if(mAlbumCount) { + delete mAlbumCount ; + mAlbumCount = NULL; + } + if(mListView) { delete mListView; mListView = NULL; @@ -231,3 +246,9 @@ emit itemSpecificMenuTriggered(viewId(),coords); } +void GlxListView::showAlbumCount() +{ + int albumCnt = mModel->rowCount(); + QString text = HbParameterLengthLimiter(GLX_ALBUM_LIST_COUNT_LABEL, albumCnt); + mAlbumCount->setHeading(text); +} diff -r 45459746d5e8 -r 27f2d7aec52a ui/views/slideshowsettingsview/inc/glxslideshowsettingsview.h --- a/ui/views/slideshowsettingsview/inc/glxslideshowsettingsview.h Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/views/slideshowsettingsview/inc/glxslideshowsettingsview.h Wed Oct 06 14:49:39 2010 +0530 @@ -17,46 +17,47 @@ * */ - #ifndef GLXSLIDESHOWSETTINGSVIEW_H #define GLXSLIDESHOWSETTINGSVIEW_H #include "glxview.h" - //Qt/Orbit forward declarations class HbLabel; class HbView; class HbMainWindow; class HbComboBox; +class HbPushButton; class QAbstractItemModel; class GlxSettingInterface; -class GlxSlideShowSettingsView : public GlxView +class GlxSlideShowSettingsView: public GlxView { - Q_OBJECT +Q_OBJECT -public : - GlxSlideShowSettingsView(HbMainWindow *window); +public: + GlxSlideShowSettingsView( HbMainWindow *window ); ~GlxSlideShowSettingsView(); - void activate() ; + void activate(); void deActivate(); - void setModel (QAbstractItemModel *model); + void setModel( QAbstractItemModel *model ); private slots: - void orientationChanged(Qt::Orientation); - + void orientationChanged( Qt::Orientation ); + void playSlideShow( ); + private: void setLayout(); - + private: - HbComboBox *mEffect; //Drop down box to display transition effect - HbComboBox *mDelay; //Drop down box to display transition delay - HbMainWindow *mWindow; //no ownership - HbLabel *mContextlabel; //Display SlideShow label - HbLabel *mEffectlabel; //Display "Transition Effect: " - HbLabel *mDelaylabel; //Display "Transition delay: " - GlxSettingInterface *mSettings; //no ownership + HbComboBox *mEffect; //Drop down box to display transition effect + HbComboBox *mDelay; //Drop down box to display transition delay + HbMainWindow *mWindow; //no ownership + HbLabel *mContextlabel; //Display SlideShow label + HbLabel *mEffectlabel; //Display "Transition Effect: " + HbLabel *mDelaylabel; //Display "Transition delay: " + HbPushButton *mPlaySlideShow; //For playing slide show + GlxSettingInterface *mSettings; //no ownership }; #endif /* GLXGRIDVIEW_H_ */ diff -r 45459746d5e8 -r 27f2d7aec52a ui/views/slideshowsettingsview/src/glxslideshowsettingsview.cpp --- a/ui/views/slideshowsettingsview/src/glxslideshowsettingsview.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/views/slideshowsettingsview/src/glxslideshowsettingsview.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -15,12 +15,12 @@ * */ - - //Includes #include #include #include +#include +#include #include //User Includes @@ -29,20 +29,21 @@ #include "glxslideshowsettingsview.h" #include "glxsettinginterface.h" #include "glxlocalisationstrings.h" - +#include "glxcommandhandlers.hrh" -GlxSlideShowSettingsView::GlxSlideShowSettingsView(HbMainWindow *window) - : GlxView ( GLX_SLIDESHOWSETTINGSVIEW_ID ), - mEffect(NULL), - mDelay(NULL), - mWindow(window), - mContextlabel (NULL), - mEffectlabel (NULL), - mDelaylabel (NULL), +GlxSlideShowSettingsView::GlxSlideShowSettingsView( HbMainWindow *window ) + : GlxView( GLX_SLIDESHOWSETTINGSVIEW_ID ), + mEffect( NULL ), + mDelay( NULL ), + mWindow( window ), + mContextlabel( NULL ), + mEffectlabel( NULL ), + mDelaylabel( NULL ), + mPlaySlideShow( NULL ), mSettings( NULL ) { - mSettings = GlxSettingInterface::instance() ; - setContentFullScreen( true ); + mSettings = GlxSettingInterface::instance(); + setContentFullScreen( true ); } GlxSlideShowSettingsView::~GlxSlideShowSettingsView() @@ -52,54 +53,66 @@ delete mDelaylabel; delete mEffect; delete mDelay; + delete mPlaySlideShow; } -void GlxSlideShowSettingsView::setModel(QAbstractItemModel *model) +void GlxSlideShowSettingsView::setModel( QAbstractItemModel *model ) { Q_UNUSED( model ) return; } -void GlxSlideShowSettingsView::orientationChanged(Qt::Orientation) +void GlxSlideShowSettingsView::orientationChanged( Qt::Orientation ) { setLayout(); } +void GlxSlideShowSettingsView::playSlideShow() +{ + emit actionTriggered( EGlxCmdSelectSlideshow ); +} + void GlxSlideShowSettingsView::activate() { - connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation))); + connect( mWindow, SIGNAL( orientationChanged( Qt::Orientation ) ), this, SLOT( orientationChanged( Qt::Orientation ) ) ); if ( mContextlabel == NULL ) { mContextlabel = new HbLabel( GLX_MENU_SLIDESHOW, this ); mContextlabel->setObjectName( "SlideShow" ); } - + if ( mEffectlabel == NULL ) { mEffectlabel = new HbLabel( GLX_LABEL_TRANSITION_EFFECT, this ); mEffectlabel->setObjectName( "Effect" ); } - + if ( mEffect == NULL ) { - mEffect = new HbComboBox(this); + mEffect = new HbComboBox( this ); QStringList effectList = mSettings->slideShowEffectList(); - mEffect->addItems( effectList ); + mEffect->addItems( effectList ); mEffect->setObjectName( "Effect List" ); } - + if ( mDelaylabel == NULL ) { mDelaylabel = new HbLabel( GLX_LABEL_TRANSITION_DELAY, this ); mDelaylabel->setObjectName( "Delay" ); } - + if ( mDelay == NULL ) { - mDelay = new HbComboBox(this); + mDelay = new HbComboBox( this ); mDelay->setObjectName( "Delay List" ); QStringList delayList; - delayList << GLX_VAL_SLOW << GLX_VAL_MEDIUM << GLX_VAL_FAST ; + delayList << GLX_VAL_SLOW << GLX_VAL_MEDIUM << GLX_VAL_FAST; mDelay->addItems( delayList ); } - - // Read the values from the cenrep + + if ( mPlaySlideShow == NULL ) { + mPlaySlideShow = new HbPushButton( this ); + mPlaySlideShow->setText( GLX_BUTTON_PLAY ) ; + connect( mPlaySlideShow, SIGNAL( clicked( bool ) ), this, SLOT( playSlideShow() ) ); + } + + // Read the values from the cenrep mEffect->setCurrentIndex( mSettings->slideShowEffectIndex() ); mDelay->setCurrentIndex( mSettings->slideShowDelayIndex() ); setLayout(); @@ -108,19 +121,25 @@ void GlxSlideShowSettingsView::setLayout() { QSize sz = screenSize(); - - mContextlabel->setGeometry( 5, 25, sz.width() - 50, 100); - mEffectlabel->setGeometry(5, 75, sz.width() - 50, 100 ); - mEffect->setGeometry(15, 150, sz.width() - 50, 100 ); - mDelaylabel->setGeometry(5, 180, sz.width() - 50, 100 ); - mDelay->setGeometry(15, 255, sz.width() - 50, 100 ); + + mContextlabel->setGeometry( 5, 25, sz.width() - 50, 100 ); + mEffectlabel->setGeometry( 5, 60, sz.width() - 50, 100 ); + mEffect->setGeometry( 15, 130, sz.width() - 50, 100 ); + mDelaylabel->setGeometry( 5, 160, sz.width() - 50, 100 ); + mDelay->setGeometry( 15, 230, sz.width() - 50, 100 ); + if( mWindow->orientation() == Qt::Vertical ) { + mPlaySlideShow->setGeometry( 120, 300, 120, 60 ); + } + else { + mPlaySlideShow->setGeometry( 260, 300, 120, 60 ); + } } void GlxSlideShowSettingsView::deActivate() { - //Store the current effect and delay before going back to the previous view - mSettings->setslideShowEffectIndex( mEffect->currentIndex() ); - mSettings->setSlideShowDelayIndex( mDelay->currentIndex() ); + //Store the current effect and delay before going back to the previous view + mSettings->setslideShowEffectIndex( mEffect->currentIndex() ); + mSettings->setSlideShowDelayIndex( mDelay->currentIndex() ); disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation))); } diff -r 45459746d5e8 -r 27f2d7aec52a ui/views/slideshowview/src/glxslideshowwidget.cpp --- a/ui/views/slideshowview/src/glxslideshowwidget.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/views/slideshowview/src/glxslideshowwidget.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -424,7 +424,7 @@ { TRACER ( "GlxSlideShowWidget::clearCurrentModel( ) "); if ( mModel ) { - disconnect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); + disconnect( mModel, SIGNAL( fullScreenDataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); disconnect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInserted(QModelIndex,int,int))); disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); disconnect(mModel, SIGNAL(destroyed()), this, SLOT( modelDestroyed())); @@ -436,7 +436,7 @@ { TRACER("GlxSlideShowWidget::initializeNewModel" ); if ( mModel ) { - connect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); + connect( mModel, SIGNAL( fullScreenDataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInserted(QModelIndex,int,int))); connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); connect(mModel, SIGNAL(destroyed()), this, SLOT( modelDestroyed())); diff -r 45459746d5e8 -r 27f2d7aec52a ui/widgets/glxzoomwidget/src/glxzoomwidget.cpp --- a/ui/widgets/glxzoomwidget/src/glxzoomwidget.cpp Mon Sep 27 15:13:20 2010 +0530 +++ b/ui/widgets/glxzoomwidget/src/glxzoomwidget.cpp Wed Oct 06 14:49:39 2010 +0530 @@ -95,7 +95,7 @@ { mModel = model; retreiveFocusedImage(); //Update mZoomItem with focused Image - connect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); + connect( mModel, SIGNAL( fullScreenDataChanged( QModelIndex, QModelIndex ) ), this, SLOT( dataChanged( QModelIndex, QModelIndex ) ) ); connect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) ); } } @@ -139,7 +139,7 @@ { disconnect(this,SIGNAL( pinchGestureReceived(int) ), this, SLOT( sendDecodeRequest(int) ) ); if(mModel) { - disconnect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); + disconnect( mModel, SIGNAL( fullScreenDataChanged( QModelIndex, QModelIndex ) ), this, SLOT( dataChanged( QModelIndex, QModelIndex ) ) ); disconnect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) ); mModel = NULL; }