# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1283256365 -10800 # Node ID 491b3ed49290e51a6af910bd7d502d2fa8e6ad28 # Parent 95243422089afa49cb71304065be508ea2d565f3 Revision: 201033 Kit: 201035 diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncDmAdapter/data/DevEncUiDmAdapter.rss --- a/deviceencryption/DevEncDmAdapter/data/DevEncUiDmAdapter.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2005 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: Registery info for the Camera Control DM Adapter. -* -*/ - -// INCLUDES -#include -#include "DevEncUids.hrh" -//#include // for KSmlDMInterfaceUid - -// CONSTANTS - -// MACROS - -// RESOURCE DEFINITIONS - -//----------------------------------------------------------------------------- -// -// theInfo -// - -// -//----------------------------------------------------------------------------- -// -RESOURCE REGISTRY_INFO theRegistryInfo - { - dll_uid = KDevEncOmaDmPluginUid; // The DLL's 3rd UID. - interfaces = - { - INTERFACE_INFO - { - interface_uid = 0x102018B4; //KSmlDMInterfaceUid - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = KDevEncOmaDmPluginImplUid; - version_no = 1; - display_name = "Device Encryption DM Adapter"; - default_data = ""; - opaque_data = ""; - } - }; - } - }; - } - -// End Of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncDmAdapter/group/DevEncUiDmAdapter.mmp --- a/deviceencryption/DevEncDmAdapter/group/DevEncUiDmAdapter.mmp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2005 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 "../inc/DevEncUids.hrh" - - -TARGET devencuidmadapter.dll -TARGETTYPE PLUGIN -CAPABILITY CAP_ECOM_PLUGIN CAP_GENERAL_DLL -UID 0x10009D8D KDevEncOmaDmPluginUid -VENDORID VID_DEFAULT -LANG SC - -SOURCEPATH ../../common -SOURCE DevEncLog.cpp -SOURCEPATH ../src -SOURCE DevEncAdapter.cpp -SOURCE DevEncAdapterImp.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../common - -APP_LAYER_SYSTEMINCLUDE - -SYSTEMINCLUDE /epoc32/include/swi -SYSTEMINCLUDE /epoc32/include/ecom - -START RESOURCE ../data/DevEncUiDmAdapter.rss -TARGET devencuidmadapter.rsc -END - -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY centralrepository.lib -LIBRARY dmutil.lib -STATICLIBRARY dmutils.lib -LIBRARY charconv.lib -LIBRARY devenccommonutils.lib -DEBUGLIBRARY flogger.lib - - -// End Of File - - diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncDmAdapter/group/bld.inf --- a/deviceencryption/DevEncDmAdapter/group/bld.inf Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +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: Provides the information required for building DevEncDmAdapter. -* -*/ -//#ifdef FF_NATIVE_FILE_ENCRYPTION - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -// ROM files - -// Exported headers - -// Central repository files - -PRJ_MMPFILES -DevEncUiDmAdapter.mmp - -//#endif - -// End of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncDmAdapter/inc/DevEncAdapter.h --- a/deviceencryption/DevEncDmAdapter/inc/DevEncAdapter.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,450 +0,0 @@ -/* -* Copyright (c) 2005 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: Camera Control DM Adapter. -* -*/ -#ifndef __DEVENCADAPTER_H -#define __DEVENCADAPTER_H - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include - -enum TDevEncCommand - { - EDmDecrypt = 0, - EDmEncryptDefault, - EDmEncryptBackup, - EDmEncryptRestore - }; - - -// CLASS DECLARATION - -/** -* Adapter class -* Provides DM adapter interface -*/ -class CDevEncAdapter : public CSmlDmAdapter - { - - public: // Constructors, destructor - /** - * Create instance of CDevEncAdapter - * @param aDmCallBack - * @return Instance of CDevEncAdapter - */ - static CDevEncAdapter* NewL( MSmlDmCallback* aDmCallback ); - - /** - * Create instance of CDevEncAdapter - * @param aDmCallBack - * @return Instance of CDevEncAdapter - */ - static CDevEncAdapter* NewLC( MSmlDmCallback* aDmCallback ); - - /** - * C++ Destructor - */ - virtual ~CDevEncAdapter(); - - public: - /** - * The function returns current version of the DDF. - * By asking current DDF versions from adapters DM Module can control - * possible changes in the data structure and send the changed DDF - * description to a management server. - * This function is always called after DDFStructureL. - * @param aVersion DDF version of the adapter. (filled by the adapter) - * @publishedPartner - * @prototype - */ - void DDFVersionL( CBufBase& aVersion ); - - /** - * The function for filling the DDF structure of the adapter - * This function is only called once, immediately after the adapter is created. - * @param aDDFObject Reference to root object. A DM adapter starts filling - the data structure by calling AddChildObjectL to the root object and - so describes the DDF of the adapter. - * @publishedPartner - * @prototype - */ - void DDFStructureL( MSmlDmDDFObject& aDDF ); - - /** - * The function creates new leaf objects, or replaces data in existing leaf - * objects. The information about the success of the command should be - * returned by calling SetStatusL function of MSmlDmCallback callback - * interface. This makes it possible to buffer the commands. However, all - * the status codes for buffered commands must be returned at the latest when - * the adapter's CompleteOutstandingCmdsL() is called. - * @param aURI URI of the object - * @param aLUID LUID of the object (if the adapter has earlier returned a - LUID to the DM Module). For new objects, this is the LUID - inherited through the parent node. - * @param aObject Data of the object. - * @param aType MIME type of the object - * @param aStatusRef Reference to correct command, i.e. this reference - must be used when calling the SetStatusL of this command - * @publishedPartner - * @prototype - */ - void UpdateLeafObjectL( const TDesC8& aURI, - const TDesC8& aLUID, - const TDesC8& aObject, - const TDesC8& aType, - TInt aStatusRef - ); - - /** - * The function creates new leaf objects, or replaces data in existing leaf - * objects, in the case where data is large enough to be streamed. The - * information about the success of the command should be returned by calling - * SetStatusL function of MSmlDmCallback callback interface. This makes it - * possible to buffer the commands. However, all the status codes for buffered - * commands must be returned at the latest when the CompleteOutstandingCmdsL() - * of adapter is called. - * @param aURI URI of the object - * @param aLUID LUID of the object (if the adapter has earlier returned a - LUID to the DM Module). For new objects, this is the LUID - inherited through the parent node. - * @param aStream Data of the object. Adapter should create write stream - and return, when data is written to stream by DM agent, - StreamCommittedL() is called by DM engine - * @param aType MIME type of the object - * @param aStatusRef Reference to correct command, i.e. this reference - must be used when calling the SetStatusL of this - command. - * @publishedPartner - * @prototype - */ - void UpdateLeafObjectL( const TDesC8& aURI, - const TDesC8& aLUID, - RWriteStream*& aStream, - const TDesC8& aType, - TInt aStatusRef - ); - - /** - * The function deletes an object and its child objects. The SetStatusL - * should be used as described in UpdateLeafObjectL() - * @param aURI URI of the object - * @param aLUID LUID of the object (if the adapter have earlier returned - LUID to the DM Module). - * @param aStatusRef Reference to correct command, i.e. this reference must - be used when calling the SetStatusL of this command. - * @publishedPartner - * @prototype - */ - void DeleteObjectL( const TDesC8& aURI, - const TDesC8& aLUID, - TInt aStatusRef - ); - - /** - * The function fetches data of a leaf object. The SetStatusL should be used - * as described in UpdateLeafObjectL(). The data is returned by using the - * SetResultsL function of MSmlCallback callback interface, and may be streamed. - * @param aURI URI of the object - * @param aLUID LUID of the object (if the adapter have earlier - returned LUID to the DM Module). - * @param aType MIME type of the object - * @param aResultsRef Reference to correct results, i.e. this reference - must be used when returning the result by calling - the SetResultsL. - * @param aStatusRef Reference to correct command, i.e. this reference - must be used when calling the SetStatusL of this - command. - * @publishedPartner - * @prototype - */ - void FetchLeafObjectL( const TDesC8& aURI, - const TDesC8& aLUID, - const TDesC8& aType, - TInt aResultsRef, - TInt aStatusRef - ); - - /** - * The function fetches the size of the data of a leaf object. The size is - * in bytes, and must reflect the number of bytes that will be transferred - * when the framework calls FetchLeafObjectL. The SetStatusL should be used - * as described in FetchLeafObjectL(). The size value is returned by using - * the SetResultsL function of MSmlCallback callback interface, and must be - * a decimal integer expressed as a string, eg. "1234". - * Results from this call MUST NOT be streamed. - * @param aURI URI of the object - * @param aLUID LUID of the object (if the adapter have earlier - returned LUID to the DM Module). - * @param aType MIME type of the object - * @param aResultsRef Reference to correct results, i.e. this reference - must be used when returning the result by calling - the SetResultsL. - * @param aStatusRef Reference to correct command, i.e. this reference - must be used when calling the SetStatusL of this - command. - * @publishedPartner - * @prototype - */ - void FetchLeafObjectSizeL( const TDesC8& aURI, - const TDesC8& aLUID, - const TDesC8& aType, - TInt aResultsRef, - TInt aStatusRef - ); - /** - * The function fetches URI list. An adapter returns the list of URI segments - * under the given URI be separated by slash ("/"). The URI segment names for - * new objects must be given by the adapter. - * The list is returned by calling the SetResultsL function of MSmlCallback - * callback interface. Results from this call MUST NOT be streamed. - * @param aParentURI URI of the parent object - * @param aParentLUID LUID of the parent object (if the - adapter have earlier returned LUID to - the DM Module). - * @param aPreviousURISegmentList URI list with mapping LUID information, - which is known by DM engine. An adapter - can use this information when verifying - if old objects still exists. An adapter - also knows what objects are new to DM - engine and can provide LUID mapping for - them. aPreviousURISegmentList parameter - (see above) helps to recognise new - objects. - * @param aResultsRef Reference to correct results, i.e. this - reference must be used when returning - the result by calling the SetResultsL. - * @param aStatusRef Reference to correct command, i.e. this - reference must be used when calling the - SetStatusL of this command. - * @publishedPartner - * @prototype - */ - void ChildURIListL( const TDesC8& aURI, - const TDesC8& aLUID, - const CArrayFix& aPreviousURISegmentList, - TInt aResultsRef, - TInt aStatusRef - ); - - /** - * The function adds node object. In some cases an implementation of the - * function may be empty function, if the node object does not need concrete - * database update. Still this function may be helpful to an adapter, i.e. in - * passing mapping LUID of the node to DM Module. The SetStatusL should be - * used as described in UpdateLeafObjectL() - * @param aURI URI of the object - * @param aParentLUID LUID of the parent object (if the adapter have - earlier returned LUID to the DM Module). - * @param aStatusRef Reference to correct command, i.e. this reference - must be used when calling the SetStatusL of this - command. - * @publishedPartner - * @prototype - */ - void AddNodeObjectL( const TDesC8& aURI, - const TDesC8& aParentLUID, - TInt aStatusRef - ); - - /** - * The function implements execute command. The information about the success - * of the command should be returned by calling SetStatusL function of - * MSmlDmCallback callback interface. This makes it possible to buffer the - * commands. - * However, all the status codes for buffered commands must be returned at - * the latest when the CompleteOutstandingCmdsL() of adapter is called. - * @param aURI URI of the command - * @param aLUID LUID of the object (if the adapter have earlier - returned LUID to the DM Module). - * @param aArgument Argument for the command - * @param aType MIME type of the object - * @param aStatusRef Reference to correct command, i.e. this reference - must be used when calling the SetStatusL of this - command. - * @publishedPartner - * @prototype - */ - void ExecuteCommandL( const TDesC8& aURI, - const TDesC8& aLUID, - const TDesC8& aArgument, - const TDesC8& aType, - TInt aStatusRef - ); - - /** - * The function implements execute command. The information about the - * success of the command should be returned by calling SetStatusL function - * of MSmlDmCallback callback interface. This makes it possible to buffer the - * commands. - * However, all the status codes for buffered commands must be returned at - * the latest when the CompleteOutstandingCmdsL() of adapter is called. - * @param aURI URI of the command - * @param aLUID LUID of the object (if the adapter have earlier - returned LUID to the DM Module). - * @param aStream Argument for the command. Adapter should create - write stream and return, when data is written to - stream by DM agent, StreamCommittedL() is called by - DM engine - * @param aType MIME type of the object - * @param aStatusRef Reference to correct command, i.e. this reference - must be used when calling the SetStatusL of this - command. - * @publishedPartner - * @prototype - */ - void ExecuteCommandL( const TDesC8& aURI, - const TDesC8& aLUID, - RWriteStream*& aStream, - const TDesC8& aType, - TInt aStatusRef - ); - - /** - * The function implements copy command. The information about the success of - * the command should be returned by calling SetStatusL function of - * MSmlDmCallback callback interface. This makes it possible to buffer the - * commands. - * However, all the status codes for buffered commands must be returned at - * the latest when the CompleteOutstandingCmdsL() of adapter is called. - * @param aTargetURI Target URI for the command - * @param aSourceLUID LUID of the target object (if one exists, and if the adapter - has earlier returned a LUID to the DM Module). - * @param aSourceURI Source URI for the command - * @param aSourceLUID LUID of the source object (if the adapter has - earlier returned a LUID to the DM Module). - * @param aType MIME type of the objects - * @param aStatusRef Reference to correct command, i.e. this reference - must be used when calling the SetStatusL of this - command. - * @publishedPartner - * @prototype - */ - void CopyCommandL( const TDesC8& aTargetURI, - const TDesC8& aTargetLUID, - const TDesC8& aSourceURI, - const TDesC8& aSourceLUID, - const TDesC8& aType, - TInt aStatusRef - ); - - /** - * The function indicates start of Atomic command. - * @publishedPartner - * @prototype - */ - void StartAtomicL(); - - /** - * The function indicates successful end of Atomic command. The adapter - * should commit all changes issued between StartAtomicL() and - * CommitAtomicL() - * @publishedPartner - * @prototype - */ - void CommitAtomicL(); - - /** - * The function indicates unsuccessful end of Atomic command. The adapter - * should rollback all changes issued between StartAtomicL() and - * RollbackAtomicL(). If rollback fails for a command, adapter should use - * SetStatusL() to indicate it. - * @publishedPartner - * @prototype - */ - void RollbackAtomicL(); - - /** - * Returns ETrue if adapter supports streaming otherwise EFalse. - * @param aItemSize size limit for stream usage - * @return TBool ETrue for streaming support - * @publishedPartner - * @prototype - */ - TBool StreamingSupport( TInt& aItemSize ); - - /** - * Called when stream returned from UpdateLeafObjectL or ExecuteCommandL has - * been written to and committed. Not called when fetching item. - * @publishedPartner - * @prototype - */ - void StreamCommittedL(); - - /** - * The function tells the adapter that all the commands of the message that - * can be passed to the adapter have now been passed. This indicates that - * the adapter must supply status codes and results to any buffered commands. - * This must be done at latest by the time this function returns. - * This function is used at the end of SyncML messages, and during processing - * of Atomic. In the case of Atomic processing, the function will be - * followed by a call to CommitAtomicL or RollbackAtomicL. - * @publishedPartner - * @prototype - */ - void CompleteOutstandingCmdsL(); - - private: // New methods - void FillNodeInfoL( MSmlDmDDFObject& aDDFObject, - TSmlDmAccessTypes& aAccessTypes, - MSmlDmDDFObject::TScope aScope, - MSmlDmDDFObject::TDFFormat aFormat, - MSmlDmDDFObject::TOccurence aOccurence, - const TDesC8& aDescription, - const TDesC8& aMIMEType ); - - TPtrC8 CDevEncAdapter::LastURISeg( const TDesC8& aURI ); - - HBufC8* CDevEncAdapter::AskPassWordL(); - - TBool CheckBatteryL(); - - private: // Constructor - /** - * Symbian 2nd phase constructor - */ - void ConstructL(); - - /** - * C++ Constructor - */ - CDevEncAdapter( TAny* aEcomArguments ); - - private: // Data - CDevEncDiskUtils* iDiskUtils; - CDevEncKeyUtils* iKeyUtils; - CDevEncSession* iPhoneMemorySession; - CDevEncSession* iMemoryCardSession; - TInt iStatusRef; - TInt iResultRef; - HBufC8* iPkcs5Key; - CRepository* iUiCenRep; - TBool iPhoneMemOpPending; - TBool iMemCardOpPending; - TInt iPendingCommand; - RTimer iTimer; - - }; - -#endif // __CDevEncAdapter_H - -// End Of File - diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncDmAdapter/inc/DevEncUids.hrh --- a/deviceencryption/DevEncDmAdapter/inc/DevEncUids.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2005 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: Uids of components related to Device Encryption. -* -*/ -#ifndef DEVENCUIUIDS_HRH -#define DEVENCUIUIDS_HRH - -#define KDevEncUiUid 0x2000259A -#define KDevEncStarterUid 0x2000259B -#define KDevEncOmaDmPluginUid 0x200025B5 -#define KDevEncOmaDmPluginImplUid 0x200025BB -#define KDevEncRfsPluginUid 0x200025B6 -#define KDevEncRfsPluginImplUid 0x200025BC -#define KDevEncCommonUtilsUid 0x200025B7 -#define KDevEncNotifPluginUid 0x20002672 -#define KDevEncNotifPluginImplUid 0x20002673 -#define KDevEncPasswdDlgUid 0x20002674 - -#define KDevEncNokiaVID 0x70000001 - -#endif // DEVENCUIUIDS_HRH - -// End of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncDmAdapter/sis/DevEncDmAdapter.pkg --- a/deviceencryption/DevEncDmAdapter/sis/DevEncDmAdapter.pkg Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -; -; 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: -; -; DevEncDmAdapter.pkg -; -;Language - standard language definitions -&EN - -;Standard SIS file header (use UI application UID) -#{"DevEncUiDmAdapter"},(0x200025B5),1,0,0 - -;Localised Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -;Supports Series 60 v 3.0 -[0x101F7961], 0, 0, 0, {"Series60ProductID"} - -;Files to install - -;---------------------------------------------------------------------------- -; Device Encryption Device Management Adapter -;---------------------------------------------------------------------------- -"\epoc32\release\armv5\urel\DevEncUiDmAdapter.dll" -"!:\sys\bin\DevEncUiDmAdapter.dll" -"\epoc32\data\z\resource\plugins\DevEncUiDmAdapter.rsc" -"!:\resource\plugins\DevEncUiDmAdapter.rsc" diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncDmAdapter/src/DevEncAdapter.cpp --- a/deviceencryption/DevEncDmAdapter/src/DevEncAdapter.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1084 +0,0 @@ -/* -* Copyright (c) 2005 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: SW Installer DM Adapter. -* -*/ - -// INCLUDE -#include -#include -#include -#include -#include // For power state -#include -#include -#include "DevEncLog.h" -#include "DevEncAdapter.h" -#include "DevEncUids.hrh" - - -// CONSTANTS -_LIT8( KIntType,"int" ); // Leaf inputs -_LIT8( KTextType,"text/plain" ); // Leaf inputs -_LIT8( KDevEncAdapterVersion, "1.0" ); // Adapter version -_LIT8( KDevEncRootNode, "DevEnc" ); // root URI -_LIT8( KPhoneMemoryCmdNode, "PhoneMemoryCmd" ); // URI postfix -_LIT8( KMemoryCardCmdNode, "MemoryCardCmd" ); // URI postfix -_LIT8( KPhoneMemoryStatusNode, "PhoneMemoryStatus" ); // URI postfix -_LIT8( KMemoryCardStatusNode, "MemoryCardStatus" ); // URI postfix -_LIT8( KMemoryCardEncKeyNode, "MemoryCardEncKey" ); // URI postfix -_LIT8( KUIStateNode, "UIState" ); // URI postfix -_LIT8( KPhoneMemoryProgNode, "PhoneMemoryProgress" ); // URI postfix -_LIT8( KMemoryCardProgNode, "MemoryCardProgress" ); // URI postfix -_LIT8( KPhoneMemoryCmdDescription, "Phone memory encryption command" ); // Description -_LIT8( KMemoryCardCmdDescription, "Memory card encryption command" ); // Description -_LIT8( KPhoneMemoryStatusDescription, "Phone memory encryption status" ); // Description -_LIT8( KMemoryCardStatusDescription, "Memory card encryption status" ); // Description -_LIT8( KMemoryCardEncKeyDescription, "Memory card encryption key" ); // Description -_LIT8( KUIStateDescription, "State of encryption settings" ); // Description -_LIT8( KPhoneMemoryProgDescription, "En/Decryption progress in percents (phone)" ); // Description -_LIT8( KMemoryCardProgDescription, "En/Decryption progress in percents (memory card)" ); // Description -_LIT8( KSeparator, "/" ); - -static const TUint32 KSizeOfSettingId = 16; // Contanst size declaration -static const TInt KBufGranularity = 8; -static const TDriveNumber KPhoneMemoryDriveNum = EDriveC; -static const TDriveNumber KMemoryCardDriveNum = EDriveF; -static const TUid KPSCategory = { 0x101F9A02 }; // DM client SID -static const TInt KPkcs5PSKey = KDevEncOmaDmPluginImplUid; - -// ============================= MEMBER FUNCTIONS ============================= - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::NewL -// Symbian 1st phase contructor -// (static, may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -CDevEncAdapter* CDevEncAdapter::NewL( MSmlDmCallback* aCallback ) - { - CDevEncAdapter* self = NewLC( aCallback ); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::NewLC -// Symbian 1st phase contructor. Push object to cleanup-stack -// (static, may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -CDevEncAdapter* CDevEncAdapter::NewLC( MSmlDmCallback* aCallback ) - { - CDevEncAdapter* self = new ( ELeave ) CDevEncAdapter( aCallback ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::CDevEncAdapter() -// C++ Constructor -// Status : Draft -// ---------------------------------------------------------------------------- -CDevEncAdapter::CDevEncAdapter( TAny* aEcomArguments ) - : CSmlDmAdapter::CSmlDmAdapter( aEcomArguments ), - iPhoneMemOpPending( EFalse ), - iMemCardOpPending( EFalse ) - { - DFLOG( "CDevEncAdapter Constructor" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::ConstructL -// 2nd phase contructor -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::ConstructL() - { - DFLOG( "CDevEncAdapter::ConstructL Begin" ); - iDiskUtils = new (ELeave) CDevEncDiskUtils(); - iKeyUtils = new (ELeave) CDevEncKeyUtils(); - iPhoneMemorySession = new (ELeave) CDevEncSession( KPhoneMemoryDriveNum ); - iMemoryCardSession = new (ELeave) CDevEncSession( KMemoryCardDriveNum ); - User::LeaveIfError(iPhoneMemorySession->Connect()); - User::LeaveIfError(iMemoryCardSession->Connect()); - iTimer.CreateLocal(); - iUiCenRep = CRepository::NewL( TUid::Uid( KCRDevEncUiSettings ) ); - DFLOG( "CDevEncAdapter::ConstructL End" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::~CDevEncAdapter() -// C++ Destructor -// Status : Draft -// ---------------------------------------------------------------------------- -// -CDevEncAdapter::~CDevEncAdapter() - { - DFLOG( "CDevEncAdapter Destructor Begin" ); - if (iDiskUtils) - { - delete iDiskUtils; - iDiskUtils = NULL; - } - - if (iKeyUtils) - { - delete iKeyUtils; - iKeyUtils = NULL; - } - - if (iPhoneMemorySession) - { - iPhoneMemorySession->Close(); - delete iPhoneMemorySession; - iPhoneMemorySession = NULL; - } - - if (iMemoryCardSession) - { - iMemoryCardSession->Close(); - delete iMemoryCardSession; - iMemoryCardSession = NULL; - } - - if ( iPkcs5Key ) - { - delete iPkcs5Key; - iPkcs5Key = NULL; - } - if (iTimer.Handle()) - iTimer.Close(); - - if (iUiCenRep) - { - delete iUiCenRep; - iUiCenRep = NULL; - } - DFLOG( "CDevEncAdapter Destructor End" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::DDFVersionL -// Return DM plug-in version -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::DDFVersionL( CBufBase& aDDFVersion ) - { - // Insert version information - DFLOG( "CDevEncAdapter::DDFVersionL Begin" ); - aDDFVersion.InsertL( 0, KDevEncAdapterVersion ); - DFLOG( "CDevEncAdapter::DDFVersionL End" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::DDFStructureL -// Return DM plug-in structure -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) - { - // Declare accesses - DFLOG( "CDevEncAdapter::DDFStructureL Begin" ); - TSmlDmAccessTypes accessTypes; - accessTypes.SetGet(); - - // Create root node - MSmlDmDDFObject& root = aDDF.AddChildObjectL( KDevEncRootNode ); - FillNodeInfoL( root, - accessTypes, - MSmlDmDDFObject::EPermanent, - MSmlDmDDFObject::ENode, - MSmlDmDDFObject::EOne, - KNullDesC8(), - KNullDesC8() ); - - // Create leaf nodes - - accessTypes.Reset(); - accessTypes.SetReplace(); // Command nodes are write-only - - MSmlDmDDFObject& node1 = root.AddChildObjectL( KPhoneMemoryCmdNode ); - FillNodeInfoL( node1, - accessTypes, - MSmlDmDDFObject::EPermanent, - MSmlDmDDFObject::EInt, - MSmlDmDDFObject::EOne, - KPhoneMemoryCmdDescription, - KIntType ); - - MSmlDmDDFObject& node2 = root.AddChildObjectL( KMemoryCardCmdNode ); - FillNodeInfoL( node2, - accessTypes, - MSmlDmDDFObject::EPermanent, - MSmlDmDDFObject::EInt, - MSmlDmDDFObject::EOne, - KMemoryCardCmdDescription, - KIntType ); - - accessTypes.Reset(); - accessTypes.SetGet(); // Status nodes are read-only - - MSmlDmDDFObject& node3 = root.AddChildObjectL( KPhoneMemoryStatusNode ); - FillNodeInfoL( node3, - accessTypes, - MSmlDmDDFObject::EPermanent, - MSmlDmDDFObject::EInt, - MSmlDmDDFObject::EOne, - KPhoneMemoryStatusDescription, - KIntType ); - - MSmlDmDDFObject& node4 = root.AddChildObjectL( KMemoryCardStatusNode ); - FillNodeInfoL( node4, - accessTypes, - MSmlDmDDFObject::EPermanent, - MSmlDmDDFObject::EInt, - MSmlDmDDFObject::EOne, - KMemoryCardStatusDescription, - KIntType ); - - accessTypes.SetReplace(); - - MSmlDmDDFObject& node5 = root.AddChildObjectL( KMemoryCardEncKeyNode ); - FillNodeInfoL( node5, - accessTypes, - MSmlDmDDFObject::EPermanent, - MSmlDmDDFObject::EB64, - MSmlDmDDFObject::EOne, - KMemoryCardEncKeyDescription, - KTextType ); - - MSmlDmDDFObject& node6 = root.AddChildObjectL( KUIStateNode ); - FillNodeInfoL( node6, - accessTypes, - MSmlDmDDFObject::EPermanent, - MSmlDmDDFObject::EInt, - MSmlDmDDFObject::EOne, - KUIStateDescription, - KIntType ); - - accessTypes.Reset(); - accessTypes.SetGet(); // Progress nodes are read-only - - MSmlDmDDFObject& node7 = root.AddChildObjectL( KPhoneMemoryProgNode ); - FillNodeInfoL( node7, - accessTypes, - MSmlDmDDFObject::EPermanent, - MSmlDmDDFObject::EInt, - MSmlDmDDFObject::EOne, - KPhoneMemoryProgDescription, - KIntType ); - - MSmlDmDDFObject& node8 = root.AddChildObjectL( KMemoryCardProgNode ); - FillNodeInfoL( node8, - accessTypes, - MSmlDmDDFObject::EPermanent, - MSmlDmDDFObject::EInt, - MSmlDmDDFObject::EOne, - KMemoryCardProgDescription, - KIntType ); - DFLOG( "CDevEncAdapter::DDFStructureL End" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::StreamingSupport -// Return streaming support status, set supported item size -// Status : Draft -// ---------------------------------------------------------------------------- -// -TBool CDevEncAdapter::StreamingSupport( TInt& /* aItemSize */ ) - { - // Not supported - DFLOG( "CDevEncAdapter::StreamingSupport" ); - return EFalse; - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::StreamCommittedL -// Commit stream buffer -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::StreamCommittedL() - { - DFLOG( "CDevEncAdapter::StreamCommitted" ); - // Intentionally left empty - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::CompleteOutstandingCmdsL -// Complete outstanding commands -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::CompleteOutstandingCmdsL() - { - DFLOG( "CDevEncAdapter::CompleteOutstandingCmdsL Begin" ); - MSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; - TInt status; - - TRequestStatus reqStatus; - TBool pending = ( iPhoneMemOpPending || iMemCardOpPending ); - DFLOG2( "CDevEncAdapter: pending %d", ( pending ? 1 : 0 ) ); - - if ( iPhoneMemOpPending ) - { - iPhoneMemOpPending = EFalse; - DFLOG2( "CDevEncAdapter: iPendingCommand %d", iPendingCommand ); - switch ( iPendingCommand ) - { - case EDmDecrypt: - iPhoneMemorySession->DiskStatus( status ); - if ( status == EEncrypted ) - { - DFLOG( "CDevEncAdapter: phone memory decrypt" ); - iPhoneMemorySession->StartDiskDecrypt(); - } - else - { - DFLOG2( "CDevEncAdapter: Cannot decrypt, phone mem status %d", - status ); - retValue = CSmlDmAdapter::EError; - } - break; - case EDmEncryptDefault: - iPhoneMemorySession->DiskStatus( status ); - if ( status == EDecrypted ) - { - // if FOTA couldn't be disabled then the encryption cannot be performed - if( retValue != CSmlDmAdapter::EError ) - { - DFLOG( "CDevEncAdapter: phone memory encrypt" ); - iPhoneMemorySession->StartDiskEncrypt(); - } - } - else - { - DFLOG2( "CDevEncAdapter: Cannot encrypt, phone mem status %d", - status ); - retValue = CSmlDmAdapter::EError; - } - break; - default: - // Unknown or not valid command for phone memory - DFLOG2( "CDevEncAdapter: Invalid command %d", - iPendingCommand ); - retValue = CSmlDmAdapter::EInvalidObject; - break; - } - } - - if ( iMemCardOpPending ) - { - iMemCardOpPending = EFalse; - switch ( iPendingCommand ) - { - case EDmDecrypt: - iMemoryCardSession->DiskStatus( status ); - if ( status == EEncrypted ) - { - DFLOG( "CDevEncAdapter: memory card decrypt" ); - TInt opStatus = iMemoryCardSession->StartDiskDecrypt(); - } - else - { - DFLOG2( "CDevEncAdapter: Cannot decrypt, card status %d", - status ); - retValue = CSmlDmAdapter::EError; - } - break; - case EDmEncryptRestore: - case EDmEncryptBackup: - iMemoryCardSession->DiskStatus( status ); - if ( status == EDecrypted ) - { - HBufC8* passwd = AskPassWordL(); - if ( iPendingCommand == EDmEncryptBackup ) - { - DFLOG( "CDevEncAdapter: memory card backup" ); - _LIT_SECURITY_POLICY_S0( KPSSecurityPolicy, KPSCategory.iUid ); - - RProperty::Define( KPkcs5PSKey, - RProperty::EByteArray, - KPSSecurityPolicy, - KPSSecurityPolicy ); - iKeyUtils->CreateSetKey( reqStatus, - iPkcs5Key, - *passwd, - KEncryptionKeyLength ); - User::WaitForRequest( reqStatus ); - User::LeaveIfError( reqStatus.Int() ); - TInt ret = RProperty::Set( KPSCategory, - KPkcs5PSKey, - *iPkcs5Key ); - if ( ret != KErrNone ) - { - DFLOG2( "CDevEncAdapter: Error storing key: %d", ret ); - User::Leave( ret ); - } - } - else if ( iPendingCommand == EDmEncryptRestore ) - { - DFLOG( "CDevEncAdapter: memory card restore" ); - iKeyUtils->SetKey( reqStatus, *iPkcs5Key, *passwd ); - User::WaitForRequest( reqStatus ); - DFLOG2( "CDevEncAdapter::CompleteOutstandingCmdsL: \ - SetKey: %d", reqStatus.Int() ); - User::LeaveIfError( reqStatus.Int() ); - } - DFLOG( "CDevEncAdapter: memory card encrypt" ); - TInt opStatus = iMemoryCardSession->StartDiskEncrypt(); - delete passwd; - passwd = NULL; - } - else - { - DFLOG2( "CDevEncAdapter: Cannot encrypt, card status %d", - status ); - retValue = CSmlDmAdapter::EError; - } - break; - case EDmEncryptDefault: - iMemoryCardSession->DiskStatus( status ); - if ( status == EDecrypted ) - { - DFLOG( "CDevEncAdapter: memory card encrypt" ); - TInt opStatus = iMemoryCardSession->StartDiskEncrypt(); - } - else - { - DFLOG2( "CDevEncAdapter: Cannot encrypt, card status %d", - status ); - retValue = CSmlDmAdapter::EError; - } - break; - default: - // Unknown or not valid command for memory card - DFLOG2( "CDevEncAdapter: Invalid command %d", - iPendingCommand ); - retValue = CSmlDmAdapter::EInvalidObject; - break; - } - } - - if ( pending ) - { - Callback().SetStatusL( iStatusRef, retValue ); - } - DFLOG( "CDevEncAdapter::CompleteOutstandingCmdsL End" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::FillNodeInfoL -// Fill node info -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::FillNodeInfoL( MSmlDmDDFObject& aDDFObject, - TSmlDmAccessTypes& aAccessTypes, - MSmlDmDDFObject::TScope aScope, - MSmlDmDDFObject::TDFFormat aFormat, - MSmlDmDDFObject::TOccurence aOccurence, - const TDesC8& aDescription, - const TDesC8& aMIMEType ) - { - DFLOG( "CDevEncAdapter::FillNodeInfoL Begin" ); - aDDFObject.SetAccessTypesL( aAccessTypes ); - aDDFObject.SetScopeL( aScope ); - aDDFObject.SetOccurenceL( aOccurence ); - aDDFObject.SetDFFormatL( aFormat ); - aDDFObject.SetDescriptionL( aDescription ); - if ( aFormat != MSmlDmDDFObject::ENode ) - { - aDDFObject.AddDFTypeMimeTypeL( aMIMEType ); - } - DFLOG( "CDevEncAdapter::FillNodeInfoL End" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::CopyCommandL -// Copy object -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, - const TDesC8& /*aTargetLUID*/, - const TDesC8& /*aSourceURI*/, - const TDesC8& /*aSourceLUID*/, - const TDesC8& /*aType*/, - TInt aStatusRef ) - { - // Not supported - DFLOG( "CDevEncAdapter::CopyCommandL Begin" ); - Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - DFLOG( "CDevEncAdapter::CopyCommandL End" ); - } - -// ---------------------------------------------------------------------------- -// DeleteObjectL -// Delete object -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::DeleteObjectL( const TDesC8& /* aURI */, - const TDesC8& /* aLUID */, - TInt aStatusRef ) - - { - // Not supported - DFLOG( "CDevEncAdapter::DeleteObjectL Begin" ); - Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - DFLOG( "CDevEncAdapter::DeleteObjectL End" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::FetchLeafObjectL -// Fetch leaf -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::FetchLeafObjectL( const TDesC8& aURI, - const TDesC8& /* aLUID */, - const TDesC8& aType, - TInt aResultsRef, - TInt aStatusRef ) - { - DFLOG( "CDevEncAdapter::FetchLeafObjectL Begin" ); - - MSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; - CBufFlat* result = CBufFlat::NewL( KBufGranularity ); - CleanupStack::PushL( result ); - - if ( aURI.Compare( KDevEncRootNode ) >= 0 ) - { - TPtrC8 leaf = LastURISeg( aURI ); - TBuf8 buf; - - if ( leaf == KPhoneMemoryStatusNode ) - { - TInt status; - iPhoneMemorySession->DiskStatus( status ); - buf.Num( status ); - result->InsertL( 0, buf ); - } - else if ( leaf == KMemoryCardStatusNode ) - { - TInt status; - iMemoryCardSession->DiskStatus( status ); - buf.Num( status ); - result->InsertL( 0, buf ); - } - else if ( leaf == KMemoryCardEncKeyNode ) - { - iPkcs5Key = HBufC8::NewL( RProperty::KMaxPropertySize ); - TPtr8 keyPtr = iPkcs5Key->Des(); - keyPtr.FillZ( RProperty::KMaxPropertySize ); - TInt ret = RProperty::Get( KPSCategory, - KPkcs5PSKey, - keyPtr ); - if ( ret != KErrNone ) - { - DFLOG2( "CDevEncAdapter::FetchLeafObjectL: Error reading key: %d", ret ); - User::Leave( ret ); - } - result->InsertL( 0, *iPkcs5Key ); - } - else if ( leaf == KUIStateNode ) - { - TInt status; - iUiCenRep->Get( KDevEncUiDmControl, status ); - buf.Num( status ); - result->InsertL( 0, buf ); - } - else if ( leaf == KPhoneMemoryProgNode ) - { - TInt progress = -1; - iPhoneMemorySession->Progress( progress ); - buf.Num( progress ); - result->InsertL( 0, buf ); - } - else if ( leaf == KMemoryCardProgNode ) - { - TInt progress = -1; - iMemoryCardSession->Progress( progress ); - buf.Num( progress ); - result->InsertL( 0, buf ); - } - else - { - retValue = CSmlDmAdapter::ENotFound; - } - } - else - { - retValue = CSmlDmAdapter::ENotFound; - } - - if ( retValue == CSmlDmAdapter::EOk ) - { - result->Compress(); - Callback().SetResultsL( aResultsRef, *result, aType ); - } - - CleanupStack::PopAndDestroy( result ); - // Respond - Callback().SetStatusL( aStatusRef, retValue ); - DFLOG( "CDevEncAdapter::FetchLeafObjectL End" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::FetchLeafObjectSizeL -// Calculate leaf object size -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, - const TDesC8& /* aLUID */, - const TDesC8& /* aType */, - TInt aResultsRef, - TInt aStatusRef ) - { - DFLOG( "CDevEncAdapter::FetchLeafObjectSizeL Begin" ); - - MSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; - CBufFlat* result = CBufFlat::NewL( KBufGranularity ); - CleanupStack::PushL( result ); - - if ( aURI.Compare( KDevEncRootNode ) >= 0 ) - { - TPtrC8 leaf = LastURISeg( aURI ); - TBuf8 buf; - - if ( leaf == KPhoneMemoryStatusNode ) - { - buf.AppendNum( sizeof(TInt) ); - result->InsertL( 0, buf ); - } - else if ( leaf == KMemoryCardStatusNode ) - { - buf.AppendNum( sizeof(TInt) ); - result->InsertL( 0, buf ); - } - else if ( leaf == KMemoryCardEncKeyNode ) - { - buf.AppendNum( KEncryptionKeyLength ); - result->InsertL( 0, buf ); - } - else if ( leaf == KUIStateNode ) - { - buf.AppendNum( sizeof(TInt) ); - result->InsertL( 0, buf ); - } - else if ( leaf == KPhoneMemoryProgNode ) - { - buf.AppendNum( sizeof(TInt) ); - result->InsertL( 0, buf ); - } - else if ( leaf == KMemoryCardProgNode ) - { - buf.AppendNum( sizeof(TInt) ); - result->InsertL( 0, buf ); - } - else - { - retValue = CSmlDmAdapter::ENotFound; - } - } - else - { - retValue = CSmlDmAdapter::ENotFound; - } - - if ( retValue == CSmlDmAdapter::EOk ) - { - result->Compress(); - Callback().SetResultsL( aResultsRef, *result, KIntType ); - } - - CleanupStack::PopAndDestroy( result ); - // Respond - Callback().SetStatusL( aStatusRef, retValue ); - DFLOG( "CDevEncAdapter::FetchLeafObjectSizeL End" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::ChildURIListL -// Create child URI list -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::ChildURIListL( const TDesC8& aURI, - const TDesC8& /* aLUID */, - const CArrayFix& /* aPreviousURISegmentList */, - TInt aResultsRef, - TInt aStatusRef ) - { - DFLOG( "CDevEncAdapter::ChildURIListL Begin" ); - MSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; - - if ( aURI.Compare( KDevEncRootNode ) == 0 ) - { - CBufFlat* buf = CBufFlat::NewL( KBufGranularity ); - CleanupStack::PushL( buf ); - buf->InsertL( 0, KPhoneMemoryCmdNode ); - buf->InsertL( buf->Size(), KSeparator ); - buf->InsertL( buf->Size(), KMemoryCardCmdNode ); - buf->InsertL( buf->Size(), KSeparator ); - buf->InsertL( buf->Size(), KPhoneMemoryStatusNode ); - buf->InsertL( buf->Size(), KSeparator ); - buf->InsertL( buf->Size(), KMemoryCardStatusNode ); - buf->InsertL( buf->Size(), KSeparator ); - buf->InsertL( buf->Size(), KMemoryCardEncKeyNode ); - buf->InsertL( buf->Size(), KSeparator ); - buf->InsertL( buf->Size(), KUIStateNode ); - buf->InsertL( buf->Size(), KSeparator ); - buf->InsertL( buf->Size(), KPhoneMemoryProgNode ); - buf->InsertL( buf->Size(), KSeparator ); - buf->InsertL( buf->Size(), KMemoryCardProgNode ); - - buf->Compress(); - Callback().SetResultsL( aResultsRef, *buf, KNullDesC8 ); - CleanupStack::PopAndDestroy( buf ); - } - else - { - retValue = CSmlDmAdapter::ENotFound; - } - - // Respond - Callback().SetStatusL( aStatusRef, retValue ); - DFLOG( "CDevEncAdapter::ChildURIListL End" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::AddNodeObjectL -// Add node -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::AddNodeObjectL( const TDesC8& /* aURI */, - const TDesC8& /* aParentLUID */, - TInt aStatusRef ) - { - // Not supported - DFLOG( "CDevEncAdapter::AddNodeObjectL Begin" ); - Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - DFLOG( "CDevEncAdapter::AddNodeObjectL End" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::ExecuteCommandL -// Execute command -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::ExecuteCommandL( const TDesC8& /* aURI */, - const TDesC8& /* aLUID */, - const TDesC8& /* aArgument */, - const TDesC8& /* aType */, - TInt aStatusRef ) - { - // Not supported - DFLOG( "CDevEncAdapter::ExecuteCommandL Begin" ); - Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - DFLOG( "CDevEncAdapter::ExecuteCommandL End" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::ExecuteCommandL -// Execute command, streaming enabled -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::ExecuteCommandL( const TDesC8& /* aURI */, - const TDesC8& /* aLUID */, - RWriteStream*& /* aStream */, - const TDesC8& /* aType */, - TInt aStatusRef ) - { - // Not supported - DFLOG( "CDevEncAdapter::ExecuteCommandL Begin" ); - Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - DFLOG( "CDevEncAdapter::ExecuteCommandL End" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::UpdateLeafObjectL -// Update leaf object -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::UpdateLeafObjectL( const TDesC8& aURI, - const TDesC8& /* aLUID */, - const TDesC8& aObject, - const TDesC8& /* aType */, - TInt aStatusRef ) - { - DFLOG( "CDevEncAdapter::UpdateLeafObjectL Begin" ); - MSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; - DFLOG2( "CDevEncAdapter: Object: %S", &aObject ); - - if ( aURI.Compare( KDevEncRootNode ) >= 0 ) - { - TPtrC8 leaf = LastURISeg( aURI ); - TLex8 lex; - - if ( leaf == KPhoneMemoryCmdNode ) - { - DFLOG( "CDevEncAdapter: leaf: KPhoneMemoryCmdNode" ); - DFLOG2( "CDevEncAdapter: iMemCardOpPending %d", ( iMemCardOpPending ? 1 : 0 ) ); - if ( iMemCardOpPending ) - { - retValue = CSmlDmAdapter::EObjectInUse; - } - else - { - if( !CheckBatteryL() ) - { - retValue = CSmlDmAdapter::EError; - } - else - { - lex.Assign( aObject ); - lex.Val( iPendingCommand ); - iPhoneMemOpPending = ETrue; - iStatusRef = aStatusRef; - return; // Completed in CompleteOutstandingCmdsL - } - } - } - else if ( leaf == KMemoryCardCmdNode ) - { - DFLOG( "CDevEncAdapter: leaf: KMemoryCardCmdNode" ); - DFLOG2( "CDevEncAdapter: iPhoneMemOpPending %d", ( iPhoneMemOpPending ? 1 : 0 ) ); - if ( iPhoneMemOpPending ) - { - retValue = CSmlDmAdapter::EObjectInUse; - } - else - { - if( !CheckBatteryL() ) - { - retValue = CSmlDmAdapter::EError; - } - else - { - lex.Assign( aObject ); - lex.Val( iPendingCommand ); - iMemCardOpPending = ETrue; - iStatusRef = aStatusRef; - return; // Completed in CompleteOutstandingCmdsL - } - } - } - else if ( leaf == KMemoryCardEncKeyNode ) - { - DFLOG( "CDevEncAdapter: leaf: KMemoryCardEncKeyNode" ); - iPkcs5Key = aObject.AllocL(); - } - else if ( leaf == KUIStateNode ) - { - DFLOG( "CDevEncAdapter: leaf: KUIStateNode" ); - lex.Assign( aObject ); - TInt value; - lex.Val( value ); - iUiCenRep->Set( KDevEncUiDmControl, value ); - } - else - { - retValue = CSmlDmAdapter::ENotFound; - DFLOG( "CDevEncAdapter: Not Found" ); - } - } - else - { - retValue = CSmlDmAdapter::ENotFound; - DFLOG( "CDevEncAdapter: Not Found" ); - } - Callback().SetStatusL( aStatusRef, retValue ); - DFLOG( "CDevEncAdapter::UpdateLeafObjectL End" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::UpdateLeafObjectL -// Update leaf object, streaming enabled -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::UpdateLeafObjectL( const TDesC8& /* aURI */, - const TDesC8& /* aLUID */, - RWriteStream*& /* aStream */, - const TDesC8& /* aType */, - TInt aStatusRef ) - { - // Not supported - DFLOG( "CDevEncAdapter::UpdateLeafObjectL Begin" ); - Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); - DFLOG( "CDevEncAdapter::UpdateLeafObjectL End" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::StartAtomicL -// Start atomic -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::StartAtomicL() - { - DFLOG( "CDevEncAdapter::StartAtomicL" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::CommitAtomicL -// Commit atomic commands -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::CommitAtomicL() - { - DFLOG( "CDevEncAdapter::CommitAtomicL" ); - } - -// ---------------------------------------------------------------------------- -// CDevEncAdapter::RollbackAtomicL -// Lose all modifications after 'StartAtomicL' command -// (may leave) -// Status : Draft -// ---------------------------------------------------------------------------- -// -void CDevEncAdapter::RollbackAtomicL() - { - DFLOG( "CDevEncAdapter::RollbackAtomicL" ); - } - -TPtrC8 CDevEncAdapter::LastURISeg( const TDesC8& aURI ) - { - DFLOG( "CDevEncAdapter::LastURISeg Begin" ); - TInt i; - for ( i = aURI.Length()-1; i >= 0; i-- ) - { - if ( aURI[i] == '/' ) - { - break; - } - } - DFLOG( "CDevEncAdapter::LastURISeg End" ); - return aURI.Mid( i+1 ); - } - -HBufC8* CDevEncAdapter::AskPassWordL() - { - DFLOG( "CDevEncAdapter::AskPassWordL Begin" ); - RNotifier notif; - TInt err = notif.Connect(); - DFLOG2( "CDevEncAdapter::AskPassWordL notif.Connect(): %d", err ); - User::LeaveIfError( err ); - TBuf8 passwd; - passwd.SetLength(KMaxPasswordLength); - TRequestStatus status = KRequestPending; - DFLOG( "CDevEncAdapter::AskPassWordL StartNotifierAndGetResponse" ); - notif.StartNotifierAndGetResponse( - status, - TUid::Uid( KDevEncPasswdDlgUid ), - KNullDesC8, - passwd ); - User::WaitForRequest( status ); - notif.Close(); - err = status.Int(); - DFLOG2( "CDevEncAdapter::AskPassWordL status.Int(): %d", err ); - User::LeaveIfError( err ); - HBufC8* passwdBuf = passwd.AllocL(); - DFLOG( "CDevEncAdapter::AskPassWordL End" ); - return passwdBuf; - } - -// --------------------------------------------------------------------------- -// CDevEncAdapter::CheckBatteryL() -// Checks if there's enough battery power to update -// --------------------------------------------------------------------------- -// -TBool CDevEncAdapter::CheckBatteryL() - { -#ifdef __WINS__ - - // In the emulator, the battery level is always 0 and the charger is never - // connected, so just return ETrue. - return ETrue; - -#else // __WINS__ - - // Running on target. Check the real battery and charger status - - TInt chargingstatus( EChargingStatusError ); - TInt batterylevel( 1 ); - TBool enoughPower( EFalse ); - - // Read battery - DFLOG( "CDevEncAdapter::CheckBatteryL" ); - RProperty pw; - User::LeaveIfError( pw.Attach( KPSUidHWRMPowerState, KHWRMBatteryLevel ) ); - User::LeaveIfError( pw.Get( batterylevel ) ); - pw.Close(); - - User::LeaveIfError( pw.Attach( KPSUidHWRMPowerState, KHWRMChargingStatus ) ); - User::LeaveIfError( pw.Get( chargingstatus )); - pw.Close(); - - // Too low battery, power insufficient - if ( batterylevel >= EBatteryLevelLevel4 ) - { - enoughPower = ETrue; - } - // But charger is connected, power sufficient - if ( ( chargingstatus != EChargingStatusError ) && - ( chargingstatus != EChargingStatusNotConnected ) ) - { - enoughPower = ETrue; - } - - DFLOG3( "CDevEncAdapter: Battery level: %d (0..7), chargingstatus %d", - batterylevel, chargingstatus ); - DFLOG2( "CDevEncAdapter: CheckBatteryL %d", ( enoughPower ? 1 : 0 ) ); - return enoughPower; - -#endif // __WINS__ - } - -// ========================= OTHER EXPORTED FUNCTIONS ========================= - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncDmAdapter/src/DevEncAdapterImp.cpp --- a/deviceencryption/DevEncDmAdapter/src/DevEncAdapterImp.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2005 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: Printing Framework DM Adapter. -* -*/ - -// INCLUDE -#include -#include "DevEncAdapter.h" -#include "DevEncUids.hrh" - -// ---------------------------------------------------------------------------- -// ImplementationTable -// Ecom plug-in implementation table -// Status : Draft -// ---------------------------------------------------------------------------- -// -const TImplementationProxy ImplementationTable[] = - { -#ifdef __EABI__ - IMPLEMENTATION_PROXY_ENTRY( KDevEncOmaDmPluginImplUid, CDevEncAdapter::NewL ) -#else // !__EABI__ - { { KDevEncOmaDmPluginImplUid }, CDevEncAdapter::NewL } -#endif // __EABI__ - }; - -// ---------------------------------------------------------------------------- -// ImplementationGroupProxy -// Instance of implementation proxy -// (exported) -// Status : Draft -// ---------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) - { - aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); - - return ImplementationTable; - } - -// End Of File - - diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncGsPlugin/data/200255CF.rss --- a/deviceencryption/DevEncGsPlugin/data/200255CF.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2005 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: ECOM plugin resource file for GSConfigPlugin. -* -*/ - -#include - -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = 0x200255CF; // dll UID - interfaces = - { - INTERFACE_INFO - { - interface_uid = 0x10207236; // common UID for all GS plugins - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x200255CF; - version_no = 1; - display_name = "Device Encryption Plugin"; - default_data = "0x1020743A"; // Parent UID - opaque_data = "20"; // Order number - } - }; - } - }; - } - diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncGsPlugin/data/devencgspluginrsc.rss --- a/deviceencryption/DevEncGsPlugin/data/devencgspluginrsc.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2005 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 file for DE Plugin. -* -*/ - - -// RESOURCE IDENTIFIER -NAME GSDP // 4 letter ID - -// INCLUDES - - -#include -#include - - -#include - -// CONSTANTS - -// RESOURCE DEFINITIONS - -//---------------------------------------------------- -// -// -// Needed or loading the resource fails! -// -//---------------------------------------------------- -// -RESOURCE RSS_SIGNATURE - { - } - -//---------------------------------------------------- -// -// r_gs_config_plugin_caption -// Configuration Contexts Plugin caption. -// -//---------------------------------------------------- -// -RESOURCE TBUF r_gs_de_plugin_caption - { - buf = qtn_cp_folder_de; - } - - - -//End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncGsPlugin/group/bld.inf --- a/deviceencryption/DevEncGsPlugin/group/bld.inf Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2005 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: Information required for building GSConfigPlugin. -* -*/ - -// To get the APP_LAYER_LOC_EXPORT_PATH-definition -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -#include "devencgspluginexports.inc" - -PRJ_EXTENSIONS -START EXTENSION s60/mifconv - OPTION TARGETFILE gsprofilesplugin.mif - OPTION HEADERFILE gsprofilesplugin.mbg - OPTION SOURCES -c8,8 qgn_prop_cp_perso_prof -END - -PRJ_EXTENSIONS -START EXTENSION s60/mifconv - OPTION TARGETFILE devencgsplugin.mif - OPTION HEADERFILE devencgsplugin.mbg - - OPTION SOURCES \ - -c8,8 qgn_prop_cp_devenc.svg -END - -PRJ_MMPFILES -//gnumakefile devencgspluginicons.mk -devencgsplugin.mmp - -PRJ_TESTMMPFILES - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncGsPlugin/group/devencgsplugin.mmp --- a/deviceencryption/DevEncGsPlugin/group/devencgsplugin.mmp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2005 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 specification file for deviceencryptiongsplugin. -* -*/ - - -#include //this is needed for RESOURCE_FILES_DIR -#include - -CAPABILITY CAP_ECOM_PLUGIN -TARGET devencgsplugin.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x200255CF // dll uid is 0x200255CF -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE devencgsplugin.cpp -SOURCE devencgspluginImplementationTable.cpp - -USERINCLUDE ../data -USERINCLUDE ../inc - -SYSTEMINCLUDE . -SYSTEMINCLUDE /epoc32/include/ecom - -// Default system include paths for application layer modules. -APP_LAYER_SYSTEMINCLUDE - -SOURCEPATH ../data - -//ECOM resource definition -START RESOURCE 200255CF.rss - TARGET devencgsplugin.rsc - TARGETPATH ECOM_RESOURCE_DIR -END - -// Gsplugin caption -START RESOURCE devencgspluginrsc.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END // Gsplugin caption - - -LIBRARY apparc.lib -LIBRARY avkon.lib -LIBRARY bafl.lib -LIBRARY commonengine.lib // RConeResourceLoader -LIBRARY cone.lib -LIBRARY ecom.lib -LIBRARY efsrv.lib -LIBRARY egul.lib -LIBRARY eikcoctl.lib -LIBRARY eikcore.lib -LIBRARY euser.lib -LIBRARY featmgr.lib -LIBRARY gsecomplugin.lib -LIBRARY gsframework.lib // Base classes -LIBRARY ws32.lib -LIBRARY aknskins.lib // AknsUtils.h -LIBRARY apgrfx.lib // RApaLsSession -LIBRARY servicehandler.lib // For AIW - -DEBUGLIBRARY flogger.lib - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncGsPlugin/group/devencgspluginexports.inc --- a/deviceencryption/DevEncGsPlugin/group/devencgspluginexports.inc Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - -// To get the APP_LAYER_SYSTEMINCLUDE-definition -#include - -#ifndef DEVENCGSPLUGINEXPORTS_INC -#define DEVENCGSPLUGINEXPORTS_INC - -../loc/devencgsplugin.loc APP_LAYER_LOC_EXPORT_PATH(devencgsplugin.loc) - -#endif // DEVENCGSPLUGINEXPORTS_INC - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncGsPlugin/group/qgn_prop_cp_devenc.svg --- a/deviceencryption/DevEncGsPlugin/group/qgn_prop_cp_devenc.svg Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncGsPlugin/inc/devencgsplugin.h --- a/deviceencryption/DevEncGsPlugin/inc/devencgsplugin.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -/* -* Copyright (c) 2005 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: DeviceEncryptionGsPlugin implementation. -* -*/ - -#ifndef DEVENCGSPLUGIN_H -#define DEVENCGSPLUGIN_H - -// User includes -#include <../../common/DevEncUids.hrh> - -// System includes -#include -#include -#include -#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS -#include -#include -#endif //SYMBIAN_ENABLE_SPLIT_HEADERS - -// Classes referenced -class CAknNullService; -class CRepository; - -// Constants -const TUid KDeviceEncryptionGsPluginUID = { KDevEncGsPluginUid }; // dll uid -const TUid KDeviceEncryptionGsPluginImplUID = { KDevEncGsPluginImplUid }; // dll impl uid -const TUid KDeviceEncryptionAppUid = { KDevEncUiUid }; // UI uid - -_LIT( KDeviceEncryptionApp, "z:\\sys\\bin\\DevEncUi.exe" ); -_LIT( KDeviceEncryptionGsPluginResourceFileName, "z:devencGsPluginRsc.rsc" ); -_LIT( KDeviceEncryptionGsPluginIconDirAndName, "z:devencgsplugin.mbm"); // Use KDC_BITMAP_DIR - -// CLASS DECLARATION - -//For embedding CC in CS -class TAppInfo - { - public: - TAppInfo( TUid aUid, const TDesC& aFile ) - : iUid( aUid ), iFile( aFile ) - {} - TUid iUid; - TFileName iFile; - }; - - -/** -* CDeviceEncryptionGsPlugin. -* -* This class handles state and application logic of CDeviceEncryptionGsPlugin. -* The plugin is a type of EGSItemTypeSettingDialog and therefore the GS FW will -* call HandleSelection() instead of DoActivate(). No CAknView functionality is -* supported even though the base class is CAknView derived via -* CGSPluginInterface. -* -*/ -class CDeviceEncryptionGsPlugin : public CGSPluginInterface, - public MAknServerAppExitObserver // Embedding - { - public: // Constructors and destructor - - /** - * Symbian OS two-phased constructor - * @return - */ - static CDeviceEncryptionGsPlugin* NewL( TAny* aInitParams ); - - /** - * Destructor. - */ - ~CDeviceEncryptionGsPlugin(); - - public: // From CAknView - - /** - * See base class. - */ - TUid Id() const; - - public: // From CGSPluginInterface - - /** - * See base class. - */ - void GetCaptionL( TDes& aCaption ) const; - - /** - * See base class. - */ - TInt PluginProviderCategory() const; - - /** - * See base class. - */ - TGSListboxItemTypes ItemType(); - - /** - * See base class. - */ - void GetValue( const TGSPluginValueKeys aKey, - TDes& aValue ); - - /** - * See base class. - */ - void HandleSelection( const TGSSelectionTypes aSelectionType ); - - /** - * See base class. - */ - CGulIcon* CreateIconL( const TUid aIconType ); - - protected: // New - - /** - * C++ default constructor. - */ - CDeviceEncryptionGsPlugin(); - - /** - * Symbian OS default constructor. - */ - void ConstructL(); - - protected: // From CAknView - - /** - * This implementation is empty because this class, being just a dialog, - * does not implement the CAknView finctionality. - */ - void DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * This implementation is empty because this class, being just a dialog, - * does not implement the CAknView finctionality. - */ - void DoDeactivate(); - - private: - - /** - * Opens localized resource file. - */ - void OpenLocalizedResourceFileL( - const TDesC& aResourceFileName, - RConeResourceLoader& aResourceLoader ); - - /** - * Launches provisioning application. - */ - void LaunchDEAppL(); - - /** - * Launches application as embedded. - */ - void EmbedAppL( const TAppInfo& aApp ); - - protected: - - //Resource loader. - RConeResourceLoader iResources; - - CAknNullService* iNullService; - - CApaDocument* iEmbedded; - }; - -#endif // DEVENCGSPLUGIN_H -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncGsPlugin/loc/devencgsplugin.loc --- a/deviceencryption/DevEncGsPlugin/loc/devencgsplugin.loc Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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: Localization strings for . -* -*/ - - -// LOCALISATION STRINGS - -// **CAPTIONS - -//d:Text of a list item in main view list -//d:Used by -//l:list_single_large_graphic_pane_t1 -//w: -//r: 5.0 -#define qtn_cp_folder_de "Device Encryption" - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncGsPlugin/src/devencgsplugin.cpp --- a/deviceencryption/DevEncGsPlugin/src/devencgsplugin.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,300 +0,0 @@ -/* -* Copyright (c) 2005 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: GSProfilesPlugin implementation. -* -*/ - - -// User includes -#include "devencgsplugin.h" -#include -#include -#include // GUI Resource -#include -#include -#include -#include -#include -// System includes -#include -#include -#include - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::CDeviceEncryptionGsPlugin -// -// --------------------------------------------------------------------------- -// -CDeviceEncryptionGsPlugin::CDeviceEncryptionGsPlugin() - : iResources( *iCoeEnv ), iNullService(NULL) - { - } - - -// --------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::~CDeviceEncryptionGsPlugin -// -// --------------------------------------------------------------------------- -// -CDeviceEncryptionGsPlugin::~CDeviceEncryptionGsPlugin() - { - iResources.Close(); - - if ( iNullService ) - { - delete iNullService; - } - } - - -// --------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::ConstructL -// -// --------------------------------------------------------------------------- -// -void CDeviceEncryptionGsPlugin::ConstructL() - { - OpenLocalizedResourceFileL( KDeviceEncryptionGsPluginResourceFileName, iResources ); - } - - -// --------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::NewL -// -// --------------------------------------------------------------------------- -// -CDeviceEncryptionGsPlugin* CDeviceEncryptionGsPlugin::NewL( TAny* /*aInitParams*/ ) - { - CDeviceEncryptionGsPlugin* self = new ( ELeave ) CDeviceEncryptionGsPlugin(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -// ----------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::Id (from CGSPluginInterface) -// -// ----------------------------------------------------------------------------- -// -TUid CDeviceEncryptionGsPlugin::Id() const - { - return KDeviceEncryptionGsPluginImplUID; - } - - -// ----------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::DoActivateL (from CGSPluginInterface) -// -// ----------------------------------------------------------------------------- -// -void CDeviceEncryptionGsPlugin::DoActivateL( const TVwsViewId& /*aPrevViewId*/, - TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/ ) - { - } - - -// ----------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::DoDeactivate (from CGSPluginInterface) -// -// ----------------------------------------------------------------------------- -// -void CDeviceEncryptionGsPlugin::DoDeactivate() - { - } - - - -// ----------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::GetCaptionL (from CGSPluginInterface) -// -// ----------------------------------------------------------------------------- -// -void CDeviceEncryptionGsPlugin::GetCaptionL( TDes& aCaption ) const - { -// HBufC* result = iEikonEnv->AllocReadResourceAsDes16L( R_GS_DE_PLUGIN_CAPTION ); - HBufC* result = StringLoader::LoadL( R_GS_DE_PLUGIN_CAPTION ); - - if (result->Des().Length() < aCaption.MaxLength()) - { - aCaption.Copy( *result ); - } - else - { - aCaption = KNullDesC; - } - - delete result; -// aCaption.Copy( _L("Device Encryption") ); - } - - -// ----------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::PluginProviderCategory (from CGSPluginInterface) -// -// ----------------------------------------------------------------------------- -// -TInt CDeviceEncryptionGsPlugin::PluginProviderCategory() const - { - return KGSPluginProviderInternal; - } - - -// ----------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::ItemType (from CGSPluginInterface) -// -// ----------------------------------------------------------------------------- -// -TGSListboxItemTypes CDeviceEncryptionGsPlugin::ItemType() - { - return EGSItemTypeSettingDialog; - } - - -// ----------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::GetValue (from CGSPluginInterface) -// -// ----------------------------------------------------------------------------- -// -void CDeviceEncryptionGsPlugin::GetValue( const TGSPluginValueKeys /*aKey*/, - TDes& /*aValue*/ ) - { - } - - -// ----------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::HandleSelection (from CGSPluginInterface) -// -// ----------------------------------------------------------------------------- -// -void CDeviceEncryptionGsPlugin::HandleSelection( - const TGSSelectionTypes /*aSelectionType*/ ) - { - //TRAP_IGNORE( LaunchDEAppL() ); - LaunchDEAppL(); - } - -// --------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::CreateIconL (from CGSPluginInterface) -// -// --------------------------------------------------------------------------- -// - -CGulIcon* CDeviceEncryptionGsPlugin::CreateIconL( const TUid aIconType ) - { - CGulIcon* icon; - TParse* fp = new ( ELeave ) TParse(); - CleanupStack::PushL( fp ); - fp->Set( KDeviceEncryptionGsPluginIconDirAndName, &KDC_BITMAP_DIR, NULL ); - - if ( aIconType == KGSIconTypeLbxItem ) - { - icon = AknsUtils::CreateGulIconL( - AknsUtils::SkinInstance(), - KAknsIIDQgnPropCpPersoProf, - //KAknsIIDQgnPropCpDevenc, - fp->FullName(), - EMbmDevencgspluginQgn_prop_cp_devenc, - EMbmDevencgspluginQgn_prop_cp_devenc_mask ); - } - else - { - icon = CGSPluginInterface::CreateIconL( aIconType ); - } - - CleanupStack::PopAndDestroy( fp ); - - return icon; - } - - -// ----------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::OpenLocalizedResourceFileL -// -// ----------------------------------------------------------------------------- - -void CDeviceEncryptionGsPlugin::OpenLocalizedResourceFileL( - const TDesC& aResourceFileName, - RConeResourceLoader& aResourceLoader ) - { - RFs fsSession; - User::LeaveIfError( fsSession.Connect() ); - CleanupClosePushL(fsSession); - - // Find the resource file: - TParse parse; - parse.Set( aResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL ); - TFileName fileName( parse.FullName() ); - - // Get language of resource file: - BaflUtils::NearestLanguageFile( fsSession, fileName ); - - // Open resource file: - aResourceLoader.OpenL( fileName ); - - CleanupStack::PopAndDestroy(&fsSession); - } - - -// ----------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::LaunchProfilesAppL -// -// ----------------------------------------------------------------------------- -// -void CDeviceEncryptionGsPlugin::LaunchDEAppL() - { - // Get the correct application data - RWsSession ws; - User::LeaveIfError(ws.Connect()); - CleanupClosePushL(ws); - - // Find the task with uid - TApaTaskList taskList(ws); - TApaTask task = taskList.FindApp( KDeviceEncryptionAppUid ); - - if ( task.Exists() ) - { - task.BringToForeground(); - } - else - { - //Launch application as embedded - TAppInfo app( KDeviceEncryptionAppUid, KDeviceEncryptionApp ); - iEmbedded=NULL; - EmbedAppL( app ); - } - CleanupStack::PopAndDestroy(&ws); - } - - -// ----------------------------------------------------------------------------- -// CDeviceEncryptionGsPlugin::EmbedAppL -// -// ----------------------------------------------------------------------------- -// -void CDeviceEncryptionGsPlugin::EmbedAppL( const TAppInfo& aApp ) - { - if ( iNullService ) - { - delete iNullService; - iNullService = NULL; - } - iNullService = CAknNullService::NewL( aApp.iUid, this ); - } - -// End of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncGsPlugin/src/devencgspluginImplementationTable.cpp --- a/deviceencryption/DevEncGsPlugin/src/devencgspluginImplementationTable.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2005 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: ECOM proxy table for GSProfilesPlugin. -* -*/ - - -// User includes -#include "devencgsplugin.h" - -// System includes -#include -#include - - -// Constants -const TImplementationProxy KDeviceEncryptionGsPluginImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( 0x200255CF, CDeviceEncryptionGsPlugin::NewL ), - }; - - -// --------------------------------------------------------------------------- -// ImplementationGroupProxy -// Gate/factory function -// -// --------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( - TInt& aTableCount ) - { - aTableCount = sizeof( KDeviceEncryptionGsPluginImplementationTable ) - / sizeof( TImplementationProxy ); - return KDeviceEncryptionGsPluginImplementationTable; - } - - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncNotifPlugin/data/20002672.rss --- a/deviceencryption/DevEncNotifPlugin/data/20002672.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* Copyright (c) 2005 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: This file specifies the interface and implementation -* information for USBUINotif Ecom Plugins. -* -*/ - -#include "registryinfo.rh" -#include "uikon.hrh" -#include "DevEncUids.hrh" - -RESOURCE REGISTRY_INFO theInfo -{ - dll_uid = KDevEncNotifPluginUid; - interfaces = - { - INTERFACE_INFO - { - interface_uid = KUikonUidPluginInterfaceNotifiers; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = KDevEncNotifPluginImplUid; - version_no = 1; - display_name = "TTNOTIFY2V2 Plugin 1"; - default_data = "TTNOTIFY2V2"; - opaque_data = "0"; - } - }; - } - }; -} diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncNotifPlugin/data/DevEncNotifPlugin.rss --- a/deviceencryption/DevEncNotifPlugin/data/DevEncNotifPlugin.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2005 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 file for DE Plugin. -* -*/ - -NAME DENP - -#include -#include - -#include -#include -#include -#include - -#include - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF { buf=""; } - -// === QUERIES ================================================================ - -RESOURCE DIALOG r_devenc_passwd_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items= - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = ECodeLayout; - label = qtn_encryption_passphrase_ask; - control = SECRETED - { - }; - }; - } - }; - } - -RESOURCE TBUF r_devenc_invalid_passwd_string - { - buf = qtn_encryption_note_invalid_password; - } diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncNotifPlugin/group/DevEncNotifPlugin.mmp --- a/deviceencryption/DevEncNotifPlugin/group/DevEncNotifPlugin.mmp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2005 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: OMA DM adapter for controlling camera. -* -*/ - -#include -#include //this is needed for RESOURCE_FILES_DIR -#include "../../common/DevEncUids.hrh" - -TARGET devencnotifplugin.dll -TARGETTYPE plugin -UID 0x10009D8D KDevEncNotifPluginUid -TARGETPATH SHARED_LIB_DIR -CAPABILITY CAP_ECOM_PLUGIN -VENDORID VID_DEFAULT - -SOURCEPATH ../../common -SOURCE DevEncLog.cpp -SOURCEPATH ../src -SOURCE DevEncPasswdDlg.cpp -SOURCE DevEncNotifPluginImp.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../common - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/platform/mw/uikon -SYSTEMINCLUDE /epoc32/include/ecom - -// Notifier resource file -START RESOURCE ../data/DevEncNotifPlugin.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - -// ECom resource file -START RESOURCE ../data/20002672.rss -//#ifdef SYMBIAN_SECURE_ECOM -TARGET devencnotifplugin.rsc -//#endif -END - -LIBRARY euser.lib cone.lib -LIBRARY ecom.lib eiksrv.lib -LIBRARY commonengine.lib -LIBRARY avkon.lib bafl.lib -LIBRARY charconv.lib -LIBRARY eiksrvui.lib -DEBUGLIBRARY flogger.lib - -// End Of File - - diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncNotifPlugin/group/bld.inf --- a/deviceencryption/DevEncNotifPlugin/group/bld.inf Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2005 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: Device Encryption OMA DM Adapter. -* -*/ - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -// ROM files - -// Exported headers - -// Central repository files - -PRJ_MMPFILES -DevEncNotifPlugin.mmp - -// End of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncNotifPlugin/inc/DevEncPasswdDlg.h --- a/deviceencryption/DevEncNotifPlugin/inc/DevEncPasswdDlg.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,164 +0,0 @@ -/* -* Copyright (c) 2005 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: CCDevEncPasswdDlg declaration. -* -*/ - -#ifndef CDEVENCPASSWDDLG_H -#define CDEVENCPASSWDDLG_H - -#include // For CActive, link against: euser.lib -#include // For RTimer, link against: euser.lib -#include -#include -#include - -class CDevEncPasswdDlg : public CActive, - public MEikSrvNotifierBase2 - { - public: - // Cancel and destroy - ~CDevEncPasswdDlg(); - - // Two-phased constructor. - static CDevEncPasswdDlg* NewL(); - - // Two-phased constructor. - static CDevEncPasswdDlg* NewLC(); - - public: // Functions from MEikSrvNotifierBase2 - /** Frees all resources owned by this notifier. - - This function is called by the notifier framework when all resources allocated - by notifiers should be freed. As a minimum, this function should delete this - object (i.e. delete this;). - - Note that it is important to implement this function correctly to avoid memory - leaks. */ - virtual void Release(); - /** Performs any initialisation that this notifier may require. - - The function is called when the notifier is loaded (when the plug-in DLL is - loaded). It is called only once. - - As a minimum, the function should return a TNotifierInfo instance describing - the notifier parameters. A good implementation would be to set this into a - data member, and then to return it. This is because the same information is - returned by Info(). - - The function is safe to leave from, so it is possible, although rarely necessary, - to allocate objects as you would normally do in a ConstructL() function as - part of two-phase construction. - - @return Describes the parameters of the notifier. */ - virtual TNotifierInfo RegisterL(); - /** Gets the notifier parameters. - - This is usually the same information as returned by RegisterL() but can be - varied at run time. - - @return Describes the parameters of the notifier. */ - virtual TNotifierInfo Info() const; - /** Starts the notifier. - - This is called as a result of a client-side call to RNotifier::StartNotifier(), - which the client uses to start a notifier from which it does not expect a - response. - - The function is synchronous, but it should be implemented so that it completes - as soon as possible, allowing the notifier framework to enforce its priority - mechanism. - - It is not possible to to wait for a notifier to complete before returning - from this function unless the notifier is likely to finish implementing its - functionality immediately. - - @param aBuffer Data that can be passed from the client-side. The format and - meaning of any data is implementation dependent. - @return A pointer descriptor representing data that may be returned. The format - and meaning of any data is implementation dependent. */ - virtual TPtrC8 StartL(const TDesC8& aBuffer); - /** Starts the notifier. - - This is called as a result of a client-side call to the asynchronous function - RNotifier::StartNotifierAndGetResponse(). This means that the client is waiting, - asynchronously, for the notifier to tell the client that it has finished its - work. - - It is important to return from this function as soon as possible, and derived - classes may find it useful to take a copy of the reply-slot number and - the RMessage object. - - The implementation of a derived class must make sure that Complete() is called - on the RMessage object when the notifier is deactivated. - - This function may be called multiple times if more than one client starts - the notifier. - - @param aBuffer Data that can be passed from the client-side. The format and - meaning of any data is implementation dependent. - @param aReplySlot Identifies which message argument to use for the reply. - This message argument will refer to a modifiable descriptor, a TDes8 type, - into which data can be returned. The format and meaning of any returned data - is implementation dependent. - @param aMessage Encapsulates a client request. */ - virtual void StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); - - /** Cancels an active notifier. - - This is called as a result of a client-side call to RNotifier::CancelNotifier(). - - An implementation should free any relevant resources and complete any outstanding - messages, if relevant. */ - virtual void Cancel(); - /** Updates a currently active notifier with new data. - - This is called as a result of a client-side call to RNotifier::UpdateNotifier(). - - @param aBuffer Data that can be passed from the client-side. The format and - meaning of any data is implementation dependent. - @return A pointer descriptor representing data that may be returned. The format - and meaning of any data is implementation dependent. */ - virtual TPtrC8 UpdateL(const TDesC8& aBuffer); - private: - // C++ constructor - CDevEncPasswdDlg(); - - // Second-phase constructor - void ConstructL(); - - private: // From CActive - // Handle completion - void RunL(); - - // How to cancel me - void DoCancel(); - - // Override to handle leaves from RunL(). Default implementation causes - // the active scheduler to panic. - TInt RunError( TInt aError ); - - private: - TNotifierInfo iInfo; - CAknTextQueryDialog* iDlg; - CAknErrorNote* iNote; - RMessagePtr2 iMessage; // Received message - TInt iReplySlot; // Reply slot - TBool iNeedToCompleteMessage; // Flag for releasing messages - TInt iResourceFileFlag; // Flag for eikon env. - CEikonEnv* iEikEnv; // Local eikonenv - RTimer iTimer; - }; - -#endif // CDEVENCPASSWDDLG_H diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncNotifPlugin/src/DevEncNotifPluginImp.cpp --- a/deviceencryption/DevEncNotifPlugin/src/DevEncNotifPluginImp.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2005 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: Printing Framework DM Adapter. -* -*/ - -// INCLUDE FILES - -#include -#include - -#include "DevEncUids.hrh" -#include "DevEncPasswdDlg.h" -#include "DevEncLog.h" - -// CONSTANTS - - - -// ================= EXPORTED FUNCTIONS ======================================= - -// ---------------------------------------------------------------------------- -// -// Instantiate notifiers -// -// ---------------------------------------------------------------------------- - -LOCAL_C void CreateNotifiersL( CArrayPtrFlat* aNotifiers ) - { - CDevEncPasswdDlg* passWdDlg = CDevEncPasswdDlg::NewLC(); - aNotifiers->AppendL( passWdDlg ); - CleanupStack::Pop( passWdDlg ); - } - -// ---------------------------------------------------------------------------- -// -// Lib main entry point: Creates a notifiers array. -// -// ---------------------------------------------------------------------------- - -EXPORT_C CArrayPtr* NotifierArray() - { - CArrayPtrFlat* notifiers = NULL; - - TRAPD( err, notifiers = new (ELeave)CArrayPtrFlat( 1 )); - - if ( err == KErrNone ) - { - if( notifiers ) - { - TRAPD( err, CreateNotifiersL( notifiers )); - if( err ) - { - TInt count = notifiers->Count(); - while(count--) - { - (*notifiers)[count]->Release(); - } - delete notifiers; - notifiers = NULL; - } - } - } - else - { - DFLOG( "NotifierArray: CArrayPtrFlat: error" ); - } - - return notifiers; - } - -// ---------------------------------------------------------------------------- -// -// DLL entry point -// -// ---------------------------------------------------------------------------- -#ifndef EKA2 -GLDEF_C TInt E32Dll( TDllReason /* aReason */) - { - return( KErrNone ); - } -#endif - -// ---------------------------------------------------------------------------- -// -// ECOM -// -// ---------------------------------------------------------------------------- - -const TImplementationProxy ImplementationTable[] = - { -#ifdef __EABI__ - {{KDevEncNotifPluginImplUid},(TFuncPtr)NotifierArray}, -#else - IMPLEMENTATION_PROXY_ENTRY( KDevEncNotifPluginImplUid, NotifierArray ), -#endif - }; - -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) - { - aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); - return ImplementationTable; - } - -// End of file - diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncNotifPlugin/src/DevEncPasswdDlg.cpp --- a/deviceencryption/DevEncNotifPlugin/src/DevEncPasswdDlg.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +0,0 @@ -/* -* Copyright (c) 2005 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: CDevEncPasswdDlg implementation. -* -*/ - -#include "DevEncPasswdDlg.h" -#include "DevEncUids.hrh" -#include "DevEncDef.h" -#include -#include -#include -#include // BAFL utils (for language file) -#include -#include -#include "DevEncLog.h" - -#define KErrorNoteTimeout 2000000 -_LIT(KFileDrive,"z:"); -_LIT(KResourceFileName, "DevEncNotifPlugin.rsc"); - -CDevEncPasswdDlg::CDevEncPasswdDlg() : - CActive( EPriorityStandard ), // Standard priority - iNeedToCompleteMessage( EFalse ) - { - } - -CDevEncPasswdDlg* CDevEncPasswdDlg::NewLC() - { - CDevEncPasswdDlg* self = new ( ELeave ) CDevEncPasswdDlg(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -CDevEncPasswdDlg* CDevEncPasswdDlg::NewL() - { - CDevEncPasswdDlg* self = CDevEncPasswdDlg::NewLC(); - CleanupStack::Pop(); // self; - return self; - } - -void CDevEncPasswdDlg::ConstructL() - { - DFLOG( "CDevEncPasswdDlg::ConstructL Begin" ); - CActiveScheduler::Add( this ); // Add to scheduler - - iEikEnv = CEikonEnv::Static(); - iTimer.CreateLocal(); - TFileName filename; - filename += KFileDrive; - filename += KDC_RESOURCE_FILES_DIR; // From data_caging_path_literals.hrh - filename += KResourceFileName; - BaflUtils::NearestLanguageFile( iEikEnv->FsSession(), filename ); - iResourceFileFlag = iEikEnv->AddResourceFileL( filename ); - DFLOG( "CDevEncPasswdDlg::ConstructL End" ); - } - -CDevEncPasswdDlg::~CDevEncPasswdDlg() - { - DFLOG( "CDevEncPasswdDlg::~CDevEncPasswdDlg Begin" ); - Cancel(); - iEikEnv->DeleteResourceFile( iResourceFileFlag ); - if ( iNeedToCompleteMessage ) - { - iMessage.Complete( KErrDied ); - } - iTimer.Close(); - DFLOG( "CDevEncPasswdDlg::~CDevEncPasswdDlg End" ); - } - -void CDevEncPasswdDlg::DoCancel() - { - - } - -void CDevEncPasswdDlg::Release() - { - delete this; - } - -CDevEncPasswdDlg::TNotifierInfo CDevEncPasswdDlg::RegisterL() - { - DFLOG( "CDevEncPasswdDlg::RegisterL Begin" ); - iInfo.iUid = TUid::Uid( KDevEncPasswdDlgUid ); - iInfo.iChannel = TUid::Uid( KDevEncPasswdDlgUid ); - iInfo.iPriority = ENotifierPriorityVHigh; - DFLOG( "CDevEncPasswdDlg::RegisterL End" ); - return iInfo; - } - -CDevEncPasswdDlg::TNotifierInfo CDevEncPasswdDlg::Info() const - { - return iInfo; - } - -TPtrC8 CDevEncPasswdDlg::StartL(const TDesC8& /*aBuffer*/) - { - return TPtrC8(); - } - -void CDevEncPasswdDlg::StartL(const TDesC8& /*aBuffer*/, TInt aReplySlot, const RMessagePtr2& aMessage) - { - DFLOG( "CDevEncPasswdDlg::StartL Begin" ); - iMessage = aMessage; - iReplySlot = aReplySlot; - iNeedToCompleteMessage = ETrue; - - SetActive(); - iStatus = KRequestPending; - TRequestStatus* stat = &iStatus; - User::RequestComplete( stat, KErrNone ); - DFLOG( "CDevEncPasswdDlg::StartL End" ); - } - -void CDevEncPasswdDlg::Cancel() - { - CActive::Cancel(); - } - -TPtrC8 CDevEncPasswdDlg::UpdateL(const TDesC8& /*aBuffer*/) - { - return TPtrC8(); - } - - -void CDevEncPasswdDlg::RunL() - { - DFLOG( "CDevEncPasswdDlg::RunL Begin" ); - TBuf passwdIn; - TBuf8 passwdOut; - - STATIC_CAST( CEikServAppUi*, iEikEnv->AppUi())-> - SuppressAppSwitching( ETrue ); - - iDlg = CAknTextQueryDialog::NewL( passwdIn ); - iDlg->SetMaxLength( KMaxPasswordLength ); - DFLOG( "CDevEncPasswdDlg: PasswdDlg: ExecuteLD" ); - TInt resp = iDlg->ExecuteLD( R_DEVENC_PASSWD_QUERY ); - iDlg = NULL; - - if ( resp == EEikBidCancel ) - { - iMessage.Complete( KErrCancel ); - iNeedToCompleteMessage = EFalse; - } - else - { - if ( CnvUtfConverter::ConvertFromUnicodeToUtf8( passwdOut, passwdIn ) ) - { - iNote = new (ELeave) CAknErrorNote(); - HBufC* prompt = StringLoader::LoadLC( R_DEVENC_INVALID_PASSWD_STRING ); - iNote->ExecuteLD( *prompt ); - iNote = NULL; - CleanupStack::PopAndDestroy( prompt ); - - iTimer.After( iStatus, KErrorNoteTimeout ); - SetActive(); - return; - } - else - { - iMessage.WriteL( iReplySlot, passwdOut ); - iMessage.Complete( KErrNone ); - iNeedToCompleteMessage = EFalse; - } - } - STATIC_CAST( CEikServAppUi*, iEikEnv->AppUi())-> - SuppressAppSwitching( EFalse ); - DFLOG( "CDevEncPasswdDlg::RunL End" ); - } - -TInt CDevEncPasswdDlg::RunError( TInt aError ) - { - if( iNeedToCompleteMessage ) - { - iMessage.Complete( aError ); - } - - iNeedToCompleteMessage = EFalse; - iReplySlot = NULL; - STATIC_CAST( CEikServAppUi*, iEikEnv->AppUi())-> - SuppressAppSwitching( EFalse ); - - return aError; - } - -// End of file - diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/aif/DevEncUi_aif.rss --- a/deviceencryption/DevEncUi/aif/DevEncUi_aif.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2005 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: RSS for creating the aif file for Device Encryption UI. -* -*/ - -#include -#include - -RESOURCE AIF_DATA - { - app_uid=ESSYSAPP_APP_UID; - hidden = KAppIsHidden; - num_icons = 2; - embeddability = KAppNotEmbeddable; - newfile = KAppDoesNotSupportNewFile; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/data/DevEncUi.rss --- a/deviceencryption/DevEncUi/data/DevEncUi.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,857 +0,0 @@ -/* -* Copyright (c) 2005 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: Application resource file. -* -*/ - -// RESOURCE IDENTIFIER -NAME DENC // 4 letter ID - -// INCLUDES -#include -#include -#include // For wait note -#include -#include -#include -#include -#include "DevEnc.hrh" -#include "DevEncUiDef.h" - - -// RESOURCE DEFINITIONS - -// ----------------------------------------------------------------------------- -// -// Define the resource file signature -// This resource should be empty. -// -// ----------------------------------------------------------------------------- -// -RESOURCE RSS_SIGNATURE - { - } - -// ----------------------------------------------------------------------------- -// -// Default Document Name -// -// ----------------------------------------------------------------------------- -// -RESOURCE TBUF r_default_document_name - { - buf = "DevEncUi"; - } - -// ----------------------------------------------------------------------------- -// -// Define default menu and CBA key. -// -// ----------------------------------------------------------------------------- -// -RESOURCE EIK_APP_INFO - { - cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; - } - -// ----------------------------------------------------------------------------- -// -// Localizable application information -// -// ----------------------------------------------------------------------------- -// -RESOURCE LOCALISABLE_APP_INFO r_devencui_localisable_app_info - { - short_caption = qtn_apps_encryption_grid; - caption_and_icon = CAPTION_AND_ICON_INFO - { - caption = qtn_encryption_title; - - // TBD: Is this valid? - number_of_icons = 1; - icon_file = "\\resource\\apps\\DevEncUi_aif.mif"; - }; - } - -// --------------------------------------------------------- -// -// r_devencui_mainview -// Define main view -// -// --------------------------------------------------------- -// -RESOURCE AVKON_VIEW r_devencui_mainview - { - menubar = r_devencui_menubar_main; - cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; - } - -// --------------------------------------------------------- -// -// r_devencui_encrview -// Define encryption view -// -// --------------------------------------------------------- -// -RESOURCE AVKON_VIEW r_devencui_encrview - { - menubar = r_devencui_menubar_encr; - cba = R_AVKON_SOFTKEYS_OPTIONS_BACK; - } - -// --------------------------------------------------------- -// -// r_devencui_decrview -// Define decryption view -// -// --------------------------------------------------------- -// -RESOURCE AVKON_VIEW r_devencui_decrview - { - menubar = r_devencui_menubar_decr; - cba = R_AVKON_SOFTKEYS_OPTIONS_BACK; - } - -// ----------------------------------------------------------------------------- -// -// r_devencui_menubar_encr -// Menubar for NFEUI example -// -// ----------------------------------------------------------------------------- -// -RESOURCE MENU_BAR r_devencui_menubar_encr - { - titles = - { - MENU_TITLE { menu_pane = r_devencui_menu_encr; } - }; - } - -// ----------------------------------------------------------------------------- -// -// r_devencui_menubar_decr -// Menubar for NFEUI example -// -// ----------------------------------------------------------------------------- -// -RESOURCE MENU_BAR r_devencui_menubar_decr - { - titles = - { - MENU_TITLE { menu_pane = r_devencui_menu_decr; } - }; - } - -// ----------------------------------------------------------------------------- -// -// r_devencui_menubar -// Menubar for NFEUI example -// -// ----------------------------------------------------------------------------- -// -RESOURCE MENU_BAR r_devencui_menubar_main - { - titles = - { - MENU_TITLE { menu_pane = r_devencui_menu_main; } - }; - } - -// ----------------------------------------------------------------------------- -// -// r_devencui_menu_main -// Main menu options -// -// ----------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_devencui_menu_main - { - items = - { - MENU_ITEM - { - command = EDevEncUiCommandChange; - txt = qtn_options_change; - flags = EEikMenuItemAction; - }, - MENU_ITEM - { - command = EDevEncUiCommandHelp; - txt = qtn_options_help; - }, - MENU_ITEM - { - command = EAknSoftkeyExit; - txt = qtn_options_exit; - } - }; - } - -// ----------------------------------------------------------------------------- -// -// r_devencui_menu_encr -// Encryption menu options -// -// ----------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_devencui_menu_encr - { - items = - { - MENU_ITEM - { - command = EDevEncUiCommandHelp; - txt = qtn_options_help; - }, - MENU_ITEM - { - command = EAknSoftkeyExit; - txt = qtn_options_exit; - } - }; - } - -// ----------------------------------------------------------------------------- -// -// r_devencui_menu_decr -// Decryption menu options -// -// ----------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_devencui_menu_decr - { - items = - { - MENU_ITEM - { - command = EDevEncUiCommandHelp; - txt = qtn_options_help; - }, - MENU_ITEM - { - command = EAknSoftkeyExit; - txt = qtn_options_exit; - } - }; - } - -//---------------------------------------------------- -// -// r_settingslist_setting_item_list -// settings item list for the application -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_ITEM_LIST r_devencui_setting_item_list - { - items = - { - AVKON_SETTING_ITEM - { - identifier = EPhoneEncryptionSettingItem; - setting_page_resource = r_settingslist_phonememory_setting_page; - associated_resource = r_settingslist_phonememory_popup_setting_texts; - name = qtn_encryption_phonememory; - }, - AVKON_SETTING_ITEM - { - identifier = EMemoryCardEncryptionSettingItem; - setting_page_resource = r_settingslist_memorycard_setting_page; - associated_resource = r_settingslist_memorycard_popup_setting_texts; - name = qtn_encryption_memorycard; - } - }; - } - -//---------------------------------------------------- -// -// r_settingslist_phonememory_setting_page -// hints setting page for the setting list -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_settingslist_phonememory_setting_page - { - label = qtn_encryption_phonememory_setting_title; - type = EAknCtPopupSettingList; - editor_resource_id = r_settingslist_phonememory_popup_setting_list; - } - -//---------------------------------------------------- -// -// r_settingslist_phonememory_encryption_setting_page -// hints setting page for the setting list -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_settingslist_memorycard_setting_page - { - label = qtn_encryption_memorycard_setting_title; - type = EAknCtPopupSettingList; - editor_resource_id = r_settingslist_memorycard_popup_setting_list; - } - -//---------------------------------------------------- -// -// r_settingslist_phonememory_popup_setting_texts -// popup setting list for the hint item of the -// setting list -// -//---------------------------------------------------- -// -RESOURCE POPUP_SETTING_LIST r_settingslist_phonememory_popup_setting_list - { - } - -//---------------------------------------------------- -// -// r_settingslist_phonememory_popup_setting_texts -// popup setting list for the hint item of the -// setting list -// -//---------------------------------------------------- -// -RESOURCE POPUP_SETTING_LIST r_settingslist_memorycard_popup_setting_list - { - } - -//---------------------------------------------------- -// -// r_settingslist_hints_popup_setting_texts -// popped up and non-popped up texts for the hint -// item of the setting list -// -//---------------------------------------------------- -// -RESOURCE AVKON_POPUP_SETTING_TEXTS r_settingslist_phonememory_popup_setting_texts - { - setting_texts_resource = r_settingslist_encryption_state_texts; - popped_up_texts_resource = r_settingslist_hints_popup_texts; - } - -//---------------------------------------------------- -// -// r_settingslist_hints_popup_setting_texts -// popped up and non-popped up texts for the hint -// item of the setting list -// -//---------------------------------------------------- -// -RESOURCE AVKON_POPUP_SETTING_TEXTS r_settingslist_memorycard_popup_setting_texts - { - setting_texts_resource = r_settingslist_encryption_state_texts; - popped_up_texts_resource = r_settingslist_hints_popup_texts; - } - -//---------------------------------------------------- -// -// r_settingslist_hints_texts -// non-popped up texts for the hint -// item of the setting list -// -//---------------------------------------------------- -// -RESOURCE ARRAY r_settingslist_encryption_state_texts - { - items = - { - AVKON_ENUMERATED_TEXT - { - value = 1; - text = qtn_encryption_phonememory_setting_on; - }, - AVKON_ENUMERATED_TEXT - { - value = 0; - text = qtn_encryption_phonememory_setting_off; - } - - }; - } - -//---------------------------------------------------- -// -// r_settingslist_hints_popup_texts -// popped up texts for the hint -// item of the setting list -// -//---------------------------------------------------- -// -RESOURCE ARRAY r_settingslist_hints_popup_texts - { - items = - { - LBUF - { - txt = qtn_encryption_phonememory_setting_on; - }, - LBUF - { - txt = qtn_encryption_phonememory_setting_off; - } - }; - } - -//---------------------------------------------------- -// -// r_devencui_confirmation_query -// confirmation query for the application -// -//---------------------------------------------------- -// -RESOURCE DIALOG r_devencui_confirmation_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EDevEncUiDlgCIdConfirmationQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - label = qtn_encryption_note_lock; - }; - } - }; - } - -// --------------------------------------------------------- -// -// r_devencui_encrypt_confirmation_query_dialog -// About dialog - show version and copyright info etc. -// -// --------------------------------------------------------- -// - -RESOURCE DIALOG r_devencui_encrypt_confirmation_query_dialog - { - flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - label = qtn_encryption_note_header; - headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - message = qtn_encryption_note_lock; - }; - } - }; - } - -//---------------------------------------------------- -// -// r_devencui_data_query -// data query for the application -// -//---------------------------------------------------- -RESOURCE DIALOG r_devencui_data_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EDevEncUiDlgCIdDataQuery; - control = AVKON_DATA_QUERY - { - layout = EDataLayout; - control = - EDWIN - { - width = KMaxFileNameLength; - lines = 1; - maxlength = KMaxFileNameLength; - }; - }; - } - }; - } - -//---------------------------------------------------- -// -// r_devencui_code_query -// secret data query for the application -// -//---------------------------------------------------- -RESOURCE DIALOG r_devencui_code_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EDevEncUiSecretCodeQueryId; - control = AVKON_DATA_QUERY - { - layout = ECodeLayout; - label = qtn_encryption_passphrase_ask; - control = SECRETED - { - num_letters = KMaxPasswordLength; - }; - }; - } - }; - } - -//---------------------------------------------------- -// -// r_devencui_list_query -// list query for the application -// -//---------------------------------------------------- -// -//RESOURCE AVKON_LIST_QUERY r_devencui_list_query -// { -// items = -// { -// AVKON_LIST_QUERY_DLG_LINE -// { -// control = AVKON_LIST_QUERY_CONTROL -// { -// listtype = EAknCtSinglePopupMenuListBox; -// heading = qtn_encryption_selectkey; -// listbox = AVKON_LIST_QUERY_LIST -// { -// // array of items will be defined dynamically -// }; -// }; -// } -// }; -// } -RESOURCE DIALOG r_devencui_list_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtListQueryControl; - id = EListQueryControl; - control = AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSinglePopupMenuListBox; - heading = qtn_encryption_selectkey; - listbox = AVKON_LIST_QUERY_LIST - { - }; - }; - } - }; - } - -// --------------------------------------------------------- -// r_devencui_encryption_listbox -// -// -// --------------------------------------------------------- -// -RESOURCE LISTBOX r_devencui_encryption_listbox - { - array_id = r_devencui_encryption_listbox_items; - flags = EAknListBoxSelectionList; - } - -// --------------------------------------------------------- -// r_devencui_encryption_listbox_items -// -// -// --------------------------------------------------------- -// -RESOURCE ARRAY r_devencui_encryption_listbox_items - { - items = - { - LBUF - { - txt = "\t"qtn_encryption_encrypt"\t\t"; - }, - LBUF - { - txt = "\t"qtn_encryption_encryptsave"\t\t"; - }, - LBUF - { - txt = "\t"qtn_encryption_encryptload"\t\t"; - } - }; - } - -// --------------------------------------------------------- -// r_devencui_decryption_listbox -// -// -// --------------------------------------------------------- -// -RESOURCE LISTBOX r_devencui_decryption_listbox - { - array_id = r_devencui_decryption_listbox_items; - flags = EAknListBoxSelectionList; - } - -// --------------------------------------------------------- -// r_devencui_decryption_listbox_items -// -// -// --------------------------------------------------------- -// -RESOURCE ARRAY r_devencui_decryption_listbox_items - { - items = - { - LBUF - { - txt = "\t"qtn_encryption_decrypt"\t\t"; - }, - LBUF - { - txt = "\t"qtn_encryption_decryptturnoff"\t\t"; - } - }; - } - -RESOURCE DIALOG r_devencui_creating_key_waitnote - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EDevEncUiWaitNoteId; - control = AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_encryption_note_wait; - //imagefile = "z:\\system\data\avkon.mbm"; - imagefile = "z:\\resource\apps\avkon2.mbm"; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -// ----------------------------------------------------------------------------- -// -// Resources for messages. -// -// ----------------------------------------------------------------------------- - -RESOURCE TBUF r_devencui_text_encryption_on { buf = - qtn_encryption_phonememory_setting_on; } - -RESOURCE TBUF r_devencui_text_encryption_off { buf = - qtn_encryption_phonememory_setting_off; } - -RESOURCE TBUF r_devencui_text_apps_grid { buf = - qtn_apps_encryption_grid; } - -RESOURCE TBUF r_devencui_text_title { buf = - qtn_encryption_title; } - -RESOURCE TBUF r_devencui_text_phonememory { buf = - qtn_encryption_phonememory; } - -RESOURCE TBUF r_devencui_text_memorycard { buf = - qtn_encryption_memorycard; } - -RESOURCE TBUF r_devencui_text_note_lock { buf = - qtn_encryption_note_lock; } - -RESOURCE TBUF r_devencui_text_note_encrypting { buf = - qtn_encryption_note_encrypting; } - -RESOURCE TBUF r_devencui_text_note_phone_decrypting { buf = - qtn_encryption_note_phone_decrypting; } - -RESOURCE TBUF r_devencui_text_encrypt { buf = - qtn_encryption_encrypt; } - -RESOURCE TBUF r_devencui_text_encryptsave { buf = - qtn_encryption_encryptsave; } - -RESOURCE TBUF r_devencui_text_encryptload { buf = - qtn_encryption_encryptload; } - -RESOURCE TBUF r_devencui_text_note_wait { buf = - qtn_encryption_note_wait; } - -RESOURCE TBUF r_devencui_text_passphrase_protect { buf = - qtn_encryption_passphrase_protect; } - -RESOURCE TBUF r_devencui_text_filename { buf = - qtn_encryption_filename; } - -RESOURCE TBUF r_devencui_text_note_saveinfo { buf = - qtn_encryption_note_saveinfo; } - -RESOURCE TBUF r_devencui_text_selectkey { buf = - qtn_encryption_selectkey; } - -RESOURCE TBUF r_devencui_text_passphrase_ask { buf = - qtn_encryption_passphrase_ask; } - -RESOURCE TBUF r_devencui_text_note_memorycard_encrypted { buf = - qtn_encryption_note_memorycard_encrypted; } - -RESOURCE TBUF r_devencui_text_decrypt { buf = - qtn_encryption_decrypt; } - -RESOURCE TBUF r_devencui_text_decryptturnoff { buf = - qtn_encryption_decryptturnoff; } - -RESOURCE TBUF r_devencui_text_note_decrypting { buf = - qtn_encryption_note_decrypting; } - -RESOURCE TBUF r_devencui_text_note_decryptingdestroy { buf = - qtn_encryption_note_decryptingdestroy; } - -RESOURCE TBUF r_devencui_text_note_decrypt_loadkey { buf = - qtn_encryption_note_decrypt_loadkey; } - -RESOURCE TBUF r_devencui_text_note_insertunencrypted { buf = - qtn_encryption_note_insertunencrypted; } - -RESOURCE TBUF r_devencui_text_note_decrypt_nomemrycard { buf = - qtn_encryption_note_decrypt_nomemrycard; } - -RESOURCE TBUF r_devencui_text_note_memorycard_unencrypted { buf = - qtn_encryption_note_memorycard_unencrypted; } - -RESOURCE TBUF r_devencui_text_note_insertencrypted { buf = - qtn_encryption_note_insertencrypted; } - -RESOURCE TBUF r_devencui_text_note_encryptioninterrupt { buf = - qtn_encryption_note_encryptioninterrupt; } - -RESOURCE TBUF r_devencui_text_phonememory_setting_title { buf = - qtn_encryption_phonememory_setting_title; } - -RESOURCE TBUF r_devencui_text_memorycard_setting_title { buf = - qtn_encryption_memorycard_setting_title; } - -RESOURCE TBUF r_devencui_text_note_wrongkeyfile { buf = - qtn_encryption_note_wrongkeyfile; } - -RESOURCE TBUF r_devencui_text_note_unusedmemorycard { buf = - qtn_encryption_note_unusedmemorycard; } - -RESOURCE TBUF r_devencui_text_encrypt_process { buf = - qtn_encryption_encrypt_process; } - -RESOURCE TBUF r_devencui_text_decrypt_process { buf = - qtn_encryption_decrypt_process; } - -RESOURCE TBUF r_devencui_text_note_insertoff_unusedmemorycard { buf = - qtn_encryption_note_insertoff_unusedmemorycard; } - -RESOURCE TBUF r_devencui_text_note_inserton_unusedmemorycard { buf = - qtn_encryption_note_inserton_unusedmemorycard; } - -RESOURCE TBUF r_devencui_text_phonememory_setting_on { buf = - qtn_encryption_phonememory_setting_on; } - -RESOURCE TBUF r_devencui_text_phonememory_setting_off { buf = - qtn_encryption_phonememory_setting_off; } - -RESOURCE TBUF r_devencui_text_memorycard_setting_on { buf = - qtn_encryption_memorycard_setting_on; } - -RESOURCE TBUF r_devencui_text_memorycard_setting_off { buf = - qtn_encryption_memorycard_setting_off; } - -RESOURCE TBUF r_devencui_text_apps_list { buf = - qtn_apps_encryption_list; } - -RESOURCE TBUF r_devencui_note_header { buf = - qtn_encryption_note_header; } - -RESOURCE TBUF r_devencui_note_admin_control { buf = - qtn_encryption_note_admin_control; } - -// Own text buffers - -RESOURCE TBUF r_devencui_text_corrupted { buf = - qtn_encryption_corrupted; } - -RESOURCE TBUF r_devencui_text_battery_low { buf = - qtn_encryption_battery_low; } - -RESOURCE TBUF r_devencui_text_no_keys_found { buf = - qtn_encryption_note_no_keys_found; } - -RESOURCE TBUF r_devencui_text_invalid_password { buf = - qtn_encryption_note_invalid_password; } - -RESOURCE TBUF r_devencui_text_key_error { buf = - qtn_encryption_note_key_error; } - -RESOURCE TBUF r_devencui_text_bad_name { buf = - qtn_encryption_note_bad_name; } - -RESOURCE TBUF r_devencui_text_file_exists { buf = - qtn_encryption_note_file_exists; } - -RESOURCE TBUF r_devencui_fota_not_poss { buf = - qtn_conf_encr_not_poss; } - -//---------------------------------------------------- -// -// r_devencui_confirmation_query_ok_empty -// -//---------------------------------------------------- -// -RESOURCE DIALOG r_devencui_confirmation_query_ok_empty - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationLayout; - }; - } - }; - } - -// END OF FILE diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/data/DevEncUi_reg.rss --- a/deviceencryption/DevEncUi/data/DevEncUi_reg.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2005 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: Application registration resource file. -* -*/ - -#include -#include -#include -#include -#include "DevEncUids.hrh" - -UID2 KUidAppRegistrationResourceFile -UID3 KDevEncUiUid - -RESOURCE APP_REGISTRATION_INFO - { - app_file = "DevEncUi"; - localisable_resource_file = APP_RESOURCE_DIR"\\DevEncUi"; - localisable_resource_id = R_DEVENCUI_LOCALISABLE_APP_INFO; - embeddability = KAppEmbeddable; - hidden = KAppIsHidden; - newfile = KAppDoesNotSupportNewFile; - datatype_list = - { - DATATYPE - { - priority = EDataTypePriorityHigh; - type = "application/vnd.nokia.pk5"; - } - }; - } diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/group/DevEncUi.mmp --- a/deviceencryption/DevEncUi/group/DevEncUi.mmp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2005 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 specification file for DevEncUi. -* -*/ - -#include -#include -#include "../../common/DevEncUids.hrh" - -TARGET devencui.exe -TARGETTYPE exe -UID 0x0 KDevEncUiUid -//EPOCSTACKSIZE 0x5000 - -VENDORID KDevEncNokiaVID -CAPABILITY CAP_GENERAL_DLL CAP_APPLICATION WriteDeviceData DiskAdmin -DRM - -SOURCEPATH ../src -SOURCE DevEncUi.cpp -SOURCE DevEncUiApplication.cpp -SOURCE DevEncUiAppui.cpp -SOURCE DevEncUiCreateKeyProcess.cpp -SOURCE DevEncUiDecrView.cpp -SOURCE DevEncUiDecrViewContainer.cpp -SOURCE DevEncUiDocument.cpp -SOURCE DevEncUiEncrView.cpp -SOURCE DevEncUiEncrViewContainer.cpp -SOURCE DevEncUiEncryptionOperator.cpp -SOURCE DevEncUiFileManager.cpp -SOURCE DevEncUiMainView.cpp -SOURCE DevEncUiMainViewContainer.cpp -SOURCE DevEncUiMemoryEntity.cpp -SOURCE DevEncUiSecretMinMaxCodeQuery.cpp -SOURCE DevEncUiSettingItemList.cpp -SOURCE DevEncUiTimer.cpp - -SOURCEPATH ../../common -SOURCE DevEncLog.cpp - -SOURCEPATH ../data - -START RESOURCE DevEncUi.rss -HEADER -TARGETPATH APP_RESOURCE_DIR -LANGUAGE_IDS -END //RESOURCE - -START RESOURCE DevEncUi_reg.rss -DEPENDS devencui.rsg -HEADER -TARGETPATH /private/10003a3f/apps -END //RESOURCE - -USERINCLUDE ../inc -USERINCLUDE ../../common - -APP_LAYER_SYSTEMINCLUDE - -SYSTEMINCLUDE /epoc32/include/platform/mw/uikon - -LIBRARY aknicon.lib -LIBRARY aknnotify.lib -LIBRARY aknskins.lib -LIBRARY aknskinsrv.lib -LIBRARY aknswallpaperutils.lib -LIBRARY apparc.lib -LIBRARY avkon.lib -LIBRARY bafl.lib -LIBRARY centralrepository.lib -LIBRARY charconv.lib -LIBRARY commonengine.lib -LIBRARY cone.lib -LIBRARY devenccommonutils.lib -LIBRARY efsrv.lib -LIBRARY egul.lib -LIBRARY eikcoctl.lib -LIBRARY eikcore.lib -LIBRARY eikctl.lib -LIBRARY eikdlg.lib -LIBRARY eiksrv.lib -LIBRARY estor.lib -LIBRARY euser.lib -LIBRARY hlplch.lib // Help launcher -LIBRARY platformenv.lib // for system path literals -LIBRARY secui.lib -LIBRARY ws32.lib -LIBRARY terminalcontrol.lib -DEBUGLIBRARY flogger.lib - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/group/bld.inf --- a/deviceencryption/DevEncUi/group/bld.inf Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2005 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: Provides the information required for building DevEncUi. -* -*/ - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -// Exported headers -../loc/devenc.loc APP_LAYER_LOC_EXPORT_PATH(devenc.loc) - -//../inc/encryption.hlp.hrh /epoc32/include/cshelp/encryption.hlp.hrh - -PRJ_EXTENSIONS -START EXTENSION s60/mifconv - OPTION TARGETFILE DevEncUi_aif.mif - OPTION SOURCES \ - -c8,8 qgn_menu_encryption.svg -END - -PRJ_MMPFILES -DevEncUi.mmp - -//gnumakefile Icons_aif_scalable_dc.mk - -// End of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/group/qgn_menu_encryption.svg --- a/deviceencryption/DevEncUi/group/qgn_menu_encryption.svg Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUi.hrh --- a/deviceencryption/DevEncUi/inc/DevEncUi.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* -* Copyright (c) 2005 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: Enumerations used in the application UI. -* -*/ - -#ifndef __DEVENCUI_HRH__ -#define __DEVENCUI_HRH__ - -// DevEncUi enumerate command codes -enum TDevEncUiCommandIds - { - EDevEncUiCommandChange = 4242, // start value must not be 0 - EDevEncUiCommandHelp, - - // These MMC-related commands are used in the Encryption view. - EDevEncUiCommandEncryptWithoutSavingKey, - EDevEncUiCommandEncryptAndSaveKey, - EDevEncUiCommandEncryptWithRestoredKey, - - // These MMC-related commands are used in the Decryption view. - EDevEncUiCommandDecrypt, - EDevEncUiCommandDecryptAndTurnOffEncryption, - - EDevEncUiInternalCommandEncrypt, - EDevEncUiInternalCommandDecrypt, - - // ID's of some UI items - EPhoneEncryptionSettingItem, - EMemoryCardEncryptionSettingItem, - EDevEncUiDlgCIdConfirmationQuery, - EDevEncUiDlgCIdDataQuery, - EDevEncUiWaitNoteId, - EDevEncUiSecretCodeQueryId - }; - -enum TDevEncUiMemoryType - { - EPhoneMemory, - EMemoryCard - }; - -enum TDevEncUiMemoryEntityState - { - EMemStateUnknown, - EMemDecrypted, - EMemEncrypting, - EMemEncrypted, - EMemDecrypting, - EMemCorrupted - }; - -enum TDevEncUiViewIds - { - EDevEncUiMainViewId = 1, - EDevEncUiEncrViewId, - EDevEncUiDecrViewId, - EDevEncUiNumberOfViews - }; - -#endif // __DEVENCUI_HRH__ diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUi.pan --- a/deviceencryption/DevEncUi/inc/DevEncUi.pan Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2005 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: Application panic codes. -* -*/ - -#ifndef __DEVENCUI_PAN__ -#define __DEVENCUI_PAN__ - -/** DevEncUi application panic codes */ -enum TDevEncUiPanics - { - EDevEncUi = 1 - // add further panics here - }; - -inline void Panic( TDevEncUiPanics aReason ) - { - _LIT(applicationName,"DevEncUi"); - User::Panic(applicationName, aReason); - } - -#endif // __DEVENCUI_PAN__ diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiApplication.h --- a/deviceencryption/DevEncUi/inc/DevEncUiApplication.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2005 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: Application entry point. -* -*/ - -#ifndef __DEVENCUIAPPLICATION_H__ -#define __DEVENCUIAPPLICATION_H__ - -// INCLUDES -#include - -// CLASS DECLARATION - -/** -* CDevEncUiApplication application class. -* Provides factory to create concrete document object. -* An instance of CDevEncUiApplication is the application part of the -* AVKON application framework for the DEVENCUI example application. -*/ -class CDevEncUiApplication : public CAknApplication - { - public: // Functions from base classes - - /** - * From CApaApplication, AppDllUid. - * @return Application's UID (KUidDEVENCUIApp). - */ - TUid AppDllUid() const; - - protected: // Functions from base classes - - /** - * From CApaApplication, CreateDocumentL. - * Creates CDevEncUiDocument document object. The returned - * pointer in not owned by the CDevEncUiApplication object. - * @return A pointer to the created document object. - */ - CApaDocument* CreateDocumentL(); - }; - -#endif // __DEVENCUIAPPLICATION_H__ - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiAppui.h --- a/deviceencryption/DevEncUi/inc/DevEncUiAppui.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,222 +0,0 @@ -/* -* Copyright (c) 2005 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: AppUi class of the application. -* -*/ - -#ifndef __DEVENCUIAPPUI_H__ -#define __DEVENCUIAPPUI_H__ - -// INCLUDES -#include -#include -#include -#include "DevEncUiMemInfoObserver.h" -#include "DevEncUiTimer.h" - -// FORWARD DECLARATIONS -class CDevEncUiEncrView; -class CDevEncUiEncryptionOperator; -class CDevEncUiDecrView; -class CDevEncUiMainView; -class CDevEncUiMemoryEntity; -class CRepository; - -// CLASS DECLARATION -/** -* CDevEncUiAppUi application UI class. -* Interacts with the user through the UI and request message processing -* from the handler class -*/ -class CDevEncUiAppUi : public CAknViewAppUi, - public MMemoryCardObserver, - public MDevEncUiMemInfoObserver, - public MDevEncUiTimerCallback - { - public: // Constructors and destructor - - /** - * ConstructL. - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * CDevEncUiAppUi. - * C++ default constructor. This needs to be public due to - * the way the framework constructs the AppUi - */ - CDevEncUiAppUi(); - - /** - * Virtual Destructor. - */ - virtual ~CDevEncUiAppUi(); - - /** - * Dynamically initialises a menu pane. - * The Uikon framework calls this function, if it is implemented in a - * menu's observer, immediately before the menu pane is activated. - */ - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - - /** - * From MMemoryCardObserver. - */ - void MMCStatusChangedL(); - - /** - * From MDevEncUiMemInfoObserver. - */ - void UpdateInfo( TDevEncUiMemoryType aType, - TUint aState, - TUint aProgress ); - - /** - * From MDevEncUiTimerCallback - */ - void Timeout(); - - protected: - /** - * From CAknViewAppUi. Handles changes in keyboard focus when an - * application switches to foreground. - */ - void HandleForegroundEventL( TBool aForeground ); - - private: // Functions from base classes - - /** - * From CEikAppUi, HandleCommandL. - * Takes care of command handling. - * @param aCommand Command to be handled. - */ - void HandleCommandL( TInt aCommand ); - - /** - * Displays the context-sensitive help. - */ - void DisplayHelpL(); - - void DoUpdateInfoL( TDevEncUiMemoryType aType, - TUint aState ); - - /** - * From CEikAppUi. - * Command line processing. - * - * When DocumentHandler wants to launch NpdViewer as a standalone - * application, it use RApaLsSession::StartDocument(filename, ...). - * - * CEikonEnv::ConstructAppFromCommandLineL(...), at first, pass - * the filename information to ProcessCommandParametersL - * correctly. But default CEikAppUi::ProcessCommandParametersL - * overwrite it's reference parameter (TFileName& aDocumentName) to - * application's defualt document name such as "NpdViewer.ini". - * (In EikAppUi.cpp, - * Application()->GetDefaultDocumentFileName(aDocumentName); - * do this). - * So, when CEikonEnv::ConstructAppFromCommandLineL(...) calls - * CApaDocument::OpenFileL(...), the filename information from - * Document Handler had been lost. - * - * On the other hand, when DocumentHandler wants to launch NpdViewer - * as a embeded application, it use CApaDocument::OpenFileL() directly - * and never call ProcessCommandParametersL. - * - * So, in order to pass a correct filename information to OpenFileL - * in both case, we decide to override this function. - * - * @param aCommand command. (ignored) - * @param aDocumentName Filename. - * @param aTail optional command line parampeter. (ignored) - * @return ETrue if aDocumentName file exists. - */ - TBool ProcessCommandParametersL( - TApaCommand aCommand, - TFileName& aDocumentName, - const TDesC8& aTail); - - /** - * From CEikAppUi. - * Start fileviewer with specified filename. - * Both standalone and embeded case, this function is really called - * - * @param aFilename Filename to view. - */ - void OpenFileL(const TDesC& aFilename); - - /** - * Copy a file to a new path (Others folder) - **/ - void CopyL(const TDesC &anOld, const TDesC &aNew); - - public: - - /** - * Start fileviewer with specified file handle. - * Both standalone and embeded case, this function is really called - * - * @param aFile File handle. - */ - void OpenFileL(RFile& aFile); - - private: // Data - - /** Created by this class, ownership transferred to CAknAppUi */ - CDevEncUiMainView* iMainView; - - /** Created by this class, ownership transferred to CAknAppUi */ - CDevEncUiEncrView* iEncryptionView; - - /** Created by this class, ownership transferred to CAknAppUi */ - CDevEncUiDecrView* iDecryptionView; - - /** Owned */ - CDevEncUiEncryptionOperator* iEncOperator; - - /** Owned */ - RArray iMemEntities; - - /** Owned */ - CRepository* iCrSettings; - - /** Owned */ - CMmcObserver* iObserver; - - /** Owned */ - RFs iFs; - - /** Holds the current MMC mount status (from file server) */ - TInt iMmcStatus; - - /** Hold the current MMC encryption status (from NFE) */ - TInt iMmcEncState; - - /** ETrue if a Mmc status update is ongoing (to prevent re-entry) */ - TBool iStatusUpdateOngoing; - - /** Owned */ - CDevEncUiTimer* iTimer; - - /** ETrue if the application is foreground */ - TBool iForeground; - - /** ETrue if the application hasn't completed yet the construction phase */ - TBool iConstructionOnGoing; - }; - -#endif // __DEVENCUIAPPUI_H__ - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiConfig.hrh --- a/deviceencryption/DevEncUi/inc/DevEncUiConfig.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2005 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 __DEVENCUI_CONFIG_H__ -#define __DEVENCUI_CONFIG_H__ - -// Comment this out to disable logs -#define DEVENCUI_LOG - -#endif // __DEVENCUI_CONFIG_H__ -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiContainerEventCallback.h --- a/deviceencryption/DevEncUi/inc/DevEncUiContainerEventCallback.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2005 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: Mixin class for notifying observers about user selections. -* -*/ - -#ifndef DEVENCUI_CONTAINEREVENTCALLBACK_H_ -#define DEVENCUI_CONTAINEREVENTCALLBACK_H_ - -#include "DevEnc.hrh" - -class MContainerEventCallback - { - public: - virtual void EncryptionStatusChangeReq( - TDevEncUiMemoryType aType ) = 0; - }; - -#endif /*DEVENCUI_CONTAINEREVENTCALLBACK_H_*/ diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiCreateKeyProcess.h --- a/deviceencryption/DevEncUi/inc/DevEncUiCreateKeyProcess.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2005 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: Shows a progress notification during the creation of keys. -* -*/ - -#ifndef DEVENCUI_CREATEKEYPROCESS_H_ -#define DEVENCUI_CREATEKEYPROCESS_H_ - -#include -#include - -class CDevEncUiCreateKeyProcess : public CBase, - public MAknBackgroundProcess - - { - public: - virtual ~CDevEncUiCreateKeyProcess(); - static TBool RunLD(); - - private: - CDevEncUiCreateKeyProcess(); - void ProcessFinished(); - void DialogDismissedL( TInt aButtonId ); - TBool IsProcessDone() const; - void StepL(); - - // Data - TInt iCount; - }; - -#endif /*DEVENCUI_CREATEKEYPROCESS_H_*/ diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiDecrView.h --- a/deviceencryption/DevEncUi/inc/DevEncUiDecrView.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* Copyright (c) 2005 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: Decryption view. -* -*/ - -#ifndef __DEVENCUI_DECRVIEW_H__ -#define __DEVENCUI_DECRVIEW_H__ - -//INCLUDES - -// System includes -#include - -//User Includes -#include "DevEncUiDocument.h" - -// FORWARD DECLARATIONS -class CDevEncUiDecrViewContainer; -class CDevEncUiMemoryEntity; - -class CDevEncUiDecrView: public CAknView - { - public: // constructors and destructor - - /** - * Symbian OS 2 phase constructor. - * Constructs the CDevEncUiDecrView using the NewLC method, popping - * the constructed object from the CleanupStack before returning it. - * - * @param aRect The rectangle for this window - * @return The newly constructed CDevEncUiDecrView - */ - static CDevEncUiDecrView* NewL( RArray& aMemEntities ); - - /** - * Symbian OS 2 phase constructor. - * Constructs the CDevEncUiDecrView using the constructor and ConstructL - * method, leaving the constructed object on the CleanupStack before returning it. - * - * @param aRect The rectangle for this window - * @return The newly constructed CDevEncUiDecrView - */ - static CDevEncUiDecrView* NewLC( RArray& aMemEntities ); - CDevEncUiDecrViewContainer* Container(); - - /** - * Destructor. Frees up memory. - */ - ~CDevEncUiDecrView(); - CDevEncUiAppUi& GetAppUi(); - - protected: - /** - * HandleStatusPaneSizeChange. - * Called by the framework when the application status pane - * size is changed. - */ - void HandleStatusPaneSizeChange(); - - void HandleResourceChangeL( TInt aType ); - - private: // from CAknView - - /** - * Called by the framework - * @return The Uid for this view - */ - TUid Id() const; - - /** - * From CEikAppUi, takes care of command handling for this view. - * @param aCommand command to be handled - */ - void HandleCommandL( TInt aCommand ); - - CDevEncUiDecrView( RArray& aMemEntities ); - - /** - * Called by the framework when the view is activated. Constructs the - * container if necessary, setting this view as its MOP parent, and - * adding it to the control stack. - */ - void DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * Called by the framework when the view is deactivated. - * Removes the container from the control stack and deletes it. - */ - void DoDeactivate(); - - private: // constructors - - /** - * Symbian OS 2nd phase constructor. - * Uses the superclass constructor to construct the view using the - * R_EMCCVIEWSWITCHED_VIEW1 resource. - */ - void ConstructL(); - - private: // data - /** Owned. What this view will display */ - CDevEncUiDecrViewContainer* iContainer; - TUid iId; - - /** Not owned */ - RArray& iMemEntities; - - }; - -#endif // __DEVENCUI_DECRVIEW_H__ - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiDecrViewContainer.h --- a/deviceencryption/DevEncUi/inc/DevEncUiDecrViewContainer.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* -* Copyright (c) 2005 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: Container for the decryption view. -* -*/ - -#ifndef __DEVENCUI_GRAPHIC_VIEW_CONTAINER_H__ -#define __DEVENCUI_GRAPHIC_VIEW_CONTAINER_H__ - -//INCLUDES - -//System Includes -#include -#include -#include - -//User Includes - -//FORWARD DECLARATIONS -class CAknDoubleStyle2ListBox; - -class CDevEncUiDecrViewContainer : public CCoeControl, - public MEikListBoxObserver - { -public: - /** - * @function NewLC - * @abstract Creates a CDevEncUiEncrViewContainer object, which will - * draw itself to aRect - * @param aRect A rectangle that defines the size and location of the - * displayable area for the view - * @param aDocument the document - **/ - static CDevEncUiDecrViewContainer* NewL(const TRect& aRect, CAknView& aOwningView); - /** - * @function NewL - * @abstract Creates a CDevEncUiEncrViewContainer object, which will draw - * itself to aRect - * @param aRect A rectangle that defines the size and location of the - * displayable area for the view - * @param aDocument the document - **/ - static CDevEncUiDecrViewContainer* NewLC(const TRect& aRect, CAknView& aOwningView); - - /** - * Destructor. - **/ - ~CDevEncUiDecrViewContainer(); - - // from MEikListBoxObserver - void HandleListBoxEventL( CEikListBox* aListBox, - TListBoxEvent aEventType ); - - /** - * From CCoeControl. Called by the framework in compound controls - * @return The number of controls in this CSimpleListContainer - */ - TInt CountComponentControls() const; - - /** - * From CCoeControl. Called by the framework in compound controls - * @param The index of the control to return - * @return The control for aIndex - */ - CCoeControl* ComponentControl( TInt aIndex ) const; - - /** - * Called by the framework to draw this control. Clears the area in - * aRect. - * @param aRect in which to draw - */ - void Draw( const TRect& aRect ) const; - - /** - * Called by the framework whenever a key event occurs. - * @param aKeyEvent the Key event which occured, e.g. select key pressed - * @param aType the type of Key event which occurred, e.g. key up, key down - * @return TKeyResponse EKeyWasNotConsumed if the key was not processed, - * EKeyWasConsumed if it was - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ); - /** - * Called by framework when the view size is changed. Resizes the - * iLabel accordingly. - */ - void SizeChanged(); - -private: - /** - * @function CDevEncUiEncrViewContainer - * @abstract Performs the first stage construction - * @param aOwningView the view that owns this container - **/ - CDevEncUiDecrViewContainer(CAknView& aOwningView/*CDevEncUiDocument* aDocument*/); - - /** - * @function ConstructL - * @abstract Performs the second phase construction, setting the bounding - * rectangle to aRect - * @param aRect the display area for the view - **/ - void ConstructL(const TRect& aRect); - - /** - * Constructs the iListBox, setting its window. - */ - void CreateListL(); - -private: - CAknView& iOwningView; - CAknDoubleStyle2ListBox* iListBox; -}; - - -#endif // __DEVENCUI_GRAPHIC_VIEW_CONTAINER_H__ diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiDef.h --- a/deviceencryption/DevEncUi/inc/DevEncUiDef.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2005 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: Common definitions for the application. -* -*/ - -#ifndef DEVENCUIDEF_H_ -#define DEVENCUIDEF_H_ - -enum TDevEncUiDefinitions - { - KMinPasswordLength = 4, // Same as for security code - KMaxPasswordLength = 50, - KMaxKeyNameLength = 50, - KMaxFilenameLength = 100 - }; - -#endif /*DEVENCUIDEF_H_*/ diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiDocument.h --- a/deviceencryption/DevEncUi/inc/DevEncUiDocument.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/* -* Copyright (c) 2005 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: Document class of the application. -* -*/ - -#ifndef __DEVENCUIDOCUMENT_H__ -#define __DEVENCUIDOCUMENT_H__ - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class CDevEncUiAppUi; -class CEikApplication; - - -// CLASS DECLARATION - -/** -* CDevEncUiDocument application class. -* An instance of class CDevEncUiDocument is the Document part of the -* AVKON application framework for the DEVENCUI example application. -*/ -class CDevEncUiDocument : public CAknDocument - { - public: // Constructors and destructor - - /** - * NewL. - * Two-phased constructor. - * Construct a CDevEncUiDocument for the AVKON application aApp - * using two phase construction, and return a pointer - * to the created object. - * @param aApp Application creating this document. - * @return A pointer to the created instance of CDevEncUiDocument. - */ - static CDevEncUiDocument* NewL( CEikApplication& aApp ); - - /** - * NewLC. - * Two-phased constructor. - * Construct a CDevEncUiDocument for the AVKON application aApp - * using two phase construction, and return a pointer - * to the created object. - * @param aApp Application creating this document. - * @return A pointer to the created instance of CDevEncUiDocument. - */ - static CDevEncUiDocument* NewLC( CEikApplication& aApp ); - - /** - * ~CDevEncUiDocument - * Virtual Destructor. - */ - virtual ~CDevEncUiDocument(); - - public: // Functions from base classes - - /** - * CreateAppUiL - * From CEikDocument, CreateAppUiL. - * Create a CDevEncUiAppUi object and return a pointer to it. - * The object returned is owned by the Uikon framework. - * @return Pointer to created instance of AppUi. - */ - CEikAppUi* CreateAppUiL(); - - private: // Constructors - - /** - * ConstructL - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * CDevEncUiDocument. - * C++ default constructor. - * @param aApp Application creating this document. - */ - CDevEncUiDocument( CEikApplication& aApp ); - - /** - * From CEikDocument. - * Always return NULL, so as not to create a INI file. - * - * @param aDoOpen ETrue if file exists. (ignored) - * @param aFilename file to view. - * @param aFs FileServerSession. (ignored) - * @return file store. (always NULL) - */ - CFileStore* OpenFileL( - TBool /*aDoOpen*/, - const TDesC& aFilename, - RFs& /*aFs*/); - - /** - * From CEikDocument. - * - * @param aFileStore. (ignored) - * @param aFile. - */ - void OpenFileL( - CFileStore*& /*aFileStore*/, - RFile& aFile); - - }; - -#endif // __DEVENCUIDOCUMENT_H__ - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiEncrView.h --- a/deviceencryption/DevEncUi/inc/DevEncUiEncrView.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2005 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: Encryption view. -* -*/ - -#ifndef __DEVENCUI_ENCRVIEW_H__ -#define __DEVENCUI_ENCRVIEW_H__ - -//INCLUDES - -// System includes -#include - -//User Includes -#include "DevEncUiDocument.h" - -// FORWARD DECLARATIONS -class CDevEncUiEncrViewContainer; -class CDevEncUiEncryptionOperator; -class CDevEncUiMemoryEntity; - -class CDevEncUiEncrView: public CAknView - { - public: // constructors and destructor - static CDevEncUiEncrView* NewL( RArray& aMemEntities ); - static CDevEncUiEncrView* NewLC( RArray& aMemEntities ); - CDevEncUiEncrViewContainer* Container(); - ~CDevEncUiEncrView(); - CDevEncUiAppUi& GetAppUi(); - - private: // from CAknView - TUid Id() const; - void HandleCommandL( TInt aCommand ); - CDevEncUiEncrView( RArray& aMemEntities ); - - void DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - void DoDeactivate(); - - private: // constructors - void ConstructL(); - - protected: - /** - * HandleStatusPaneSizeChange. - * Called by the framework when the application status pane - * size is changed. - */ - void HandleStatusPaneSizeChange(); - - private: // data - /** Owned. What this view will display */ - CDevEncUiEncrViewContainer* iContainer; - TUid iId; - - /** Not owned */ - RArray& iMemEntities; - }; - -#endif // __DEVENCUI_ENCRVIEW_H__ - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiEncrViewContainer.h --- a/deviceencryption/DevEncUi/inc/DevEncUiEncrViewContainer.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* -* Copyright (c) 2005 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: Container for the encryption view. -* -*/ - -#ifndef __DEVENCUI_GRAPHIC_VIEW_CONTAINER_H__ -#define __DEVENCUI_GRAPHIC_VIEW_CONTAINER_H__ - -//INCLUDES - -//System Includes -#include -#include -#include - -//User Includes - -//FORWARD DECLARATIONS -class CAknDoubleStyle2ListBox; - -class CDevEncUiEncrViewContainer : public CCoeControl, - public MEikListBoxObserver - { -public: - /** - * @function NewLC - * @abstract Creates a CDevEncUiEncrViewContainer object, which will - * draw itself to aRect - * @param aRect A rectangle that defines the size and location of the - * displayable area for the view - * @param aDocument the document - **/ - static CDevEncUiEncrViewContainer* NewL(const TRect& aRect, CAknView& aOwningView); - - /** - * @function NewL - * @abstract Creates a CDevEncUiEncrViewContainer object, which will draw - * itself to aRect - * @param aRect A rectangle that defines the size and location of the - * displayable area for the view - * @param aDocument the document - **/ - static CDevEncUiEncrViewContainer* NewLC( const TRect& aRect, - CAknView& aOwningView ); - - /** - * Destructor. - **/ - ~CDevEncUiEncrViewContainer(); - - // from MEikListBoxObserver - void HandleListBoxEventL( CEikListBox* aListBox, - TListBoxEvent aEventType ); - - /** - * From CCoeControl. Called by the framework in compound controls - * @return The number of controls in this CSimpleListContainer - */ - TInt CountComponentControls() const; - - /** - * From CCoeControl. Called by the framework in compound controls - * @param The index of the control to return - * @return The control for aIndex - */ - CCoeControl* ComponentControl( TInt aIndex ) const; - - /** - * Called by the framework to draw this control. Clears the area in - * aRect. - * @param aRect in which to draw - */ - void Draw( const TRect& aRect ) const; - - /** - * Called by the framework whenever a key event occurs. - * @param aKeyEvent the Key event which occured, e.g. select key pressed - * @param aType the type of Key event which occurred, e.g. key up, key down - * @return TKeyResponse EKeyWasNotConsumed if the key was not processed, - * EKeyWasConsumed if it was - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ); - /** - * Called by framework when the view size is changed. Resizes the - * iLabel accordingly. - */ - void SizeChanged(); - -private: - /** - * @function CDevEncUiEncrViewContainer - * @abstract Performs the first stage construction - * @param aOwningView the view that owns this container - **/ - CDevEncUiEncrViewContainer( CAknView& aOwningView/*CDevEncUiDocument* aDocument*/); - - /** - * @function ConstructL - * @abstract Performs the second phase construction, setting the bounding - * rectangle to aRect - * @param aRect the display area for the view - **/ - void ConstructL( const TRect& aRect ); - - /** - * Constructs the iListBox, setting its window. - */ - void CreateListL(); - -private: - CAknView& iOwningView; - CAknDoubleStyle2ListBox* iListBox; -}; - - -#endif // __DEVENCUI_GRAPHIC_VIEW_CONTAINER_H__ diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiEncryptionOperator.h --- a/deviceencryption/DevEncUi/inc/DevEncUiEncryptionOperator.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +0,0 @@ -/* -* Copyright (c) 2005 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: Performs required preparations before encryption -* operations can place. -* -*/ - -#ifndef DEVENCUI_ENCRYPTIONOPERATOR_H_ -#define DEVENCUI_ENCRYPTIONOPERATOR_H_ - -//INCLUDES - -//System includes -#include -#include -#include // for CDesCArrayFlat - -//User Includes - -// FORWARD DECLARATIONS -class CDevEncUiMemoryEntity; -class CEikonEnv; -class CAknViewAppUi; -class CRepository; - -class CDevEncUiEncryptionOperator: public CBase - { - public: - // Constructors and destructor - static CDevEncUiEncryptionOperator* NewL( CEikonEnv& aEikonEnv, - CAknViewAppUi& aAppUi, - CRepository*& aCrSettings ); - static CDevEncUiEncryptionOperator* NewLC( CEikonEnv& aEikonEnv, - CAknViewAppUi& aAppUi, - CRepository*& aCrSettings ); - ~CDevEncUiEncryptionOperator(); - - // Functions related to encryption - void HandlePhoneMemEncryptRequestL( CDevEncUiMemoryEntity* aMem, CDevEncUiMemoryEntity* aPrimaryMem = NULL ); - - void HandleMmcEncryptRequestL( CDevEncUiMemoryEntity* aMem, - TInt aCommand ); - - void HandleMmcDecryptRequestL( CDevEncUiMemoryEntity* aMem, - TInt aCommand ); - - void DestroyKeyQueryL( TBool aShowMmcNote ); - - void BatteryStatusCallback(); - - void SuggestMmcEncryptionL( CDevEncUiMemoryEntity* aMem ); - - void SuggestMmcDecryptionL( CDevEncUiMemoryEntity* aMem ); - - void SuggestMmcImportKeyL( CDevEncUiMemoryEntity* aMem, - TBool aFirstAttempt ); - - void ShowWrongKeyNoteL(); - - /** - * Displays an error note. - * @param aResourceId the error text to display - */ - void ErrorNoteL( TInt aResourceId, - TBool aWaitingNote = ETrue ); - - /** - * Displays an information note. - * @param aResourceId the text to display - */ - void InfoNoteL( TInt aResourceId, - TBool aWaitingNote = EFalse ); - - private: - CDevEncUiEncryptionOperator( CEikonEnv& aEikonEnv, - CAknViewAppUi& aAppUi, - CRepository*& aCrSettings ); - - // Second-phase constructor - void ConstructL(); - - TBool PrepareEncryptionL(); - - TBool PrepareDecryptionL(); - - void SetPowerMenuStatusL( TBool aOpen ); - - TBool MessageQueryL( TInt aResourceId, - TInt aSoftKeysId = R_AVKON_SOFTKEYS_OK_CANCEL ); - - TBool QueryDialogL( TInt aResourceId, - TInt aSoftKeysId = R_AVKON_SOFTKEYS_OK_CANCEL ); - - TBool DataQueryDialogL( TDes& aResult, - TInt aPromptResourceId, - TInt aMaxLength ); - - /** - * Displays a query dialog to let the user enter a password. - * @param aPromptResourceId the prompt text to display - * @param aPassword On return, contains the password - * @return ETrue if the user entered a password, EFalse if - * the dialog was cancelled. - */ - TBool PasswordQueryL( TInt aPromptResourceId, - TDes8& aPassword ); - - /** - * Checks if there's enough battery power to update. - * @return ETrue if battery OK or charger connected - */ - TBool CheckBatteryL(); - - /** - * Prompts the user for a key name and password, then creates - * a pkcs#5 encrypted key using the common utility component. - * @return ETrue if the key was created and saved successfully - */ - TBool CreateAndSaveKeyL(); - - /** - * Lets the user select a key and enter a password, then loads - * the specified key and takes it in use using the common utility - * component. - * @return ETrue if the key was loaded and set successfully - */ - TBool LoadAndSetKeyL(); - - /** - * Creates a random key and sets it in the security driver. - * @return ETrue if the key was created and set successfully - */ - TBool CreateKeyL(); - - /** - * Resets the key in the security driver (fills with null chars). - * Before destroying the key, a confirmation query is shown to - * the user. - */ - void DestroyKeyL(); - - void RemountMmcL(); - - TInt CheckMMCStatus(); - - // For testing, remove - void CheckNotesL(); - void CheckNotesWithHeaderL(); - - - // data - /** Not owned */ - CEikonEnv& iEikEnv; - - /** Not owned */ - CAknViewAppUi& iAppUi; - - /** Owned */ - CDesCArrayFlat* iListQueryItemArray; - - /** Not owned */ - CRepository*& iCrSettings; - }; - -#endif /* DEVENCUI_ENCRYPTIONOPERATOR_H_ */ - -// END OF FILE diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiFileManager.h --- a/deviceencryption/DevEncUi/inc/DevEncUiFileManager.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2005 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: AppUi class of the application. -* -*/ - -#ifndef CDEVENCUIFILEMANAGER_H_ -#define CDEVENCUIFILEMANAGER_H_ - -#include -#include - -class CDir; -class CFileStore; -//class RFs; - -class CDevEncUiFileManager : public CBase - { - public: - virtual ~CDevEncUiFileManager(); - void ConstructL(); - - void InteractiveKeySaveL( const TDesC8& aPkcs5Key ); - void InteractiveKeyLoadL( HBufC8*& aPkcs5Key ); - - TInt OpenFileStore( const TDesC& aFilename, - CFileStore*& aStore ); - - void SaveKeyL( CFileStore* aStore, - const TDesC8& aPkcs5Key ) const; - - void LoadKeyL( const TFileName& aFileName, - HBufC8*& aPkcs5Key ); - - void GetKeyListL( CDir*& aList ); - - TInt DriveToChar( TInt aDrive, TChar &aChar ); - - TInt KeyFolder( TDes& aResult ); - - TInt RemountMmc(); - - private: - RFs iFs; - }; - -#endif /*CDEVENCUIFILEMANAGER_H_*/ diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiLog.h --- a/deviceencryption/DevEncUi/inc/DevEncUiLog.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/* -* Copyright (c) 2005 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: Debug logging functionality. -* -*/ - -#ifndef __DEVENCUI_LOG_H__ -#define __DEVENCUI_LOG_H__ - -#include "DevEncUiConfig.hrh" - -#if defined( _DEBUG ) && defined ( DEVENCUI_LOG ) - -#include -#include -#include - -class CFileLog : public CBase - { - public: - static void Printf( TRefByValue aFmt, ... ); - }; - -// Debug trace to stdout -#define DLOG( aText ) \ - { \ - _LIT( KText, aText ); \ - RDebug::Print( KText ); \ - } - -// Debug trace to stdout -#define DLOG2( aText, aParam ) \ - { \ - _LIT( KText, aText ); \ - RDebug::Print( KText, aParam ); \ - } - -// Debug trace to stdout -#define DLOG3( aText, aParam1, aParam2 ) \ - { \ - _LIT( KText, aText ); \ - RDebug::Print( KText, aParam1, aParam2 ); \ - } - -// Debug trace to file -#define FLOG( aText ) \ - { \ - _LIT( KLogText, aText ); \ - CFileLog::Printf( KLogText ); \ - } - -// Debug trace to file -#define FLOG2( aText, b ) \ - { \ - _LIT( KLogText, aText ); \ - CFileLog::Printf( KLogText, b ); \ - } - -// Debug trace to file -#define FLOG3( aText, b, c ) \ - { \ - _LIT( KLogText, aText ); \ - CFileLog::Printf( KLogText, b, c ); \ - } - -// Debug trace to stdout and file -#define DFLOG( aText ) \ - { \ - DLOG( aText ); \ - FLOG( aText ); \ - } - -// Debug trace to stdout and file -#define DFLOG2( aText, aParam ) \ - { \ - DLOG2( aText, aParam ); \ - FLOG2( aText, aParam ); \ - } - -// Debug trace to stdout and file -#define DFLOG3( aText, aParam1, aParam2 ) \ - { \ - DLOG3( aText, aParam1, aParam2 ); \ - FLOG3( aText, aParam1, aParam2 ); \ - } - -// Debug trace a string literal to file -#define FLOGBUF( aText ) \ - { \ - CFileLog::Printf( aText ); \ - } - -#else // _DEBUG not defined, no logging code will be included at all - -#define DLOG( a ) -#define DLOG2( a, b ) -#define DLOG3( a, b, c ) -#define FLOG( a ) -#define FLOG2( a, b ) -#define FLOG3( a, b, c ) -#define DFLOG( a ) -#define DFLOG2( a, b ) -#define DFLOG3( a, b, c ) -#define FLOGBUF( a ) - -#endif // _DEBUG - -#endif // __DEVENCUI_LOG_H__ - -// End of File - diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiMainView.h --- a/deviceencryption/DevEncUi/inc/DevEncUiMainView.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* -* Copyright (c) 2005 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: Main view of the application. -* -*/ - -#ifndef __DEVENCUI_MAINVIEW_H__ -#define __DEVENCUI_MAINVIEW_H__ - -//INCLUDES - -//System includes -#include // CAknView -#include - -//User Includes -#include "DevEncUiContainerEventCallback.h" -#include "DevEncUiDocument.h" - -// FORWARD DECLARATIONS -class CDevEncUiEncryptionOperator; -class CDevEncUiMainViewContainer; -class CDevEncUiMemoryEntity; - -class CDevEncUiMainView: public CAknView, - public MContainerEventCallback - { - public: - // constructors and destructor - static CDevEncUiMainView* NewL( RArray& aMemEntities, - CRepository*& aSettings, - TInt& aMmcStatus ); - static CDevEncUiMainView* NewLC( RArray& aMemEntities, - CRepository*& aSettings, - TInt& aMmcStatus ); - ~CDevEncUiMainView(); - CDevEncUiAppUi& GetAppUi(); - - // from MContainerEventCallback - void EncryptionStatusChangeReq( TDevEncUiMemoryType aType ); - - protected: - void DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane* aMenuPane ); - - /** - * HandleStatusPaneSizeChange. - * Called by the framework when the application status pane - * size is changed. - */ - void HandleStatusPaneSizeChange(); - - private: - // from CAknView - TUid Id() const; - void HandleCommandL( TInt aCommand ); - CDevEncUiMainView( RArray& aMemEntities, - CRepository*& aSettings, - TInt& aMmcStatus ); - - void DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - void DoDeactivate(); - - // constructors - void ConstructL(); - - void HandleMemoryCardEncryptRequestL( CDevEncUiMemoryEntity* aMem ); - - void DoEncryptionStatusChangeReqL( TDevEncUiMemoryType aType ); - - TBool DmControlsMemory( TDevEncUiMemoryType aType, - TInt aDmControlSetting ); - - void ErrorNoteL( TInt aResourceId ); - - // data - /** ID of this view */ - TUid iId; - - /** Owned */ - CDevEncUiMainViewContainer* iContainer; - - /** Not owned */ - RArray& iMemEntities; - - /** Owned */ - CDevEncUiEncryptionOperator* iEncOperator; - - /** Not owned */ - CRepository*& iCrSettings; - - /** Not owned */ - TInt& iMmcStatus; - }; - -#endif // __DEVENCUI_MAINVIEW_H__ - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiMainViewContainer.h --- a/deviceencryption/DevEncUi/inc/DevEncUiMainViewContainer.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -/* -* Copyright (c) 2005 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: Container for the main view. -* -*/ - -#ifndef __DEVENCUI_MAINVIEW_CONTAINER_H__ -#define __DEVENCUI_MAINVIEW_CONTAINER_H__ - -//INCLUDES - -//System Includes -#include -#include -#include -#include - -//User Includes - -#include "DevEnc.hrh" -#include "DevEncUiContainerEventCallback.h" -#include "DevEncUiMemInfoObserver.h" - -//FORWARD DECLARATIONS -class CDevEncUiDocument; -class CDevEncUiSettingItemList; -class CRepository; -class CDevEncUiMemoryEntity; - -class CDevEncUiMainViewContainer : public CCoeControl, - public MDevEncUiMemInfoObserver - { - public: - virtual TInt CountComponentControls() const; - /** - * @function NewL - * @abstract Creates a CDevEncUiMainViewContainer object, which will draw itself to aRect - * @param aRect A rectangle that defines the size and location of the displayable area - * for the view - * @param aDocument the document - **/ - static CDevEncUiMainViewContainer* NewL( const TRect& aRect, - RArray& aMemEntities, - MContainerEventCallback& aCallback, - CRepository*& aCrSettings, - TInt& aMmcStatus ); - - /** - * @function NewLC - * @abstract Creates a CDevEncUiMainViewContainer object, which will draw itself to aRect - * @param aRect A rectangle that defines the size and location of the displayable area - * for the view - * @param aDocument the document - **/ - static CDevEncUiMainViewContainer* NewLC( const TRect& aRect, - RArray& aMemEntities, - MContainerEventCallback& aCallback, - CRepository*& aCrSettings, - TInt& aMmcStatus ); - ~CDevEncUiMainViewContainer(); - - /** - * From CCoeControl. Called by the framework whenever a key event occurs. - * Passes the key event to the settings list if it is not null, otherwise returns - * EKeyWasNotConsumed - * @param aKeyEvent the Key event which occured, e.g. select key pressed - * @param aType the type of Key event which occurred, e.g. key up, key down - * @return TKeyResponse EKeyWasNotConsumed if the key was not processed, - * EKeyWasConsumed if it was - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - - /** - * @function ConstructL - * @abstract Performs the second phase construction, setting the bounding - * rectangle to aRect - * @param aRect the display area for the view - **/ - void ConstructL(const TRect& aRect); - - TInt SelectedItem(); - - /** - * Shows a popup dialog to let user set the state of the selected item. - * @return ETrue if desired state of the selected item was changed - */ - TBool ChangeSelectedItemL(); - - /** - * From MDevEncUiMemInfoObserver - * */ - void UpdateInfo( TDevEncUiMemoryType aType, - TUint aState, - TUint aProgress = 0 ); - - protected: - virtual CCoeControl* ComponentControl(TInt aIndex) const; - - /** - * From CCoeControl - * */ - void SizeChanged(); - - /** - * From CCoeControl - * */ - void HandleResourceChange(TInt aType); - - private: - CDevEncUiMainViewContainer( RArray& aMemEntities, - MContainerEventCallback& aCallback, - CRepository*& aCrSettings, - TInt& aMmcStatus ); - void DoUpdateInfoL( TDevEncUiMemoryType aType, - TUint aState, - TUint aProgress /*= 0*/ ); - - private: - /** Owned */ - MContainerEventCallback& iCallback; - - /** Owned */ - CDevEncUiSettingItemList* iSettingItemList; - - /** Not owned */ - RArray& iMemEntities; - - /** Not owned */ - CRepository*& iCrSettings; - - /** Not owned */ - TInt& iMmcStatus; -}; - - -#endif // __DEVENCUI_MAINVIEW_CONTAINER_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiMemInfoObserver.h --- a/deviceencryption/DevEncUi/inc/DevEncUiMemInfoObserver.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2005 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: Mixin class for passing memory status updates to observers. -* -*/ - - -#ifndef __DEVENCUI_MEMINFOOBSERVER_H__ -#define __DEVENCUI_MEMINFOOBSERVER_H__ - -#include "DevEnc.hrh" -#include - -class MDevEncUiMemInfoObserver - { - public: - virtual void UpdateInfo( TDevEncUiMemoryType aType, - TUint aState, - TUint aProgress = 0 ) = 0; - }; - -#endif // __DEVENCUI_MEMINFOOBSERVER_H__ diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiMemoryEntity.h --- a/deviceencryption/DevEncUi/inc/DevEncUiMemoryEntity.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,187 +0,0 @@ -/* -* Copyright (c) 2005 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: Class for managing different types of memory on a -* very abstract level. -* -*/ - -#ifndef DEVENCUI_MEMORYENTITY_H -#define DEVENCUI_MEMORYENTITY_H - -#include -#include - -#include "DevEnc.hrh" -#include "DevEncUiMemInfoObserver.h" -#include "DevEncDiskStatusObserver.h" - -class CDevEncSession; -class CDevEncUiInfoObserver; - -class CDevEncUiMemoryEntity : public CBase, - public MDiskStatusObserver - { - public: - /** - * Constructs the CDevEncUiMemoryEntity using the NewLC method, popping - * the constructed object from the CleanupStack before returning it. - * - * @return The newly constructed CDevEncUiMemoryEntity - */ - static CDevEncUiMemoryEntity* NewL( CEikonEnv* aEikonEnv, - TDevEncUiMemoryType aType ); - - /** - * Constructs the CDevEncUiMemoryEntity using the constructor and ConstructL - * method, leaving the constructed object on the CleanupStack before returning it. - * - * @return The newly constructed CDevEncUiMemoryEntity - */ - static CDevEncUiMemoryEntity* NewLC( CEikonEnv* aEikonEnv, - TDevEncUiMemoryType aType ); - - /** - * Adds an observer to this object's list of observers. - * @param aInfoObserver The observer to add - * @leave Symbian error code - */ - void AddObserverL( MDevEncUiMemInfoObserver* aInfoObserver ); - - /** - * Removes an observer from this object's list of observers. - * Any errors are ignored. - * @param aInfoObserver The observer to remove - */ - void RemoveObserver( MDevEncUiMemInfoObserver* aInfoObserver ); - - /** - * Called periodically. Not intended for use by other classes. - * @param aPtr Pointer to an instance of this class. - */ - static TInt ProgressTick( TAny* aPtr ); - - /** - * Called periodically. Not intended for use by other classes. - * @param aPtr Pointer to an instance of this class. - */ - static TInt PollTick( TAny* aPtr ); - - /** - * Destructor. - */ - virtual ~CDevEncUiMemoryEntity(); - - /** - * Starts the encryption of this memory. - */ - void StartEncryptionL(); - - /** - * Starts the decryption of this memory. - */ - void StartDecryptionL(); - - void Cancel(); - - /** - * Gets the state of this memory entity. - * @return the current state - */ - TUint State() const; - - /** - * Sends the current memory state information to all observers. - * @return none - */ - virtual void UpdateMemoryInfo(); - - /* - * From MDiskStatusObserver - */ - void DiskStatusChangedL( TInt aStatus ); - - private: - // functions - - /** - * C++ Constructor - **/ - CDevEncUiMemoryEntity( CEikonEnv* aEikonEnv, TDevEncUiMemoryType aType ); - - /** - * Second-phase constructor - **/ - virtual void ConstructL(); - - /** - * Sets the internal state and calls UpdateMemoryInfo() - * @param aState the new state - **/ - virtual void SetState( TUint aState ); - - /** - * Starts a timer to periodically update the memory state in the UI. - * @param aInterval the polling interval - **/ - void StartPolling( TTimeIntervalMicroSeconds32 aInterval ); - - /** - * Helper function, called by StartPolling. - * Starts a timer to periodically update the memory state in the UI. - * @param aInterval the polling interval - **/ - void DoStartPollingL( TTimeIntervalMicroSeconds32 aInterval ); - - /** - * Fetches the encryption state and progress. Called periodically. - **/ - virtual void CheckProgress(); - - /** - * Performs periodical processing of timeouts. Calls CheckProgress(). - **/ - virtual void DoProgressTick(); - - /** - * Performs periodical processing of timeouts. - * Checks if the encryption status has changed. - **/ - virtual void DoPollTickL(); - - void RestoreAutolockSettings(); - - // Data - /** Not owned */ - CEikonEnv* iEikEnv; - - /** Owned */ - CDiskStatusObserver* iDiskStatusObserver; - - /** Owned */ - CPeriodic* iPeriodic; - - /** Owned */ - RArray iObservers; - - /** Owned */ - CDevEncSession* iSession; - - TUint iState; - TUint iPrevState; - const TDevEncUiMemoryType iType; - TInt iPercentDone; - TInt iPrevPercentDone; - }; - -#endif // DEVENCUI_MEMORYENTITY_H diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiSecretMinMaxCodeQuery.h --- a/deviceencryption/DevEncUi/inc/DevEncUiSecretMinMaxCodeQuery.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* -* Copyright (c) 2005 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 DEVENCUISECRETMINMAXCODEQUERY_H_ -#define DEVENCUISECRETMINMAXCODEQUERY_H_ - -#include -#include -#include "DevEnc.hrh" - -class CDevEncUiSecretMinMaxCodeQuery : public CAknTextQueryDialog - { - public://construction and destruction - /** - * C++ Constructor. - * @param aDataText TDes& (code which is entered in query) - * @param aMinLength TInt (code min length) - * @param aMaxLength TInt (code max length) - */ - CDevEncUiSecretMinMaxCodeQuery( TDes& aDataText, - TInt aMinLength, - TInt aMaxLength ); - /** - * Destructor. - */ - ~CDevEncUiSecretMinMaxCodeQuery(); - - protected://from CAknTextQueryDialog - /** - * From CAknTextQueryDialog. This function is called by the UIKON - * dialog framework just before the dialog is activated, after it has - * called PreLayoutDynInitL() and the dialog has been sized. - */ - void PreLayoutDynInitL(); - - /** - * From CAknTextQueryDialog. This function is called by the UIKON - * framework if the user activates a button in the button panel. - * It is not called if the Cancel button is activated, - * unless the EEikDialogFlagNotifyEsc flag is set. - * @param aButtonId The ID of the button that was activated - * @return Should return ETrue if the dialog should exit, - * and EFalse if it should not. - */ - TBool OkToExitL( TInt aButtonId ); - - /** - * From CAknTextQueryDialog. This function is called by the UIKON - * dialog framework just after a key is pressed - * @param aKeyEvent TKeyEvent& - * @param aType TEventCode - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ); - - /** - * From MAknQueryControlObeserver. Overrides the default - * implementation in CAknQueryDialog. Gets called by framework when - * text in editor is edited. - */ - void UpdateLeftSoftKeyL(); - - private: // Data - TInt iMinLength; - TInt iMaxLength; - }; - -#endif /*DEVENCUISECRETMINMAXCODEQUERY_H_*/ diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiSettingItemList.h --- a/deviceencryption/DevEncUi/inc/DevEncUiSettingItemList.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -/* -* Copyright (c) 2005 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: Device Encryption UI settings item list. -* -*/ - -#ifndef DEVENCUI_SETTINGITEMLIST_H -#define DEVENCUI_SETTINGITEMLIST_H - -// INCLUDES - -// System includes -#include // CAknSettingItemList - -// User includes -#include "DevEnc.hrh" - -// CLASS DECLARATION - -class CDevEncUiSettingItemList : public CAknSettingItemList - { - public: // Constructors and destructor - CDevEncUiSettingItemList(); - ~CDevEncUiSettingItemList(); - - // From CAknSettingItemList - /** - * Creates the actual setting items for the list, passing - * ownership of them to the calling class. Each setting - * item has a piece of member data which it sets values in. - */ - CAknSettingItem* CreateSettingItemL( TInt identifier ); - - // From CAknSettingItemList - virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); - - /** - * Called by the framework whenever an item is selected. - * Causes the edit page for the currently selected setting item to - * be displayed and stores any changes made. - * @param aIndex the index of the item to change - * @param aCalledFromMenu If ETrue, opens a popup window to let the - * user select the state of this item. Otherwise the item state - * is just changed. - */ - void EditItemL ( TInt aIndex, TBool aCalledFromMenu ); - - // Members - /** - * Gets the index of the currently selected item. - * @return the index - */ - TInt SelectedItem(); - - /** - * Opens a popup window to let the user select the state of this item - */ - void ChangeSelectedItemL(); - - /** - * Sets the text of a list item. Does not change the state. - * @param aIndex the index of the item to change - * @param aNewText the new text - */ - void SetItemTextL( TInt aIndex, const TDesC& aNewText ); - - /** - * Sets the state of a list item. - * @param aIndex the index of the item to change - * @param aSetting the new state - */ - void SetItemStateL( TInt aIndex, TBool aSetting ); - - /** - * Gets the state of a list item. - * @param aIndex the index of the item to change - * @param aSetting Contains the current setting when finished. - */ - void ItemState( TInt aIndex, TBool& aSetting ); - - /** - * From CAknSettingItemList - * - * Handles a change to the control's resources of type aType - * which are shared across the environment, e.g. colors or fonts. - * - * @since 2.0 - * @param aType Reason for the "resource" change, usually an system event UID - */ - void HandleResourceChange( TInt aType ); - - private: - // From CAknSettingItemList - /** - * Called by framework when the view size is changed. Resizes the - * setting list accordingly. - */ - void SizeChanged(); - - // Member data - /* Holds the UI representation of the current state of the phone - * memory encryption. This does not always correlate to the real memory - * state, as this variable often contains a new setting that has not - * been validated yet. */ - TBool iPhoneMemSetting; - - /* Holds the UI representation of the current state of the memory - * card encryption. This does not always correlate to the real memory - * state, as this variable often contains a new setting that has not - * been validated yet. */ - TBool iMmcSetting; - - /** Owned. Holds the current state text of the phone memory */ - HBufC* iPhoneMemStateText; - - /** Owned. Holds the current state text of the memory card */ - HBufC* iMmcStateText; - }; - -#endif // #ifndef DEVENCUI_SETTINGITEMLIST_H - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiTimer.h --- a/deviceencryption/DevEncUi/inc/DevEncUiTimer.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2005 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 DEVENCUITIMER_H_ -#define DEVENCUITIMER_H_ - -// INCLUDES -#include - -// FORWARD DECLARATIONS - -class MDevEncUiTimerCallback - { - public: - virtual void Timeout()=0; - }; - -class CDevEncUiTimer : public CTimer - { - public: - static CDevEncUiTimer* NewL( MDevEncUiTimerCallback* aCallback ); - ~CDevEncUiTimer(); - - void StartAppL( const TUint32& aUid ); - - protected: - // from CActive - void RunL(); - void DoCancel(); - TInt RunError( TInt aError ); - - private: - // Functions - CDevEncUiTimer( MDevEncUiTimerCallback* aCallback ); - - void ConstructL(); - - // Data - MDevEncUiTimerCallback* iCallback; // parent - }; - -#endif /*DEVENCUITIMER_H_*/ diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/inc/DevEncUiUids.hrh --- a/deviceencryption/DevEncUi/inc/DevEncUiUids.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* -* Copyright (c) 2005 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: DevEncUi ids, that can be used both in cpp and rss files. -* -*/ - -#ifndef DEVENCUIUIDS_HRH -#define DEVENCUIUIDS_HRH - -#define KDevEncUiUid 0x2000259A - -#endif // DEVENCUIUIDS_HRH - diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/loc/devenc.loc --- a/deviceencryption/DevEncUi/loc/devenc.loc Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,354 +0,0 @@ -/* -* Copyright (c) 2005 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: String localization file. -* -*/ - -// LOCALISATION STRINGS - - -// d:Application name in menu grid view. -// l:cell_app_pane_t1 -// r:3.1 -// -#define qtn_apps_encryption_grid "Encryption" - -// d:Application name displayed in title. -// l:title_pane_t1 -// r:3.1 -// -#define qtn_encryption_title "Encryption" - -// d:Setting list item for phone memory encryption. -// d:Possible values are "On" and "Off". -// l:list_setting_pane_t1 -// r:3.1 -// -#define qtn_encryption_phonememory "Phone memory" - -// d:Setting list item for memory card encryption. -// d:Possible values are "On" and "Off" -// l:list_setting_pane_t1 -// r:3.1 -// -#define qtn_encryption_memorycard "Memory card" - -// d:Information note, scrollable. Displayed after user has selected to start memory encryption and Autolock period setting is "None". -// d:softkeys are OK and Cancel. -// d:Keep translation consistent with "Autolock period" (qtn_set_autolock) and "Phone and SIM card" (qtn_set_dev_sim_security). -// l:popup_info_list_pane_t1_6_rows -// r:3.1 -// -#define qtn_encryption_note_lock "To encrypt phone memory, it is highly recommended to enable 'Autolock' and set lock code in 'Phone and SIM card' settings to prevent unauthorised data access." - -// d:Information note, scrollable. Displayed after user has selected to start memory encryption. -// d:Softkeys are OK and Cancel. -// l:popup_info_list_pane_t1 -// r:3.1 -// -#define qtn_encryption_note_encrypting "Encryption process is long. Power-off button is disabled. Please do not remove the battery during the process." - -// d:Information note, scrollable. Displayed after user has selected to start memory decryption. -// l:popup_info_list_pane_t1 -// r:3.1 -// -#define qtn_encryption_note_phone_decrypting "This will decrypt the phone memory. Decryption process is long. Power-off button is disabled. Please do not remove the battery during the process. After decryption, encryption key is destroyed." - -// d:Displayed when user is about to start Memory card encryption. -// d:Memory card will be encrypted without saving the key. -// l:list_setting_pane_t1 -// r:3.1 -// -#define qtn_encryption_encrypt "Encrypt witht sav. key" - -// d:Displayed when user is about to start Memory card encryption. -// d:Memory card will be encrypted and key will be saved. -// l:list_setting_pane_t1 -// r:3.1 -// -#define qtn_encryption_encryptsave "Encrypt and save key" - -// d:Displayed when user is about to start Memory card encryption. -// d:Memory card will be encrypted with the restored key. -// l:list_setting_pane_t1 -// r:3.1 -// -#define qtn_encryption_encryptload "Encrypt / restored key" - -// d:Wait note. Displayed while encryption key is being created. -// d:Displayed after user has selected to start encrypting Memory card. -// l:popup_note_wait_window -// r:3.1 -// -#define qtn_encryption_note_wait "Creating encryption key" - -// d:Data query text. User is asked to enter passphrase to protect the encryption key. -// l:popup_query_data_window -// r:3.1 -// -#define qtn_encryption_passphrase_protect "Enter key's passphrase to protect the key:" - -// d:Data query. User is asked to enter name for the encryption key. -// d:Displayed after user has selected "Encrypt and save the key" (qtn_encryption_encryptsave). -// l:popup_query_data_window -// r:3.1 -// -#define qtn_encryption_filename "Save key as:" - -// d:Confirmation note. Displayed after kkey is saved successfully. -// d:Keep the localisation of Other consistent with string qtn_fmgr_def_fldr_others. -// l:popup_note_window -// r:3.1 -// -#define qtn_encryption_note_saveinfo "Key saved succesfully in Other folder" - -// d:Heading in list query. User is asked to select key file. -// l:heading_pane_t1 -// r:3.1 -// -#define qtn_encryption_selectkey "Select key file:" - -// d:Data query. User is asked to enter key's phassphrase. -// l:popup_query_data_window -// r:3.1 -// -#define qtn_encryption_passphrase_ask "Enter key's passphrase:" - -// d:Information note. Inform the user that the memory card is encrypted. -// l:popup_note_window/opt2 -// r:3.1 -// -#define qtn_encryption_note_memorycard_encrypted "Encrypted memory card" - -// d:Displayed when user is about to start Memory card decryption. -// d:Memory card will be decrypted. -// l:list_setting_pane_t1 -// r:3.1 -// -#define qtn_encryption_decrypt "Decrypt" - -// d:Displayed when user is about to start Memory card decryption. -// d:Memory card will be decrypted and encryption will be set off. -// l:list_setting_pane_t1 -// r:3.1 -// -#define qtn_encryption_decryptturnoff "Decrypt / turn off encr." - -// d:Information note, scrollable. Displayed after user has selected to start memory decryption. -// d:Softkeys are OK and Cancel. -// l:popup_info_list_pane_t1 -// r:3.1 -// -#define qtn_encryption_note_decrypting "The decryption process is long. The power off button is disabled. Please don't remove the battery during the process." - -// d:Information note, scrollable. Displayed after user has selected to start memory decryption. -// d:Softkeys are OK and Cancel. -// l:popup_info_list_pane_t1 -// r:3.1 -// -#define qtn_encryption_note_decryptingdestroy "Decryption process is long. Power-off button is disabled. Please do not remove the battery during the process. After decryption, encryption key is destroyed." - -// d:Information note, scrollable. Displayed after user has selected to start memory encryption. -// d:Softkeys are Yes and No. -// l:popup_info_list_pane_t1 -// r:3.1 -// -#define qtn_encryption_note_decrypt_loadkey "Memory card encrypted with another key. To decrypt it, import its key. Importing the new key will destroy the current key in driver. Continue?" - -// d:Confirmation query. Displayed in case insert an unencrypted memory card in the phone and encryption is on. -// d:Softkeys are Yes and No. -// l:popup_note_window -// r:3.1 -// -#define qtn_encryption_note_insertunencrypted "Memory card encryption setting is 'On'. Encrypt this memory card?" - -// d:Confirmation query. Displayed in case user select to turn off the encryption when no memory card is inside phone. -// d:Softkeys are Yes and No. -// l:popup_note_window -// r:3.1 -// -#define qtn_encryption_note_decrypt_nomemrycard "Turning off memory card encryption will destroy the current key in driver. Continue?" - -// d:Information note. Informs the user that the memory card is not an encrypted one. -// l:popup_note_window/opt2 -// r:3.1 -// -#define qtn_encryption_note_memorycard_unencrypted "Unencrypted memory card" - -// d:Confirmation query. Displayed in case user inserts encrypted memory card in the phone and encryption is off. -// l:popup_note_window -// r:3.1 -// -#define qtn_encryption_note_insertencrypted "This memory card is encrypted but the phone encryption is off. Decrypt this memory card?" - -// d:Information note. Displayed when the encryption is interrupted and cancelled. -// l:popup_note_window/opt2 -// r:3.1 -// -#define qtn_encryption_note_encryptioninterrupt "Memory card encryption cancelled" - -// d:Setting list item, static. Possible values are On (qtn_encryption_phonememory_setting_on) and Off (qtn_encryption_phonememory_setting_off). -// l:list_setting_pane_t1 -// r:3.1 -// -#define qtn_encryption_phonememory_setting_title "Phone mem. encrypt.:" - -// d:Setting list item, static. Possible values are On (qtn_encryption_memorycard_setting_on) and Off (qtn_encryption_memorycard_setting_off). -// l:list_setting_pane_t1 -// r:3.1 -// -#define qtn_encryption_memorycard_setting_title "Mem. card encryption:" - -// d:Information note. Inform the user that the key file is wrong. -// l:popup_note_window/opt2 -// r:3.1 -// -#define qtn_encryption_note_wrongkeyfile "Incorrect key file" - -// d:Information note. Inform the user that the inserted memory card cannot be used. -// l:popup_note_window/opt2 -// r:3.1 -// -#define qtn_encryption_note_unusedmemorycard "Memory card cannot be used" - -// d:Text displayed after setting Phone memory or Memory card encryption On. -// d:Indicates the process of memory encryption. %N is replaced with the percentage of how much of the memory is encrypted. -// l:list_set_graphic_pane_t1 -// r:3.1 -// -#define qtn_encryption_encrypt_process "Encrypting, %N%" - -// d:Text displayed after setting Phone memory or Memory card encryption Off. -// d:Indicates the process of memory decryption. %N is replaced with the percentage of how much of the memory is decrypted. -// l:list_set_graphic_pane_t1 -// r:3.1 -// -#define qtn_encryption_decrypt_process "Decrypting, %N%" - -// d:Confirmation query, one softkey OK. Displayed in case memory card cannot be used unless encryption is set on. -// l:popup_note_window -// r:3.1 -// -#define qtn_encryption_note_insertoff_unusedmemorycard "This memory card cannot be used. To use it, turn on memory card encryption." - -// d:Confirmation query, one softkey OK. Displayed in case memory cannot be used because key does not match to the memory card. -// l:popup_note_window -// r:3.1 -// -#define qtn_encryption_note_inserton_unusedmemorycard "Key not matched to this memory card. Memory card cannot be used." - -// d:Setting list item, dynamic. Setting the phone memory encryption on. -// l:list_set_graphic_pane_t1 -// r:3.1 -// -#define qtn_encryption_phonememory_setting_on "On" - -// d:Setting list item, dynamic. Setting the phone memory encryption off. -// l:list_set_graphic_pane_t1 -// r:3.1 -// -#define qtn_encryption_phonememory_setting_off "Off" - -// d:Setting list item, dynamic. Setting the memory card encryption on. -// l:list_set_graphic_pane_t1 -// r:3.1 -// -#define qtn_encryption_memorycard_setting_on "On" - -// d:Setting list item, dynamic. Setting the memory card encryption off. -// l:list_set_graphic_pane_t1 -// r:3.1 -// -#define qtn_encryption_memorycard_setting_off "Off" - -// d:Application name in menu list view. -// l:list_single_large_graphic_pane_t1 -// r:3.1 -// -#define qtn_apps_encryption_list "Encryption" - -// d:Header text. -// d:Displayed as a header for several scrollable notes (e.g qtn_encryption_note_lock, qtn_encryption_note_encrypting) -// l:heading_pane_t1 -// r:3.1 -// -#define qtn_encryption_note_header "Note:" - - -/************* Own defines *****************************************/ - - -// d:Information note. memory card is corrupted. -// d: -// l:popup_note_window/opt2 -// r:3.1 -// -#define qtn_encryption_corrupted "Corrupted" - -// d:Information note. Informs that the battery is low. -// d: User is asked to change battery or connect a charger. -// l:popup_note_window/opt2 -// r:3.1 -// -#define qtn_encryption_battery_low "Battery low. Change battery or connect charger." - -// d:Information note. Informs that no keys were found. -// d: -// l:popup_note_window/opt2 -// r:3.1 -// -#define qtn_encryption_note_no_keys_found "No keys found" - -// d:Information note. Informs that password is invalid. -// d: -// l:popup_note_window/opt2 -// r:3.1 -// -#define qtn_encryption_note_invalid_password "Invalid password" - -// d:Information note. Informs about key error. -// l:popup_note_window/opt2 -// r:3.1 -// -#define qtn_encryption_note_key_error "Key error" - -// d:Information note. Informs that encryption is controlled by admin. -// d: -// l:popup_note_window/opt2 -// r:3.1 -// -#define qtn_encryption_note_admin_control "Encryption controlled by admin" - -// d:Information note. Informs about invalid name and asks user to enter name again. -// d: -// l:popup_note_window/opt2 -// r:3.1 -// -#define qtn_encryption_note_bad_name "Invalid name. Try again." - -// d:Information note. Informs that the file already exists. -// d: -// l:popup_note_window/opt2 -// r:3.1 -// -#define qtn_encryption_note_file_exists "File already exists" - -// d:Confirmation query. Informs that phone memory cannot be encrypted while -// d:firmware update process is ongoing. -// l:popup_note_window -// r:3.2 -// -#define qtn_conf_encr_not_poss "Device encryption cannot be activated when an update over the air is ongoing. Wait for the update to stop and try again." - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/rom/DevEncUi.iby --- a/deviceencryption/DevEncUi/rom/DevEncUi.iby Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2005 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: Contains information about binary files and their locations. -* -*/ - -#ifndef __DEVENCUI_IBY__ -#define __DEVENCUI_IBY__ - -S60_APP_EXE( DevEncUi ) -//S60_APP_BITMAP( essysapp ) -S60_APP_AIF_ICONS( DevEncUi ) -S60_APP_AIF_RSC( DevEncUi ) -data=DATAZ_\private\10003a3f\apps\DevEncUi_reg.rsc private\10003a3f\import\apps\DevEncUi_reg.rsc -data=DATAZ_\resource\apps\DevEncUi.rsc resource\apps\DevEncUi.rsc - -#endif // __DEVENCUI_IBY__ - -// End of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/sis/DevEncUi.pkg --- a/deviceencryption/DevEncUi/sis/DevEncUi.pkg Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -; -; 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: -; -; DevEncUi.pkg -; -;Language - standard language definitions -&EN - -;Standard SIS file header -#{"DevEncUi"},(0x2000259A),1,0,0 - -;Localised Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -;Supports Series 60 v 3.0 -[0x101F7961], 0, 0, 0, {"Series60ProductID"} - -;Files to install -"\epoc32\release\armv5\urel\DevEncUi.exe" -"!:\sys\bin\DevEncUi.exe" -"\epoc32\data\z\resource\apps\DevEncUi.rsc" -"!:\resource\apps\DevEncUi.rsc" -;"\epoc32\data\z\resource\apps\DevEncUi.mif" -"!:\resource\apps\DevEncUi.mif" -"\epoc32\data\z\private\10003a3f\apps\DevEncUi_reg.rsc" -"!:\private\10003a3f\import\apps\DevEncUi_reg.rsc" diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUi.cpp --- a/deviceencryption/DevEncUi/src/DevEncUi.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2005 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 application entry point functions. -* -*/ - -// INCLUDE FILES -#include -#include "DevEncUiApplication.h" - - -// ----------------------------------------------------------------------------- -// NewApplication() -// -// ----------------------------------------------------------------------------- -// -LOCAL_C CApaApplication* NewApplication() - { - return new CDevEncUiApplication; - } - -// ----------------------------------------------------------------------------- -// E32Main() -// -// ----------------------------------------------------------------------------- -// -GLDEF_C TInt E32Main() - { - return EikStart::RunApplication( NewApplication ); - } diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiApplication.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiApplication.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2005 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 CDevEncUiApplication. -* -*/ - -// INCLUDE FILES -#include "DevEncLog.h" -#include "DevEncUiDocument.h" -#include "DevEncUiApplication.h" -#include "DevEncUids.hrh" - -// ============================ MEMBER FUNCTIONS =============================== - -// UID for the application -// this should correspond to the uid defined in the mmp file -const TUid KUidDevEncUIApp = { KDevEncUiUid }; - -// -------------------------------------------------------------------------- -// CDevEncUiApplication::AppDllUid() -// Returns application UID -// -------------------------------------------------------------------------- -// -TUid CDevEncUiApplication::AppDllUid() const - { - // Return the UID for the DevEncUI application - return KUidDevEncUIApp; - } - -// -------------------------------------------------------------------------- -// CDevEncUiApplication::CreateDocumentL() -// Creates CApaDocument object -// -------------------------------------------------------------------------- -// -CApaDocument* CDevEncUiApplication::CreateDocumentL() - { - DFLOG( "CDevEncUiApplication::CreateDocumentL" ); - // Create an DevEncUI document, and return a pointer to it - return ( static_cast - ( CDevEncUiDocument::NewL( *this ) ) ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiAppui.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiAppui.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,565 +0,0 @@ -/* -* Copyright (c) 2005 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 CDevEncUiAppUi. -* -*/ - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include // Help launcher -#include // TBD: Needed? -#include -#include - -#include "DevEncLog.h" -#include "DevEnc.hrh" -#include "DevEncUi.pan" -#include "DevEncUiAppui.h" -#include "DevEncUiEncrView.h" -#include "DevEncUiEncryptionOperator.h" -#include "DevEncUiDecrView.h" - -#include "DevEncUiMainView.h" -#include "DevEncUiMemoryEntity.h" -#include "DevEncUids.hrh" - -#include - -//Local definitions -const TInt KDevEncUiConstructionDelay( 1000000 ); - -// ============================ MEMBER FUNCTIONS =============================== - -// -------------------------------------------------------------------------- -// CDevEncUiAppUi::ConstructL() -// Symbian 2nd phase constructor can leave. -// -------------------------------------------------------------------------- -// -void CDevEncUiAppUi::ConstructL() - { - // Initialise app UI with standard value. - BaseConstructL( EAknEnableSkin | EAknSingleClickCompatible ); - - DFLOG( ">>CDevEncUiAppUi::ConstructL" ); - - User::LeaveIfError( iFs.Connect() ); - - DFLOG( "CDevEncUiAppUi::ConstructL => Create drive path" ); - // Create private folder. TBD: Needed? - TInt error = iFs.CreatePrivatePath( EDriveC ); - if ( error == KErrAlreadyExists ) - { - error = KErrNone; - } - DFLOG( "CDevEncUiAppUi::ConstructL => Leave ?" ); - User::LeaveIfError( error ); - DFLOG( "CDevEncUiAppUi::ConstructL => No, constructing CR" ); - - // Central repository settings - iCrSettings = CRepository::NewL( TUid::Uid( KCRDevEncUiSettings ) ); - DFLOG( "CDevEncUiAppUi::ConstructL => Adding observer" ); - - // Create MMC observer - iObserver = CMmcObserver::NewL( this, &iFs ); - iObserver->StartObserver(); - - // Call the MMC callback function once to get the initial card status - MMCStatusChangedL(); - - DFLOG( "CDevEncUiAppUi::ConstructL => constructing mass memory" ); - - CDevEncUiMemoryEntity* massMemory = CDevEncUiMemoryEntity::NewLC( iEikonEnv, - EPhoneMemory ); - - DFLOG( "CDevEncUiAppUi::ConstructL => adding to mem entities" ); - iMemEntities.AppendL( massMemory ); - CleanupStack::Pop( massMemory ); - - DFLOG( "CDevEncUiAppUi::ConstructL => constructing memory card" ); - - CDevEncUiMemoryEntity* memoryCard = CDevEncUiMemoryEntity::NewLC( iEikonEnv, - EMemoryCard ); - - DFLOG( "CDevEncUiAppUi::ConstructL => adding to mem entities" ); - iMemEntities.AppendL( memoryCard ); - CleanupStack::Pop( memoryCard ); - - DFLOG( "CDevEncUiAppUi::ConstructL => constructing phone memory" ); - - CDevEncUiMemoryEntity* phoneMemory = CDevEncUiMemoryEntity::NewLC( iEikonEnv, - EPrimaryPhoneMemory ); - - DFLOG( "CDevEncUiAppUi::ConstructL => adding to mem entities" ); - iMemEntities.AppendL( phoneMemory ); - CleanupStack::Pop( phoneMemory ); - - DFLOG( "CDevEncUiAppUi::ConstructL() => Create enc operator" ); - - // Create encryption operator - iEncOperator = CDevEncUiEncryptionOperator::NewL( *iEikonEnv, - *this, - iCrSettings ); - - DFLOG( "CDevEncUiAppUi::ConstructL() => Create views" ); - - // Create views - iMainView = CDevEncUiMainView::NewL( iMemEntities, - iCrSettings, - iMmcStatus ); - - AddViewL( iMainView ); // transfer ownership - - iEncryptionView = CDevEncUiEncrView::NewL( iMemEntities ); - AddViewL( iEncryptionView ); // transfer ownership - - iDecryptionView = CDevEncUiDecrView::NewL( iMemEntities ); - AddViewL( iDecryptionView ); // transfer ownership - - SetDefaultViewL( *iMainView ); - - DFLOG( "ConstructL 6" ); - - iConstructionOnGoing = ETrue; - - iTimer = CDevEncUiTimer::NewL( this ); - iTimer->After( KDevEncUiConstructionDelay ); - - DFLOG( "<>CDevEncUiAppUi::~CDevEncUiAppUi" ); - delete iObserver; - iFs.Close(); - delete iEncOperator; - if (iMemEntities.Count()) - iMemEntities[ EMemoryCard ]->RemoveObserver( this ); - for ( TInt i = 0; i < iMemEntities.Count(); i++ ) - { - delete iMemEntities[i]; - } - iMemEntities.Close(); - delete iCrSettings; - delete iTimer; - } - -// -------------------------------------------------------------------------- -// CDevEncUiAppUi::HandleCommandL() -// Takes care of command handling. -// -------------------------------------------------------------------------- -// -void CDevEncUiAppUi::HandleCommandL( TInt aCommand ) - { - DFLOG( ">>CDevEncUiAppUi::HandleCommandL" ); - - switch( aCommand ) - { - // These commands are specific to the memory card - case EDevEncUiCommandEncryptWithoutSavingKey: // fall through - case EDevEncUiCommandEncryptAndSaveKey: - case EDevEncUiCommandEncryptWithRestoredKey: - { - // Pass the MMC memory entity to the operator, along with the command - iEncOperator->HandleMmcEncryptRequestL( iMemEntities[ EMemoryCard ], - aCommand ); - break; - } - - case EDevEncUiCommandDecrypt: // fall through - case EDevEncUiCommandDecryptAndTurnOffEncryption: - { - // Pass the MMC memory entity to the operator, along with the command - iEncOperator->HandleMmcDecryptRequestL( iMemEntities[ EMemoryCard ], - aCommand ); - break; - } - - case EDevEncUiCommandHelp: - { - DisplayHelpL(); - break; - } - - case EAknSoftkeyBack: - { - // Get the current view - TVwsViewId wsViewId; - TInt err = GetActiveViewId( wsViewId ); - if ( ( err != KErrNone ) || - ( wsViewId.iAppUid.iUid != KDevEncUiUid ) ) - { - User::Leave( err ); - } - - // Go to the main view from the encryption and decryption views - if ( wsViewId.iViewUid.iUid == EDevEncUiEncrViewId || - wsViewId.iViewUid.iUid == EDevEncUiDecrViewId ) - { - ActivateLocalViewL( TUid::Uid( EDevEncUiMainViewId ) ); - } - if ( wsViewId.iViewUid.iUid == EDevEncUiMainViewId ) - { - Exit(); - } - break; - } - - case EEikCmdExit: // fall through - case EAknSoftkeyExit: - { - Exit(); - break; - } - - default: - Panic( EDevEncUi ); - break; - } - } - -// -------------------------------------------------------------------------- -// Called by the framework when the app is moved to or from foreground. -// -// -------------------------------------------------------------------------- -// -void CDevEncUiAppUi::HandleForegroundEventL( TBool aForeground ) - { - DFLOG( "CDevEncUiAppUi::HandleForegroundEventL" ); - DFLOG2( "CDevEncUiAppUi::HandleForegroundEventL => aForeground = %d ", aForeground ); - CAknAppUi::HandleForegroundEventL( aForeground ); - - iForeground = aForeground; - - if( iConstructionOnGoing ) - { - DFLOG( "CDevEncUiAppUi::HandleForegroundEventL => Construction on going" ); - if( iTimer ) - { - iTimer->Cancel(); - } - iTimer->After( KDevEncUiConstructionDelay ); - } - } - -// -------------------------------------------------------------------------- -// Called by the framework before the options menu is shown. -// Sets the correct menu items. -// -------------------------------------------------------------------------- -// -void CDevEncUiAppUi::DynInitMenuPaneL( TInt /*aResourceId*/, - CEikMenuPane* /*aMenuPane*/ ) - { - } - -// -------------------------------------------------------------------------- -// Called by the framework before the context-sensitive help is shown. -// Sets the correct menu items. -// -------------------------------------------------------------------------- -// -//CArrayFix* CDevEncUiAppUi::HelpContextL() -// { -// TCoeHelpContext& aContext -// } - -// -------------------------------------------------------------------------- -// Called by the framework before the context-sensitive help is shown. -// Sets the correct menu items. -// -------------------------------------------------------------------------- -void CDevEncUiAppUi::DisplayHelpL() - { - CArrayFix* contexts = - new ( ELeave ) CArrayFixFlat( 1 ); - CleanupStack::PushL( contexts ); - TCoeHelpContext context; - context.iMajor = TUid::Uid( KDevEncUiUid ); - - // Get the currently active view - TVwsViewId wsViewId; - TInt err = GetActiveViewId( wsViewId ); - if ( ( err != KErrNone ) || - ( wsViewId.iAppUid.iUid != KDevEncUiUid ) ) - { - User::Leave( err ); - } - - // Set the help context for the current view - switch ( wsViewId.iViewUid.iUid ) - { - case EDevEncUiEncrViewId: - { - context.iContext = KES_HLP_ENCRYPTION_ENCRYPT; - } - break; - case EDevEncUiDecrViewId: - { - context.iContext = KES_HLP_ENCRYPTION_DECRYPT; - } - break; - default: // Main view - { - context.iContext = KES_HLP_ENCRYPTION_MAIN; - } - break; - } - - contexts->AppendL( context ); - CleanupStack::Pop( contexts ); - HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), contexts ); - } - -// -------------------------------------------------------------------------- -// Called by CDevEncMmcObserver when MMC status changes. -// -// -------------------------------------------------------------------------- -void CDevEncUiAppUi::MMCStatusChangedL() - { - DFLOG( "CDevEncUiAppUi::MMCStatusChangedL" ); - TVolumeInfo volInfo; - - TInt err = iFs.Volume( volInfo, /*EDriveE*/EDriveF ); - switch ( err ) - { - case KErrNone: - { - // Readable MMC inserted - DFLOG( "MMC inserted" ); - iMmcStatus = EMmcOk; - break; - } - - case KErrNotReady: - { - // MMC ejected - DFLOG( "MMC ejected" ); - iMmcStatus = EMmcNotPresent; - break; - } - - case KErrCorrupt: - { - // Corrupt or unformatted MMC, or wrong key - DFLOG( "MMC corrupt, unformatted or encrypted with other key" ); - iMmcStatus = EMmcNotReadable; - break; - } - - default: - { - DFLOG2( "RFs::Volume returned error %d", err ); - break; - } - } // switch - } - -// -------------------------------------------------------------------------- -// Called by memory entity when memory status changes. -// -// -------------------------------------------------------------------------- -void CDevEncUiAppUi::UpdateInfo( TDevEncUiMemoryType aType, - TUint aState, - TUint /*aProgress*/ ) - { - DFLOG( "CDevEncUiAppUi::UpdateInfo" ); - TInt error( KErrNone ); - TRAP( error, DoUpdateInfoL( aType, aState ) ); - DFLOG2( "CDevEncUiAppUi::DoUpdateInfo returned %d", error ); - } - -// -------------------------------------------------------------------------- -// Helper function called by UpdateInfo when memory status changes. -// -// -------------------------------------------------------------------------- -void CDevEncUiAppUi::DoUpdateInfoL( TDevEncUiMemoryType aType, - TUint aState ) - { - DFLOG( ">>CDevEncUiAppUi::DoUpdateInfoL" ); - if ( aType != EMemoryCard ) - { - return; - } - - // Prevent re-entry - if ( iStatusUpdateOngoing ) - { - return; - } - iStatusUpdateOngoing = ETrue; - - DFLOG3( "CDevEncUiAppUi::DoUpdateInfoL, type %d, state %d", - aType, aState ); - DFLOG2( "Mmc state %d", iMmcStatus ); - DFLOG2( "Enc state %d", iMmcEncState ); - - // Check encryption key status - TInt mmcKeyInDriver( 0 ); - iCrSettings->Get( KDevEncUserSettingMemoryCard, mmcKeyInDriver ); - - if ( ( iMmcStatus == EMmcOk ) && - ( iMmcEncState == EUnmounted ) && - ( aState == EDecrypted ) ) - { - // A readable memory card has just been inserted - - if ( mmcKeyInDriver ) - { - // We have a valid encryption key, but the newly inserted - // card is decrypted. Ask if the user wants to encrypt. - // (see UI spec 2.13) - iEncOperator->SuggestMmcEncryptionL( - iMemEntities[ EMemoryCard ] ); - } - } - - if ( ( iMmcStatus == EMmcNotReadable ) && - ( iMmcEncState == EUnmounted ) && - ( aState == ECorrupted ) ) - { - // An unreadable memory card has just been inserted - - if ( mmcKeyInDriver ) - { - // We seem to have the wrong encryption key in the driver. - // Inform the user that the card cannot be used. - // (see UI spec 2.16) - iEncOperator->ErrorNoteL( - R_DEVENCUI_TEXT_NOTE_INSERTON_UNUSEDMEMORYCARD ); - } - else - { - DFLOG( "CDevEncUiAppUi::DoUpdateInfoL => SuggestMmcDecryption" ); - // We have no encryption key in the driver. - // Ask if the user wants to import a key and decrypt. - // (see UI spec 2.17) - iEncOperator->SuggestMmcDecryptionL( - iMemEntities[ EMemoryCard ] ); - } - } - - iMmcEncState = aState; - iStatusUpdateOngoing = EFalse; - DFLOG( "< Construction completed" ); - //the construction is completed now - iConstructionOnGoing = EFalse; - // This class needs to observe memory card status changes. - // (This call results in a call to UpdateInfo, hence we need to be fully - // constructed before this.) - TRAP_IGNORE(iMemEntities[ EMemoryCard ]->AddObserverL( this )); - - } - } - -// ----------------------------------------------------------------------------- -// CDevEncUiAppUi::ProcessCommandParametersL -// From CEikAppUi -// ----------------------------------------------------------------------------- -// -TBool CDevEncUiAppUi::ProcessCommandParametersL( - TApaCommand /*aCommand*/, - TFileName& /*aDocumentName*/, - const TDesC8& /*aTail*/ ) - { - return ETrue; - } - -// ----------------------------------------------------------------------------- -// CDevEncUiAppUi::OpenFileL -// ----------------------------------------------------------------------------- -// -void CDevEncUiAppUi::OpenFileL(const TDesC& /*aFilename*/) - { - DFLOG("CDevEncUiAppUi::OpenFileL"); - } - -// ----------------------------------------------------------------------------- -// CDevEncUiAppUi::OpenFileL() -// ----------------------------------------------------------------------------- -// -void CDevEncUiAppUi::OpenFileL(RFile& aFile) - { - _LIT(KTargetDir,"c:\\data\\others\\"); - TBuf16<100> destinationPath; - destinationPath.Copy( KTargetDir ); - TBuf16<250> sourcePath; - aFile.FullName( sourcePath ); - - // if the paths are the same, the copy operation will not be executed - if ( sourcePath.Left( destinationPath.Length() ).CompareF( destinationPath ) ) - { - // copy the file to Others folder - TRAPD(err, CopyL( sourcePath, destinationPath )); - - if( err == KErrNone ) - { - iEncOperator->InfoNoteL( R_DEVENCUI_TEXT_NOTE_SAVEINFO, ETrue ); - ActivateLocalViewL( TUid::Uid( EDevEncUiMainViewId ) ); - } - else - { - Exit(); - } - } - else - { - ActivateLocalViewL( TUid::Uid( EDevEncUiMainViewId ) ); - } - } - -// ----------------------------------------------------------------------------- -// CDevEncUiAppUi::Copy() -// ----------------------------------------------------------------------------- -// -void CDevEncUiAppUi::CopyL(const TDesC &anOld, const TDesC &aNew) - { - CFileMan* fileMan=CFileMan::NewL( iFs ); - CleanupStack::PushL( fileMan ); - - User::LeaveIfError(fileMan->Copy( anOld, aNew )); - - CleanupStack::PopAndDestroy( fileMan ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiCreateKeyProcess.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiCreateKeyProcess.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* -* Copyright (c) 2005 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 CDevEncUiCreateKeyProcess. -* -*/ - -#include "DevEncLog.h" -#include "DevEncUiCreateKeyProcess.h" -#include - -CDevEncUiCreateKeyProcess::CDevEncUiCreateKeyProcess() - { - iCount = 0; - } - -CDevEncUiCreateKeyProcess::~CDevEncUiCreateKeyProcess() - { - } - -void CDevEncUiCreateKeyProcess::ProcessFinished() - { - } - -void CDevEncUiCreateKeyProcess::DialogDismissedL( TInt /*aButtonId*/ ) - { - } - -//TInt CDevEncUiCreateKeyProcess::CycleError( TInt aError ) -// { -// return aError; -// } - -TBool CDevEncUiCreateKeyProcess::IsProcessDone() const - { - return ( iCount == 3 ); - } - -void CDevEncUiCreateKeyProcess::StepL() - { - // Simulate processing - User::After( 1000000 ); - iCount++; - } - -TBool CDevEncUiCreateKeyProcess::RunLD() - { - TBool returnvalue = EFalse; - - CDevEncUiCreateKeyProcess* process = new ( ELeave ) CDevEncUiCreateKeyProcess(); - CleanupStack::PushL( process ); - - CAknWaitNoteWrapper* waitNoteWrapper = - CAknWaitNoteWrapper::NewL(); - - CleanupStack::PushL( reinterpret_cast( waitNoteWrapper ) ); - - if ( waitNoteWrapper->ExecuteL( R_DEVENCUI_CREATING_KEY_WAITNOTE, - *process, - ETrue ) ) - { - returnvalue = ETrue; - } - else //note was cancelled - { - returnvalue = EFalse; - } - - CleanupStack::PopAndDestroy( waitNoteWrapper ); - CleanupStack::PopAndDestroy( process ); - return returnvalue; - } diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiDecrView.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiDecrView.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,203 +0,0 @@ -/* -* Copyright (c) 2005 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 CDevEncUiDecrView. -* -*/ - -// INCLUDE FILES -// Class includes -#include "DevEncUiDecrView.h" - -// System includes -#include // CAknViewAppUi -#include - -// User includes -#include "DevEncLog.h" -#include "DevEnc.hrh" -#include "DevEncUiDecrViewContainer.h" -#include "DevEncUiMemoryEntity.h" - -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrView::CDevEncUiDecrView -// -// ----------------------------------------------------------------------------- -// -CDevEncUiDecrView::~CDevEncUiDecrView() - { - delete iContainer; - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrView::NewL -// -// ----------------------------------------------------------------------------- -// -CDevEncUiDecrView* CDevEncUiDecrView::NewL( RArray& aMemEntities ) - { - CDevEncUiDecrView* self = CDevEncUiDecrView::NewLC( aMemEntities ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrView::NewLC -// -// ----------------------------------------------------------------------------- -// -CDevEncUiDecrView* CDevEncUiDecrView::NewLC( RArray& aMemEntities ) - { - CDevEncUiDecrView* self = new ( ELeave ) CDevEncUiDecrView( aMemEntities ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrView::CDevEncUiDecrView -// -// ----------------------------------------------------------------------------- -// -CDevEncUiDecrView::CDevEncUiDecrView( RArray& aMemEntities ) - : iMemEntities( aMemEntities ) - { - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrView::Container -// -// ----------------------------------------------------------------------------- -// -CDevEncUiDecrViewContainer* CDevEncUiDecrView::Container() - { - return iContainer; - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrView::GetAppUi -// -// ----------------------------------------------------------------------------- -// -CDevEncUiAppUi& CDevEncUiDecrView::GetAppUi() - { - CAknViewAppUi* aknViewAppUi = AppUi(); - CDevEncUiAppUi* appUi = reinterpret_cast( aknViewAppUi ); - return ( *appUi ); - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrView::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CDevEncUiDecrView::ConstructL() - { - BaseConstructL( R_DEVENCUI_DECRVIEW ); - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrView::Id -// -// ----------------------------------------------------------------------------- -// -TUid CDevEncUiDecrView::Id() const - { - return TUid::Uid( EDevEncUiDecrViewId ); - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrView::DoActivateL -// -// ----------------------------------------------------------------------------- -// -void CDevEncUiDecrView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, - TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/ ) - { - if ( !iContainer ) - { - iContainer = CDevEncUiDecrViewContainer::NewL( AppUi()->ClientRect(), - *this ); - iContainer->SetMopParent( this ); - AppUi()->AddToStackL( *this, iContainer ); - } - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrView::DoDeactivate -// -// ----------------------------------------------------------------------------- -// -void CDevEncUiDecrView::DoDeactivate() - { - if (iContainer) - { - AppUi()->RemoveFromStack( iContainer ); - delete iContainer; - iContainer = NULL; - } - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrView::HandleCommandL -// -// ----------------------------------------------------------------------------- -// -void CDevEncUiDecrView::HandleCommandL( TInt aCommand ) - { - - switch ( aCommand ) - { - - case EAknSoftkeyBack: - { - AppUi()->HandleCommandL( EAknSoftkeyBack ); - break; - } - default: - { - AppUi()->HandleCommandL( aCommand ); - } - } - } - -// -------------------------------------------------------------------------- -// Called by the framework when the application status pane -// size is changed. Passes the new client rectangle to the container. -// -------------------------------------------------------------------------- -void CDevEncUiDecrView::HandleStatusPaneSizeChange() - { - if ( iContainer ) - { - iContainer->SetRect( ClientRect() ); - } - } - -void CDevEncUiDecrView::HandleResourceChangeL( TInt aType ) - { - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - // do re-layout - if ( iContainer ) - { - iContainer->SetRect( ClientRect() ); - iContainer->HandleResourceChange( aType ); - } - } - } - - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiDecrViewContainer.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiDecrViewContainer.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,244 +0,0 @@ -/* -* Copyright (c) 2005 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 CDevEncUiDecrViewContainer. -* -*/ - -// INCLUDE FILES - -// Class includes -#include "DevEncUiDecrViewContainer.h" - -// System Includes -#include -#include -#include -#include -#include - -// User Includes -#include "DevEncLog.h" -#include "DevEnc.hrh" -#include "DevEncUi.pan" -#include "DevEncUiAppui.h" -#include "DevEncUiDocument.h" -#include "DevEncUiDecrView.h" - -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrViewContainer::NewLC -// -// ----------------------------------------------------------------------------- -// -CDevEncUiDecrViewContainer* CDevEncUiDecrViewContainer::NewLC( const TRect& aRect, - CAknView& aOwningView ) - { - CDevEncUiDecrViewContainer* self = - new ( ELeave ) CDevEncUiDecrViewContainer( aOwningView ); - CleanupStack::PushL( self ); - self->ConstructL( aRect ); - return self; - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrViewContainer::NewL -// -// ----------------------------------------------------------------------------- -// -CDevEncUiDecrViewContainer* CDevEncUiDecrViewContainer::NewL( const TRect& aRect, - CAknView& aOwningView ) - { - CDevEncUiDecrViewContainer* self = NewLC( aRect, aOwningView ); - CleanupStack::Pop( self ); - return self; - } - - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrViewContainer::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CDevEncUiDecrViewContainer::ConstructL( const TRect& aRect ) - { - // Create a window for this application view - CreateWindowL(); - - CreateListL(); - - // Set the windows size - SetRect( aRect ); - - // Activate the window, which makes it ready to be drawn - ActivateL(); - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrViewContainer::CreateListL -// -// ----------------------------------------------------------------------------- -// -void CDevEncUiDecrViewContainer::CreateListL() - { - // First phase construction - iListBox = new ( ELeave ) CAknDoubleStyle2ListBox; - iListBox->SetContainerWindowL( *this ); - - // Second Phase Construction - TResourceReader reader; - iEikonEnv->CreateResourceReaderLC( reader, R_DEVENCUI_DECRYPTION_LISTBOX ); - iListBox->ConstructFromResourceL( reader ); - CleanupStack::PopAndDestroy(); // reader (Can't pass T-classes as parameter) - - iListBox->SetListBoxObserver( this ); - iListBox->CreateScrollBarFrameL( ETrue ); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrViewContainer::CDevEncUiDecrViewContainer -// -// ----------------------------------------------------------------------------- -// -CDevEncUiDecrViewContainer::CDevEncUiDecrViewContainer( CAknView& aOwningView ) - : iOwningView( aOwningView ) - { - // No implementation required - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrViewContainer::CDevEncUiDecrViewContainer -// -// ----------------------------------------------------------------------------- -// -CDevEncUiDecrViewContainer::~CDevEncUiDecrViewContainer() - { - delete iListBox; - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrViewContainer::HandleListBoxEventL -// -// ----------------------------------------------------------------------------- -// -void CDevEncUiDecrViewContainer::HandleListBoxEventL( CEikListBox* /*aListBox*/, - TListBoxEvent aEventType ) - { - switch ( aEventType ) - { - case EEventItemSingleClicked: // FALLTHROUGH - case EEventEnterKeyPressed: - { - if ( iListBox->CurrentItemIndex() == 0 ) - { - iOwningView.HandleCommandL( EDevEncUiCommandDecrypt ); - } - if ( iListBox->CurrentItemIndex() == 1 ) - { - iOwningView.HandleCommandL( EDevEncUiCommandDecryptAndTurnOffEncryption ); - } - } - break; - default: - break; - } - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrViewContainer::CountComponentControls -// Return number of controls inside this container -// ----------------------------------------------------------------------------- -// -TInt CDevEncUiDecrViewContainer::CountComponentControls() const - { - return 1; - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrViewContainer::ComponentControl -// -// ----------------------------------------------------------------------------- -// -CCoeControl* CDevEncUiDecrViewContainer::ComponentControl( TInt aIndex ) const - { - switch ( aIndex ) - { - case 0: - return iListBox; - default: - return NULL; - } - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrViewContainer::Draw -// -// ----------------------------------------------------------------------------- -// -void CDevEncUiDecrViewContainer::Draw( const TRect& aRect ) const - { - CWindowGc& gc = SystemGc(); - gc.Clear( aRect ); - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDecrViewContainer::OfferKeyEventL -// -// ----------------------------------------------------------------------------- -// -TKeyResponse CDevEncUiDecrViewContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - if ( !iListBox ) - { - return EKeyWasNotConsumed; - } - if ( aKeyEvent.iCode == EKeyDevice3 /* OK key */ ) - { - if ( iListBox->CurrentItemIndex() < 0 ) - { - return EKeyWasConsumed; - } - // User selected a list item. Notify the callback instance. - if ( iListBox->CurrentItemIndex() == 0 ) - { - iOwningView.HandleCommandL( EDevEncUiCommandDecrypt ); - } - if ( iListBox->CurrentItemIndex() == 1 ) - { - iOwningView.HandleCommandL( EDevEncUiCommandDecryptAndTurnOffEncryption ); - } - return EKeyWasConsumed; - } - return iListBox->OfferKeyEventL( aKeyEvent, aType ); - } - -// -------------------------------------------------------------------------- -// CDevEncUiDecrViewContainer::SizeChanged() -// -// -------------------------------------------------------------------------- -// - void CDevEncUiDecrViewContainer::SizeChanged() - { - if ( iListBox ) - { - iListBox->SetExtent( TPoint( 0, 0 ), iListBox->MinimumSize() ); - } - } - -//End Of File - - diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiDocument.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiDocument.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* -* Copyright (c) 2005 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 CDevEncUiDocument. -* -*/ - -// INCLUDE FILES -#include "DevEncLog.h" -#include "DevEncUiAppui.h" -#include "DevEncUiDocument.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CDevEncUiDocument::NewL() -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CDevEncUiDocument* CDevEncUiDocument::NewL( CEikApplication& - aApp ) - { - CDevEncUiDocument* self = NewLC( aApp ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDocument::NewLC() -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CDevEncUiDocument* CDevEncUiDocument::NewLC( CEikApplication& - aApp ) - { - CDevEncUiDocument* self = - new ( ELeave ) CDevEncUiDocument( aApp ); - - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDocument::ConstructL() -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CDevEncUiDocument::ConstructL() - { - // No implementation required - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDocument::CDevEncUiDocument() -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -// -CDevEncUiDocument::CDevEncUiDocument( CEikApplication& aApp ) - : CAknDocument( aApp ) - { - // No implementation required - } - -// --------------------------------------------------------------------------- -// CDevEncUiDocument::~CDevEncUiDocument() -// Destructor. -// --------------------------------------------------------------------------- -// -CDevEncUiDocument::~CDevEncUiDocument() - { - // No implementation required - } - -// --------------------------------------------------------------------------- -// CDevEncUiDocument::CreateAppUiL() -// Constructs CreateAppUi. -// --------------------------------------------------------------------------- -// -CEikAppUi* CDevEncUiDocument::CreateAppUiL() - { - DFLOG( "CDevEncUiDocument::CreateAppUiL" ); - // Create the application user interface, and return a pointer to it - // the framework takes ownership of this object - return ( static_cast ( new ( ELeave ) - CDevEncUiAppUi ) ); - } - -// ----------------------------------------------------------------------------- -// CDevEncUiDocument::OpenFileL -// ----------------------------------------------------------------------------- -// -CFileStore* CDevEncUiDocument::OpenFileL( - TBool /*aDoOpen*/, - const TDesC& aFilename, - RFs& /*aFs*/) - { - iAppUi->OpenFileL(aFilename); - return NULL; - } - -// ----------------------------------------------------------------------------- -// void CDevEncUiDocument::OpenFileL() -// ----------------------------------------------------------------------------- -// -void CDevEncUiDocument::OpenFileL( - CFileStore*& /*aFileStore*/, - RFile& aFile) - { - ((CDevEncUiAppUi*) iAppUi)->OpenFileL(aFile); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiEncrView.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiEncrView.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005 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 CDevEncUiEncrView. -* -*/ - -// INCLUDE FILES -// Class includes -#include "DevEncUiEncrView.h" - -// System includes -#include // CAknViewAppUi -#include - -// User includes -#include "DevEncLog.h" -#include "DevEnc.hrh" -#include "DevEncUiEncrViewContainer.h" -#include "DevEncUiMemoryEntity.h" - -// ================= MEMBER FUNCTIONS ======================= - -/** -* Destructor. Frees up memory for the iLabel. -*/ -CDevEncUiEncrView::~CDevEncUiEncrView() - { - delete iContainer; - } - -/** -* Symbian OS 2 phase constructor. -* Constructs the CDevEncUiEncrView using the NewLC method, popping -* the constructed object from the CleanupStack before returning it. -* -* @param aRect The rectangle for this window -* @return The newly constructed CDevEncUiEncrView -*/ -CDevEncUiEncrView* CDevEncUiEncrView::NewL( RArray& aMemEntities ) - { - CDevEncUiEncrView* self = CDevEncUiEncrView::NewLC( aMemEntities ); - CleanupStack::Pop( self ); - return self; - } - -/** -* Symbian OS 2 phase constructor. -* Constructs the CDevEncUiEncrView using the constructor and ConstructL -* method, leaving the constructed object on the CleanupStack before returning it. -* -* @param aRect The rectangle for this window -* @return The newly constructed CDevEncUiEncrView -*/ -CDevEncUiEncrView* CDevEncUiEncrView::NewLC( RArray& aMemEntities ) - { - CDevEncUiEncrView* self = new ( ELeave ) CDevEncUiEncrView( aMemEntities ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -CDevEncUiEncrView::CDevEncUiEncrView( RArray& aMemEntities ) - : iMemEntities( aMemEntities ) - { - } - -CDevEncUiEncrViewContainer* CDevEncUiEncrView::Container() - { - return iContainer; - } - -CDevEncUiAppUi& CDevEncUiEncrView::GetAppUi() - { - CAknViewAppUi* aknViewAppUi = AppUi(); - CDevEncUiAppUi* appUi = reinterpret_cast( aknViewAppUi ); - return ( *appUi ); - } - -/** -* Symbian OS 2nd phase constructor. -* Uses the superclass constructor to construct the view using the -* R_EMCCVIEWSWITCHED_VIEW1 resource. -*/ -void CDevEncUiEncrView::ConstructL() - { - BaseConstructL( R_DEVENCUI_ENCRVIEW ); - } - -/** -* Called by the framework -* @return The Uid for this view -*/ -TUid CDevEncUiEncrView::Id() const - { - return TUid::Uid( EDevEncUiEncrViewId ); - } - -/** -* Called by the framework when the view is activated. Constructs the -* container if necessary, setting this view as its MOP parent, and -* adding it to the control stack. -*/ -void CDevEncUiEncrView::DoActivateL( const TVwsViewId& /*aPrevViewId*/ , - TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/ ) - { - if ( ! iContainer ) - { - iContainer = CDevEncUiEncrViewContainer::NewL( AppUi()->ClientRect(), - *this ); - iContainer->SetMopParent( this ); - AppUi()->AddToStackL( *this, iContainer ); - } - } - -/** -* Called by the framework when the view is deactivated. -* Removes the container from the control stack and deletes it. -*/ -void CDevEncUiEncrView::DoDeactivate() - { - if ( iContainer ) - { - AppUi()->RemoveFromStack( iContainer ); - delete iContainer; - iContainer = NULL; - } - } - -/** -* From CEikAppUi, takes care of command handling for this view. -* -* @param aCommand command to be handled -*/ -void CDevEncUiEncrView::HandleCommandL( TInt aCommand ) - { - DFLOG2( "CDevEncUiEncrView::HandleCommandL %d", aCommand ); - - switch ( aCommand ) - { - case EAknSoftkeyBack: - { - AppUi()->HandleCommandL( EAknSoftkeyBack ); - break; - } - default: - { - AppUi()->HandleCommandL( aCommand ); - } - } - } - -// -------------------------------------------------------------------------- -// Called by the framework when the application status pane -// size is changed. Passes the new client rectangle to the container. -// -------------------------------------------------------------------------- -void CDevEncUiEncrView::HandleStatusPaneSizeChange() - { - if ( iContainer ) - { - iContainer->SetRect( ClientRect() ); - } - } - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiEncrViewContainer.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiEncrViewContainer.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,250 +0,0 @@ -/* -* Copyright (c) 2005 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 CDevEncUiEncrViewContainer. -* -*/ - -// INCLUDE FILES - -// Class includes -#include "DevEncUiEncrViewContainer.h" - -// System Includes -#include -#include -#include -#include -#include - -// User Includes -#include "DevEncLog.h" -#include "DevEnc.hrh" -#include "DevEncUi.pan" -#include "DevEncUiAppui.h" -#include "DevEncUiDocument.h" -#include "DevEncUiEncrView.h" - -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// CDevEncUiEncrViewContainer::NewLC -// -// -------------------------------------------------------------------------- -// -CDevEncUiEncrViewContainer* CDevEncUiEncrViewContainer::NewLC( const TRect& aRect, - CAknView& aOwningView ) - { - CDevEncUiEncrViewContainer* self = - new ( ELeave ) CDevEncUiEncrViewContainer( aOwningView ); - CleanupStack::PushL( self ); - self->ConstructL( aRect ); - return self; - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncrViewContainer::NewL -// -// -------------------------------------------------------------------------- -// -CDevEncUiEncrViewContainer* CDevEncUiEncrViewContainer::NewL( - const TRect& aRect, - CAknView& aOwningView ) - { - CDevEncUiEncrViewContainer* self = NewLC( aRect, aOwningView ); - CleanupStack::Pop( self ); - return self; - } - - -// -------------------------------------------------------------------------- -// CDevEncUiEncrViewContainer::ConstructL -// -// -------------------------------------------------------------------------- -// -void CDevEncUiEncrViewContainer::ConstructL( const TRect& aRect ) - { - // Create a window for this application view - CreateWindowL(); - - CreateListL(); - - // Set the windows size - SetRect( aRect ); - - // Activate the window, which makes it ready to be drawn - ActivateL(); - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncrViewContainer::CreateListL -// -// -------------------------------------------------------------------------- -// -void CDevEncUiEncrViewContainer::CreateListL() - { - // First phase construction - iListBox = new ( ELeave ) CAknDoubleStyle2ListBox; - iListBox->SetContainerWindowL( *this ); - - // Second Phase Construction - TResourceReader reader; - iEikonEnv->CreateResourceReaderLC( reader, R_DEVENCUI_ENCRYPTION_LISTBOX ); - iListBox->ConstructFromResourceL( reader ); - CleanupStack::PopAndDestroy(); // reader (Can't pass T-classes as parameter) - - iListBox->SetListBoxObserver( this ); - iListBox->CreateScrollBarFrameL( ETrue ); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncrViewContainer::CDevEncUiEncrViewContainer -// -// -------------------------------------------------------------------------- -// -CDevEncUiEncrViewContainer::CDevEncUiEncrViewContainer( - CAknView& aOwningView ) - : iOwningView( aOwningView ) - { - // No implementation required - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncrViewContainer::CDevEncUiEncrViewContainer -// -// -------------------------------------------------------------------------- -// -CDevEncUiEncrViewContainer::~CDevEncUiEncrViewContainer() - { - delete iListBox; - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncrViewContainer::HandleListBoxEventL -// -// -------------------------------------------------------------------------- -// -void CDevEncUiEncrViewContainer::HandleListBoxEventL( CEikListBox* /*aListBox*/, - TListBoxEvent aEventType ) - { - switch ( aEventType ) - { - case EEventItemSingleClicked: // FALLTHROUGH - case EEventEnterKeyPressed: - { - if ( iListBox->CurrentItemIndex() == 0 ) - { - iOwningView.HandleCommandL( EDevEncUiCommandEncryptWithoutSavingKey ); - } - if ( iListBox->CurrentItemIndex() == 1 ) - { - iOwningView.HandleCommandL( EDevEncUiCommandEncryptAndSaveKey ); - } - if ( iListBox->CurrentItemIndex() == 2 ) - { - iOwningView.HandleCommandL( EDevEncUiCommandEncryptWithRestoredKey ); - } - } - break; - default: - break; - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncrViewContainer::CountComponentControls -// Return number of controls inside this container -// -------------------------------------------------------------------------- -// -TInt CDevEncUiEncrViewContainer::CountComponentControls() const - { - return 1; - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncrViewContainer::ComponentControl -// -// -------------------------------------------------------------------------- -// -CCoeControl* CDevEncUiEncrViewContainer::ComponentControl( TInt aIndex ) const - { - switch ( aIndex ) - { - case 0: - return iListBox; - default: - return NULL; - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncrViewContainer::Draw -// -// -------------------------------------------------------------------------- -// -void CDevEncUiEncrViewContainer::Draw( const TRect& aRect ) const - { - CWindowGc& gc = SystemGc(); - gc.Clear( aRect ); - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncrViewContainer::OfferKeyEventL -// -// -------------------------------------------------------------------------- -// -TKeyResponse CDevEncUiEncrViewContainer::OfferKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - if ( !iListBox ) - { - return EKeyWasNotConsumed; - } - if ( aKeyEvent.iCode == EKeyDevice3 /* OK key */ ) - { - if ( iListBox->CurrentItemIndex() == 0 ) - { - iOwningView.HandleCommandL( EDevEncUiCommandEncryptWithoutSavingKey ); - } - if ( iListBox->CurrentItemIndex() == 1 ) - { - iOwningView.HandleCommandL( EDevEncUiCommandEncryptAndSaveKey ); - } - if ( iListBox->CurrentItemIndex() == 2 ) - { - iOwningView.HandleCommandL( EDevEncUiCommandEncryptWithRestoredKey ); - } - return EKeyWasConsumed; - } - return iListBox->OfferKeyEventL( aKeyEvent, aType ); - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncrViewContainer::SizeChanged() -// -// -------------------------------------------------------------------------- -// - void CDevEncUiEncrViewContainer::SizeChanged() - { - if ( iListBox ) - { - iListBox->SetExtent( TPoint( 0, 0 ), iListBox->MinimumSize() ); - } - } - -//End Of File - - diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiEncryptionOperator.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiEncryptionOperator.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1349 +0,0 @@ -/* -* Copyright (c) 2005 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 CDevEncUiEncryptionOperator. -* -*/ - -// INCLUDE FILES -#include -// Class includes -#include "DevEncLog.h" -#include "DevEncUids.hrh" -#include "DevEncUiEncryptionOperator.h" - -#include "DevEncUiFileManager.h" - -//System includes -#include -#include -#include -#include // for CAknErrorNote -#include // For BAFL, localized resource files -#include -#include -#include // for resource files dir -#include -#include -#include -#include -#include -#include // For general settings view UIDs (autolock) -#include // For power state -#include // for autolock -#include -#include -#include // For character conversion -#include - -#include - -//User includes -#include "DevEncLog.h" -#include "DevEnc.hrh" -#include "DevEncUiCreateKeyProcess.h" -#include "DevEncDef.h" -#include "DevEncUiMemoryEntity.h" -#include "DevEncUiSecretMinMaxCodeQuery.h" -//for KMaxAutolockPeriod = 20; -#include "DevEncSession.h" - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::~CDevEncUiEncryptionOperator -// -// -------------------------------------------------------------------------- -// -CDevEncUiEncryptionOperator::~CDevEncUiEncryptionOperator() - { - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::NewL -// -// -------------------------------------------------------------------------- -// -CDevEncUiEncryptionOperator* CDevEncUiEncryptionOperator::NewL( CEikonEnv& aEikonEnv, - CAknViewAppUi& aAppUi, - CRepository*& aCrSettings ) - { - CDevEncUiEncryptionOperator* self = - CDevEncUiEncryptionOperator::NewLC( aEikonEnv, - aAppUi, - aCrSettings ); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::NewLC -// -// -------------------------------------------------------------------------- -// -CDevEncUiEncryptionOperator* CDevEncUiEncryptionOperator::NewLC( CEikonEnv& aEikonEnv, - CAknViewAppUi& aAppUi, - CRepository*& aCrSettings ) - { - CDevEncUiEncryptionOperator* self = - new ( ELeave ) CDevEncUiEncryptionOperator( aEikonEnv, - aAppUi, - aCrSettings ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::CDevEncUiEncryptionOperator -// -// -------------------------------------------------------------------------- -// -CDevEncUiEncryptionOperator::CDevEncUiEncryptionOperator( CEikonEnv& aEikonEnv, - CAknViewAppUi& aAppUi, - CRepository*& aCrSettings ) - : iEikEnv( aEikonEnv ), - iAppUi( aAppUi ), - iCrSettings( aCrSettings ) - { - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::ConstructL -// -// -------------------------------------------------------------------------- -// -void CDevEncUiEncryptionOperator::ConstructL() - { - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::HandlePhoneMemEncryptRequestL() -// -------------------------------------------------------------------------- -// -void CDevEncUiEncryptionOperator::HandlePhoneMemEncryptRequestL( CDevEncUiMemoryEntity* aMem, CDevEncUiMemoryEntity* aPrimaryMem ) - { - // Check the battery level first - if ( ! CheckBatteryL() ) - { - // The battery level is too low and no charger is connected. - // Show a note to the user. - ErrorNoteL( R_DEVENCUI_TEXT_BATTERY_LOW ); - User::Leave( KErrNotReady ); - } - - if ( (aMem->State() == EDecrypted) || (aPrimaryMem && (aPrimaryMem->State() == EDecrypted)) ) - { - // Encryption is off -> encrypt - if ( PrepareEncryptionL() ) - { - if ( aMem->State() == EDecrypted ) - { - DFLOG( "Starting Mass Storage encryption" ); - aMem->StartEncryptionL(); - } - if( aPrimaryMem && (aPrimaryMem->State() == EDecrypted) ) - { - DFLOG( "Starting phone memory encryption" ); - aPrimaryMem->StartEncryptionL(); - } - } - else - { - DFLOG( "Encryption cancelled" ); - } - } - else if ( (aMem->State() == EEncrypted) || (aPrimaryMem && (aPrimaryMem->State() == EEncrypted)) ) - { - if ( PrepareDecryptionL() ) - { - if ( aMem->State() == EEncrypted ) - { - DFLOG( "Starting Mass Storage decryption" ); - aMem->StartDecryptionL(); - } - if( aPrimaryMem && (aPrimaryMem->State() == EEncrypted) ) - { - DFLOG( "Starting phone memory decryption" ); - aPrimaryMem->StartDecryptionL(); - } - } - else - { - DFLOG( "Decryption cancelled" ); - } - } - else - { - DFLOG2( "Phone memory busy, state = %d, no action", aMem->State() ); - } - - // Depending on the user's selection, the memory may be in the same - // state as before or in a new state. This call will let all observers - // know what state the memory ended up in. - aMem->UpdateMemoryInfo(); - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::PrepareEncryptionL() -// -------------------------------------------------------------------------- -// -TBool CDevEncUiEncryptionOperator::PrepareEncryptionL() - { - TBool result( EFalse ); - - // Show the confirmation query about autolock - CAknMessageQueryDialog* yesNoQuery = new ( ELeave ) CAknMessageQueryDialog; - if ( ! yesNoQuery->ExecuteLD( R_DEVENCUI_ENCRYPT_CONFIRMATION_QUERY_DIALOG ) ) - { - // User answered no. Do nothing - DFLOG( "User cancelled after autolock warning. No action." ); - return result; - } - - // Autolock must be on before encryption can be enabled. - // Get the current autolock status and the current max autolock period - TInt lockTime = 0; - TBuf8<21> autoLockPeriodBuf; - - RTerminalControl terminalCtrl; - TInt ctrlConnect = terminalCtrl.Connect(); - DFLOG2( "DEVENC: terminal control connected %d", ctrlConnect ); - - RTerminalControl3rdPartySession session; - TInt retValue = session.Open( terminalCtrl ); - DFLOG2( "DEVENC: terminal control session open %d", retValue ); - - TInt err2 = session.GetDeviceLockParameter( RTerminalControl3rdPartySession::ETimeout, autoLockPeriodBuf ); - DFLOG2( "DEVENC: max value get returned value %d", err2 ); - - TLex8 lexAutolock( autoLockPeriodBuf ); - lexAutolock.Val( lockTime ); - DFLOG2( "lockTime = %d", lockTime ); - - //Get current max autolock period - TBuf8<21> oldMaxPeriodBuf; - TInt maxperioderr = session.GetDeviceLockParameter( RTerminalControl3rdPartySession::EMaxTimeout, oldMaxPeriodBuf ); - DFLOG2( "DEVENC: max value set returned value %d", maxperioderr ); - -#ifndef __WINS__ - // Setting the autolock works only in target - - if ( lockTime == 0 ) - { - // Autolock disabled. Go to the autolock settings - DFLOG( "Autolock currently disabled, going to settings" ); - - // Create the filename of the SecUi resource file - _LIT( KFileDrive, "z:" ); - _LIT( KSecUiResourceFileName, "SecUi.rsc" ); - TFileName filename; - filename += KFileDrive; - filename += KDC_RESOURCE_FILES_DIR; - filename += KSecUiResourceFileName; - - // Convert to a localized resource filename if possible - RFs fs; - User::LeaveIfError( fs.Connect() ); - BaflUtils::NearestLanguageFile( fs, filename ); - - // Load the SecUi resource file - TInt rfileOffset( 0 ); - TRAPD( err, rfileOffset = iEikEnv.AddResourceFileL( filename ) ); - if ( err ) - { - DFLOG2( "Add resource file error %d", err ); - } - User::LeaveIfError( err ); - - // Set maximum autolock period - - TBuf8<21> maxPeriodBuf; - maxPeriodBuf.AppendNum( KMaxAutolockPeriod ); - TInt err3 = session.SetDeviceLockParameter( RTerminalControl3rdPartySession::EMaxTimeout, maxPeriodBuf ); - DFLOG2( "DEVENC: max value set returned value %d", err3 ); - - // Let the user set an autolock period - CSecuritySettings* secSett = CSecuritySettings::NewL(); - CleanupStack::PushL( secSett ); - TInt newLockTime = secSett->ChangeAutoLockPeriodL( lockTime ); - CleanupStack::PopAndDestroy( secSett ); - - iEikEnv.DeleteResourceFile( rfileOffset ); - - if ( newLockTime == 0 ) - { - // User cancelled or set autolock off -> do nothing - DFLOG( "User selected not to enable autolock. No action." ); - - //restore the old maximum period value - TInt err3 = session.SetDeviceLockParameter( RTerminalControl3rdPartySession::EMaxTimeout, oldMaxPeriodBuf ); - DFLOG2( "DEVENC: max value set returned value %d", err3 ); - - //the autolock period is now at KMaxAutolockPeriod( =20 ) so we have to set it as it was previously - err3 = session.SetDeviceLockParameter( RTerminalControl3rdPartySession::ETimeout, autoLockPeriodBuf ); - DFLOG2( "DEVENC: max value set returned value %d", err3 ); - - session.Close(); - terminalCtrl.Close(); - return result; - } - - TBuf8<21> newLockTimeBuf; - newLockTimeBuf.AppendNum( newLockTime ); - - TInt setResult = session.SetDeviceLockParameter( RTerminalControl3rdPartySession::ETimeout, newLockTimeBuf ); - if ( setResult ) - { - // TBI: Log the failure and leave with error - DFLOG2( "ERROR: session.SetDeviceLockParameter( RTerminalControl3rdPartySession::ETimeout, .. ) returned %d", setResult ); - session.Close(); - terminalCtrl.Close(); - return result; - } - lockTime = newLockTime; - } - else - { - DFLOG( "Autolock already enabled. Set only the current maximum period" ); - - //By setting the max autolock period the autolock period is set to max if it was greater than that - TBuf8<21> maxPeriodBuf; - maxPeriodBuf.AppendNum( KMaxAutolockPeriod ); - TInt err3 = session.SetDeviceLockParameter( RTerminalControl3rdPartySession::EMaxTimeout, maxPeriodBuf ); - DFLOG2( "DEVENC: max value set returned value %d", err3 ); - } -#endif // __WINS__ - - DFLOG2( "Autolock time is %d", lockTime ); - - // Autolock is now enabled, so we can proceed with the encryption - // Warn the user about the long encryption process - if ( MessageQueryL( R_DEVENCUI_TEXT_NOTE_ENCRYPTING ) ) - { - result = ETrue; - DFLOG( "Starting encryption" ); - } - else - { - DFLOG( "Encryption cancelled" ); - //the encryption was cancelled. Let's set the old autolock values - //restore the old maximum period value - TInt err3 = session.SetDeviceLockParameter( RTerminalControl3rdPartySession::EMaxTimeout, oldMaxPeriodBuf ); - DFLOG2( "DEVENC: max value set returned value %d", err3 ); - - //the autolock period is now at KMaxAutolockPeriod( =20 ) so we have to set it as it was previously - err3 = session.SetDeviceLockParameter( RTerminalControl3rdPartySession::ETimeout, autoLockPeriodBuf ); - DFLOG2( "DEVENC: max value set returned value %d", err3 ); - } - - session.Close(); - terminalCtrl.Close(); - - return result; - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::PrepareDecryptionL() -// -------------------------------------------------------------------------- -// -TBool CDevEncUiEncryptionOperator::PrepareDecryptionL() - { - // Warn the user about the long decryption process - return MessageQueryL( R_DEVENCUI_TEXT_NOTE_PHONE_DECRYPTING ); - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::MessageQueryL() -// -------------------------------------------------------------------------- -// -TBool CDevEncUiEncryptionOperator::MessageQueryL( TInt aResourceId, - TInt aSoftKeysId ) - { - TBool result( EFalse ); - - // Show a message query with OK and Cancel buttons and the specified text - CAknMessageQueryDialog* query = - new ( ELeave ) CAknMessageQueryDialog; - query->PrepareLC( R_DEVENCUI_ENCRYPT_CONFIRMATION_QUERY_DIALOG ); - query->ButtonGroupContainer().SetCommandSetL( aSoftKeysId ); - HBufC* prompt = StringLoader::LoadLC( aResourceId, &iEikEnv ); - query->SetMessageTextL( *prompt ); - CleanupStack::PopAndDestroy( prompt ); - if ( query->RunLD() ) - { - result = ETrue; - } - return result; - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::QueryDialog() -// -------------------------------------------------------------------------- -// -TBool CDevEncUiEncryptionOperator::QueryDialogL( TInt aResourceId, - TInt aSoftKeysId ) - { - TBool result( EFalse ); - CAknQueryDialog* query = CAknQueryDialog::NewL(); - query->PrepareLC( R_DEVENCUI_CONFIRMATION_QUERY ); // CleanupStack OK - HBufC* prompt = StringLoader::LoadLC( aResourceId, &iEikEnv ); - query->SetPromptL( *prompt ); - query->ButtonGroupContainer().SetCommandSetL( aSoftKeysId ); - - CleanupStack::PopAndDestroy( prompt ); - if ( query->RunLD() ) - { - result = ETrue; - } - return result; - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::DataQueryDialogL() -// -------------------------------------------------------------------------- -// -TBool CDevEncUiEncryptionOperator::DataQueryDialogL( TDes& aResult, - TInt aPromptResourceId, - TInt aMaxLength ) - { - // The descriptor contained the prompt text for the query. The prompt - // text can also be defined in the resource structure of the query - HBufC* prompt = StringLoader::LoadLC( aPromptResourceId, &iEikEnv ); - - // create dialog instance - CAknTextQueryDialog* dlg = - new( ELeave ) CAknTextQueryDialog( aResult, *prompt ); - - CleanupStack::PopAndDestroy( prompt ); - - // Sets the maximum length of the text editor - dlg->SetMaxLength( aMaxLength ); - - // Prepares the dialog, constructing it from the specified resource - dlg->PrepareLC( R_DEVENCUI_DATA_QUERY ); - - // Launch the dialog - return dlg->RunLD(); - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::HandleMmcEncryptRequestL() -// -------------------------------------------------------------------------- -// -void CDevEncUiEncryptionOperator::HandleMmcEncryptRequestL( CDevEncUiMemoryEntity* aMem, - TInt aCommand ) - { - // Check the battery level first - if ( ! CheckBatteryL() ) - { - // The battery level is too low and no charger is connected. - // Show a note to the user. - ErrorNoteL( R_DEVENCUI_TEXT_BATTERY_LOW ); - User::Leave( KErrNotReady ); - } - - TBool proceed( EFalse ); - switch ( aCommand ) - { - case EDevEncUiCommandEncryptWithRestoredKey: - { - DFLOG( "Encrypt with restored key selected" ); - proceed = LoadAndSetKeyL(); // No cleanup stack needed - break; - } - - case EDevEncUiCommandEncryptAndSaveKey: - { - DFLOG( "Encrypt and save key selected" ); - proceed = CreateAndSaveKeyL(); // No cleanup stack needed - if( proceed ) - { - InfoNoteL( R_DEVENCUI_TEXT_NOTE_SAVEINFO, ETrue ); - DFLOG( "Key saved succesfully" ); - } - break; - } - - case EDevEncUiCommandEncryptWithoutSavingKey: - { - DFLOG( "Encrypt without saving key selected" ); - // Create an encryption key and take it in use - // The key will remain in the driver until the next key is set, - // and it can not be retrieved. - proceed = CreateKeyL(); // No cleanup stack needed - break; - } - - case EDevEncUiCommandEncryptWithCurrentKey: - { - DFLOG( "Encrypt with current key selected" ); - proceed = ETrue; - } - - default: - { - DFLOG( "Invalid command" ); - break; - } - } - - if ( aMem->State() == EUnmounted ) - { - if( !proceed ) - { - // The encryption operation was cancelled, just go back to encryption view - DFLOG( "No Mmc present and operation was cancelled -> no encryption" ); - } - else - { - // The encryption operation was succesfull, go back to main view - iAppUi.ActivateLocalViewL( TUid::Uid( EDevEncUiMainViewId ) ); - proceed = EFalse; - DFLOG( "No Mmc present -> no encryption" ); - } - } - - if ( aMem->State() == ECorrupted ) - { - if( !proceed ) - { - DFLOG( "Mmc probably enc with another key -> wait for remount" ); - } - else - { - // Mmc was probably encrypted with another key. We have just set a - // new key, so now we have to wait until the state changes and hope - // that the card is readable. If it is, a note will be shown to the - // user. (See UI spec 2.7) - InfoNoteL( R_DEVENCUI_TEXT_NOTE_MEMORYCARD_ENCRYPTED, ETrue ); - iAppUi.ActivateLocalViewL( TUid::Uid( EDevEncUiMainViewId ) ); - proceed = EFalse; - DFLOG( "Mmc probably enc with another key -> wait for remount" ); - RemountMmcL(); - } - } - - if ( proceed ) - { - TInt encrypt( 0 ); - - // Check DM admin status - TInt dmControlSetting( 0 ); - iCrSettings->Get( KDevEncUiDmControl, dmControlSetting ); - - if( ( dmControlSetting & KDmControlsMemoryCard ) && ( aCommand == EDevEncUiCommandEncryptWithCurrentKey ) ) - { - //if the DM admin is controlling the encryption, encrypt straight away - encrypt = ETrue; - } - else - { - encrypt = MessageQueryL( R_DEVENCUI_TEXT_NOTE_ENCRYPTING ); - } - - // Warn the user about the long encryption process - if ( encrypt ) - { - // Start the encryption - DFLOG( "Starting encryption" ); - aMem->StartEncryptionL(); - // Go back to main view - iAppUi.ActivateLocalViewL( TUid::Uid( EDevEncUiMainViewId ) ); - } - else - { - DFLOG( "Encryption cancelled" ); - // Stay in the Encryption view - // Show a note to the user about that the new key is in use, - // but the card is still decrypted (UI spec 2.3) - InfoNoteL( R_DEVENCUI_TEXT_NOTE_ENCRYPTIONINTERRUPT, ETrue ); - iAppUi.ActivateLocalViewL( TUid::Uid( EDevEncUiMainViewId ) ); - } - } - - // Depending on the user's selection, the memory may be in the same - // state as before or in a new state. This call will let all observers - // know what state the memory ended up in. - aMem->UpdateMemoryInfo(); - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::CreateKeyL() -// -------------------------------------------------------------------------- -// -TBool CDevEncUiEncryptionOperator::CreateKeyL() - { - TBool proceed( EFalse ); - CDevEncKeyUtils* utils = new ( ELeave ) CDevEncKeyUtils; - CleanupStack::PushL( utils ); -// User::LeaveIfError(utils->Connect()); - TRequestStatus status; - utils->CreateSetKey( status, KEncryptionKeyLength ); - User::WaitForRequest( status ); -// utils->Close(); - CleanupStack::PopAndDestroy( utils ); - if ( ! status.Int() ) - { - // Save the Mmc encryption key status - User::LeaveIfError( iCrSettings->Set( KDevEncUserSettingMemoryCard, - ETrue ) ); - proceed = ETrue; - } - return proceed; - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::CreateAndSaveKeyL() -// -------------------------------------------------------------------------- -// -TBool CDevEncUiEncryptionOperator::CreateAndSaveKeyL() - { - TBool proceed( EFalse ); - - TBool passwordOk( EFalse ); - TBool keyFileNameOk( EFalse ); - TBool keyCreated( EFalse ); - TBool keySaved( EFalse ); - CFileStore* file( NULL ); - HBufC* keyFileName = HBufC::NewLC( KMaxFilenameLength ); - - // Get the key password from the user - HBufC8* password = HBufC8::NewLC( KMaxPasswordLength ); - TPtr8 passwordPtr = password->Des(); - passwordOk = PasswordQueryL( R_DEVENCUI_TEXT_PASSPHRASE_PROTECT, - passwordPtr ); - - CDevEncUiFileManager* fm = new ( ELeave ) CDevEncUiFileManager; - CleanupStack::PushL( fm ); - fm->ConstructL(); - - HBufC8* pkcs5Key( NULL ); - - if ( passwordOk ) - { - DFLOG( "Password entered" ); - // The user entered the correct password - - // Construct file path - _LIT( KDevEncKeyFileExtension, ".pk5"); - TBuf filePath; - User::LeaveIfError( fm->KeyFolder( filePath ) ); - TInt pathLen( filePath.Length() ); - - // Get the key file name from the user - TBool filenameEntered( EFalse ); - TBool cancelPressed( EFalse ); - TPtr16 keyFileNamePtr = keyFileName->Des(); - while ( ( ! cancelPressed ) && ( ! file ) ) - { - filenameEntered = DataQueryDialogL( keyFileNamePtr, - R_DEVENCUI_TEXT_FILENAME, - KMaxFilenameLength ); - if ( !filenameEntered ) - { - // User pressed cancel, stop here - cancelPressed = ETrue; - } - else - { - // User entered a file name. Try to open a file store - filePath.Append( keyFileNamePtr ); - filePath.Append( KDevEncKeyFileExtension ); - TInt openError = fm->OpenFileStore( filePath, - file ); - if ( openError ) - { - DFLOG2( "Error opening file: %d", openError ); - - // Notify the user that something went wrong - if ( openError == KErrAlreadyExists ) - { - ErrorNoteL( R_DEVENCUI_TEXT_FILE_EXISTS ); - } - else - { - ErrorNoteL( R_DEVENCUI_TEXT_BAD_NAME ); - } - - // Remove the file name from the path and try again - filePath.Delete( pathLen, filePath.Length() - pathLen ); - } - else - { - DFLOG( "File opened:" ); - DFLOGBUF( filePath ); - keyFileNameOk = ETrue; - CleanupStack::PushL( file ); - } - } - } // end of while - } - else - { - DFLOG( "Password incorrect" ); - } - - if ( keyFileNameOk ) - { - // Create the encryption key - CDevEncKeyUtils* utils = new ( ELeave ) CDevEncKeyUtils; - CleanupStack::PushL( utils ); -// User::LeaveIfError(utils->Connect()); - - TRequestStatus status; - utils->CreateSetKey( status, pkcs5Key, *password, KEncryptionKeyLength ); - User::WaitForRequest( status ); -// utils->Close(); - CleanupStack::PopAndDestroy( utils ); - - if ( status.Int() ) - { - DFLOG2( "Error creating key: %d", status.Int() ); - } - else - { - keyCreated = ETrue; - CleanupStack::PushL( pkcs5Key ); - // Save the Mmc encryption key status - User::LeaveIfError( iCrSettings->Set( KDevEncUserSettingMemoryCard, - ETrue ) ); - } - } - - if ( keyCreated ) - { - // Save the key - fm->SaveKeyL( file, *pkcs5Key ); - CleanupStack::PopAndDestroy( pkcs5Key ); - keySaved = ETrue; - } - - if ( keySaved ) - { - // Finally, start the encryption - proceed = ETrue; - } - - // Cleanup on demand - if ( file ) - { - CleanupStack::PopAndDestroy( file ); - } - if ( fm ) - { - CleanupStack::PopAndDestroy( fm ); - } - if ( password ) - { - CleanupStack::PopAndDestroy( password ); - } - if ( keyFileName ) - { - CleanupStack::PopAndDestroy( keyFileName ); - } - - return proceed; - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::LoadAndSetKeyL() -// -------------------------------------------------------------------------- -// -TBool CDevEncUiEncryptionOperator::LoadAndSetKeyL() - { - TBool proceed( EFalse ); - - TBool keySelected( EFalse ); - TBool passwordOk( EFalse ); - TBool askPassword( ETrue ); - HBufC8* pkcs5Key( NULL ); - TBuf8 password8; - - // Get a list of existing keys in the private directory - CDevEncUiFileManager* fm = new ( ELeave ) CDevEncUiFileManager; - CleanupStack::PushL( fm ); - fm->ConstructL(); - CDir* dir( NULL ); - fm->GetKeyListL( dir ); - - DFLOG2( "Found %d keys", dir->Count() ); - - if ( dir->Count() <= 0 ) - { - ErrorNoteL( R_DEVENCUI_TEXT_NO_KEYS_FOUND ); - User::Leave( KErrNotReady ); - } - - // Create a list for the query - iListQueryItemArray = new ( ELeave ) CDesCArrayFlat( dir->Count() ); - for ( TInt i = 0; i < dir->Count(); i++ ) - { - TEntry entry( (*dir)[i] ); - HBufC* tmpFileName = entry.iName.AllocLC(); - iListQueryItemArray->AppendL( entry.iName ); - CleanupStack::PopAndDestroy( tmpFileName ); - } - - // Let the user select which key to load - TInt index( 0 ); // the index of the selected item - CAknListQueryDialog* query = - new ( ELeave ) CAknListQueryDialog( &index ); - query->PrepareLC( R_DEVENCUI_LIST_QUERY ); - query->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_OK_BACK ); - query->SetItemTextArray( iListQueryItemArray ); - // Keep ownership of the item array - query->SetOwnershipType( ELbmDoesNotOwnItemArray ); - if ( query->RunLD() ) - { - DFLOG2( "User selected key %d", index ); - DFLOGBUF( ( *dir )[index].iName ); - // Load the key file. - - // Construct file path - TBuf filePath; - DFLOG("Start find key folder"); - User::LeaveIfError( fm->KeyFolder( filePath ) ); - DFLOG("Stop find key folder"); - - TFileName filename; - filename.Append( filePath ); - filename.Append( ( *dir )[index].iName ); - fm->LoadKeyL( filename, - pkcs5Key ); - CleanupStack::PushL( pkcs5Key ); - keySelected = ETrue; - DFLOG( "Key loaded" ); - } - else - { - // User cancelled the query - DFLOG( "Key file query cancelled by user, stopping here" ); - } - - while ( askPassword ) - { - if ( keySelected ) - { - // Get the key password from the user - passwordOk = PasswordQueryL( R_DEVENCUI_TEXT_PASSPHRASE_ASK, - password8 ); - } - else - { - //The user pressed back. Do not ask the password - askPassword = EFalse; - } - - if ( passwordOk ) - { - DFLOG( "Password ok, setting key" ); - CDevEncKeyUtils* utils = new ( ELeave ) CDevEncKeyUtils; - CleanupStack::PushL( utils ); -// User::LeaveIfError(utils->Connect()); - - TRequestStatus status; - utils->SetKey( status, *pkcs5Key, password8 ); - User::WaitForRequest( status ); -// utils->Close(); - CleanupStack::PopAndDestroy( utils ); - if ( status.Int() ) - { - const TInt KErrBadPassphrase( -11000 ); - DFLOG2( "Error taking key in use: %d", status.Int() ); - if ( status.Int() == KErrBadPassphrase ) - { - DFLOG( "Invalid password" ); - ErrorNoteL( R_DEVENCUI_TEXT_INVALID_PASSWORD ); - } - else - { - DFLOG2( "Key read error %d", status.Int() ); - ErrorNoteL( R_DEVENCUI_TEXT_KEY_ERROR ); - askPassword = EFalse; - } - } - else - { - DFLOG( "New key is now in use" ); - // Save the Mmc encryption key status - User::LeaveIfError( iCrSettings->Set( KDevEncUserSettingMemoryCard, - ETrue ) ); - proceed = ETrue; - askPassword = EFalse; - } - } - else - { - askPassword = EFalse; - } - } - // Cleanup on demand - if ( pkcs5Key ) - { - CleanupStack::PopAndDestroy( pkcs5Key ); - } - if ( fm ) - { - CleanupStack::PopAndDestroy( fm ); - } - - return proceed; - } - - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::PasswordQueryL() -// -------------------------------------------------------------------------- -// -TBool CDevEncUiEncryptionOperator::PasswordQueryL( TInt aPromptResourceId, - TDes8& aResult ) - { - TBool passwordOk( EFalse ); - TBuf password; - TBuf8 password8; - CDevEncUiSecretMinMaxCodeQuery* query = - new ( ELeave ) CDevEncUiSecretMinMaxCodeQuery( password, - KMinPasswordLength, - KMaxPasswordLength ); - - HBufC* prompt = StringLoader::LoadLC( aPromptResourceId, &iEikEnv ); - query->SetPromptL( *prompt ); - CleanupStack::PopAndDestroy( prompt ); - - // Prompt the user for the key password - if ( ( query->ExecuteLD( R_DEVENCUI_CODE_QUERY ) ) ) - { - // This indicates that the user filled in some password and - // pressed OK. - passwordOk = ETrue; - } - else - { - DFLOG( "Key password dialog cancelled" ); - } - - if ( passwordOk ) - { - // Convert the password to UTF-8 - if ( CnvUtfConverter::ConvertFromUnicodeToUtf8( password8, - password ) ) - { - DFLOG( "Password conversion failed" ); - passwordOk = EFalse; - } - else - { - aResult.Copy( password8 ); - } - } - - return passwordOk; - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::HandleMmcDecryptRequestL() -// -------------------------------------------------------------------------- -// -void CDevEncUiEncryptionOperator::HandleMmcDecryptRequestL( CDevEncUiMemoryEntity* aMem, - TInt aCommand ) - { - // Check the battery level first - if ( ! CheckBatteryL() ) - { - // The battery level is too low and no charger is connected. - // Show a note to the user. - ErrorNoteL( R_DEVENCUI_TEXT_BATTERY_LOW ); - User::Leave( KErrNotReady ); - } - - TBool proceed( EFalse ); - switch ( aCommand ) - { - case EDevEncUiCommandDecrypt: - { - DFLOG( "Decrypt selected" ); - // Warn the user about the long decryption process - proceed = MessageQueryL( R_DEVENCUI_TEXT_NOTE_DECRYPTING ); - break; - } - case EDevEncUiCommandDecryptAndTurnOffEncryption: - { - DFLOG( "Decrypt and turn off selected" ); - // Warn the user about the long decryption process, - // and that the key will be destroyed - proceed = MessageQueryL( R_DEVENCUI_TEXT_NOTE_DECRYPTINGDESTROY ); - // Save the Mmc encryption key status - User::LeaveIfError( iCrSettings->Set( KDevEncUserSettingMemoryCard, - EFalse ) ); - // The key will actually be destroyed in the DevEncStarter - // component, because the user may exit from the UI at any time. - // By saving the encryption key status in the central repository, - // we ensure that the Starter knows that it's supposed to destroy - // the key when the operation is complete - // TBI: Destroy the key in Starter after decryption is complete. - break; - } - default: - { - break; - } - } - - if ( aMem->State() == EUnmounted ) - { - // Just go back to main view, no decryption operation - iAppUi.ActivateLocalViewL( TUid::Uid( EDevEncUiMainViewId ) ); - proceed = EFalse; - DFLOG( "No Mmc present -> no decryption" ); - } - - if ( proceed ) - { - // Start the decryption - DFLOG( "Starting decryption" ); - aMem->StartDecryptionL(); - // Go back to main view - iAppUi.ActivateLocalViewL( TUid::Uid( EDevEncUiMainViewId ) ); - } - else - { - DFLOG( "Decryption cancelled" ); - // Stay in the decryption view - } - - // Depending on the user's selection, the memory may be in the same - // state as before or in a new state. This call will let all observers - // know what state the memory ended up in. - aMem->UpdateMemoryInfo(); - } - -// --------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::CheckBatteryL() -// Checks if there's enough battery power to update -// --------------------------------------------------------------------------- -// -TBool CDevEncUiEncryptionOperator::CheckBatteryL() - { -#ifdef __WINS__ - - // In the emulator, the battery level is always 0 and the charger is never - // connected, so just return ETrue. - return ETrue; - -#else // __WINS__ - - // Running on target. Check the real battery and charger status - - TInt chargingstatus( EChargingStatusError ); - TInt batterylevel( 1 ); - TBool enoughPower( EFalse ); - - // Read battery - DFLOG( "CDevEncUiEncryptionOperator::CheckBatteryL" ); - RProperty pw; - User::LeaveIfError( pw.Attach( KPSUidHWRMPowerState, KHWRMBatteryLevel ) ); - User::LeaveIfError( pw.Get( batterylevel ) ); - pw.Close(); - - User::LeaveIfError( pw.Attach( KPSUidHWRMPowerState, KHWRMChargingStatus ) ); - User::LeaveIfError( pw.Get( chargingstatus )); - pw.Close(); - - // Too low battery, power insufficient - if ( batterylevel >= EBatteryLevelLevel4 ) - { - enoughPower = ETrue; - } - // But charger is connected, power sufficient - if ( ( chargingstatus != EChargingStatusError ) && - ( chargingstatus != EChargingStatusNotConnected ) ) - { - enoughPower = ETrue; - } - - DFLOG3( "Battery level: %d (0..7), chargingstatus %d", - batterylevel, chargingstatus ); - DFLOG2( "CheckBatteryL %d", ( enoughPower ? 1 : 0 ) ); - return enoughPower; - -#endif // __WINS__ - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::ErrorNoteL() -// -------------------------------------------------------------------------- -// -void CDevEncUiEncryptionOperator::ErrorNoteL( TInt aResourceId, - TBool aWaitingNote ) - { - HBufC* message = StringLoader::LoadLC( aResourceId ); - CAknErrorNote* errorNote = new ( ELeave ) CAknErrorNote( aWaitingNote ); - errorNote->ExecuteLD( *message ); - CleanupStack::PopAndDestroy( message ); - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::InfoNoteL() -// -------------------------------------------------------------------------- -// -void CDevEncUiEncryptionOperator::InfoNoteL( TInt aResourceId, - TBool aWaitingNote ) - { - HBufC* message = StringLoader::LoadLC( aResourceId ); - CAknInformationNote* note = new ( ELeave ) CAknInformationNote( aWaitingNote ); - note->ExecuteLD( *message ); - CleanupStack::PopAndDestroy( message ); - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::DestroyKeyQueryL() -// -// -------------------------------------------------------------------------- -void CDevEncUiEncryptionOperator::DestroyKeyQueryL( TBool aShowMmcNote ) - { - TBool destroy = QueryDialogL( R_DEVENCUI_TEXT_NOTE_DECRYPT_NOMEMRYCARD, R_AVKON_SOFTKEYS_YES_NO ); - if ( destroy ) - { - DestroyKeyL(); - if ( aShowMmcNote ) - { - InfoNoteL( R_DEVENCUI_TEXT_NOTE_MEMORYCARD_UNENCRYPTED ); - } - } - else - { - DFLOG( "User cancelled destroy key query" ); - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::DestroyKeyL() -// -// -------------------------------------------------------------------------- -void CDevEncUiEncryptionOperator::DestroyKeyL() - { - DFLOG( "CDevEncUiEncryptionOperator::DestroyKeyL" ); - CDevEncKeyUtils* utils = new ( ELeave ) CDevEncKeyUtils; - CleanupStack::PushL( utils ); -// User::LeaveIfError(utils->Connect()); - - TRequestStatus status; - utils->ResetKey( status ); - User::WaitForRequest( status ); -// utils->Close(); - CleanupStack::PopAndDestroy( utils ); - if ( status.Int() ) - { - DFLOG2( "DestroyKeyL error %d", status.Int() ); - } - else - { - DFLOG( "DestroyKeyL done" ); - // We no longer have a key in the driver. Update the user setting. - iCrSettings->Set( KDevEncUserSettingMemoryCard, 0 ); - } - User::LeaveIfError( status.Int() ); - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::SuggestMmcEncryptionL() -// -// -------------------------------------------------------------------------- -void CDevEncUiEncryptionOperator::SuggestMmcEncryptionL( - CDevEncUiMemoryEntity* aMem ) - { - TInt encrypt( 0 ); - - // Check DM admin status - TInt dmControlSetting( 0 ); - iCrSettings->Get( KDevEncUiDmControl, dmControlSetting ); - - if( dmControlSetting & KDmControlsMemoryCard ) - { - //The admin is controlling the encryption, encrypt straight away without questions - encrypt = ETrue; - } - else - { - encrypt = MessageQueryL( R_DEVENCUI_TEXT_NOTE_INSERTUNENCRYPTED, - R_AVKON_SOFTKEYS_YES_NO ); - } - - if ( encrypt ) - { - HandleMmcEncryptRequestL( aMem, - EDevEncUiCommandEncryptWithCurrentKey ); - } - else - { - DFLOG( "User selected not to encrypt the card" ); - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::SuggestMmcDecryptionL() -// -// -------------------------------------------------------------------------- -void CDevEncUiEncryptionOperator::SuggestMmcDecryptionL( CDevEncUiMemoryEntity* aMem ) - { - TBool decrypt = MessageQueryL( R_DEVENCUI_TEXT_NOTE_INSERTENCRYPTED, - R_AVKON_SOFTKEYS_YES_NO ); - if ( decrypt ) - { - SuggestMmcImportKeyL( aMem, ETrue ); - } - else - { - ErrorNoteL( R_DEVENCUI_TEXT_NOTE_INSERTOFF_UNUSEDMEMORYCARD ); - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::SuggestMmcImportKeyL() -// -// -------------------------------------------------------------------------- -void CDevEncUiEncryptionOperator::SuggestMmcImportKeyL( - CDevEncUiMemoryEntity* /*aMem*/, - TBool aFirstAttempt ) - { - DFLOG( "CDevEncUiEncryptionOperator::SuggestMmcImportKeyL" ); - TBool import( ETrue ); - if ( aFirstAttempt ) - { - DFLOG( "CDevEncUiEncryptionOperator::SuggestMmcImportKeyL => firstAttempt" ); - import = MessageQueryL( R_DEVENCUI_TEXT_NOTE_DECRYPT_LOADKEY, - R_AVKON_SOFTKEYS_YES_NO ); - } - - if ( import ) - { - TBool reloadKey = ETrue; - // Loop while user chooses correct key or cancels operation - while ( reloadKey ) - { - TBool keySet = LoadAndSetKeyL(); - if ( !keySet ) - { - ErrorNoteL( R_DEVENCUI_TEXT_NOTE_UNUSEDMEMORYCARD ); - reloadKey = EFalse; - } - else - { - // New key is in use, now we need to remount the mmc - RemountMmcL(); - - // Check that key is valid - TInt err = CheckMMCStatus(); - - if( err == KErrCorrupt ) - { - ErrorNoteL( R_DEVENCUI_TEXT_NOTE_WRONGKEYFILE ); - reloadKey = ETrue; - } - else - { - reloadKey = EFalse; - } - } - } - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::CheckMMCStatus() -// -// -------------------------------------------------------------------------- -TInt CDevEncUiEncryptionOperator::CheckMMCStatus() - { - TVolumeInfo volInfo; - RFs fs; - TInt err = fs.Connect(); - if (err == KErrNone) - { - fs.Volume( volInfo, EDriveF ); - fs.Close(); - } - return err; - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::RemountMmc() -// -// -------------------------------------------------------------------------- -void CDevEncUiEncryptionOperator::RemountMmcL() - { - CDevEncUiFileManager* fm = new ( ELeave ) CDevEncUiFileManager; - CleanupStack::PushL( fm ); - fm->ConstructL(); - TInt error = fm->RemountMmc(); - CleanupStack::PopAndDestroy( fm ); - if ( error ) - { - DFLOG2( "Mmc remount failed, error %d", error ); - User::Leave( error ); - } - else - { - DFLOG( "Mmc remounted" ); - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::ShowWrongKeyNoteL() -// -// -------------------------------------------------------------------------- -void CDevEncUiEncryptionOperator::ShowWrongKeyNoteL() - { - ErrorNoteL( R_DEVENCUI_TEXT_NOTE_INSERTON_UNUSEDMEMORYCARD ); - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::CheckNotesWithHeaderL() -// -// -------------------------------------------------------------------------- -void CDevEncUiEncryptionOperator::CheckNotesWithHeaderL() - { - MessageQueryL( R_DEVENCUI_TEXT_NOTE_DECRYPT_LOADKEY ); - MessageQueryL( R_DEVENCUI_TEXT_NOTE_DECRYPT_NOMEMRYCARD ); - MessageQueryL( R_DEVENCUI_TEXT_NOTE_DECRYPTING ); - MessageQueryL( R_DEVENCUI_TEXT_NOTE_DECRYPTINGDESTROY ); - MessageQueryL( R_DEVENCUI_TEXT_NOTE_ENCRYPTING ); - MessageQueryL( R_DEVENCUI_TEXT_NOTE_ENCRYPTIONINTERRUPT ); - MessageQueryL( R_DEVENCUI_TEXT_NOTE_INSERTENCRYPTED ); - MessageQueryL( R_DEVENCUI_TEXT_NOTE_INSERTOFF_UNUSEDMEMORYCARD ); - MessageQueryL( R_DEVENCUI_TEXT_NOTE_INSERTON_UNUSEDMEMORYCARD ); - MessageQueryL( R_DEVENCUI_TEXT_NOTE_INSERTUNENCRYPTED ); - MessageQueryL( R_DEVENCUI_TEXT_NOTE_LOCK ); - MessageQueryL( R_DEVENCUI_TEXT_NOTE_PHONE_DECRYPTING ); - } - -// -------------------------------------------------------------------------- -// CDevEncUiEncryptionOperator::CheckNotesL() -// -------------------------------------------------------------------------- -// -void CDevEncUiEncryptionOperator::CheckNotesL() - { - QueryDialogL( R_DEVENCUI_TEXT_NOTE_DECRYPT_LOADKEY ); - QueryDialogL( R_DEVENCUI_TEXT_NOTE_DECRYPT_NOMEMRYCARD ); - QueryDialogL( R_DEVENCUI_TEXT_NOTE_DECRYPTING ); - QueryDialogL( R_DEVENCUI_TEXT_NOTE_DECRYPTINGDESTROY ); - QueryDialogL( R_DEVENCUI_TEXT_NOTE_ENCRYPTING ); - QueryDialogL( R_DEVENCUI_TEXT_NOTE_ENCRYPTIONINTERRUPT ); - QueryDialogL( R_DEVENCUI_TEXT_NOTE_INSERTENCRYPTED ); - QueryDialogL( R_DEVENCUI_TEXT_NOTE_INSERTOFF_UNUSEDMEMORYCARD ); - QueryDialogL( R_DEVENCUI_TEXT_NOTE_INSERTON_UNUSEDMEMORYCARD ); - QueryDialogL( R_DEVENCUI_TEXT_NOTE_INSERTUNENCRYPTED ); - QueryDialogL( R_DEVENCUI_TEXT_NOTE_LOCK ); - QueryDialogL( R_DEVENCUI_TEXT_NOTE_PHONE_DECRYPTING ); - } - -// END OF FILE diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiFileManager.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiFileManager.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005 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 CDevEncUiFileManager. -* -*/ - -#include "DevEncLog.h" -#include "DevEncUids.hrh" -#include "DevEncUiFileManager.h" - -#include -#include -#include - -// -------------------------------------------------------------------------- -// CDevEncUiFileManager::CDevEncUiFileManager() -// -// -------------------------------------------------------------------------- -void CDevEncUiFileManager::ConstructL() - { - User::LeaveIfError( iFs.Connect() ); - } - -// -------------------------------------------------------------------------- -// CDevEncUiFileManager::CDevEncUiFileManager() -// -// -------------------------------------------------------------------------- -CDevEncUiFileManager::~CDevEncUiFileManager() - { - iFs.Close(); - } - -// -------------------------------------------------------------------------- -// CDevEncUiFileManager::SaveKeyL() -// -// -------------------------------------------------------------------------- -void CDevEncUiFileManager::SaveKeyL( CFileStore* aStore, - const TDesC8& aPkcs5Key ) const - { - RStoreWriteStream write; - - aStore->SetTypeL( aStore->Layout() ); - - //write the encryption key to a new stream - write.CreateLC( *aStore ); - write << aPkcs5Key; - write.CommitL(); - CleanupStack::PopAndDestroy(); //CreateLC() - - aStore->Commit(); - } - -// -------------------------------------------------------------------------- -// CDevEncUiFileManager::LoadKeyL() -// -// -------------------------------------------------------------------------- -void CDevEncUiFileManager::LoadKeyL( const TFileName& aFileName, - HBufC8*& aPkcs5Key ) - { - DFLOG2( "CDevEncUiFileManager::LoadKeyL Filename %S", &aFileName ); - //prepare to read the streams back in, creating a new TPBEncryptionData - RStoreReadStream read; - - // open the next PFS - CFileStore *store = CPermanentFileStore::OpenLC( iFs, - aFileName, - EFileRead ); - - DFLOG("CPermanentFileStore::OpenLC passed"); - - TStreamId dataStreamId( 1 ); // we know it was the first stream written - read.OpenLC( *store, dataStreamId ); - DFLOG("RStoreReadStream::OpenLC passed"); - //read in Encryption key - aPkcs5Key = HBufC8::NewL( read, KMaxTInt ); - DFLOG("HBufC8::NewL passed"); - CleanupStack::Pop(); // read - read.Close(); - CleanupStack::PopAndDestroy( store ); - } - -// -------------------------------------------------------------------------- -// CDevEncUiFileManager::OpenFileStore() -// -// -------------------------------------------------------------------------- -TInt CDevEncUiFileManager::OpenFileStore( const TDesC& aFilename, - CFileStore*& aStore ) - { - // Leaves with KErrAlreadyExists if file exists from before - TInt error( KErrNone ); - CFileStore* store( NULL ); - TRAP( error, store = CPermanentFileStore::CreateL( iFs, - aFilename, - EFileRead | EFileWrite ) ); - if ( !error ) - { - aStore = store; - } - return error; - } - -// -------------------------------------------------------------------------- -// CDevEncUiFileManager::GetKeyListL() -// -// -------------------------------------------------------------------------- -void CDevEncUiFileManager::GetKeyListL( CDir*& aList ) - { - // Construct file path - _LIT( KAsterisk, "*" ); - _LIT( KDevEncKeyFileExtension, ".pk5"); - - TBuf filePath; - User::LeaveIfError( KeyFolder( filePath ) ); - filePath.Append( KAsterisk ); - filePath.Append( KDevEncKeyFileExtension ); - - TInt error = iFs.GetDir( filePath, - KEntryAttNormal, // Any file, not hidden and system files - ESortByName, - aList ); - if ( error ) - { - DFLOG2( "Could not get dir listing, error %d", error ); - User::Leave( error ); - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiFileManager::DriveToChar() -// -// -------------------------------------------------------------------------- -TInt CDevEncUiFileManager::DriveToChar( TInt aDrive, TChar &aChar ) - { - return iFs.DriveToChar( aDrive, aChar ); - } - -// -------------------------------------------------------------------------- -// CDevEncUiFileManager::KeyFolder() -// -// -------------------------------------------------------------------------- -TInt CDevEncUiFileManager::KeyFolder( TDes& aResult ) - { - DFLOG("KeyFolder()"); - TInt result( KErrNone ); - if ( !result ) - { - DFLOG("1st Append"); - aResult.Append( PathInfo::PhoneMemoryRootPath() ); - DFLOG("2nd Append"); - aResult.Append( PathInfo::OthersPath() ); - } - DFLOG2( "CDevEncUiFileManager::KeyFolder %S", &aResult ); - return result; - } - -// -------------------------------------------------------------------------- -// CDevEncUiFileManager::RemountMmc() -// -// -------------------------------------------------------------------------- -TInt CDevEncUiFileManager::RemountMmc() - { - return iFs.RemountDrive( /*EDriveE*/EDriveF ); - } - -// End of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiLog.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiLog.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2005 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 CFileLog. -* -*/ - -#include "DevEncUiLog.h" -#include - -#if defined( _DEBUG ) && defined ( DEVENCUI_LOG ) - -_LIT( KDevEncUiLogDir, "DevEnc"); -_LIT( KDevEncUiLogFile, "DevEncUi.log"); - -void CFileLog::Printf( TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - RFileLogger::WriteFormat( KDevEncUiLogDir, - KDevEncUiLogFile, - EFileLoggingModeAppend, - aFmt, - list ); - } - -#endif - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiMainView.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiMainView.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,441 +0,0 @@ -/* -* Copyright (c) 2005 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 CDevEncUiMainView. -* -*/ - -// INCLUDES - -// Class include -#include "DevEncUiMainView.h" - -// System includes -#include -#include // CAknViewAppUi -#include -#include -#include -#include - -// User includes -#include "DevEncLog.h" -#include "DevEnc.hrh" -#include "DevEncUiEncryptionOperator.h" - -#include "DevEncUiMainViewContainer.h" -#include "DevEncUiMemoryEntity.h" - -// ================= MEMBER FUNCTIONS ======================= - -/** -* Destructor. Frees up memory for the iLabel. -*/ -CDevEncUiMainView::~CDevEncUiMainView() - { - for ( TInt i = 0; i < iMemEntities.Count(); i++ ) - { - iMemEntities[i]->RemoveObserver( iContainer ); - } - delete iContainer; - delete iEncOperator; - } - -/** -* Symbian OS 2 phase constructor. -* Constructs the CDevEncUiMainView using the NewLC method, popping -* the constructed object from the CleanupStack before returning it. -* -* @param aRect The rectangle for this window -* @return The newly constructed CDevEncUiMainView -*/ -CDevEncUiMainView* CDevEncUiMainView::NewL( - RArray& aMemEntities, - CRepository*& aCrSettings, - TInt& aMmcStatus ) - { - CDevEncUiMainView* self = CDevEncUiMainView::NewLC( aMemEntities, - aCrSettings, - aMmcStatus ); - CleanupStack::Pop( self ); - return self; - } - -/** -* Symbian OS 2 phase constructor. -* Constructs the CDevEncUiMainView using the constructor and ConstructL -* method, leaving the constructed object on the CleanupStack before returning it. -* -* @param aRect The rectangle for this window -* @return The newly constructed CDevEncUiMainView -*/ -CDevEncUiMainView* CDevEncUiMainView::NewLC( - RArray& aMemEntities, - CRepository*& aCrSettings, - TInt& aMmcStatus ) - { - CDevEncUiMainView* self = - new ( ELeave ) CDevEncUiMainView( aMemEntities, - aCrSettings, - aMmcStatus ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -CDevEncUiMainView::CDevEncUiMainView( RArray& aMemEntities, - CRepository*& aCrSettings, - TInt& aMmcStatus ) - : iMemEntities( aMemEntities ), - iCrSettings( aCrSettings ), - iMmcStatus( aMmcStatus ) - { - } - -/** -* Symbian OS 2nd phase constructor. -* Uses the superclass constructor to construct the view -*/ -void CDevEncUiMainView::ConstructL() - { - BaseConstructL( R_DEVENCUI_MAINVIEW ); - - iContainer = CDevEncUiMainViewContainer::NewL( AppUi()->ClientRect(), - iMemEntities, - *this, - iCrSettings, - iMmcStatus ); - iContainer->SetMopParent( this ); - - for ( TInt i = 0; i < iMemEntities.Count(); i++ ) - { - iMemEntities[i]->AddObserverL( iContainer ); - } - } - -/** -* Called by the framework -* @return The Uid for this view -*/ -TUid CDevEncUiMainView::Id() const - { - return TUid::Uid( EDevEncUiMainViewId ); - } - -/** -* Called by the framework when the view is activated. -* Adds the container to the control stack. -*/ -void CDevEncUiMainView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, - TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/) - { - AppUi()->AddToStackL( *this, iContainer ); - - if ( iEikonEnv->StartedAsServerApp() ) - { - CEikButtonGroupContainer* cba = Cba(); - cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); - } - } - -/** -* Called by the framework when the view is deactivated. -* Removes the container from the control stack. -*/ -void CDevEncUiMainView::DoDeactivate() - { - if ( iContainer ) - { - AppUi()->RemoveFromStack( iContainer ); - } - } - -/** -* From CEikAppUi, takes care of command handling for this view. -* -* @param aCommand command to be handled -*/ -void CDevEncUiMainView::HandleCommandL( TInt aCommand ) - { - - switch ( aCommand ) - { - case EDevEncUiCommandChange: - { - // Show the toggle popup - if ( iContainer->ChangeSelectedItemL() ) - { - // The user made a new selection - TDevEncUiMemoryType memoryType = - static_cast( iContainer->SelectedItem() ); - EncryptionStatusChangeReq( memoryType ); - } - break; - } - default: - { - AppUi()->HandleCommandL( aCommand ); - break; - } - } - } - -void CDevEncUiMainView::DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane* aMenuPane ) - { - if ( ! iContainer || - iMemEntities.Count() == 0 ) - { - return; - } - - // Disable the "Change" menu item if an encryption operation is ongoing - if ( aResourceId == R_DEVENCUI_MENU_MAIN ) - { - TBool proceed( ETrue ); - TInt dmControl( 0 ); - TInt err = iCrSettings->Get( KDevEncUiDmControl, dmControl ); - if ( err ) - { - DFLOG2( "Cenrep error %d", err ); - User::Leave( err ); - } - - // Check if phone memory encryption is controlled by dev management - if ( ( dmControl & KDmControlsPhoneMemory ) && - ( iContainer->SelectedItem() == EPhoneMemory ) ) - { - // Selected memory is controlled by DM -> disable "Change" - aMenuPane->SetItemDimmed( EDevEncUiCommandChange, ETrue ); - proceed = EFalse; - } - - // Check if memory card encryption is controlled by dev management - if ( ( dmControl & KDmControlsMemoryCard ) && - ( iContainer->SelectedItem() == EMemoryCard ) ) - { - // Selected memory is controlled by DM -> disable "Change" - aMenuPane->SetItemDimmed( EDevEncUiCommandChange, ETrue ); - proceed = EFalse; - } - - if ( !proceed ) - { - DFLOG( "Hiding Change, item is controlled by DM" ); - return; - } - - // Show the "Change" item if encryption status can be changed - TBool allowChange( EFalse ); - if ( ( iMemEntities[ EMemoryCard ]->State() == EUnmounted || - iMemEntities[ EMemoryCard ]->State() == EDecrypted || - iMemEntities[ EMemoryCard ]->State() == EEncrypted ) && - ( iMemEntities[ EPhoneMemory ]->State() == EDecrypted || - iMemEntities[ EPhoneMemory ]->State() == EEncrypted ) ) - { - allowChange = ETrue; - } - - if ( allowChange ) - { - aMenuPane->SetItemDimmed( EDevEncUiCommandChange, EFalse ); - } - else - { - aMenuPane->SetItemDimmed( EDevEncUiCommandChange, ETrue ); - } - } - } - - - -CDevEncUiAppUi& CDevEncUiMainView::GetAppUi() - { - CAknViewAppUi* aknViewAppUi = AppUi(); - CDevEncUiAppUi* appUi = reinterpret_cast( aknViewAppUi ); - return ( *appUi ); - } - -void CDevEncUiMainView::EncryptionStatusChangeReq( TDevEncUiMemoryType aType ) - { - // Can't do anything about errors here - TInt error( KErrNone ); - TRAP( error, DoEncryptionStatusChangeReqL( aType ) ); - if ( error ) - { - DFLOG2( "DoEncryptionStatusChangeReqL error %d", error ); - } - } - -// TBI: Async this function and create a subfunction with -L -void CDevEncUiMainView::DoEncryptionStatusChangeReqL( TDevEncUiMemoryType aType ) - { - DFLOG( "CDevEncUiMainView::DoEncryptionStatusChangeReqL" ); - - // Check if we are allowed to start an encryption operation - TInt dmControl( 0 ); - TInt err = iCrSettings->Get( KDevEncUiDmControl, dmControl ); - if ( err ) - { - DFLOG2( "Cenrep error %d", err ); - User::Leave( err ); - } - if ( DmControlsMemory( aType, dmControl ) ) - { - // Encryption controlled by admin - ErrorNoteL( R_DEVENCUI_NOTE_ADMIN_CONTROL ); - return; - } - - // Create the encryption operator if necessary - if ( ! iEncOperator ) - { - iEncOperator = CDevEncUiEncryptionOperator::NewL( *iEikonEnv, - *AppUi(), - iCrSettings ); - } - - // Get the currently highlighted memory type - CDevEncUiMemoryEntity* mem = iMemEntities[ aType ]; - - DFLOG3( "Mem type: %d, state: %d", aType, mem->State() ); - - if ( aType == EPhoneMemory ) - { - CDevEncUiMemoryEntity* phoneMemory = iMemEntities[ EPrimaryPhoneMemory]; - iEncOperator->HandlePhoneMemEncryptRequestL( mem, phoneMemory ); - } - else // aType = EMemoryCard - { - HandleMemoryCardEncryptRequestL( mem ); - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiMainView::ErrorNoteL() -// TBI: Create base class and move this there -// -------------------------------------------------------------------------- -// -void CDevEncUiMainView::ErrorNoteL( TInt aResourceId ) - { - HBufC* message = StringLoader::LoadLC( aResourceId ); - CAknErrorNote* errorNote = new ( ELeave ) CAknErrorNote; - errorNote->ExecuteLD( *message ); - CleanupStack::PopAndDestroy( message ); - } - -// TBI: Create base class and move this there -TBool CDevEncUiMainView::DmControlsMemory( TDevEncUiMemoryType aType, - TInt aDmControlSetting ) - { - TBool result( EFalse ); - if ( ( aType == EPhoneMemory ) && - ( aDmControlSetting & KDmControlsPhoneMemory ) ) - { - result = ETrue; - } - if ( ( aType == EMemoryCard ) && - ( aDmControlSetting & KDmControlsMemoryCard ) ) - { - result = ETrue; - } - return result; - } - -// -------------------------------------------------------------------------- -// CDevEncUiMainView::HandleMemoryCardEncryptRequestL() -// -------------------------------------------------------------------------- -// -void CDevEncUiMainView::HandleMemoryCardEncryptRequestL( CDevEncUiMemoryEntity* aMem ) - { - // Check if the driver has a known encryption key - TInt mmcEncrOn( 0 ); - iCrSettings->Get( KDevEncUserSettingMemoryCard, mmcEncrOn ); - - if ( aMem->State() == EDecrypted || - aMem->State() == EUnmounted ) - { - if ( mmcEncrOn ) - { - // Mmc decrypted or ejected but encryption is on -> - // suggest destruction of key - DFLOG( "Mmc decrypted, encryption key set -> destroy key?" ); - if ( aMem->State() == EDecrypted ) - { - // Mmc inserted -> indicate that it is decrypted - // (see UI spec 2.12) - iEncOperator->DestroyKeyQueryL( ETrue ); - } - else - { - // Mmc ejected -> no need to show note - // (see UI spec 2.11) - iEncOperator->DestroyKeyQueryL( EFalse ); - } - } - else - { - // Mmc decrypted and encryption is off -> show encryption menu - DFLOG( "Mmc decrypted, encryption key not set -> enc menu" ); - AppUi()->ActivateLocalViewL( TUid::Uid( EDevEncUiEncrViewId ) ); - } - } - else if ( aMem->State() == EEncrypted ) - { - // Encryption is on -> show decryption menu - DFLOG( "Mmc encrypted -> decr menu" ); - AppUi()->ActivateLocalViewL( TUid::Uid( EDevEncUiDecrViewId ) ); - } - else if ( aMem->State() == ECorrupted ) - { - if ( mmcEncrOn ) - { - // Mmc seems to be encrypted with another key. - // Ask if the user wants to import another key. - // (See UI spec 2.10) - DFLOG( "CDevEncUiMainView::HandleMemoryCardEncryptRequestL => Mmc encrypted with another key, enc on -> import key" ); - iEncOperator->SuggestMmcImportKeyL( aMem, ETrue ); - } - else - { - // Mmc is probably encrypted with another key -> show encryption - // menu to let user choose a key - DFLOG( "Mmc encrypted, encryption key not set -> enc menu" ); - AppUi()->ActivateLocalViewL( TUid::Uid( EDevEncUiEncrViewId ) ); - } - } - else - { - DFLOG2( "Mmc busy, state = %d, no action", aMem->State() ); - } - // Depending on the user's selection, the memory may be in the same - // state as before or in a new state. This call will let all observers - // know what state the memory ended up in. - aMem->UpdateMemoryInfo(); - - } - -// -------------------------------------------------------------------------- -// Called by the framework when the application status pane -// size is changed. Passes the new client rectangle to the container. -// -------------------------------------------------------------------------- -void CDevEncUiMainView::HandleStatusPaneSizeChange() - { - if ( iContainer ) - { - iContainer->SetRect( ClientRect() ); - } - } - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiMainViewContainer.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiMainViewContainer.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,564 +0,0 @@ -/* -* Copyright (c) 2005 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 CDevEncUiMainViewContainer. -* -*/ - - -// INCLUDE FILES - -// Class includes -#include "DevEncUiMainViewContainer.h" - -//System includes -#include -#include -#include -#include -#include -#include - -//User includes -#include "DevEncLog.h" -#include "DevEncUi.pan" -#include "DevEncUiAppui.h" -#include "DevEncUiDocument.h" -#include "DevEncUiMainView.h" -#include "DevEncUiSettingItemList.h" -#include "DevEncUiMemoryEntity.h" - -// Local definitions -const TInt KPercent100( 100 ); - -// ================= MEMBER FUNCTIONS ======================= - -// -------------------------------------------------------------------------- -// CDevEncUiMainViewContainer::NewLC() -// -------------------------------------------------------------------------- -// -CDevEncUiMainViewContainer* CDevEncUiMainViewContainer::NewLC( - const TRect& aRect, - RArray& aMemEntities, - MContainerEventCallback& aCallback, - CRepository*& aCrSettings, - TInt& aMmcStatus ) - { - CDevEncUiMainViewContainer* self = - new ( ELeave ) CDevEncUiMainViewContainer( aMemEntities, - aCallback, - aCrSettings, - aMmcStatus ); - - CleanupStack::PushL( self ); - self->ConstructL(aRect); - return self; - } - -// -------------------------------------------------------------------------- -// CDevEncUiMainViewContainer::NewL() -// -------------------------------------------------------------------------- -// -CDevEncUiMainViewContainer* CDevEncUiMainViewContainer::NewL( - const TRect& aRect, - RArray& aMemEntities, - MContainerEventCallback& aCallback, - CRepository*& aCrSettings, - TInt& aMmcStatus ) - { - CDevEncUiMainViewContainer* self = NewLC( aRect, - aMemEntities, - aCallback, - aCrSettings, - aMmcStatus ); - CleanupStack::Pop( self ); - return self; - } - - -// -------------------------------------------------------------------------- -// CDevEncUiMainViewContainer::ConstructL() -// -------------------------------------------------------------------------- -// -void CDevEncUiMainViewContainer::ConstructL(const TRect& aRect) - { - // Create a window for this application view - CreateWindowL(); - // TBD: Give the list some settings - iSettingItemList = new ( ELeave ) CDevEncUiSettingItemList(); - iSettingItemList->SetMopParent( this ); - iSettingItemList->ConstructFromResourceL( R_DEVENCUI_SETTING_ITEM_LIST ); - SetRect( aRect ); - ActivateL(); - } - - -// -------------------------------------------------------------------------- -// CDevEncUiMainViewContainer::CDevEncUiMainViewContainer() -// -------------------------------------------------------------------------- -// -CDevEncUiMainViewContainer::CDevEncUiMainViewContainer( - RArray& aMemEntities, - MContainerEventCallback& aCallback, - CRepository*& aCrSettings, - TInt& aMmcStatus ) - : iMemEntities( aMemEntities ), - iCallback( aCallback ), - iCrSettings( aCrSettings ), - iMmcStatus( aMmcStatus ) - { - // No implementation required - } - -// -------------------------------------------------------------------------- -// CDevEncUiMainViewContainer::CDevEncUiMainViewContainer() -// -------------------------------------------------------------------------- -// -CDevEncUiMainViewContainer::~CDevEncUiMainViewContainer() - { - delete iSettingItemList; - } - -// -------------------------------------------------------------------------- -// CDevEncUiMainViewContainer::CountComponentControls() -// -------------------------------------------------------------------------- -// -TInt CDevEncUiMainViewContainer::CountComponentControls() const - { - return 1; - } - -// -------------------------------------------------------------------------- -// CDevEncUiMainViewContainer::ComponentControl() -// -------------------------------------------------------------------------- -// -CCoeControl* CDevEncUiMainViewContainer::ComponentControl( TInt aIndex ) const - { - CCoeControl* returnedItem( NULL ); - switch (aIndex) - { - case 0: - returnedItem = iSettingItemList; - break; - default: - break; - } - return returnedItem; - } - -// -------------------------------------------------------------------------- -// CDevEncUiMainViewContainer::SizeChanged() -// -------------------------------------------------------------------------- -// -void CDevEncUiMainViewContainer::SizeChanged() - { - if ( iSettingItemList ) - { - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, - mainPaneRect ); - iSettingItemList->SetRect( mainPaneRect ); - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiMainViewContainer::HandleResourceChange() -// -------------------------------------------------------------------------- -// -void CDevEncUiMainViewContainer::HandleResourceChange( TInt aType ) - { - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - if ( iSettingItemList ) - { - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, - mainPaneRect ); - iSettingItemList->SetRect( mainPaneRect ); - iSettingItemList->HandleResourceChange( aType ); - } - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiMainViewContainer::OfferKeyEventL() -// -------------------------------------------------------------------------- -// -TKeyResponse CDevEncUiMainViewContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - if ( aKeyEvent.iCode == EKeyDevice3 /* OK key */ || - aKeyEvent.iCode == EKeyEnter /* Enter key*/ ) - { - // User selected a list item. Proceed to toggle the status - TInt selectedItem = iSettingItemList->SelectedItem(); - if ( selectedItem < 0 ) - { - return EKeyWasConsumed; - } - TDevEncUiMemoryType type = static_cast( selectedItem ); - iCallback.EncryptionStatusChangeReq( type ); - return EKeyWasConsumed; - } - else - { - if ( iSettingItemList ) - return iSettingItemList->OfferKeyEventL( aKeyEvent, aType ); - else - return EKeyWasNotConsumed; - } - } - - // -------------------------------------------------------------------------- - // CDevEncUiMainViewContainer::SelectedItem() - // -------------------------------------------------------------------------- - // -TInt CDevEncUiMainViewContainer::SelectedItem() - { - if ( !iSettingItemList ) - { - return -1; - } - return iSettingItemList->SelectedItem(); - } - -// -------------------------------------------------------------------------- -// CDevEncUiMainViewContainer::ChangeSelectedItemL() -// -------------------------------------------------------------------------- -// -TBool CDevEncUiMainViewContainer::ChangeSelectedItemL() - { - TBool itemChanged( EFalse ); - if ( !iSettingItemList ) - { - return itemChanged; - } - // Get index of currently selected item - TInt selectedItem = iSettingItemList->SelectedItem(); - if ( selectedItem < 0 ) - { - User::Leave( KErrNotFound ); - } - - // Fetch the current setting for later comparison - TBool currentSetting( EFalse ); - iSettingItemList->ItemState( selectedItem, currentSetting ); - - // Let the user change the value (synchronously during this call) - iSettingItemList->ChangeSelectedItemL(); - - // Compare the new setting for changes - TBool newSetting( EFalse ); - iSettingItemList->ItemState( selectedItem, newSetting ); - - // Notify our callback observer if the setting was changed. This always - // eventually results in a call to UpdateInfo, which means that if the - // user decides to interrupt the operation, the values in the setting - // item list are updated accordingly. - if ( newSetting != currentSetting ) - { - itemChanged = ETrue; - } - return itemChanged; - } - -// -------------------------------------------------------------------------- -// CDevEncUiMainViewContainer::UpdateInfo() -// -------------------------------------------------------------------------- -// -void CDevEncUiMainViewContainer::UpdateInfo( TDevEncUiMemoryType aType, - TUint aState, - TUint aProgress /* = 0*/ ) - { - DFLOG( ">>CDevEncUiMainViewContainer::UpdateInfoL" ); - TInt err( KErrNone ); - TRAP( err, DoUpdateInfoL( aType, aState, aProgress ) ); - if ( err ) - { - DFLOG2( "CDevEncUiMainViewContainer::UpdateInfoL => error is %d", err ); - // TBI: Log the error - } - DFLOG( "<>CDevEncUiMainViewContainer::DoUpdateInfoL" ); - DFLOG2( "CDevEncUiMainViewContainer::DoUpdateInfoL, type %d", aType ); - DFLOG3( "New state %d, new progress %d", aState, aProgress ); - - if ( aType > EPrimaryPhoneMemory ) - { - // Unknown memory type - User::Leave( KErrUnknown ); - } - if ( aState > ECorrupted ) - { - // Unknown state - User::Leave( KErrCorrupt ); - } - if ( aProgress > KPercent100 ) - { - // Invalid progress value - User::Leave( KErrOverflow ); - } - - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL => Passed first area of error "); - - HBufC* stateText( NULL ); - - switch ( aState ) - { - case EDecrypted: - { - if ( ( aType == EMemoryCard ) && ( iMmcStatus == EMmcOk ) ) - { - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL => Memory card OK "); - // The Mmc is readable and decrypted, but there may be a key - // in the driver. In that case, we need to show "On" even - // though the card itself is not encrypted. - TBool mmcEncKeyInDriver( EFalse ); - User::LeaveIfError( - iCrSettings->Get( KDevEncUserSettingMemoryCard, - mmcEncKeyInDriver ) ); - if ( mmcEncKeyInDriver ) - { - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL => MMCKey in driver "); - // "On" - stateText = StringLoader::LoadLC( - R_DEVENCUI_TEXT_ENCRYPTION_ON, - iEikonEnv ); - // Update the On/Off popup settings - iSettingItemList->SetItemStateL( aType, ETrue ); - } - else - { - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL => MMCKey NOT in driver "); - // "Off" - stateText = StringLoader::LoadLC( - R_DEVENCUI_TEXT_ENCRYPTION_OFF, - iEikonEnv ); - // Update the On/Off popup settings - iSettingItemList->SetItemStateL( aType, EFalse ); - } - } - else if (aType == EMemoryCard) - { - stateText = StringLoader::LoadLC( R_DEVENCUI_TEXT_ENCRYPTION_OFF, iEikonEnv ); - iSettingItemList->SetItemStateL( aType, EFalse ); - } - else - { - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL => Phone Memory or Mass Storage "); - if (aType == EPhoneMemory) // Mass Storage - { - if ( iMemEntities.Count() > EPrimaryPhoneMemory ) - { - TUint phoneMemState = iMemEntities[EPrimaryPhoneMemory]->State(); - DFLOG2( "CDevEncUiMainViewContainer::DoUpdateInfoL, Now Mass Storage, need Phone Memory State: %d", phoneMemState); - if (phoneMemState == ECorrupted) - { - stateText = StringLoader::LoadLC(R_DEVENCUI_TEXT_CORRUPTED, iEikonEnv); - } - else - { - stateText = StringLoader::LoadLC(R_DEVENCUI_TEXT_ENCRYPTION_OFF, iEikonEnv); - } - } - else - { - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL, Now Mass Storage, no Phone Memory"); - stateText = StringLoader::LoadLC(R_DEVENCUI_TEXT_ENCRYPTION_OFF, iEikonEnv); - } - } - else // aType == EPrimaryPhoneMemory, means Phone Memory - { - if ( iMemEntities.Count() > EPhoneMemory ) - { - TUint massStoreState = iMemEntities[EPhoneMemory]->State(); - DFLOG2( "CDevEncUiMainViewContainer::DoUpdateInfoL, Now Phone Memory, need Mass Storage State: %d", massStoreState); - if (massStoreState == ECorrupted) - { - stateText = StringLoader::LoadLC(R_DEVENCUI_TEXT_CORRUPTED, iEikonEnv); - } - else - { - stateText = StringLoader::LoadLC(R_DEVENCUI_TEXT_ENCRYPTION_OFF, iEikonEnv); - } - } - else - { - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL, Now Phone Memory, no Mass Storage"); - stateText = StringLoader::LoadLC(R_DEVENCUI_TEXT_ENCRYPTION_OFF, iEikonEnv); - } - } - - // Update the On/Off popup settings - iSettingItemList->SetItemStateL( EPhoneMemory, EFalse ); - } - break; - } - case EEncrypting: - { - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL => EEncrypting "); - stateText = StringLoader::LoadLC( - R_DEVENCUI_TEXT_ENCRYPT_PROCESS, - //R_DEVENCUI_TEXT_DECRYPT, - aProgress, - iEikonEnv ); - break; - } - case EEncrypted: - { - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL => Phone Memory or Mass Storage "); - if (aType == EPhoneMemory) // Mass Storage - { - if ( iMemEntities.Count() > EPrimaryPhoneMemory ) - { - TUint phoneMemState = iMemEntities[EPrimaryPhoneMemory]->State(); - DFLOG2( "CDevEncUiMainViewContainer::DoUpdateInfoL, Now Mass Storage, need Phone Memory State: %d", phoneMemState); - if (phoneMemState == ECorrupted) - { - stateText = StringLoader::LoadLC(R_DEVENCUI_TEXT_CORRUPTED, iEikonEnv); - } - else if (phoneMemState == EDecrypted) - { - stateText = StringLoader::LoadLC(R_DEVENCUI_TEXT_ENCRYPTION_OFF, iEikonEnv); - } - else - { - stateText = StringLoader::LoadLC(R_DEVENCUI_TEXT_ENCRYPTION_ON, iEikonEnv); - } - } - else - { - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL, Now Mass Storage, no Phone Memory"); - stateText = StringLoader::LoadLC(R_DEVENCUI_TEXT_ENCRYPTION_ON, iEikonEnv); - } - } - else if (aType == EPrimaryPhoneMemory)// Phone Memory - { - if ( iMemEntities.Count() > EPhoneMemory ) - { - TUint massStoreState = iMemEntities[EPhoneMemory]->State(); - DFLOG2( "CDevEncUiMainViewContainer::DoUpdateInfoL, Now Phone Memory, need Mass Storage State: %d", massStoreState); - if (massStoreState == ECorrupted) - { - stateText = StringLoader::LoadLC(R_DEVENCUI_TEXT_CORRUPTED, iEikonEnv); - } - else if (massStoreState == EDecrypted) - { - stateText = StringLoader::LoadLC(R_DEVENCUI_TEXT_ENCRYPTION_OFF, iEikonEnv); - } - else - { - stateText = StringLoader::LoadLC(R_DEVENCUI_TEXT_ENCRYPTION_ON, iEikonEnv); - } - } - else - { - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL, Now Phone Memory, no Mass Storage"); - stateText = StringLoader::LoadLC(R_DEVENCUI_TEXT_ENCRYPTION_ON, iEikonEnv); - } - } - else // Memory Card - { - stateText = StringLoader::LoadLC(R_DEVENCUI_TEXT_ENCRYPTION_ON, iEikonEnv); - } - // Update the On/Off popup settings - if ( aType != EPrimaryPhoneMemory ) - { - iSettingItemList->SetItemStateL( aType, ETrue ); - } - else - { - iSettingItemList->SetItemStateL( EPhoneMemory, ETrue ); - } - break; - } - case EDecrypting: - { - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL => EDecrypting "); - stateText = StringLoader::LoadLC( - R_DEVENCUI_TEXT_DECRYPT_PROCESS, - aProgress, - iEikonEnv ); - break; - } - case ECorrupted: // fall through - case EUnmounted: - default: - { - if ( aType == EMemoryCard ) - { - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL => MMC Corrupted "); - // Mmc is a) not inserted, b) corrupted or c) encrypted with - // another key. Check the user setting, and show "On" if any - // key is in the driver. - TBool mmcEncKeyInDriver( EFalse ); - User::LeaveIfError( - iCrSettings->Get( KDevEncUserSettingMemoryCard, - mmcEncKeyInDriver ) ); - if ( mmcEncKeyInDriver ) - { - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL => MMC On "); - // "On" - stateText = StringLoader::LoadLC( - R_DEVENCUI_TEXT_ENCRYPTION_ON, - iEikonEnv ); - // Update the On/Off popup settings - iSettingItemList->SetItemStateL( aType, ETrue ); - } - else - { - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL => MMC Off "); - // "Off" - stateText = StringLoader::LoadLC( - R_DEVENCUI_TEXT_ENCRYPTION_OFF, - iEikonEnv ); - // Update the On/Off popup settings - iSettingItemList->SetItemStateL( aType, EFalse ); - } - } - else - { - DFLOG( "CDevEncUiMainViewContainer::DoUpdateInfoL => NON OF THE PREVIOUS"); - stateText = StringLoader::LoadLC( - R_DEVENCUI_TEXT_CORRUPTED, - iEikonEnv ); - } - break; - } - } // End of switch - - if (aType != EPrimaryPhoneMemory) - { - iSettingItemList->SetItemTextL( aType, *stateText ); - } - else - { - iSettingItemList->SetItemTextL( EPhoneMemory, *stateText ); - } - CleanupStack::PopAndDestroy( stateText ); - - DFLOG( ">>CDevEncUiMainViewContainer::DoUpdateInfoL" ); - } - - -//End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiMemoryEntity.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiMemoryEntity.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,535 +0,0 @@ -/* -* Copyright (c) 2005 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 CDevEncUiMemoryEntity. -* -*/ - -#include "DevEncLog.h" -#include "DevEncUiMemoryEntity.h" -#include "DevEncUiMemInfoObserver.h" - -#include "DevEncDiskUtils.h" -#include "DevEncSession.h" -#include // for TDriveNumer -#include -#include - -// Local definitions -const TInt KPercent100( 100 ); -const TTimeIntervalMicroSeconds32 KProgressInterval( 500000 ); // ms, 0.5 seconds -const TTimeIntervalMicroSeconds32 KPollInterval( 2000000 ); // ms, 2 seconds - -// -------------------------------------------------------------------------- -// CDevEncUiMemoryEntity::CDevEncUiMemoryEntity() -// -// -------------------------------------------------------------------------- -CDevEncUiMemoryEntity::CDevEncUiMemoryEntity( - CEikonEnv* aEikonEnv, - TDevEncUiMemoryType aType ) - : iEikEnv( aEikonEnv ), - iType( aType ) - { - // TBI: Get the real states from the underlying SW levels - iState = EDecrypted; - } - - -// -------------------------------------------------------------------------- -// CDevEncUiMemoryEntity::~CDevEncUiMemoryEntity() -// -// -------------------------------------------------------------------------- -CDevEncUiMemoryEntity::~CDevEncUiMemoryEntity() - { - if ( iPeriodic ) - { - iPeriodic->Cancel(); - delete iPeriodic; - } - iObservers.Close(); - if ( iSession ) - { - iSession->Close(); - delete iSession; - } - delete iDiskStatusObserver; - } - -// -------------------------------------------------------------------------- -// CDevEncUiMemoryEntity::NewL() -// -// -------------------------------------------------------------------------- -CDevEncUiMemoryEntity* CDevEncUiMemoryEntity::NewL( - CEikonEnv* aEikonEnv, - TDevEncUiMemoryType aType ) - { - CDevEncUiMemoryEntity* self = - CDevEncUiMemoryEntity::NewLC( aEikonEnv, aType ); - CleanupStack::Pop( self ); - return self; - } - -// -------------------------------------------------------------------------- -// CDevEncUiMemoryEntity::NewLC() -// -// -------------------------------------------------------------------------- -CDevEncUiMemoryEntity* CDevEncUiMemoryEntity::NewLC( - CEikonEnv* aEikonEnv, - TDevEncUiMemoryType aType ) - { - CDevEncUiMemoryEntity* self = - new ( ELeave ) CDevEncUiMemoryEntity( aEikonEnv, aType ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// -------------------------------------------------------------------------- -// CDevEncUiMemoryEntity::ConstructL() -// -// -------------------------------------------------------------------------- -void CDevEncUiMemoryEntity::ConstructL() - { - DFLOG2( ">>CDevEncUiMemoryEntity::ConstructL, drive = %d", iType ); - - switch( iType ) - { - case EPhoneMemory: iSession = new ( ELeave ) CDevEncSession( /*EDriveC*/EDriveE ); - iDiskStatusObserver = CDiskStatusObserver::NewL( this, /*EDriveC*/EDriveE ); - break; - - case EPrimaryPhoneMemory: iSession = new ( ELeave ) CDevEncSession( EDriveC ); - iDiskStatusObserver = CDiskStatusObserver::NewL( this, EDriveC ); - break; - - case EMemoryCard: iSession = new ( ELeave ) CDevEncSession( /*EDriveE*/EDriveF ); - iDiskStatusObserver = CDiskStatusObserver::NewL( this, /*EDriveE*/EDriveF ); - break; - } - - // Get initial memory state - TInt nfeDiskStatus( EUnmounted ); -#ifndef __WINS__ - User::LeaveIfError( iSession->Connect() ); - TInt err = iSession->DiskStatus( nfeDiskStatus ); - if ( err ) - { - DFLOG2( "Could not get disk status, error %d", err ); - nfeDiskStatus = EDecrypted; - //User::Leave( err ); - } -#else - nfeDiskStatus = EDecrypted; -#endif - SetState( nfeDiskStatus ); - - if ( ( iState == EEncrypting ) || - ( iState == EDecrypting ) ) - { - // If the app was started in the middle of an ongoing operation, - // start polling the progress - StartPolling( KProgressInterval ); - } - else - { - // Otherwise poll every once in a while to see if the status changes - //StartPolling( KPollInterval ); - } - - DFLOG( "<>CDevEncUiMemoryEntity::StartEncryptionL" ); - -#ifndef __WINS__ - - if ( ! iSession->Connected() ) - { - User::LeaveIfError( iSession->Connect() ); - DFLOG( "Connected" ); - } - - // Make sure the memory is decrypted - TInt nfeDiskStatus( EUnmounted ); - TInt err = iSession->DiskStatus( nfeDiskStatus ); - if ( err ) - { - DFLOG2( "Could not get disk status, error %d", err ); - User::Leave( err ); - } - if ( nfeDiskStatus != EDecrypted ) - { - DFLOG2( "Memory is in wrong state (%d), leaving", nfeDiskStatus ); - User::Leave( KErrNotReady ); - } - - // Launch the encryption process - err = iSession->StartDiskEncrypt(); - if ( err ) - { - DFLOG2( "Could not start encryption, error %d", err ); - User::Leave( err ); - } - - // Set our internal state and update UI - iPercentDone = 0; - SetState( EEncrypting ); - - // Start a timer to periodically update the memory state in the UI - StartPolling( KProgressInterval ); - -#endif // __WINS__ - - DFLOG( "<( this ) ); - TCallBack progressCallBack( ProgressTick, static_cast( this ) ); - - if ( !iPeriodic ) - { - iPeriodic = CPeriodic::NewL( EPriorityNormal ); - } - iPeriodic->Cancel(); - - if ( aInterval == KProgressInterval ) - { - iPeriodic->Start( 0, aInterval, progressCallBack ); - } - else - { - iPeriodic->Start( 0, aInterval, pollCallBack ); - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiMemoryEntity::StartDecryptionL() -// -// -------------------------------------------------------------------------- -void CDevEncUiMemoryEntity::StartDecryptionL() - { - DFLOG( ">>CDevEncUiMemoryEntity::StartDecryptionL" ); - -#ifndef __WINS__ - - if ( ! iSession->Connected() ) - { - User::LeaveIfError( iSession->Connect() ); - DFLOG( "Connected " ); - } - - // Make sure the memory is encrypted - TInt nfeDiskStatus( EUnmounted ); - TInt err = iSession->DiskStatus( nfeDiskStatus ); - if ( err ) - { - DFLOG2( "Could not get disk status, error %d", err ); - //User::Leave( err ); - } - if ( nfeDiskStatus != EEncrypted ) - { - DFLOG2( "Memory is in wrong state (%d), leaving", nfeDiskStatus ); - User::Leave( KErrNotReady ); - } - - // Launch the decryption process - err = iSession->StartDiskDecrypt(); - if ( err ) - { - DFLOG2( "Could not start decryption, error %d", err ); - User::Leave( err ); - } - - // Set our internal state and update UI - iPercentDone = 0; - SetState( EDecrypting ); - - // Start a timer to periodically update the memory state in the UI - StartPolling( KProgressInterval ); - -#endif // __WINS__ - - DFLOG( "<( aPtr ); - self->DoProgressTick(); - return 0; - } - -// -------------------------------------------------------------------------- -// CDevEncUiMemoryEntity::DoProgressTick() -// -// -------------------------------------------------------------------------- -void CDevEncUiMemoryEntity::DoProgressTick() - { - CheckProgress(); - } - -// -------------------------------------------------------------------------- -// CDevEncUiMemoryEntity::PollTick() -// -// -------------------------------------------------------------------------- -TInt CDevEncUiMemoryEntity::PollTick( TAny* aPtr ) - { - CDevEncUiMemoryEntity* self = static_cast( aPtr ); - TInt error( KErrNone ); - TRAP( error, self->DoPollTickL() ); - DFLOG2( "CDevEncUiMemoryEntity::PollTick result %d", error ); - return 0; - } - -// -------------------------------------------------------------------------- -// CDevEncUiMemoryEntity::DoPollTickL() -// -// -------------------------------------------------------------------------- -void CDevEncUiMemoryEntity::DoPollTickL() - { - DFLOG( "CDevEncUiMemoryEntity::DoPollTickL" ); - TInt nfeDiskStatus( EUnmounted ); - TInt err = iSession->DiskStatus( nfeDiskStatus ); - if ( err ) - { - DFLOG2( "Could not get disk status, error %d", err ); - // Ignore error - return; - } - if ( ( nfeDiskStatus == EEncrypting ) || - ( nfeDiskStatus == EDecrypting ) ) - { - // Some other component has started an encryption operation. - // Indicate this to the UI and start polling the progress. - DFLOG2( "CDevEncUiMemoryEntity::DoPollTick: New operation %d", - nfeDiskStatus ); - SetState( nfeDiskStatus ); - StartPolling( KProgressInterval ); - } - else - { - if ( iState != nfeDiskStatus ) - { - DFLOG( "CDevEncUiMemoryEntity::DoPollTickL => SetState" ); - // The Mmc status has changed, but we are not in the middle of - // any operation. Just set the new state. - SetState( nfeDiskStatus ); - } - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiMemoryEntity::SetState() -// -// -------------------------------------------------------------------------- -void CDevEncUiMemoryEntity::SetState( TUint aState ) - { - DFLOG3( "CDevEncUiMemoryEntity::SetState, prev %d, new %d", - iState, aState ); - iState = aState; - UpdateMemoryInfo(); - } - -// -------------------------------------------------------------------------- -// CDevEncUiMemoryEntity::CheckProgress() -// -// -------------------------------------------------------------------------- -void CDevEncUiMemoryEntity::CheckProgress() - { - ASSERT( iSession ); - ASSERT( iSession->Connected() ); - - TInt err = iSession->Progress( iPercentDone ); - - if ( err ) - { - DFLOG( "Could not get progress" ); - iPeriodic->Cancel(); - } - else if ( iPercentDone >= KPercent100 ) - { - DFLOG( "Operation complete" ); - iPeriodic->Cancel(); - iPercentDone = 0; - - // The disk needs to be finalized, but the finalization is done in - // the starter component. - - DFLOG2( "CDevEncUiMemoryEntity::CheckProgress => iSession->DriveNumber() = %d", iSession->DriveNumber() ); - - if ( iState == EDecrypted && iSession->DriveNumber() == EDriveC ) - { - DFLOG( "CDevEncUiMemoryEntity::CheckProgress => RestoreAutolockSettings" ); - RestoreAutolockSettings(); - } - // Restart the polling at a slower pace - // StartPolling( KPollInterval ); - } - else // Not yet finished... - { - UpdateMemoryInfo(); - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiMemoryEntity::RestoreAutolockSettings() -// -// -------------------------------------------------------------------------- -void CDevEncUiMemoryEntity::RestoreAutolockSettings() - { -#ifndef __WINS__ - //the user chose to decrypt the phone memory. restore the previuos autolock settings - RTerminalControl terminalCtrl; - TInt ctrlConnect = terminalCtrl.Connect(); - DFLOG2( "DEVENC: terminal control connected %d", ctrlConnect ); - - RTerminalControl3rdPartySession session; - TInt retValue = session.Open( terminalCtrl ); - DFLOG2( "DEVENC: terminal control session open %d", retValue ); - - //read the current autolock period - TBuf8<21> autoLockPeriodBuf; - TInt err2 = session.GetDeviceLockParameter( RTerminalControl3rdPartySession::ETimeout, autoLockPeriodBuf ); - DFLOG2( "DEVENC: max value get returned value %d", err2 ); - - //this is set to 0 because the Tarm control prevent the autolock from being disabled otherwise. - TBuf8<21> oldMaxPeriodBuf; - oldMaxPeriodBuf.AppendNum( 0 ); - TInt err = session.SetDeviceLockParameter( RTerminalControl3rdPartySession::EMaxTimeout, oldMaxPeriodBuf ); - DFLOG2( "DEVENC: max value set returned value %d", err ); - - //set the autolock period as it was previously - err = session.SetDeviceLockParameter( RTerminalControl3rdPartySession::ETimeout, autoLockPeriodBuf ); - DFLOG2( "DEVENC: max value set returned value %d", err ); - - session.Close(); - terminalCtrl.Close(); -#endif - } - -// -------------------------------------------------------------------------- -// CDevEncUiMemoryEntity::UpdateMemoryInfo() -// -// -------------------------------------------------------------------------- -void CDevEncUiMemoryEntity::UpdateMemoryInfo() - { - DFLOG( "CDevEncUiMemoryEntity::UpdateMemoryInfo" ); - for ( TInt i = 0; i < iObservers.Count(); i++ ) - { - iObservers[i]->UpdateInfo( iType, iState, iPercentDone ); - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiMemoryEntity::State() -// -// -------------------------------------------------------------------------- -TUint CDevEncUiMemoryEntity::State() const - { - return iState; - } - -// -------------------------------------------------------------------------- -// CDevEncUiMemoryEntity::DiskStatusChangedL() -// From MDiskStatusObserver -// -------------------------------------------------------------------------- -void CDevEncUiMemoryEntity::DiskStatusChangedL( TInt aNfeStatus ) - { - if ( ( aNfeStatus == EEncrypting ) || - ( aNfeStatus == EDecrypting ) ) - { - // Some other component has started an encryption operation. - // Indicate this to the UI and start polling the progress. - DFLOG2( "CDevEncStarterMemoryEntity::DoPollTick: New operation %d", - aNfeStatus ); - SetState( aNfeStatus ); - StartPolling( KProgressInterval ); - } - else - { - if ( iState != aNfeStatus ) - { - // The Mmc status has changed, but we are not in the middle of - // any operation. Just set the new state. - SetState( aNfeStatus ); - } - } - } - -// End of File - - - diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiSecretMinMaxCodeQuery.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiSecretMinMaxCodeQuery.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* -* Copyright (c) 2005 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 -#include -#include -#include - -#include "DevEncLog.h" -#include "DevEnc.hrh" -#include "DevEncUiSecretMinMaxCodeQuery.h" - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------------- -// CCodeQueryDialog::CCodeQueryDialog() -// C++ constructor -// ---------------------------------------------------------- -// -CDevEncUiSecretMinMaxCodeQuery::CDevEncUiSecretMinMaxCodeQuery( - TDes& aDataText, - TInt aMinLength, - TInt aMaxLength ) - : CAknTextQueryDialog( aDataText, ENoTone ), - iMinLength( aMinLength ), - iMaxLength( aMaxLength ) - { - } -// -// ---------------------------------------------------------- -// CDevEncUiSecretMinMaxCodeQuery::~CodeQueryDialog() -// Destructor -// ---------------------------------------------------------- -// -CDevEncUiSecretMinMaxCodeQuery::~CDevEncUiSecretMinMaxCodeQuery() - { - } -// -// ---------------------------------------------------------- -// CDevEncUiSecretMinMaxCodeQuery::PreLayoutDynInitL() -// Called by framework before dialog is shown -// ---------------------------------------------------------- -// -void CDevEncUiSecretMinMaxCodeQuery::PreLayoutDynInitL() - { - CAknTextQueryDialog::PreLayoutDynInitL(); - SetMaxLength( iMaxLength ); - } -// -// --------------------------------------------------------- -// CDevEncUiSecretMinMaxCodeQuery::OfferKeyEventL -// called by framework when any key is pressed -// --------------------------------------------------------- -// -TKeyResponse CDevEncUiSecretMinMaxCodeQuery::OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - // '#' key - if ( aKeyEvent.iScanCode == EStdKeyHash && aType == EEventKeyUp ) - { - TryExitL( EEikBidOk ); - return EKeyWasConsumed; - } - - // '*' key - if ( aKeyEvent.iCode == '*' ) - { - return EKeyWasConsumed; - } - - // end key - if ( aKeyEvent.iCode == EKeyPhoneEnd ) - { - TryExitL( EAknSoftkeyCancel ); - return EKeyWasConsumed; - } - - return CAknTextQueryDialog::OfferKeyEventL( aKeyEvent,aType ); - } - -// --------------------------------------------------------- -// CDevEncUiSecretMinMaxCodeQuery::OkToExitL() -// Called by framework when the softkey is pressed -// --------------------------------------------------------- -TBool CDevEncUiSecretMinMaxCodeQuery::OkToExitL( TInt aButtonId ) - { - TInt length = 0; - TBool returnvalue( EFalse ); - - switch( aButtonId ) - { - case EAknSoftkeyOk: - { - CAknQueryControl* control = QueryControl(); - if ( control ) - { - length = control->GetTextLength(); - } - if ( length < iMinLength ) - { - returnvalue = EFalse; - } - else - { - returnvalue = CAknTextQueryDialog::OkToExitL( aButtonId ); - } - } - break; - - case EEikBidCancel: //Also includes EAknSoftkeyCancel as they have the same numerical value - { - returnvalue = ETrue; - break; - } - default: - break; - } - return returnvalue; - } - -void CDevEncUiSecretMinMaxCodeQuery::UpdateLeftSoftKeyL() - { - CAknQueryControl* control = QueryControl(); - if ( control ) - { - TBool makeVisible( control->GetTextLength() >= iMinLength ); - MakeLeftSoftkeyVisible( makeVisible ); - } - } - -// End of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiSettingItemList.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiSettingItemList.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,241 +0,0 @@ -/* -* Copyright (c) 2005 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 CDevEncUiSettingItemList. -* -*/ - -// INCLUDE FILES - -// Class include -#include "DevEncUiSettingItemList.h" - -// System include -#include -#include - -// User include - -// Constants -const TInt KOffTextIndex( 0 ); -const TInt KOnTextIndex( 1 ); -const TInt KOffEnumerationValue( 0 ); -const TInt KOnEnumerationValue( 1 ); - -// ================= MEMBER FUNCTIONS ======================= - -// -------------------------------------------------------------------------- -// CDevEncUiSettingItemList::CDevEncUiSettingItemList() -// -------------------------------------------------------------------------- -// -CDevEncUiSettingItemList::CDevEncUiSettingItemList() - { - } - -// -------------------------------------------------------------------------- -// CDevEncUiSettingItemList::~CDevEncUiSettingItemList() -// -------------------------------------------------------------------------- -// -CDevEncUiSettingItemList::~CDevEncUiSettingItemList() - { - } - -// -------------------------------------------------------------------------- -// CDevEncUiSettingItemList::SizeChanged() -// -------------------------------------------------------------------------- -// -void CDevEncUiSettingItemList::SizeChanged() - { - if ( ListBox() ) - { - ListBox()->SetRect( Rect() ); - ListBox()->HandleResourceChange( KEikDynamicLayoutVariantSwitch ); - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiSettingItemList::HandleResourceChange() -// -------------------------------------------------------------------------- -// -void CDevEncUiSettingItemList::HandleResourceChange( TInt aType ) - { - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - // do re-layout - if ( ListBox() ) - { - ListBox()->SetRect( Rect() ); - ListBox()->HandleResourceChange( aType ); - } - } - } - -// -------------------------------------------------------------------------- -// CDevEncUiSettingItemList::CreateSettingItemL() -// -------------------------------------------------------------------------- -// -CAknSettingItem* CDevEncUiSettingItemList::CreateSettingItemL( TInt aIdentifier ) - { - CAknSettingItem* settingItem = NULL; - - switch ( aIdentifier ) - { - case EPhoneEncryptionSettingItem: - settingItem = - new ( ELeave ) CAknBinaryPopupSettingItem( aIdentifier, - iPhoneMemSetting ); - break; - case EMemoryCardEncryptionSettingItem: - settingItem = - new ( ELeave ) CAknBinaryPopupSettingItem( aIdentifier, - iMmcSetting ); - break; - } - return settingItem; // passing ownership - } - -// -------------------------------------------------------------------------- -// CDevEncUiSettingItemList::HandleListBoxEventL() -// -------------------------------------------------------------------------- -// -void CDevEncUiSettingItemList::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType) - { - if ( aEventType == EEventItemSingleClicked ) - { - TKeyEvent event; - event.iCode = EKeyEnter; - event.iScanCode = EStdKeyEnter; - event.iRepeats = 0; - iCoeEnv->SimulateKeyEventL( event, EEventKey ); - return; - } - CAknSettingItemList::HandleListBoxEventL(aListBox, aEventType); - } - -// -------------------------------------------------------------------------- -// CDevEncUiSettingItemList::ChangeSelectedItemL() -// -------------------------------------------------------------------------- -// -void CDevEncUiSettingItemList::ChangeSelectedItemL() - { - if ( ! ListBox() ) - { - User::Leave( KErrNotFound ); - } - EditItemL( ListBox()->CurrentItemIndex(), ETrue ); - } - -// -------------------------------------------------------------------------- -// CDevEncUiSettingItemList::SelectedItem() -// -------------------------------------------------------------------------- -// -TInt CDevEncUiSettingItemList::SelectedItem() - { - if ( ! ListBox() ) - { - return -1; - } - return ListBox()->CurrentItemIndex(); - } - - - // -------------------------------------------------------------------------- - // CDevEncUiSettingItemList::EditItemL() - // -------------------------------------------------------------------------- - // -void CDevEncUiSettingItemList::EditItemL( TInt aIndex, TBool aCalledFromMenu ) - { - CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu ); - (*SettingItemArray())[aIndex]->StoreL(); - } - -// -------------------------------------------------------------------------- -// CDevEncUiSettingItemList::SetItemTextL() -// -------------------------------------------------------------------------- -// -void CDevEncUiSettingItemList::SetItemTextL( TInt aIndex, const TDesC& aNewText ) - { - // Sanity check - if ( aIndex > ( SettingItemArray()->Count() - 1 ) ) - { - User::Leave( KErrOverflow ); - } - // Get hold of the existing texts for the selected item - // The binary popup setting item has two texts, one for each setting. - // Just to be sure, we set them both. - CAknBinaryPopupSettingItem* settingItem = - reinterpret_cast - ( ( *SettingItemArray() )[aIndex] ); - CArrayPtr* textArray = - settingItem->EnumeratedTextArray(); - CAknEnumeratedText* enumTextOn = textArray->At( KOnTextIndex ); - CAknEnumeratedText* enumTextOff = textArray->At( KOffTextIndex ); - - // Delete the previous texts thoroughly - HBufC* prevTextOn = enumTextOn->Value(); - HBufC* prevTextOff = enumTextOff->Value(); - textArray->Delete( KOnTextIndex ); - textArray->Delete( KOffTextIndex ); - delete prevTextOn; - delete prevTextOff; - - // Set the new enumeration values (matching the ones in the rss file) - enumTextOn->SetEnumerationValue( KOnEnumerationValue ); - enumTextOff->SetEnumerationValue( KOffEnumerationValue ); - - // Set the new texts - enumTextOn->SetValue( aNewText.AllocL() ); // Ownership transferred to array - enumTextOff->SetValue( aNewText.AllocL() ); // Ownership transferred to array - textArray->AppendL( enumTextOn ); - textArray->AppendL( enumTextOff ); - - // The list updates itself - HandleChangeInItemArrayOrVisibilityL(); - } - -// -------------------------------------------------------------------------- -// CDevEncUiSettingItemList::SetItemStateL() -// -------------------------------------------------------------------------- -// -void CDevEncUiSettingItemList::SetItemStateL( TInt aIndex, TBool aSetting ) - { - if ( aIndex == EPhoneMemory ) - { - iPhoneMemSetting = aSetting; - } - else - { - iMmcSetting = aSetting; - } - // Load the new value to the framework's internal data - ( *SettingItemArray() )[ aIndex ]->LoadL(); - } - -// -------------------------------------------------------------------------- -// CDevEncUiSettingItemList::ItemState() -// -------------------------------------------------------------------------- -// -void CDevEncUiSettingItemList::ItemState( TInt aIndex, TBool& aSetting ) - { - // Fetch the current value from the framework's internal data - if ( aIndex == EPhoneMemory ) - { - aSetting = iPhoneMemSetting; - } - else - { - aSetting = iMmcSetting; - } - } - -// END OF FILE diff -r 95243422089a -r 491b3ed49290 deviceencryption/DevEncUi/src/DevEncUiTimer.cpp --- a/deviceencryption/DevEncUi/src/DevEncUiTimer.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2005 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 "DevEncUiTimer.h" -#include "DevEncLog.h" - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------------- -// CDevEncUiTimer::NewL -// Instancies CDevEncUiTimer object -// ---------------------------------------------------------- -// -CDevEncUiTimer* CDevEncUiTimer::NewL( MDevEncUiTimerCallback* aCallback ) - { - CDevEncUiTimer* self = new ( ELeave ) CDevEncUiTimer( aCallback ); - CleanupStack::PushL ( self ); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } - -// ---------------------------------------------------------- -// CDevEncUiTimer::ConstructL() -// Initializes data objects -// ---------------------------------------------------------- -// -void CDevEncUiTimer::ConstructL() - { - CTimer::ConstructL(); - } - -// ---------------------------------------------------------- -// CDevEncUiTimer::CDevEncUiTimer() -// Constructor -// ---------------------------------------------------------- -// -CDevEncUiTimer::CDevEncUiTimer( MDevEncUiTimerCallback* aCallback ) - : CTimer( EPriorityStandard ), - iCallback( aCallback ) - { - CActiveScheduler::Add( this ); - } - -// ---------------------------------------------------------- -// CDevEncUiTimer::CDevEncUiTimer() -// Destructor -// ---------------------------------------------------------- -// -CDevEncUiTimer::~CDevEncUiTimer() - { - Cancel(); - } - -// ---------------------------------------------------------- -// CDevEncUiTimer::RunError() -// CActive Object method -// ---------------------------------------------------------- -// -TInt CDevEncUiTimer::RunError( TInt aError ) - { - return aError; - } - -// ---------------------------------------------------------- -// CDevEncUiTimer::RunL() -// CActive Object method -// ---------------------------------------------------------- -// -void CDevEncUiTimer::RunL() - { - DFLOG2( "CDevEncUiTimer::RunL, status %d", iStatus.Int() ); - if ( iStatus == KErrNone ) - { - iCallback->Timeout(); - } - } - -// ---------------------------------------------------------- -// CDevEncUiTimer::DoCancel() -// CActive Object method -// ---------------------------------------------------------- -// -void CDevEncUiTimer::DoCancel() - { - } - -// End of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/common/DevEnc.hrh --- a/deviceencryption/common/DevEnc.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2005 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: Enumerations used in the application UI. -* -*/ - -#ifndef __DEVENCUI_HRH__ -#define __DEVENCUI_HRH__ - -// DevEncUi enumerate command codes -enum TDevEncUiCommandIds - { - EDevEncUiCommandChange = 4242, // start value must not be 0 - EDevEncUiCommandHelp, - - // These MMC-related commands are used in the Encryption view. - EDevEncUiCommandEncryptWithoutSavingKey, - EDevEncUiCommandEncryptAndSaveKey, - EDevEncUiCommandEncryptWithRestoredKey, - - // This MMC-related command is not shown to the user. It is used - // when the encryption key is in the security driver and the user - // inserts an unencrypted card. - EDevEncUiCommandEncryptWithCurrentKey, - - // These MMC-related commands are used in the Decryption view. - EDevEncUiCommandDecrypt, - EDevEncUiCommandDecryptAndTurnOffEncryption, - - EDevEncUiInternalCommandEncrypt, - EDevEncUiInternalCommandDecrypt, - - // ID's of some UI items - EPhoneEncryptionSettingItem, - EMemoryCardEncryptionSettingItem, - EDevEncUiDlgCIdConfirmationQuery, - EDevEncUiDlgCIdDataQuery, - EDevEncUiWaitNoteId, - EDevEncUiSecretCodeQueryId - }; - -enum TDevEncUiMemoryType - { - EPhoneMemory, - EMemoryCard, - EPrimaryPhoneMemory - }; - -enum TDevEncUiMemoryEntityState - { - EMemStateUnknown = 0, - EMemDecrypted = 1, - EMemEncrypting = 2, - EMemEncrypted = 3, - EMemDecrypting = 4, - EMemCorrupted = 5 - }; - -enum TDevEncUiViewIds - { - EDevEncUiMainViewId = 1, - EDevEncUiEncrViewId, - EDevEncUiDecrViewId, - EDevEncUiNumberOfViews - }; - -enum TDevEncUiMmcStatus - { - EMmcNotPresent = 0, - EMmcNotReadable = 1, - EMmcOk = 2 - }; - -#endif // __DEVENCUI_HRH__ diff -r 95243422089a -r 491b3ed49290 deviceencryption/common/DevEncConfig.hrh --- a/deviceencryption/common/DevEncConfig.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2005 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: Common build configuration of Device Encryption components. -* -*/ - -#ifndef __DEVENCUI_CONFIG_H__ -#define __DEVENCUI_CONFIG_H__ - -// Comment this out to disable logs -#define DEVENC_LOG - -#endif // __DEVENCUI_CONFIG_H__ -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/common/DevEncDef.h --- a/deviceencryption/common/DevEncDef.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2005 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: Common definitions for the application. -* -*/ - -#ifndef DEVENCDEF_H_ -#define DEVENCDEF_H_ - -enum - { - KMinPasswordLength = 4, // Same as for security code - KMaxPasswordLength = 50, - KMaxKeyNameLength = 50, - KMaxFilenameLength = 100, - KEncryptionKeyLength = 32 - }; -#endif /*DEVENCDEF_H_*/ diff -r 95243422089a -r 491b3ed49290 deviceencryption/common/DevEncLog.cpp --- a/deviceencryption/common/DevEncLog.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2005 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 CFileLog. -* -*/ - -#include "DevEncLog.h" -#include - -#if defined( _DEBUG ) && defined ( DEVENC_LOG ) - -_LIT( KDevEncLogDir, "DevEnc"); -_LIT( KDevEncLogFile, "DevEnc.log"); - -void CFileLog::Printf( TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - RFileLogger::WriteFormat( KDevEncLogDir, - KDevEncLogFile, - EFileLoggingModeAppend, - aFmt, - list ); - } - -#endif - -// End of File diff -r 95243422089a -r 491b3ed49290 deviceencryption/common/DevEncLog.h --- a/deviceencryption/common/DevEncLog.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* Copyright (c) 2005 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: Debug logging functionality. -* -*/ - -#ifndef __DEVENC_LOG_H__ -#define __DEVENC_LOG_H__ - -#include "DevEncConfig.hrh" - -#if defined( _DEBUG ) && defined ( DEVENC_LOG ) - -#include -#include -#include - -class CFileLog : public CBase - { - public: - static void Printf( TRefByValue aFmt, ... ); - }; - -// Debug trace to stdout -#define DLOG( aText ) \ - { \ - _LIT( KText, aText ); \ - RDebug::Print( KText ); \ - } - -// Debug trace to stdout -#define DLOG2( aText, aParam ) \ - { \ - _LIT( KText, aText ); \ - RDebug::Print( KText, aParam ); \ - } - -// Debug trace to stdout -#define DLOG3( aText, aParam1, aParam2 ) \ - { \ - _LIT( KText, aText ); \ - RDebug::Print( KText, aParam1, aParam2 ); \ - } - -// Debug trace to file -#define FLOG( aText ) \ - { \ - _LIT( KLogText, aText ); \ - CFileLog::Printf( KLogText ); \ - } - -// Debug trace to file -#define FLOG2( aText, b ) \ - { \ - _LIT( KLogText, aText ); \ - CFileLog::Printf( KLogText, b ); \ - } - -// Debug trace to file -#define FLOG3( aText, b, c ) \ - { \ - _LIT( KLogText, aText ); \ - CFileLog::Printf( KLogText, b, c ); \ - } - -// Debug trace to stdout and file -#define DFLOG( aText ) \ - { \ - DLOG( aText ); \ - FLOG( aText ); \ - } - -// Debug trace to stdout and file -#define DFLOG2( aText, aParam ) \ - { \ - DLOG2( aText, aParam ); \ - FLOG2( aText, aParam ); \ - } - -// Debug trace to stdout and file -#define DFLOG3( aText, aParam1, aParam2 ) \ - { \ - DLOG3( aText, aParam1, aParam2 ); \ - FLOG3( aText, aParam1, aParam2 ); \ - } - -// Debug trace a string literal to file -#define FLOGBUF( aText ) \ - { \ - CFileLog::Printf( aText ); \ - } - -// Debug trace a string literal -#define DLOGBUF( aText ) \ - { \ - RDebug::Print( aText ); \ - } - -// Debug trace a string literal to file and stdout -#define DFLOGBUF( aText ) \ - { \ - DLOGBUF( aText ); \ - FLOGBUF( aText ); \ - } - -#else // _DEBUG not defined, no logging code will be included at all - -#define DLOG( a ) -#define DLOG2( a, b ) -#define DLOG3( a, b, c ) -#define FLOG( a ) -#define FLOG2( a, b ) -#define FLOG3( a, b, c ) -#define DFLOG( a ) -#define DFLOG2( a, b ) -#define DFLOG3( a, b, c ) -#define FLOGBUF( a ) -#define DFLOGBUF( a ) - -#endif // _DEBUG - -#endif // __DEVENC_LOG_H__ - -// End of File - diff -r 95243422089a -r 491b3ed49290 deviceencryption/common/DevEncUids.hrh --- a/deviceencryption/common/DevEncUids.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2005 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: Uids of components related to Device Encryption. -* -*/ - -#ifndef DEVENCUIUIDS_HRH -#define DEVENCUIUIDS_HRH - -#define KDevEncUiUid 0x2000259A -#define KDevEncStarterUid 0x2000259B -#define KDevEncOmaDmPluginUid 0x200025B5 -#define KDevEncOmaDmPluginImplUid 0x200025BB -#define KDevEncRfsPluginUid 0x200025B6 -#define KDevEncRfsPluginImplUid 0x200025BC -#define KDevEncCommonUtilsUid 0x200025B7 -#define KDevEncNotifPluginUid 0x20002672 -#define KDevEncNotifPluginImplUid 0x20002673 -#define KDevEncPasswdDlgUid 0x20002674 -#define KDevEncGsPluginUid 0x200255CF -#define KDevEncGsPluginImplUid 0x200255D0 - -#define KDevEncNokiaVID 0x70000001 - -#endif // DEVENCUIUIDS_HRH - -// End of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/group/bld.inf --- a/deviceencryption/group/bld.inf Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2005 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: Provides the information required for building all -* Device Encryption components. -* -*/ - -#include -#include - -PRJ_EXPORTS - -// ROM files -../rom/DevEnc.iby CORE_APP_LAYER_IBY_EXPORT_PATH(DevEncryption.iby) -../rom/DevEncResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(DevEncResources.iby) - -// Exported headers -../common/DevEncDef.h APP_LAYER_PLATFORM_EXPORT_PATH(DevEncDef.h) - -PRJ_MMPFILES - -#include "../DevEncNotifPlugin/group/bld.inf" -#include "../DevEncUi/group/bld.inf" -#include "../DevEncDmAdapter/group/bld.inf" -#include "../DevEncGsPlugin/group/bld.inf" -#include "../help/group/bld.inf" - - -// End of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/help/data/xhtml.zip Binary file deviceencryption/help/data/xhtml.zip has changed diff -r 95243422089a -r 491b3ed49290 deviceencryption/help/group/bld.inf --- a/deviceencryption/help/group/bld.inf Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* 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: -* Export help related files. -* -*/ - -#include -PRJ_EXPORTS -:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite -:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite - -../inc/devenc.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/devenc.hlp.hrh) -../rom/deviceencryptionhelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(deviceencryptionhelps_variant.iby) diff -r 95243422089a -r 491b3ed49290 deviceencryption/help/inc/devenc.hlp.hrh --- a/deviceencryption/help/inc/devenc.hlp.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* 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: -* -*/ - -// -// devenc.hlp.hrh generated by CSXHelp Utilities. -// - -#ifndef __DEVENC_HLP_HRH__ -#define __DEVENC_HLP_HRH__ - -_LIT(KES_HLP_ENCRYPTION_DECRYPT, "ES_HLP_ENCRYPTION_DECRYPT"); // -_LIT(KES_HLP_ENCRYPTION_ENCRYPT, "ES_HLP_ENCRYPTION_ENCRYPT"); // -_LIT(KES_HLP_ENCRYPTION_MAIN, "ES_HLP_ENCRYPTION_MAIN"); // - -#endif \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/help/rom/deviceencryptionhelps_variant.iby --- a/deviceencryption/help/rom/deviceencryptionhelps_variant.iby Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* 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 __DEVICEENCRPTIONHELPS_VARIANT_IBY__ -#define __DEVICEENCRPTIONHELPS_VARIANT_IBY__ - -#if defined(FF_S60_HELPS_IN_USE) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x2000259A\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x2000259A\contents.zip) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x2000259A\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x2000259A\index.xml) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x2000259A\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x2000259A\keywords.xml) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x2000259A\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x2000259A\meta.xml) -#endif - -#endif \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/layers.sysdef.xml --- a/deviceencryption/layers.sysdef.xml Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - -]> - - - - - - - - - - \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/rom/DevEnc.iby --- a/deviceencryption/rom/DevEnc.iby Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2005 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: Contains information about binary files and their locations. -* -*/ - -#ifndef __DEVENC0_IBY__ -#define __DEVENC0_IBY__ -#ifdef FF_DEVICE_ENCRYPTION_FEATURE - -//--------------------------------------------------------------------------- -// Device Encryption UI -//--------------------------------------------------------------------------- - -S60_APP_EXE( DevEncUi ) -S60_APP_BITMAP( DevEncUi ) -SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,DevEncUi) -S60_APP_AIF_ICONS( DevEncUi ) -S60_APP_AIF_RSC( DevEncUi ) - -//--------------------------------------------------------------------------- -// Device Encryption OMA DM Adapter -//--------------------------------------------------------------------------- -ECOM_PLUGIN(DevEncUiDmAdapter.dll,DevEncUiDmAdapter.rsc) - -//--------------------------------------------------------------------------- -// Device Encryption Notifier plugin -//--------------------------------------------------------------------------- -ECOM_PLUGIN(devencnotifplugin.dll,devencnotifplugin.rsc) -//--------------------------------------------------------------------------- -// Device Encryption GS Plugin -//--------------------------------------------------------------------------- -ECOM_PLUGIN(devencgsplugin.dll,200255CF.rsc) -data=DATAZ_\BITMAP_DIR\devencgsplugin.mif BITMAP_DIR\devencgsplugin.mif - -#endif // FF_DEVICE_ENCRYPTION_FEATURE -#endif // __DEVENC0_IBY__ - -// End of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/rom/DevEncResources.iby --- a/deviceencryption/rom/DevEncResources.iby Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2005 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: Contains information about binary files and their locations. -* -*/ - -#ifndef __DEVENCRESOURCES_IBY__ -#define __DEVENCRESOURCES_IBY__ -#ifdef FF_DEVICE_ENCRYPTION_FEATURE - -// Device Encryption UI -//data=DATAZ_\resource\apps\DevEncUi.rsc resource\apps\DevEncUi.rsc -S60_APP_RESOURCE (DevEncUi) - -//DevEnc Notification plugin -data=DATAZ_\RESOURCE_FILES_DIR\devencnotifplugin.rsc RESOURCE_FILES_DIR\devencnotifplugin.rsc - -// Device Encryption GS Plugin -data=DATAZ_\resource\devencGsPluginRsc.rsc resource\devencGsPluginRsc.rsc - -#endif // FF_DEVICE_ENCRYPTION_FEATURE - -#endif // __DEVENCRESOURCES_IBY__ -// End of file diff -r 95243422089a -r 491b3ed49290 deviceencryption/sis/DevEnc.pkg --- a/deviceencryption/sis/DevEnc.pkg Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -; -; 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: -; -; DevEnc.pkg -; -;Language - standard language definitions -&EN - -;Standard SIS file header (use UI application UID) -#{"DevEncUi"},(0x2000259A),1,0,0 - -;Localised Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -;Supports Series 60 v 3.0 -[0x101F7961], 0, 0, 0, {"Series60ProductID"} - -;Files to install - -;---------------------------------------------------------------------------- -; Device Encryption UI -;---------------------------------------------------------------------------- -"\epoc32\release\armv5\urel\DevEncUi.exe" -"!:\sys\bin\DevEncUi.exe" -"\epoc32\data\z\resource\apps\DevEncUi.rsc" -"!:\resource\apps\DevEncUi.rsc" -"\epoc32\data\z\private\10003a3f\apps\DevEncUi_reg.rsc" -"!:\private\10003a3f\import\apps\DevEncUi_reg.rsc" -;"\epoc32\data\z\private\10202be9\200025A6.txt" -"!:\private\10202be9\200025A6.txt" -;"\epoc32\data\z\resource\apps\DevEncUi.mif" -"!:\resource\apps\DevEncUi.mif" - -;---------------------------------------------------------------------------- -; Device Encryption Common Utilities -;---------------------------------------------------------------------------- -"\epoc32\release\armv5\urel\devenccommonutils.dll" -"!:\sys\bin\devenccommonutils.dll" - -;---------------------------------------------------------------------------- -; Device Encryption Device Management Adapter -;---------------------------------------------------------------------------- -"\epoc32\release\armv5\urel\DevEncUiDmAdapter.dll" -"!:\sys\bin\DevEncUiDmAdapter.dll" -"\epoc32\data\z\resource\plugins\DevEncUiDmAdapter.rsc" -"!:\resource\plugins\DevEncUiDmAdapter.rsc" - -;---------------------------------------------------------------------------- -; Device Encryption Notifier Plugin -;---------------------------------------------------------------------------- -"\epoc32\release\armv5\urel\DevEncNotifPlugin.dll" -"!:\sys\bin\DevEncNotifPlugin.dll" -;"\epoc32\release\armv5\urel\DevEncNotifWrapper.dll" -"!:\sys\bin\DevEncNotifWrapper.dll" -"\epoc32\data\z\resource\plugins\DevEncNotifPlugin.rsc" -"!:\resource\plugins\DevEncNotifPlugin.rsc" -"\epoc32\data\z\resource\devencnotifplugin.rsc" -"!:\resource\devencnotifplugin.rsc" - diff -r 95243422089a -r 491b3ed49290 deviceencryption/sysdef_1_4_0.dtd --- a/deviceencryption/sysdef_1_4_0.dtd Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/Aif/FileManageraif.rss --- a/filemanager/Aif/FileManageraif.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2002-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 for project FileManager -* -*/ - - -#include - -RESOURCE AIF_DATA -{ - app_uid = 0x101f84eb; - num_icons = 2; - embeddability = KAppNotEmbeddable; - hidden = KAppNotHidden; - newfile = KAppDoesNotSupportNewFile; -} - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Aif/icon44.bmp Binary file filemanager/Aif/icon44.bmp has changed diff -r 95243422089a -r 491b3ed49290 filemanager/Aif/icon44m.bmp Binary file filemanager/Aif/icon44m.bmp has changed diff -r 95243422089a -r 491b3ed49290 filemanager/App/data/FileManager.rss --- a/filemanager/App/data/FileManager.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1519 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource definitions for project FileManager -* -*/ - - -// RESOURCE IDENTIFIER -NAME FMGR // 4 letter ID - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "FileManagerEngine.hrh" // filemanager_mbm_file_location -#include "FileManager.hrh" - - -// RESOURCE DEFINITIONS - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF { buf = qtn_fmgr_main_title; } - -RESOURCE EIK_APP_INFO -{ - status_pane = r_filemanager_status_pane; -} - -/** - * STATUS_PANE_APP_MODEL - * FileManager default status pane - */ -RESOURCE STATUS_PANE_APP_MODEL r_filemanager_status_pane - { - layout = R_AVKON_STATUS_PANE_LAYOUT_USUAL; - panes = - { - SPANE_PANE - { - id = EEikStatusPaneUidTitle; - type = EAknCtTitlePane; - resource = r_filemanager_title_pane; - } - }; - } - -/** - * TITLE_PANE - * FileManager default title pane text - */ -RESOURCE TITLE_PANE r_filemanager_title_pane - { - txt = qtn_fmgr_main_title; - } - -#include - -RESOURCE LOCALISABLE_APP_INFO r_filemanager_localisable_app_info - { - short_caption = qtn_apps_fmgr_grid; - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = qtn_apps_fmgr_list; -#ifdef __SCALABLE_ICONS - number_of_icons = 1; - icon_file = APP_BITMAP_DIR"\\FileManager_aif.mif"; -#else - number_of_icons = 2; - icon_file = APP_BITMAP_DIR"\\FileManager_aif.mbm"; -#endif - }; - } - -/** -* AVKON_VIEW -* General view -*/ -RESOURCE AVKON_VIEW r_filemanager_main_view - { - cba = r_filemanager_softkeys_options_exit__open; - menubar = r_filemanager_main_menubar; - } -/** -* AVKON_VIEW -* General view (embedded) -*/ -RESOURCE AVKON_VIEW r_filemanager_main_view_embedded - { - cba = r_filemanager_softkeys_options_exit__open_embedded; - menubar = r_filemanager_main_menubar; - } - -/** -* AVKON_VIEW -* Folders view -*/ -RESOURCE AVKON_VIEW r_filemanager_folders_view - { - cba = r_filemanager_softkeys_options_back__open; - menubar = r_filemanager_memory_store_menubar; - } - -/** -* AVKON_VIEW -* Search results view -*/ -/* -RESOURCE AVKON_VIEW r_filemanager_search_results_view - { - cba = r_filemanager_softkeys_options_back__open; - menubar = r_filemanager_search_results_menubar; - } -*/ -/** -* MENU_BAR -* Phone memory menu bar -*/ -RESOURCE MENU_BAR r_filemanager_main_menubar - { - titles = - { - MENU_TITLE - { - menu_pane = r_filemanager_main_view_menu; - } - }; - } - -/** -* MENU_BAR -* Memory store menu bar -*/ -RESOURCE MENU_BAR r_filemanager_memory_store_menubar - { - titles = - { - MENU_TITLE - { - menu_pane = r_filemanager_memory_store_view_menu; - } - }; - } - -RESOURCE MENU_PANE r_filemanager_main_view_menu - { - items = - { - MENU_ITEM - { - command = EFileManagerOpen; - txt = qtn_fldr_open; - flags = EEikMenuItemAction; - }, - MENU_ITEM - { - command = EFileManagerConnectRemoveDrive; - txt = qtn_rd_opt_connect; - flags = EEikMenuItemDimmed; - }, - MENU_ITEM - { - command = EFileManagerDisconnectRemoveDrive; - txt = qtn_rd_opt_disconnect; - flags = EEikMenuItemDimmed; - }, - MENU_ITEM - { - command = EFileManagerEject; - txt = qtn_fmgr_options_eject; - flags = EEikMenuItemSpecific; - }, -#ifndef RD_FILE_MANAGER_BACKUP - MENU_ITEM - { - command = EFileManagerBackup; - txt = qtn_memc_options_backup; - }, - MENU_ITEM - { - command = EFileManagerRestore; - txt = qtn_memc_options_restore; - }, -#endif // !RD_FILE_MANAGER_BACKUP - MENU_ITEM - { - command = EFileManagerFindFile; - txt = qtn_fmgr_options_find_file; - }, - MENU_ITEM - { - command = EFileManagerMemoryStorage; - cascade = r_filemanager_memory_storage_menu; - txt = qtn_fmgr_options_memory_sub; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerRemoveDrives; - cascade = r_filemanager_remote_drives_menu; - txt = qtn_fmgr_opt_remote_drives; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerRemoveDrivesMapDrive; - txt = qtn_fmgr_opt_rd_new_drive; - }, - MENU_ITEM - { - command = EAknCmdHelp; - txt = qtn_options_help; - }, - MENU_ITEM - { - command = EAknSoftkeyExit; - txt = qtn_options_exit; - } - }; - } - -RESOURCE MENU_PANE r_filemanager_memory_store_view_menu - { - items = - { - MENU_ITEM - { - command = EFileManagerOpen; - txt = qtn_fldr_open; - flags = EEikMenuItemAction; - }, - MENU_ITEM - { - command = EFileManagerConnectRemoveDrive; - txt = qtn_rd_opt_connect; - }, - MENU_ITEM - { - command = EFileManagerDisconnectRemoveDrive; - txt = qtn_rd_opt_disconnect; - }, - MENU_ITEM - { - command = EFileManagerRefreshRemoteDrive; - txt = qtn_fmgr_rd_opt_refresh; - }, - MENU_ITEM - { - command = EFileManagerDelete; - txt = qtn_fldr_delete; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerOrganise; - cascade = r_filemanager_organise_menu; - txt = qtn_fmgr_options_organise; - }, - MENU_ITEM - { - command = EFileManagerMoveToFolder; - txt = qtn_options_org_move_to_folder; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerCopyToFolder; - txt = qtn_options_org_copy_to; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerMark; - cascade = r_filemanager_mark_unmark_menu; - txt = qtn_options_list; - }, - MENU_ITEM - { - command = EFileManagerRename; - txt = qtn_fldr_rename; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerFindFile; - txt = qtn_fmgr_options_find_file; - }, - MENU_ITEM - { - command = EFileManagerSort; - cascade = r_filemanager_sort_menu; - txt = qtn_fmgr_options_sort_submenu; - }, - MENU_ITEM - { - command = EFileManagerSearchSort; - cascade = r_filemanager_search_sort_menu; - txt = qtn_fmgr_options_sort_submenu; - }, - MENU_ITEM - { - command = EFileManagerReceiveViaIR; - txt = qtn_album_cmd_receive_via_ir; - }, - MENU_ITEM - { - command = EFileManagerDetails; - cascade = r_filemanager_details_menu; - txt = qtn_fmgr_options_memory_storage_details; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerUnlockMemoryCard; - txt = qtn_memc_options_unlock; - flags = EEikMenuItemSpecific; - }, -#ifdef RD_MULTIPLE_DRIVE - MENU_ITEM - { - command = EFileManagerFormatMassStorage; - txt = qtn_fmgr_options_format_mass; - }, -#endif // RD_MULTIPLE_DRIVE -// MENU_ITEM -// { -// command = EFileManagerMemoryCardPassword; -// cascade = r_filemanager_memory_card_password_menu; -// txt = qtn_fmgr_options_card_password; -// }, -// MENU_ITEM -// { -// command = EFileManagerUnlockMemoryCard; -// txt = qtn_memc_options_unlock; -// }, - MENU_ITEM - { - command = EAknCmdHelp; - txt = qtn_options_help; - }, - MENU_ITEM - { - command = EAknSoftkeyExit; - txt = qtn_options_exit; - } - }; - } - -RESOURCE MENU_PANE r_filemanager_memory_storage_menu - { - items = - { - MENU_ITEM - { - command = EFileManagerMemoryStorageUnlock; - txt = qtn_fmgr_unlock_memory; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerMemoryStorageDetails; - txt = qtn_fmgr_options_memory_storage_details; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerMemoryStorageName; - txt = qtn_fmgr_options_card_name; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerMemoryStorageRename; - txt = qtn_fmgr_options_card_rename; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerMemoryStorageSetPassword; - txt = qtn_fmgr_options_set_memc_passwd; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerMemoryStorageChangePassword; - txt = qtn_fmgr_options_change_memc_passwd; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerMemoryStorageRemovePassword; - txt = qtn_fmgr_options_remove_memc_passwd; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerMemoryStorageFormat; - txt = qtn_fmgr_options_card_format; - flags = EEikMenuItemSpecific; - } - }; - } - -RESOURCE MENU_PANE r_filemanager_organise_menu - { - items = - { - MENU_ITEM - { - command = EFileManagerNewFolder; - txt = qtn_options_org_new_folder; - } - }; - } - -RESOURCE MENU_PANE r_filemanager_sort_menu - { - items = - { - MENU_ITEM - { - command = EFileManagerSortByName; - txt = qtn_fmgr_options_sort_by_name; - flags = EEikMenuItemRadioStart; - }, - MENU_ITEM - { - command = EFileManagerSortByType; - txt = qtn_fmgr_options_sort_by_type; - flags = EEikMenuItemRadioMiddle; - }, - MENU_ITEM - { - command = EFileManagerSortMostRecentFirst; - txt = qtn_fmgr_options_sort_recent_first; - flags = EEikMenuItemRadioMiddle; - }, - MENU_ITEM - { - command = EFileManagerSortLargestFirst; - txt = qtn_fmgr_options_sort_largest_first; - flags = EEikMenuItemRadioEnd; - } - }; - } - -RESOURCE MENU_PANE r_filemanager_search_sort_menu - { - items = - { - MENU_ITEM - { - command = EFileManagerSortByMatch; - txt = qtn_fmgr_options_sort_by_match; - flags = EEikMenuItemRadioStart; - }, - MENU_ITEM - { - command = EFileManagerSortByName; - txt = qtn_fmgr_options_sort_by_name; - flags = EEikMenuItemRadioMiddle; - }, - MENU_ITEM - { - command = EFileManagerSortByType; - txt = qtn_fmgr_options_sort_by_type; - flags = EEikMenuItemRadioMiddle; - }, - MENU_ITEM - { - command = EFileManagerSortMostRecentFirst; - txt = qtn_fmgr_options_sort_recent_first; - flags = EEikMenuItemRadioMiddle; - }, - MENU_ITEM - { - command = EFileManagerSortLargestFirst; - txt = qtn_fmgr_options_sort_largest_first; - flags = EEikMenuItemRadioEnd; - } - }; - } - -RESOURCE MENU_PANE r_filemanager_remote_drives_menu - { - items = - { - MENU_ITEM - { - command = EFileManagerRemoveDrivesSettings; - txt = qtn_fmgr_opt_rd_settings; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerRemoveDrivesDelete; - txt = qtn_fmgr_opt_rd_delete_drive; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerConnectRemoveDrive; - txt = qtn_rd_opt_connect; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerDisconnectRemoveDrive; - txt = qtn_rd_opt_disconnect; - flags = EEikMenuItemSpecific; - } - }; - } - -RESOURCE MENU_PANE r_filemanager_details_menu - { - items = - { - MENU_ITEM - { - command = EFileManagerFileDetails; - txt = qtn_fmgr_options_details; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerFolderDetails; - txt = qtn_fmgr_options_details; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerMoreInfoOnline; - txt = qtn_drm_options_more_info; - flags = EEikMenuItemSpecific; - } -// MENU_ITEM -// { -// command = EFileManagerMemoryCardDetails; -// txt = qtn_fmgr_options_card_details; -// }, -// MENU_ITEM -// { -// command = EFileManagerMemoryState; -// txt = qtn_fmgr_options_memory_details; -// } - }; - } - -//RESOURCE MENU_PANE r_filemanager_memory_card_menu -// { -// items = -// { -// MENU_ITEM -// { -// command = EFileManagerMemoryCardName; -// txt = qtn_fmgr_options_card_name; -// }, -// MENU_ITEM -// { -// command = EFileManagerMemoryCardRename; -// txt = qtn_fmgr_options_card_rename; -// }, -// MENU_ITEM -// { -// command = EFileManagerMemoryCardFormat; -// txt = qtn_fmgr_options_card_format; -// } -// }; -// } -// -//RESOURCE MENU_PANE r_filemanager_memory_card_password_menu -// { -// items = -// { -// MENU_ITEM -// { -// command = EFileManagerMemoryCardPasswordSet; -// txt = qtn_fmgr_options_set_password; -// }, -// MENU_ITEM -// { -// command = EFileManagerMemoryCardPasswordChange; -// txt = qtn_fmgr_options_change_passwd; -// }, -// MENU_ITEM -// { -// command = EFileManagerMemoryCardPasswordRemove; -// txt = qtn_fmgr_options_remove_passwd; -// } -// }; -// } - -RESOURCE MENU_BAR r_filemanager_context_sensitive_menubar - { - titles = - { - MENU_TITLE - { - menu_pane = r_filemanager_context_sensitive_menu; - } - }; - } - -RESOURCE MENU_PANE r_filemanager_context_sensitive_menu - { - items= - { - MENU_ITEM - { - command = EFileManagerOrganise; - cascade = r_filemanager_organise_context_sensitive_menu; - txt = qtn_fmgr_options_organise; - }, - MENU_ITEM - { - command = EFileManagerDelete; - txt = qtn_fldr_delete; - }, - MENU_ITEM - { - command = EFileManagerMark; - cascade = r_filemanager_context_sensitive_mark_unmark_menu; - txt = qtn_options_list; - }, - MENU_ITEM - { - command = EFileManagerUnlockMemoryCard; - txt = qtn_memc_options_unlock; - }, - MENU_ITEM - { - command = EFileManagerMemoryStorageFormat; - txt = qtn_fmgr_options_card_format; - } - }; - } - -RESOURCE MENU_PANE r_filemanager_organise_context_sensitive_menu - { - items = - { - MENU_ITEM - { - command = EFileManagerMoveToFolder; - txt = qtn_options_org_move_to_folder; - }, - MENU_ITEM - { - command = EFileManagerCopyToFolder; - txt = qtn_options_org_copy_to; - } - }; - } - -#ifdef RD_FILE_MANAGER_BACKUP -/** -* AVKON_VIEW -* Backup view -*/ -RESOURCE AVKON_VIEW r_filemanager_backup_view - { - cba = r_filemanager_softkeys_options_back__change; - menubar = r_filemanager_backup_menubar; - } - -/** -* MENU_BAR -* Backup menu bar -*/ -RESOURCE MENU_BAR r_filemanager_backup_menubar - { - titles = - { - MENU_TITLE - { - menu_pane = r_filemanager_backup_view_menu; - } - }; - } - -RESOURCE MENU_PANE r_filemanager_backup_view_menu - { - items = - { - MENU_ITEM - { command = EFileManagerOpen; txt = qtn_options_change; }, - MENU_ITEM - { command = EFileManagerBackup; txt = qtn_fmgr_options_backup_now; }, - MENU_ITEM - { command = EFileManagerRestore; txt = qtn_fmgr_options_restore; }, - MENU_ITEM - { command = EFileManagerDeleteBackup; txt = qtn_fmgr_options_delete_backup; }, - MENU_ITEM - { command = EAknCmdHelp; txt = qtn_options_help; }, - MENU_ITEM - { command = EAknSoftkeyExit; txt = qtn_options_exit; } - }; - } - -RESOURCE AVKON_VIEW r_filemanager_restore_view - { - cba = R_AVKON_SOFTKEYS_OK_CANCEL__MARK; - menubar = R_AVKON_MENUPANE_EMPTY; - } - -RESOURCE AVKON_VIEW r_filemanager_scheduled_backup_view - { - cba = R_AVKON_SOFTKEYS_EMPTY; - menubar = R_AVKON_MENUPANE_EMPTY; - } - -RESOURCE ARRAY r_filemanager_backup_contents_texts - { - items = - { - LBUF { txt = qtn_fmgr_backup_content_all; }, - LBUF { txt = qtn_fmgr_backup_content_settings; }, - LBUF { txt = qtn_fmgr_backup_content_messages; }, - LBUF { txt = qtn_fmgr_backup_content_contacts; }, - LBUF { txt = qtn_fmgr_backup_content_calendar; }, - LBUF { txt = qtn_fmgr_backup_content_bookmarks; }, - LBUF { txt = qtn_fmgr_backup_content_userfiles; } - }; - } - -RESOURCE ARRAY r_filemanager_backup_weekday_texts - { - items = - { - LBUF { txt = qtn_week_long_monday; }, - LBUF { txt = qtn_week_long_tuesday; }, - LBUF { txt = qtn_week_long_wednesday; }, - LBUF { txt = qtn_week_long_thursday; }, - LBUF { txt = qtn_week_long_friday; }, - LBUF { txt = qtn_week_long_saturday; }, - LBUF { txt = qtn_week_long_sunday; } - }; - } - -RESOURCE ARRAY r_filemanager_backup_scheduling_texts - { - items = - { - LBUF { txt = qtn_fmgr_backup_no_scheduling; }, - LBUF { txt = qtn_fmgr_backup_daily; }, - LBUF { txt = qtn_fmgr_backup_weekly; } - }; - } - -#endif // RD_FILE_MANAGER_BACKUP - -RESOURCE MENU_PANE r_filemanager_mark_unmark_menu - { - items = - { - MENU_ITEM - { - command = EFileManagerMarkOne; - txt = qtn_options_list_mark_one; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerUnmarkOne; - txt = qtn_options_list_unmark_one; - flags = EEikMenuItemSpecific; - }, - MENU_ITEM - { - command = EFileManagerMarkAll; - txt = qtn_options_list_mark_all; - }, - MENU_ITEM - { - command = EFileManagerUnmarkAll; - txt = qtn_options_list_unmark_all; - } - }; - } -RESOURCE MENU_PANE r_filemanager_context_sensitive_mark_unmark_menu - { - items = - { - MENU_ITEM - { - command = EFileManagerMarkOne; - txt = qtn_options_list_mark_one; - }, - MENU_ITEM - { - command = EFileManagerUnmarkOne; - txt = qtn_options_list_unmark_one; - }, - MENU_ITEM - { - command = EFileManagerMarkAll; - txt = qtn_options_list_mark_all; - }, - MENU_ITEM - { - command = EFileManagerUnmarkAll; - txt = qtn_options_list_unmark_all; - } - }; - } - -RESOURCE MEMORYSELECTIONDIALOG r_filemanager_copy_memory_selectiondialog - { - softkey_1 = text_softkey_ok; - locations = - { - LOCATION { root_path = text_phone_memory_root_path; }, - LOCATION { root_path = text_memory_card_root_path; } - }; - } - -RESOURCE MEMORYSELECTIONDIALOG r_filemanager_move_memory_selectiondialog - { - softkey_1 = text_softkey_ok; - locations = - { - LOCATION { root_path = text_phone_memory_root_path; }, - LOCATION { root_path = text_memory_card_root_path; } - }; - } - -RESOURCE MEMORYSELECTIONDIALOG r_filemanager_find_memory_selectiondialog - { - title = qtn_fmgr_find_prtx; - softkey_1 = text_softkey_ok; - locations = - { - LOCATION { root_path = text_phone_memory_root_path; }, - LOCATION { root_path = text_memory_card_root_path; } - }; - } - -RESOURCE FILESELECTIONDIALOG r_filemanager_find_folder_selectiondialog - { - title = qtn_fmgr_find_prtx; - softkey_1_file = text_softkey_select; - softkey_1_folder = text_softkey_open; - softkey_2_root_level = text_softkey_cancel; - softkey_2_subfolder = text_softkey_back; - } - -RESOURCE CBA r_filemanager_softkeys_search_cancel__search - { - buttons = - { - CBA_BUTTON { id = EAknSoftkeyOk; txt = text_softkey_search; }, - CBA_BUTTON { id = EAknSoftkeyCancel; txt = text_softkey_cancel; }, - CBA_BUTTON { id = EAknSoftkeyOk; txt = text_softkey_search; } - }; - } - -RESOURCE DIALOG r_filemanager_search_query - { - flags = EGeneralQueryFlags; - buttons = r_filemanager_softkeys_search_cancel__search; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = EDataLayout; - label = qtn_fldr_name_prmpt; - control = EDWIN - { - flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable; - //width = 35; - lines = 1; - maxlength = 35; - }; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_find_wait_dialog - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items= - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralQuery; - control= AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_fmgr_wnote_search; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_delete_wait_dialog - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items= - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralQuery; - control= AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_fldr_deleting_wait_note; - imagefile = AVKON_BITMAP_FILE; // bitmap file - imageid = EMbmAvkonQgn_note_erased; - imagemask = EMbmAvkonQgn_note_erased_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } -//----------------------------------------------------------------------------- -// -// r_aknexnote_progress_note -// For progress note. -// -//----------------------------------------------------------------------------- -// -RESOURCE DIALOG r_filemanager_progress_note_copy - { - flags = EAknProgressNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EAknNoteProgressBar; - control = AVKON_NOTE - { - layout = EProgressLayout; - singular_label = qtn_gen_note_copying; - plural_label = qtn_gen_note_copying; - imagefile = avkon_mbm_file_location; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_wait_note_copy - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EAknNoteProgressBar; - control= AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_gen_note_copying; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_progress_note_move - { - flags = EAknProgressNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EAknNoteProgressBar; - control = AVKON_NOTE - { - layout = EProgressLayout; - singular_label = qtn_fldr_moving_wait_note; - plural_label = qtn_fldr_moving_wait_note; - imagefile = avkon_mbm_file_location; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_wait_note_move - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EAknNoteProgressBar; - control= AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_fldr_moving_wait_note; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_wait_note_open - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EAknNoteProgressBar; - control= AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_gen_note_opening; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_wait_note_open_with_cancel - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EAknNoteProgressBar; - control= AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_gen_note_opening; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_eject_confirm_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - bmpfile = AVKON_ICON_FILE; - bmpid = EMbmAvkonQgn_note_info; - bmpmask = EMbmAvkonQgn_note_info_mask; - animation = R_QGN_NOTE_INFO_ANIM; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_wait_note_process - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EAknNoteProgressBar; - control= AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_gen_note_processing; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -RESOURCE DIALOG r_file_receive_dialog - { - flags = EAknProgressNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items= - { - DLG_LINE - { - type = EAknCtNote; - id = EAknNoteProgressBar; - control= AVKON_NOTE - { - layout = EProgressLayout; - singular_label = qtn_ir_connecting; - plural_label = ""; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_progress_note_with_cancel - { - flags = EAknProgressNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items= - { - DLG_LINE - { - type = EAknCtNote; - id = EAknNoteProgressBar; - control= AVKON_NOTE - { - layout = EProgressLayout; - imagefile = AVKON_ICON_FILE; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_progress_note - { - flags = EAknProgressNoteFlags; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtNote; - id = EAknNoteProgressBar; - control= AVKON_NOTE - { - layout = EProgressLayout; - imagefile = AVKON_ICON_FILE; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_wait_note - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtNote; - id = EAknNoteProgressBar; - control= AVKON_NOTE - { - layout = EWaitLayout; - imagefile = AVKON_ICON_FILE; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_drive_name_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control= AVKON_DATA_QUERY - { - layout = EDataLayoutAllowEmptyInput; - //label = qtn_memc_name_prompt; - label = qtn_fmgr_memory_name_prompt; - control = EDWIN - { - flags = EEikEdwinNoHorizScrolling|EEikEdwinOnlyASCIIChars; - avkon_flags = EAknEditorFlagLatinInputModesOnly; - maxlength = 11; // FAT limitation for volume name - }; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_drive_name_query_non_western - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control= AVKON_DATA_QUERY - { - layout = EDataLayoutAllowEmptyInput; - //label = qtn_memc_name_prompt; - label = qtn_fmgr_memory_name_prompt; - control = EDWIN - { - flags = EEikEdwinNoHorizScrolling; - // Unicode chars take 2 bytes, only 5 chars fit to the name - maxlength = 5; - }; - }; - } - }; - } - -RESOURCE CBA r_filemanager_softkeys_options_exit__open - { - buttons = - { - CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, - CBA_BUTTON { id = EAknSoftkeyExit; txt = text_softkey_exit; }, - CBA_BUTTON { id = EFileManagerSelectionKey; txt = qtn_msk_open; } - }; - } - -RESOURCE CBA r_filemanager_softkeys_options_exit__open_embedded - { - buttons = - { - CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, - CBA_BUTTON { id = EAknSoftkeyExit; txt = text_softkey_back; }, - CBA_BUTTON { id = EFileManagerSelectionKey; txt = qtn_msk_open; } - }; - } - -RESOURCE CBA r_filemanager_softkeys_options_back__open - { - buttons = - { - CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, - CBA_BUTTON { id = EAknSoftkeyBack; txt = text_softkey_back; }, - CBA_BUTTON { id = EFileManagerSelectionKey; txt = qtn_msk_open; } - }; - } - -RESOURCE CBA r_filemanager_softkeys_options_back__empty - { - buttons = - { - CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, - CBA_BUTTON { id = EAknSoftkeyBack; txt = text_softkey_back; }, - CBA_BUTTON { id = EAknSoftkeyEmpty; txt = text_softkey_empty; } - }; - } - -RESOURCE CBA r_filemanager_softkeys_context_options_back__options - { - buttons = - { - CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option;}, - CBA_BUTTON { id = EAknSoftkeyBack; txt = text_softkey_back; }, - CBA_BUTTON { id = EAknSoftkeyContextOptions; txt = text_softkey_option; } - }; - } - -RESOURCE CBA r_filemanager_softkeys_options_back__change - { - buttons = - { - CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, - CBA_BUTTON { id = EAknSoftkeyBack; txt = text_softkey_back; }, - CBA_BUTTON { id = EFileManagerSelectionKey; txt = qtn_msk_change; } - }; - } - - -RESOURCE TBUF r_qtn_fmgr_search_not_found { buf = qtn_fmgr_search_not_found; } -RESOURCE TBUF r_qtn_selec_empty_list { buf = qtn_selec_empty_list; } -RESOURCE TBUF r_qtn_query_common_conf_delete { buf = qtn_query_common_conf_delete; } -RESOURCE TBUF r_qtn_fldr_del_items_query { buf = qtn_fldr_del_items_query; } -RESOURCE TBUF r_qtn_fldr_del_full_fldrs_query { buf = qtn_fldr_del_full_fldrs_query; } -RESOURCE TBUF r_qtn_fmgr_error_unsupport { buf = qtn_fmgr_error_unsupport; } -RESOURCE TBUF r_qtn_fmgr_error_cant_open { buf = qtn_fmgr_error_cant_open; } -RESOURCE TBUF r_qtn_fmgr_error_del_def_fldr { buf = qtn_fmgr_error_del_def_fldr; } -RESOURCE TBUF r_qtn_fmgr_error_delete_file_open { buf = qtn_fmgr_error_delete_file_open; } -RESOURCE TBUF r_qtn_fmgr_find_dataq_prtx { buf = qtn_fmgr_find_dataq_prtx; } -RESOURCE TBUF r_qtn_memc_mainpage_error1 { buf = qtn_memc_mainpage_error1; } -RESOURCE TBUF r_qtn_memc_mainpage_error2 { buf = qtn_memc_mainpage_error2; } -RESOURCE TBUF r_qtn_memc_mainpage_error3 { buf = qtn_memc_mainpage_error3; } -RESOURCE TBUF r_qtn_memc_mainpage_error4 { buf = qtn_memc_mainpage_error4; } -RESOURCE TBUF r_qtn_fldr_overwrite_query { buf = qtn_fldr_overwrite_query; } -RESOURCE TBUF r_qtn_fldr_rename_query { buf = qtn_fldr_rename_query; } - -RESOURCE TBUF r_qtn_ir_connecting { buf = qtn_ir_connecting; } -RESOURCE TBUF r_qtn_fmgr_note_receive_ir { buf = qtn_fmgr_note_receive_ir; } -RESOURCE TBUF r_qtn_fmgr_mstate_heading { buf = qtn_fmgr_mstate_heading; } -RESOURCE TBUF r_qtn_fmgr_error_del_fldr_open_1 { buf = qtn_fmgr_error_del_fldr_open_1; } -RESOURCE TBUF r_qtn_fmgr_error_del_fldr_open_se { buf = qtn_fmgr_error_del_fldr_open_se; } -RESOURCE TBUF r_qtn_fldr_cant_delete_fldr_open { buf = qtn_fldr_cant_delete_fldr_open; } -RESOURCE TBUF r_qtn_options_send_via { buf = qtn_options_send_via; } -RESOURCE TBUF r_qtn_fldr_item_cannot_be_moved { buf = qtn_fldr_item_cannot_be_moved; } -RESOURCE TBUF r_qtn_fmgr_find_prtx { buf = qtn_fmgr_find_prtx; } -RESOURCE TBUF r_text_softkey_back { buf = text_softkey_back; } -RESOURCE TBUF r_qtn_fldr_cant_rename_item { buf = qtn_fldr_cant_rename_item; } -RESOURCE TBUF r_qtn_fldr_item_cannot_be_copied { buf = qtn_fldr_item_cannot_be_copied; } -RESOURCE TBUF r_qtn_fldr_cant_delete_item { buf = qtn_fldr_cant_delete_item; } -RESOURCE TBUF r_qtn_drm_mos_deleted { buf = qtn_drm_mos_deleted; } -RESOURCE TBUF r_qtn_drm_mo_deleted { buf = qtn_drm_mo_deleted; } -RESOURCE TBUF r_qtn_memc_memorycard_read_only { buf = qtn_memc_memorycard_read_only; } - -#ifdef __KEEP_DRM_CONTENT_ON_PHONE -RESOURCE TBUF r_qtn_drm_info_move_one_forbid { buf = qtn_drm_info_move_one_forbid; } -RESOURCE TBUF r_qtn_drm_info_move_many_forbid { buf = qtn_drm_info_move_many_forbid; } -RESOURCE TBUF r_qtn_drm_info_copy_one_forbid { buf = qtn_drm_info_copy_one_forbid; } -RESOURCE TBUF r_qtn_drm_info_copy_many_forbid { buf = qtn_drm_info_copy_many_forbid; } -RESOURCE TBUF r_qtn_drm_info_move_folder_forbid { buf = qtn_drm_info_move_folder_forbid; } -RESOURCE TBUF r_qtn_drm_info_copy_folder_forbid { buf = qtn_drm_info_copy_folder_forbid; } -RESOURCE TBUF r_qtn_drm_query_copy_forbidden { buf = qtn_drm_query_copy_forbidden; } -RESOURCE TBUF r_qtn_drm_query_move_forbidden { buf = qtn_drm_query_move_forbidden; } -#endif - -// Eject texts -RESOURCE TBUF r_qtn_conf_eject { buf = qtn_memc_conf_eject; } -RESOURCE TBUF r_qtn_wait_eject { buf = qtn_memc_wait_eject; } -RESOURCE TBUF r_qtn_info_eject { buf = qtn_memc_info_eject; } -// Rename texts -RESOURCE TBUF r_qtn_mmc_default_name { buf = qtn_memc_mmc_default_label; } -RESOURCE TBUF r_qtn_invalid_drive_name { buf = qtn_memc_name_note1; } -RESOURCE TBUF r_qtn_drive_name_changed { buf = qtn_memc_name_note2; } -// Completed texts -RESOURCE TBUF r_qtn_backup_completed { buf = qtn_memc_backup_completed; } -RESOURCE TBUF r_qtn_restore_completed { buf = qtn_memc_restore_completed; } -RESOURCE TBUF r_qtn_format_completed { buf = qtn_memc_format_completed; } -// Confirm texts -RESOURCE TBUF r_qtn_confirm_backup_text { buf = qtn_memc_backup_query1; } -RESOURCE TBUF r_qtn_confirm_backup_text2 { buf = qtn_memc_backup_query2; } -RESOURCE TBUF r_qtn_confirm_restore_text { buf = qtn_memc_restore_query1; } -RESOURCE TBUF r_qtn_confirm_format_text { buf = qtn_memc_format_query1; } -RESOURCE TBUF r_qtn_confirm_backup_level1 { buf = qtn_memc_backup_query3; } -RESOURCE TBUF r_qtn_confirm_format_text2 { buf = qtn_memc_format_query2; } -// Error texts -RESOURCE TBUF r_qtn_files_not_backupped { buf = qtn_memc_backup_info1; } -RESOURCE TBUF r_qtn_one_file_not_backupped { buf = qtn_memc_backup_info2; } -RESOURCE TBUF r_qtn_files_not_restored { buf = qtn_memc_restore_info1; } -RESOURCE TBUF r_qtn_one_file_not_restored { buf = qtn_memc_restore_info2; } -RESOURCE TBUF r_qtn_backup_no_space { buf = qtn_memc_backup_enoughspace; } -RESOURCE TBUF r_qtn_restore_no_space { buf = qtn_memc_restore_enoughspace; } -RESOURCE TBUF r_qtn_corrupt { buf = qtn_memc_memorycard_error; } -RESOURCE TBUF r_qtn_memorycard_readonly { buf = qtn_memc_memorycard_read_only; } -RESOURCE TBUF r_qtn_critical_error { buf = qtn_memc_gen_error; } -RESOURCE TBUF r_qtn_format_files_in_use { buf = qtn_memc_format_card_used; } -// Password texts -RESOURCE TBUF r_qtn_passwords_wrong_text { buf = qtn_memc_change_pwd_error1; } -RESOURCE TBUF r_qtn_unlock_pwd_wrong_text { buf = qtn_memc_unlock_pwd_error; } -RESOURCE TBUF r_qtn_password_set_text { buf = qtn_memc_set_password_info; } -RESOURCE TBUF r_qtn_password_changed_text { buf = qtn_memc_change_pwd_info; } -RESOURCE TBUF r_qtn_password_text { buf = qtn_memc_remove_pwd_prompt; } -RESOURCE TBUF r_qtn_unlock_password_text { buf = qtn_memc_unlock_pwd_prompt; } -RESOURCE TBUF r_qtn_password_old_text { buf = qtn_memc_change_pwd_prompt1; } -RESOURCE TBUF r_qtn_password_remove_text { buf = qtn_memc_remove_pwd_query; } -RESOURCE TBUF r_qtn_password_removed_text { buf = qtn_memc_remove_pwd_info; } -// Progress texts -RESOURCE TBUF r_qtn_format_inprogress { buf = qtn_memc_format_inprogress; } -RESOURCE TBUF r_qtn_backup_inprogress { buf = qtn_memc_backup_inprogress; } -RESOURCE TBUF r_qtn_restore_inprogress { buf = qtn_memc_restore_inprogress; } -// Remote storage error texts -RESOURCE TBUF r_qtn_rd_query_delete_drive { buf = qtn_rd_query_delete_drive; } -RESOURCE TBUF r_qtn_fmgr_empty_remote_drive { buf = qtn_fmgr_empty_remote_drive; } -RESOURCE TBUF r_qtn_fmgr_infonote_unable_open_remotely - { buf = qtn_fmgr_infonote_unable_open_remotely; } -RESOURCE TBUF r_qtn_rd_error_max_drives { buf = qtn_rd_error_max_drives; } - -#ifdef RD_FILE_MANAGER_BACKUP -RESOURCE TBUF r_qtn_fmgr_backup_title { buf = qtn_fmgr_backup_title; } -RESOURCE TBUF r_qtn_fmgr_backup_contents { buf = qtn_fmgr_backup_contents; } -RESOURCE TBUF r_qtn_fmgr_backup_scheduling { buf = qtn_fmgr_backup_scheduling; } -RESOURCE TBUF r_qtn_fmgr_backup_weekday { buf = qtn_fmgr_backup_weekday; } -RESOURCE TBUF r_qtn_fmgr_backup_time { buf = qtn_fmgr_backup_time; } - -RESOURCE TBUF r_qtn_fmgr_backup_content_all { buf = qtn_fmgr_backup_content_all; } -RESOURCE TBUF r_qtn_fmgr_backup_content_selected { buf = qtn_fmgr_backup_content_selected; } -RESOURCE TBUF r_qtn_fmgr_backup_content_settings { buf = qtn_fmgr_backup_content_settings; } -RESOURCE TBUF r_qtn_fmgr_backup_content_messages { buf = qtn_fmgr_backup_content_messages; } -RESOURCE TBUF r_qtn_fmgr_backup_content_contacts { buf = qtn_fmgr_backup_content_contacts; } -RESOURCE TBUF r_qtn_fmgr_backup_content_calendar { buf = qtn_fmgr_backup_content_calendar; } -RESOURCE TBUF r_qtn_fmgr_backup_content_bookmarks { buf = qtn_fmgr_backup_content_bookmarks; } -RESOURCE TBUF r_qtn_fmgr_backup_content_userfiles { buf = qtn_fmgr_backup_content_userfiles; } - -RESOURCE TBUF r_qtn_fmgr_restore_title { buf = qtn_fmgr_restore_title; } -RESOURCE TBUF r_qtn_fmgr_restore_settings { buf = qtn_fmgr_restore_settings; } -RESOURCE TBUF r_qtn_fmgr_restore_messages { buf = qtn_fmgr_restore_messages; } -RESOURCE TBUF r_qtn_fmgr_restore_contacts { buf = qtn_fmgr_restore_contacts; } -RESOURCE TBUF r_qtn_fmgr_restore_calendar { buf = qtn_fmgr_restore_calendar; } -RESOURCE TBUF r_qtn_fmgr_restore_bookmarks { buf = qtn_fmgr_restore_bookmarks; } -RESOURCE TBUF r_qtn_fmgr_restore_userfiles { buf = qtn_fmgr_restore_userfiles; } - -RESOURCE TBUF r_qtn_fmgr_backup_no_scheduling { buf = qtn_fmgr_backup_no_scheduling; } -RESOURCE TBUF r_qtn_fmgr_backup_daily { buf = qtn_fmgr_backup_daily; } -RESOURCE TBUF r_qtn_fmgr_backup_weekly { buf = qtn_fmgr_backup_weekly; } - -RESOURCE TBUF r_qtn_fmgr_restore_no_backups { buf = qtn_fmgr_restore_no_backups; } -RESOURCE TBUF r_qtn_fmgr_restore_space_error { buf = qtn_fmgr_restore_space_error; } - -RESOURCE TBUF r_qtn_fmgr_scheduled_backup_query { buf = qtn_fmgr_scheduled_backup_query; } -RESOURCE TBUF r_qtn_fmgr_scheduled_backup_progress { buf = qtn_fmgr_scheduled_backup_progress; } -RESOURCE TBUF r_qtn_fmgr_backup_tight_memory { buf = qtn_fmgr_backup_tight_memory; } -RESOURCE TBUF r_qtn_fmgr_backup_destination_full { buf = qtn_fmgr_backup_destination_full; } -RESOURCE TBUF r_qtn_fmgr_select_backup_destination { buf = qtn_fmgr_select_backup_destination; } -RESOURCE TBUF r_qtn_fmgr_scheduled_backup_error { buf = qtn_fmgr_scheduled_backup_error; } -RESOURCE TBUF r_qtn_fmgr_backup_query_exists { buf = qtn_fmgr_backup_query_exists; } -RESOURCE TBUF r_qtn_fmgr_progress_preparing_backup { buf = qtn_fmgr_progress_preparing_backup; } -RESOURCE TBUF r_qtn_fmgr_backup_query { buf = qtn_fmgr_backup_query; } -RESOURCE TBUF r_qtn_fmgr_restore_query { buf = qtn_fmgr_restore_query; } - -RESOURCE TBUF r_qtn_fmgr_progress_preparing_restore { buf = qtn_fmgr_progress_preparing_restore; } -RESOURCE TBUF r_qtn_fmgr_error_corrupted_backup_file - { buf = qtn_fmgr_error_corrupted_backup_file; } -RESOURCE TBUF r_qtn_fmgr_error_backup_memorycard_not_available - { buf = qtn_fmgr_error_backup_memorycard_not_available; } - -#endif // RD_FILE_MANAGER_BACKUP - -RESOURCE TBUF r_qtn_fldr_name_prmpt { buf = qtn_fldr_name_prmpt; } -RESOURCE TBUF r_qtn_fldr_item_name_prmpt { buf = qtn_fldr_item_name_prmpt; } - -#ifdef RD_MULTIPLE_DRIVE -RESOURCE TBUF r_qtn_memc_mass_storage_corrupted { buf = qtn_memc_mass_storage_corrupted; } -RESOURCE TBUF r_qtn_memc_mass_storage_in_use { buf = qtn_memc_mass_storage_in_use; } -RESOURCE TBUF r_qtn_memc_not_available { buf = qtn_memc_not_available; } - -RESOURCE TBUF r_qtn_memc_conf_eject_multiple { buf = qtn_memc_conf_eject_multiple; } -RESOURCE TBUF r_qtn_memc_conf_eject_multiple_defaultname { buf = qtn_memc_conf_eject_multiple_defaultname; } - -RESOURCE TBUF r_qtn_memc_info_eject_multiple { buf = qtn_memc_info_eject_multiple; } -RESOURCE TBUF r_qtn_memc_info_eject_multiple_defaultname { buf = qtn_memc_info_eject_multiple_defaultname; } - -RESOURCE TBUF r_qtn_memc_unlock_password_multiple { buf = qtn_memc_unlock_password_multiple; } -RESOURCE TBUF r_qtn_memc_unlock_password_multiple_defaultname { buf = qtn_memc_unlock_password_multiple_defaultname; } - -RESOURCE TBUF r_qtn_memc_multiple_memc_read_only { buf = qtn_memc_multiple_memc_read_only; } -RESOURCE TBUF r_qtn_memc_memory_card_corrupted_multiple { buf = qtn_memc_memory_card_corrupted_multiple; } - -RESOURCE TBUF r_qtn_fmgr_format_mass_query1 { buf = qtn_fmgr_format_mass_query1; } -RESOURCE TBUF r_qtn_fmgr_mass_format_inprogress { buf = qtn_fmgr_mass_format_inprogress; } -RESOURCE TBUF r_qtn_fmgr_mass_format_completed { buf = qtn_fmgr_mass_format_completed; } -RESOURCE TBUF r_qtn_fmgr_format_mass_query2 { buf = qtn_fmgr_format_mass_query2; } -#endif // RD_MULTIPLE_DRIVE - -RESOURCE TBUF r_qtn_fmgr_scheduled_backup_cancelled_ps { buf = qtn_fmgr_scheduled_backup_cancelled_ps; } - -RESOURCE TBUF r_qtn_fmgr_free_memory_var_units { buf = qtn_fmgr_free_memory_var_units; } -RESOURCE TBUF r_qtn_fmgr_units_byte { buf = qtn_fmgr_units_byte; } -RESOURCE TBUF r_qtn_fmgr_units_kilobyte { buf = qtn_fmgr_units_kilobyte; } -RESOURCE TBUF r_qtn_fmgr_units_megabyte { buf = qtn_fmgr_units_megabyte; } -RESOURCE TBUF r_qtn_fmgr_units_gigabyte { buf = qtn_fmgr_units_gigabyte; } - -RESOURCE TBUF r_qtn_memlo_not_enough_memory_card_name { buf = qtn_memlo_not_enough_memory_card_name; } -RESOURCE TBUF r_qtn_memlo_not_enough_memory_card_defaultname { buf = qtn_memlo_not_enough_memory_card_defaultname; } -RESOURCE TBUF r_qtn_memlo_not_enough_mass_memory { buf = qtn_memlo_not_enough_mass_memory; } -RESOURCE TBUF r_qtn_memlo_not_enough_device_memory { buf = qtn_memlo_not_enough_device_memory; } - -RESOURCE TBUF r_qtn_fmgr_confirm_memory_name_changed { buf = qtn_fmgr_confirm_memory_name_changed; } -RESOURCE TBUF r_qtn_fmgr_usb_memory_format_query { buf = qtn_fmgr_usb_memory_format_query; } -RESOURCE TBUF r_qtn_fmgr_formatting_memory_progress { buf = qtn_fmgr_formatting_memory_progress; } -RESOURCE TBUF r_qtn_fmgr_memory_in_use_format { buf = qtn_fmgr_memory_in_use_format; } -RESOURCE TBUF r_qtn_fmgr_delete_backup_title { buf = qtn_fmgr_delete_backup_title; } -RESOURCE TBUF r_qtn_fmgr_delete_backup_query { buf = qtn_fmgr_delete_backup_query; } -RESOURCE TBUF r_qtn_fmgr_usb_memory_default_name { buf = qtn_fmgr_usb_memory_default_name; } - -RESOURCE TBUF r_qtn_fmgr_system_not_ready { buf = qtn_hs_operation_failed_no_disk ; } -RESOURCE TBUF r_qtn_fmgr_file_size_too_large { buf = qtn_http_err_413; } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/data/FileManager_reg.rss --- a/filemanager/App/data/FileManager_reg.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2004-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 for project FileManager -* -*/ - - -#include -#include -#include -#include "FileManagerUID.h" - -UID2 KUidAppRegistrationResourceFile -UID3 KFileManagerUID3 - -RESOURCE APP_REGISTRATION_INFO - { - app_file = "FileManager"; - localisable_resource_file = APP_RESOURCE_DIR"\\FileManager"; - localisable_resource_id = R_FILEMANAGER_LOCALISABLE_APP_INFO; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/data/filemanager_caption.rss --- a/filemanager/App/data/filemanager_caption.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2002-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 for project FileManager -* -*/ - - -// RESOURCE IDENTIFIER -NAME FMGC // 4 letter ID - -// INCLUDES -#include -#include - - -// RESOURCE DEFINITIONS -// --------------------------------------------------------- -// -// CAPTION_DATA -// Long and short caption for File Mgr app. -// -// --------------------------------------------------------- -// -RESOURCE CAPTION_DATA - { - caption = qtn_apps_fmgr_list; - shortcaption = qtn_apps_fmgr_grid; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerAppUi.h --- a/filemanager/App/inc/CFileManagerAppUi.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,422 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Manager application UI class -* -*/ - - - -#ifndef CFILEMANAGERAPPUI_H -#define CFILEMANAGERAPPUI_H - -// INCLUDES -#include // CAknViewAppUi -#include -#include - -#include "MFileManagerSchBackupObserver.h" - -// FORWARD DECLARATIONS -class CAknNavigationControlContainer; -class CAknTitlePane; -class CAknNavigationDecorator; -class CSendUi; -class CAiwGenericParamList; -class CFileManagerIRReceiver; -class MFileManagerProcessObserver; -class CFileManagerTaskScheduler; -class CFileManagerSchBackupHandler; - - -// CLASS DECLARATION -/** - * FileManager application UI class. - * An object of this class is created by the Symbian OS framework by a call to - * CFileManagerDocument::CreateAppUiL(). The application UI object creates - * and owns the application's views and handles system commands selected - * from the menu. - */ -class CFileManagerAppUi : public CAknViewAppUi, - public MCoeForegroundObserver, - public MFileManagerSchBackupObserver - { - public: // Constants and types - static const TUid KFileManagerMainViewId; - static const TUid KFileManagerMemoryStoreViewId; - static const TUid KFileManagerFoldersViewId; - static const TUid KFileManagerSearchResultsViewId; - static const TUid KFileManagerBackupViewId; - static const TUid KFileManagerRestoreViewId; - - public: // Constructors and destructor - /** - * Standard C++ constructor. - */ - CFileManagerAppUi(); - - /** - * Destructor. - */ - ~CFileManagerAppUi(); - - /** - * Constructs the CFileManagerAppUi class. - */ - void ConstructL(); - - public: - /** - * Activates folders view if it is not already - * activated. - * @since 2.0 - * @return ETrue if activated - * EFalse if view already activated - */ - TBool ActivateFoldersViewL(); - - /** - * Closes folders view and goes back to view in which the - * application was before folders view was activated. - * @since 2.0 - */ - void CloseFoldersViewL(); - - /** - * Activates search results view if it is not already - * activated. - * @since 2.0 - */ - void ActivateSearchResultsViewL(); - - /** - * Closes search results view and goes back to view in which - * the application was before search results view was - * activated - * @since 2.0 - */ - void CloseSearchResultsViewL(); - - /** - * Restores the default title of application to title pane. - * @since 2.0 - */ - void RestoreDefaultTitleL(); - /** - * Returns the CSendUi2 of this application. - * - * @since 3.0 - * @return The CSendUi2 of this application. - */ - CSendUi& SendUiL(); - /** - * This is called if resource is changed. Needed for skin feature - * - * @since 2.0 - */ - void HandleResourceChangeL(TInt aType); - - /** - * Is application foreground - * - * @since 2.0 - * @return ETrue if application is foreground - * EFalse if application is not foreground - */ - TBool IsFmgrForeGround(); - - /** - * Activates main view - * activated. - * @since 3.1 - */ - void ActivateMainViewL(); - - /** - * Activates memory store view - * activated. - * @since 3.1 - */ - void ActivateMemoryStoreViewL(); - - /** - * Closes memory store view and goes back to main view - * @since 3.1 - */ - void CloseMemoryStoreViewL(); - - /** - * Gets reference to drive info - * @since 3.1 - */ - TFileManagerDriveInfo& DriveInfo(); - - /** - * Activates remote drive settings view - * @since 3.1 - */ - void ActivateRemoteDriveSettingsViewL( - const TDesC& aDriveName = KNullDesC ); - -#ifdef RD_FILE_MANAGER_BACKUP - /** - * Activates backup view if not already active - * @since 3.1 - */ - void ActivateBackupViewL(); - - /** - * Closes backup view and goes back to main view - * @since 3.1 - */ - void CloseBackupViewL(); - - /** - * Activates restore view if not already active - * - * @since 3.1 - * @param aDeleteBackup Indicates if delete backup selection is used. - */ - void ActivateRestoreViewL( TBool aDeleteBackup = EFalse ); - - /** - * Closes restore view and goes back to backup view - * @since 3.1 - */ - void CloseRestoreViewL(); - - /** - * Starts scheduled backup - */ - void StartSchBackupL(); - - /** - * Gets task scheduler - */ - CFileManagerTaskScheduler& TaskSchedulerL(); - - /** - * Gets scheduled backup handler - */ - CFileManagerSchBackupHandler& SchBackupHandlerL(); -#endif // RD_FILE_MANAGER_BACKUP - - /** - * Activates IR receive - * @since 3.1 - */ - void StartIRReceiveL( MFileManagerProcessObserver& aObserver ); - - /** - * Stops IR receive - * @since 3.1 - */ - void StopIRReceive(); - - /** - * Sets title - * @since 3.1 - */ - void SetTitleL( const TDesC& aTitle ); - - /** - * Sets title - * @since 3.1 - */ - void SetTitleL( const TInt aTitle ); - - /** - * Checks if view is file manager based view - * @since 3.1 - */ - TBool IsFileManagerView( const TUid aViewUid ); - - /** - * Informs active view to update its cba - * @since 3.2 - */ - void NotifyCbaUpdate(); - - /** - * Processes AIW input parameters - * @since 5.0 - */ - void ProcessAiwParamListL( const CAiwGenericParamList& aInParams ); - - /** - * Indicates are all required input params received - * @since 5.0 - */ - TBool WaitingForInputParams() const; - - /** - * Exits the embedded open application if needed - * @since 5.0 - */ - void ExitEmbeddedAppIfNeededL(); - - /** - * Checks is search view open - * @since 5.0 - */ - TBool IsSearchViewOpen() const; - - /** - * Save the time when backup/restore started. - * @since 5.0 - */ - void BackupOrRestoreStarted(); - - /** - * Save the time when backup/restore ended. - * @since 5.0 - */ - void BackupOrRestoreEnded(); - - /** - * Returns the time when backup/restore started. - * @since 5.0 - */ - TTime BackupOrRestoreStartTime() const; - - /** - * Returns the time when backup/restore ended. - * @since 5.0 - */ - TTime BackupOrRestoreEndTime() const; - - /** - * Resets the time when backup/restore start and end times. - * @since 5.0 - */ - void ResetBackupOrRestoreEndTime(); - - /** - * after startup finish, the system state will get normal, backup/restore need check the status before get started. - * @since 5.2 - * @return ETrue if system state is normal, EFalse if not - */ - TBool IsSystemStateNormal() const; - - public: // MCoeForegroundObserver - - /** Handles the application coming to the foreground. */ - void HandleGainingForeground(); - /** Handles the application going into the background. */ - void HandleLosingForeground(); - - public: // From CAknViewAppUi - /** - * @see CAknViewAppUi - */ - void HandleViewDeactivation( const TVwsViewId &aViewIdToBeDeactivated, - const TVwsViewId &aNewlyActivatedViewId ); - - /** - * @see CAknViewAppUi - */ - void HandleCommandL( TInt aCommand ); - - /** - * From CAknViewAppUi, called when screen layout changes - */ - void HandleScreenDeviceChangedL(); - - /** - * @see CAknViewAppUi - */ - TErrorHandlerResponse HandleError( TInt aError, - const SExtendedError& aExtErr, TDes& aErrorText, TDes& aContextText ); - - /** - * @see CAknViewAppUi - */ - TBool ProcessCommandParametersL( - TApaCommand aCommand, - TFileName& aDocumentName, - const TDesC8& aTail ); - -#ifdef RD_FILE_MANAGER_BACKUP - /** - * @see CAknViewAppUi - */ - void ProcessMessageL( TUid aUid, const TDesC8& aParams ); -#endif // RD_FILE_MANAGER_BACKUP - - public: // From MFileManagerSchBackupObserver - /** - * @see MFileManagerSchBackupObserver - */ - void SchBackupFinishedL( TInt aError ); - - private: - /** Deletes IR receive after timeout. */ - static TInt DeleteIRReceiveCB( TAny* aPtr ); - - /** Informs active view when screen device has changed. */ - void NotifyViewScreenDeviceChanged(); - - void SetFolderToOpenAtStartup( - const TDesC& aFullPath, TInt aSortMode ); - - void OpenFolderViewAtStartupL(); - - void CreateAndActivateLocalViewL( - TUid aViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage ); - - void CreateAndActivateLocalViewL( TUid aViewId ); - - private: // Data - /// Ref: Title pane of the application - CAknTitlePane* iTitlePane; - // Own: CSendAppUi for send menu item and sending files - CSendUi* iSendUi; - /// Uid of currently active view - TUid iActiveView; - /// Flag to indicate if search view is open - TBool iSearchViewOpen; - // For some reason IsForeGround() does not return correct state of the application - // so own boolean is updated according MCoeForegroundObserver callbacks. - TBool iForeGround; - // Own: Infrared receiver for receive via IR functionality - CFileManagerIRReceiver* iIRReceiver; - // Own: Callback to delete CFileManagerIrReceiver - CAsyncCallBack* iIRDeleteCB; - // Own: Drive info - TFileManagerDriveInfo iDriveInfo; - // Task scheduler - CFileManagerTaskScheduler* iTaskScheduler; - // Handler for scheduled backup - CFileManagerSchBackupHandler* iSchBackupHandler; - // Flag to indicate if started for scheduled backup only - TBool iSchBackupStandalone; - // Indicates the folder to be opened at startup - TFileName iFolderToOpenAtStartup; - // Indicates the folder level at startup when the app is embedded - TInt iInitialFolderLevel; - // Indicates the parameter ready status - TBool iWaitingForParams; - - // Own: Stores the start time - TTime iManualBackupOrRestoreStarted; - // Own: Stores the end time - TTime iManualBackupOrRestoreEnded; - - // State aware session. - RSsmStateAwareSession iSAS; - - }; - -#endif // CFILEMANAGERAPPUI_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerApplication.h --- a/filemanager/App/inc/CFileManagerApplication.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* -* Copyright (c) 2002-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: File Manager application class -* -*/ - - -#ifndef CFILEMANAGERAPP_H -#define CFILEMANAGERAPP_H - -// INCLUDES -#include // CAknApplication - -// CLASS DECLARATION - -/** - * FileManager application class. - * This class is created by the Symbian OS framework by a call to - * NewApplication() function when the application is started. The - * main purpose of the application class is to create the - * application-specific document object (CFileManagerDocument in - * this case) via a call to virtual CreateDocumentL(). - */ -class CFileManagerApplication : public CAknApplication - { - public: // Constructors and destructor - - /** - * Standard C++ constructor. - */ - CFileManagerApplication(); - - /** - * Destructor. - */ - ~CFileManagerApplication(); - - public: // From CAknApplication - /** - * Creates the FileManager document object (CFileManagerDocument). - * Called by the application framework. - * - * @return New FileManager document object (CFileManagerDocument). - */ - CApaDocument* CreateDocumentL(); - - /** - * @return the UID of this application. - */ - TUid AppDllUid() const; - - }; - -#endif // CFILEMANAGERAPP_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerBackupView.h --- a/filemanager/App/inc/CFileManagerBackupView.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* -* Copyright (c) 2002-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: View for backup settings -* -*/ - - - -#ifndef C_FILEMANAGERBACKUPVIEW_H -#define C_FILEMANAGERBACKUPVIEW_H - - -// INCLUDES -#include -#include "CFileManagerViewBase.h" - - -// CLASS DECLARATION -/** - * This class is used for backup settings view - * - * @since S60 3.1 - */ -class CFileManagerBackupView : public CFileManagerViewBase - { - -public: // Constructors and destructor - /** - * Two-phased constructor.Leaves created view - * to cleanup stack. - * - * @return Newly constructed view - */ - static CFileManagerBackupView* NewLC(); - - /** - * Destructor. - */ - ~CFileManagerBackupView(); - -public: // From CFileManagerViewBase - /** - * @see CFileManagerViewBase - */ - void DirectoryChangedL(); - - /** - * @see CFileManagerViewBase - */ - CFileManagerContainerBase* CreateContainerL(); - - /** - * @see CFileManagerViewBase - */ - void NotifyForegroundStatusChange( TBool aForeground ); - -private: // From CAknView - /** - * @see CAknView - */ - void DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * @see CAknView - */ - void DoDeactivate(); - - /** - * @see CAknView - */ - TUid Id() const; - - /** - * @see CAknView - */ - void HandleCommandL( TInt aCommand ); - - /** - * @see CAknView - */ - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - -private: // New functions - /** - * Handles change command - */ - void CmdChangeL(); - - /** - * Handles backup command - */ - void CmdBackupL(); - - /** - * Handles restore command - */ - void CmdRestoreL(); - - /** - * Changes backup contents - */ - void ChangeContentsL(); - - /** - * Changes backup scheduling - */ - void ChangeSchedulingL(); - - /** - * Changes backup weekday - */ - void ChangeWeekdayL(); - - /** - * Changes backup time - */ - void ChangeTimeL(); - - /** - * Changes backup target drive - */ - void ChangeTargetDriveL(); - - /** - * Handles command back - */ - void CmdBackL(); - - /** - * Updates schedule state - */ - void UpdateScheduleL(); - - /** - * Refreshes all settings - */ - void RefreshSettingsL(); - - /** - * Handles delete backup command - */ - void CmdDeleteBackupL(); - - /** - * Filters backup menu items. - * - * @param aMenuPane Menu instance to be filtered. - */ - void BackupMenuFilteringL( CEikMenuPane& aMenuPane ); - -private: - /** - * C++ default constructor. - */ - CFileManagerBackupView(); - -private: // Data - - }; - -#endif // C_FILEMANAGERBACKUPVIEW_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerContainerBase.h --- a/filemanager/App/inc/CFileManagerContainerBase.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,275 +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: Base class for all file manager containers -* -*/ - - -#ifndef CFILEMANAGERCONTAINERBASE_H -#define CFILEMANAGERCONTAINERBASE_H - - -// INCLUDES -#include -#include -#include -#include - - -// FORWARD DECLARATIONS -class CEikTextListBox; - - -// CLASS DECLARATION -/** - * Base class for all containers in File Manager - */ -class CFileManagerContainerBase : public CCoeControl, - public MEikListBoxObserver, - public MCoeControlObserver, - public MEikCommandObserver, - public MListBoxSelectionObserver - { - public: // destructor - /** - * Destructor. - */ - ~CFileManagerContainerBase(); - - protected: // MEikListBoxObserver - void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); - - protected: // MCoeControlObserver - void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ); - - protected: // From CCoeControl - /** - * @see CCoeControl - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - - /** - * @see CCoeControl - */ - void SizeChanged(); - - /** - * @see CCoeControl - */ - TInt CountComponentControls() const; - - /** - * @see CCoeControl - */ - CCoeControl* ComponentControl( TInt aIndex ) const; - - /** - * @see CCoeControl - */ - void FocusChanged( TDrawNow aDrawNow ); - - /** - * @see CCoeControl - */ - void GetHelpContext( TCoeHelpContext& aContext ) const; - - public: // From MEikCommandObserver - /** - * @see MEikCommandObserver - */ - void ProcessCommandL( TInt aCommandId ); - - public: // New functions - /** - * Sets list empty and removes empty text until refreshed. - */ - virtual void SetListEmptyL(); - - /** - * Stores the focus, so when control is reseted, focus can - * be set back to current position. - * - * @param aFocusedIndex index to be stored - */ - void SetIndex( TInt aFocusedIndex ); - - /** - * Sets text array. - */ - void SetTextArray( MDesCArray* aArray ); - - /** - * Sets help context. - */ - void SetHelpContext( const TDesC& aHelpContext ); - - /** - * Sets empty text. - */ - void SetEmptyTextL( TInt aTextId ); - - /** - * Refreshes the container. - * @param aFocusedIndex Index of the item that will be focused - * after refresh. - */ - virtual void RefreshListL( TInt aFocusedIndex ); - - /** - * Gets selection mode status - */ - TBool SelectionModeEnabled() const; - - /** - * Updates cba - */ - virtual void UpdateCba(); - - /** - * Gets index of current list item - * @return Index of current list item or KErrNotFound if list is empty. - */ - virtual TInt ListBoxCurrentItemIndex(); - - /** - * Gets number of list items - * @return Number of list items. - */ - virtual TInt ListBoxNumberOfItems(); - - /** - * Gets indexes of selection - * @return Array of selected indexes. Ownership is not transferred. - */ - virtual const CArrayFix< TInt >* ListBoxSelectionIndexes(); - - /** - * Gets number of selected list items - * @return Number of selected list items. - */ - virtual TInt ListBoxSelectionIndexesCount(); - - /** - * Toggles list item selection status - * @param aIndex Index of list item. - */ - virtual void ListBoxToggleItemL( TInt aIndex ); - - /** - * Checks list item selection status - * @param aIndex Index of list item. - * @return ETrue if item is selected. Otherwise EFalse. - */ - virtual TBool ListBoxIsItemSelected( TInt aIndex ); - - /** - * Selects all list items - */ - virtual void ListBoxSelectAllL(); - - /** - * Clears list selection - */ - virtual void ListBoxClearSelection(); - - /** - * Sets text showm in empty list view. - * @param aText Text to be shown - */ - virtual void ListBoxSetTextL( const TDesC& aText ); - - /** - * Checks is search field visible - * @return ETrue if search field is visible. Otherwise EFalse. - */ - virtual TBool IsSearchFieldVisible() const; - - /** - * Enables and disables the search field. - * @param aEnable New status of search field. - * @param aSearchText Text to search - */ - virtual void EnableSearchFieldL( - TBool aEnable, const TDesC& aSearchText = KNullDesC ); - - /** - * Sets current item index after search - * @param aIndex Current item index. - */ - virtual void SetCurrentItemIndexAfterSearch( TInt aIndex ); - - /** - * Selects list item - * @param aIndex Index of list item. - */ - virtual void ListBoxSelectItemL( TInt aIndex ); - - /** - * Deselects list item - * @param aIndex Index of list item. - */ - virtual void ListBoxDeselectItem( TInt aIndex ); - - /** - * - * - */ - virtual void ListBoxSetSelectionIndexesL(const CArrayFixFlat* - aSelectionIndexes); - /** - * search filed index to listbox index - * @param aIndex index in search filed - * @return index in listbox - */ - virtual TInt SearchFieldToListBoxIndex( TInt aIndex ); - protected: - /** - * Standard C++ constructor. - */ - CFileManagerContainerBase(); - - virtual void ConstructL( - const TRect& aRect, - const TInt aFocusedIndex ); - - virtual CEikTextListBox* CreateListBoxL() = 0; - - TBool ListBoxExists() const; - - CEikListBox& ListBox(); - - private: // From MListBoxSelectionObserver - void SelectionModeChanged( - CEikListBox* aListBox, TBool aSelectionModeEnabled ); - - private: - void SetEmptyArrayL(); - - private: // Data - // Own: Pointer to listbox - CEikTextListBox* iListBox; - // Own: Help context name - TCoeContextName iHelpContext; - // Own: Empty text - HBufC* iEmptyText; - // Ref: Pointer to text array - MDesCArray* iArray; - // Own: Stores selection mode status - TBool iSelectionModeEnabled; - - }; - -#endif // CFILEMANAGERCONTAINERBASE_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerDocument.h --- a/filemanager/App/inc/CFileManagerDocument.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Document class of the file manager -* -*/ - - - -#ifndef CFILEMANAGERDOCUMENT_H -#define CFILEMANAGERDOCUMENT_H - -// INCLUDES -#include -#include // RConeResourceLoader -#include - - -// FORWARD DECLARATIONS -class CFileManagerIconArray; -class CFileManagerEngine; -class CFileManagerStringCache; - - -// CLASS DECLARATION -/** - * FileManager application document class. - * An object of this class is created by the Symbian OS framework by a call to - * CFileManagerApplication::CreateDocumentL(). - * The application framework creates the FileManager application UI object - * (CFileManagerAppUi) by a call to the virtual function CreateAppUiL(). - */ -class CFileManagerDocument : public CAiwGenericParamConsumer - { - - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CFileManagerDocument* NewL( CEikApplication& aApp ); - - /** - * Destructor. - */ - ~CFileManagerDocument(); - - public: // From CAiwGenericParamConsumer - CEikAppUi* CreateAppUiL(); - - void UpdateTaskNameL( CApaWindowGroupName* aWgName ); - - CFileStore* OpenFileL( TBool aDoOpen, const TDesC& aFilename, RFs& aFs ); - - public: // New methods - /** - * Returns the icon array of this application. - * - * @return The icon array of this application. - */ - CFileManagerIconArray* IconArray() const; - - /** - * Returns reference to engine of this application - * - * @return Reference to engine of this application - */ - CFileManagerEngine& Engine() const; - - /** - * Returns the model for listbox - * @return Return MDesCArray to current filelist - */ - MDesCArray* FileList() const; - - /** - * Clears the string cache - */ - void ClearStringCache(); - - /** - * Gets last error - */ - TInt LastError() const; - - /** - * Checks is app was launched for scheduled backup - */ - TBool IsScheduledBackup(); - - /** - * Stores ECOM plugins to be deleted with document - */ - void StorePluginL( const TUid& aUid ); - - private: - - /** - * Standard C++ constructor. - * - * @param aApp Application which this document belongs to. - */ - CFileManagerDocument( CEikApplication& aApp ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Deletes stored ECOM plugins - */ - void DeletePlugins(); - - private: // Data - /// Own: Engine of the application - CFileManagerEngine* iEngine; - /// Own: Icon array that contains all the icons used in listboxes. - CFileManagerIconArray* iIconArray; - /// Resource loader for view resources - RConeResourceLoader iViewResourceLoader; - /// Resource loader for engine resources - RConeResourceLoader iEngineResourceLoader; - // Own: For caching listbox strings - CFileManagerStringCache* iStringCache; - // Own: Stores loaded ECom plugin ids - RArray< TUid > iPluginArray; - - }; - -#endif // CFILEMANAGERDOCUMENT_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerFileListContainer.h --- a/filemanager/App/inc/CFileManagerFileListContainer.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File list container in file manager -* -*/ - - -#ifndef CFILEMANAGERFILELISTCONTAINER_H -#define CFILEMANAGERFILELISTCONTAINER_H - -// INCLUDES -#include "CFileManagerContainerBase.h" - -// FORWARD DECLARATIONS -class CFileManagerDocument; -class CFileManagerAppUi; -class CAknSearchField; - - -// CLASS DECLARATION -/** - * File list container in File Manager. - * Replaces old phone memory, memory card, folder and search specific - * containers. - */ -class CFileManagerFileListContainer : public CFileManagerContainerBase, - public MCoeFocusObserver - { - public: - enum TListType - { - EListMain = 0, // Main layout - EListMemoryStore, // Memory store (Phone memory etc) layout - EListFolder // Folder layout - }; - - static CFileManagerFileListContainer* - CFileManagerFileListContainer::NewL( - const TRect& aRect, - const TInt aFocusedIndex, - const TListType aType, - const TInt aEmptyText, - const TDesC& aHelpContext ); - - /** - * Destructor. - */ - ~CFileManagerFileListContainer(); - - private: // MCoeControlObserver - void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType); - - private: // From CCoeControl - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,TEventCode aType ); - - void HandlePointerEventL( const TPointerEvent &aPointerEvent ); - - void SizeChanged(); - - TInt CountComponentControls() const; - - CCoeControl* ComponentControl( TInt aIndex ) const; - - public: // From CFileManagerContainerBase - void SetListEmptyL(); - - void RefreshListL( TInt aFocusedIndex ); - - CEikTextListBox* CreateListBoxL(); - - void UpdateCba(); - - TInt ListBoxCurrentItemIndex(); - - TInt ListBoxNumberOfItems(); - - const CArrayFix< TInt >* ListBoxSelectionIndexes(); - - TInt ListBoxSelectionIndexesCount(); - - void ListBoxToggleItemL( TInt aIndex ); - - TBool ListBoxIsItemSelected( TInt aIndex ); - - void ListBoxSetTextL( const TDesC& aText ); - - TBool IsSearchFieldVisible() const; - - void EnableSearchFieldL( - TBool aEnable, const TDesC& aSearchText = KNullDesC ); - - void SetCurrentItemIndexAfterSearch( TInt aIndex ); - - void ListBoxSelectItemL( TInt aIndex ); - - void ListBoxDeselectItem( TInt aIndex ); - - TInt SearchFieldToListBoxIndex(TInt aIndex ); - - private: // From MCoeFocusObserver - void HandleChangeInFocus(); - - void HandleDestructionOfFocusedItem(); - - private: - /** - * Standard C++ constructor. - */ - CFileManagerFileListContainer( - const TListType aType ); - - void ConstructL( - const TRect& aRect, - const TInt aFocusedIndex, - const TInt aEmptyText, - const TDesC& aHelpContext ); - - TInt SearchFieldToListIndex( TInt aIndex ); - - TInt ListToSearchFieldIndex( TInt aIndex ); - - void PageScrollL( TBool aUp ); - - TKeyResponse OfferSearchKeyEventL( - const TKeyEvent& aKeyEvent, TEventCode aType ); - - private: - /** - * Custom item drawer, to support the "no-folders-marked" feature. - */ - class CItemDrawer : public CColumnListBoxItemDrawer - { - public: - CItemDrawer( - CTextListBoxModel* aTextListBoxModel, - const CFont* aFont, - CColumnListBoxData* aColumnData, - CFileManagerFileListContainer& aContainer ); - public: // From CColumnListBoxItemDrawer - TListItemProperties Properties( TInt aItemIndex ) const; - private: // Data - CFileManagerFileListContainer& iContainer; - }; - - /** - * Custom listbox, to support the "no-folders-marked" feature. - */ - class CListBox : public CAknSingleGraphicStyleListBox - { - public: - CListBox( CFileManagerFileListContainer& aContainer ); - - protected: // From CAknSingleGraphicStyleListBox - void CreateItemDrawerL(); - - private: // Data - CFileManagerFileListContainer& iContainer; - }; - - private: // Data - // Ref: Document of this application - CFileManagerDocument* iDocument; - // Ref: AppUi of this application - CFileManagerAppUi* iAppUi; - // List type bits - TUint iType; - // Indicates if the navigation is supported - TBool iRightLeftNaviSupported; - // Indicates if dragging is on - TBool iDragging; - // Stores dragging start point - TPoint iDragStartPoint; - // Own: Search field - CAknSearchField* iSearchField; - // Buffer for search text - TFileName iSearchText; - // Indicates if search field is enabled after refresh - TBool iSearchFieldAfterRefresh; - // Stores the list index to be restored after search ends - TInt iIndexAfterSearch; - // Stores search field enabled status - TBool iSearchFieldEnabled; - // Stores fast scroll disbaled status - TBool iOwnFastScrollDisabled; - }; - -#endif // CFILEMANAGERFILELISTCONTAINER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerFileSelectionFilter.h --- a/filemanager/App/inc/CFileManagerFileSelectionFilter.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2002-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: Filters PlatSec dirs from file selection -* -*/ - - - -#ifndef CFILEMANAGERFILESELECTIONFILTER_H -#define CFILEMANAGERFILESELECTIONFILTER_H - -// INCLUDES -#include -#include - -// FORWARD DECLARATIONS -class CFileManagerEngine; - -// CLASS DECLARATION -/** - * - */ -class CFileManagerFileSelectionFilter : public CBase, - public MAknFileFilter - { - public: - CFileManagerFileSelectionFilter( CFileManagerEngine& aEngine ); - - public: // From MAknFileFilter - TBool Accept( const TDesC& aDriveAndPath, const TEntry& aEntry ) const; - - private: // Data - /// Ref: Reference to engine of the application. - CFileManagerEngine& iEngine; - }; - -#endif // CFILEMANAGERFILESELECTIONFILTER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerFoldersView.h --- a/filemanager/App/inc/CFileManagerFoldersView.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -/* -* Copyright (c) 2002-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: View for folder -* -*/ - - - -#ifndef CFILEMANAGERFOLDERSVIEW_H -#define CFILEMANAGERFOLDERSVIEW_H - -// INCLUDES -#include "CFileManagerViewBase.h" -#include - -// FORWARD DECLARATIONS -class CAknNavigationControlContainer; -class CAknNavigationDecorator; -class CFileManagerFolderNavigationPane; -class CAknInfoPopupNoteController; - -// CLASS DECLARATION -/** - * Folders view of the application. - */ -class CFileManagerFoldersView : public CFileManagerViewBase, - public MFileManagerFolderNaviObserver - { - public: // Custom Message IDs - /// custom message for opening from results view - static const TUid KOpenFromSearchResultsView; - - // For custom message use - enum TMessage - { - EOpenFromSearchResultsView = 1 - }; - - public: // Constructors and destructor - /** - * Two-phased constructor. Leaves created view - * to cleanup stack. - * - * @return Newly constructed view - */ - static CFileManagerFoldersView* NewLC(); - - /** - * Destructor. - */ - ~CFileManagerFoldersView(); - - public: // New declarations - - /** - * Forwards Resource change events to view - * @since 2.0 - * @param aType type of change - */ - void HandleResourceChangeL( TInt aType ); - - /** - * Forwards DirectoryChange information to active view - * @since 2.0 - */ - void DirectoryChangedL(); - - private: // From CAknView - /** - * @see CAknView - */ - TUid Id() const; - - /** - * @see CAknView - */ - void HandleCommandL( TInt aCommand ); - - /** - * @see CAknView - */ - TKeyResponse OfferKeyEventL( - const TKeyEvent& aKeyEvent, TEventCode aType ); - - /** - * @see CAknView - */ - void DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage); - - /** - * @see CAknView - */ - void DoDeactivate(); - - private: // From CFileManagerViewBase - /** - * @see CFileManagerViewBase - */ - CFileManagerContainerBase* CreateContainerL(); - - /** - * @see CFileManagerViewBase - */ - void UpdateCbaL(); - - private: // From MFileManagerFolderNaviObserver - /** - * @see MFileManagerFolderNaviObserver - */ - void HandleFolderNaviEventL( TNaviEvent aEvent, TInt aValue ); - - private: - /** - * Refreshes title to contain name of the - * current folder. - */ - void RefreshTitleL(); - - /** - * Standard C++ constructor. - */ - CFileManagerFoldersView(); - - /** - * 2nd phase constructor. - */ - void ConstructL(); - - /** - * Handles backstepping from the current folder. - * @since 3.1 - * @param aBacksteps Number of backsteps to do - */ - void BackstepL( TInt aBacksteps = 1 ); - - /** - * Gets folder name from specified folder level - * @since 3.1 - * @param aFolderLevel Folder level - * @return Folder name - */ - TPtrC FolderName( const TInt aFolderLevel ); - - private: // Data - /// Ref: Navi pane of the view - CAknNavigationControlContainer* iNaviPane; - /// Own: Navigation decorator for navi pane - CAknNavigationDecorator* iNaviDecorator; - /* - * Ref: Navi control that draws folders in the navi pane. - * Ownership is given to navi pane after creation. - */ - CFileManagerFolderNavigationPane* iNaviControl; - - // Current depth, with this folder view knows when - // user has gone up or down in folder tree - TInt iFolderDepth; - - // Own: Initial folder depth. - // View is closed after stepped back below this level. - TInt iInitialFolderDepth; - - // Own: For showing info popups - CAknInfoPopupNoteController* iPopupController; - - }; - -#endif // CFILEMANAGERFOLDERSVIEW_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerMainView.h --- a/filemanager/App/inc/CFileManagerMainView.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Main view -* -*/ - - - -#ifndef C_FILEMANAGERMAINVIEW_H -#define C_FILEMANAGERMAINVIEW_H - - -// INCLUDES -#include -#include "CFileManagerViewBase.h" - - -// CLASS DECLARATION -/** - * This class implements main view of the application. - * - * @since S60 3.1 - */ -class CFileManagerMainView : public CFileManagerViewBase - { - -public: // Constructors and destructor - /** - * Two-phased constructor.Leaves created view - * to cleanup stack. - * - * @return Newly constructed view - */ - static CFileManagerMainView* NewLC(); - - /** - * Destructor. - */ - ~CFileManagerMainView(); - -public: // From CFileManagerViewBase - /** - * @see CFileManagerViewBase - */ - void DirectoryChangedL(); - - /** - * @see CFileManagerViewBase - */ - CFileManagerContainerBase* CreateContainerL(); - -private: // From CAknView - /** - * @see CAknView - */ - void DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * @see CAknView - */ - void DoDeactivate(); - - /** - * @see CAknView - */ - TUid Id() const; - - /** - * @see CAknView - */ - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - - /** - * @see CAknView - */ - void HandleCommandL( TInt aCommand ); - -private: // From MFileManagerProcessObserver - /** - * @see MFileManagerProcessObserver - */ - TInt NotifyL( TFileManagerNotify aType, TInt aData, const TDesC& aName ); - -private: // New functions - /** - * Filters main menu in aMenuPane. - */ - void MainMenuFilteringL( CEikMenuPane& aMenuPane ); - - /** - * Filters remote drives menu in aMenuPane. - */ - void RemoteDrivesMenuFilteringL( CEikMenuPane& aMenuPane ); - - /** - * Handles memory store open command - */ - void CmdOpenMemoryStoreL(); - - /** - * Handles eject command - */ - void CmdEjectL(); - -#ifndef RD_FILE_MANAGER_BACKUP - /** - * Handles legacy backup command - */ - void CmdBackupL(); - - /** - * Handles legacy restore command - */ - void CmdRestoreL(); -#endif // RD_FILE_MANAGER_BACKUP - - /** - * Handles map remote drive command - */ - void CmdMapRemoteDriveL(); - - /** - * Handles remote drive settings command - */ - void CmdRemoteDriveSettingsL(); - - /** - * Handles remote drive delete command - */ - void CmdRemoteDriveDeleteL(); - - /** - * Filters memory storage menu items. - * - * @param aMenuPane Menu instance to be filtered. - */ - void MemoryStorageMenuFilteringL( CEikMenuPane& aMenuPane ); - - /** - * Handles memory storage details command. - */ - void CmdMemoryStorageDetailsL(); - - /** - * Handles drive rename command. - */ - void CmdRenameDriveL(); - - /** - * Handles drive password set command. - */ - void CmdSetDrivePasswordL(); - - /** - * Handles drive password change command. - */ - void CmdChangeDrivePasswordL(); - - /** - * Handles drive password remove command. - */ - void CmdRemoveDrivePasswordL(); - - /** - * Gets drive at current position. - * - * @return Drive identifier or KErrNotFound. - */ - TInt DriveAtCurrentPosL(); - -private: - /** - * C++ default constructor. - */ - CFileManagerMainView(); - - void ConstructL(); - - }; - -#endif // C_FILEMANAGERMAINVIEW_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerMemoryStoreView.h --- a/filemanager/App/inc/CFileManagerMemoryStoreView.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +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: Memory store view -* -*/ - - - -#ifndef C_FILEMANAGERMEMORYSTOREVIEW_H -#define C_FILEMANAGERMEMORYSTOREVIEW_H - - -// INCLUDES -#include -#include "CFileManagerViewBase.h" - - -// CLASS DECLARATION -/** - * This class implements memory store view. - * - * @since S60 3.1 - */ -class CFileManagerMemoryStoreView : public CFileManagerViewBase - { - -public: // Constructors and destructor - /** - * Two-phased constructor.Leaves created view - * to cleanup stack. - * - * @return Newly constructed view - */ - static CFileManagerMemoryStoreView* NewLC(); - - /** - * Destructor. - */ - ~CFileManagerMemoryStoreView(); - -public: // From CFileManagerViewBase - /** - * @see CFileManagerViewBase - */ - void DirectoryChangedL(); - - /** - * @see CFileManagerViewBase - */ - CFileManagerContainerBase* CreateContainerL(); - - /** - * @see CFileManagerViewBase - */ - void UpdateCbaL(); - -private: // From CAknView - /** - * @see CAknView - */ - void DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * @see CAknView - */ - void DoDeactivate(); - - /** - * @see CAknView - */ - TUid Id() const; - - /** - * @see CAknView - */ - void HandleCommandL( TInt aCommand ); - -private: // New functions - /** - * Checks memory store available - */ - TBool DriveAvailableL( TBool aShowRemoteNotConnected ); - - /** - * Refreshes memory store title - */ - void RefreshTitleL(); - - /** - * Handles open memory store command - */ - void CmdOpenL(); - - /** - * Handles back command - */ - void CmdBackL(); - -private: - /** - * C++ default constructor. - */ - CFileManagerMemoryStoreView(); - -private: - - }; - -#endif // C_FILEMANAGERMEMORYSTOREVIEW_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerRestoreView.h --- a/filemanager/App/inc/CFileManagerRestoreView.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: View for restore settings -* -*/ - - - -#ifndef C_FILEMANAGERRESTOREVIEW_H -#define C_FILEMANAGERRESTOREVIEW_H - - -// INCLUDES -#include -#include "CFileManagerViewBase.h" - - -// CLASS DECLARATION -/** - * This class is used for restore settings view - * - * @since S60 3.1 - */ -class CFileManagerRestoreView : public CFileManagerViewBase - { - -public: // Custom Message IDs - // Custom message for deleting backups - static const TUid KDeleteBackups; - - // For custom messages - enum TMessage - { - EDeleteBackups = 1 - }; - -public: // Constructors and destructor - /** - * Two-phased constructor.Leaves created view - * to cleanup stack. - * - * @return Newly constructed view - */ - static CFileManagerRestoreView* NewLC(); - - /** - * Destructor. - */ - ~CFileManagerRestoreView(); - -public: // From CFileManagerViewBase - /** - * @see CFileManagerViewBase - */ - void DirectoryChangedL(); - - /** - * @see CFileManagerViewBase - */ - CFileManagerContainerBase* CreateContainerL(); - - /** - * @see CFileManagerViewBase - */ - void NotifyForegroundStatusChange( TBool aForeground ); - - /** - * Updates cba - */ - virtual void UpdateCbaL(); - -private: // From CAknView - /** - * @see CAknView - */ - void DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * @see CAknView - */ - void DoDeactivate(); - - /** - * @see CAknView - */ - TUid Id() const; - - /** - * @see CAknView - */ - void HandleCommandL( TInt aCommand ); - -public: // From MFileManagerProcessObserver - /** - * @see MFileManagerProcessObserver - */ - void ProcessFinishedL( TInt aError, const TDesC& aName = KNullDesC ); - -private: // New functions - /** - * Handles ok command - */ - void CmdOkL(); - - /** - * Handles cancel command - */ - void CmdCancelL(); - - /** - * Handles select command - */ - void CmdSelectL(); - - /** - * Handles check mark command - */ - void CmdCheckMarkL(); - - /** - * Refreshes all settings - */ - void RefreshSettingsL(); - - /** - * Restores list selection after refresh - */ - void RestoreSelectionL(); - - /** - * Updates cba according to list selection - */ - void UpdateCbaFromSelectionL(); - -private: - /** - * C++ default constructor. - */ - CFileManagerRestoreView(); - -private: // Data - // Indicates if view is started into delete backup mode - TBool iDeleteBackups; - - /** - * For storing list selection during refresh - */ - TUint64 iSelection; - - }; - -#endif // C_FILEMANAGERRESTOREVIEW_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerSchBackupHandler.h --- a/filemanager/App/inc/CFileManagerSchBackupHandler.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +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: Handler for scheduled backup -* -*/ - - -#ifndef C_FILEMANAGERSCHBACKUPHANDLER_H -#define C_FILEMANAGERSCHBACKUPHANDLER_H - - -// INCLUDES -#include -#include - - -// FORWARD DECLARATIONS -class CFileManagerEngine; -class CFileManagerGlobalDlg; -class MFileManagerSchBackupObserver; -class CRepository; - - -// CLASS DECLARATION -/** - * This class handles scheduled backup - * - * @since S60 3.1 - */ -class CFileManagerSchBackupHandler : - public CBase, - public MFileManagerGlobalDlgObserver - { - -public: - /** - * Two-phased constructor. - */ - static CFileManagerSchBackupHandler* NewL( - CFileManagerEngine& aEngine ); - - /** - * Destructor. - */ - ~CFileManagerSchBackupHandler(); - - /** - * Starts backup with confirm note. - */ - void StartBackupWithConfirm(); - - /** - * Sets backup observer - * @param aObserver Pointer to observer or NULL. - * Ownership is not transferred. - */ - void SetObserver( - MFileManagerSchBackupObserver* aObserver ); - - /** - * Informs process finished - * @param aError System wide error code - * @param aName Error related descriptor - */ - void ProcessFinishedL( TInt aError, const TDesC& aName ); - - /** - * Informs process advance - * @param aValue Current progress value - */ - void ProcessAdvanceL( TInt aValue ); - - /** - * Informs process started - * @param aFinalValue Final progress value - */ - void ProcessStartedL( TInt aFinalValue ); - - /** - * Cancels scheduled backup launcher - */ - void CancelBackupStarter(); - -private: // From MFileManagerGlobalDialogObserver - /** - * @see MFileManagerGlobalDialogObserver - */ - void HandleGlobalDlgResult( - TInt aDialogType, - TInt aDialogResult ); - -private: - CFileManagerSchBackupHandler( - CFileManagerEngine& aEngine ); - - void ConstructL(); - - void StartBackupWithConfirmL(); - - void StartBackupL(); - - void StartBackup(); - - void InformObserver( const TInt aValue ); - - TBool IsPowerSavingModeOnL(); - - TBool IsTargetDriveAvailableL( const TFileManagerDriveInfo& aDrvInfo ); - -private: // Data - /** - * Reference to file manager engine - * Not own. - */ - CFileManagerEngine& iEngine; - - /** - * For global dialog handling - * Own. - */ - CFileManagerGlobalDlg* iGlobalDlg; - - /** - * Pointer to scheduled backup observer - * Not own. - */ - MFileManagerSchBackupObserver* iObserver; - - /** - * To indicate is backup ongoing - */ - TBool iBackupOngoing; - - /** - * Pointer to CenRep - * Own. - */ - CRepository* iCenRep; - }; - -#endif // C_FILEMANAGERSCHBACKUPHANDLER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerSettingListContainer.h --- a/filemanager/App/inc/CFileManagerSettingListContainer.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +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: Setting list container in file manager -* -*/ - - - -#ifndef CFILEMANAGERSETTINGLISTCONTAINER_H -#define CFILEMANAGERSETTINGLISTCONTAINER_H - -// INCLUDES -#include "CFileManagerContainerBase.h" - - -// CLASS DECLARATION -/** - * Container for backup view. - */ -class CFileManagerSettingListContainer : public CFileManagerContainerBase - { - public: // Constructors and destructor - enum TListType - { - EListBackup = 0, // Backup settings layout - EListRestore // Restore selection layout - }; - - /** - * Two-phased constructor. - */ - static CFileManagerSettingListContainer* NewL( - const TRect& aRect, - const TInt aFocusedIndex, - const TListType aType, - MDesCArray* aArray, - const TDesC& aHelpContext = KNullDesC ); - - /** - * Destructor. - */ - ~CFileManagerSettingListContainer(); - - private: // From CFileManagerContainerBase - CEikTextListBox* CreateListBoxL(); - - TKeyResponse OfferKeyEventL( - const TKeyEvent& aKeyEvent, TEventCode aType ); - - void HandleControlEventL( - CCoeControl* aControl, TCoeEvent aEventType ); - - private: - /** - * C++ default constructor. - */ - CFileManagerSettingListContainer( const TListType aType ); - - void ConstructL( - const TRect& aRect, - const TInt aFocusedIndex, - MDesCArray* aArray, - const TDesC& aHelpContext ); - - CEikTextListBox* CreateBackupListBoxL(); - - CEikTextListBox* CreateRestoreListBoxL(); - - private: // Data - // Setting list type - TListType iType; - - }; - -#endif // CFILEMANAGERSETTINGLISTCONTAINER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerStringCache.h --- a/filemanager/App/inc/CFileManagerStringCache.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2002-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: This class caches strings -* -*/ - - - -#ifndef CFILEMANAGERSTRINGCACHE_H -#define CFILEMANAGERSTRINGCACHE_H - -// INCLUDES -#include -#include -#include - -// CONSTANTS -const TInt KNumStringCacheItems = 16; -const TInt KFormatStringLen = KMaxFileName * 2; - -// FORWARD DECLARATIONS -class CFileManagerEngine; -class CFileManagerIconArray; - - -// CLASS DECLARATION -/** -* This class caches strings -* -* @since 2.7 -*/ -class CFileManagerStringCache : public CBase, public MDesCArray - { - public: - - /** - * Two-phased constructor. - */ - static CFileManagerStringCache* NewL( - CFileManagerEngine& aEngine, - CFileManagerIconArray& aIconArray ); - - void Clear() const; - - /** - * Destructor. - */ - ~CFileManagerStringCache(); - - /** - * Gets last error - */ - TInt LastError() const; - - public: // From MDesCArray - - TInt MdcaCount() const; - TPtrC MdcaPoint(TInt aIndex) const; - - private: - /** - * C++ default constructor. - */ - CFileManagerStringCache( - CFileManagerEngine& aEngine, - CFileManagerIconArray& aIconArray ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Sets last error - */ - void SetError( TInt aError ) const; - - private: - - /** - * Searches index from cache and return cache index - * so it can be retrieve with FormattedString - */ - TInt FormattedStringFound( TInt aIndex ) const; - - /** - * Retrieve string from cache with FormattedStringFound() - * given index - */ - TPtrC FormattedString( TInt aIndex ) const; - - /** - * Stores string in iFormatted string with given - * listbox index. Checks the fartest position - * and stores there. - */ - void StoreFormattedStringL( TInt aIndex ) const; - - /** - * Clears cache item - * given index - */ - void Clear( TInt aIndex ) const; - - private: // Data - class TCacheItem - { - public: - HBufC* iString; - TInt iIndex; - }; - - // Ref: To get item details - CFileManagerEngine& iEngine; - - // Ref: To resolve icons - CFileManagerIconArray& iIconArray; - - // Own: array of formatted listbox items - TFixedArray< TCacheItem, KNumStringCacheItems > mutable - iFormattedItems; - - // Own: String buffer for formatting string - TBuf< KFormatStringLen > mutable iFormatString; - - // Own: Last error - TInt mutable iError; - - }; - -#endif // CFILEMANAGERSTRINGCACHE_H - -// End of File - diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerTaskScheduler.h --- a/filemanager/App/inc/CFileManagerTaskScheduler.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +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: Wraps task scheduler functionality -* -*/ - - - -#ifndef C_FILEMANAGERTASKSCHEDULER_H -#define C_FILEMANAGERTASKSCHEDULER_H - - -// INCLUDES -#include -#include - - -// FORWARD DECLARATIONS -class CFileManagerEngine; - - -// CLASS DECLARATION -/** - * This class wraps task scheduler functionality - * - * @since S60 3.1 - */ -class CFileManagerTaskScheduler : public CBase - { - -public: // New functions - /** - * Two-phased constructor. - */ - static CFileManagerTaskScheduler* NewL( - CFileManagerEngine& aEngine ); - - /** - * Destructor. - */ - ~CFileManagerTaskScheduler(); - - /** - * Enables and disables backup schedule - */ - void EnableBackupScheduleL( const TBool aEnable ); - -private: - CFileManagerTaskScheduler( - CFileManagerEngine& aEngine ); - - void ConstructL(); - - void CreateScheduleL(); - - void DeleteScheduleL(); - -private: // Data - /** - * Reference to file manager engine - * Not own. - */ - CFileManagerEngine& iEngine; - - /** - * Handle to task scheduler - */ - RScheduler iScheduler; - - /** - * Handle to schedule - */ - TInt iScheduleHandle; - - }; - -#endif // C_FILEMANAGERBACKUPSCHEDULER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/CFileManagerViewBase.h --- a/filemanager/App/inc/CFileManagerViewBase.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,706 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Base class for all file manager views -* -*/ - - - -#ifndef CFILEMANAGERVIEWBASE_H -#define CFILEMANAGERVIEWBASE_H - - -// INCLUDES -#include -#include -#include -#include -#include -#include - - -// FORWARD DECLARATIONS -class CFileManagerContainerBase; -class CFileManagerEngine; -class CFileManagerActiveExecute; -class CEikMenuBar; -class CFileManagerActiveDelete; -class CFileManagerItemProperties; -class CAknQueryDialog; -class CAknWaitNoteWrapper; -class CFileManagerFeatureManager; -class MAknServerAppExitObserver; - - -// Defines maximum media password length in Unicode -const TUint KFmgrMaxMediaPassword = KMaxMediaPassword / 2; // Because of Unicode -// CLASS DECLARATION -/** - * Base class for all views in File Manager applicaiton - */ -class CFileManagerViewBase : public CAknView, - public MProgressDialogCallback, - public MFileManagerProcessObserver, - public MAknServerAppExitObserver - { - protected: - /** - * Return value enumeration for CmdOpenL to indicate what - * kind of item was opened or if there was an error during - * opening. - */ - enum TFileManagerOpenResult - { - EFolderOpened, - EFileOpened, - EOpenError - }; - public: // Constructors and destructor - /** - * Two-phased constructor. - */ - static CFileManagerViewBase* NewLC(); - - /** - * Timer calls this in order to update the progress bar. - * @param aPtr pointer to object where is function to be call - * when timer expires. - * @return positive number if timer needs to be activated again - * 0 if timer is not needed any more. - */ - static TInt UpdateProgressBar( TAny* aPtr ); - - /** - * Timer calls this in order to start refresh progress dialog. - * @param aPtr pointer to object where is function to be call - * when timer expires. - * @return positive number if timer needs to be activated again - * 0 if timer is not needed any more. - */ - static TInt RefreshProgressDelayedStart( TAny* aPtr ); - - /** - * Stores current index - * @return ETrue if storing successfull - * EFalse if storing not succesfull - */ - TBool StoreIndex(); - - /** - * Nulls everything which is related to progress bar - */ - void ClearProgressBarL(); - - /** - * @return Current process in app - */ - MFileManagerProcessObserver::TFileManagerProcess CurrentProcess(); - - /** - * Destructor. - */ - virtual ~CFileManagerViewBase(); - - public: // From MProgressDialogCallback - void DialogDismissedL( TInt aButtonId ); - - public://MAknServerAppExitObserver - /** - * @see MAknServerAppExitObserver - */ - void HandleServerAppExit( TInt aReason ); - - public: // From MFileManagerProcessObserver - /** - * @see MFileManagerProcessObserver - */ - void ProcessFinishedL( TInt aError, const TDesC& aName ); - - /** - * @see MFileManagerProcessObserver - */ - void ProcessAdvanceL( TInt aValue ); - - /** - * @see MFileManagerProcessObserver - */ - void ProcessStartedL( - MFileManagerProcessObserver::TFileManagerProcess aProcess, - TInt aFinalValue ); - - /** - * @see MFileManagerProcessObserver - */ - TBool ProcessQueryOverWriteL( - const TDesC& aOldName, - TDes& aNewName, - TFileManagerProcess aProcess ); - - /** - * @see MFileManagerProcessObserver - */ - TBool ProcessQueryRenameL( - const TDesC& aOldName, - TDes& aNewName, - TFileManagerProcess aProcess ); - - /** - * @see MFileManagerProcessObserver - */ - void RefreshStartedL(); - - /** - * @see MFileManagerProcessObserver - */ - void RefreshStoppedL(); - - /** - * @see MFileManagerProcessObserver - */ - void ShowWaitDialogL( MAknBackgroundProcess& aProcess); - - /** - * @see MFileManagerProcessObserver - */ - void Error( TInt aError ); - - /** - * @see MFileManagerProcessObserver - */ - TInt NotifyL( TFileManagerNotify aType, TInt aData, const TDesC& aName ); - - public: - - /* - * When view needs refresh, this is called. - */ - virtual void DirectoryChangedL() = 0; - - /* - * Checks if refresh is in progress - */ - TBool IsRefreshInProgress(); - - /** - * Handles errors caused by file or folder deletion outside - * file manager while file manager is in foreground. - * @param aError Error code. - * @return ETrue if error was handled. Otherwise EFalse. - */ - TBool HandleFileNotFoundL( TInt aError ); - - /** - * Handles screen layout changes - */ - virtual void ScreenDeviceChanged(); - -#ifdef RD_FILE_MANAGER_BACKUP - void StartSchBackupL(); - - void SchBackupFinishedL(); -#endif // RD_FILE_MANAGER_BACKUP - - /** - * Updates cba - */ - virtual void UpdateCbaL(); - - /** - * Notifies foreground status change - */ - virtual void NotifyForegroundStatusChange( TBool aForeground ); - - protected: // From CAknView - /** - * @see CAknView - */ - void DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage); - - /** - * @see CAknView - */ - void DoDeactivate(); - - /** - * @see CAknView - */ - void HandleCommandL( TInt aCommand ); - - /** - * @see CAknView - */ - void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); - - /** - * @see CAknView - */ - void ProcessCommandL( TInt aCommand ); - - protected: // New methods - - /** - * Returns a container class that is derived from - * CFileManagerContainerBase. This is provided for derived - * classes to create their own type of containers. - * @return Newly created container. - */ - virtual CFileManagerContainerBase* CreateContainerL() = 0; - - /** - * Executes open command. Opens currently selected item in - * list. - * @return Code that tells if opened item was folder or - * file. EOpenError is returned if there was an - * error during open. - */ - TFileManagerOpenResult CmdOpenL(); - - /** - * Executes delete command to delete current item - * or if there are marked items, all of them are deleted. - */ - void CmdDeleteL(); - - /** - * Marks all markable items in list. - */ - void CmdMarkAllL(); - - /** - * Unmarks all marked items in list. - */ - void CmdUnmarkAllL(); - - /** - * Changes mark status of currently focused item. - */ - void CmdToggleMarkL(); - - /** - * Creates new folder to currently active directory. - */ - void CmdNewFolderL(); - - /** - * Renames currently active item. - */ - void CmdRenameL(); - - /** - * Moves current item to folder that is queried using - * Common File Dialogs. If there are marked items, all of - * them are moved. - */ - void CmdMoveToFolderL(); - - /** - * Copies current item to folder that is queried using - * Common File Dialogs. If there are marked items, all of - * them are copied. - */ - void CmdCopyToFolderL(); - - /** - * Shows info popup dialog that contains information - * about currently active item. - */ - void CmdViewInfoL(); - - /** - * Shows memory status popup dialog that contains - * information about current memory status of the - * active memory. - */ - void CmdMemoryStateL(); - - /** - * Executes find command. - */ - void CmdFindL(); - - /** - * Receives file via infrared to currently active - * folder. - */ - void CmdReceiveViaIRL(); - - /** - * Runs move or copy operation. Parameter aToFolder is the destination - * of operation. - * @param aOperation Operation to execute. - * @param aToFolder Destination folder of the operation. - */ - void RunOperationL( - MFileManagerProcessObserver::TFileManagerProcess aOperation, - const TDesC& aToFolder ); - - /** - * Gets reference to drive info. - */ - TFileManagerDriveInfo& DriveInfo() const; - - /** - * Refreshes drive info. - */ - void RefreshDriveInfoL(); - - void StartProcessL( - MFileManagerProcessObserver::TFileManagerProcess aProcess, - TInt aValue = KErrNotFound ); - - void CmdUnlockDriveL(); - - void CmdFormatDriveL(); - -// void CmdRenameDriveL(); -// -// void CmdSetDrivePasswordL(); -// -// void CmdChangeDrivePasswordL(); -// -// void CmdRemoveDrivePasswordL(); -// -// void CmdMemoryCardDetailsL(); - - TInt UpdatePassword( - TInt aDrive, const TDesC& aOldPwd, const TDesC& aPwd ); - - TInt UnlockRemovePasswordL( TInt aDrive, TBool aRemove ); - - /** - * Sets remote drive connection state. - * - * @param aState ETrue to connect, EFalse to disconnect. - */ - void SetRemoteDriveConnectionStateL( TBool aState ); - - /** - * Opens remote drive setting view. - * - * @param aDriveName Name of the remote drive. - */ - void OpenRemoteDriveSettingsL( - const TDesC& aDriveName = KNullDesC ); - - /** - * Checks if item is on disconnected remote drive. - * - * @param aProp Item properties. - * @return ETrue if item is on disconnect drive. Otherwise EFalse. - */ - TBool IsDisconnectedRemoteDrive( - CFileManagerItemProperties& aProp ); - - /** - * Performs remote drive menu filtering. - * - * @param aMenuPane Menu instance to be filtered. - */ - void RemoteDriveCommonFilteringL( CEikMenuPane& aMenuPane ); - - /** - * Renames current drive. - * - * @param aForceDefaultName ETrue to offer the default name by force. - */ - void RenameDriveL( TBool aForceDefaultName ); - - /** - * Handles refresh directory command. - */ - void CmdRefreshDirectoryL(); - - /** - * Shows eject query. - */ - void ShowEjectQueryL(); - - /** - * Launches progress dialog with given final and initial values. - * aOperation parameter is used to determine what resource - * should be used when displaying dialog. - * @param aFinalValue Final value of the created progress dialog. - * @param aInitialValue Initial value of the created progress dialog. - * @param aOperation Operation that this progress dialog represents - * @param aImmediatelyVisible Dialog is immediately visible if ETrue - */ - void LaunchProgressDialogL( - TInt64 aFinalValue, - TInt64 aInitialValue, - MFileManagerProcessObserver::TFileManagerProcess aOperation, - TBool aImmediatelyVisible = EFalse ); - - TBool AskPathL( TDes& aPath, TInt aTextId ); - - void SetCbaMskTextL( const TInt aTextId ); - - void UpdateCommonCbaL(); - - TBool IsDriveAvailable( const TDesC& aPath ) const; - - TBool IsDriveAvailable( const TInt aDrive ) const; - - TBool DriveReadOnlyMmcL( const TInt aDrive ) const; - - TBool DriveReadOnlyMmcL( const TDesC& aFullPath ) const; - - TBool CheckPhoneState() const; - - TBool StopProgressDialogAndStoreValues(); - - void CmdSortL( TInt aCommand ); - - CFileManagerFeatureManager& FeatureManager() const; - - void ShowDiskSpaceErrorL( const TDesC& aFolder ); - - /** - * Sets given media password string to empty and zero fills it. - * - * @param aPwd Media password to clean up. - */ - static void EmptyPwd( TDes& aPwd ); - - /** - * Converts chars to media password. - * - * @param aWord Password to convert in Unicode. - * @param aConverted Converted password. - */ - static void ConvertCharsToPwd( const TDesC& aWord, TDes8& aConverted ); - - /** - * Gets drive information at current position. - * - * @param aInfo Stores drive information. - * @return Drive identifier or KErrNotFound. - */ - TInt DriveInfoAtCurrentPosL( TFileManagerDriveInfo& aInfo ); - - protected: - - /** - * C++ default constructor. - */ - CFileManagerViewBase(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - virtual void ConstructL( TInt aResId ); - - private: // New methods - /** - * Constructs an array that contains the indices - * of marked items. - * @return Array of marked items. - */ - CArrayFixFlat* MarkedArrayLC(); - - /** - * Gets paths of marked sendable files - * @param Reference to get size of the sendable files - * @return Array of sendable file items - */ - CArrayFixFlat* GetSendFilesLC( TInt& aSize ); - - /** - * Filters Edit menu in aMenuPane. - */ - void MarkMenuFilteringL( CEikMenuPane& aMenuPane ); - - /** - * Creates a send ui query - */ - void SendUiQueryL(); - - /** - * Timer calls this for updating the progress bar. - */ - void DoUpdateProgressBar(); - - /** - * Returns true if all or any focused item or marked items are protected. - * - * The 'all' or 'any' mode of operation is controlled by the aMode parameter. - * - * @param aMode controls the 'all' or 'any' mode. ETrue = 'all'. - * @return ETrue all chosen items are protected - * EFalse at least one of the items are not protected - */ - TBool AreChosenFilesProtectedL( TBool aMode ); - - /** - * Creates and displayes the Context sensitive menu - */ - void ShowContextSensitiveMenuL(); - - /** - * Adds SendUi option to option menu - */ - void AddSendOptionL( - CEikMenuPane& aMenuPane, - const TInt aCommandIdAfter ); - - /** - * Check is delete condition ok for given item - */ - TBool DeleteStatusNotOkL( - CFileManagerItemProperties& aProp, - TInt aSelectionCount ) const; - - /** - * Deletes focused or marked items from current listbox - */ - void DeleteItemsL( TInt aIndex ); - - /** - * Checks if given index has InfoUrl. - * @param aIndex given index - * @return ETrue if given index has InfoUrl, - * EFalse otherwise. - */ - TBool HasInfoUrlL( TInt aIndex ); - - /** - * Opens InfoUrl of given index in browser. - * @param aIndex given index - */ - void OpenInfoUrlL( TInt aIndex ); - - /** - * Checks file rights and shows note if expired. - * @param aFullPath File to check - * @return ETrue if rights are valid - * EFalse if rights are expired - */ - TBool CheckFileRightsAndInformIfExpiredL( const TDesC& aFullPath ); - - /** - * Filters memory store menu in aMenuPane. - */ - void MemoryStoreMenuFilteringL( CEikMenuPane& aMenuPane ); - - /** - * Filters organise menu in aMenuPane. - */ - void OrganiseMenuFilteringL( CEikMenuPane& aMenuPane ); - - /** - * Filters details menu in aMenuPane. - */ - void DetailsMenuFilteringL( CEikMenuPane& aMenuPane ); -// -// /** -// * Filters memory card menu in aMenuPane. -// */ -// void MemoryCardMenuFilteringL( CEikMenuPane& aMenuPane ); -// -// /** -// * Filters memory card password menu in aMenuPane. -// */ -// void MemoryCardPasswordMenuFilteringL( CEikMenuPane& aMenuPane ); - - /** - * Filters context sensitive menu in aMenuPane. - */ - void ContextSensitiveMenuFilteringL( CEikMenuPane& aMenuPane ); - - /** - * Launches progress bar - */ - void LaunchProgressBarL( - TInt aDialogId, - TInt aTextId, - TInt64 aFinalValue, - TInt64 aInitialValue, - TBool aPeriodic, - TBool aImmediatelyVisible ); - - /** - * Starts refresh progress dialog - */ - void RefreshProgressDelayedStartL(); - - void CheckPostponedDirectoryRefresh(); - - void DenyDirectoryRefresh( TBool aDeny ); - - void SortMenuFilteringL( CEikMenuPane& aMenuPane ); - - void DoProcessFinishedL( TInt aError, const TDesC& aName ); - - void DoLaunchProgressDialogAsync(); - - static TInt LaunchProgressDialogAsync( TAny* aPtr ); - - TInt FilesCountInSearchField(); - - protected: // Data - /// Own: Container that this view handles. - CFileManagerContainerBase* iContainer; - /// Ref: Reference to File Manager engine. - CFileManagerEngine& iEngine; - /// Own: Progress dialog for iActiveExec - CAknProgressDialog* iProgressDialog; - /// Own: Progress dialog for iActiveExec - CAknProgressDialog* iProgressDialogRefresh; - /// Ref: Progress info of iProgressDialog - CEikProgressInfo* iProgressInfo; - /// Own: Active object that executes copy and move operations - CFileManagerActiveExecute* iActiveExec; - /// Own: Array of marked items in listbox - CArrayFixFlat* iMarkedArray; - /// Currently active process - MFileManagerProcessObserver::TFileManagerProcess iActiveProcess; - /// Own: Popup menu for showing context sensitive menu - CEikMenuBar* iPopupMenu; - /// Own: This is used to update the progress bar - CPeriodic* iPeriodic; - // This is for progress bar - TInt64 iTotalTransferredBytes; - // This is for progress bar(in order to support over 2Gb files) - // Own: for wait note wrapper, delete items - CFileManagerActiveDelete* iActiveDelete; - // current listbox index - TInt iIndex; - // Own: Timer object to start refresh progress dialog - CPeriodic* iRefreshProgressDelayedStart; - // Own: Indicates that scheduled backup is pending - TBool iSchBackupPending; - // Own: Eject query dialog - CAknQueryDialog* iEjectQueryDialog; - // Own: Indicates if eject has been done - TBool iEjectDone; - // Own: Stores current progress value - TInt64 iProgressCurrentValue; - // Own: Stores final progress value - TInt64 iProgressFinalValue; - // Own: Denies directory refresh during query until selected operation gets started - TBool iDirectoryRefreshDenied; - // Own: Indicates postponed directory refresh - TBool iDirectoryRefreshPostponed; - // Own: For wait note stepping - CAknWaitNoteWrapper* iWaitNoteWrapper; - // Own: Indicates if there's a SendUi popup query dialog - TBool iSendUiPopupOpened; - - }; - -#endif // CFILEMANAGERVIEWBASE_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/Cfilemanagersearchresultsview.h --- a/filemanager/App/inc/Cfilemanagersearchresultsview.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* Copyright (c) 2002-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: View for search results -* -*/ - - -#ifndef CFILEMANAGERSEARCHRESULTSVIEW_H -#define CFILEMANAGERSEARCHRESULTSVIEW_H - -// INCLUDES -#include "CFileManagerViewBase.h" - -// CONSTANTS -_LIT8( KFileManagerSearchViewRefreshMsg, "FmgrRefresh" ); - -// FORWARD DECLARATIONS -class CFileManagerSearchFileArray; -class CAknNavigationControlContainer; -class CAknNavigationDecorator; -// CLASS DECLARATION -/** - * Search results view of the application. - */ -class CFileManagerSearchResultsView : public CFileManagerViewBase - { - public: // Constructors and destructor - /** - * Two-phased constructor.Leaves created view - * to cleanup stack. - * - * @return Newly constructed view - */ - static CFileManagerSearchResultsView* NewLC(); - - /** - * Destructor. - */ - ~CFileManagerSearchResultsView(); - - public: - - /** - * Forwards DirectoryChange information to active view - * @since 2.0 - */ - void DirectoryChangedL(); - - private: // From CAknView - /** - * @see CAknView - */ - void HandleCommandL( TInt aCommand ); - - /** - * @see CAknView - */ - void DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * @see CAknView - */ - void DoDeactivate(); - - /** - * @see CAknView - */ - TUid Id() const; - - private: // From CFileManagerViewBase - /** - * @see CFileManagerViewBase - */ - CFileManagerContainerBase* CreateContainerL(); - - /** - * @see CFileManagerViewBase - */ - void UpdateCbaL(); - - private: - /** - * Standard C++ constructor. - */ - CFileManagerSearchResultsView(); - - /** - * 2nd phase constructor. - */ - void ConstructL(); - - void CmdBackL(); - - void RefreshTitleL(); - - private: // Data - /// Ref: Navi pane of the view - CAknNavigationControlContainer* iNaviPane; - - /// Ref: Pointer to empty navidecorator, needed for popping up correct decorator - CAknNavigationDecorator* iNaviDecorator; - - }; - -#endif // CFILEMANAGERSEARCHRESULTSVIEW_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/FileManager.hrh --- a/filemanager/App/inc/FileManager.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* -* Copyright (c) 2002-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 headers for project FileManager -* -*/ - - -#ifndef FILEMANAGER_HRH -#define FILEMANAGER_HRH - -/** - * View IDs of File Manager - * - */ -enum TFileManagerViewIds - { - EFileManagerMainViewId = 1, - EFileManagerMemoryStoreViewId, - EFileManagerFoldersViewId, - EFileManagerSearchResultsViewId, - EFileManagerBackupViewId, - EFileManagerRestoreViewId - }; - -/** - * Command IDs of FileManager - */ -enum TFileManagerCommands - { - EFileManagerOpen = 1, - EFileManagerSend, - EFileManagerDelete, - EFileManagerMoveToFolder, - EFileManagerCopyToFolder, - EFileManagerNewFolder, - EFileManagerMark, - EFileManagerRename, - EFileManagerFindFile, - EFileManagerReceiveViaIR, - EFileManagerViewInfo, - EFileManagerMemoryState, - EFileManagerFileDetails, - EFileManagerFolderDetails, - // Mark / Unmark subcommands - EFileManagerMarkOne, - EFileManagerUnmarkOne, - EFileManagerToggleMark, - EFileManagerMarkAll, - EFileManagerUnmarkAll, - EFileManagerCheckMark, - // Selection key - EFileManagerSelectionKey, - EFileManagerMoreInfoOnline, - EFileManagerBackup, - EFileManagerRestore, - EFileManagerEject, - EFileManagerDetails, - EFileManagerMemoryCardDetails, - EFileManagerOrganise, - EFileManagerConnectRemoveDrive, - EFileManagerDisconnectRemoveDrive, - EFileManagerRefreshRemoteDrive, - EFileManagerRemoveDrives, // Remove drives subcommands - EFileManagerRemoveDrivesSettings, - EFileManagerRemoveDrivesMapDrive, - EFileManagerRemoveDrivesDelete, - EFileManagerMemoryCard, // Memory card subcommands - EFileManagerMemoryCardName, - EFileManagerMemoryCardRename, - EFileManagerMemoryCardFormat, - EFileManagerMemoryCardPassword, // Memory card password subcommands - EFileManagerMemoryCardPasswordSet, - EFileManagerMemoryCardPasswordChange, - EFileManagerMemoryCardPasswordRemove, - EFileManagerUnlockMemoryCard, - EFileManagerFormatMassStorage, - EFileManagerSort, - EFileManagerSortByName, - EFileManagerSortByType, - EFileManagerSortMostRecentFirst, - EFileManagerSortLargestFirst, - EFileManagerSortByMatch, - EFileManagerSearchSort, - EFileManagerMemoryStorage, // Memory storage subcommands - EFileManagerMemoryStorageDetails, - EFileManagerMemoryStorageName, - EFileManagerMemoryStorageRename, - EFileManagerMemoryStorageSetPassword, - EFileManagerMemoryStorageChangePassword, - EFileManagerMemoryStorageRemovePassword, - EFileManagerMemoryStorageFormat, - EFileManagerMemoryStorageUnlock, - EFileManagerDeleteBackup - }; - -#endif // FILEMANAGER_HRH - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/inc/MFileManagerSchBackupObserver.h --- a/filemanager/App/inc/MFileManagerSchBackupObserver.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +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: Scheduled backup result observer -* -*/ - - - -#ifndef M_FILEMANAGERSCHBACKUPOBSERVER_H -#define M_FILEMANAGERSCHBACKUPOBSERVER_H - - -// INCLUDES -#include - - -// CLASS DECLARATION -/** - * This class observes global scheduled backup notifications - * - * @since S60 3.1 - */ -class MFileManagerSchBackupObserver - { - -public: - /** - * Handles scheduled backup finished notification - * - * @since S60 3.1 - * @param aError Finished backup status - */ - virtual void SchBackupFinishedL( TInt aError ) = 0; - - }; - -#endif // M_FILEMANAGERSCHBACKUPOBSERVER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerAppUi.cpp --- a/filemanager/App/src/CFileManagerAppUi.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1317 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File Manager application UI class. -* -*/ - - - -// INCLUDE FILES -#include // CAknTitlePane -#include // CAknNavigationControlContainer -#include // CAknNavigationDecorator -#include // CSendAppUi -#include -#include -#include -#include // HlpLauncher -#include -#include // For layout change event definitions -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include "CFileManagerAppUi.h" -#include "CFileManagerDocument.h" -#include "CFileManagerMainView.h" -#include "CFileManagerMemoryStoreView.h" -#ifdef RD_FILE_MANAGER_BACKUP - #include - #include "CFileManagerBackupView.h" - #include "CFileManagerRestoreView.h" - #include "CFileManagerTaskScheduler.h" - #include "CFileManagerSchBackupHandler.h" -#endif // RD_FILE_MANAGER_BACKUP -#include "CFileManagerFoldersView.h" -#include "Cfilemanagersearchresultsview.h" -#include "CFileManagerIconArray.h" -#include "FileManager.hrh" - - -// CONSTANTS -const TUid CFileManagerAppUi::KFileManagerMainViewId = - { EFileManagerMainViewId }; -const TUid CFileManagerAppUi::KFileManagerMemoryStoreViewId = - { EFileManagerMemoryStoreViewId }; -const TUid CFileManagerAppUi::KFileManagerFoldersViewId = - { EFileManagerFoldersViewId }; -const TUid CFileManagerAppUi::KFileManagerSearchResultsViewId = - { EFileManagerSearchResultsViewId }; -const TUid CFileManagerAppUi::KFileManagerBackupViewId = - { EFileManagerBackupViewId }; -const TUid CFileManagerAppUi::KFileManagerRestoreViewId = - { EFileManagerRestoreViewId }; - -const TUid KUidFileManager = { KFileManagerUID3 }; -const TUid KUidGsRsfwPlugin = { 0x101F9778 }; -const TUid KUidGsRsFwSettingsViewId = { 11 }; - - -// ============================ LOCAL FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// ProcessExists -// --------------------------------------------------------------------------- -// -static TBool ProcessExists( const TSecureId& aSecureId ) - { - _LIT( KFindPattern, "*" ); - TFindProcess finder( KFindPattern ); - TFullName processName; - while( finder.Next( processName ) == KErrNone ) - { - RProcess process; - if ( process.Open( processName ) == KErrNone ) - { - TSecureId processId( process.SecureId() ); - process.Close(); - if( processId == aSecureId ) - { - return ETrue; - } - } - } - return EFalse; - } - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::CFileManagerAppUi -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerAppUi::CFileManagerAppUi() : - iInitialFolderLevel( KErrNotFound ) - { - FUNC_LOG - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::~CFileManagerAppUi -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerAppUi::~CFileManagerAppUi() - { - FUNC_LOG - - iCoeEnv->RemoveForegroundObserver( *this ); - delete iIRReceiver; - delete iIRDeleteCB; - delete iSendUi; -#ifdef RD_FILE_MANAGER_BACKUP - delete iTaskScheduler; - delete iSchBackupHandler; -#endif // RD_FILE_MANAGER_BACKUP - CFileManagerEngine& engine = - static_cast< CFileManagerDocument* >( Document() )->Engine(); - engine.SetObserver( NULL ); - iSAS.Close(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::ConstructL() - { - FUNC_LOG - - // Construct only must have stuff required for app start here. - // Other stuff is constructed later to decrease app start time. - INFO_LOG( "CFileManagerAppUi::ConstructL()-BaseConstructL" ) - BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible ); - - INFO_LOG( "CFileManagerAppUi::ConstructL()-Setup panes" ) - CEikStatusPane* sp = StatusPane(); - iTitlePane = static_cast< CAknTitlePane* > - ( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); - - INFO_LOG( "CFileManagerAppUi::ConstructL()-Create main view" ) - CAknView* view = CFileManagerMainView::NewLC(); - AddViewL( view ); // Takes ownership - CleanupStack::Pop( view ); - SetDefaultViewL( *view ); - iActiveView = view->Id(); - - User::LeaveIfError( iSAS.Connect( KSM2GenMiddlewareDomain3 ) ); - -#ifdef RD_FILE_MANAGER_BACKUP - CFileManagerDocument* doc = - static_cast< CFileManagerDocument* >( Document() ); - iSchBackupStandalone = doc->IsScheduledBackup(); - if ( iSchBackupStandalone ) - { - // Do standalone scheduled backup startup - INFO_LOG( "CFileManagerAppUi::ConstructL-Launch scheduled backup" ) - iEikonEnv->WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); - RThread().SetProcessPriority( EPriorityForeground ); - sp->MakeVisible( EFalse ); - sp->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_EMPTY ); - StartSchBackupL(); - } - else - { -#endif // RD_FILE_MANAGER_BACKUP - - CFileManagerEngine& engine = - static_cast< CFileManagerDocument* >( Document() )->Engine(); - iWaitingForParams = engine.FeatureManager().IsEmbedded(); - - // Do normal application startup - INFO_LOG( "CFileManagerAppUi::ConstructL()-Add foreground observer" ) - iCoeEnv->AddForegroundObserverL( *this ); - -#ifdef RD_FILE_MANAGER_BACKUP - } -#endif // RD_FILE_MANAGER_BACKUP - - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::HandleCommandL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::HandleCommandL( TInt aCommand ) - { - switch( aCommand ) - { - case EEikCmdExit: // FALLTHROUGH - case EAknSoftkeyExit: - { - CFileManagerEngine& engine = - static_cast< CFileManagerDocument* >( Document() )->Engine(); - engine.CancelRefresh(); - Exit(); - break; - } - case EAknCmdHelp: - { - HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), - AppHelpContextL()); - break; - } - default: - break; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::HandleViewDeactivation -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::HandleViewDeactivation( - const TVwsViewId& aViewIdToBeDeactivated, - const TVwsViewId& aNewlyActivatedViewId ) - { - if ( aNewlyActivatedViewId.iAppUid == Application()->AppDllUid() ) - { - if ( IsFileManagerView( aNewlyActivatedViewId.iViewUid ) && - View( aNewlyActivatedViewId.iViewUid ) ) - { - iActiveView = aNewlyActivatedViewId.iViewUid; - } - } - CAknViewAppUi::HandleViewDeactivation( - aViewIdToBeDeactivated, aNewlyActivatedViewId ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::ActivateFoldersViewL -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerAppUi::ActivateFoldersViewL() - { - if ( iActiveView != KFileManagerFoldersViewId ) - { - if ( iSearchViewOpen ) - { - CreateAndActivateLocalViewL( KFileManagerFoldersViewId, - CFileManagerFoldersView::KOpenFromSearchResultsView, - KNullDesC8 ); - } - else - { - CreateAndActivateLocalViewL( KFileManagerFoldersViewId ); - } - return ETrue; - } - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::CloseFoldersViewL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::CloseFoldersViewL() - { - if ( iSearchViewOpen ) - { - CreateAndActivateLocalViewL( KFileManagerSearchResultsViewId ); - iActiveView = KFileManagerSearchResultsViewId; - } - else - { - ExitEmbeddedAppIfNeededL(); - ActivateMemoryStoreViewL(); - iActiveView = KFileManagerMemoryStoreViewId; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::ActivateSearchResultsViewL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::ActivateSearchResultsViewL() - { - if ( iActiveView != KFileManagerSearchResultsViewId ) - { - // Activate with refresh - CreateAndActivateLocalViewL( - KFileManagerSearchResultsViewId, - KNullUid, - KFileManagerSearchViewRefreshMsg ); - iSearchViewOpen = ETrue; - } - - CFileManagerEngine& engine = - static_cast< CFileManagerDocument* >( Document() )->Engine(); - SetTitleL( engine.SearchString() ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::CloseSearchResultsViewL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::CloseSearchResultsViewL() - { - CFileManagerEngine& engine = - static_cast< CFileManagerDocument* >( Document() )->Engine(); - TInt level( engine.FolderLevel() ); - - // If embedded, then ensure that the return folder is not below given level - // or on different drive - if ( engine.FeatureManager().IsEmbedded() ) - { - TPtrC dir( engine.CurrentDirectory().Left( - iFolderToOpenAtStartup.Length() ) ); - if ( engine.FolderLevel() < iInitialFolderLevel || - dir.CompareF( iFolderToOpenAtStartup ) ) - { - engine.SetDirectoryWithBackstepsL( iFolderToOpenAtStartup ); - level = iInitialFolderLevel; - } - } - - if ( level > 0 ) - { - CreateAndActivateLocalViewL( KFileManagerFoldersViewId ); - iActiveView = KFileManagerFoldersViewId; - } - else if ( !level ) - { - CreateAndActivateLocalViewL( KFileManagerMemoryStoreViewId ); - iActiveView = KFileManagerMemoryStoreViewId; - } - else - { - CreateAndActivateLocalViewL( KFileManagerMainViewId ); - iActiveView = KFileManagerMainViewId; - } - iSearchViewOpen = EFalse; - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::RestoreDefaultTitleL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::RestoreDefaultTitleL() - { - TResourceReader reader; - iCoeEnv->CreateResourceReaderLC( reader, R_FILEMANAGER_TITLE_PANE ); - iTitlePane->SetFromResourceL( reader ); // restore title pane - CleanupStack::PopAndDestroy(); // reader - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::SendUiL -// -// ----------------------------------------------------------------------------- -// -CSendUi& CFileManagerAppUi::SendUiL() - { - if ( !iSendUi ) - { - iSendUi = CSendUi::NewL(); - } - return *iSendUi; - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::HandleResourceChangeL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::HandleResourceChangeL( TInt aType ) - { - if( aType == KAknsMessageSkinChange || - aType == KEikDynamicLayoutVariantSwitch ) - { - CEikStatusPane* sp = StatusPane(); - sp->HandleResourceChange( aType ); - CFileManagerDocument* doc = - static_cast< CFileManagerDocument* >( Document() ); - doc->ClearStringCache(); - doc->IconArray()->UpdateIconsL(); - - if ( iActiveView == KFileManagerFoldersViewId ) - { - CFileManagerFoldersView* view = - static_cast< CFileManagerFoldersView* >( - View( KFileManagerFoldersViewId ) ); - view->HandleResourceChangeL( KAknsMessageSkinChange ); - } - NotifyViewScreenDeviceChanged(); - } - - CAknViewAppUi::HandleResourceChangeL( aType ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::HandleGainingForeground -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::HandleGainingForeground() - { - if ( !iForeGround ) - { - iForeGround = ETrue; - - CFileManagerViewBase* view = - static_cast< CFileManagerViewBase* >( View( iActiveView ) ); - - CFileManagerEngine& engine = - static_cast< CFileManagerDocument* >( Document() )->Engine(); - - engine.SetObserver( view ); - view->NotifyForegroundStatusChange( iForeGround ); - - if ( view->CurrentProcess() == - MFileManagerProcessObserver::ENoProcess ) - { - engine.FileSystemEvent( EFalse ); - } - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::HandleLosingForeground -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::HandleLosingForeground() - { - iForeGround = EFalse; - - CFileManagerViewBase* view = - static_cast< CFileManagerViewBase* >( View( iActiveView ) ); - - CFileManagerEngine& engine = - static_cast< CFileManagerDocument* >( Document() )->Engine(); - - engine.SetObserver( view ); - view->StoreIndex(); - view->NotifyForegroundStatusChange( iForeGround ); - - if ( view->CurrentProcess() == - MFileManagerProcessObserver::ENoProcess ) - { - engine.FileSystemEvent( ETrue ); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::IsFmgrForeGround -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerAppUi::IsFmgrForeGround() - { - return iForeGround; - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::HandleScreenDeviceChangedL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::HandleScreenDeviceChangedL() - { - CAknViewAppUi::HandleScreenDeviceChangedL(); - NotifyViewScreenDeviceChanged(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::HandleError() -// -// ----------------------------------------------------------------------------- -// -TErrorHandlerResponse CFileManagerAppUi::HandleError( TInt aError, - const SExtendedError& aExtErr, TDes& aErrorText, TDes& aContextText ) - { - ERROR_LOG1( "CFileManagerAppUi::HandleError()-aError=%d", aError ) - switch ( aError ) - { - case KErrCancel: // FALLTHROUGH - case KErrNotReady: - { - // Suppress notes for canceled operations. - // Suppress notes for not ready when caused by hotswap. - if ( View( iActiveView ) ) - { - return ENoDisplay; - } - break; - } - case KErrNotFound: // Fall through - case KErrPathNotFound: - { - CFileManagerViewBase* view = - static_cast< CFileManagerViewBase* >( View( iActiveView ) ); - TBool handled( EFalse ); - TRAPD( err, handled = view->HandleFileNotFoundL( aError ) ); - if ( err == KErrNone && handled ) - { - // Suppress not found when handled by refresh. - return ENoDisplay; - } - break; - } - default: - { - break; - } - } - return CAknViewAppUi::HandleError( - aError, aExtErr, aErrorText, aContextText ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi:ActivateMainViewL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::ActivateMainViewL() - { - if ( iActiveView != KFileManagerMainViewId ) - { - CreateAndActivateLocalViewL( KFileManagerMainViewId ); - iSearchViewOpen = EFalse; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi:ActivateMemoryStoreViewL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::ActivateMemoryStoreViewL() - { - if ( iActiveView != KFileManagerMemoryStoreViewId ) - { - CreateAndActivateLocalViewL( KFileManagerMemoryStoreViewId ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::CloseMemoryStoreViewL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::CloseMemoryStoreViewL() - { - if ( iSearchViewOpen ) - { - CreateAndActivateLocalViewL( KFileManagerSearchResultsViewId ); - } - else - { - ExitEmbeddedAppIfNeededL(); - CreateAndActivateLocalViewL( KFileManagerMainViewId ); - iActiveView = KFileManagerMainViewId; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::DriveInfo -// -// ----------------------------------------------------------------------------- -// -TFileManagerDriveInfo& CFileManagerAppUi::DriveInfo() - { - return iDriveInfo; - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::ActivateRemoteDriveSettingsViewL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::ActivateRemoteDriveSettingsViewL( const TDesC& aDriveName ) - { - CFileManagerDocument* doc = - static_cast< CFileManagerDocument* >( Document() ); - CFileManagerFeatureManager& featureManager( doc->Engine().FeatureManager() ); - - if ( !featureManager.IsRemoteStorageFwSupported() ) - { - return; - } - - if ( !View( KUidGsRsfwPlugin ) ) - { - TUid plugin_ID_Key; - TAny* ptr = REComSession::CreateImplementationL( - KUidGsRsfwPlugin, plugin_ID_Key ); - CAknView* view = reinterpret_cast< CAknView* >( ptr ); - - TRAPD( err, - { - doc->StorePluginL( plugin_ID_Key ); - AddViewL( view ); // Takes ownership - } ); - if ( err != KErrNone ) - { - REComSession::DestroyedImplementation( plugin_ID_Key ); - User::Leave( err ); - } - } - - if ( aDriveName.Length() ) - { - // 16bit Unicode conversion to UTF8 takes max 3 bytes per char - const TInt KUtf8Factor = 3; - HBufC8* buffer8 = HBufC8::NewLC( aDriveName.Length() * KUtf8Factor ); - TPtr8 ptr8( buffer8->Des() ); - - CnvUtfConverter::ConvertFromUnicodeToUtf8( ptr8, aDriveName ); - CreateActivateViewEventL( - TVwsViewId( KUidFileManager, KUidGsRsfwPlugin ), - KUidGsRsFwSettingsViewId, - *buffer8 ); - CleanupStack::PopAndDestroy( buffer8 ); - } - else - { - CreateActivateViewEventL( - TVwsViewId( KUidFileManager, KUidGsRsfwPlugin ), - KUidGsRsFwSettingsViewId, - KNullDesC8() ); - } - } - -#ifdef RD_FILE_MANAGER_BACKUP -// ----------------------------------------------------------------------------- -// CFileManagerAppUi:ActivateBackupViewL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::ActivateBackupViewL() - { - if ( iActiveView != KFileManagerBackupViewId ) - { - CAknView* view = View( KFileManagerBackupViewId ); - if ( !view ) - { - view = CFileManagerBackupView::NewLC(); - AddViewL( view ); // Takes ownership - CleanupStack::Pop( view ); - } - CreateAndActivateLocalViewL( KFileManagerBackupViewId ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi:CloseBackupViewL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::CloseBackupViewL() - { - CreateAndActivateLocalViewL( KFileManagerMainViewId ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi:ActivateRestoreViewL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::ActivateRestoreViewL( TBool aDeleteBackup ) - { - if ( iActiveView != KFileManagerRestoreViewId ) - { - if ( aDeleteBackup ) - { - CreateAndActivateLocalViewL( - KFileManagerRestoreViewId, - CFileManagerRestoreView::KDeleteBackups, - KNullDesC8 ); - } - else - { - CreateAndActivateLocalViewL( KFileManagerRestoreViewId ); - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi:CloseRestoreViewL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::CloseRestoreViewL() - { - CreateAndActivateLocalViewL( KFileManagerBackupViewId ); - iActiveView = KFileManagerBackupViewId; - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::ProcessCommandParametersL -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerAppUi::ProcessCommandParametersL( - TApaCommand aCommand, - TFileName& aDocumentName, - const TDesC8& aTail ) - { - switch( aCommand ) - { - case EApaCommandOpen: - { - TLex8 lex8( aTail ); - TInt32 sortMode( 0 ); - if ( lex8.Val( sortMode, EDecimal ) != KErrNone ) - { - sortMode = 0; // Use the default on error - } - SetFolderToOpenAtStartup( aDocumentName, sortMode ); - break; - } - default: - { - break; - } - } - aDocumentName.Zero(); - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi:ProcessMessageL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::ProcessMessageL( - TUid /*aUid*/, const TDesC8& aParams ) - { - if ( aParams.Length() ) - { - // Allow the backup only if scheduled backup starter exists - const TSecureId KFileManagerSchBkupUid( KFileManagerSchBkupUID3 ); - if( ProcessExists( KFileManagerSchBkupUid ) ) - { - HBufC* cmd = HBufC::NewLC( aParams.Length() ); - TPtr ptr( cmd->Des() ); - ptr.Copy( aParams ); - if ( !ptr.Compare( KSchBackupTaskName ) ) - { - StartSchBackupL(); - } - CleanupStack::PopAndDestroy( cmd ); - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi:StartSchBackupL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::StartSchBackupL() - { - CFileManagerViewBase* view = - static_cast< CFileManagerViewBase* >( View( iActiveView ) ); - view->StartSchBackupL(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::TaskSchedulerL -// -// ----------------------------------------------------------------------------- -// -CFileManagerTaskScheduler& CFileManagerAppUi::TaskSchedulerL() - { - if ( !iTaskScheduler ) - { - CFileManagerDocument* doc = - static_cast< CFileManagerDocument* >( Document() ); - iTaskScheduler = CFileManagerTaskScheduler::NewL( - doc->Engine() ); - } - return *iTaskScheduler; - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::SchBackupHandlerL -// -// ----------------------------------------------------------------------------- -// -CFileManagerSchBackupHandler& CFileManagerAppUi::SchBackupHandlerL() - { - if ( !iSchBackupHandler ) - { - CFileManagerDocument* doc = - static_cast< CFileManagerDocument* >( Document() ); - iSchBackupHandler = CFileManagerSchBackupHandler::NewL( - doc->Engine() ); - iSchBackupHandler->SetObserver( this ); - } - return *iSchBackupHandler; - } - -#endif // RD_FILE_MANAGER_BACKUP - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::StartIRReceiveL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::StartIRReceiveL( - MFileManagerProcessObserver& aObserver ) - { - FUNC_LOG - - delete iIRDeleteCB; - iIRDeleteCB = NULL; - - delete iIRReceiver; - iIRReceiver = NULL; - - CFileManagerEngine& engine = - static_cast< CFileManagerDocument* >( Document() )->Engine(); - iIRReceiver = CFileManagerIRReceiver::NewL( - aObserver, - engine.CurrentDirectory(), - engine ); - iIRReceiver->ReceiveFileL(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerAppUi::StopIRReceive() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerAppUi::StopIRReceive() - { - FUNC_LOG - - if ( iIRReceiver ) - { - iIRReceiver->StopReceiving(); - - delete iIRDeleteCB; - iIRDeleteCB = NULL; - - iIRDeleteCB = new CAsyncCallBack( - TCallBack( DeleteIRReceiveCB, this ), - CActive::EPriorityStandard ); - if ( iIRDeleteCB ) - { - iIRDeleteCB->CallBack(); - } - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::DeleteIRReceiveCB -// -// ------------------------------------------------------------------------------ -// -TInt CFileManagerAppUi::DeleteIRReceiveCB( TAny* aPtr ) - { - FUNC_LOG - - CFileManagerAppUi* self = static_cast< CFileManagerAppUi* >( aPtr ); - - delete self->iIRReceiver; - self->iIRReceiver = NULL; - - delete self->iIRDeleteCB; - self->iIRDeleteCB = NULL; - - return KErrNone; - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::NotifyViewScreenDeviceChanged -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::NotifyViewScreenDeviceChanged() - { - CAknView* activeView = View( iActiveView ); - if ( activeView ) - { - CFileManagerViewBase* view = - static_cast< CFileManagerViewBase* > ( activeView ); - view->ScreenDeviceChanged(); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::SetTitleL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::SetTitleL( const TDesC& aTitle ) - { - iTitlePane->SetTextL( aTitle ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::SetTitleL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::SetTitleL( const TInt aTitle ) - { - HBufC* title = StringLoader::LoadLC( aTitle ); - iTitlePane->SetTextL( *title ); - CleanupStack::PopAndDestroy( title ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::ScheduledBackupFinishedL -// -// ------------------------------------------------------------------------------ -// -#ifdef RD_FILE_MANAGER_BACKUP -void CFileManagerAppUi::SchBackupFinishedL( TInt /*aError*/ ) - { - CFileManagerViewBase* view = - static_cast< CFileManagerViewBase* >( View( iActiveView ) ); - if ( view->CurrentProcess() == MFileManagerProcessObserver::ESchBackupProcess ) - { - view->SchBackupFinishedL(); - } - if ( iSchBackupStandalone ) - { - ProcessCommandL( EAknCmdExit ); - } - } -#else // RD_FILE_MANAGER_BACKUP -void CFileManagerAppUi::SchBackupFinishedL( TInt /*aError*/ ) - { - } -#endif // RD_FILE_MANAGER_BACKUP - - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::IsFileManagerView -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerAppUi::IsFileManagerView( const TUid aViewUid ) - { - return ( aViewUid == KFileManagerFoldersViewId || - aViewUid == KFileManagerSearchResultsViewId || - aViewUid == KFileManagerMainViewId || - aViewUid == KFileManagerMemoryStoreViewId || - aViewUid == KFileManagerBackupViewId || - aViewUid == KFileManagerRestoreViewId ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::NotifyCbaUpdate -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::NotifyCbaUpdate() - { - CAknView* activeView = View( iActiveView ); - if ( activeView ) - { - CFileManagerViewBase* view = - static_cast< CFileManagerViewBase* > ( activeView ); - TRAP_IGNORE( view->UpdateCbaL() ); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::SetFolderToOpenAtStartup -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::SetFolderToOpenAtStartup( - const TDesC& aFullPath, TInt aSortMode ) - { - FUNC_LOG - - INFO_LOG2( - "CFileManagerAppUi::SetFolderToOpenAtStartup-%S-%d", - &aFullPath, aSortMode ) - - // Validate given path - _LIT( KWild1, "*" ); - _LIT( KWild2, "?" ); - const TInt KWildLen = 1; - CFileManagerEngine& engine = - static_cast< CFileManagerDocument* >( Document() )->Engine(); - RFs& fs( iEikonEnv->FsSession() ); - TInt err( KErrNone ); - if ( !aFullPath.Length() || - !aFullPath.Left( KWildLen ).CompareF( KWild1 ) || - !aFullPath.Left( KWildLen ).CompareF( KWild2 ) ) - { - err = KErrBadName; // Ignore bad drives - } - else - { - TParsePtrC parse( aFullPath ); - if ( !parse.DrivePresent() || !parse.PathPresent() ) - { - err = KErrBadName; // Ignore bad paths - } - TUint driveStatus( 0 ); - if ( err == KErrNone ) - { - TInt drive = TDriveUnit( aFullPath ); - err = DriveInfo::GetDriveStatus( fs, drive, driveStatus ); - if ( err != KErrNone || - !( driveStatus & DriveInfo::EDriveUserVisible ) ) - { - err = KErrAccessDenied; // Ignore hidden drives - } - else - { - TFileName rootPath; - err = PathInfo::GetRootPath( rootPath, drive ); - if ( err == KErrNone && - rootPath.CompareF( aFullPath.Left( rootPath.Length() ) ) ) - { - err = KErrAccessDenied; // Ignore paths below root level - } - } - } - if ( err == KErrNone && - !( driveStatus & DriveInfo::EDriveRemote ) ) - { - if ( engine.IsSystemFolder( parse.DriveAndPath() ) ) - { - err = KErrAccessDenied; // Ignore system folders - } - else if ( !( driveStatus & DriveInfo::EDriveReadOnly ) ) - { - TRAP( err, BaflUtils::EnsurePathExistsL( - fs, parse.DriveAndPath() ) ); - } - } - if ( err == KErrNone ) - { - iFolderToOpenAtStartup.Copy( parse.DriveAndPath() ); - engine.SetSortMethod( - static_cast< CFileManagerEngine::TSortMethod >( aSortMode ) ); - engine.SetCurrentItemName(parse.NameAndExt()); - TRAP( err, OpenFolderViewAtStartupL() ); - } - } - if ( err != KErrNone ) - { - ERROR_LOG1( "CFileManagerAppUi::SetFolderToOpenAtStartup-err=%d", err ) - iWaitingForParams = EFalse; - - // Refresh only if embedded app - if ( engine.FeatureManager().IsEmbedded() ) - { - engine.RefreshDirectory(); - } - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::ProcessAiwParamListL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::ProcessAiwParamListL( - const CAiwGenericParamList& aInParams ) - { - FUNC_LOG - - iWaitingForParams = EFalse; - - TPtrC folder( KNullDesC ); - TInt folderSortMode( KErrNotFound ); - TInt i( 0 ); - // Get folder path - const TAiwGenericParam* param = aInParams.FindFirst( - i, EGenericParamDir, EVariantTypeDesC ); - if ( i != KErrNotFound && param ) - { - folder.Set( param->Value().AsDes() ); - } - // Get folder sort mode - param = aInParams.FindFirst( - i, EGenericParamDir, EVariantTypeTInt32 ); - if ( i != KErrNotFound && param ) - { - folderSortMode = param->Value().AsTInt32(); - } - SetFolderToOpenAtStartup( folder, folderSortMode ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::OpenFolderViewAtStartupL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::OpenFolderViewAtStartupL() - { - FUNC_LOG - - CFileManagerEngine& engine = - static_cast< CFileManagerDocument* >( Document() )->Engine(); - engine.SetDirectoryWithBackstepsL( iFolderToOpenAtStartup ); - if( engine.NavigationLevel() <= 0 ) - { - ActivateMemoryStoreViewL(); - // Ensure that view change gets updated when used during contruction - iActiveView = KFileManagerMemoryStoreViewId; - } - else - { - ActivateFoldersViewL(); - // Ensure that view change gets updated when used during contruction - iActiveView = KFileManagerFoldersViewId; - } - // Store initial folder level when embedded - if ( engine.FeatureManager().IsEmbedded() ) - { - iInitialFolderLevel = engine.FolderLevel(); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::ExitEmbeddedAppIfNeededL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::ExitEmbeddedAppIfNeededL() - { - FUNC_LOG - - CFileManagerEngine& engine = - static_cast< CFileManagerDocument* >( Document() )->Engine(); - // Exit embedded app if the initial folder level is crossed - if ( engine.FeatureManager().IsEmbedded() && - engine.FolderLevel() < iInitialFolderLevel ) - { - ProcessCommandL( EAknCmdExit ); - User::Leave( KErrCancel ); // To abort current operation - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::WaitingForInputParams -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerAppUi::WaitingForInputParams() const - { - return iWaitingForParams; - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::CreateAndActivateLocalViewL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::CreateAndActivateLocalViewL( - TUid aViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage ) - { - FUNC_LOG - - CAknView* view = View( aViewId ); - if ( !view ) - { - if ( aViewId == KFileManagerMainViewId ) - { - view = CFileManagerMainView::NewLC(); - } - else if ( aViewId == KFileManagerMemoryStoreViewId ) - { - view = CFileManagerMemoryStoreView::NewLC(); - } - else if ( aViewId == KFileManagerFoldersViewId ) - { - view = CFileManagerFoldersView::NewLC(); - } - else if ( aViewId == KFileManagerSearchResultsViewId ) - { - view = CFileManagerSearchResultsView::NewLC(); - } - else if ( aViewId == KFileManagerBackupViewId ) - { - view = CFileManagerBackupView::NewLC(); - } - else if ( aViewId == KFileManagerRestoreViewId ) - { - view = CFileManagerRestoreView::NewLC(); - } - else - { - ERROR_LOG1( - "CFileManagerAppUi::CreateAndActivateLocalViewL-InvalidView=0x%x", - aViewId.iUid ) - User::Leave( KErrNotFound ); - } - AddViewL( view ); // Takes ownership - CleanupStack::Pop( view ); - } - ActivateLocalViewL( aViewId, aCustomMessageId, aCustomMessage ); - iActiveView = aViewId; - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::CreateAndActivateLocalViewL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::CreateAndActivateLocalViewL( TUid aViewId ) - { - FUNC_LOG - - CreateAndActivateLocalViewL( aViewId, KNullUid, KNullDesC8 ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::IsSearchViewOpen -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerAppUi::IsSearchViewOpen() const - { - return iSearchViewOpen; - } -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::BackupOrRestoreStarted -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::BackupOrRestoreStarted() - { - iManualBackupOrRestoreStarted.HomeTime(); - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::BackupOrRestoreEnded -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::BackupOrRestoreEnded() - { - iManualBackupOrRestoreEnded.HomeTime(); - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::BackupOrRestoreStartTime -// -// ------------------------------------------------------------------------------ -// -TTime CFileManagerAppUi::BackupOrRestoreStartTime() const - { - return iManualBackupOrRestoreStarted; - } - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::BackupOrRestoreEndTime -// -// ------------------------------------------------------------------------------ -// -TTime CFileManagerAppUi::BackupOrRestoreEndTime() const - { - return iManualBackupOrRestoreEnded; - } -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::ResetBackupOrRestoreEndTime -// -// ------------------------------------------------------------------------------ -// -void CFileManagerAppUi::ResetBackupOrRestoreEndTime() - { - iManualBackupOrRestoreStarted = 0; - iManualBackupOrRestoreEnded = 0; - } - - -// ------------------------------------------------------------------------------ -// CFileManagerAppUi::IsSystemStateNormal -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerAppUi::IsSystemStateNormal() const - { - TSsmState state = iSAS.State(); - return ( state.MainState() == ESsmNormal ); - } - -// End of File - diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerApplication.cpp --- a/filemanager/App/src/CFileManagerApplication.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* Copyright (c) 2002-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: File Manager application class. -* -*/ - - - -// INCLUDE FILES -#include -#include "CFileManagerApplication.h" -#include "CFileManagerDocument.h" -#include "FileManagerUID.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerApplication::CFileManagerApplication -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerApplication::CFileManagerApplication() - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerApplication::~CFileManagerApplication -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerApplication::~CFileManagerApplication() - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerApplication::CreateDocumentL -// -// ----------------------------------------------------------------------------- -// -CApaDocument* CFileManagerApplication::CreateDocumentL() - { - return CFileManagerDocument::NewL( *this ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerApplication::AppDllUid -// -// ----------------------------------------------------------------------------- -// -TUid CFileManagerApplication::AppDllUid() const - { - return TUid::Uid( KFileManagerUID3 ); - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// NewApplication -// Creates a new FileManager application object (CFileManagerApplication). -// Called by the application framework. -// Returns the new application object (CFileManagerApplication). -// NULL if out of memory. -// ----------------------------------------------------------------------------- -// -EXPORT_C CApaApplication* NewApplication() - { - return new CFileManagerApplication; - } - -// ----------------------------------------------------------------------------- -// E32Main -// Standard entry point for the application exe (FileManager.exe). -// Returns standard Symbian OS error code, KErrNone if succesful. -// ----------------------------------------------------------------------------- -// -GLDEF_C TInt E32Main() - { - return EikStart::RunApplication( NewApplication ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerBackupView.cpp --- a/filemanager/App/src/CFileManagerBackupView.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,568 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: View for backup settings -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef RD_MULTIPLE_DRIVE -#include -#include -#endif // RD_MULTIPLE_DRIVE -#include -#include "CFileManagerBackupView.h" -#include "CFileManagerTaskScheduler.h" -#include "CFileManagerSettingListContainer.h" -#include "CFileManagerAppUi.h" -#include "FileManager.hrh" - - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::CFileManagerBackupView -// ---------------------------------------------------------------------------- -// -CFileManagerBackupView::CFileManagerBackupView() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::NewLC -// ---------------------------------------------------------------------------- -// -CFileManagerBackupView* CFileManagerBackupView::NewLC() - { - CFileManagerBackupView* self = new( ELeave ) CFileManagerBackupView(); - CleanupStack::PushL( self ); - self->ConstructL( R_FILEMANAGER_BACKUP_VIEW ); - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::~CFileManagerBackupView -// ---------------------------------------------------------------------------- -// -CFileManagerBackupView::~CFileManagerBackupView() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::DoActivateL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ) - { - FUNC_LOG - - CFileManagerViewBase::DoActivateL( - aPrevViewId, aCustomMessageId, aCustomMessage ); - - static_cast< CFileManagerAppUi* >( AppUi() )->SetTitleL( - R_QTN_FMGR_BACKUP_TITLE ); - - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - settings.RefreshL(); - - iContainer->RefreshListL( iIndex ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerBackupView::DoDeactivate -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::DoDeactivate() - { - FUNC_LOG - - CFileManagerViewBase::DoDeactivate(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::DirectoryChangedL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::DirectoryChangedL() - { - FUNC_LOG - - TRAP_IGNORE( RefreshSettingsL() ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::Id -// ---------------------------------------------------------------------------- -// -TUid CFileManagerBackupView::Id() const - { - return CFileManagerAppUi::KFileManagerBackupViewId; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::CreateContainerL -// ---------------------------------------------------------------------------- -// -CFileManagerContainerBase* CFileManagerBackupView::CreateContainerL() - { - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - - return CFileManagerSettingListContainer::NewL( - ClientRect(), - iIndex, - CFileManagerSettingListContainer::EListBackup, - &settings, - KFMGR_HLP_BACKUP_VIEW ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::HandleCommandL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::HandleCommandL( TInt aCommand ) - { - switch( aCommand ) - { - case EFileManagerSelectionKey: // FALLTHROUGH - case EFileManagerOpen: - { - CmdChangeL(); - break; - } - case EFileManagerBackup: - { - CmdBackupL(); - break; - } - case EFileManagerRestore: - { - CmdRestoreL(); - break; - } - case EFileManagerDeleteBackup: - { - CmdDeleteBackupL(); - break; - } - case EAknSoftkeyBack: - { - CmdBackL(); - break; - } - default: - { - CFileManagerViewBase::HandleCommandL( aCommand ); - break; - } - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::CmdChangeL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::CmdChangeL() - { - if ( !iContainer ) - { - return; - } - TInt index( iContainer->ListBoxCurrentItemIndex() ); - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - - StoreIndex(); - - switch ( settings.SettingAt( index ) ) - { - case CFileManagerBackupSettings::EContents: - { - ChangeContentsL(); - break; - } - case CFileManagerBackupSettings::EScheduling: - { - ChangeSchedulingL(); - break; - } - case CFileManagerBackupSettings::EWeekday: - { - ChangeWeekdayL(); - break; - } - case CFileManagerBackupSettings::ETime: - { - ChangeTimeL(); - break; - } - case CFileManagerBackupSettings::ETarget: - { - ChangeTargetDriveL(); - break; - } - default: - { - break; - } - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::CmdBackupL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::CmdBackupL() - { - if ( !iContainer ) - { - return; - } - - TBool isSystemStateNormal = static_cast< CFileManagerAppUi* >( AppUi() )->IsSystemStateNormal(); - if ( !isSystemStateNormal ) - { - FileManagerDlgUtils::ShowErrorNoteL( R_QTN_FMGR_SYSTEM_NOT_READY ); - return; - } - - StoreIndex(); - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - TInt drive( settings.TargetDrive() ); - TFileManagerDriveInfo drvInfo; - if( !IsDriveAvailable( drive ) ) - { - for( TInt i ( EDriveA ) ; i <= EDriveZ ; i++ ) - { - iEngine.GetDriveInfoL( i , drvInfo ); - if( ( IsDriveAvailable( i ) ) && ( drvInfo.iState & TFileManagerDriveInfo::EDriveEjectable ) ) - { - drive = i; - settings.SetTargetDrive( drive ); - settings.SaveL(); - break; - } - } - } - RArray< CFileManagerRestoreSettings::TInfo > info; - CleanupClosePushL( info ); - iEngine.GetRestoreInfoArrayL( info, drive ); - TInt count( info.Count() ); - CleanupStack::PopAndDestroy( &info ); - TPtrC driveName( iEngine.DriveName( drive ) ); - TBool isContinue( true ); - - - const TInt64 KBackupLimitSize = 10000000; - - //define a protected limit size to avoid not enough space during backup - - if( count ) - { - TInt textId( R_QTN_FMGR_BACKUP_QUERY_EXISTS ); - - if( !FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( - textId, driveName ) ) - { - isContinue = false; - } - } - if( isContinue ) - { - if ( !DriveReadOnlyMmcL( drive ) ) - { - if ( !IsDriveAvailable( drive ) ) - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_FMGR_ERROR_BACKUP_MEMORYCARD_NOT_AVAILABLE ); - } - else if ( !CheckPhoneState() ) - { - FileManagerDlgUtils::ShowErrorNoteL( R_QTN_CRITICAL_ERROR ); - } - else if ( !iEngine.EnoughSpaceL( - TDriveUnit( drive ).Name(), KBackupLimitSize, EBackupProcess ) ) - { - FileManagerDlgUtils::ShowConfirmQueryWithOkL( - FileManagerDlgUtils::EErrorIcons, - R_QTN_FMGR_BACKUP_DESTINATION_FULL, - driveName ); - } - else - { - StartProcessL( EBackupProcess ); - } - } - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::CmdRestoreL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::CmdRestoreL() - { - StoreIndex(); - static_cast< CFileManagerAppUi* >( AppUi() )->ActivateRestoreViewL(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::ChangeContentsL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::ChangeContentsL() - { - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - TUint32 selection( settings.Content() ); - - if ( FileManagerDlgUtils::ShowNOfMSettingQueryL( - R_QTN_FMGR_BACKUP_CONTENTS, - R_FILEMANAGER_BACKUP_CONTENTS_TEXTS, - selection, - 0 ) ) - { - settings.SetContent( selection ); - settings.SaveL(); - iContainer->RefreshListL( iIndex ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::ChangeSchedulingL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::ChangeSchedulingL() - { - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - TInt index( settings.Scheduling() ); - - if ( FileManagerDlgUtils::ShowOOfMSettingQueryL( - R_QTN_FMGR_BACKUP_SCHEDULING, - R_FILEMANAGER_BACKUP_SCHEDULING_TEXTS, - index ) ) - { - settings.SetScheduling( index ); - settings.SaveL(); - iContainer->RefreshListL( iIndex ); - UpdateScheduleL(); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::ChangeWeekdayL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::ChangeWeekdayL() - { - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - TDay day( static_cast< TDay >( settings.Day() ) ); - - if ( FileManagerDlgUtils::ShowWeekdayQueryL( - R_QTN_FMGR_BACKUP_WEEKDAY, - day ) ) - { - settings.SetDay( day ); - settings.SaveL(); - iContainer->RefreshListL( iIndex ); - UpdateScheduleL(); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::ChangeTargetDriveL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::ChangeTargetDriveL() - { -#ifdef RD_MULTIPLE_DRIVE - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - - HBufC* title = StringLoader::LoadLC( - R_QTN_FMGR_SELECT_BACKUP_DESTINATION ); - - TUint32 drvMask( settings.AllowedDriveAttMatchMask() ); - TInt memType( AknCommonDialogsDynMem::EMemoryTypeMMCExternal ); - if ( drvMask & KDriveAttRemote ) - { - memType |= AknCommonDialogsDynMem::EMemoryTypeRemote; - } - - CAknMemorySelectionDialogMultiDrive* dlg = - CAknMemorySelectionDialogMultiDrive::NewL( - ECFDDialogTypeNormal, - R_FILEMANAGER_FIND_MEMORY_SELECTIONDIALOG, - ETrue, - memType ); - CleanupStack::PushL( dlg ); - dlg->SetTitleL( *title ); - TDriveNumber driveNumber( static_cast< TDriveNumber >( - settings.TargetDrive() ) ); - TBool ret( dlg->ExecuteL( driveNumber ) ); - CleanupStack::PopAndDestroy( dlg ); - CleanupStack::PopAndDestroy( title ); - if ( ret ) - { - TInt drive( static_cast< TInt >( driveNumber ) ); - if ( drive != settings.TargetDrive() ) - { - settings.SetTargetDrive( drive ); - settings.SaveL(); - iContainer->RefreshListL( iIndex ); - } - } -#endif // RD_MULTIPLE_DRIVE - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::ChangeTimeL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::ChangeTimeL() - { - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - TTime time( settings.Time() ); - - if ( FileManagerDlgUtils::ShowTimeSettingQueryL( - R_QTN_FMGR_BACKUP_TIME, - time ) ) - { - settings.SetTime( time ); - settings.SaveL(); - iContainer->RefreshListL( iIndex ); - UpdateScheduleL(); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::CmdBackL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::CmdBackL() - { - iIndex = 0; - static_cast< CFileManagerAppUi* >( AppUi() )->CloseBackupViewL(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::UpdateScheduleL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::UpdateScheduleL() - { - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - CFileManagerAppUi* appUi = - static_cast< CFileManagerAppUi* >( AppUi() ); - CFileManagerTaskScheduler& scheduler( appUi->TaskSchedulerL() ); - - if ( settings.Scheduling() == EFileManagerBackupScheduleNone ) - { - scheduler.EnableBackupScheduleL( EFalse ); - } - else - { - scheduler.EnableBackupScheduleL( ETrue ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::NotifyForegroundStatusChange -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::NotifyForegroundStatusChange( - TBool aForeground ) - { - FUNC_LOG - - if ( aForeground ) - { - TRAP_IGNORE( RefreshSettingsL() ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::RefreshSettingsL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::RefreshSettingsL() - { - FUNC_LOG - - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - settings.RefreshL(); - if ( iContainer ) - { - iContainer->RefreshListL( iIndex ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::CmdDeleteBackupL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::CmdDeleteBackupL() - { - StoreIndex(); - static_cast< CFileManagerAppUi* >( AppUi() )->ActivateRestoreViewL( ETrue ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::DynInitMenuPaneL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::DynInitMenuPaneL( - TInt aResourceId, CEikMenuPane* aMenuPane) - { - switch( aResourceId ) - { - case R_FILEMANAGER_BACKUP_VIEW_MENU: - { - BackupMenuFilteringL( *aMenuPane ); - break; - } - default: - { - CFileManagerViewBase::DynInitMenuPaneL( aResourceId, aMenuPane ); - break; - } - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupView::BackupMenuFilteringL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupView::BackupMenuFilteringL( CEikMenuPane& aMenuPane ) - { - CFileManagerRestoreSettings& settings( iEngine.RestoreSettingsL() ); - TRAP_IGNORE( settings.RefreshL() ); - if ( !settings.MdcaCount() ) - { - aMenuPane.SetItemDimmed( EFileManagerDeleteBackup, ETrue ); - } - aMenuPane.SetItemDimmed( EFileManagerOpen, ETrue ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerContainerBase.cpp --- a/filemanager/App/src/CFileManagerContainerBase.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,591 +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 all file manager containers -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include "CFileManagerContainerBase.h" -#include "FileManager.hrh" - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::CFileManagerContainerBase -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerContainerBase::CFileManagerContainerBase() - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::ConstructL( - const TRect& aRect, - const TInt aFocusedIndex ) - { - CreateWindowL(); - iListBox = CreateListBoxL(); - if ( !iListBox ) - { - User::Leave( KErrGeneral ); - } - SetListEmptyL(); - iListBox->CreateScrollBarFrameL( ETrue ); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - iListBox->SetObserver( this ); - iListBox->SetListBoxObserver( this ); - SetIndex( aFocusedIndex ); - iListBox->SetFocus( ETrue ); - iListBox->AddSelectionObserverL( this ); - SetRect( aRect ); - ActivateL(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::~CFileManagerContainerBase -// -// ----------------------------------------------------------------------------- -// -CFileManagerContainerBase::~CFileManagerContainerBase() - { - delete iListBox; - delete iEmptyText; - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::SizeChanged -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::SizeChanged() - { - if ( iListBox ) - { - iListBox->SetRect( Rect() ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::CountComponentControls -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerContainerBase::CountComponentControls() const - { - return iListBox ? 1 : 0; - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ComponentControl -// -// ----------------------------------------------------------------------------- -// -CCoeControl* CFileManagerContainerBase::ComponentControl( - TInt /* aIndex */ ) const - { - return iListBox; - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::OfferKeyEventL -// -// ----------------------------------------------------------------------------- -// -TKeyResponse CFileManagerContainerBase::OfferKeyEventL( - const TKeyEvent& aKeyEvent, TEventCode aType ) - { - return iListBox->OfferKeyEventL( aKeyEvent, aType ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ListBox -// -// ----------------------------------------------------------------------------- -// -CEikListBox& CFileManagerContainerBase::ListBox() - { - return *iListBox; - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::RefreshListL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::RefreshListL( TInt aFocusedIndex ) - { - if ( !iListBox ) - { - return; - } - - TBool isEmpty( ETrue ); - if ( iArray ) - { - if ( iArray->MdcaCount() ) - { - isEmpty = EFalse; - iListBox->Model()->SetItemTextArray( iArray ); - // Remove ownership from listbox. - iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - } - if ( isEmpty ) - { - SetEmptyArrayL(); - } - - iListBox->Reset(); - SetIndex( aFocusedIndex ); - iListBox->UpdateScrollBarsL(); - iListBox->SetFocus( ETrue ); - - if ( iEmptyText ) - { - iListBox->View()->SetListEmptyTextL( *iEmptyText ); - } - else - { - iListBox->View()->SetListEmptyTextL( KNullDesC ); - } - iListBox->DrawDeferred(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::SetListEmptyL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::SetListEmptyL() - { - if ( !iListBox ) - { - return; - } - SetEmptyArrayL(); - iListBox->View()->SetListEmptyTextL( KNullDesC ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::SetIndex -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::SetIndex( TInt aFocusedIndex ) - { - if ( !iListBox ) - { - return; - } - // Check that given index is valid - if ( aFocusedIndex >= 0 && - aFocusedIndex < iListBox->Model()->NumberOfItems() ) - { - iListBox->SetCurrentItemIndex( aFocusedIndex ); - } - else - { - // if list is empty or value is negative then set focus to 0 - if ( !iListBox->Model()->NumberOfItems() || aFocusedIndex < 0 ) - { - iListBox->SetCurrentItemIndex( 0 ); - } - else - { - // Something has been deleted in the end of the list - // set focus to last one so the focus doesn't jump around - iListBox->SetCurrentItemIndex( - iListBox->Model()->NumberOfItems() - 1 ); - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::SetTextArray -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::SetTextArray( MDesCArray* aArray ) - { - iArray = aArray; - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::SetEmptyTextL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::SetEmptyTextL( TInt aTextId ) - { - delete iEmptyText; - iEmptyText = NULL; - - if ( aTextId ) - { - iEmptyText = StringLoader::LoadL( aTextId ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::SetHelpContext -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::SetHelpContext( - const TDesC& aHelpContext ) - { - iHelpContext = aHelpContext; - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::HandleListBoxEventL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::HandleListBoxEventL( - CEikListBox* /*aListBox*/, TListBoxEvent aEventType ) - { - switch ( aEventType ) - { - case EEventItemSingleClicked: // FALLTHROUGH - case EEventEnterKeyPressed: - { - static_cast< CAknAppUi* >( ControlEnv()->AppUi() )-> - ProcessCommandL( EFileManagerSelectionKey ); - break; - } - default: - { - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::HandleControlEventL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::HandleControlEventL( - CCoeControl* /* aControl*/, TCoeEvent /*aEventType*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::FocusChanged -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::FocusChanged( TDrawNow aDrawNow ) - { - CCoeControl::FocusChanged( aDrawNow ); - - if ( iListBox ) - { - iListBox->SetFocus( IsFocused(), aDrawNow ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::GetHelpContext -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::GetHelpContext( - TCoeHelpContext& aContext ) const - { - if ( iHelpContext.Length() ) - { - aContext.iMajor = TUid::Uid( KFileManagerUID3 ); - aContext.iContext = iHelpContext; - } - else - { - CCoeControl::GetHelpContext( aContext ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ListBoxExists -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerContainerBase::ListBoxExists() const - { - return iListBox ? ETrue : EFalse; - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::SetEmptyArrayL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::SetEmptyArrayL() - { - CDesCArray* empty = new( ELeave ) CDesCArrayFlat( 1 ); - iListBox->Model()->SetItemTextArray( empty ); - // Transfer ownership to listbox. - iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ProcessCommandL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::ProcessCommandL( TInt aCommandId ) - { - switch ( aCommandId ) - { - case EAknSoftkeyShiftMSK: - { - static_cast< CAknAppUi* >( ControlEnv()->AppUi() )-> - ProcessCommandL( EFileManagerToggleMark ); - break; - } - - default: - { - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::SelectionModeChanged -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::SelectionModeChanged( - CEikListBox* aListBox, TBool aSelectionModeEnabled ) - { - if ( iListBox == aListBox && - iSelectionModeEnabled != aSelectionModeEnabled ) - { - iSelectionModeEnabled = aSelectionModeEnabled; - if ( !iSelectionModeEnabled ) - { - // Update cba after selection mode gets done - UpdateCba(); - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::SelectionModeEnabled -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerContainerBase::SelectionModeEnabled() const - { - return iSelectionModeEnabled; - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::UpdateCba -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::UpdateCba() - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ListBoxCurrentItemIndex -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerContainerBase::ListBoxCurrentItemIndex() - { - return iListBox->CurrentItemIndex(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ListBoxNumberOfItems -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerContainerBase::ListBoxNumberOfItems() - { - return iListBox->Model()->NumberOfItems(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ListBoxSelectionIndexes -// -// ----------------------------------------------------------------------------- -// -const CArrayFix< TInt >* CFileManagerContainerBase::ListBoxSelectionIndexes() - { - return iListBox->SelectionIndexes(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ListBoxSelectionIndexesCount -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerContainerBase::ListBoxSelectionIndexesCount() - { - return iListBox->SelectionIndexes()->Count(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ListBoxToggleItemL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::ListBoxToggleItemL( TInt aIndex ) - { - iListBox->View()->ToggleItemL( aIndex ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ListBoxIsItemSelected -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerContainerBase::ListBoxIsItemSelected( TInt aIndex ) - { - return iListBox->View()->ItemIsSelected( aIndex ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ListBoxSelectAllL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::ListBoxSelectAllL() - { - TInt count( ListBoxNumberOfItems() ); - if ( count > 0 ) - { - CArrayFixFlat* array = - new( ELeave ) CArrayFixFlat< TInt >( count ); - CleanupStack::PushL( array ); - for ( TInt i( 0 ); i < count; ++i ) - { - array->AppendL( i ); - } - iListBox->View()->SetSelectionIndexesL( array ); - CleanupStack::PopAndDestroy( array ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ListBoxClearSelection -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::ListBoxClearSelection() - { - iListBox->View()->ClearSelection(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ListBoxSetTextL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::ListBoxSetTextL( const TDesC& aText ) - { - iListBox->View()->SetListEmptyTextL( aText ); - iListBox->DrawDeferred(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::IsSearchFieldVisible -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerContainerBase::IsSearchFieldVisible() const - { - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::EnableSearchFieldL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::EnableSearchFieldL( - TBool /*aEnable*/, const TDesC& /*aSearchText^*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::SetCurrentItemIndexAfterSearch -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::SetCurrentItemIndexAfterSearch( - TInt /*aIndex*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ListBoxSelectItemL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::ListBoxSelectItemL( TInt aIndex ) - { - iListBox->View()->SelectItemL( aIndex ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ListBoxDeselectItem -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::ListBoxDeselectItem( TInt aIndex ) - { - iListBox->View()->DeselectItem( aIndex ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::ListBoxSetSelectionIndexesL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerContainerBase::ListBoxSetSelectionIndexesL(const CArrayFixFlat* - aSelectionIndexes) - { - iListBox->View()->SetSelectionIndexesL( aSelectionIndexes ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerContainerBase::SearchFieldToListBoxIndex -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerContainerBase::SearchFieldToListBoxIndex( TInt aIndex ) - { - return 0; - } -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerDocument.cpp --- a/filemanager/App/src/CFileManagerDocument.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,262 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Document class of the file manager -* -*/ - - -// INCLUDE FILES -#include // to make iIconArray->ResetAndDestroy work -#include -#include -#include -#include -#include -#include -#include -#include -#include "CFileManagerDocument.h" -#include "CFileManagerAppUi.h" -#include "CFileManagerStringCache.h" - - -// CONSTANTS -_LIT( KFileManagerEngineResource, "filemanagerengine.rsc" ); -_LIT( KFileManagerViewResource, "filemanagerview.rsc" ); -_LIT_SECURE_ID( KFileManagerSchBkupSID, KFileManagerSchBkupUID3 ); - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerDocument::CFileManagerDocument -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerDocument::CFileManagerDocument( CEikApplication& aApp ) : - CAiwGenericParamConsumer( aApp ), - iViewResourceLoader( *CCoeEnv::Static() ), - iEngineResourceLoader( *CCoeEnv::Static() ) - { - FUNC_LOG - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocument::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CFileManagerDocument::ConstructL() - { - FUNC_LOG - - // Get resource drive from exe location - TFileName exeFileName( RProcess().FileName() ); - TParsePtrC exeParse( exeFileName ); - TPtrC exeDrive( exeParse.Drive() ); - - TFileName fileName; - fileName.Copy( exeDrive ); - fileName.Append( KDC_RESOURCE_FILES_DIR ); - CFileManagerUtils::EnsureFinalBackslash( fileName ); - fileName.Append( KFileManagerViewResource ); - iViewResourceLoader.OpenL( fileName ); - - fileName.Copy( exeDrive ); - fileName.Append( KDC_RESOURCE_FILES_DIR ); - CFileManagerUtils::EnsureFinalBackslash( fileName ); - fileName.Append( KFileManagerEngineResource ); - iEngineResourceLoader.OpenL( fileName ); - - INFO_LOG( "CFileManagerDocument::ConstructL()-Create engine" ) - RFs& fs( CCoeEnv::Static()->FsSession() ); - User::LeaveIfError( fs.ShareProtected() ); // Make shareable - iEngine = CFileManagerEngine::NewL( fs ); - - INFO_LOG( "CFileManagerDocument::ConstructL()-Create icon array" ) - iIconArray = CFileManagerIconArray::NewL(); - - INFO_LOG( "CFileManagerDocument::ConstructL()-Create string cache" ) - iStringCache = CFileManagerStringCache::NewL( *iEngine, *iIconArray ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocument::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CFileManagerDocument* CFileManagerDocument::NewL( CEikApplication& aApp ) - { - CFileManagerDocument* self = new( ELeave ) CFileManagerDocument( aApp ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocument::~CFileManagerDocument -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerDocument::~CFileManagerDocument() - { - FUNC_LOG - - DeletePlugins(); - iPluginArray.Close(); - REComSession::FinalClose(); - iViewResourceLoader.Close(); - iEngineResourceLoader.Close(); - if ( iIconArray ) - { - iIconArray->ResetAndDestroy(); - delete iIconArray; - } - delete iStringCache; - delete iEngine; - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocument::CreateAppUiL -// -// ----------------------------------------------------------------------------- -// -CEikAppUi* CFileManagerDocument::CreateAppUiL() - { - return new( ELeave ) CFileManagerAppUi; - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocument::IconArray -// -// ----------------------------------------------------------------------------- -// -CFileManagerIconArray* CFileManagerDocument::IconArray() const - { - return iIconArray; - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocument::Engine -// -// ----------------------------------------------------------------------------- -// -CFileManagerEngine& CFileManagerDocument::Engine() const - { - return *iEngine; - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocument::ClearStringCache -// -// ----------------------------------------------------------------------------- -// -void CFileManagerDocument::ClearStringCache() - { - iStringCache->Clear(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocument::FileList -// -// ----------------------------------------------------------------------------- -// -MDesCArray* CFileManagerDocument::FileList() const - { - return iStringCache; - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocument::LastError -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerDocument::LastError() const - { - return iStringCache->LastError(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocument::UpdateTaskNameL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerDocument::UpdateTaskNameL( CApaWindowGroupName* aWgName ) - { - CAknDocument::UpdateTaskNameL( aWgName ); -#ifdef RD_FILE_MANAGER_BACKUP - if ( IsScheduledBackup() ) - { - aWgName->SetHidden( ETrue ); - } -#endif // RD_FILE_MANAGER_BACKUP - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocument::IsScheduledBackup -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerDocument::IsScheduledBackup() - { - // Check is started by file manager schedule starter - return ( User::CreatorSecureId() == KFileManagerSchBkupSID ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocument::StorePluginL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerDocument::StorePluginL( const TUid& aUid ) - { - iPluginArray.AppendL( aUid ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocument::DeletePlugins -// -// ----------------------------------------------------------------------------- -// -void CFileManagerDocument::DeletePlugins() - { - TInt count( iPluginArray.Count() ); - for ( TInt i( 0 ); i < count; ++i ) - { - REComSession::DestroyedImplementation( iPluginArray[ i ] ); - } - iPluginArray.Reset(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocument::OpenFileL() -// -// ----------------------------------------------------------------------------- -CFileStore* CFileManagerDocument::OpenFileL( - TBool /*aDoOpen*/, const TDesC& /*aFilename*/, RFs& /*aFs*/ ) - { - const CAiwGenericParamList* inParams = GetInputParameters(); - CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( iAppUi ); - if ( appUi && inParams ) - { - appUi->ProcessAiwParamListL( *inParams ); - } - return NULL; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerFileListContainer.cpp --- a/filemanager/App/src/CFileManagerFileListContainer.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,892 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File list container in file manager -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CFileManagerFileListContainer.h" -#include "CFileManagerDocument.h" -#include "CFileManagerAppUi.h" -#include "FileManager.hrh" -#include "CFileManagerIconArray.h" -#include -#include -#include // CEikMenuPane -// CONSTANTS -const TInt KTouchGestureThreshold = 30; // Threshold could be stored in CenRep - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::CFileManagerFileListContainer -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerFileListContainer::CFileManagerFileListContainer( - const TListType aType ) : - iType( aType ) - { - iAppUi = static_cast< CFileManagerAppUi* >( ControlEnv()->AppUi() ); - iDocument = static_cast< CFileManagerDocument* >( iAppUi->Document() ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::NewL -// -// ----------------------------------------------------------------------------- -// -CFileManagerFileListContainer* CFileManagerFileListContainer::NewL( - const TRect& aRect, - const TInt aFocusedIndex, - const TListType aType, - const TInt aEmptyText, - const TDesC& aHelpContext ) - { - CFileManagerFileListContainer* self = - new ( ELeave ) CFileManagerFileListContainer( aType ); - CleanupStack::PushL( self ); - self->ConstructL( - aRect, - aFocusedIndex, - aEmptyText, - aHelpContext ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::ConstructL( - const TRect& aRect, - const TInt aFocusedIndex, - const TInt aEmptyText, - const TDesC& aHelpContext ) - { - CFileManagerFeatureManager& featureManager( - iDocument->Engine().FeatureManager() ); - iRightLeftNaviSupported = featureManager.IsFeatureSupported( - EFileManagerFeatureRightLeftNaviSupported ); - iOwnFastScrollDisabled = featureManager.IsFeatureSupported( - EFileManagerFeatureOwnFastScrollDisabled ); - CFileManagerContainerBase::ConstructL( aRect, aFocusedIndex ); - SetEmptyTextL( aEmptyText ); - SetHelpContext( aHelpContext ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::CreateListBoxL -// -// ----------------------------------------------------------------------------- -// -CEikTextListBox* CFileManagerFileListContainer::CreateListBoxL() - { - switch ( iType ) - { - case EListMain: - { - CAknDoubleLargeStyleListBox* listBox = - new( ELeave ) CAknDoubleLargeStyleListBox(); - CleanupStack::PushL( listBox ); - listBox->SetContainerWindowL( *this ); - listBox->ConstructL( this, EAknGenericListBoxFlags | - EAknListBoxMenuList | EAknListBoxLoopScrolling ); - CFormattedCellListBoxData* column = listBox->ItemDrawer()->ColumnData(); - column->SetIconArray( iDocument->IconArray() ); - column->SetSkinEnabledL( ETrue ); - column->EnableMarqueeL( ETrue ); - CleanupStack::Pop( listBox ); - return listBox; - } - case EListMemoryStore: // FALLTHROUGH - case EListFolder: - { - CAknColumnListBox* listBox = new( ELeave ) - CFileManagerFileListContainer::CListBox( *this ); - CleanupStack::PushL( listBox ); - listBox->SetContainerWindowL( *this ); - listBox->ConstructL( this, EAknGenericListBoxFlags | - EAknListBoxMenuList | EAknListBoxLoopScrolling | - EAknListBoxStylusMarkableList ); - CColumnListBoxData* column = listBox->ItemDrawer()->ColumnData(); - column->SetIconArray( iDocument->IconArray() ); - column->SetSkinEnabledL( ETrue ); - // Disable lists MSK observer because the container will be used - // as observer - listBox->EnableMSKObserver( EFalse ); - column->EnableMarqueeL( ETrue ); - // Create search field popup - iSearchField = CAknSearchField::NewL( - *this, CAknSearchField::EPopup, NULL, KMaxFileName ); - iSearchField->MakeVisible( EFalse ); - iSearchField->SetSkinEnabledL( ETrue ); - CCoeEnv::Static()->AddFocusObserverL( *this ); - CleanupStack::Pop( listBox ); - return listBox; - } - default: - { - User::Leave( KErrGeneral ); - break; - } - } - - return NULL; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::~CFileManagerFileListContainer -// -// ----------------------------------------------------------------------------- -// -CFileManagerFileListContainer::~CFileManagerFileListContainer() - { - CCoeEnv::Static()->RemoveFocusObserver( *this ); - - if ( ListBoxExists() ) - { - // before we destroy listbox in base class, - // we have to set icon array to NULL - // because we want to let document class own the icon array - if ( iType == EListMain ) - { - CAknDoubleLargeStyleListBox& listBox = - static_cast< CAknDoubleLargeStyleListBox& >( ListBox() ); - listBox.ItemDrawer()->ColumnData()->SetIconArray( NULL ); - } - else - { - CAknColumnListBox& listBox = - static_cast< CAknColumnListBox& >( ListBox() ); - listBox.ItemDrawer()->ColumnData()->SetIconArray( NULL ); - } - } - delete iSearchField; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::OfferKeyEventL -// -// ----------------------------------------------------------------------------- -// -TKeyResponse CFileManagerFileListContainer::OfferKeyEventL( - const TKeyEvent& aKeyEvent, TEventCode aType ) - { - TKeyResponse response = OfferSearchKeyEventL( aKeyEvent, aType ); - if ( response == EKeyWasConsumed ) - { - return response; - } - - TVwsViewId enabledViewId = TVwsViewId( KNullUid, KNullUid ); - iAppUi->GetActiveViewId( enabledViewId ); - - TUid enabledViewUid = enabledViewId.iViewUid; - CAknView* enabledView = iAppUi->View( enabledViewUid ); - CEikMenuBar* menuBar = NULL; - - if ( iAppUi->IsFileManagerView( enabledViewUid ) ) - { - menuBar = enabledView->MenuBar(); - } - switch( aKeyEvent.iCode ) - { - case EKeyEnter: // FALLTHROUH - case EKeyOK: - { - if ( ( menuBar != NULL ) && menuBar->ItemSpecificCommandsEnabled() ) - { - iAppUi->ProcessCommandL( EFileManagerSelectionKey ); - response = EKeyWasConsumed; - } - break; - } - case EKeyDelete: // FALLTHROUGH - case EKeyBackspace: - { - if ( ( menuBar != NULL ) && menuBar->ItemSpecificCommandsEnabled() ) - { - iAppUi->ProcessCommandL( EFileManagerDelete ); - response = EKeyWasConsumed; - } - break; - } - case EKeyLeftArrow: // FALLTHROUGH - case EKeyRightArrow: - { - if ( iRightLeftNaviSupported ) - { - // Depth navigation using arrows - TInt commandId( EAknSoftkeyBack ); - if ( aKeyEvent.iCode == EKeyRightArrow ) - { - commandId = EFileManagerOpen; - } - iAppUi->ProcessCommandL( commandId ); - response = EKeyWasConsumed; - } - break; - } - case EKeyYes: - { - if ( AknLayoutUtils::PenEnabled() ) - { - // Touch uses just the default functionality - response = ListBox().OfferKeyEventL( aKeyEvent, aType ); - } - else - { - iAppUi->ProcessCommandL( EFileManagerSend ); - response = EKeyWasConsumed; - } - break; - } - default: - { - response = ListBox().OfferKeyEventL( aKeyEvent, aType ); - break; - } - } - return response; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::SetListEmptyL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::SetListEmptyL() - { - if ( IsSearchFieldVisible() ) - { - iSearchField->GetSearchText( iSearchText ); - iSearchFieldAfterRefresh = ETrue; - EnableSearchFieldL( EFalse ); - } - CFileManagerContainerBase::SetListEmptyL(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::RefreshListL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::RefreshListL( TInt aFocusedIndex ) - { - iDocument->ClearStringCache(); - SetTextArray( iDocument->FileList() ); - CFileManagerContainerBase::RefreshListL( aFocusedIndex ); - if ( iSearchFieldAfterRefresh ) - { - iSearchFieldAfterRefresh = EFalse; - EnableSearchFieldL( ETrue, iSearchText ); - } - // Inform user about OOM, suppress other errors - TInt err( iDocument->LastError() ); - if ( err == KErrNoMemory ) - { - ControlEnv()->HandleError( KErrNoMemory ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::HandleControlEventL -// From MCoeControlObserver, called by current listbox -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::HandleControlEventL( - CCoeControl* /* aControl*/, TCoeEvent aEventType ) - { - if ( aEventType == EEventStateChanged ) - { - iAppUi->ProcessCommandL( EFileManagerCheckMark ); // Inform change - } - } - -//----------------------------------------------------------------------------- -// CFileManagerFileListContainer::CItemDrawer::CItemDrawer -//----------------------------------------------------------------------------- -// -CFileManagerFileListContainer::CItemDrawer::CItemDrawer( - CTextListBoxModel* aTextListBoxModel, - const CFont* aFont, - CColumnListBoxData* aColumnData, - CFileManagerFileListContainer& aContainer ) : - CColumnListBoxItemDrawer( - aTextListBoxModel, aFont, aColumnData ), - iContainer( aContainer ) - { - } - -//----------------------------------------------------------------------------- -// CFileManagerFileListContainer::CItemDrawer::Properties -//----------------------------------------------------------------------------- -// -TListItemProperties CFileManagerFileListContainer::CItemDrawer::Properties( - TInt aItemIndex ) const - { - aItemIndex = iContainer.SearchFieldToListIndex( aItemIndex ); - TListItemProperties prop( - CColumnListBoxItemDrawer::Properties( aItemIndex ) ); - // Do not allow folder marking - if ( iContainer.iDocument->Engine().IsFolder( aItemIndex ) ) - { - prop.SetHiddenSelection( ETrue ); - } - return prop; - } - -//----------------------------------------------------------------------------- -// CFileManagerFileListContainer::CListBox::CListBox -//----------------------------------------------------------------------------- -// -CFileManagerFileListContainer::CListBox::CListBox( - CFileManagerFileListContainer& aContainer ) : - CAknSingleGraphicStyleListBox(), - iContainer( aContainer ) - { - } - -//----------------------------------------------------------------------------- -// CFileManagerFileListContainer::CListBox::CreateItemDrawerL -//----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::CListBox::CreateItemDrawerL() - { - CColumnListBoxData* data = CColumnListBoxData::NewL(); - CleanupStack::PushL( data ); - iItemDrawer = new ( ELeave ) CFileManagerFileListContainer::CItemDrawer( - Model(), - iEikonEnv->NormalFont(), - data, - iContainer ); - CleanupStack::Pop( data ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::UpdateCba -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::UpdateCba() - { - iAppUi->NotifyCbaUpdate(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::HandlePointerEventL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::HandlePointerEventL( - const TPointerEvent &aPointerEvent ) - { - if ( !iRightLeftNaviSupported ) - { - CCoeControl::HandlePointerEventL( aPointerEvent ); - return; - } - if ( !AknLayoutUtils::PenEnabled() ) - { - return; - } - TBool consumed( EFalse ); - switch ( aPointerEvent.iType ) - { - case TPointerEvent::EButton1Down: - { - iDragStartPoint = aPointerEvent.iPosition; - iDragging = EFalse; - break; - } - case TPointerEvent::EDrag: - { - iDragging = ETrue; - break; - } - case TPointerEvent::EButton1Up: - { - if ( iDragging ) - { - iDragging = EFalse; - // Solve drag direction and convert touch gesture to key event - TInt xDelta( iDragStartPoint.iX - aPointerEvent.iPosition.iX ); - TInt keyCode( EKeyNull ); - if ( xDelta < -KTouchGestureThreshold ) - { - keyCode = EKeyRightArrow; - } - else if ( xDelta > KTouchGestureThreshold ) - { - keyCode = EKeyLeftArrow; - } - if ( keyCode != EKeyNull ) - { - TKeyEvent keyEvent; - keyEvent.iCode = keyCode; - keyEvent.iScanCode = EStdKeyNull; - keyEvent.iModifiers = 0; - keyEvent.iRepeats = 1; - OfferKeyEventL( keyEvent, EEventKey ); - consumed = ETrue; - } - } - break; - } - default: - { - iDragging = EFalse; - break; - } - } - if ( !consumed ) - { - CCoeControl::HandlePointerEventL( aPointerEvent ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::SizeChanged -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::SizeChanged() - { - if ( iSearchField ) - { - AknFind::HandlePopupFindSizeChanged( this, &ListBox(), iSearchField ); - } - else - { - CFileManagerContainerBase::SizeChanged(); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::CountComponentControls -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerFileListContainer::CountComponentControls() const - { - TInt ret( CFileManagerContainerBase::CountComponentControls() ); - if ( iSearchField ) - { - ++ret; - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::ComponentControl -// -// ----------------------------------------------------------------------------- -// -CCoeControl* CFileManagerFileListContainer::ComponentControl( TInt aIndex ) const - { - if ( aIndex < CFileManagerContainerBase::CountComponentControls() ) - { - return CFileManagerContainerBase::ComponentControl( aIndex ); - } - if ( aIndex < CountComponentControls() ) - { - return iSearchField; - } - return NULL; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::ListBoxCurrentItemIndex -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerFileListContainer::ListBoxCurrentItemIndex() - { - return SearchFieldToListIndex( ListBox().CurrentItemIndex() ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::ListBoxNumberOfItems -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerFileListContainer::ListBoxNumberOfItems() - { - if ( IsSearchFieldVisible() ) - { - return static_cast< CAknFilteredTextListBoxModel* >( - ListBox().Model() )->Filter()->FilteredNumberOfItems(); - } - return CFileManagerContainerBase::ListBoxNumberOfItems(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::ListBoxSelectionIndexes -// -// ----------------------------------------------------------------------------- -// -const CArrayFix< TInt >* CFileManagerFileListContainer::ListBoxSelectionIndexes() - { - if ( IsSearchFieldVisible() ) - { - CAknListBoxFilterItems* filter = - static_cast< CAknFilteredTextListBoxModel* >( - ListBox().Model() )->Filter(); - - if ( filter ) - { - TRAPD( err, filter->UpdateSelectionIndexesL() ); - if ( err == KErrNone ) - { - return filter->SelectionIndexes(); - } - } - return NULL; - } - return CFileManagerContainerBase::ListBoxSelectionIndexes(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::ListBoxSelectionIndexesCount -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerFileListContainer::ListBoxSelectionIndexesCount() - { - if ( IsSearchFieldVisible() ) - { - CAknListBoxFilterItems* filter = - static_cast< CAknFilteredTextListBoxModel* >( - ListBox().Model() )->Filter(); - - if ( filter ) - { - TRAPD( err, filter->UpdateSelectionIndexesL() ); - if ( err == KErrNone ) - { - return filter->SelectionIndexes()->Count(); - } - } - return 0; - } - return CFileManagerContainerBase::ListBoxSelectionIndexesCount(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::ListBoxToggleItemL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::ListBoxToggleItemL( TInt aIndex ) - { - aIndex = ListToSearchFieldIndex( aIndex ); - CFileManagerContainerBase::ListBoxToggleItemL( aIndex ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::ListBoxIsItemSelected -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerFileListContainer::ListBoxIsItemSelected( TInt aIndex ) - { - aIndex = ListToSearchFieldIndex( aIndex ); - return CFileManagerContainerBase::ListBoxIsItemSelected( aIndex ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::SearchFieldToListIndex -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerFileListContainer::SearchFieldToListIndex( TInt aIndex ) - { - if ( IsSearchFieldVisible() && aIndex >= 0 ) - { - aIndex = static_cast< CAknFilteredTextListBoxModel* >( - ListBox().Model() )->Filter()->FilteredItemIndex( aIndex ); - } - return aIndex; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::ListToSearchFieldIndex -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerFileListContainer::ListToSearchFieldIndex( TInt aIndex ) - { - if ( IsSearchFieldVisible() && aIndex >= 0 ) - { - aIndex = static_cast< CAknFilteredTextListBoxModel* >( - ListBox().Model() )->Filter()->VisibleItemIndex( aIndex ); - } - return aIndex; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::ListBoxSetTextL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::ListBoxSetTextL( const TDesC& aText ) - { - EnableSearchFieldL( EFalse ); - CFileManagerContainerBase::ListBoxSetTextL( aText ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::ListBoxSetTextL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::PageScrollL( TBool aUp ) - { - CEikListBox& listBox( ListBox() ); - TInt numItems( listBox.Model()->NumberOfItems() ); - - if ( numItems > 0 ) - { - TInt lastIndex( numItems - 1 ); - if ( !aUp && listBox.View()->BottomItemIndex() == lastIndex ) - { - listBox.SetCurrentItemIndex( lastIndex ); - } - else - { - CListBoxView::TCursorMovement move( aUp ? - CListBoxView::ECursorPrevScreen : - CListBoxView::ECursorNextScreen ); - listBox.View()->MoveCursorL( move, CListBoxView::ENoSelection ); - listBox.SetCurrentItemIndex( listBox.CurrentItemIndex() ); - } - DrawDeferred(); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::IsSearchFieldVisible -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerFileListContainer::IsSearchFieldVisible() const - { - return ( iSearchField && iSearchField->IsVisible() ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::EnableSearchFieldL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::EnableSearchFieldL( - TBool aEnable, const TDesC& aSearchText ) - { - if ( !iSearchField ) - { - return; - } - - CEikListBox& listBox( ListBox() ); - CAknFilteredTextListBoxModel* filteredModel = - static_cast< CAknFilteredTextListBoxModel* >( listBox.Model() ); - - if ( aEnable ) - { - if ( !iSearchField->IsVisible() && listBox.Model()->NumberOfItems() ) - { - iIndexAfterSearch = listBox.CurrentItemIndex(); - iSearchField->SetSearchTextL( aSearchText ); - if ( !filteredModel->Filter() ) - { - filteredModel->CreateFilterL( &listBox, iSearchField ); - } - filteredModel->Filter()->HandleItemArrayChangeL(); - iSearchField->MakeVisible( ETrue ); - iSearchField->SetFocus( ETrue ); - iSearchFieldEnabled = ETrue; - } - } - else - { - iSearchFieldEnabled = EFalse; - iSearchField->SetFocus( EFalse ); - iSearchField->MakeVisible( EFalse ); - iSearchField->ResetL(); - filteredModel->RemoveFilter(); - SetIndex( iIndexAfterSearch ); - } - - SizeChanged(); - UpdateCba(); - DrawDeferred(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::SetCurrentItemIndexAfterSearch -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::SetCurrentItemIndexAfterSearch( - TInt aIndex ) - { - iIndexAfterSearch = aIndex; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::HandleChangeInFocus -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::HandleChangeInFocus() - { - // Update softkeys after search field has been canceled - if ( ListBoxExists() && - IsFocused() && - iSearchFieldEnabled && - iSearchField && - !iSearchField->IsVisible() ) - { - CAknFilteredTextListBoxModel* filteredModel = - static_cast< CAknFilteredTextListBoxModel* >( ListBox().Model() ); - iSearchFieldEnabled = EFalse; - TRAP_IGNORE( iSearchField->ResetL() ); - filteredModel->RemoveFilter(); - SetIndex( iIndexAfterSearch ); - UpdateCba(); - DrawDeferred(); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::HandleDestructionOfFocusedItem -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::HandleDestructionOfFocusedItem() - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::OfferSearchKeyEventL -// -// ----------------------------------------------------------------------------- -// -TKeyResponse CFileManagerFileListContainer::OfferSearchKeyEventL( - const TKeyEvent& aKeyEvent, TEventCode aType ) - { - if ( !iSearchField || aKeyEvent.iScanCode == EStdKeyYes ) - { - return EKeyWasNotConsumed; - } - // Open search field on alpha digit - TBool isVisible( iSearchField->IsVisible() ); - if ( !isVisible && - aType == EEventKeyDown && - aKeyEvent.iScanCode ) - { - TChar ch( aKeyEvent.iScanCode ); - if ( ch.IsAlphaDigit() ) - { - EnableSearchFieldL( ETrue ); - return EKeyWasConsumed; - } - } - // Close search field on clear-button if it's empty - else if ( isVisible && aKeyEvent.iCode == EKeyBackspace ) - { - iSearchField->GetSearchText( iSearchText ); - if ( !iSearchText.Length() ) - { - EnableSearchFieldL( EFalse ); - return EKeyWasConsumed; - } - } - if ( isVisible ) - { - TKeyResponse response( iSearchField->OfferKeyEventL( aKeyEvent, aType ) ); - UpdateCba(); - if ( response == EKeyWasConsumed ) - { - return response; - } - } - if ( !iOwnFastScrollDisabled ) - { - if ( aKeyEvent.iCode == EKeyUpArrow && aKeyEvent.iRepeats > 0 ) - { - PageScrollL( ETrue ); - return EKeyWasConsumed; - } - if ( aKeyEvent.iCode == EKeyDownArrow && aKeyEvent.iRepeats > 0 ) - { - PageScrollL( EFalse ); - return EKeyWasConsumed; - } - } - return EKeyWasNotConsumed; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::ListBoxSelectItemL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::ListBoxSelectItemL( TInt aIndex ) - { - aIndex = ListToSearchFieldIndex( aIndex ); - CFileManagerContainerBase::ListBoxSelectItemL( aIndex ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::ListBoxDeselectItem -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileListContainer::ListBoxDeselectItem( TInt aIndex ) - { - aIndex = ListToSearchFieldIndex( aIndex ); - CFileManagerContainerBase::ListBoxDeselectItem( aIndex ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileListContainer::SearchFieldToListBoxIndex -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerFileListContainer::SearchFieldToListBoxIndex( TInt aIndex ) - { - if ( !iSearchField || !iSearchField->IsVisible() ) - { - return 0; - } - return SearchFieldToListIndex( aIndex ); - } -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerFileSelectionFilter.cpp --- a/filemanager/App/src/CFileManagerFileSelectionFilter.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2002-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: Filters PlatSec dirs from file selection -* -*/ - - - -// INCLUDE FILES -#include -#include "CFileManagerFileSelectionFilter.h" -#include "CFileManagerEngine.h" -#include "CFileManagerCommonDefinitions.h" - - -// ============================ MEMBER FUNCTIONS =============================== -// ----------------------------------------------------------------------------- -// CFileManagerFileSelectionFilter::CFileManagerFileSelectionFilter -// -// ----------------------------------------------------------------------------- -// -CFileManagerFileSelectionFilter::CFileManagerFileSelectionFilter( - CFileManagerEngine& aEngine ) - : iEngine( aEngine ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileSelectionFilter::Accept -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerFileSelectionFilter::Accept( const TDesC& aDriveAndPath, - const TEntry& aEntry ) const - { - if ( aEntry.IsHidden() || aEntry.IsSystem() ) - { - return EFalse; - } - if ( !aEntry.IsDir() ) - { - return ETrue; - } - HBufC* fullPath = HBufC::New( KMaxPath ); - if ( !fullPath ) - { - return EFalse; - } - TPtr ptr( fullPath->Des() ); - ptr.Copy( aDriveAndPath ); - ptr.Append( aEntry.iName ); - ptr.Append( KFmgrBackslash ); - TBool isVisible( !iEngine.IsSystemFolder( ptr ) ); - delete fullPath; - return isVisible; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerFoldersView.cpp --- a/filemanager/App/src/CFileManagerFoldersView.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,444 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: View for folder -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CFileManagerFoldersView.h" -#include "CFileManagerFileListContainer.h" -#include "CFileManagerAppUi.h" -#include "CFileManagerDocument.h" -#include "Cfilemanagerfoldernavigationpane.h" -#include "FileManager.hrh" -#include "FileManagerUID.h" - -// CONSTANTS -const TUid CFileManagerFoldersView::KOpenFromSearchResultsView = - { EOpenFromSearchResultsView }; - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerFoldersView::CFileManagerFoldersView -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerFoldersView::CFileManagerFoldersView() - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerFoldersView::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CFileManagerFoldersView::ConstructL() - { - CFileManagerViewBase::ConstructL( R_FILEMANAGER_FOLDERS_VIEW ); - - CEikStatusPane* sp = StatusPane(); - - iNaviPane = static_cast< CAknNavigationControlContainer* > - ( sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); - - iPopupController = CAknInfoPopupNoteController::NewL(); - iPopupController->SetTimeDelayBeforeShow( 0 ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFoldersView::NewLC -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CFileManagerFoldersView* CFileManagerFoldersView::NewLC() - { - CFileManagerFoldersView* self = new( ELeave ) CFileManagerFoldersView; - - CleanupStack::PushL( self ); - self->ConstructL(); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFoldersView::~CFileManagerFoldersView -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerFoldersView::~CFileManagerFoldersView() - { - delete iPopupController; - delete iNaviDecorator; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFoldersView::Id -// -// ----------------------------------------------------------------------------- -// -TUid CFileManagerFoldersView::Id() const - { - return CFileManagerAppUi::KFileManagerFoldersViewId; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFoldersView::CreateContainerL -// -// ----------------------------------------------------------------------------- -// -CFileManagerContainerBase* CFileManagerFoldersView::CreateContainerL() - { - return CFileManagerFileListContainer::NewL( - ClientRect(), - iIndex, - CFileManagerFileListContainer::EListFolder, - R_QTN_SELEC_EMPTY_LIST, - KFMGR_HLP_MEM_STORE_VIEW ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFoldersView::DoActivateL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFoldersView::DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ) - { - FUNC_LOG - - if ( aCustomMessageId == KOpenFromSearchResultsView ) - { - iInitialFolderDepth = iEngine.FolderLevel(); - } - else - { - // Check embedded app exit - CFileManagerAppUi* appUi = - static_cast< CFileManagerAppUi* >( AppUi() ); - appUi->ExitEmbeddedAppIfNeededL(); - - iInitialFolderDepth = 1; // First folder view level - } - - CFileManagerViewBase::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); - - TResourceReader reader; - iCoeEnv->CreateResourceReaderLC( reader, R_FILEMANAGER_FOLDER_NAVIGATION_PANE ); - iNaviControl = CFileManagerFolderNavigationPane::NewL( iEngine.Memory(), 0, reader ); - CleanupStack::PopAndDestroy(); // reader - - iNaviControl->SetObserver( this ); - - iNaviDecorator = CAknNavigationDecorator::NewL( iNaviPane, iNaviControl ); - iNaviDecorator->SetContainerWindowL( *iNaviPane ); - iNaviPane->PushL( *iNaviDecorator ); - - RefreshTitleL(); - iEngine.SetState( CFileManagerEngine::ENavigation ); - iEngine.SetObserver( this ); - iEngine.RefreshDirectory(); - } -// ----------------------------------------------------------------------------- -// CFileManagerFoldersView::DoDeactivate -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFoldersView::DoDeactivate() - { - FUNC_LOG - - CFileManagerViewBase::DoDeactivate(); - - iNaviPane->Pop( iNaviDecorator ); - delete iNaviDecorator; - iNaviDecorator = NULL; - iNaviControl = NULL; // Not owned and deleted by decorator - - iPopupController->HideInfoPopupNote(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFoldersView::RefreshTitleL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFoldersView::RefreshTitleL() - { - static_cast< CFileManagerAppUi* >( AppUi() )->SetTitleL( - iEngine.LocalizedNameOfCurrentDirectory() ); - - if ( iNaviControl ) // May be deleted by view deactivation - { - iNaviControl->ChangeRootL( iEngine.Memory() ); - iNaviControl->SetFolderDepth( iEngine.FolderLevel() ); - } - - iNaviPane->DrawDeferred(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFoldersView::HandleCommandL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFoldersView::HandleCommandL( TInt aCommand ) - { - switch( aCommand ) - { - case EAknSoftkeyBack: - { - BackstepL(); - break; - } - case EFileManagerOpen: - { - iPopupController->HideInfoPopupNote(); - CFileManagerViewBase::CmdOpenL(); - break; - } - default: - { - CFileManagerViewBase::HandleCommandL( aCommand ); - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerFoldersView::DirectoryChangedL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFoldersView::DirectoryChangedL() - { - FUNC_LOG - - CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( AppUi() ); - - if ( iEngine.FolderLevel() < iInitialFolderDepth || !iContainer ) - { - appUi->CloseFoldersViewL(); - } - else - { - if ( !appUi->IsSearchViewOpen() ) - { - appUi->ExitEmbeddedAppIfNeededL(); - } - TRAP_IGNORE( RefreshDriveInfoL() ); - TFileManagerDriveInfo& drvInfo( DriveInfo() ); - if ( !( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) ) - { - User::Leave(KErrPathNotFound); - } - else - { - TInt index( iEngine.CurrentIndex() ); - if ( index != KErrNotFound ) - { - iContainer->RefreshListL( index ); - } - else - { - iContainer->RefreshListL( iIndex ); - } - RefreshTitleL(); - } - iFolderDepth = iEngine.FolderLevel(); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerFoldersView::HandleResourceChangeL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CFileManagerFoldersView::HandleResourceChangeL( TInt aType ) - { - if ( iNaviControl ) // May be deleted by view deactivation - { - iNaviControl->HandleResourceChangeL( aType ); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerFoldersView::UpdateCbaL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerFoldersView::UpdateCbaL() - { - UpdateCommonCbaL(); - } - -// ------------------------------------------------------------------------------ -// CFileManagerFoldersView::BackstepL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerFoldersView::BackstepL( - TInt aBacksteps ) - { - if (iActiveProcess != ENoProcess) - { - return; // Ignore to avoid container mess up - } - iPopupController->HideInfoPopupNote(); - CFileManagerAppUi* appUi = static_cast (AppUi()); - TInt level(iEngine.FolderLevel()); - while ( aBacksteps > 0 ) - { - if ( level < iInitialFolderDepth ) - { - break; - } - TRAP_IGNORE( iEngine.BackstepL() ); - --level; - --aBacksteps; - } - - if ( !appUi->IsSearchViewOpen() ) - { - appUi->ExitEmbeddedAppIfNeededL(); - } - - if (level < iInitialFolderDepth) - { - iFolderDepth = 0; - iIndex = 0; - appUi->CloseFoldersViewL(); - } - else - { - iEngine.SetObserver(this); - iEngine.RefreshDirectory(); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerFoldersView::FolderName -// -// ------------------------------------------------------------------------------ -// -TPtrC CFileManagerFoldersView::FolderName( const TInt aLevel ) - { - if ( !aLevel ) - { - // Get memory store name - return iEngine.CurrentDriveName(); - } - - // Get folder name - TPtrC dir( iEngine.CurrentDirectory() ); - TInt drive = TDriveUnit( dir ); - TPtrC root( iEngine.DriveRootDirectory( drive ) ); - TInt count( dir.Length() ); - TInt bsCount( 0 ); - - for ( TInt i( root.Length() ); i < count; ) - { - TPtrC ptr( dir.Mid( i ) ); - TInt j( ptr.Locate( KFmgrBackslash()[ 0 ] ) ); - if ( j != KErrNotFound ) - { - ++bsCount; - if ( bsCount == aLevel ) - { - // Use localised folder name if it exists - TPtrC locName( iEngine.LocalizedName( dir.Left( - i + j + 1 ) ) ); - if ( locName.Length() ) - { - return locName; - } - return TPtrC( ptr.Left( j ) ); - } - } - else - { - break; - } - i += j + 1; - } - return TPtrC( KNullDesC ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerFoldersView::HandleFolderNaviEventL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerFoldersView::HandleFolderNaviEventL( - TNaviEvent aEvent, TInt aValue ) - { - switch ( aEvent ) - { - case ENaviTapDown: - { - iPopupController->HideInfoPopupNote(); - break; - } - case ENaviTapUp: - { - if ( aValue != KErrNotFound ) - { - TInt level( iEngine.FolderLevel() ); - if ( level > aValue ) - { - BackstepL( level - aValue ); - } - } - break; - } - case ENaviLongTap: - { - if ( aValue != KErrNotFound ) - { - TPtrC folder( FolderName( aValue ) ); - if ( folder.Length() ) - { - iPopupController->SetTextL( folder ); - iPopupController->ShowInfoPopupNote(); - } - } - break; - } - default: - { - break; - } - } - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerMainView.cpp --- a/filemanager/App/src/CFileManagerMainView.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,927 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Main view -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CFileManagerMainView.h" -#include "CFileManagerFileListContainer.h" -#include "CFileManagerAppUi.h" -#include "CFileManagerDocument.h" -#include "FileManager.hrh" - - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::CFileManagerMainView -// ---------------------------------------------------------------------------- -// -CFileManagerMainView::CFileManagerMainView() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::NewLC -// ---------------------------------------------------------------------------- -// -CFileManagerMainView* CFileManagerMainView::NewLC() - { - CFileManagerMainView* self = new( ELeave ) CFileManagerMainView(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::ConstructL -// ---------------------------------------------------------------------------- -// -void CFileManagerMainView::ConstructL() - { - CFileManagerViewBase::ConstructL( - FeatureManager().IsEmbedded() ? - R_FILEMANAGER_MAIN_VIEW_EMBEDDED : - R_FILEMANAGER_MAIN_VIEW ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::~CFileManagerMainView -// ---------------------------------------------------------------------------- -// -CFileManagerMainView::~CFileManagerMainView() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::DoActivateL -// ---------------------------------------------------------------------------- -// -void CFileManagerMainView::DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ) - { - FUNC_LOG - - CFileManagerViewBase::DoActivateL( - aPrevViewId, aCustomMessageId, aCustomMessage ); - - // Ensure that no directory is defined - if ( iEngine.CurrentDirectory().Length() ) - { - TInt count( iEngine.NavigationLevel() ); - ++count; - for ( TInt i( 0 ); i < count; i++ ) - { - TRAP_IGNORE( iEngine.BackstepL() ); - } - } - - CFileManagerAppUi* appUi = - static_cast< CFileManagerAppUi* >( AppUi() ); - appUi->RestoreDefaultTitleL(); - iEngine.SetState( CFileManagerEngine::ENavigation ); - iEngine.SetObserver( this ); - appUi->ExitEmbeddedAppIfNeededL(); - if ( !appUi->WaitingForInputParams() ) - { - iEngine.RefreshDirectory(); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::DoDeactivate -// ---------------------------------------------------------------------------- -// -void CFileManagerMainView::DoDeactivate() - { - FUNC_LOG - - CFileManagerViewBase::DoDeactivate(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::DirectoryChangedL -// ---------------------------------------------------------------------------- -// -void CFileManagerMainView::DirectoryChangedL() - { - FUNC_LOG - - CFileManagerAppUi* appUi = - static_cast< CFileManagerAppUi* >( AppUi() ); - - if ( iContainer && !appUi->WaitingForInputParams() ) - { - iContainer->RefreshListL( iIndex ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::Id -// ---------------------------------------------------------------------------- -// -TUid CFileManagerMainView::Id() const - { - return CFileManagerAppUi::KFileManagerMainViewId; - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::CreateContainerL -// ---------------------------------------------------------------------------- -// -CFileManagerContainerBase* CFileManagerMainView::CreateContainerL() - { - return CFileManagerFileListContainer::NewL( - ClientRect(), - iIndex, - CFileManagerFileListContainer::EListMain, - R_QTN_SELEC_EMPTY_LIST, - KFMGR_HLP_MAIN_VIEW ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::DynInitMenuPaneL -// ---------------------------------------------------------------------------- -// -void CFileManagerMainView::DynInitMenuPaneL( - TInt aResourceId, - CEikMenuPane* aMenuPane) - { - switch( aResourceId ) - { - // These menus are used only by main view - case R_FILEMANAGER_MAIN_VIEW_MENU: - { - MainMenuFilteringL( *aMenuPane ); - break; - } - case R_FILEMANAGER_REMOTE_DRIVES_MENU: - { - RemoteDrivesMenuFilteringL( *aMenuPane ); - break; - } - case R_FILEMANAGER_MEMORY_STORAGE_MENU: - { - MemoryStorageMenuFilteringL( *aMenuPane ); - break; - } - default: - { - CFileManagerViewBase::DynInitMenuPaneL( aResourceId, aMenuPane ); - break; - } - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::MainMenuFilteringL -// ---------------------------------------------------------------------------- -// -void CFileManagerMainView::MainMenuFilteringL( CEikMenuPane& aMenuPane ) - { - RemoteDriveCommonFilteringL( aMenuPane ); - - if ( !iContainer->ListBoxNumberOfItems() ) - { - aMenuPane.SetItemDimmed( EFileManagerEject, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerFindFile, ETrue ); -#ifndef RD_FILE_MANAGER_BACKUP - aMenuPane.SetItemDimmed( EFileManagerBackup, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerRestore, ETrue ); -#endif // RD_FILE_MANAGER_BACKUP - aMenuPane.SetItemDimmed( EFileManagerMemoryStorage, ETrue ); - return; - } - - CFileManagerItemProperties* prop = iEngine.GetItemInfoLC( - iContainer->ListBoxCurrentItemIndex() ); - TUint32 drvState( 0 ); - if ( prop->IsDrive() ) - { - iEngine.DriveState( drvState, prop->FullPath() ); - } - - TFileManagerDriveInfo drvInfo; - if ( DriveInfoAtCurrentPosL( drvInfo ) < 0 ) - { - // No drive selected - aMenuPane.SetItemDimmed( EFileManagerMemoryStorage, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerEject, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerRemoveDrives, ETrue ); - } - else - { - if ( !( drvInfo.iState & TFileManagerDriveInfo::EDriveEjectable ) || - !( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) ) - { - aMenuPane.SetItemDimmed( EFileManagerEject, ETrue ); - } - if ( ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemovable ) && - !( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) ) - { - aMenuPane.SetItemDimmed( EFileManagerMemoryStorage, ETrue ); - } - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) - { - aMenuPane.SetItemDimmed( EFileManagerMemoryStorage, ETrue ); - } - if ( !FeatureManager().IsRemoteStorageFwSupported() || - !( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) ) - { - aMenuPane.SetItemDimmed( EFileManagerRemoveDrives, ETrue ); - } - } - -#ifndef RD_FILE_MANAGER_BACKUP - TFileManagerDriveInfo mmcinfo( iEngine.GetMMCInfoL() ); - if ( mmcinfo.iState & ( TFileManagerDriveInfo::EDriveLocked | - TFileManagerDriveInfo::EDriveCorrupted ) ) - { - aMenuPane.SetItemDimmed( EFileManagerBackup, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerRestore, ETrue ); - } - else if ( !( mmcinfo.iState & TFileManagerDriveInfo::EDrivePresent ) ) - { - aMenuPane.SetItemDimmed( EFileManagerBackup, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerRestore, ETrue ); - } - else if ( !( mmcinfo.iState & TFileManagerDriveInfo::EDriveBackupped ) ) - { - aMenuPane.SetItemDimmed( EFileManagerRestore, ETrue ); - } - if ( FeatureManager().IsEmbedded() ) - { - // Disable backup in embedded mode, because it messes up - // backup and restore operations since embedded apps are closed. - aMenuPane.SetItemDimmed( EFileManagerBackup, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerRestore, ETrue ); - } -#endif // RD_FILE_MANAGER_BACKUP - - if( !iEngine.IsDriverMounted( drvInfo.iDrive ) ) - { - aMenuPane.SetItemDimmed( EFileManagerEject, ETrue ); - } - CleanupStack::PopAndDestroy( prop ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::RemoteDrivesMenuFilteringL -// ---------------------------------------------------------------------------- -// -void CFileManagerMainView::RemoteDrivesMenuFilteringL( - CEikMenuPane& aMenuPane ) - { - TInt index( iContainer->ListBoxCurrentItemIndex() ); - CFileManagerItemProperties* prop = iEngine.GetItemInfoLC( index ); - TUint32 drvState( 0 ); - if ( iEngine.DriveState( drvState, prop->FullPath() ) == KErrNone ) - { - if ( !( drvState & TFileManagerDriveInfo::EDriveRemote ) || - ( drvState & TFileManagerDriveInfo::EDriveConnected ) ) - { - aMenuPane.SetItemDimmed( - EFileManagerRemoveDrivesSettings, ETrue ); - aMenuPane.SetItemDimmed( - EFileManagerRemoveDrivesDelete, ETrue ); - } - } - else - { - aMenuPane.SetItemDimmed( EFileManagerRemoveDrivesSettings, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerRemoveDrivesDelete, ETrue ); - } - CleanupStack::PopAndDestroy( prop ); - TBool dimAll( EFalse ); - if ( !FeatureManager().IsRemoteStorageFwSupported() ) - { - dimAll = ETrue; - } - else - { - if ( drvState & TFileManagerDriveInfo::EDriveRemote ) - { - if ( drvState & TFileManagerDriveInfo::EDriveConnected ) - { - aMenuPane.SetItemDimmed( EFileManagerConnectRemoveDrive, ETrue ); - } - else - { - aMenuPane.SetItemDimmed( EFileManagerDisconnectRemoveDrive,ETrue ); - } - } - else - { - dimAll = ETrue; - } - } - - if ( dimAll ) - { - aMenuPane.SetItemDimmed( EFileManagerConnectRemoveDrive, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerDisconnectRemoveDrive, ETrue ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::HandleCommandL -// ---------------------------------------------------------------------------- -// -void CFileManagerMainView::HandleCommandL( TInt aCommand ) - { - switch( aCommand ) - { - case EFileManagerOpen: - { - CmdOpenMemoryStoreL(); - break; - } - case EFileManagerEject: - { - CmdEjectL(); - break; - } -#ifndef RD_FILE_MANAGER_BACKUP - case EFileManagerBackup: - { - CmdBackupL(); - break; - } - case EFileManagerRestore: - { - CmdRestoreL(); - break; - } -#endif // RD_FILE_MANAGER_BACKUP - case EFileManagerRemoveDrivesMapDrive: - { - CmdMapRemoteDriveL(); - break; - } - case EFileManagerRemoveDrivesSettings: - { - CmdRemoteDriveSettingsL(); - break; - } - case EFileManagerDelete: // Fall through - case EFileManagerRemoveDrivesDelete: - { - CmdRemoteDriveDeleteL(); - break; - } - case EFileManagerSend: // Suppress - { - break; - } - case EFileManagerMemoryStorageDetails: - { - CmdMemoryStorageDetailsL(); - break; - } - case EFileManagerMemoryStorageName: - case EFileManagerMemoryStorageRename: // Fall through - { - CmdRenameDriveL(); - break; - } - case EFileManagerMemoryStorageFormat: - { - CmdFormatDriveL(); - break; - } - case EFileManagerMemoryStorageSetPassword: - { - CmdSetDrivePasswordL(); - break; - } - case EFileManagerMemoryStorageChangePassword: - { - CmdChangeDrivePasswordL(); - break; - } - case EFileManagerMemoryStorageRemovePassword: - { - CmdRemoveDrivePasswordL(); - break; - } - case EFileManagerMemoryStorageUnlock: - { - CmdUnlockDriveL(); - break; - } - default: - { - CFileManagerViewBase::HandleCommandL( aCommand ); - break; - } - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::CmdOpenMemoryStoreL -// ---------------------------------------------------------------------------- -// -void CFileManagerMainView::CmdOpenMemoryStoreL() - { - StoreIndex(); - TInt index( iContainer->ListBoxCurrentItemIndex() ); - if ( index >= 0 ) - { - CFileManagerAppUi* appUi = - static_cast< CFileManagerAppUi* >( AppUi() ); - CFileManagerItemProperties* prop = iEngine.GetItemInfoLC( index ); - - TRAPD( err, iEngine.OpenL( index ) ); - if ( err == KErrNone && prop->FullPath().Length() ) - { - appUi->ActivateMemoryStoreViewL(); - } - CleanupStack::PopAndDestroy( prop ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::CmdEjectL -// ---------------------------------------------------------------------------- -// -void CFileManagerMainView::CmdEjectL() - { - StoreIndex(); - -#ifdef RD_MULTIPLE_DRIVE - TInt index( iContainer->ListBoxCurrentItemIndex() ); - CFileManagerItemProperties* prop = iEngine.GetItemInfoLC( index ); - TInt drive( prop->DriveId() ); - const TInt KDriveShift = 16; - - // Let SysAp handle eject - RProperty::Set( - KPSUidCoreApplicationUIs, - KCoreAppUIsMmcRemovedWithoutEject, - ECoreAppUIsEjectCommandUsedToDrive | ( drive << KDriveShift ) - ); - - CleanupStack::PopAndDestroy( prop ); -#else // RD_MULTIPLE_DRIVE - if ( FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( R_QTN_CONF_EJECT ) ) - { - StartProcessL( EEjectProcess ); - } -#endif // RD_MULTIPLE_DRIVE - } - -#ifndef RD_FILE_MANAGER_BACKUP -// ---------------------------------------------------------------------------- -// CFileManagerMainView::CmdBackupL -// -// ---------------------------------------------------------------------------- -// -void CFileManagerMainView::CmdBackupL() - { - StoreIndex(); - TInt textId( R_QTN_CONFIRM_BACKUP_TEXT ); - TFileManagerDriveInfo mmcinfo( iEngine.GetMMCInfoL() ); - - if( mmcinfo.iState & TFileManagerDriveInfo::EDriveBackupped ) - { - textId = R_QTN_CONFIRM_BACKUP_TEXT2; - } - if( FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( textId ) ) - { - if ( !DriveReadOnlyMmcL( mmcinfo.iDrive ) ) - { - if ( !IsDriveAvailable( mmcinfo.iDrive ) || - !CheckPhoneState() ) - { - FileManagerDlgUtils::ShowErrorNoteL( R_QTN_CRITICAL_ERROR ); - } - else - { - StartProcessL( EBackupProcess ); - } - } - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::CmdRestoreL -// ---------------------------------------------------------------------------- -// -void CFileManagerMainView::CmdRestoreL() - { - StoreIndex(); - if( FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( R_QTN_CONFIRM_RESTORE_TEXT ) ) - { - TFileManagerDriveInfo mmcinfo( iEngine.GetMMCInfoL() ); - - if ( !IsDriveAvailable( mmcinfo.iDrive ) || - !CheckPhoneState() ) - { - FileManagerDlgUtils::ShowErrorNoteL( R_QTN_CRITICAL_ERROR ); - } - else - { - StartProcessL( ERestoreProcess ); - } - } - } -#endif // RD_FILE_MANAGER_BACKUP - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::CmdMapRemoteDriveL -// ---------------------------------------------------------------------------- -// -void CFileManagerMainView::CmdMapRemoteDriveL() - { - StoreIndex(); - const TInt KMaxRemoteDrives = 9; - RFs& fs( CCoeEnv::Static()->FsSession() ); - TDriveList driveList; - User::LeaveIfError( fs.DriveList( driveList, KDriveAttRemote ) ); - TInt numRemote( 0 ); - TInt count( driveList.Length() ); - for( TInt i( 0 ); i < count; ++i ) - { - if ( driveList[ i ] & KDriveAttRemote ) - { - ++numRemote; - } - } - if ( numRemote < KMaxRemoteDrives ) - { - OpenRemoteDriveSettingsL(); - } - else - { - FileManagerDlgUtils::ShowConfirmQueryWithOkL( - FileManagerDlgUtils::EErrorIcons, - R_QTN_RD_ERROR_MAX_DRIVES ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerMainView::CmdRemoteDriveSettingsL -// ------------------------------------------------------------------------------ -// -void CFileManagerMainView::CmdRemoteDriveSettingsL() - { - StoreIndex(); - TInt index( iContainer->ListBoxCurrentItemIndex() ); - CFileManagerItemProperties* prop = iEngine.GetItemInfoLC( index ); - OpenRemoteDriveSettingsL( prop->DriveName() ); - CleanupStack::PopAndDestroy( prop ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerMainView::CmdRemoteDriveDeleteL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerMainView::CmdRemoteDriveDeleteL() - { - StoreIndex(); - TInt index( iContainer->ListBoxCurrentItemIndex() ); - CFileManagerItemProperties* prop = iEngine.GetItemInfoLC( index ); - if ( IsDisconnectedRemoteDrive( *prop ) ) - { - if ( FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( - R_QTN_RD_QUERY_DELETE_DRIVE, prop->Name() ) ) - { - TInt drv = TDriveUnit( prop->FullPath() ); - User::LeaveIfError( iEngine.DeleteRemoteDrive( drv ) ); - } - } - CleanupStack::PopAndDestroy( prop ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerMainView::NotifyL -// -// ------------------------------------------------------------------------------ -// -TInt CFileManagerMainView::NotifyL( - TFileManagerNotify aType, TInt aData, const TDesC& aName ) - { - TInt ret( KErrNone ); - switch ( aType ) - { -#ifdef RD_FILE_MANAGER_BACKUP - case ENotifyActionSelected: - { - if ( aData == EFileManagerBackupAction ) - { - StoreIndex(); - CFileManagerAppUi* appUi = - static_cast< CFileManagerAppUi* >( AppUi() ); - appUi->ActivateBackupViewL(); - } - break; - } -#endif // RD_FILE_MANAGER_BACKUP - default: - { - ret = CFileManagerViewBase::NotifyL( aType, aData, aName ); - break; - } - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerMainView::MemoryStorageMenuFilteringL -// ----------------------------------------------------------------------------- -// -void CFileManagerMainView::MemoryStorageMenuFilteringL( CEikMenuPane& aMenuPane ) - { - TFileManagerDriveInfo drvInfo; - if( DriveInfoAtCurrentPosL( drvInfo ) < 0 ) - { - // No drive selected - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageUnlock, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageDetails, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageFormat, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageName, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageRename, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageSetPassword, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageChangePassword, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageRemovePassword, ETrue ); - return; - } - - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveCorrupted ) - { - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageDetails, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageName, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageRename, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageSetPassword, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageChangePassword, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageRemovePassword, ETrue ); - } - else if ( !( drvInfo.iState & TFileManagerDriveInfo::EDriveRemovable ) || - ( drvInfo.iState & ( TFileManagerDriveInfo::EDriveLocked | - TFileManagerDriveInfo::EDriveMassStorage ) ) ) - { - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageName, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageRename, ETrue ); - } - else if ( drvInfo.iName.Length() > 0 ) - { - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageName, ETrue ); - } - else - { - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageRename, ETrue ); - } - if (!( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent) ) - { - aMenuPane.SetItemDimmed(EFileManagerMemoryStorageSetPassword, ETrue ); - aMenuPane.SetItemDimmed(EFileManagerMemoryStorageName, ETrue ); - aMenuPane.SetItemDimmed(EFileManagerMemoryStorageRename, ETrue ); - aMenuPane.SetItemDimmed(EFileManagerMemoryStorageDetails, ETrue ); - - } - - if ( FeatureManager().IsEmbedded() || - !( drvInfo.iState & TFileManagerDriveInfo::EDriveRemovable ) || - !( drvInfo.iState & TFileManagerDriveInfo::EDriveFormattable ) ) - { - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageFormat, ETrue ); - } - - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveLocked ) - { - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageDetails, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageSetPassword, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageChangePassword, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageRemovePassword, ETrue ); - } - else - { - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageUnlock, ETrue ); - } - - if ( !( drvInfo.iState & TFileManagerDriveInfo::EDriveRemovable ) || - ( drvInfo.iState & ( TFileManagerDriveInfo::EDriveMassStorage | - TFileManagerDriveInfo::EDriveUsbMemory ) ) ) - { - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageSetPassword, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageChangePassword, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageRemovePassword, ETrue ); - } - else if ( drvInfo.iState & TFileManagerDriveInfo::EDrivePasswordProtected ) - { - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageSetPassword, ETrue ); - } - else - { - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageChangePassword, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageRemovePassword, ETrue ); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerMainView::CmdMemoryStorageDetailsL -// ------------------------------------------------------------------------------ -// -void CFileManagerMainView::CmdMemoryStorageDetailsL() - { - StoreIndex(); - TFileManagerDriveInfo drvInfo; - TInt drive( DriveInfoAtCurrentPosL( drvInfo ) ); - if ( drive < 0 ) - { - return; // No drive selected - } - HBufC* title = StringLoader::LoadLC( R_QTN_FMGR_MSTATE_HEADING ); - CMemStatePopup::RunLD( - static_cast< TDriveNumber >( drive ), *title ); - CleanupStack::PopAndDestroy( title ); -// TFileManagerDriveInfo drvInfo; -// iEngine.GetDriveInfoL( iEngine.CurrentDrive(), drvInfo ); -// FileManagerDlgUtils::ShowMemoryStoreInfoPopupL( drvInfo ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerMainView::CmdRenameDriveL -// ------------------------------------------------------------------------------ -// -void CFileManagerMainView::CmdRenameDriveL() - { - StoreIndex(); - TFileManagerDriveInfo drvInfo; - if ( DriveInfoAtCurrentPosL( drvInfo ) < 0 ) - { - return; // No drive selected - } - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveWriteProtected ) - { - FileManagerDlgUtils::ShowErrorNoteL( R_QTN_MEMORYCARD_READONLY ); - return; - } - RenameDriveL( EFalse ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerMainView::CmdSetDrivePasswordL -// ------------------------------------------------------------------------------ -// -void CFileManagerMainView::CmdSetDrivePasswordL() - { - StoreIndex(); - TInt drive( DriveAtCurrentPosL() ); - if ( drive < 0 ) - { - return; // No drive selected - } - - TBuf< KFmgrMaxMediaPassword > pwd; - if( FileManagerDlgUtils::ShowPasswordQueryL( pwd ) ) - { - TBuf< KFmgrMaxMediaPassword > nullPwd; - EmptyPwd( nullPwd ); - if( UpdatePassword( drive, nullPwd, pwd ) == KErrNone ) - { - FileManagerDlgUtils::ShowConfirmNoteL( R_QTN_PASSWORD_SET_TEXT ); - } - else - { - FileManagerDlgUtils::ShowErrorNoteL( R_QTN_CRITICAL_ERROR ); - } - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerMainView::CmdChangeDrivePasswordL -// ------------------------------------------------------------------------------ -// -void CFileManagerMainView::CmdChangeDrivePasswordL() - { - StoreIndex(); - TInt drive( DriveAtCurrentPosL() ); - if ( drive < 0 ) - { - return; // No drive selected - } - - TBuf< KFmgrMaxMediaPassword > pwd; - TBuf< KFmgrMaxMediaPassword > oldPwd; - TBool isDone( EFalse ); - TBool isCanceled( EFalse ); - TInt err( KErrNone ); - - // Ask for the old password until the correct one is given - while( !isDone ) - { - EmptyPwd( oldPwd ); - if( FileManagerDlgUtils::ShowSimplePasswordQueryL( - R_QTN_PASSWORD_OLD_TEXT, oldPwd ) ) - { - TInt index(iContainer->ListBoxCurrentItemIndex()); - CFileManagerItemProperties* prop = iEngine.GetItemInfoLC(index); - TUint32 drvState(0); - TInt error= iEngine.DriveState(drvState, prop->FullPath()); - if ((error!=KErrNone)||(!(drvState & TFileManagerDriveInfo::EDrivePresent))) - { - isDone = ETrue; - isCanceled = ETrue; - FileManagerDlgUtils::ShowErrorNoteL(R_QTN_MEMC_NOT_AVAILABLE ); - } - else - { - err = UpdatePassword( drive, oldPwd, oldPwd ); - if( err == KErrNone ) - { - isDone = ETrue; - } - else - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_PASSWORDS_WRONG_TEXT ); - } - } - CleanupStack::PopAndDestroy( prop ); - } - else - { - isDone = ETrue; - isCanceled = ETrue; - } - } - - // Then query for the new password - if( !isCanceled ) - { - if( FileManagerDlgUtils::ShowPasswordQueryL( pwd ) ) - { - err = UpdatePassword( drive, oldPwd, pwd ); - if( err == KErrNone ) - { - FileManagerDlgUtils::ShowConfirmNoteL( - R_QTN_PASSWORD_CHANGED_TEXT ); - } - else - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_CRITICAL_ERROR ); - } - } - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerMainView::CmdRemoveDrivePasswordL -// ------------------------------------------------------------------------------ -// -void CFileManagerMainView::CmdRemoveDrivePasswordL() - { - StoreIndex(); - TInt drive( DriveAtCurrentPosL() ); - if ( drive < 0 ) - { - return; // No drive selected - } - - if( !UnlockRemovePasswordL( drive, ETrue ) ) - { - FileManagerDlgUtils::ShowConfirmNoteL( R_QTN_PASSWORD_REMOVED_TEXT ); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerMainView::DriveAtCurrentPosL -// ------------------------------------------------------------------------------ -// -TInt CFileManagerMainView::DriveAtCurrentPosL() - { - TFileManagerDriveInfo dummy; - return DriveInfoAtCurrentPosL( dummy ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerMemoryStoreView.cpp --- a/filemanager/App/src/CFileManagerMemoryStoreView.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,349 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Memory store view -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include "CFileManagerMemoryStoreView.h" -#include "CFileManagerFileListContainer.h" -#include "CFileManagerAppUi.h" -#include "CFileManagerDocument.h" -#include "FileManager.hrh" - - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// CFileManagerMemoryStoreView::CFileManagerMemoryStoreView -// ---------------------------------------------------------------------------- -// -CFileManagerMemoryStoreView::CFileManagerMemoryStoreView() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerMemoryStoreView::NewLC -// ---------------------------------------------------------------------------- -// -CFileManagerMemoryStoreView* CFileManagerMemoryStoreView::NewLC() - { - CFileManagerMemoryStoreView* self = - new( ELeave ) CFileManagerMemoryStoreView(); - - CleanupStack::PushL( self ); - self->ConstructL( R_FILEMANAGER_FOLDERS_VIEW ); - - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerMemoryStoreView::~CFileManagerMemoryStoreView -// ---------------------------------------------------------------------------- -// -CFileManagerMemoryStoreView::~CFileManagerMemoryStoreView() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerMemoryStoreView::DoActivateL -// ---------------------------------------------------------------------------- -// -void CFileManagerMemoryStoreView::DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ) - { - FUNC_LOG - - // Check embedded app exit first - CFileManagerAppUi* appUi = - static_cast< CFileManagerAppUi* >( AppUi() ); - appUi->ExitEmbeddedAppIfNeededL(); - - CFileManagerViewBase::DoActivateL( - aPrevViewId, aCustomMessageId, aCustomMessage ); - - TBool showRemoteNotConnected( EFalse ); - // Ensure that root directory is defined - TInt count( iEngine.NavigationLevel() ); - if ( count > 0 ) - { - iIndex = 0; - for ( TInt i( 0 ); i < count; i++ ) - { - TRAP_IGNORE( iEngine.BackstepL() ); - } - showRemoteNotConnected = ETrue; - } - - TRAP_IGNORE ( RefreshDriveInfoL() ); - RefreshTitleL(); - iEngine.SetState( CFileManagerEngine::ENavigation ); - iEngine.SetObserver( this ); - if ( DriveAvailableL( showRemoteNotConnected ) ) - { - iEngine.RefreshDirectory(); - } - else - { - UpdateCbaL(); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerMemoryStoreView::DoDeactivate -// ---------------------------------------------------------------------------- -// -void CFileManagerMemoryStoreView::DoDeactivate() - { - FUNC_LOG - - CFileManagerViewBase::DoDeactivate(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerMemoryStoreView::DirectoryChangedL -// ---------------------------------------------------------------------------- -// -void CFileManagerMemoryStoreView::DirectoryChangedL() - { - FUNC_LOG - - TBool drvAvailable( DriveAvailableL( ETrue ) ); - - if ( iContainer ) - { - if ( drvAvailable ) - { - TInt index = iEngine.CurrentIndex(); - if ( index != KErrNotFound ) - { - iIndex = index; - } - iContainer->RefreshListL( iIndex ); - } - else - { - iIndex = 0; - } - RefreshTitleL(); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerMemoryStoreView::Id -// ---------------------------------------------------------------------------- -// -TUid CFileManagerMemoryStoreView::Id() const - { - return CFileManagerAppUi::KFileManagerMemoryStoreViewId; - } - -// ---------------------------------------------------------------------------- -// CFileManagerMemoryStoreView::CreateContainerL -// ---------------------------------------------------------------------------- -// -CFileManagerContainerBase* CFileManagerMemoryStoreView::CreateContainerL() - { - return CFileManagerFileListContainer::NewL( - ClientRect(), - iIndex, - CFileManagerFileListContainer::EListMemoryStore, - R_QTN_SELEC_EMPTY_LIST, - KFMGR_HLP_MEM_STORE_VIEW ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerMemoryStoreView::HandleCommandL -// ---------------------------------------------------------------------------- -// -void CFileManagerMemoryStoreView::HandleCommandL( TInt aCommand ) - { - switch( aCommand ) - { - case EFileManagerOpen: - { - CmdOpenL(); - break; - } - case EAknSoftkeyBack: - { - CmdBackL(); - break; - } - default: - { - CFileManagerViewBase::HandleCommandL( aCommand ); - break; - } - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerMemoryStoreView::DriveAvailableL -// ---------------------------------------------------------------------------- -// -TBool CFileManagerMemoryStoreView::DriveAvailableL( - TBool aShowRemoteNotConnected ) - { - HBufC* error = NULL; - TFileManagerDriveInfo& drvInfo( DriveInfo() ); - if ( drvInfo.iState & ( - TFileManagerDriveInfo::EDriveRemovable | - TFileManagerDriveInfo::EDriveRemote ) ) - { - TRAP_IGNORE( RefreshDriveInfoL() ); - } - - TInt drvNum = drvInfo.iDrive; - iEngine.GetDriveInfoL(drvNum,drvInfo); - - INFO_LOG1( "CFileManagerMemoryStoreView::DriveAvailableL-drvState=%d", - drvInfo.iState ) - - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) - { - iEngine.SetMemoryL( EFmRemoteDrive ); - } -#ifdef RD_MULTIPLE_DRIVE - else if ( drvInfo.iState & TFileManagerDriveInfo::EDriveMassStorage ) - { - iEngine.SetMemoryL( EFmMassStorage ); - } -#endif // RD_MULTIPLE_DRIVE - else if ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemovable ) - { - iEngine.SetMemoryL( EFmMemoryCard ); - } - else if ( drvInfo.iState & TFileManagerDriveInfo::EDriveUsbMemory ) - { - iEngine.SetMemoryL( EFmUsbMemory ); - } - else - { - iEngine.SetMemoryL( EFmPhoneMemory ); - } - -#ifdef RD_MULTIPLE_DRIVE - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveMassStorage ) - { - // Handle mass storage states - if ( !( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) || - ( drvInfo.iState & TFileManagerDriveInfo::EDriveInUse ) ) - { - error = StringLoader::LoadLC( R_QTN_MEMC_MASS_STORAGE_IN_USE ); - } - else if ( drvInfo.iState & TFileManagerDriveInfo::EDriveCorrupted ) - { - error = StringLoader::LoadLC( R_QTN_MEMC_MASS_STORAGE_CORRUPTED ); - } - } - else - { - // Handle other drives -#endif // RD_MULTIPLE_DRIVE - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveInUse ) - { - error = StringLoader::LoadLC( R_QTN_MEMC_MAINPAGE_ERROR4 ); - } - else if ( drvInfo.iState & TFileManagerDriveInfo::EDriveLocked ) - { - error = StringLoader::LoadLC( R_QTN_MEMC_MAINPAGE_ERROR2 ); - } - else if ( drvInfo.iState & TFileManagerDriveInfo::EDriveCorrupted ) - { - error = StringLoader::LoadLC( R_QTN_MEMC_MAINPAGE_ERROR3 ); - } - else if ( !( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) ) - { - error = StringLoader::LoadLC( R_QTN_MEMC_NOT_AVAILABLE ); - } - else if ( aShowRemoteNotConnected && - ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) && - ! ( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected ) ) - { - error = StringLoader::LoadLC( R_QTN_FMGR_EMPTY_REMOTE_DRIVE ); - } -#ifdef RD_MULTIPLE_DRIVE - } -#endif // RD_MULTIPLE_DRIVE - if ( error ) - { - if ( iContainer ) - { - iContainer->ListBoxSetTextL( *error ); - } - CleanupStack::PopAndDestroy( error ); - return EFalse; - } - return ETrue; - } - -// ---------------------------------------------------------------------------- -// CFileManagerMemoryStoreView::RefreshTitleL -// ---------------------------------------------------------------------------- -// -void CFileManagerMemoryStoreView::RefreshTitleL() - { - static_cast< CFileManagerAppUi* >( AppUi() )->SetTitleL( - iEngine.CurrentDriveName() ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerMemoryStoreView::CmdOpenL -// ---------------------------------------------------------------------------- -// -void CFileManagerMemoryStoreView::CmdOpenL() - { - StoreIndex(); - CFileManagerViewBase::CmdOpenL(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerMemoryStoreView::CmdBackL -// ---------------------------------------------------------------------------- -// -void CFileManagerMemoryStoreView::CmdBackL() - { - if ( iActiveProcess != ENoProcess ) - { - return; // Ignore to avoid container mess up - } - CFileManagerAppUi* appUi = - static_cast< CFileManagerAppUi* >( AppUi() ); - iEngine.BackstepL(); - iIndex = 0; - appUi->CloseMemoryStoreViewL(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerMemoryStoreView::UpdateCbaL -// ---------------------------------------------------------------------------- -// -void CFileManagerMemoryStoreView::UpdateCbaL() - { - UpdateCommonCbaL(); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerRestoreView.cpp --- a/filemanager/App/src/CFileManagerRestoreView.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,435 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: View for restore settings -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include "CFileManagerRestoreView.h" -#include "CFileManagerSettingListContainer.h" -#include "CFileManagerDocument.h" -#include "CFileManagerAppUi.h" -#include "FileManager.hrh" - -// CONSTANTS -const TUid CFileManagerRestoreView::KDeleteBackups = { EDeleteBackups }; -const TInt KMaxSelection = 64; - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::CFileManagerRestoreView -// ---------------------------------------------------------------------------- -// -CFileManagerRestoreView::CFileManagerRestoreView() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::NewLC -// ---------------------------------------------------------------------------- -// -CFileManagerRestoreView* CFileManagerRestoreView::NewLC() - { - CFileManagerRestoreView* self = new( ELeave ) CFileManagerRestoreView(); - CleanupStack::PushL( self ); - self->ConstructL( R_FILEMANAGER_RESTORE_VIEW ); - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::~CFileManagerRestoreView -// ---------------------------------------------------------------------------- -// -CFileManagerRestoreView::~CFileManagerRestoreView() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::DoActivateL -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreView::DoActivateL( - const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ) - { - FUNC_LOG - - iSelection = 0; // Reset stored list selection - iDeleteBackups = ( aCustomMessageId == KDeleteBackups ); - - CFileManagerViewBase::DoActivateL( - aPrevViewId, aCustomMessageId, aCustomMessage ); - - static_cast< CFileManagerAppUi* >( AppUi() )->SetTitleL( - iDeleteBackups ? - R_QTN_FMGR_DELETE_BACKUP_TITLE : R_QTN_FMGR_RESTORE_TITLE ); - - CFileManagerRestoreSettings& settings( iEngine.RestoreSettingsL() ); - settings.RefreshL(); - - iContainer->RefreshListL( iIndex ); - - CEikButtonGroupContainer* cba = Cba(); - cba->SetCommandSetL(R_AVKON_SOFTKEYS_OK_CANCEL__MARK ); - cba->MakeCommandVisible( EAknSoftkeyOk, EFalse ); - cba->MakeCommandVisible( EAknSoftkeyMark, ETrue ); - - if ( !iContainer->ListBoxNumberOfItems() ) - { - cba->MakeCommandVisible( EAknSoftkeyMark, EFalse ); - } - cba->DrawDeferred(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::DoDeactivate -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreView::DoDeactivate() - { - FUNC_LOG - - CFileManagerViewBase::DoDeactivate(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::DirectoryChangedL -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreView::DirectoryChangedL() - { - FUNC_LOG - - if ( iContainer ) - { - CFileManagerRestoreSettings& settings( iEngine.RestoreSettingsL() ); - settings.RefreshL(); - iContainer->RefreshListL( iIndex ); - RestoreSelectionL(); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::Id -// ---------------------------------------------------------------------------- -// -TUid CFileManagerRestoreView::Id() const - { - return CFileManagerAppUi::KFileManagerRestoreViewId; - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::CreateContainerL -// ---------------------------------------------------------------------------- -// -CFileManagerContainerBase* CFileManagerRestoreView::CreateContainerL() - { - CFileManagerRestoreSettings& settings( iEngine.RestoreSettingsL() ); - CFileManagerContainerBase* container = - CFileManagerSettingListContainer::NewL( - ClientRect(), - iIndex, - CFileManagerSettingListContainer::EListRestore, - &settings ); - container->SetEmptyTextL( R_QTN_FMGR_RESTORE_NO_BACKUPS ); - return container; - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::HandleCommandL -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreView::HandleCommandL( TInt aCommand ) - { - switch( aCommand ) - { - case EAknSoftkeySelect: // FALLTHROUGH - case EAknSoftkeyMark: // FALLTHROUGH - case EAknSoftkeyUnmark: // FALLTHROUGH - case EFileManagerSelectionKey: // FALLTHROUGH - case EFileManagerToggleMark: // FALLTHROUGH - case EFileManagerOpen: - { - CmdSelectL(); - break; - } - case EAknSoftkeyOk: - { - CmdOkL(); - break; - } - case EAknSoftkeyCancel: // FALLTHROUGH - case EAknSoftkeyBack: - { - CmdCancelL(); - break; - } - case EFileManagerCheckMark: - { - CmdCheckMarkL(); - break; - } - default: - { - break; - } - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::CmdOkL -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreView::CmdOkL() - { - if ( !iContainer ) - { - return; - } - - TBool isSystemStateNormal = static_cast< CFileManagerAppUi* >( AppUi() )->IsSystemStateNormal(); - if ( !isSystemStateNormal ) - { - FileManagerDlgUtils::ShowErrorNoteL( R_QTN_FMGR_SYSTEM_NOT_READY ); - return; - } - - const CArrayFix< TInt >* items = iContainer->ListBoxSelectionIndexes(); - - TInt count( items->Count() ); - - if ( count ) - { - if( FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( - iDeleteBackups ? - R_QTN_FMGR_DELETE_BACKUP_QUERY : R_QTN_FMGR_RESTORE_QUERY ) ) - { - if ( !CheckPhoneState() ) - { - FileManagerDlgUtils::ShowErrorNoteL( R_QTN_CRITICAL_ERROR ); - } - else - { - TUint64 selection( 0 ); - for ( TInt i( 0 ); i < count; ++i ) - { - selection |= ( ( TUint64 ) 1 ) << ( ( *items )[ i ] ); - } - - CFileManagerRestoreSettings& settings( - iEngine.RestoreSettingsL() ); - settings.SetSelection( selection ); - - if ( iDeleteBackups ) - { - // Delete selected backups and close this view - iEngine.DeleteBackupsL(); - iIndex = 0; - static_cast< CFileManagerAppUi* >( - AppUi() )->CloseRestoreViewL(); - } - else - { - // Start restoring selected backups - TRAPD( err, StartProcessL( ERestoreProcess ) ); - if ( err == KErrCorrupt ) - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_FMGR_ERROR_CORRUPTED_BACKUP_FILE ); - } - else - { - User::LeaveIfError( err ); - } - } - } - } - } - else - { - CmdCancelL(); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::CmdCancelL -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreView::CmdCancelL() - { - iIndex = 0; - static_cast< CFileManagerAppUi* >( AppUi() )->CloseRestoreViewL(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::CmdSelectL -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreView::CmdSelectL() - { - if ( !iContainer ) - { - return; - } - if ( !iContainer->ListBoxNumberOfItems() ) - { - return; - } - TInt index( iContainer->ListBoxCurrentItemIndex() ); - iContainer->ListBoxToggleItemL( index ); - iSelection ^= ( ( TUint64 ) 1 ) << index; // Toggle stored list selection - UpdateCbaFromSelectionL(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::CmdCheckMarkL -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreView::CmdCheckMarkL() - { - if ( !iContainer ) - { - return; - } - TInt mskTextId( R_QTN_MSK_MARK ); - if ( iContainer->ListBoxIsItemSelected( - iContainer->ListBoxCurrentItemIndex() ) ) - { - mskTextId = R_QTN_MSK_UNMARK; - } - - SetCbaMskTextL( mskTextId ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::ProcessFinishedL -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreView::ProcessFinishedL( - TInt aError, const TDesC& aName ) - { - TBool isRestore( iActiveProcess == ERestoreProcess ); - - CFileManagerViewBase::ProcessFinishedL( aError, aName ); - - // Exit when restore finished - if ( isRestore ) - { - CmdCancelL(); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::NotifyForegroundStatusChange -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreView::NotifyForegroundStatusChange( - TBool aForeground ) - { - FUNC_LOG - - if ( aForeground ) - { - TRAP_IGNORE( RefreshSettingsL() ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::RefreshSettingsL -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreView::RefreshSettingsL() - { - FUNC_LOG - - DirectoryChangedL(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::RestoreSelectionL -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreView::RestoreSelectionL() - { - if ( !iContainer ) - { - return; - } - const CArrayFix< TInt >* items = iContainer->ListBoxSelectionIndexes(); - for ( TInt i( 0 ); i < KMaxSelection; ++i ) - { - if ( iSelection & ( ( ( TUint64 ) 1 ) << i ) ) - { - iContainer->ListBoxSelectItemL( i ); - } - else - { - iContainer->ListBoxDeselectItem( i ); - } - } - UpdateCbaFromSelectionL(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::UpdateCbaFromSelectionL -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreView::UpdateCbaFromSelectionL() - { - if ( !iContainer ) - { - return; - } - CmdCheckMarkL(); - CEikButtonGroupContainer* cba = Cba(); - TBool hasItem(iContainer->ListBoxNumberOfItems()); - const CArrayFix< TInt >* items = iContainer->ListBoxSelectionIndexes(); - if ( hasItem && items->Count() ) - { - cba->MakeCommandVisible( EAknSoftkeyOk, ETrue ); - } - else - { - cba->MakeCommandVisible( EAknSoftkeyOk, EFalse ); - } - cba->DrawDeferred(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreView::UpdateCbaL -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreView::UpdateCbaL() - { - CEikButtonGroupContainer* cba = Cba(); - TBool hasItem(iContainer->ListBoxNumberOfItems()); - cba->MakeCommandVisible( EAknSoftkeyMark, hasItem ); - TBool hasSelecttionItem( hasItem && ( iContainer->ListBoxSelectionIndexesCount() ) ); - cba->MakeCommandVisible( EAknSoftkeyOk, hasSelecttionItem ); - cba->DrawDeferred(); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerSchBackupHandler.cpp --- a/filemanager/App/src/CFileManagerSchBackupHandler.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,423 +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: Handler for scheduled backup -* -*/ - - - #define FILE_MANAGER_POWER_SAVING_MODE - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef FILE_MANAGER_POWER_SAVING_MODE - #include -#endif // FILE_MANAGER_POWER_SAVING_MODE -#include "CFileManagerSchBackupHandler.h" -#include "MFileManagerSchBackupObserver.h" - - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::CFileManagerSchBackupHandler -// ---------------------------------------------------------------------------- -// -CFileManagerSchBackupHandler::CFileManagerSchBackupHandler( - CFileManagerEngine& aEngine ) : - iEngine( aEngine ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::NewL -// ---------------------------------------------------------------------------- -// -CFileManagerSchBackupHandler* CFileManagerSchBackupHandler::NewL( - CFileManagerEngine& aEngine ) - { - CFileManagerSchBackupHandler* self = - new( ELeave ) CFileManagerSchBackupHandler( aEngine ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::ConstructL -// ---------------------------------------------------------------------------- -// -void CFileManagerSchBackupHandler::ConstructL() - { - FUNC_LOG - - iGlobalDlg = CFileManagerGlobalDlg::NewL(); - iGlobalDlg->SetObserver( this ); - - iCenRep = CRepository::NewL( KCRUidFileManagerSettings ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::~CFileManagerSchBackupHandler -// ---------------------------------------------------------------------------- -// -CFileManagerSchBackupHandler::~CFileManagerSchBackupHandler() - { - FUNC_LOG - - delete iGlobalDlg; - delete iCenRep; - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::HandleGlobalDlgResult -// ---------------------------------------------------------------------------- -// -void CFileManagerSchBackupHandler::HandleGlobalDlgResult( - TInt aDlgType, - TInt aDlgResult ) - { - INFO_LOG2( - "CFileManagerSchBackupHandler::HandleGlobalDlgResult-aDlgType=%d,aDlgResult=%d", - aDlgType, aDlgResult ) - TInt err( KErrNone ); - switch ( aDlgType ) - { - case CFileManagerGlobalDlg::ECountdownQuery: - { - if ( aDlgResult == EAknSoftkeyYes ) - { - // Backup was accepted - StartBackup(); - - err = iCenRep->Set( - KFileManagerLastSchBackupStatus, - EFileManagerSchBackupStatusInProgress ); - } - else - { - // Backup was rejected - InformObserver( KErrCancel ); - CancelBackupStarter(); - } - break; - } - case CFileManagerGlobalDlg::EProgressDialog: - { - // Backup was canceled - iEngine.CancelProcess( - MFileManagerProcessObserver::ESchBackupProcess ); - InformObserver( KErrCancel ); - CancelBackupStarter(); - break; - } - default: - { - InformObserver( aDlgResult ); - break; - } - } - - LOG_IF_ERROR1( err, - "CFileManagerSchBackupHandler::HandleGlobalDlgResult-err=%d", err ) - - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::StartBackupWithConfirmL -// ---------------------------------------------------------------------------- -// -void CFileManagerSchBackupHandler::StartBackupWithConfirmL() - { - TBool psmOn( EFalse ); - TRAPD( err, psmOn = IsPowerSavingModeOnL() ); - if ( psmOn && err == KErrNone ) - { - iGlobalDlg->ShowDialogL( - CFileManagerGlobalDlg::EQueryWithInfoIcon, - R_QTN_FMGR_SCHEDULED_BACKUP_CANCELLED_PS, - R_AVKON_SOFTKEYS_OK_EMPTY ); - CancelBackupStarter(); - return; - } - - // Show cancelable global confirm countdown before starting backup. - // Backup is started only if accepted or countdown has expired. - iGlobalDlg->ShowDialogL( - CFileManagerGlobalDlg::ECountdownQuery, - R_QTN_FMGR_SCHEDULED_BACKUP_QUERY ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::StartBackupL -// ---------------------------------------------------------------------------- -// -void CFileManagerSchBackupHandler::StartBackupL() - { - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - TFileManagerDriveInfo drvInfo; - iEngine.GetDriveInfoL( settings.TargetDrive(), drvInfo ); - TBool drvAvailable( EFalse ); - - if( !IsTargetDriveAvailableL(drvInfo ) ) - { - for( TInt i ( EDriveA ); i <= EDriveZ; i++ ) - { - iEngine.GetDriveInfoL( i , drvInfo ); - if( ( IsTargetDriveAvailableL( drvInfo ) ) && ( drvInfo.iState & TFileManagerDriveInfo::EDriveEjectable ) ) - { - settings.SetTargetDrive( i ); - settings.SaveL(); - drvAvailable = ETrue; - break; - } - } - } - else - { - drvAvailable = ETrue; - } - if ( !drvAvailable ) - { - iGlobalDlg->ShowDialogL( - CFileManagerGlobalDlg::EQueryWithWarningIcon, - R_QTN_FMGR_SCHEDULED_BACKUP_ERROR, - R_AVKON_SOFTKEYS_OK_EMPTY ); - CancelBackupStarter(); - return; - } - - HBufC* text = StringLoader::LoadLC( - R_QTN_FMGR_SCHEDULED_BACKUP_PROGRESS, - iEngine.DriveName( settings.TargetDrive() ) ); - - iGlobalDlg->ShowDialogL( - CFileManagerGlobalDlg::EProgressDialog, - *text ); - - CleanupStack::PopAndDestroy( text ); - - iEngine.StartBackupProcessL( - MFileManagerProcessObserver::ESchBackupProcess ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::SetObserver -// ---------------------------------------------------------------------------- -// -void CFileManagerSchBackupHandler::SetObserver( - MFileManagerSchBackupObserver* aObserver ) - { - iObserver = aObserver; - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::StartBackupWithConfirm -// ---------------------------------------------------------------------------- -// -void CFileManagerSchBackupHandler::StartBackupWithConfirm() - { - FUNC_LOG - - if ( iBackupOngoing ) - { - return; - } - - iBackupOngoing = ETrue; - - TRAPD( err, StartBackupWithConfirmL() ); - if ( err != KErrNone ) - { - InformObserver( err ); - } - else - { - // Confirm scheduled backup start state - TInt err( iCenRep->Set( - KFileManagerLastSchBackupStatus, - EFileManagerSchBackupStatusInProgress ) ); - - LOG_IF_ERROR1( err, - "CFileManagerSchBackupHandler::StartBackupWithConfirm-err=%d", err ) - - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::StartBackup -// ---------------------------------------------------------------------------- -// -void CFileManagerSchBackupHandler::StartBackup() - { - FUNC_LOG - - TRAPD( err, StartBackupL() ); - if ( err != KErrNone ) - { - InformObserver( err ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::InformObserver -// ---------------------------------------------------------------------------- -// -void CFileManagerSchBackupHandler::InformObserver( const TInt aValue ) - { - INFO_LOG1( "CFileManagerSchBackupHandler::InformObserver-aValue=%d", aValue ) - - iBackupOngoing = EFalse; - if ( iObserver ) - { - TRAP_IGNORE( iObserver->SchBackupFinishedL( aValue ) ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::ProcessFinishedL -// ---------------------------------------------------------------------------- -// -void CFileManagerSchBackupHandler::ProcessFinishedL( - TInt aError, const TDesC& /*aName*/ ) - { - INFO_LOG1( "CFileManagerSchBackupHandler::ProcessFinishedL-aError=%d", - aError ) - - iGlobalDlg->CancelDialog(); - TInt err( KErrNone ); - if ( aError == KErrCancel ) - { - CancelBackupStarter(); - } - else if ( aError != KErrNone ) - { - iGlobalDlg->ShowDialogL( - CFileManagerGlobalDlg::EErrorNote, - R_QTN_CRITICAL_ERROR ); - - err = iCenRep->Set( - KFileManagerLastSchBackupStatus, - EFileManagerSchBackupStatusFailed ); - } - else - { - iGlobalDlg->ShowDialogL( - CFileManagerGlobalDlg::EInfoNote, - R_QTN_BACKUP_COMPLETED ); - - err = iCenRep->Set( - KFileManagerLastSchBackupStatus, - EFileManagerSchBackupStatusOk ); - } - - LOG_IF_ERROR1( err, - "CFileManagerSchBackupHandler::ProcessFinishedL-err=%d", err ) - - InformObserver( aError ); - - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::ProcessAdvanceL -// ---------------------------------------------------------------------------- -// -void CFileManagerSchBackupHandler::ProcessAdvanceL( TInt aValue ) - { - iGlobalDlg->UpdateProgressDialog( aValue ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::ProcessStartedL -// ---------------------------------------------------------------------------- -// -void CFileManagerSchBackupHandler::ProcessStartedL( TInt aFinalValue ) - { - FUNC_LOG - - iGlobalDlg->UpdateProgressDialog( 0, aFinalValue ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::CancelBackupStarter -// ---------------------------------------------------------------------------- -// -void CFileManagerSchBackupHandler::CancelBackupStarter() - { - TInt err( iCenRep->Set( - KFileManagerLastSchBackupStatus, - EFileManagerSchBackupStatusCanceled ) ); - LOG_IF_ERROR1( err, - "CFileManagerSchBackupHandler::CancelBackupStarter-err=%d", err ) - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::IsPowerSavingModeOnL -// ---------------------------------------------------------------------------- -// -TBool CFileManagerSchBackupHandler::IsPowerSavingModeOnL() - { - TBool ret( EFalse ); -#ifdef FILE_MANAGER_POWER_SAVING_MODE - // Check power saving mode before start - CRepository* psmCenRep = CRepository::NewLC( KCRUidPowerSaveMode ); - TInt psmMode( 0 ); - User::LeaveIfError( psmCenRep->Get( KPsmCurrentMode, psmMode ) ); - if ( psmMode ) - { - ERROR_LOG1( - "CFileManagerSchBackupHandler::IsPowerSavingModeOnL-PsmMode=%d", - psmMode ) - ret = ETrue; - } - CleanupStack::PopAndDestroy( psmCenRep ); -#endif // FILE_MANAGER_POWER_SAVING_MODE - return ret; - } - -// ---------------------------------------------------------------------------- -// CFileManagerSchBackupHandler::IsTargetDriveAvailableL -// ---------------------------------------------------------------------------- -// -TBool CFileManagerSchBackupHandler::IsTargetDriveAvailableL( const TFileManagerDriveInfo& aDrvInfo ) - { - // Start backup with cancelable global progress dialog - - // Check is target drive available - TBool ret( ETrue ); - if ( !( aDrvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) || - ( aDrvInfo.iState & - ( TFileManagerDriveInfo::EDriveLocked | - TFileManagerDriveInfo::EDriveCorrupted | - TFileManagerDriveInfo::EDriveWriteProtected ) ) ) - { - ERROR_LOG1( - "CFileManagerSchBackupHandler::IsTargetDriveAvailableL-DrvState=%d", - aDrvInfo.iState ) - ret = EFalse; - } - return ret; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerSettingListContainer.cpp --- a/filemanager/App/src/CFileManagerSettingListContainer.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,287 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Setting list container in file manager -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "FileManager.hrh" -#include "CFileManagerDocument.h" -#include "CFileManagerIconArray.h" -#include "CFileManagerSettingListContainer.h" - - -// needed because _LIT macro does not expand parameter, which is also macro -#define _CREATE_LIT(a,b) _LIT(a,b) - -// CONSTANTS -const TInt KRestoreIconListGranularity = 3; -_CREATE_LIT( KFileManagerBitmapFile, filemanager_mbm_file_location ); - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerSettingListContainer::CFileManagerSettingListContainer -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerSettingListContainer::CFileManagerSettingListContainer( - const TListType aType ) : - iType( aType ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerSettingListContainer::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerSettingListContainer::ConstructL( - const TRect& aRect, - const TInt aFocusedIndex, - MDesCArray* aArray, - const TDesC& aHelpContext ) - { - CFileManagerContainerBase::ConstructL( aRect, aFocusedIndex ); - SetTextArray( aArray ); - SetHelpContext( aHelpContext ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerSettingListContainer::CreateListBoxL -// -// ----------------------------------------------------------------------------- -// -CEikTextListBox* CFileManagerSettingListContainer::CreateListBoxL() - { - CEikTextListBox* listBox = NULL; - - switch ( iType ) - { - case EListBackup: - { - listBox = CreateBackupListBoxL(); - break; - } - case EListRestore: - { - listBox = CreateRestoreListBoxL(); - break; - } - default: - { - break; - } - } - - return listBox; - } - -// ----------------------------------------------------------------------------- -// CFileManagerSettingListContainer::CreateBackupListBoxL -// -// ----------------------------------------------------------------------------- -// -CEikTextListBox* CFileManagerSettingListContainer::CreateBackupListBoxL() - { - CAknSettingStyleListBox* listBox = new( ELeave ) CAknSettingStyleListBox; - CleanupStack::PushL( listBox ); - listBox->SetContainerWindowL( *this ); - listBox->ConstructL( this, EAknListBoxSelectionList ); - listBox->ItemDrawer()->ColumnData()->SetSkinEnabledL( ETrue ); - CleanupStack::Pop( listBox ); - return listBox; - } - -// ----------------------------------------------------------------------------- -// CFileManagerSettingListContainer::CreateRestoreListBoxL -// -// ----------------------------------------------------------------------------- -// -CEikTextListBox* CFileManagerSettingListContainer::CreateRestoreListBoxL() - { - CAknAppUi* appUi = static_cast< CAknAppUi* >( ControlEnv()->AppUi() ); - CFileManagerDocument* doc = - static_cast< CFileManagerDocument* >( appUi->Document() ); - CAknDoubleGraphicStyleListBox* listBox = - new( ELeave ) CAknDoubleGraphicStyleListBox; - CleanupStack::PushL( listBox ); - listBox->SetContainerWindowL( *this ); - listBox->ConstructL( this, EAknListBoxMultiselectionList ); - listBox->ItemDrawer()->ColumnData()->SetSkinEnabledL( ETrue ); - - // Create icon array and icons - CAknIconArray* iconArray = new( ELeave ) CAknIconArray( - KRestoreIconListGranularity ); - listBox->ItemDrawer()-> - ColumnData()->SetIconArray( iconArray ); // changes ownership - - CGulIcon* icon = CFileManagerIconArray::LoadIconL( - KAvkonBitmapFile, - EMbmAvkonQgn_indi_checkbox_on, - EMbmAvkonQgn_indi_checkbox_on_mask, - KAknsIIDQgnIndiCheckboxOn.iMajor, - KAknsIIDQgnIndiCheckboxOn.iMinor, - ETrue ); - CleanupStack::PushL( icon ); - iconArray->AppendL( icon ); - CleanupStack::Pop( icon ); - - icon = CFileManagerIconArray::LoadIconL( - KAvkonBitmapFile, - EMbmAvkonQgn_indi_checkbox_off, - EMbmAvkonQgn_indi_checkbox_off_mask, - KAknsIIDQgnIndiCheckboxOff.iMajor, - KAknsIIDQgnIndiCheckboxOff.iMinor, - ETrue ); - CleanupStack::PushL( icon ); - iconArray->AppendL( icon ); - CleanupStack::Pop( icon ); - - icon = CFileManagerIconArray::LoadIconL( - KFileManagerBitmapFile, - EMbmFilemanagerQgn_indi_mmc_add, - EMbmFilemanagerQgn_indi_mmc_add_mask, - KAknsIIDQgnIndiMmcAdd.iMajor, - KAknsIIDQgnIndiMmcAdd.iMinor, - ETrue ); - CleanupStack::PushL( icon ); - iconArray->AppendL( icon ); - CleanupStack::Pop( icon ); - - icon = CFileManagerIconArray::LoadIconL( - KFileManagerBitmapFile, - EMbmFilemanagerQgn_indi_usb_memc, - EMbmFilemanagerQgn_indi_usb_memc_mask, - KAknsIIDQgnIndiMmcAdd.iMajor, - KAknsIIDQgnIndiMmcAdd.iMinor, - ETrue ); - CleanupStack::PushL( icon ); - iconArray->AppendL( icon ); - CleanupStack::Pop( icon ); - - // Disable lists MSK observer because the container will be used - // as observer - listBox->EnableMSKObserver( EFalse ); - CleanupStack::Pop( listBox ); - return listBox; - } - -// ----------------------------------------------------------------------------- -// CFileManagerSettingListContainer::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CFileManagerSettingListContainer* CFileManagerSettingListContainer::NewL( - const TRect& aRect, - const TInt aFocusedIndex, - const TListType aType, - MDesCArray* aArray, - const TDesC& aHelpContext ) - { - CFileManagerSettingListContainer* self = - new( ELeave ) CFileManagerSettingListContainer( aType ); - CleanupStack::PushL( self ); - self->ConstructL( aRect, aFocusedIndex, aArray, aHelpContext ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerSettingListContainer::~CFileManagerSettingListContainer -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerSettingListContainer::~CFileManagerSettingListContainer() - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerSettingListContainer::OfferKeyEventL -// -// ----------------------------------------------------------------------------- -// -TKeyResponse CFileManagerSettingListContainer::OfferKeyEventL( - const TKeyEvent& aKeyEvent, TEventCode aType ) - { - TKeyResponse response = EKeyWasNotConsumed; - - switch( aKeyEvent.iCode ) - { - case EKeyEnter: // FALLTHROUGH - case EKeyOK: - { - // Notify restore list about selection change - if ( iType == EListRestore ) - { - static_cast< CAknAppUi* >( ControlEnv()->AppUi() )-> - ProcessCommandL( EFileManagerSelectionKey ); - response = EKeyWasConsumed; - } - else - { - response = ListBox().OfferKeyEventL( aKeyEvent, aType ); - } - break; - } - case EKeyApplicationF: - { - // Suppress this from listbox, - // otherwise empty multiselection list sometimes works badly on exit - break; - } - default: - { - response = CFileManagerContainerBase::OfferKeyEventL( - aKeyEvent, aType ); - } - } - return response; - } - -// ----------------------------------------------------------------------------- -// CFileManagerSettingListContainer::HandleControlEventL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerSettingListContainer::HandleControlEventL( - CCoeControl* aControl, TCoeEvent aEventType ) - { - if ( iType == EListRestore && - aEventType == EEventStateChanged ) - { - static_cast< CAknAppUi* >( ControlEnv()->AppUi() )-> - ProcessCommandL( EFileManagerCheckMark ); - } - - CFileManagerContainerBase::HandleControlEventL( - aControl, aEventType ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerStringCache.cpp --- a/filemanager/App/src/CFileManagerStringCache.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,479 +0,0 @@ -/* -* Copyright (c) 2002-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: Cache for strings -* -*/ - - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include "CFileManagerStringCache.h" -#include "CFileManagerIconArray.h" - -// CONSTANTS -const TInt KFmgrMaximumSizeOfIconIdString = 3; -_LIT( KIconStr, "%d" ); -const TInt KMaxSizeString = 16; -const TInt64 KKileByte = 1024; -const TInt64 KMegaByte = 1048576; -const TInt64 KGigaByte = 1073741824; -const TInt64 KKileByteLowLimit = 100; // 100 bytes -const TInt64 KMegaByteLowLimit = 1048576; // 1MB -const TInt64 KGigaByteLowLimit = 1073741824; // 1GB -const TInt KSizeDecimals = 1; -const TInt KSizeTextArrayLen = 2; - -_LIT( KDateFormat1, "%1" ); -_LIT( KDateFormat2, "%2" ); -_LIT( KDateFormat3, "%3" ); -const TUint KSecondSeparator = 1; -const TUint KThirdSeparator = 2; -const TInt KDateStrMax = 20; - - -// ============================ LOCAL FUNCTIONS ================================ - -// ----------------------------------------------------------------------------- -// GetUnitAndFormatSize -// ----------------------------------------------------------------------------- -// -static TInt GetUnitAndFormatSize( TDes& aDes, const TInt64& aSize ) - { - TRealFormat sizeFormat( aDes.MaxLength(), KSizeDecimals ); - sizeFormat.iType |= KDoNotUseTriads; - TInt ret( R_QTN_FMGR_UNITS_BYTE ); - if ( aSize >= KGigaByteLowLimit ) - { - // Format in GBs with decimals - TReal size( I64REAL( aSize ) / I64REAL( KGigaByte ) ); - aDes.AppendNum( size, sizeFormat ); - ret = R_QTN_FMGR_UNITS_GIGABYTE; - } - else if ( aSize >= KMegaByteLowLimit ) - { - // Format in MBs with decimals - TReal size( I64REAL( aSize ) / I64REAL( KMegaByte ) ); - aDes.AppendNum( size, sizeFormat ); - ret = R_QTN_FMGR_UNITS_MEGABYTE; - } - else if ( aSize >= KKileByteLowLimit ) - { - // Format in kBs with decimals - TReal size( I64REAL( aSize ) / I64REAL( KKileByte ) ); - aDes.AppendNum( size, sizeFormat ); - ret = R_QTN_FMGR_UNITS_KILOBYTE; - } - else - { - // Format in bytes - aDes.AppendNum( aSize ); - } - AknTextUtils::LanguageSpecificNumberConversion( aDes ); - return ret; - } - -// ----------------------------------------------------------------------------- -// GetFreeSpaceStringL -// ----------------------------------------------------------------------------- -// -static HBufC* GetFreeSpaceStringL( const TInt64& aSize ) - { - CDesCArray* sizeTexts = new ( ELeave ) CDesCArrayFlat( KSizeTextArrayLen ); - CleanupStack::PushL( sizeTexts ); - TBuf< KMaxSizeString > size; - HBufC* unit = StringLoader::LoadLC( GetUnitAndFormatSize( size, aSize ) ); - sizeTexts->AppendL( size ); - sizeTexts->AppendL( *unit ); - CleanupStack::PopAndDestroy( unit ); - HBufC* ret = StringLoader::LoadL( R_QTN_FMGR_FREE_MEMORY_VAR_UNITS, - *sizeTexts ); - CleanupStack::PopAndDestroy( sizeTexts ); - return ret; - } - -// ----------------------------------------------------------------------------- -// DateStringL -// ----------------------------------------------------------------------------- -// -static HBufC* DateStringL( const TTime& aTime ) - { - TBuf< KDateStrMax > dateStr; - TBuf< KDateStrMax > dateStrFormat; - TLocale local; - dateStrFormat.Append( KDateFormat1 ); - dateStrFormat.Append( local.DateSeparator( KSecondSeparator ) ); - dateStrFormat.Append( KDateFormat2 ); - dateStrFormat.Append( local.DateSeparator( KThirdSeparator ) ); - dateStrFormat.Append( KDateFormat3 ); - aTime.FormatL( dateStr, dateStrFormat ); - return dateStr.AllocL(); - } - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerStringCache::CFileManagerStringCache -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerStringCache::CFileManagerStringCache( - CFileManagerEngine& aEngine, - CFileManagerIconArray& aIconArray ) : - iEngine( aEngine ), - iIconArray( aIconArray ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerStringCache::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CFileManagerStringCache* CFileManagerStringCache::NewL( - CFileManagerEngine& aEngine, - CFileManagerIconArray& aIconArray ) - { - CFileManagerStringCache* self = new( ELeave ) - CFileManagerStringCache( aEngine, aIconArray ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerStringCache::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerStringCache::ConstructL() - { - Clear(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerStringCache::~CFileManagerStringCache -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerStringCache::~CFileManagerStringCache() - { - Clear(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerStringCache::MdcaCount -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerStringCache::MdcaCount() const - { - return iEngine.FileList()->MdcaCount(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerStringCache::MdcaPoint -// -// ----------------------------------------------------------------------------- -// -TPtrC CFileManagerStringCache::MdcaPoint( TInt aIndex ) const - { - TInt err( KErrNone ); - TInt index( FormattedStringFound( aIndex ) ); - - if ( index >= 0 ) - { - return FormattedString( index ); - } - - iFormatString.Zero(); - - // Get icon - TInt iconId( EFileManagerOtherFileIcon ); - TRAP( err, iconId = iEngine.IconIdL( aIndex ) ); - if ( err != KErrNone ) - { - iconId = EFileManagerOtherFileIcon; - SetError( err ); - } - // Get name - CFileManagerItemProperties* prop = NULL; - TRAP( err, prop = iEngine.GetItemInfoL( aIndex ) ); - if ( err == KErrNone ) - { - TPtrC ptr( prop->LocalizedName() ); - if ( iconId != EFileManagerFolderIcon && - iconId != EFileManagerFolderSubIcon && - iconId != EFileManagerFolderEmptyIcon ) - { - // Append file name with conversion - HBufC* buffer = NULL; - TRAP( err, buffer = AknTextUtils::ConvertFileNameL( ptr ) ); - if ( err == KErrNone ) - { - iFormatString.Append( *buffer ); - } - else - { - // Put file name without any convertion, its better than nothing - iFormatString.Append( ptr ); - SetError( err ); - } - delete buffer; - } - else - { - // Append folder name - iFormatString.Append( ptr ); - } - } - else - { - SetError( err ); - } - // Remove all other possible tabs in string than the icon separator, - // so that listbox won't get broken - AknTextUtils::StripCharacters( iFormatString, KFmgrTab ); - - AknTextUtils::ReplaceCharacters( iFormatString, KFmgrLineFeed, KFmgrSpace()[0] ); - AknTextUtils::ReplaceCharacters( iFormatString, KFmgrParagraphSeparator, KFmgrSpace()[0] ); - - TInt iconIndex( iIconArray.FindIcon( iconId ) ); - if ( iconIndex >= 0 ) - { - iFormatString.Insert( 0, KFmgrTab ); - TBuf numBuf; - numBuf.Copy( KIconStr ); - numBuf.Format( KIconStr, iconIndex ); - iFormatString.Insert( 0, numBuf ); - } - else - { - SetError( iconIndex ); - } - - if ( err == KErrNone && prop && prop->IsDrive() ) - { - TFileManagerDriveInfo drvInfo; - TRAP( err, iEngine.GetDriveInfoL( prop->DriveId(), drvInfo ) ); - if ( err == KErrNone ) - { - // Show free space for accessible local drives - if ( ( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) && - !( drvInfo.iState & ( TFileManagerDriveInfo::EDriveRemote | - TFileManagerDriveInfo::EDriveCorrupted | - TFileManagerDriveInfo::EDriveLocked | - TFileManagerDriveInfo::EDriveInUse ) ) ) - { - HBufC* freeSpace = NULL; - TRAP( err, freeSpace = GetFreeSpaceStringL( drvInfo.iSpaceFree ) ); - if ( err == KErrNone ) - { - iFormatString.Append( KFmgrTab ); - iFormatString.Append( *freeSpace ); - } - else - { - SetError( err ); - } - delete freeSpace; - } - // Show connection icon for connected remote drives - else if ( ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) && - ( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected ) ) - { - iconIndex = iIconArray.FindIcon( - EFileManagerRemoteDriveConnectedIcon ); - if ( iconIndex >= 0 ) - { - iFormatString.Append( KFmgrTab ); - iFormatString.Append( KFmgrTab ); - iFormatString.AppendNum( iconIndex ); - } - else if ( iconIndex != KErrNotFound ) - { - SetError( iconIndex ); - } - } - } - } - else if ( err == KErrNone && prop && !prop->FullPath().Length() ) - { - // Show the latest backup date - TTime time( 0 ); - if( prop->ModifiedLocalDate( time ) == KErrNone ) - { - HBufC* date = NULL; - if ( !(time.DateTime().Year()) ) - { - iFormatString.Append( KFmgrTab ); - iFormatString.Append( KNullDesC ); - } - else - { - - TRAPD( err2, date = DateStringL( time ) ); - if ( err2 == KErrNone ) - { - iFormatString.Append( KFmgrTab ); - iFormatString.Append( *date ); - delete date; - } - } - } - } - - delete prop; - - TRAP( err, StoreFormattedStringL( aIndex ) ); - if( err != KErrNone ) - { - Clear(); - SetError( err ); - } - - return iFormatString; - } - -// ----------------------------------------------------------------------------- -// CFileManagerStringCache::Clear -// -// ----------------------------------------------------------------------------- -// -void CFileManagerStringCache::Clear() const - { - for ( TInt i( 0 ); i < KNumStringCacheItems; i++ ) - { - Clear( i ); - } - iError = KErrNone; - } - -// ----------------------------------------------------------------------------- -// CFileManagerStringCache::FormattedStringFound -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerStringCache::FormattedStringFound( TInt aIndex ) const - { - for ( TInt i( 0 ); i < KNumStringCacheItems; i++ ) - { - if ( iFormattedItems[ i ].iIndex == aIndex ) - { - return i; - } - } - return KErrNotFound; - } - -// ----------------------------------------------------------------------------- -// CFileManagerStringCache::FormattedString -// -// ----------------------------------------------------------------------------- -// -TPtrC CFileManagerStringCache::FormattedString( TInt aIndex ) const - { - TCacheItem& item = iFormattedItems[ aIndex ]; - if ( item.iString ) - { - return item.iString->Des(); - } - return TPtrC( KNullDesC ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerStringCache::StoreFormattedString -// -// ----------------------------------------------------------------------------- -// -void CFileManagerStringCache::StoreFormattedStringL( TInt aIndex ) const - { - TInt count( MdcaCount() ); - TInt replace( 0 ); - TInt maxDist( 0 ); - - // Find index to be replaced for cyclic list scroll - for ( TInt i( 0 ); i < KNumStringCacheItems; i++ ) - { - TCacheItem& item = iFormattedItems[ i ]; - if ( item.iIndex != KErrNotFound ) - { - TInt dist( Min( Abs( item.iIndex - aIndex ), - ( count - aIndex ) + item.iIndex ) ); - if ( dist > maxDist ) - { - maxDist = dist; - replace = i; - } - } - else - { - replace = i; - break; - } - } - // Setup new cached item - Clear( replace ); - TCacheItem& item = iFormattedItems[ replace ]; - item.iString = iFormatString.AllocL(); - item.iIndex = aIndex; - } - -// ----------------------------------------------------------------------------- -// CFileManagerStringCache::Clear -// -// ----------------------------------------------------------------------------- -// -void CFileManagerStringCache::Clear( TInt aIndex ) const - { - TCacheItem& item = iFormattedItems[ aIndex ]; - delete item.iString; - item.iString = NULL; - item.iIndex = KErrNotFound; - } - -// ----------------------------------------------------------------------------- -// CFileManagerStringCache::LastError -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerStringCache::LastError() const - { - return iError; - } - -// ----------------------------------------------------------------------------- -// CFileManagerStringCache::SetError -// -// ----------------------------------------------------------------------------- -// -void CFileManagerStringCache::SetError( TInt aError ) const - { - if ( aError == KErrNoMemory || - ( aError != KErrNone && iError == KErrNone ) ) - { - iError = aError; - } - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerTaskScheduler.cpp --- a/filemanager/App/src/CFileManagerTaskScheduler.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +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: Wraps task scheduler functionality -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include "CFileManagerTaskScheduler.h" - - -// CONSTANTS -const TInt KSchedulerPriority = 32; -const TInt KSchedulerGranularity = 1; -const TInt KSchedulerRepeat = -1; // Repeat until deleted -const TInt KSchedulerTaskId = 0; -const TInt KDayNumStringLen = 4; -const TInt KTaskInterval = 1; -const TInt KTaskValidity = 1; -_LIT( KDayNumStr, "%d" ); - - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// CFileManagerTaskScheduler::CFileManagerTaskScheduler -// ---------------------------------------------------------------------------- -// -CFileManagerTaskScheduler::CFileManagerTaskScheduler( - CFileManagerEngine& aEngine ) : - iEngine( aEngine ), - iScheduleHandle( KErrNotFound ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerTaskScheduler::NewL -// ---------------------------------------------------------------------------- -// -CFileManagerTaskScheduler* CFileManagerTaskScheduler::NewL( - CFileManagerEngine& aEngine ) - { - CFileManagerTaskScheduler* self = - new( ELeave ) CFileManagerTaskScheduler( aEngine ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerTaskScheduler::ConstructL -// ---------------------------------------------------------------------------- -// -void CFileManagerTaskScheduler::ConstructL() - { - FUNC_LOG - - User::LeaveIfError( iScheduler.Connect() ); - TFileName name( KSchBackupStarterExe ); - User::LeaveIfError( iScheduler.Register( name, KSchedulerPriority ) ); - - // Try to get schedule handle of previously made schedule - CArrayFixFlat< TSchedulerItemRef >* array = - new( ELeave ) CArrayFixFlat< TSchedulerItemRef >( - KSchedulerGranularity ); - CleanupStack::PushL( array ); - if ( iScheduler.GetScheduleRefsL( *array, EAllSchedules ) == KErrNone ) - { - if ( array->Count() ) - { - iScheduleHandle = array->At( 0 ).iHandle; - } - } - CleanupStack::PopAndDestroy( array ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerTaskScheduler::~CFileManagerTaskScheduler -// ---------------------------------------------------------------------------- -// -CFileManagerTaskScheduler::~CFileManagerTaskScheduler() - { - FUNC_LOG - - iScheduler.Close(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerTaskScheduler::CreateScheduleL -// ---------------------------------------------------------------------------- -// -void CFileManagerTaskScheduler::CreateScheduleL() - { - FUNC_LOG - - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - - // Create schedule entry and store schedule handle for later use - CArrayFixFlat< TScheduleEntryInfo2 >* array = - new ( ELeave ) CArrayFixFlat< - TScheduleEntryInfo2 >( KSchedulerGranularity ); - CleanupStack::PushL( array ); - - TTsTime tsTime( settings.Time(), EFalse ); - TScheduleEntryInfo2 entry( - tsTime, EDaily, KTaskInterval, KTaskValidity ); - array->AppendL( entry ); - - TSchedulerItemRef ref; - User::LeaveIfError( iScheduler.CreatePersistentSchedule( ref, *array ) ); - CleanupStack::PopAndDestroy( array ); - iScheduleHandle = ref.iHandle; - - // Add weekday to task data if weekly backup - HBufC* data = HBufC::NewLC( KDayNumStringLen ); - if ( settings.Scheduling() == EFileManagerBackupScheduleWeekly ) - { - TPtr ptr( data->Des() ); - ptr.Format( KDayNumStr, settings.Day() ); - } - - // Create scheduled task entry and enable it - TTaskInfo taskInfo; - taskInfo.iName = KSchBackupTaskName; - taskInfo.iPriority = KSchedulerPriority; - taskInfo.iTaskId = KSchedulerTaskId; - taskInfo.iRepeat = KSchedulerRepeat; - User::LeaveIfError( iScheduler.ScheduleTask( - taskInfo, *data, iScheduleHandle ) ); - CleanupStack::PopAndDestroy( data ); - User::LeaveIfError( iScheduler.EnableSchedule( iScheduleHandle ) ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerTaskScheduler::DeleteScheduleL -// ---------------------------------------------------------------------------- -// -void CFileManagerTaskScheduler::DeleteScheduleL() - { - if ( iScheduleHandle != KErrNotFound ) - { - INFO_LOG( "CFileManagerTaskScheduler::DeleteScheduleL-Delete" ) - iScheduler.DisableSchedule( iScheduleHandle ); - iScheduler.DeleteTask( KSchedulerTaskId ); - iScheduler.DeleteSchedule( iScheduleHandle ); - iScheduleHandle = KErrNotFound; - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerTaskScheduler::EnableBackupScheduleL -// ---------------------------------------------------------------------------- -// -void CFileManagerTaskScheduler::EnableBackupScheduleL( const TBool aEnable ) - { - // Delete old schedule first - DeleteScheduleL(); - - if ( aEnable ) - { - CreateScheduleL(); - } - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/CFileManagerViewBase.cpp --- a/filemanager/App/src/CFileManagerViewBase.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5194 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Base class for all file manager views -* -*/ - - - -// INCLUDE FILES -#include -#include // CEikMenuPane -#include // CEikMenuBar -#include -#include // Common File Dialogs -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CFileManagerViewBase.h" -#include "CFileManagerContainerBase.h" -#include "CFileManagerAppUi.h" -#include "CFileManagerDocument.h" -#include "CFileManagerFileSelectionFilter.h" -#include "FileManager.hrh" -#ifdef RD_FILE_MANAGER_BACKUP - #include "CFileManagerSchBackupHandler.h" - #include "CFileManagerBackupSettings.h" - #include "CFileManagerTaskScheduler.h" -#endif // RD_FILE_MANAGER_BACKUP -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace conn; - -// CONSTANTS -const TUint KMessageSize = 1024; -const TUint KMaxPercentage = 100; -const TUint KProgressBarUpdateInterval = 1000000; // microseconds -const TUint KDriveLetterSize = 1; -const TUint KRefreshProgressStartDelay = 1000000; // microseconds -const TInt KFmgrMSK = 3; -const TInt KEstimateUpperLimit = 90; // User selectable continuation -const TInt KEstimateLowerLimit = 10; // Backup will be interrupted -const TUint32 KDefaultFolderMask = CFileManagerItemProperties::EFolder | - CFileManagerItemProperties::EDefault; -const TInt64 KMSecToMicroSecMultiplier = 1000000; -const TInt64 KMinToMicroSecMultiplier = KMSecToMicroSecMultiplier * 60; -const TInt64 KHourToMicroSecMultiplier = KMinToMicroSecMultiplier * 60; -const TUint KProgressBarAsyncStartDelay = 1500000; // microseconds -const TInt64 KMinificationFactor = 1024; // Used to zoom processbar's proportion - -// ============================ LOCAL FUNCTIONS ================================ - -// ----------------------------------------------------------------------------- -// IsWmDrmFile -// -// ----------------------------------------------------------------------------- -// -static TBool IsWmDrmFile( const TDesC& aFullPath ) - { - TBool ret( EFalse ); - ContentAccess::CContent* content = NULL; - TRAPD( err, content = ContentAccess::CContent::CContent::NewL( - aFullPath, EContentShareReadWrite ) ); - if ( err != KErrNone ) - { - TRAP( err, content = ContentAccess::CContent::CContent::NewL( - aFullPath, EContentShareReadOnly ) ); - } - if ( err == KErrNone ) - { - TInt isProtected( 0 ); - err = content->GetAttribute( EIsProtected, isProtected ); - if ( err == KErrNone && isProtected ) - { - TInt fileType( 0 ); - err = content->GetAttribute( DRM::EDrmFileType, fileType ); - ret = ( err == KErrNone && fileType == DRM::EDrmWMFile ); - } - delete content; - } - return ret; - } - -// ----------------------------------------------------------------------------- -// Int64ToInt -// -// ----------------------------------------------------------------------------- -// -static TInt Int64ToInt( const TInt64& aInt64 ) - { - if ( aInt64 > KMaxTInt ) - { - return KMaxTInt; - } - return I64INT( aInt64 ); - } - -// ----------------------------------------------------------------------------- -// EmptyPwd -// -// ----------------------------------------------------------------------------- -// -//static void EmptyPwd( TDes& aPwd ) -// { -// aPwd.FillZ( aPwd.MaxLength( ) ); -// aPwd.Zero(); -// } - -// ----------------------------------------------------------------------------- -// ConvertCharsToPwd -// -// ----------------------------------------------------------------------------- -// -//static void ConvertCharsToPwd( const TDesC& aWord, TDes8& aConverted ) -// { -// // Make sure the target password is empty ( can't use the function here ) -// aConverted.FillZ( aConverted.MaxLength() ); -// aConverted.Zero(); -// TInt size( aWord.Size() ); -// if ( size ) -// { -// if ( size > aConverted.MaxLength() ) -// { -// size = aConverted.MaxLength(); -// } -// aConverted.Copy( (TUint8*)aWord.Ptr(), size ); -// } -// } - -// ----------------------------------------------------------------------------- -// IsSystemProcess -// -// ----------------------------------------------------------------------------- -// -static TBool IsSystemProcess( - MFileManagerProcessObserver::TFileManagerProcess aProcess ) - { - switch ( aProcess ) - { - case MFileManagerProcessObserver::EFormatProcess: - case MFileManagerProcessObserver::EBackupProcess: - case MFileManagerProcessObserver::ERestoreProcess: - case MFileManagerProcessObserver::ESchBackupProcess: - { - return ETrue; - } - default: - { - break; - } - } - return EFalse; - } - -// ----------------------------------------------------------------------------- -// GetDeleteQueryPromptLC -// Chooses correct string for the delete note -// ----------------------------------------------------------------------------- -// -static HBufC* GetDeleteQueryPromptLC( CFileManagerItemProperties& aProp, TInt aCount ) - { - - HBufC* prompt = NULL; - if ( aCount == 0 && aProp.ContainsAnyFilesOrFolders() ) - { - prompt = StringLoader::LoadLC( R_QTN_FLDR_DEL_FULL_FLDRS_QUERY ); - } - else if ( aCount <= 1 ) - { - prompt = StringLoader::LoadLC( R_QTN_QUERY_COMMON_CONF_DELETE, aProp.NameAndExt() ); - } - else // aCount > 1 - { - prompt = StringLoader::LoadLC( R_QTN_FLDR_DEL_ITEMS_QUERY, aCount ); - } - - return prompt; - } - -// ----------------------------------------------------------------------------- -// MinIndex -// -// ----------------------------------------------------------------------------- -// -static TInt MinIndex( CArrayFixFlat& aIndexArray ) - { - TInt count( aIndexArray.Count() ); - if ( !count ) - { - return 0; - } - // Find min index - TInt index( 0 ); - TInt i( 0 ); - TInt ret( aIndexArray.At( i ) ); - ++i; - for( ; i < count; ++i ) - { - index = aIndexArray.At( i ); - if ( index < ret ) - { - ret = index; - } - } - return ret; - } - -// ----------------------------------------------------------------------------- -// SetCurrentYearMonthAndDay -// -// ----------------------------------------------------------------------------- -// -static TTime SetCurrentYearMonthAndDay( const TTime& aTime ) - { - TTime timeNow; - timeNow.HomeTime(); - TDateTime dateTimeNow( timeNow.DateTime() ); - TInt64 ret( timeNow.Int64() ); - // Replace hours, minutes and seconds using given ones. - ret -= static_cast< TInt64 >( dateTimeNow.Hour() ) * KHourToMicroSecMultiplier; - ret -= static_cast< TInt64 >( dateTimeNow.Minute() ) * KMinToMicroSecMultiplier; - ret -= static_cast< TInt64 >( dateTimeNow.Second() ) * KMSecToMicroSecMultiplier; - ret -= dateTimeNow.MicroSecond(); - TDateTime dateTime( aTime.DateTime() ); - ret += static_cast< TInt64 >( dateTime.Hour() ) * KHourToMicroSecMultiplier; - ret += static_cast< TInt64 >( dateTime.Minute() ) * KMinToMicroSecMultiplier; - ret += static_cast< TInt64 >( dateTime.Second() ) * KMSecToMicroSecMultiplier; - return ret; - } - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::CFileManagerViewBase -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerViewBase::CFileManagerViewBase() : - iEngine( static_cast< CFileManagerDocument* >( AppUi()->Document() )->Engine() ) - { - } - - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::~CFileManagerViewBase -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerViewBase::~CFileManagerViewBase() - { - delete iWaitNoteWrapper; - delete iActiveDelete; - delete iPeriodic; - delete iMarkedArray; - delete iContainer; - delete iActiveExec; - delete iRefreshProgressDelayedStart; - delete iEjectQueryDialog; - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::GetSendFilesLC -// -// ----------------------------------------------------------------------------- -// -CArrayFixFlat* CFileManagerViewBase::GetSendFilesLC( TInt& aSize ) - { - // Get index array and remove folders and play lists - CArrayFixFlat< TInt >* ret = MarkedArrayLC(); - TInt i( ret->Count() ); - while ( i > 0 ) - { - --i; - // IconIdL() is slow if the icon is not cached yet. - // However, it is faster than FileTypeL(). - switch ( iEngine.IconIdL( ret->At( i ) ) ) - { - case EFileManagerFolderIcon: // FALLTHROUGH - case EFileManagerFolderSubIcon: // FALLTHROUGH - case EFileManagerFolderEmptyIcon: // FALLTHROUGH - case EFileManagerPlaylistFileIcon: - { - ret->Delete( i ); - break; - } - default: - { - break; - } - } - } - aSize = Int64ToInt( iEngine.GetFileSizesL( *ret ) ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::ConstructL( TInt aResId ) - { - BaseConstructL( aResId ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::HandleCommandL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::HandleCommandL( TInt aCommand ) - { - if ( !iContainer ) return; - - TBool updateCba( !iContainer->SelectionModeEnabled() ); - - switch( aCommand ) - { - case EFileManagerOpen: - { - CmdOpenL(); - break; - } - case EFileManagerDelete: - { - CmdDeleteL(); - break; - } - case EFileManagerMoveToFolder: - { - CmdMoveToFolderL(); - break; - } - case EFileManagerCopyToFolder: - { - CmdCopyToFolderL(); - break; - } - case EFileManagerNewFolder: - { - CmdNewFolderL(); - break; - } - case EFileManagerMarkOne: // FALLTHROUGH - case EFileManagerUnmarkOne: // FALLTHROUGH - case EFileManagerToggleMark: - { - CmdToggleMarkL(); - break; - } - case EFileManagerMarkAll: - { - CmdMarkAllL(); - break; - } - case EFileManagerUnmarkAll: - { - CmdUnmarkAllL(); - break; - } - case EFileManagerRename: - { - CmdRenameL(); - break; - } - case EFileManagerFindFile: - { - CmdFindL(); - break; - } - case EFileManagerFileDetails: // FALLTHROUGH - case EFileManagerFolderDetails: // FALLTHROUGH - case EFileManagerViewInfo: - { - CmdViewInfoL(); - break; - } -// case EFileManagerMemoryState: -// { -// CmdMemoryStateL(); -// break; -// } - case EFileManagerReceiveViaIR: - { - CmdReceiveViaIRL(); - break; - } - case EFileManagerCheckMark: // Suppress - { - break; - } - case EAknSoftkeyContextOptions: // FALLTHROUGH - case EFileManagerSelectionKey: - { - TInt count( iContainer->ListBoxSelectionIndexesCount() ); - if ( !count ) - { - HandleCommandL( EFileManagerOpen ); - } - else if ( count > 0 ) - { - ShowContextSensitiveMenuL(); - } - break; - } - case EFileManagerSend: - { - if ( !iSendUiPopupOpened ) - { - SendUiQueryL(); - } - break; - } - case EFileManagerMoreInfoOnline: - { - OpenInfoUrlL( iContainer->ListBoxCurrentItemIndex() ); - break; - } - case EFileManagerUnlockMemoryCard: - { - CmdUnlockDriveL(); - break; - } -// case EFileManagerMemoryCardName: -// case EFileManagerMemoryCardRename: // Fall through -// { -// CmdRenameDriveL(); -// break; -// } - //case EFileManagerMemoryCardFormat: - case EFileManagerMemoryStorageFormat: - case EFileManagerFormatMassStorage: // Fall through - { - CmdFormatDriveL(); - break; - } -// case EFileManagerMemoryCardPasswordSet: -// { -// CmdSetDrivePasswordL(); -// break; -// } -// case EFileManagerMemoryCardPasswordChange: -// { -// CmdChangeDrivePasswordL(); -// break; -// } -// case EFileManagerMemoryCardPasswordRemove: -// { -// CmdRemoveDrivePasswordL(); -// break; -// } -// case EFileManagerMemoryCardDetails: -// { -// CmdMemoryCardDetailsL(); -// break; -// } - case EFileManagerConnectRemoveDrive: - { - SetRemoteDriveConnectionStateL( ETrue ); - break; - } - case EFileManagerDisconnectRemoveDrive: - { - SetRemoteDriveConnectionStateL( EFalse ); - break; - } - case EFileManagerRefreshRemoteDrive: - { - CmdRefreshDirectoryL(); - break; - } - case EFileManagerSortByName: - case EFileManagerSortByType: // Fall through - case EFileManagerSortMostRecentFirst: // Fall through - case EFileManagerSortLargestFirst: // Fall through - case EFileManagerSortByMatch: // Fall through - { - CmdSortL( aCommand ); - break; - } - default: - { - AppUi()->HandleCommandL( aCommand ); - break; - } - } - - if ( updateCba ) - { - UpdateCbaL(); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::SendUiQueryL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::SendUiQueryL() - { - //iSendUiPopupOpened = ETrue; - - CSendUi& sendUi( static_cast< CFileManagerAppUi* >( AppUi() )->SendUiL() ); - CMessageData* msgData = CMessageData::NewL(); - CleanupStack::PushL( msgData ); - TInt msgSize( KMessageSize ); - CArrayFixFlat< TInt >* files = GetSendFilesLC( msgSize ); - TInt count( files->Count() ); - if ( count ) - { - // Set dimmed services specified for FileManager by Send UI spec - const TInt KDimmedServices = 4; - CArrayFixFlat< TUid >* servicesToDim = - new ( ELeave ) CArrayFixFlat< TUid >( KDimmedServices ); - CleanupStack::PushL( servicesToDim ); - - servicesToDim->AppendL( KSenduiMtmAudioMessageUid ); - servicesToDim->AppendL( KMmsDirectUpload ); - servicesToDim->AppendL( KMmsIndirectUpload ); - servicesToDim->AppendL( KSenduiMtmPostcardUid ); - - TSendingCapabilities caps( - 0, msgSize, TSendingCapabilities::ESupportsAttachments ); - for( TInt i( 0 ); i < count ; i++ ) - { - HBufC* fullPath = iEngine.IndexToFullPathLC( files->At( i ) ); - msgData->AppendAttachmentL( *fullPath ); - CleanupStack::PopAndDestroy( fullPath ); - } - // Let SendUi handle protected files, queries and filtering - TRAPD( err, sendUi.ShowQueryAndSendL( msgData, caps, servicesToDim ) ); - if ( err == KErrTooBig ) - { - FileManagerDlgUtils::ShowErrorNoteL( R_QTN_FMGR_FILE_SIZE_TOO_LARGE ); - } - else - { - User::LeaveIfError( err ); - } - CleanupStack::PopAndDestroy( servicesToDim ); - } - CleanupStack::PopAndDestroy( files ); - CleanupStack::PopAndDestroy( msgData ); - - iSendUiPopupOpened = EFalse; - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::MarkMenuFilteringL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::MarkMenuFilteringL( CEikMenuPane& aMenuPane ) - { - TInt index( iContainer->ListBoxCurrentItemIndex() ); - - if ( iEngine.IsFolder( index ) ) - { - aMenuPane.SetItemDimmed( EFileManagerMarkOne, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerUnmarkOne, ETrue ); - } - else - { - if ( iContainer->ListBoxIsItemSelected( index ) ) - { - aMenuPane.SetItemDimmed( EFileManagerMarkOne, ETrue ); - } - else - { - aMenuPane.SetItemDimmed( EFileManagerUnmarkOne, ETrue ); - } - } - TInt files( 0 ); - if( iContainer->IsSearchFieldVisible() ) - { - files = FilesCountInSearchField(); - } - else - { - files = iEngine.FilesInFolderL(); - } - TInt count( iContainer->ListBoxSelectionIndexesCount() ); - if ( count == files ) - { - aMenuPane.SetItemDimmed( EFileManagerMarkAll, ETrue ); - } - - if ( !count ) - { - aMenuPane.SetItemDimmed( EFileManagerUnmarkAll, ETrue ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::CmdOpenL -// -// ----------------------------------------------------------------------------- -// -CFileManagerViewBase::TFileManagerOpenResult CFileManagerViewBase::CmdOpenL() - { - if ( !iContainer || iActiveProcess != ENoProcess ) - { - return EOpenError; // Ignore to avoid mess up - } - TInt index( iContainer->ListBoxCurrentItemIndex() ); - TInt err( KErrNone ); - - if ( index < 0 ) - { - return EOpenError; - } - CFileManagerAppUi* appUi = - static_cast< CFileManagerAppUi* >( AppUi() ); - TBool isFolder( iEngine.IsFolder( index ) ); - StoreIndex(); - TRAP( err, iEngine.OpenL( index ) ); - if ( err == KErrNone ) - { - if ( isFolder ) - { - if ( !appUi->ActivateFoldersViewL() ) - { - // Folders view is already open - // Refresh if this view is folders view - if ( Id() == CFileManagerAppUi::KFileManagerFoldersViewId ) - { - iEngine.SetObserver( this ); - iEngine.RefreshDirectory(); - } - } - return EFolderOpened; - } - return EFileOpened; - } - if ( !HandleFileNotFoundL( err ) ) - { - if ( !isFolder ) - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_FMGR_ERROR_CANT_OPEN ); - } - } - return EOpenError; - } - -// ---------------------------------------------------------------------------- -// CFileManagerViewBase::CmdDeleteL -// -// ---------------------------------------------------------------------------- -// -void CFileManagerViewBase::CmdDeleteL() - { - - if ( !iContainer->ListBoxNumberOfItems() ) - { - // List box is empty, nothing to delete - return; - } - - const TInt selectionCount(iContainer->ListBoxSelectionIndexesCount() ); - TInt index( iContainer->ListBoxCurrentItemIndex() ); - - if ( selectionCount == 1 ) - { - // One item marked - const CArrayFix< TInt >* items = iContainer->ListBoxSelectionIndexes(); - index = items->At( 0 ); - } - - CFileManagerItemProperties* prop = iEngine.GetItemInfoL( index ); - CleanupStack::PushL( prop ); - - if ( DeleteStatusNotOkL( *prop, selectionCount ) ) - { - // It is not possible to continue delete operation - CleanupStack::PopAndDestroy( prop ); - return; - } - - HBufC* prompt = GetDeleteQueryPromptLC( *prop, selectionCount ); - - TBool ret( EFalse ); - DenyDirectoryRefresh( ETrue ); - TRAPD( err, ret = FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( *prompt ) ); - DenyDirectoryRefresh( EFalse ); - User::LeaveIfError( err ); - if ( ret ) - { - if( IsDriveAvailable( DriveInfo().iDrive ) ) - { - DeleteItemsL( index ); - } - else - { - FileManagerDlgUtils::ShowInfoNoteL( R_QTN_MEMC_NOT_AVAILABLE ); - CheckPostponedDirectoryRefresh(); - } - } - else - { - CheckPostponedDirectoryRefresh(); - } - CleanupStack::PopAndDestroy( prompt ); - CleanupStack::PopAndDestroy( prop ); - - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::CmdMoveToFolderL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::CmdMoveToFolderL() - { - - if ( DriveReadOnlyMmcL( iEngine.CurrentDirectory() ) ) - { - return; - } - - // double KMaxFileName is needed if both source and target are KMaxFileName - HBufC* fileName = HBufC::NewLC( KFmgrDoubleMaxFileName ); - TPtr ptrFileName = fileName->Des(); - CFileManagerFileSelectionFilter* filter = - new( ELeave ) CFileManagerFileSelectionFilter( iEngine ); - CleanupStack::PushL( filter ); - - TInt memType( - AknCommonDialogsDynMem::EMemoryTypePhone | - AknCommonDialogsDynMem::EMemoryTypeMMC ); - - if ( FeatureManager().IsRemoteStorageFwSupported() ) - { - memType |= AknCommonDialogsDynMem::EMemoryTypeRemote; - } - - DenyDirectoryRefresh( ETrue ); - TBool ret( AknCommonDialogsDynMem::RunMoveDlgLD( - memType, - ptrFileName, - R_FILEMANAGER_MOVE_MEMORY_SELECTIONDIALOG, - filter ) ); - DenyDirectoryRefresh( EFalse ); - CleanupStack::PopAndDestroy( filter ); - - if ( ret && ptrFileName.Length() ) - { - if ( !DriveReadOnlyMmcL( ptrFileName ) ) - { - RunOperationL( - MFileManagerProcessObserver::EMoveProcess, ptrFileName ); - } - } - if (!ret ) - { - CheckPostponedDirectoryRefresh(); - } - - CleanupStack::PopAndDestroy( fileName ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::CmdCopyToFolderL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::CmdCopyToFolderL() - { - // double KMaxFileName is needed if both source and target are KMaxFileName - HBufC* fileName = HBufC::NewLC( KFmgrDoubleMaxFileName ); - TPtr ptrFileName = fileName->Des(); - CFileManagerFileSelectionFilter* filter = - new( ELeave ) CFileManagerFileSelectionFilter( iEngine ); - CleanupStack::PushL( filter ); - - TInt memType( - AknCommonDialogsDynMem::EMemoryTypePhone | - AknCommonDialogsDynMem::EMemoryTypeMMC ); - - if ( FeatureManager().IsRemoteStorageFwSupported() ) - { - memType |= AknCommonDialogsDynMem::EMemoryTypeRemote; - } - - DenyDirectoryRefresh( ETrue ); - TBool ret( AknCommonDialogsDynMem::RunCopyDlgLD( - memType, - ptrFileName, - R_FILEMANAGER_COPY_MEMORY_SELECTIONDIALOG, - filter ) ); - DenyDirectoryRefresh( EFalse ); - CleanupStack::PopAndDestroy( filter ); - - if ( ret && ptrFileName.Length() ) - { - if ( !DriveReadOnlyMmcL( ptrFileName ) ) - { - RunOperationL( - MFileManagerProcessObserver::ECopyProcess, ptrFileName ); - } - } - if (!ret ) - { - CheckPostponedDirectoryRefresh(); - } - CleanupStack::PopAndDestroy( fileName ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::CmdNewFolderL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::CmdNewFolderL() - { - - if ( DriveReadOnlyMmcL( iEngine.CurrentDirectory() ) ) - { - return; - } - - StoreIndex(); - - if ( !iEngine.EnoughSpaceL( - iEngine.CurrentDirectory(), - 0, - MFileManagerProcessObserver::ENoProcess ) ) - { - User::Leave( KErrDiskFull ); - } - HBufC* folderNameBuf = HBufC::NewLC( KMaxFileName ); - TPtr folderName( folderNameBuf->Des() ); - - if ( FileManagerDlgUtils::ShowFolderNameQueryL( - R_QTN_FLDR_NAME_PRMPT, folderName, iEngine, ETrue ) ) - { - TBuf fullFolderName( iEngine.CurrentDirectory() ); - fullFolderName.Append( folderName ); - CFileManagerUtils::EnsureFinalBackslash( fullFolderName ); - - if ( iEngine.IsSystemFolder( fullFolderName ) ) - { - FileManagerDlgUtils::ShowInfoNoteL( R_QTN_FLDR_NAME_ALREADY_USED, folderName ); - } - else - { - iEngine.NewFolderL( folderName ); - } - iEngine.SetObserver( this ); - iEngine.RefreshDirectory(); - } - else - { - if ( iContainer && iContainer->IsSearchFieldVisible() ) - { - iContainer->DrawDeferred(); - } - } - CleanupStack::PopAndDestroy( folderNameBuf ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::CmdToggleMarkL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::CmdToggleMarkL() - { - const TInt index( iContainer->ListBoxCurrentItemIndex() ); - if ( iEngine.IsFolder( index ) ) - { - iContainer->ListBoxDeselectItem( index ); - } - else - { - iContainer->ListBoxToggleItemL( index ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::CmdMarkAllL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::CmdMarkAllL() - { - iContainer->ListBoxSelectAllL(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::CmdUnmarkAllL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::CmdUnmarkAllL() - { - iContainer->ListBoxClearSelection(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::CmdRenameL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::CmdRenameL() - { - TInt index( iContainer->ListBoxCurrentItemIndex() ); - if ( index >= 0 ) - { - StoreIndex(); - CFileManagerItemProperties* prop = - iEngine.GetItemInfoL( index ); - CleanupStack::PushL( prop ); - - if ( DriveReadOnlyMmcL( prop->FullPath() ) ) - { - CleanupStack::PopAndDestroy( prop ); - return; - } - - HBufC* itemNameBuf = HBufC::NewLC( KMaxFileName ); - TPtr itemName( itemNameBuf->Des() ); - itemName.Append( prop->NameAndExt() ); - - TInt err( KErrNone ); - TBool ret( EFalse ); - if ( prop->TypeL() & CFileManagerItemProperties::EFolder ) - { - DenyDirectoryRefresh( ETrue ); - TRAP( err, ret = FileManagerDlgUtils::ShowFolderNameQueryL( - R_QTN_FLDR_ITEM_NAME_PRMPT, itemName, iEngine ) ); - DenyDirectoryRefresh( EFalse ); - User::LeaveIfError( err ); - if ( ret ) - { - if ( itemName.Length() > 1 ) - { - if ( itemName[0] == '.' ) - { - TInt j = 1; - for ( j; j < itemName.Length(); j++ ) - { - if ( !( (itemName[j] <= 'Z') && (itemName[j] >= 'A') ) ) - { - break; - } - } - if ( j == itemName.Length() ) - { - itemName.Delete(0, 1); - } - } - } - TRAP( err, iEngine.RenameL( index, itemName ) ); - if ( err == KErrAccessDenied || - err == KErrInUse || - err == KErrBadName || - err == KErrAlreadyExists || - err == KErrNotReady ) - { - err = KErrNone; // Set error as handled - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_FLDR_CANT_RENAME_ITEM, - prop->NameAndExt() ); - } - } - } - else - { - DenyDirectoryRefresh( ETrue ); - TRAP( err, ret = FileManagerDlgUtils::ShowFileNameQueryL( - R_QTN_FLDR_ITEM_NAME_PRMPT, prop->FullPath(), itemName, iEngine ) ); - DenyDirectoryRefresh( EFalse ); - User::LeaveIfError( err ); - if ( ret ) - { - TRAP( err, iEngine.RenameL( index, itemName ) ); - if ( err == KErrAccessDenied || - err == KErrInUse || - err == KErrBadName || - err == KErrAlreadyExists || - err == KErrNotReady ) - { - err = KErrNone; // Set error as handled - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_FLDR_CANT_RENAME_ITEM, - prop->NameAndExt() ); - } - } - } - - CleanupStack::PopAndDestroy( itemNameBuf ); - CleanupStack::PopAndDestroy( prop ); - User::LeaveIfError( err ); - } - iEngine.SetObserver( this ); - iEngine.RefreshDirectory(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::CmdFindL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::CmdFindL() - { - HBufC* path = HBufC::NewLC( KMaxFileName ); - TPtr ptrPath( path->Des() ); - if( AskPathL( ptrPath, R_QTN_FMGR_FIND_PRTX ) ) - { - HBufC* searchStringBuf = HBufC::NewLC( KMaxFileName ); - TPtr searchString( searchStringBuf->Des() ); - HBufC* prompt = StringLoader::LoadLC( R_QTN_FMGR_FIND_DATAQ_PRTX ); - CAknTextQueryDialog *textQuery = - new( ELeave ) CAknTextQueryDialog( searchString, *prompt ); - if ( textQuery->ExecuteLD( R_FILEMANAGER_SEARCH_QUERY ) ) - { - iEngine.SetSearchStringL( searchString ); - iEngine.SetSearchFolderL( ptrPath ); - if ( Id() == CFileManagerAppUi::KFileManagerSearchResultsViewId ) - { - // Start new search in the existing view - iIndex = 0; - iEngine.SetObserver( this ); - iEngine.RefreshDirectory(); - } - else - { - // Open search view and start new search - StoreIndex(); - // Ensure that current directory is set correctly. - // If current view was opened from previous search results view, - // backstep stack to current directory may be incomplete. - iEngine.SetDirectoryWithBackstepsL( iEngine.CurrentDirectory() ); - CFileManagerAppUi* appUi = - static_cast< CFileManagerAppUi* >( AppUi() ); - appUi->ActivateSearchResultsViewL(); - } - } - CleanupStack::PopAndDestroy( prompt ); - CleanupStack::PopAndDestroy( searchStringBuf ); - } - CleanupStack::PopAndDestroy( path ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::CmdViewInfoL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::CmdViewInfoL() - { - TInt index( iContainer->ListBoxCurrentItemIndex() ); - if ( index >= 0 ) - { - CFileManagerItemProperties* prop = iEngine.GetItemInfoL( index ); - CleanupStack::PushL( prop ); - FileManagerDlgUtils::ShowItemInfoPopupL( *prop, FeatureManager() ); - CleanupStack::PopAndDestroy( prop ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::CmdMemoryStateL -// -// ----------------------------------------------------------------------------- -// -//void CFileManagerViewBase::CmdMemoryStateL() -// { -// TInt drv( iEngine.CurrentDrive() ); -// if ( drv != KErrNotFound ) -// { -// HBufC* title = StringLoader::LoadLC( R_QTN_FMGR_MSTATE_HEADING ); -// CMemStatePopup::RunLD( -// static_cast< TDriveNumber >( drv ), *title ); -// CleanupStack::PopAndDestroy( title ); -// } -// } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::CmdReceiveViaIR -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::CmdReceiveViaIRL() - { - - if ( DriveReadOnlyMmcL( iEngine.CurrentDirectory() ) ) - { - return; - } - - iEngine.SetObserver( this ); - - ClearProgressBarL(); - - iProgressDialog = new( ELeave ) CAknProgressDialog( - reinterpret_cast< CEikDialog** >( &iProgressDialog ), ETrue ); - iProgressDialog->PrepareLC( R_FILE_RECEIVE_DIALOG ); - iProgressInfo = iProgressDialog->GetProgressInfoL(); - if ( iProgressInfo ) - { - // final value is 100 percent - iProgressInfo->SetFinalValue( KMaxPercentage ); - } - iProgressDialog->RunLD(); - iProgressDialog->SetCallback( this ); - - HBufC* label = StringLoader::LoadLC( R_QTN_IR_CONNECTING ); - iProgressDialog->SetTextL( *label ); - CleanupStack::PopAndDestroy( label ); - - CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( AppUi() ); - TRAPD( err, appUi->StartIRReceiveL( *this ) ); - - if ( err == KErrNone ) - { - iActiveProcess = MFileManagerProcessObserver::EIRReceiveProcess; - } - else - { - ClearProgressBarL(); - User::Leave( err ); - } - } - - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::DynInitMenuPaneL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane* aMenuPane) - { - TBool isHandled( ETrue ); - - switch( aResourceId ) - { - // These menus are used by memory store and folders views - case R_FILEMANAGER_MEMORY_STORE_VIEW_MENU: - { - MemoryStoreMenuFilteringL( *aMenuPane ); - break; - } - case R_FILEMANAGER_MARK_UNMARK_MENU: - case R_FILEMANAGER_CONTEXT_SENSITIVE_MARK_UNMARK_MENU: - { - MarkMenuFilteringL( *aMenuPane ); - break; - } - case R_FILEMANAGER_ORGANISE_MENU: - { - OrganiseMenuFilteringL( *aMenuPane ); - break; - } - case R_FILEMANAGER_DETAILS_MENU: - { - DetailsMenuFilteringL( *aMenuPane ); - break; - } -// case R_FILEMANAGER_MEMORY_CARD_MENU: -// { -// MemoryCardMenuFilteringL( *aMenuPane ); -// break; -// } -// case R_FILEMANAGER_MEMORY_CARD_PASSWORD_MENU: -// { -// MemoryCardPasswordMenuFilteringL( *aMenuPane ); -// break; -// } - case R_FILEMANAGER_CONTEXT_SENSITIVE_MENU: - { - ContextSensitiveMenuFilteringL( *aMenuPane ); - break; - } - case R_FILEMANAGER_SORT_MENU: - case R_FILEMANAGER_SEARCH_SORT_MENU: // Fall through - { - SortMenuFilteringL( *aMenuPane ); - break; - } - default: - { - isHandled = EFalse; - break; - } - } - - TBool isContextMenu( aResourceId == R_FILEMANAGER_CONTEXT_SENSITIVE_MENU ); - if ( isHandled || isContextMenu ) - { - CEikMenuBar* menuBar = MenuBar(); - if ( menuBar ) - { - if ( isContextMenu ) - { - menuBar->SetMenuType( CEikMenuBar::EMenuContext ); - } - else - { - menuBar->SetMenuType( CEikMenuBar::EMenuOptions ); - } - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::DoActivateL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::DoActivateL( const TVwsViewId& /*aPrevViewId*/, - TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/ ) - { - if ( !iContainer ) - { - iContainer = CreateContainerL(); - iContainer->SetMopParent( this ); - AppUi()->AddToStackL( *this, iContainer ); - iEngine.SetObserver( this ); - iContainer->ActivateL(); - } - - if ( iContainer ) - { - iContainer->SetListEmptyL(); - } - - // Set container to observe MSK commands - CEikButtonGroupContainer* bgc = Cba(); - if ( bgc ) - { - CEikCba* cba = static_cast< CEikCba* >( bgc->ButtonGroup() ); - cba->SetMSKCommandObserver( iContainer ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::DoDeactivate -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::DoDeactivate() - { - if ( iContainer ) - { - AppUi()->RemoveFromStack( iContainer ); - delete iContainer; - iContainer = NULL; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::MarkedArrayLC -// -// ----------------------------------------------------------------------------- -// -CArrayFixFlat* CFileManagerViewBase::MarkedArrayLC() - { - TInt count( iContainer->ListBoxSelectionIndexesCount() ); - CArrayFixFlat* ret = - new( ELeave ) CArrayFixFlat( count ? count : 1 ); - - CleanupStack::PushL( ret ); - - if ( !count ) - { - if ( iContainer->ListBoxNumberOfItems() > 0) - { - ret->AppendL( iContainer->ListBoxCurrentItemIndex() ); - } - return ret; - } - - const CArrayFix< TInt >* items = iContainer->ListBoxSelectionIndexes(); - for( TInt i( 0 ); i < count; ++i ) - { - ret->AppendL( items->At( i ) ); - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::DialogDismissedL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::DialogDismissedL( TInt aButtonId ) - { - FUNC_LOG - - if ( aButtonId == EAknSoftkeyCancel ) - { - TBool isHandled( ETrue ); - switch( iActiveProcess ) - { - case ENoProcess: - { - if ( IsRefreshInProgress() ) - { - // Already freed, just set to NULL - iProgressDialogRefresh = NULL; - iEngine.CancelRefresh(); - DirectoryChangedL(); // Ensure that view gets updated - } - break; - } - case EIRReceiveProcess: - { - // Already freed, just set to NULL - iProgressDialog = NULL; - iProgressInfo = NULL; - - static_cast< CFileManagerAppUi* >( AppUi() )->StopIRReceive(); - break; - } - case ECopyProcess: // FALLTHROUGH - case EMoveProcess: - { - // Already freed, just set to NULL - iProgressDialog = NULL; - iProgressInfo = NULL; - - delete iPeriodic; - iPeriodic = NULL; - if ( iActiveExec ) - { - iActiveExec->CancelExecution(); - } - break; - } - case EFileOpenProcess: // FALLTHROUGH - case EBackupProcess: // FALLTHROUGH - case ERestoreProcess: - { - // Already freed, just set to NULL - iProgressDialog = NULL; - iProgressInfo = NULL; - - iEngine.CancelProcess( iActiveProcess ); - if ( iActiveProcess == EBackupProcess || - iActiveProcess == ERestoreProcess ) - { - CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( AppUi() ); - appUi->BackupOrRestoreEnded(); - } - break; - } - case EFormatProcess: // FALLTHROUGH - case EEjectProcess: - { - // Already freed, just set to NULL - iProgressDialog = NULL; - iProgressInfo = NULL; - break; - } - default: - { - isHandled = EFalse; - break; - } - } - if ( isHandled ) - { - iEikonEnv->SetSystem( EFalse ); - iActiveProcess = ENoProcess; - } - -#ifdef RD_FILE_MANAGER_BACKUP - if ( iSchBackupPending ) - { - StartSchBackupL(); - } -#endif // RD_FILE_MANAGER_BACKUP - - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::ProcessFinishedL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::ProcessFinishedL( TInt aError, const TDesC& aName ) - { - FUNC_LOG - - TRAPD( err, DoProcessFinishedL( aError, aName ) ); - if( err != KErrNone ) - { - // Clean up the active process before forwarding leave - ERROR_LOG2( - "CFileManagerViewBase::ProcessFinishedL-iActiveProcess=%d,err=%d", - iActiveProcess, err ) - iEikonEnv->SetSystem( EFalse ); - iActiveProcess = ENoProcess; - User::Leave( err ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::DoProcessFinishedL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::DoProcessFinishedL( TInt aError, const TDesC& aName ) - { - FUNC_LOG - - TBool isHandled( ETrue ); - TBool doRefresh( ETrue ); - - LOG_IF_ERROR2( aError, "CFileManagerViewBase::DoProcessFinishedL-iActiveProcess=%d,aError=%d", - iActiveProcess, aError ) - - if ( iPeriodic && iProgressInfo && iTotalTransferredBytes ) - { - iProgressInfo->SetAndDraw( iTotalTransferredBytes ); - } - if ( IsSystemProcess( iActiveProcess ) ) - { - // Remove system status to allow app close from task switcher - iEikonEnv->SetSystem( EFalse ); - } - - ClearProgressBarL(); - - switch( iActiveProcess ) - { - case EIRReceiveProcess: // FALLTHROUGH - { - static_cast< CFileManagerAppUi* >( AppUi() )->StopIRReceive(); - if ( aError != KErrNone && aError != KErrCancel ) - { - if ( aError == KErrDiskFull ) - { - ShowDiskSpaceErrorL( iEngine.CurrentDirectory() ); - } - else - { - // Show general error note - Error( aError ); - } - } - break; - } - case ECopyProcess: // FALLTHROUGH - case EMoveProcess: - { - if ( aError != KErrNone && aError != KErrCancel && !aName.Length() ) - { - // Show general error note if item name is unavailable - if ( iActiveExec && aError == KErrDiskFull ) - { - ShowDiskSpaceErrorL( iActiveExec->ToFolder() ); - } - else - { - Error( aError ); - } - } - else if ( aError != KErrNone ) - { - // If the copy process is cancelled, no error notes should be displayed - if( aError != KErrCancel ) - { - // Show more informative note first - if ( iActiveExec && aError == KErrDiskFull ) - { - ShowDiskSpaceErrorL( iActiveExec->ToFolder() ); - } - else if ( aError == KErrNoMemory || - aError == KErrDiskFull || - aError == KErrDirFull ) - { - Error( aError ); - } - if ( iActiveProcess == EMoveProcess ) - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_FLDR_ITEM_CANNOT_BE_MOVED, aName ); - } - else - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_FLDR_ITEM_CANNOT_BE_COPIED, aName ); - } - } - delete iActiveExec; - iActiveExec = NULL; - } - else if ( iActiveProcess == EMoveProcess && iMarkedArray ) - { - // Set focus to the item after selection - TInt newIndex( MinIndex( *iMarkedArray ) ); - if ( iContainer ) - { - iContainer->SetIndex( newIndex ); - } - StoreIndex(); - } - - break; - } - case EFileOpenProcess: - { - if ( aError != KErrNone && aError != KErrCancel ) - { - if ( aError == KErrNoMemory || aError == KErrDiskFull ) - { - Error( aError ); - } - else if ( aError == KErrNotSupported ) - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_FMGR_ERROR_UNSUPPORT ); - } - else if ( aError == KErrFmgrNotSupportedRemotely ) - { - FileManagerDlgUtils::ShowConfirmQueryWithOkL( - FileManagerDlgUtils::EInfoIcons, - R_QTN_FMGR_INFONOTE_UNABLE_OPEN_REMOTELY ); - } - else if ( !HandleFileNotFoundL( aError ) ) - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_FMGR_ERROR_CANT_OPEN ); - } - } - else - { - // No refresh needed if open was successful or canceled - doRefresh = EFalse; - } - break; - } - case EFormatProcess: - { - TFileManagerDriveInfo drvInfo; - DriveInfoAtCurrentPosL( drvInfo ); - if ( aError == KErrNone ) - { -#ifdef RD_MULTIPLE_DRIVE - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveMassStorage ) - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_FMGR_MASS_FORMAT_COMPLETED ); - } - else - { -#endif // RD_MULTIPLE_DRIVE - FileManagerDlgUtils::ShowInfoNoteL( R_QTN_FORMAT_COMPLETED ); - - // After formatting a name to the card can be given - RenameDriveL( ETrue ); -#ifdef RD_MULTIPLE_DRIVE - } -#endif // RD_MULTIPLE_DRIVE - } - else if ( aError == KErrInUse || aError > 0 ) - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_FORMAT_FILES_IN_USE ); - } - else if ( aError != KErrCancel ) - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_CRITICAL_ERROR ); - } - break; - } - case EBackupProcess: - { - CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( AppUi() ); - appUi->BackupOrRestoreEnded(); - if ( aError == KErrNone ) - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_BACKUP_COMPLETED ); - } - else if ( aError == KErrDiskFull ) - { -#ifdef RD_FILE_MANAGER_BACKUP - - CFileManagerBackupSettings& settings( - iEngine.BackupSettingsL() ); - - FileManagerDlgUtils::ShowConfirmQueryWithOkL( - FileManagerDlgUtils::EErrorIcons, - R_QTN_FMGR_BACKUP_DESTINATION_FULL, - iEngine.DriveName( settings.TargetDrive() ) ); - -#else // RD_FILE_MANAGER_BACKUP - - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_BACKUP_NO_SPACE ); - -#endif // RD_FILE_MANAGER_BACKUP - } - else if ( aError > 0 ) - { - // No critical error, but some files not handled - if ( aError > 1 ) - { - FileManagerDlgUtils::ShowConfirmQueryWithOkL( - FileManagerDlgUtils::EInfoIcons, - R_QTN_FILES_NOT_BACKUPPED, - aError ); - } - else - { - FileManagerDlgUtils::ShowConfirmQueryWithOkL( - FileManagerDlgUtils::EInfoIcons, - R_QTN_ONE_FILE_NOT_BACKUPPED ); - } - } - else if ( aError != KErrCancel ) - { - if ( aError == KErrNoMemory || aError == KErrDirFull ) - { - // Show more informative note first - Error( aError ); - } - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_CRITICAL_ERROR ); - } - break; - } - case ERestoreProcess: - { - CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( AppUi() ); - appUi->BackupOrRestoreEnded(); - if ( aError == KErrNone ) - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_RESTORE_COMPLETED ); - } - else if ( aError == KErrDiskFull ) - { - FileManagerDlgUtils::ShowErrorNoteL( -#ifdef RD_FILE_MANAGER_BACKUP - R_QTN_FMGR_RESTORE_SPACE_ERROR -#else // RD_FILE_MANAGER_BACKUP - R_QTN_RESTORE_NO_SPACE -#endif // RD_FILE_MANAGER_BACKUP - ); - } -#ifdef RD_FILE_MANAGER_BACKUP - else if ( aError == KErrCorrupt ) - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_FMGR_ERROR_CORRUPTED_BACKUP_FILE ); - } -#endif // RD_FILE_MANAGER_BACKUP - else if ( aError > 0 ) - { - // No critical error, but some files not handled - if ( aError > 1 ) - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_FILES_NOT_RESTORED, aError ); - } - else - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_ONE_FILE_NOT_RESTORED ); - } - } - else - { - if ( aError == KErrNoMemory || aError == KErrDirFull ) - { - // Show more informative note first - Error( aError ); - } - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_CRITICAL_ERROR ); - } - break; - } - case EEjectProcess: - { - TRAP_IGNORE( ShowEjectQueryL() ); - break; - } -#ifdef RD_FILE_MANAGER_BACKUP - case ESchBackupProcess: - { - CFileManagerAppUi* appUi = - static_cast< CFileManagerAppUi* >( AppUi() ); - appUi->SchBackupHandlerL().ProcessFinishedL( aError, aName ); - // No refresh needed, done by view activation - doRefresh = EFalse; - break; - } -#endif // RD_FILE_MANAGER_BACKUP - default: - { - isHandled = EFalse; - break; - } - } - - if ( isHandled ) - { - iEikonEnv->SetSystem( EFalse ); - iActiveProcess = ENoProcess; - - if ( doRefresh ) - { - iEngine.SetObserver( this ); - iEngine.RefreshDirectory(); - } - } - -#ifdef RD_FILE_MANAGER_BACKUP - if ( iSchBackupPending ) - { - StartSchBackupL(); - } -#endif // RD_FILE_MANAGER_BACKUP - - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::ProcessAdvanceL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::ProcessAdvanceL( TInt aValue ) - { - FUNC_LOG - - switch( iActiveProcess ) - { - case EIRReceiveProcess: - { - if ( iProgressDialog ) - { - HBufC* label = StringLoader::LoadLC( - R_QTN_FMGR_NOTE_RECEIVE_IR, aValue ); - iProgressDialog->SetTextL( *label ); - CleanupStack::PopAndDestroy( label ); - // Incrementing progress of the process: - if ( iProgressInfo ) - { - iProgressInfo->SetAndDraw( aValue ); - } - } - break; - } - case EBackupProcess: // FALLTHROUGH - case ERestoreProcess: // FALLTHROUGH - case EFormatProcess: - { -#ifdef RD_FILE_MANAGER_BACKUP - if ( iActiveProcess == EBackupProcess && iProgressDialog ) - { - HBufC* label = StringLoader::LoadLC( - R_QTN_BACKUP_INPROGRESS ); - iProgressDialog->SetTextL( *label ); - CleanupStack::PopAndDestroy( label ); - - iProgressDialog->ButtonGroupContainer().SetCommandSetL(R_AVKON_SOFTKEYS_CANCEL); - iProgressDialog->ButtonGroupContainer().DrawDeferred(); - } - else if ( iActiveProcess == ERestoreProcess && iProgressDialog ) - { - HBufC* label = StringLoader::LoadLC( - R_QTN_RESTORE_INPROGRESS ); - iProgressDialog->SetTextL( *label ); - CleanupStack::PopAndDestroy( label ); - } -#endif // RD_FILE_MANAGER_BACKUP - if ( iProgressInfo ) - { - iProgressInfo->SetAndDraw( aValue ); - } - break; - } -#ifdef RD_FILE_MANAGER_BACKUP - case ESchBackupProcess: - { - CFileManagerAppUi* appUi = - static_cast< CFileManagerAppUi* >( AppUi() ); - appUi->SchBackupHandlerL().ProcessAdvanceL( aValue ); - break; - } -#endif // RD_FILE_MANAGER_BACKUP - default: - { - break; - } - } - iTotalTransferredBytes = static_cast(aValue); // to avoid over 2GB files looks likes minus value - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::ProcessStartedL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::ProcessStartedL( - MFileManagerProcessObserver::TFileManagerProcess aProcess, - TInt aFinalValue ) - { - FUNC_LOG - - // For preventing shutter to close app during system process - iEikonEnv->SetSystem( IsSystemProcess( aProcess ) ); - - switch( aProcess ) - { - case EIRReceiveProcess: - { - if ( iProgressDialog ) - { - HBufC* label = StringLoader::LoadLC( - R_QTN_FMGR_NOTE_RECEIVE_IR, 0 ); - iProgressDialog->SetTextL( *label ); - CleanupStack::PopAndDestroy( label ); - } - break; - } - case EFileOpenProcess: - { - ClearProgressBarL(); - LaunchProgressDialogL( 0, 0, aProcess ); - iActiveProcess = aProcess; - break; - } - case ERestoreProcess: - { - CEikButtonGroupContainer* cba = Cba(); - cba->SetCommandSetL( R_AVKON_SOFTKEYS_EMPTY ); - cba->DrawDeferred(); - // FALLTHROUGH - } - case EBackupProcess: // FALLTHROUGH - case EFormatProcess: - { - if ( iProgressDialog ) - { - if ( !iProgressDialog->IsVisible() ) - { - iProgressDialog->MakeVisible( ETrue ); - } - } - if ( iProgressInfo ) - { - iProgressInfo->SetFinalValue( aFinalValue ); - } - break; - } -#ifdef RD_FILE_MANAGER_BACKUP - case ESchBackupProcess: - { - CFileManagerAppUi* appUi = - static_cast< CFileManagerAppUi* >( AppUi() ); - appUi->SchBackupHandlerL().ProcessStartedL( aFinalValue ); - break; - } -#endif // RD_FILE_MANAGER_BACKUP - default: - { - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::RunOperationL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::RunOperationL - ( MFileManagerProcessObserver::TFileManagerProcess aOperation, - const TDesC& aToFolder ) - { - - StoreIndex(); - delete iMarkedArray; - iMarkedArray = NULL; - iMarkedArray = MarkedArrayLC(); - CleanupStack::Pop( iMarkedArray ); - - // Check if marked source and destination folder are available - if ( !iMarkedArray->Count() || !IsDriveAvailable( aToFolder ) ) - { - return; - } - - CFileManagerItemProperties* prop = - iEngine.GetItemInfoLC( iMarkedArray->At( 0 ) ); - -#ifdef __KEEP_DRM_CONTENT_ON_PHONE - // When this flag is on all the selected items have to be gone through and checked - // whether they are protected and the user has to be notified when moving or - // copying file(s) is impossible. This only applies to processes from phone to MMC. - TBool process( ETrue ); - if ( CFileManagerUtils::IsFromInternalToRemovableDrive( - iEikonEnv->FsSession(), iEngine.CurrentDirectory(), aToFolder ) ) - { - TInt fileAmount (iMarkedArray->Count()); - - // Only one folder can be selected at a time - if (iEngine.IsFolder(iMarkedArray->At( 0 ))) - { - if ( prop->FilesContainedL() == 0 && prop->FoldersContainedL() == 0) - { - process = ETrue; - } - else if (AreChosenFilesProtectedL( ETrue )) - { - if ( aOperation == EMoveProcess ) - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_DRM_INFO_MOVE_FOLDER_FORBID ); - } - else - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_DRM_INFO_COPY_FOLDER_FORBID ); - } - process = EFalse; - } - else if (AreChosenFilesProtectedL( EFalse )) - { - TInt textId( 0 ); - if ( aOperation == EMoveProcess ) - { - textId = R_QTN_DRM_QUERY_MOVE_FORBIDDEN; - } - else - { - textId = R_QTN_DRM_QUERY_COPY_FORBIDDEN; - } - if ( FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( - textId ) ) - { - // Engine will not touch protected objects anyway - process = ETrue; - } - else - { - process = EFalse; - } - } - } - else if ( fileAmount == 1 && AreChosenFilesProtectedL( ETrue )) - { - if ( aOperation == EMoveProcess ) - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_DRM_INFO_MOVE_ONE_FORBID ); - } - else - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_DRM_INFO_COPY_ONE_FORBID ); - } - process= EFalse; - } - else if ( fileAmount > 1 && AreChosenFilesProtectedL( EFalse )) - { - if (AreChosenFilesProtectedL( ETrue )) - { - if ( aOperation == EMoveProcess ) - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_DRM_INFO_MOVE_MANY_FORBID ); - } - else - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_DRM_INFO_COPY_MANY_FORBID ); - } - process= EFalse; - } - else - { - TInt textId( 0 ); - if ( aOperation == EMoveProcess ) - { - textId = R_QTN_DRM_QUERY_MOVE_FORBIDDEN; - } - else - { - textId = R_QTN_DRM_QUERY_COPY_FORBIDDEN; - } - if ( FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( - textId ) ) - { - // Engine will not touch protected objects anyway - process = ETrue; - } - else - { - process = EFalse; - } - } - } - } - if ( process ) - { -#endif // __KEEP_DRM_CONTENT_ON_PHONE - - TInt64 size( 0 ); - // Skip remote folder size counting because it may last very long time. - // The content may also change during the operation what makes - // the counting needless. - if ( !( prop->IsRemoteDrive() && - ( prop->TypeL() & CFileManagerItemProperties::EFolder ) ) ) - { - size = iEngine.GetFileSizesL( *iMarkedArray ) ; - } - if ( size == KErrNotFound ) - { - // User has cancelled size calculation, do nothing - } - else if ( iEngine.EnoughSpaceL( aToFolder, size, aOperation )) - { - iTotalTransferredBytes = 0; - iEngine.SetObserver( this ); - if ( aOperation == EMoveProcess && - aToFolder.Left( KDriveLetterSize ) == - prop->FullPath().Left( KDriveLetterSize ) ) - { - // If operation is move and it happens inside drive - // set size to file amount - // CFileMan is not calling notify if those conditions apply - if ( iMarkedArray->Count() > 0 ) - { - size = iMarkedArray->Count(); - } - else - { - // Folder move time we cannot predict, so setting size to - // 0 to show wait note, one file moves so fast that it - // won't show wait note anyway - size = 0; - } - } - - if ( prop->IsRemoteDrive() || - CFileManagerUtils::IsRemoteDrive( - iEikonEnv->FsSession(), aToFolder ) ) - { - // Use wait note for remote drives - // because real progress information is unavailable - size = 0; - } - - LaunchProgressDialogL( size, 0, aOperation ); - delete iActiveExec; - iActiveExec = NULL; - iActiveExec = CFileManagerActiveExecute::NewL( - iEngine, aOperation, *this, *iMarkedArray, aToFolder ); - iActiveProcess = aOperation; - TRAPD( err, iActiveExec->ExecuteL( CFileManagerActiveExecute::ENoOverWrite ) ); - if ( err != KErrNone ) - { - // Clean up the active process before forwarding leave - ERROR_LOG2( - "CFileManagerViewBase::RunOperationL-aOperation=%d,err=%d", - aOperation, err ) - iActiveProcess = ENoProcess; - User::Leave( err ); - } - } - else - { - ShowDiskSpaceErrorL( aToFolder ); - } - -#ifdef __KEEP_DRM_CONTENT_ON_PHONE - } -#endif // __KEEP_DRM_CONTENT_ON_PHONE - - CleanupStack::PopAndDestroy( prop ); - - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::ProcessQueryOverWriteL -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerViewBase::ProcessQueryOverWriteL - ( const TDesC& aOldName, TDes& aNewName, TFileManagerProcess aOperation ) - { - - TParsePtrC name( aOldName ); - - // Stop progress note before showing the query to be restarted later. - // Note that progress note may still exist after stop (to fill min time on screen) - // and it gets deleted later by AVKON. Asynchronous restart is needed to prevent - // mess up (if note still exists). Otherwise starting and stopping progress note too - // quickly multiple times leads to mess up in AVKON's note handling. - StopProgressDialogAndStoreValues(); - - TBool overWrite( FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( - R_QTN_FLDR_OVERWRITE_QUERY, name.NameAndExt() ) ); - if ( !overWrite ) - { - if ( !FileManagerDlgUtils::ShowFileNameQueryL( - R_QTN_FLDR_ITEM_NAME_PRMPT, aOldName, aNewName, iEngine ) ) - { - aNewName.Zero(); - } - } - - if ( iActiveProcess == aOperation && - ( aOperation == MFileManagerProcessObserver::ECopyProcess || - aOperation == MFileManagerProcessObserver::EMoveProcess ) ) - { - // Progress note needs asynchronous start because of AVKON's note handling. - delete iRefreshProgressDelayedStart; - iRefreshProgressDelayedStart = NULL; - iRefreshProgressDelayedStart = CPeriodic::NewL( CActive::EPriorityUserInput ); - iRefreshProgressDelayedStart->Start( - KProgressBarAsyncStartDelay, KProgressBarAsyncStartDelay, - TCallBack( LaunchProgressDialogAsync, this ) ); - } - - return overWrite; - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::ProcessQueryRenameL -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerViewBase::ProcessQueryRenameL - ( const TDesC& aOldName, TDes& aNewName, TFileManagerProcess aOperation ) - { - TParsePtrC typeCheck( aOldName ); - TParse oldName; - TBool folderRename( EFalse ); - - // Check is item file or folder - if ( !typeCheck.NameOrExtPresent() ) - { - oldName.Set( aOldName.Left( aOldName.Length() - 1 ), NULL, NULL ); - folderRename = ETrue; - } - else - { - oldName.Set( aOldName , NULL, NULL ); - } - - // Stop progress note before showing the query to be restarted later. - // Note that progress note may still exist after stop (to fill min time on screen) - // and it gets deleted later by AVKON. Asynchronous restart is needed to prevent - // mess up (if note still exists). Otherwise starting and stopping progress note too - // quickly multiple times leads to mess up in AVKON's note handling. - StopProgressDialogAndStoreValues(); - - TBool rename( FileManagerDlgUtils::ShowConfirmQueryWithOkCancelL( - R_QTN_FLDR_RENAME_QUERY, oldName.NameAndExt() ) ); - if ( rename ) - { - TBool done( 0 ); - if ( folderRename ) - { - aNewName.Copy( aOldName ); - done = FileManagerDlgUtils::ShowFolderNameQueryL( - R_QTN_FLDR_ITEM_NAME_PRMPT, aNewName, iEngine ); - } - else - { - done = FileManagerDlgUtils::ShowFileNameQueryL( - R_QTN_FLDR_ITEM_NAME_PRMPT, aOldName, aNewName, iEngine ); - } - - if ( !done ) - { - // User cancelled rename - aNewName.Zero(); - } - else - { - //file server doesn't support the space in the end of the folder/file name - aNewName.TrimRight(); - } - } - - if ( iActiveProcess == aOperation && - ( aOperation == MFileManagerProcessObserver::ECopyProcess || - aOperation == MFileManagerProcessObserver::EMoveProcess ) ) - { - // Progress note needs asynchronous start because of AVKON's note handling. - delete iRefreshProgressDelayedStart; - iRefreshProgressDelayedStart = NULL; - iRefreshProgressDelayedStart = CPeriodic::NewL( CActive::EPriorityUserInput ); - iRefreshProgressDelayedStart->Start( - KProgressBarAsyncStartDelay, KProgressBarAsyncStartDelay, - TCallBack( LaunchProgressDialogAsync, this ) ); - } - - return rename; - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::LaunchProgressDialogL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::LaunchProgressDialogL( - TInt64 aFinalValue, - TInt64 aInitialValue, - MFileManagerProcessObserver::TFileManagerProcess aOperation, - TBool aImmediatelyVisible ) - { - TInt dialogId( 0 ); - TInt textId( 0 ); - TBool isPeriodic( EFalse ); - TInt value; - value=Int64ToInt(aFinalValue); - switch ( aOperation ) - { - case ECopyProcess: - { - isPeriodic = ( value > 1 ); - if ( isPeriodic ) - { - dialogId = R_FILEMANAGER_PROGRESS_NOTE_COPY; - } - else - { - dialogId = R_FILEMANAGER_WAIT_NOTE_COPY; - } - break; - } - case EMoveProcess: - { - isPeriodic = ( value > 1 ); - if ( isPeriodic ) - { - dialogId = R_FILEMANAGER_PROGRESS_NOTE_MOVE; - } - else - { - dialogId = R_FILEMANAGER_WAIT_NOTE_MOVE; - } - break; - } - case EFormatProcess: - { - dialogId = R_FILEMANAGER_PROGRESS_NOTE; - TFileManagerDriveInfo drvInfo; - DriveInfoAtCurrentPosL( drvInfo ); -#ifdef RD_MULTIPLE_DRIVE - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveMassStorage - || drvInfo.iState & TFileManagerDriveInfo::EDriveUsbMemory ) - { - textId = R_QTN_FMGR_MASS_FORMAT_INPROGRESS; - } - else - { -#endif // RD_MULTIPLE_DRIVE - textId = R_QTN_FORMAT_INPROGRESS; -#ifdef RD_MULTIPLE_DRIVE - } -#endif // RD_MULTIPLE_DRIVE - break; - } - case EBackupProcess: - { - dialogId = R_FILEMANAGER_PROGRESS_NOTE_WITH_CANCEL; -#ifdef RD_FILE_MANAGER_BACKUP - textId = R_QTN_FMGR_PROGRESS_PREPARING_BACKUP; -#else // RD_FILE_MANAGER_BACKUP - textId = R_QTN_BACKUP_INPROGRESS; -#endif // RD_FILE_MANAGER_BACKUP - aImmediatelyVisible = ETrue; - break; - } - case ERestoreProcess: - { - dialogId = R_FILEMANAGER_PROGRESS_NOTE; -#ifdef RD_FILE_MANAGER_BACKUP - textId = R_QTN_FMGR_PROGRESS_PREPARING_RESTORE; -#else // RD_FILE_MANAGER_BACKUP - textId = R_QTN_RESTORE_INPROGRESS; -#endif // RD_FILE_MANAGER_BACKUP - break; - } - case EEjectProcess: - { - dialogId = R_FILEMANAGER_WAIT_NOTE; - textId = R_QTN_WAIT_EJECT; - break; - } - case EFileOpenProcess: - { - dialogId = R_FILEMANAGER_WAIT_NOTE_OPEN_WITH_CANCEL; - break; - } - default: - { - dialogId = R_FILEMANAGER_WAIT_NOTE_OPEN; - break; - } - } - LaunchProgressBarL( - dialogId, textId, aFinalValue, aInitialValue, isPeriodic, aImmediatelyVisible ); - -#ifdef RD_FILE_MANAGER_BACKUP - if ( aOperation == EBackupProcess && iProgressDialog ) - { - iProgressDialog->ButtonGroupContainer().SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY); - iProgressDialog->ButtonGroupContainer().DrawDeferred(); - } -#endif // RD_FILE_MANAGER_BACKUP - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::ShowWaitDialogL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::ShowWaitDialogL( MAknBackgroundProcess& aProcess) - { - CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL(); - CleanupDeletePushL( waitNoteWrapper ); - waitNoteWrapper->ExecuteL( R_FILEMANAGER_WAIT_NOTE_PROCESS, aProcess ); - CleanupStack::PopAndDestroy( waitNoteWrapper ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::DoUpdateProgressBar -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::DoUpdateProgressBar() - { - // Update progress indicator - if ( iProgressDialog && iProgressInfo ) - { - iProgressInfo->SetAndDraw( iTotalTransferredBytes / KMinificationFactor ); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::UpdateProgressBar -// -// ------------------------------------------------------------------------------ -// -TInt CFileManagerViewBase::UpdateProgressBar(TAny* aPtr ) - { - static_cast< CFileManagerViewBase* >( aPtr )->DoUpdateProgressBar(); - return KErrNone; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::RefreshStartedL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::RefreshStartedL() - { - FUNC_LOG - - DenyDirectoryRefresh( EFalse ); - - if ( static_cast< CFileManagerAppUi* >( AppUi() )->IsFmgrForeGround() ) - { - if ( iContainer ) - { - iContainer->SetListEmptyL(); - } - - ClearProgressBarL(); - if ( Id() == CFileManagerAppUi::KFileManagerSearchResultsViewId ) - { - // On remote drives local find progress note is sometimes - // totally blocked if the note is not started directly here. - iProgressDialogRefresh = new( ELeave ) CAknProgressDialog( - reinterpret_cast< CEikDialog** >( - &iProgressDialogRefresh ), EFalse ); - iProgressDialogRefresh->SetCallback( this ); - iProgressDialogRefresh->ExecuteLD( R_FILEMANAGER_FIND_WAIT_DIALOG ); - } - else - { - // Start progress dialog using own timer, otherwise progress dialog - // burns sometimes quite a lot CPU time even if it is not - // visible at all. - iRefreshProgressDelayedStart = CPeriodic::NewL( - CActive::EPriorityUserInput ); - iRefreshProgressDelayedStart->Start( - KRefreshProgressStartDelay, - KRefreshProgressStartDelay, - TCallBack( RefreshProgressDelayedStart, this ) ); - } - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::RefreshStoppedL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::RefreshStoppedL() - { - FUNC_LOG - - ClearProgressBarL(); - - if( iContainer ) - { - TInt index( iContainer->ListBoxCurrentItemIndex() ); - if ( index > 0 && index < iContainer->ListBoxNumberOfItems() ) - { - iIndex = index; - } - DirectoryChangedL(); - UpdateCbaL(); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::AreChosenFilesProtectedL -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerViewBase::AreChosenFilesProtectedL( TBool aMode ) - { - TBool ret = aMode; - CArrayFixFlat* indexArray = MarkedArrayLC(); - - TInt i( 0 ); - -#ifdef __KEEP_DRM_CONTENT_ON_PHONE - TBool protectedFile( EFalse ); -#endif // __KEEP_DRM_CONTENT_ON_PHONE - - while( ( ret == aMode ) && i < indexArray->Count() ) - { - CFileManagerItemProperties* prop = iEngine.GetItemInfoL( indexArray->At( i )); - CleanupStack::PushL( prop ); - -#ifdef __KEEP_DRM_CONTENT_ON_PHONE - // Only one folder can be selected at a time - if (iEngine.IsFolder(indexArray->At( i ))) - { - - CDirScan *dirScan = CDirScan::NewLC( iEikonEnv->FsSession() ); - CDir *currentDir = NULL; - // Go through the files only - dirScan->SetScanDataL( prop->FullPath(), KEntryAttNormal, ESortNone ); - - dirScan->NextL( currentDir ); - while ( ( ret == aMode ) && currentDir ) - { - CleanupStack::PushL( currentDir ); // currentDir won't be null - // due to while loop conditional - TInt j( 0 ); - while ( ( ret == aMode ) && j < currentDir->Count() ) - { - const TEntry ¤tFile( ( *currentDir )[ j ] ); - TPtrC currentPath (dirScan->FullPath()); - HBufC* currentFilePath = HBufC::NewLC( KMaxFileName ); - TPtr completeFilePath = currentFilePath->Des(); - completeFilePath.Append(currentPath); - completeFilePath.Append(currentFile.iName); - - - // the following could leave if file is opened in exclusive - // mode by another app- will cause 'in use' error dialog - //to be displayed - User::LeaveIfError( iEngine.IsDistributableFile( completeFilePath, - protectedFile )); - if( protectedFile == !aMode ) - { - ret = !aMode; - } - ++j; - CleanupStack::PopAndDestroy( currentFilePath ); - currentFilePath = NULL; - } - CleanupStack::PopAndDestroy( currentDir ); - currentDir=NULL; - dirScan->NextL( currentDir ); - } - CleanupStack::PopAndDestroy( dirScan ); - dirScan = NULL; - } - else - { - - // the following could leave if file is opened in exclusive - // mode by another app- will cause 'in use' error dialog - //to be displayed - User::LeaveIfError( iEngine.IsDistributableFile( prop->FullPath(), - protectedFile )); - if( protectedFile == !aMode ) - { - ret = !aMode; - } - } - -#else // __KEEP_DRM_CONTENT_ON_PHONE - if ( ( (prop->TypeL() & CFileManagerItemProperties::EForwardLocked) - == CFileManagerItemProperties::EForwardLocked ) == !aMode ) - { - ret = !aMode; - } -#endif // __KEEP_DRM_CONTENT_ON_PHONE - CleanupStack::PopAndDestroy( prop ); - ++i; - } - CleanupStack::PopAndDestroy( indexArray ); - return ret; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::ShowContextSensitiveMenuL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::ShowContextSensitiveMenuL() - { - CEikMenuBar* menu = MenuBar(); - // set context sensitive menu - menu->SetMenuTitleResourceId( R_FILEMANAGER_CONTEXT_SENSITIVE_MENUBAR ); - // show context sensitive menu - TRAPD( err, menu->TryDisplayMenuBarL() ); - menu->SetMenuTitleResourceId( R_FILEMANAGER_MEMORY_STORE_MENUBAR ); - User::LeaveIfError( err ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::ClearProgressBarL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::ClearProgressBarL() - { - FUNC_LOG - - iProgressInfo = NULL; - - if ( iProgressDialog ) - { - iProgressDialog->ProcessFinishedL(); - iProgressDialog = NULL; - } - if ( iProgressDialogRefresh ) - { - iProgressDialogRefresh->ProcessFinishedL(); - iProgressDialogRefresh = NULL; - } - delete iPeriodic; - iPeriodic = NULL; - - delete iRefreshProgressDelayedStart; - iRefreshProgressDelayedStart = NULL; - - iTotalTransferredBytes = 0; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::StoreIndex -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerViewBase::StoreIndex() - { - if ( iContainer ) - { - TInt index( iContainer->ListBoxCurrentItemIndex() ); - if ( index >= 0 && - index < iContainer->ListBoxNumberOfItems() ) - { - iIndex = index; // Store view's internal index - - // Store navigation index - TUid viewId( Id() ); - if ( viewId == CFileManagerAppUi::KFileManagerMemoryStoreViewId || - viewId == CFileManagerAppUi::KFileManagerFoldersViewId ) - { - iEngine.SetCurrentIndex( index ); - } - } - } - else - { - return EFalse; - } - return ETrue; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::DriveReadOnlyMmcL -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerViewBase::DriveReadOnlyMmcL( const TInt aDrive ) const - { - TBool ret( EFalse ); - TUint32 drvState( 0 ); - TInt err( iEngine.DriveState( drvState, aDrive ) ); - if ( err == KErrNone && - ( drvState & TFileManagerDriveInfo::EDriveWriteProtected ) ) - { - ret = ETrue; - } - if ( ret ) - { -#ifdef RD_MULTIPLE_DRIVE - HBufC* text = iEngine.GetFormattedDriveNameLC( - aDrive, - R_QTN_MEMC_MULTIPLE_MEMC_READ_ONLY ); - FileManagerDlgUtils::ShowErrorNoteL( *text ); - CleanupStack::PopAndDestroy( text ); -#else // RD_MULTIPLE_DRIVE - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_MEMC_MEMORYCARD_READ_ONLY ); -#endif // RD_MULTIPLE_DRIVE - } - - return ret; - } - - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::DriveReadOnlyMmcL -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerViewBase::DriveReadOnlyMmcL( const TDesC& aFullPath ) const - { - TBool ret( EFalse ); - if ( aFullPath.Length() ) - { - TInt drive = TDriveUnit( aFullPath ); - ret = DriveReadOnlyMmcL( drive ); - } - return ret; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::CurrentProcess -// -// ------------------------------------------------------------------------------ -// -MFileManagerProcessObserver::TFileManagerProcess CFileManagerViewBase::CurrentProcess() - { - return iActiveProcess; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::Error -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::Error( TInt aError ) - { - if ( aError != KErrNone ) - { - ERROR_LOG1( "CFileManagerViewBase::Error()-aError=%d", aError ) - iEikonEnv->HandleError( aError ); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::AddSendOptionL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::AddSendOptionL( - CEikMenuPane& aMenuPane, - const TInt aCommandIdAfter ) - { - CSendUi& sendUi( static_cast< CFileManagerAppUi* >( AppUi() )->SendUiL() ); - TInt pos( 0 ); - aMenuPane.ItemAndPos( aCommandIdAfter, pos ); - CArrayFixFlat< TInt >* indexArray = MarkedArrayLC(); - TInt msgSize( KMessageSize ); - if ( indexArray->Count() == 1 && - !iEngine.IsFolder( indexArray->At( 0 ) ) ) - { - msgSize = Int64ToInt( iEngine.GetFileSizesL( *indexArray ) ); - } - CleanupStack::PopAndDestroy( indexArray ); - TSendingCapabilities caps( - 0, msgSize, TSendingCapabilities::ESupportsAttachments ); - sendUi.AddSendMenuItemL( aMenuPane, pos, EFileManagerSend, caps ); - aMenuPane.SetItemSpecific(EFileManagerSend, ETrue); - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::DeleteStatusNotOk -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerViewBase::DeleteStatusNotOkL( - CFileManagerItemProperties& aProp, TInt aSelectionCount ) const - { - if ( DriveReadOnlyMmcL( aProp.FullPath() ) ) - { - // Can't delete from read-only MMC card - return ETrue; - } - - TUint32 itemType( aProp.TypeL() ); - if ( !aSelectionCount && - ( itemType & KDefaultFolderMask ) == KDefaultFolderMask ) - { - // Can't delete default folder - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_FMGR_ERROR_DEL_DEF_FLDR ); - return ETrue; - } - if ( aSelectionCount <= 1 && - ( itemType & CFileManagerItemProperties::EOpen ) ) - { - // Can't delete open file - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_FMGR_ERROR_DELETE_FILE_OPEN ); - return ETrue; - } - - return EFalse; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::DeleteItemsL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::DeleteItemsL( TInt aIndex ) - { - - CArrayFixFlat* deleteArray = MarkedArrayLC(); - TInt newIndex( MinIndex( *deleteArray ) ); - delete iActiveDelete; - iActiveDelete = NULL; - iActiveDelete = iEngine.CreateActiveDeleteL( *deleteArray ); - delete iWaitNoteWrapper; - iWaitNoteWrapper = NULL; - iWaitNoteWrapper = CAknWaitNoteWrapper::NewL(); - iActiveProcess = EDeleteProcess; - TRAPD( err, iWaitNoteWrapper->ExecuteL( - R_FILEMANAGER_DELETE_WAIT_DIALOG, *iActiveDelete ) ); - iActiveProcess = ENoProcess; - User::LeaveIfError( err ); - - HBufC* fileNameBuf = HBufC::NewLC( KMaxFileName ); - TPtr fileName( fileNameBuf->Des() ); - - err = iActiveDelete->GetError( fileName ); - - switch ( err ) - { - case KErrInUse: - case KErrFmgrSeveralFilesInUse: - { - ERROR_LOG1( "CFileManagerViewBase::DeleteItemsL()-err=%d", err ) - if ( iEngine.IsFolder( aIndex ) ) - { - if ( err == KErrFmgrSeveralFilesInUse ) - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_FMGR_ERROR_DEL_FLDR_OPEN_SE ); - } - else - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_FMGR_ERROR_DEL_FLDR_OPEN_1 ); - } - } - else - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_FMGR_ERROR_DELETE_FILE_OPEN ); - } - break; - } - case KErrNone: - { - if ( iContainer ) - { - //CEikListBox& listBox( iContainer->ListBox() ); - //AknSelectionService::HandleItemRemovalAndPositionHighlightL( - // &listBox, listBox.CurrentItemIndex(), *deleteArray); - -#ifndef RD_DRM_RIGHTS_MANAGER_REMOVAL - if ( FeatureManager().IsDrmFullSupported() ) - { - TInt deletedItems( 0 ); - TInt deletedDrmItems( iActiveDelete->DeletedDrmItems( deletedItems ) ); - if( deletedDrmItems ) - { - if( deletedDrmItems > 1 ) - { - FileManagerDlgUtils::ShowInfoQueryL( - R_QTN_DRM_MOS_DELETED, deletedDrmItems ); - } - else - { - FileManagerDlgUtils::ShowInfoQueryL( - R_QTN_DRM_MO_DELETED, fileName ); - } - } - } -#endif // RD_DRM_RIGHTS_MANAGER_REMOVAL - - // Set focus to the item after selection - iContainer->SetIndex( newIndex ); - } - break; - } - default: - { - ERROR_LOG1( "CFileManagerViewBase::DeleteItemsL()-err=%d", err ) - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_FLDR_CANT_DELETE_ITEM, fileName ); - break; - } - } - CleanupStack::PopAndDestroy( fileNameBuf ); - CleanupStack::PopAndDestroy( deleteArray ); - StoreIndex(); - iEngine.SetObserver( this ); - iEngine.RefreshDirectory(); - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::HasInfoUrlL -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerViewBase::HasInfoUrlL( TInt aIndex ) - { - if ( iEngine.IsFolder( aIndex ) ) - { - return EFalse; - } - TBool hasUrl( EFalse ); - HBufC8* url = NULL; - HBufC* fullPath = iEngine.IndexToFullPathLC( aIndex ); - CDRMHelper* drmHelper = CDRMHelper::NewLC( *iEikonEnv ); - - TRAPD( err, hasUrl = drmHelper->HasInfoUrlL( *fullPath, url ) ); - if ( hasUrl && url && err == KErrNone ) - { - hasUrl = url->Length() > 0; - } - else - { - hasUrl = EFalse; - } - - ERROR_LOG2( "CFileManagerViewBase::HasInfoUrlL()-hasUrl=%d,err=%d", hasUrl, err ) - - delete url; - CleanupStack::PopAndDestroy( drmHelper ); - CleanupStack::PopAndDestroy( fullPath ); - return hasUrl; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::OpenInfoUrlL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::OpenInfoUrlL( TInt aIndex ) - { - if ( iEngine.IsFolder( aIndex ) ) - { - return; - } - HBufC* fullPath = iEngine.IndexToFullPathLC( aIndex ); - CDRMHelper* drmHelper = CDRMHelper::NewLC( *iEikonEnv ); - - // Call returns after browser has been closed -#ifdef FILE_MANAGER_ERROR_LOG_ENABLED - TRAPD( err, drmHelper->OpenInfoUrlL( *fullPath ) ); - ERROR_LOG1( "CFileManagerViewBase::OpenInfoUrlL()-err=%d", err ) -#else // FILE_MANAGER_ERROR_LOG_ENABLED - TRAP_IGNORE( drmHelper->OpenInfoUrlL( *fullPath ) ); -#endif // FILE_MANAGER_ERROR_LOG_ENABLED - - CleanupStack::PopAndDestroy( drmHelper ); - CleanupStack::PopAndDestroy( fullPath ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::CheckFileRightsAndInformIfExpiredL -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerViewBase::CheckFileRightsAndInformIfExpiredL( - const TDesC& aFullPath ) - { - if ( !FeatureManager().IsDrmFullSupported() ) - { - return ETrue; - } - TBool expired( EFalse ); - TBool wmDrm( IsWmDrmFile( aFullPath ) ); - if ( !wmDrm ) // Ignore WM DRM files - { - TBool dummy( EFalse ); - CDRMHelperRightsConstraints* dummy2 = NULL; - CDRMHelperRightsConstraints* dummy3 = NULL; - CDRMHelperRightsConstraints* dummy4 = NULL; - CDRMHelperRightsConstraints* dummy5 = NULL; - CDRMHelper* drmHelper = CDRMHelper::NewLC( *iEikonEnv ); - TRAPD( err, drmHelper->GetRightsDetailsL( - aFullPath, 0, expired, dummy, dummy2, dummy3, dummy4, dummy5 ) ); - delete dummy2; - delete dummy3; - delete dummy4; - delete dummy5; - if ( expired ) - { - err = KErrCANoPermission; - } - if ( err == KErrCANoRights || err == KErrCANoPermission ) - { - // Rights expired or missing, show note or try get silent rights - expired = ETrue; - ERROR_LOG1( "CFileManagerViewBase::CheckFileRightsAndInformIfExpiredL-err=%d", - err ) - HBufC8* previewUri = NULL; - if ( drmHelper->HandleErrorOrPreviewL( err, aFullPath, previewUri ) == KErrNone ) - { - expired = EFalse; - } - delete previewUri; // Not needed - } - CleanupStack::PopAndDestroy( drmHelper ); - } - ERROR_LOG2( - "CFileManagerViewBase::CheckFileRightsAndInformIfExpiredL-expired=%d,wmDrm=%d", - expired, wmDrm ) - return !expired; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::HandleFileNotFoundL -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerViewBase::HandleFileNotFoundL( TInt aError ) - { - if ( aError == KErrNotFound ) - { - iEngine.SetObserver( this ); - iEngine.RefreshDirectory(); - return ETrue; - } - if ( aError == KErrPathNotFound ) - { - TInt count( iEngine.FolderLevel() ); - TBool connectedRemoteDrive( EFalse ); - RefreshDriveInfoL(); - - TFileManagerDriveInfo& drvInfo( DriveInfo() ); - TBool remoteDrive( EFalse ); - // Check if drive is remote drive and is it connected or not - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) - { - remoteDrive = ETrue; - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected ) - { - connectedRemoteDrive = ETrue; - } - } - // Check if drive has been disconnected and reconnect canceled - if ( remoteDrive && !connectedRemoteDrive ) - { - // Do only root refresh if user is already got back in main view - if ( Id() == CFileManagerAppUi::KFileManagerMainViewId && - iEngine.NavigationLevel() < 0 ) - { - iEngine.SetObserver( this ); - iEngine.RefreshDirectory(); - } - // Open memory store view to show not connected. - else if ( Id() != CFileManagerAppUi::KFileManagerMemoryStoreViewId ) - { - iIndex = 0; - static_cast< CFileManagerAppUi* >( AppUi() )->ActivateMemoryStoreViewL(); - } - else - { - iIndex = 0; - if ( iContainer ) - { - iContainer->SetListEmptyL(); - } - DirectoryChangedL(); - } - } - // Check if fetch was canceled in connected memory store view - else if ( connectedRemoteDrive && - Id() == CFileManagerAppUi::KFileManagerMemoryStoreViewId ) - { - static_cast< CFileManagerAppUi* >( AppUi() )->ActivateMainViewL(); - } - else if ( count > 0 && - ( connectedRemoteDrive || - !BaflUtils::PathExists( - iEikonEnv->FsSession(), iEngine.CurrentDirectory() ) ) ) - { - // Go back to last valid folder - CFileManagerAppUi* appUi = - static_cast< CFileManagerAppUi* >( AppUi() ); - TInt err( KErrNone ); - for ( TInt i( 0 ); i < count; i++ ) - { - TRAP( err, iEngine.BackstepL() ); - if ( err == KErrNone ) - { - break; - } - } - if ( iEngine.FolderLevel() || - iEngine.State() == CFileManagerEngine::ESearch ) - { - iEngine.SetObserver( this ); - iEngine.RefreshDirectory(); - } - else - { - appUi->CloseFoldersViewL(); - } - } - else - { - // Refresh root folder - iEngine.SetObserver( this ); - iEngine.RefreshDirectory(); - } - return ETrue; - } - return EFalse; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::ScreenDeviceChanged -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::ScreenDeviceChanged() - { - if ( iContainer ) - { - iContainer->SetRect( ClientRect() ); - iContainer->DrawDeferred(); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::NotifyL -// -// ------------------------------------------------------------------------------ -// -TInt CFileManagerViewBase::NotifyL( TFileManagerNotify aType, - TInt aData, const TDesC& aName ) - { - TInt ret( KErrNone ); - switch ( aType ) - { - case ENotifyDisksChanged: - { - if ( iDirectoryRefreshDenied ) - { - iDirectoryRefreshPostponed = ETrue; - } - else if ( iActiveProcess == ENoProcess && !IsRefreshInProgress() ) - { - StoreIndex(); - iEngine.SetObserver( this ); - iEngine.RefreshDirectory(); - } -#ifndef RD_MULTIPLE_DRIVE - else if ( iActiveProcess == EEjectProcess ) - { - // Memory card was put back, complete query - if ( iEngine.AnyEjectableDrivePresent() ) - { - delete iEjectQueryDialog; - iEjectQueryDialog = NULL; - } - } -#endif // RD_MULTIPLE_DRIVE - break; - } - case ENotifyBackupMemoryLow: - { - if( aData < KEstimateLowerLimit ) - { - ret = KErrDiskFull; - } - else if( aData < KEstimateUpperLimit ) - { - -#ifdef RD_FILE_MANAGER_BACKUP - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); -#endif // RD_FILE_MANAGER_BACKUP - - if ( !FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( -#ifdef RD_FILE_MANAGER_BACKUP - R_QTN_FMGR_BACKUP_TIGHT_MEMORY, - iEngine.DriveName( settings.TargetDrive() ) -#else // RD_FILE_MANAGER_BACKUP - R_QTN_CONFIRM_BACKUP_LEVEL1 -#endif // RD_FILE_MANAGER_BACKUP - ) ) - { - ret = KErrCancel; - } - } - break; - } - case ENotifyForcedFormat: - { - StopProgressDialogAndStoreValues(); - - TInt textId( R_QTN_CONFIRM_FORMAT_TEXT2 ); -#ifdef RD_MULTIPLE_DRIVE - if ( DriveInfo().iState & TFileManagerDriveInfo::EDriveMassStorage ) - { - textId = R_QTN_FMGR_FORMAT_MASS_QUERY2; - } -#endif // RD_MULTIPLE_DRIVE - - TBool query( FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( textId ) ); - LaunchProgressDialogL( - iProgressFinalValue, iProgressCurrentValue, iActiveProcess ); - return query; - } - case ENotifyFileOpenDenied: - { - TBool launchProgress( StopProgressDialogAndStoreValues() ); - - ret = !CheckFileRightsAndInformIfExpiredL( aName ); - if ( launchProgress ) - { - LaunchProgressDialogL( - iProgressFinalValue, iProgressCurrentValue, iActiveProcess ); - } - break; - } - default: - { - break; - } - } - return ret; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::MemoryStoreMenuFilteringL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::MemoryStoreMenuFilteringL( - CEikMenuPane& aMenuPane ) - { - TBool isSearchOn( iEngine.State() == CFileManagerEngine::ESearch ); - TRAP_IGNORE ( RefreshDriveInfoL() ); - TFileManagerDriveInfo& drvInfo( DriveInfo() ); - TInt driveNumber = drvInfo.iDrive; - iEngine.GetDriveInfoL(driveNumber,drvInfo); - - // Common remote drive filtering - RemoteDriveCommonFilteringL( aMenuPane ); - if( iContainer->IsSearchFieldVisible() && - !FilesCountInSearchField() ) - { - aMenuPane.SetItemDimmed( EFileManagerMark, ETrue ); - } - if ( iContainer->ListBoxNumberOfItems() ) - { - if ( !iContainer->ListBoxSelectionIndexesCount() ) - { - TUint32 fileType( iEngine.FileTypeL( - iContainer->ListBoxCurrentItemIndex() ) ); - if ( ( fileType & KDefaultFolderMask ) == KDefaultFolderMask ) - { - aMenuPane.SetItemDimmed( EFileManagerMoveToFolder, ETrue ); - } - } - } - else - { - aMenuPane.SetItemDimmed( EFileManagerMoveToFolder, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerCopyToFolder, ETrue ); - } - TInt index(iContainer->ListBoxCurrentItemIndex()); - TUint32 fileType(iEngine.FileTypeL(index)); - if (!(fileType & CFileManagerItemProperties::EFolder)) - { - aMenuPane.SetItemDimmed(EFileManagerMoveToFolder, ETrue); - } - CFileManagerFeatureManager& featureManager( FeatureManager() ); - -#ifdef RD_MULTIPLE_DRIVE - // No format item for mass storage in embedded mode dimming - if ( !( drvInfo.iState & TFileManagerDriveInfo::EDriveFormattable ) ) - { - aMenuPane.SetItemDimmed( EFileManagerFormatMassStorage, ETrue ); - } -#endif // RD_MULTIPLE_DRIVE - - // Memory store specific remote drive filtering - if ( !featureManager.IsRemoteStorageFwSupported() || - !( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) || - !( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected ) ) - { - // For disconnected or non remote drive - aMenuPane.SetItemDimmed( EFileManagerRefreshRemoteDrive, ETrue ); - } - - if ( !featureManager.IsHelpSupported() ) - { - // No help item dimming - aMenuPane.SetItemDimmed( EAknCmdHelp, ETrue ); - } - if ( !featureManager.IsIrdaSupported() ) - { - // No infra red item dimming - aMenuPane.SetItemDimmed( EFileManagerReceiveViaIR, ETrue ); - } - if ( isSearchOn ) - { - // Search view item dimming - aMenuPane.SetItemDimmed( EFileManagerRename, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerReceiveViaIR, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerOrganise, ETrue ); -// aMenuPane.SetItemDimmed( EFileManagerMemoryCard, ETrue ); -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue ); - //aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerRefreshRemoteDrive, ETrue ); -#ifdef RD_MULTIPLE_DRIVE - aMenuPane.SetItemDimmed( EFileManagerFormatMassStorage, ETrue ); -#endif // RD_MULTIPLE_DRIVE - aMenuPane.SetItemDimmed( EFileManagerSort, ETrue ); - } - else - { - aMenuPane.SetItemDimmed( EFileManagerSearchSort, ETrue ); - } - //dim the item unconditionally - aMenuPane.SetItemDimmed( EFileManagerFormatMassStorage, ETrue ); - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveWriteProtected ) - { - // Write protected item dimming - aMenuPane.SetItemDimmed( EFileManagerRename, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerDelete, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerReceiveViaIR, ETrue ); -// aMenuPane.SetItemDimmed( EFileManagerMemoryCard, ETrue ); -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue ); -#ifdef RD_MULTIPLE_DRIVE - aMenuPane.SetItemDimmed( EFileManagerFormatMassStorage, ETrue ); -#endif // RD_MULTIPLE_DRIVE - } - -#ifdef RD_MULTIPLE_DRIVE - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveMassStorage ) - { - // Mass storage item dimming -// aMenuPane.SetItemDimmed( EFileManagerMemoryCard, ETrue ); -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue ); - - if ( !( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) ) - { - aMenuPane.SetItemDimmed( EFileManagerFormatMassStorage, ETrue ); - } - } - else -#endif // RD_MULTIPLE_DRIVE - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemovable ) - { - // Memory card item dimming - if ( !( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) || - ( drvInfo.iState & ( TFileManagerDriveInfo::EDriveCorrupted | - TFileManagerDriveInfo::EDriveLocked ) ) ) - { -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue ); - } - if ( ( drvInfo.iState & TFileManagerDriveInfo::EDriveCorrupted ) || - !( drvInfo.iState & TFileManagerDriveInfo::EDriveLocked ) ) - { - aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue ); - } -// if ( !( drvInfo.iState & TFileManagerDriveInfo::EDriveLockable ) ) -// { -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue ); -// } - if ( !featureManager.IsMmcPassWdSupported() ) - { - //aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue ); - } -#ifdef RD_MULTIPLE_DRIVE - aMenuPane.SetItemDimmed( EFileManagerFormatMassStorage, ETrue ); -#endif // RD_MULTIPLE_DRIVE - } - else - { - // No mass storage or memory card item dimming -// aMenuPane.SetItemDimmed( EFileManagerMemoryCard, ETrue ); -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue ); -#ifdef RD_MULTIPLE_DRIVE - aMenuPane.SetItemDimmed( EFileManagerFormatMassStorage, ETrue ); -#endif // RD_MULTIPLE_DRIVE - } - -// CEikListBox& listBox = iContainer->ListBox(); - TBool dimSend( EFalse ); - - if ( iContainer->ListBoxSelectionIndexesCount() ) - { - // Selections in list - aMenuPane.SetItemDimmed( EFileManagerOpen, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerRename, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue ); - - if ( !featureManager.IsDrmFullSupported() && - AreChosenFilesProtectedL( ETrue ) ) - { - dimSend = ETrue; - } - - - // Hide empty details if no item or memory specific details - // can be shown. - if ( isSearchOn || - ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) ) - { - aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue ); - } - - if ( !( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) || - ( ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) && - !( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected ) ) ) - { - // Handle unavailable drive OR disconnected remote drive - dimSend = ETrue; - aMenuPane.SetItemDimmed( EFileManagerSort, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerOrganise, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMark, ETrue ); - } - } - else if ( iContainer->ListBoxNumberOfItems() ) - { - // Check if there is files on the list - TInt files( iEngine.FilesInFolderL() ); - if ( !files ) - { - dimSend = ETrue; - aMenuPane.SetItemDimmed( EFileManagerMark, ETrue ); - } - - // There is items in list, check selection type - TUint32 fileType( iEngine.FileTypeL( - iContainer->ListBoxCurrentItemIndex() ) ); - if ( ( fileType & KDefaultFolderMask ) == KDefaultFolderMask ) - { - dimSend = ETrue; - aMenuPane.SetItemDimmed( EFileManagerDelete, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerRename, ETrue ); - } - else if ( fileType & CFileManagerItemProperties::EFolder ) - { - dimSend = ETrue; - } - - if ( fileType & CFileManagerItemProperties::EPlaylist ) - { - dimSend = ETrue; - } - - // When full OMA DRM is in use, it is ok to show send option - if( ( fileType & CFileManagerItemProperties::EForwardLocked ) && - !featureManager.IsDrmFullSupported() ) - { - dimSend = ETrue; - } - if ( ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) && - !( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected ) ) - { - // Handle disconnected remote drive - dimSend = ETrue; - } - } - else - { - // List is empty - aMenuPane.SetItemDimmed( EFileManagerOpen, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerDelete, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMark, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerRename, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerSort, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerSearchSort, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue ); - dimSend = ETrue; - - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveWriteProtected ) - { - // Handle write protected drive - aMenuPane.SetItemDimmed( EFileManagerOrganise, ETrue ); - } - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) - { - // Handle empty remote folder - aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue ); - } - - if ( ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) && - !( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected ) ) - { - // Handle disconnected remote drive - aMenuPane.SetItemDimmed( EFileManagerReceiveViaIR, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerOrganise, ETrue ); -// aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue ); - } - else if ( !( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) || - ( drvInfo.iState & ( - TFileManagerDriveInfo::EDriveCorrupted | - TFileManagerDriveInfo::EDriveLocked ) ) ) - { - // Handle unavailable drive -// aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerReceiveViaIR, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerOrganise, ETrue ); -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue ); - - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemovable && - !( drvInfo.iState & TFileManagerDriveInfo::EDriveLocked ) ) - { - aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue ); - } - } - else if ( isSearchOn || - !BaflUtils::PathExists( - iEikonEnv->FsSession(), iEngine.CurrentDirectory() ) ) - { - // Handle empty search results and invalid path - if ( isSearchOn || !iEngine.CurrentDirectory().Length() ) - { - aMenuPane.SetItemDimmed( EFileManagerReceiveViaIR, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerOrganise, ETrue ); -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue ); -// aMenuPane.SetItemDimmed( EFileManagerMemoryCard, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue ); -// aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue ); - } - else - { - // BaflUtils::PathExists does not work for remote drive root dirs. - if( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) - { - _LIT( KRootFolder, "?:\\" ); - if ( iEngine.CurrentDirectory().MatchF( KRootFolder ) ) - { - User::Leave( KErrPathNotFound ); - } - } - else - { - User::Leave( KErrPathNotFound ); - } - } - } - } - - if ( !dimSend ) - { - AddSendOptionL( aMenuPane, EFileManagerDelete ); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::OrganiseMenuFilteringL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::OrganiseMenuFilteringL( CEikMenuPane& aMenuPane ) - { -// CEikListBox& listBox( iContainer->ListBox() ); - - - // Search view item dimming - if( iEngine.State() == CFileManagerEngine::ESearch ) - { - aMenuPane.SetItemDimmed( EFileManagerNewFolder, ETrue ); - } - - TFileManagerDriveInfo& drvInfo( DriveInfo() ); - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveWriteProtected ) - { - // Write protected item dimming - aMenuPane.SetItemDimmed( EFileManagerNewFolder, ETrue ); - - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::DetailsMenuFilteringL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::DetailsMenuFilteringL( CEikMenuPane& aMenuPane ) - { - TInt index( iContainer->ListBoxCurrentItemIndex() ); - TUint32 fileType( iEngine.FileTypeL( index ) ); - if ( fileType & CFileManagerItemProperties::EFolder ) - { - aMenuPane.SetItemDimmed( EFileManagerFileDetails, ETrue ); - } - else - { - aMenuPane.SetItemDimmed( EFileManagerFolderDetails, ETrue ); - } - if ( !FeatureManager().IsDrmFullSupported() || - !( fileType & CFileManagerItemProperties::EDrmProtected ) || - !HasInfoUrlL( index ) ) - { - aMenuPane.SetItemDimmed( EFileManagerMoreInfoOnline, ETrue ); - } - } - -//// ------------------------------------------------------------------------------ -//// CFileManagerViewBase::MemoryCardMenuFilteringL -//// -//// ------------------------------------------------------------------------------ -//// -//void CFileManagerViewBase::MemoryCardMenuFilteringL( CEikMenuPane& aMenuPane ) -// { -// TFileManagerDriveInfo& drvInfo( DriveInfo() ); -// -// if ( drvInfo.iState & ( TFileManagerDriveInfo::EDriveCorrupted | -// TFileManagerDriveInfo::EDriveLocked | -// TFileManagerDriveInfo::EDriveMassStorage ) ) -// { -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardName, ETrue ); -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardRename, ETrue ); -// } -// else -// { -// if ( drvInfo.iName.Length() ) -// { -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardName, ETrue ); -// } -// else -// { -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardRename, ETrue ); -// } -// } -// -// if ( !( drvInfo.iState & TFileManagerDriveInfo::EDriveFormattable ) ) -// { -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardFormat, ETrue ); -// } -// } -// -//// ------------------------------------------------------------------------------ -//// CFileManagerViewBase::MemoryCardPasswordMenuFilteringL -//// -//// ------------------------------------------------------------------------------ -//// -//void CFileManagerViewBase::MemoryCardPasswordMenuFilteringL( CEikMenuPane& aMenuPane ) -// { -// TFileManagerDriveInfo& drvInfo( DriveInfo() ); -// -// if ( drvInfo.iState & TFileManagerDriveInfo::EDrivePasswordProtected ) -// { -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPasswordSet, ETrue ); -// } -// else -// { -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPasswordChange, ETrue ); -// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPasswordRemove, ETrue ); -// } -// } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::ContextSensitiveMenuFilteringL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::ContextSensitiveMenuFilteringL( CEikMenuPane& aMenuPane ) - { - TFileManagerDriveInfo& drvInfo( DriveInfo() ); - TInt driveNumber = drvInfo.iDrive; - iEngine.GetDriveInfoL(driveNumber,drvInfo); - - // Check if there are files to send - TInt dummy( 0 ); - CArrayFixFlat< TInt >* files = GetSendFilesLC( dummy ); - - TBool dimSend( EFalse ); - if ( ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) && - !( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected ) ) - { - dimSend = ETrue; - } - - if ( files->Count() && !dimSend ) - { - AddSendOptionL( aMenuPane, EFileManagerOrganise ); - } - CleanupStack::PopAndDestroy( files ); - - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveWriteProtected ) - { - // Write protected item dimming - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageFormat, ETrue ); - } - - if ( iEngine.State() == CFileManagerEngine::ESearch || - !( drvInfo.iState & TFileManagerDriveInfo::EDriveRemovable ) ) - { - // No memory card item dimming - aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageFormat, ETrue ); - } - else - { - // Memory card item dimming - if ( !( drvInfo.iState & TFileManagerDriveInfo::EDriveLocked ) ) - { - aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue ); - } - if ( !( drvInfo.iState & TFileManagerDriveInfo::EDriveCorrupted ) || - !( drvInfo.iState & TFileManagerDriveInfo::EDriveFormattable ) ) - { - aMenuPane.SetItemDimmed( EFileManagerMemoryStorageFormat, ETrue ); - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::DriveInfo -// -// ----------------------------------------------------------------------------- -// -TFileManagerDriveInfo& CFileManagerViewBase::DriveInfo() const - { - return static_cast< CFileManagerAppUi* >( AppUi() )->DriveInfo(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::RefreshDriveInfoL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::RefreshDriveInfoL() - { - if ( !iEngine.CurrentDirectory().Length() ) - { - return; - } - iEngine.GetDriveInfoL( DriveInfo() ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::StartProcessL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::StartProcessL( - MFileManagerProcessObserver::TFileManagerProcess aProcess, - TInt aValue ) - { - if ( iActiveProcess != ENoProcess ) - { - return; - } - LaunchProgressDialogL( KMaxTInt, 0, aProcess ); - iEngine.SetObserver( this ); - iActiveProcess = aProcess; - TInt err( KErrNone ); - switch ( aProcess ) - { - case EFormatProcess: - { - TRAP( err, iEngine.StartFormatProcessL( aValue ) ); - break; - } - case EBackupProcess: - case ERestoreProcess: // FALLTHROUGH - { - CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( AppUi() ); - appUi->BackupOrRestoreStarted(); - - TRAP( err, iEngine.StartBackupProcessL( aProcess ) ); - break; - } - case EEjectProcess: - { - TRAP( err, iEngine.StartEjectProcessL( aValue ) ); - break; - } - default: - { - TRAP( err, ClearProgressBarL() ); - iActiveProcess = ENoProcess; - break; - } - } - if ( err != KErrNone ) - { - // Clean up the active process before forwarding leave - ERROR_LOG2( - "CFileManagerViewBase::StartProcessL-aProcess=%d,err=%d", - aProcess, err ) - iActiveProcess = ENoProcess; - User::Leave( err ); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::CmdUnlockDriveL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::CmdUnlockDriveL() - { - TFileManagerDriveInfo drvInfo; - if ( DriveInfoAtCurrentPosL( drvInfo ) < 0 ) - { - return; // No drive selected - } - - if ( !UnlockRemovePasswordL( drvInfo.iDrive, EFalse ) ) // Unlock only - { - RefreshDriveInfoL(); - iEngine.SetObserver( this ); - iEngine.RefreshDirectory(); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::CmdFormatDriveL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::CmdFormatDriveL() - { - StoreIndex(); - TFileManagerDriveInfo drvInfo; - if ( DriveInfoAtCurrentPosL( drvInfo ) < 0 ) - { - return; // No drive selected - } - - if ( !( drvInfo.iState & ( TFileManagerDriveInfo::EDriveRemovable | - TFileManagerDriveInfo::EDriveFormattable ) ) || - ( drvInfo.iState & TFileManagerDriveInfo::EDriveWriteProtected ) ) - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_MEMORYCARD_READONLY ); - return; - } - - TBool query( EFalse ); -#ifdef RD_MULTIPLE_DRIVE - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveUsbMemory ) - { - HBufC* text = iEngine.GetFormattedDriveNameLC( - drvInfo.iDrive, R_QTN_FMGR_USB_MEMORY_FORMAT_QUERY ); - query = FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( *text ); - CleanupStack::PopAndDestroy( text ); - } - else if ( drvInfo.iState & TFileManagerDriveInfo::EDriveMassStorage ) - { - HBufC* text = iEngine.GetFormattedDriveNameLC( - drvInfo.iDrive, R_QTN_FMGR_FORMAT_MASS_QUERY1 ); - query = FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( *text ); - CleanupStack::PopAndDestroy( text ); - } - else - { -#endif // RD_MULTIPLE_DRIVE - query = FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( - R_QTN_CONFIRM_FORMAT_TEXT ); -#ifdef RD_MULTIPLE_DRIVE - } -#endif // RD_MULTIPLE_DRIVE - - if ( query ) - { - StartProcessL( EFormatProcess, drvInfo.iDrive ); - } - } - -//// ------------------------------------------------------------------------------ -//// CFileManagerViewBase::CmdRenameDriveL -//// -//// ------------------------------------------------------------------------------ -//// -//void CFileManagerViewBase::CmdRenameDriveL() -// { -// TFileManagerDriveInfo& drvInfo( DriveInfo() ); -// if ( drvInfo.iState & TFileManagerDriveInfo::EDriveWriteProtected ) -// { -// FileManagerDlgUtils::ShowErrorNoteL( R_QTN_MEMORYCARD_READONLY ); -// return; -// } -// StoreIndex(); -// RenameDriveL( EFalse ); -// iEngine.SetObserver( this ); -// iEngine.RefreshDirectory(); -// } -// -//// ------------------------------------------------------------------------------ -//// CFileManagerViewBase::CmdSetDrivePasswordL -//// -//// ------------------------------------------------------------------------------ -//// -//void CFileManagerViewBase::CmdSetDrivePasswordL() -// { -// TBuf< KFmgrMaxMediaPassword > nullPwd; -// TBuf< KFmgrMaxMediaPassword > pwd; -// TInt ret( KErrNone ); -// if( FileManagerDlgUtils::ShowPasswordQueryL( pwd ) ) -// { -// EmptyPwd( nullPwd ); -// ret = UpdatePasswordL( nullPwd, pwd ); -// if( ret == KErrNone ) -// { -// FileManagerDlgUtils::ShowConfirmNoteL( R_QTN_PASSWORD_SET_TEXT ); -// RefreshDriveInfoL(); -// } -// else -// { -// FileManagerDlgUtils::ShowErrorNoteL( R_QTN_CRITICAL_ERROR ); -// } -// } -// } -// -//// ------------------------------------------------------------------------------ -//// CFileManagerViewBase::CmdChangeDrivePasswordL -//// -//// ------------------------------------------------------------------------------ -//// -//void CFileManagerViewBase::CmdChangeDrivePasswordL() -// { -// TBuf< KFmgrMaxMediaPassword > pwd; -// TBuf< KFmgrMaxMediaPassword > oldPwd; -// TBool isDone( EFalse ); -// TBool isCanceled( EFalse ); -// TInt err( KErrNone ); -// -// // Ask for the old password until the correct one is given -// while( !isDone ) -// { -// EmptyPwd( oldPwd ); -// if( FileManagerDlgUtils::ShowSimplePasswordQueryL( -// R_QTN_PASSWORD_OLD_TEXT, oldPwd ) ) -// { -// err = UpdatePasswordL( oldPwd, oldPwd ); -// if( err == KErrNone ) -// { -// isDone = ETrue; -// } -// else -// { -// FileManagerDlgUtils::ShowErrorNoteL( -// R_QTN_PASSWORDS_WRONG_TEXT ); -// } -// } -// else -// { -// isDone = ETrue; -// isCanceled = ETrue; -// } -// } -// -// // Then query for the new password -// if( !isCanceled ) -// { -// if( FileManagerDlgUtils::ShowPasswordQueryL( pwd ) ) -// { -// err = UpdatePasswordL( oldPwd, pwd ); -// if( err == KErrNone ) -// { -// FileManagerDlgUtils::ShowConfirmNoteL( -// R_QTN_PASSWORD_CHANGED_TEXT ); -// } -// else -// { -// FileManagerDlgUtils::ShowErrorNoteL( -// R_QTN_CRITICAL_ERROR ); -// } -// } -// } -// } -// -//// ------------------------------------------------------------------------------ -//// CFileManagerViewBase::CmdRemoveDrivePasswordL -//// -//// ------------------------------------------------------------------------------ -//// -//void CFileManagerViewBase::CmdRemoveDrivePasswordL() -// { -// if( !UnlockRemovePasswordL( ETrue ) ) -// { -// FileManagerDlgUtils::ShowConfirmNoteL( R_QTN_PASSWORD_REMOVED_TEXT ); -// RefreshDriveInfoL(); -// } -// } -// -//// ------------------------------------------------------------------------------ -//// CFileManagerViewBase::CmdMemoryCardDetailsL -//// -//// ------------------------------------------------------------------------------ -//// -//void CFileManagerViewBase::CmdMemoryCardDetailsL() -// { -// TFileManagerDriveInfo drvInfo; -// iEngine.GetDriveInfoL( iEngine.CurrentDrive(), drvInfo ); -// FileManagerDlgUtils::ShowMemoryStoreInfoPopupL( drvInfo ); -// } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::UpdatePasswordL -// -// ------------------------------------------------------------------------------ -// -TInt CFileManagerViewBase::UpdatePassword( - TInt aDrive, const TDesC& aOldPwd, const TDesC& aPwd ) - { - TMediaPassword mPwdNew; - TMediaPassword mPwdOld; - - ConvertCharsToPwd( aOldPwd, mPwdOld ); - ConvertCharsToPwd( aPwd, mPwdNew ); - - return iEngine.SetDrivePassword( aDrive, mPwdOld, mPwdNew ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::UnlockRemovePasswordL -// -// ------------------------------------------------------------------------------ -// -TInt CFileManagerViewBase::UnlockRemovePasswordL( - TInt aDrive, TBool aRemove ) - { - TBuf< KFmgrMaxMediaPassword > oldPwd; - TInt err( KErrNone ); - TMediaPassword pwd; - TInt res( R_QTN_UNLOCK_PASSWORD_TEXT ); - TInt resWrong( R_QTN_UNLOCK_PWD_WRONG_TEXT ); - HBufC* text = NULL; - - if( aRemove ) - { - // Confirm the action - if( !FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( - R_QTN_PASSWORD_REMOVE_TEXT ) ) - { - return KErrCancel; // Skip the rest if not accepted - } - res = R_QTN_PASSWORD_OLD_TEXT; - resWrong = R_QTN_PASSWORDS_WRONG_TEXT; - } - else - { - // Just unlock -#ifdef RD_MULTIPLE_DRIVE - text = iEngine.GetFormattedDriveNameLC( - aDrive, - R_QTN_MEMC_UNLOCK_PASSWORD_MULTIPLE_DEFAULTNAME, - R_QTN_MEMC_UNLOCK_PASSWORD_MULTIPLE ); -#else // RD_MULTIPLE_DRIVE - text = StringLoader::LoadLC( R_QTN_UNLOCK_PASSWORD_TEXT ); -#endif // RD_MULTIPLE_DRIVE - } - - // Show until correct pwd is given or canceled - TBool isDone( EFalse ); - while( !isDone ) - { - // Empty first - EmptyPwd( oldPwd ); - TBool pwdGiven( EFalse ); - if ( text ) - { - pwdGiven = FileManagerDlgUtils::ShowSimplePasswordQueryL( *text, oldPwd ); - } - else - { - pwdGiven = FileManagerDlgUtils::ShowSimplePasswordQueryL( res, oldPwd ); - } - - if( pwdGiven ) - { - ConvertCharsToPwd( oldPwd, pwd ); - if( aRemove ) - { - err = iEngine.RemoveDrivePassword( aDrive, pwd ); - } - else - { - err = iEngine.UnlockDrive( aDrive, pwd ); - } - - if ( err == KErrNone ) - { - isDone = ETrue; - } - else if ( err == KErrAccessDenied ) - { - FileManagerDlgUtils::ShowErrorNoteL( resWrong ); - } - else if ( err == KErrNotReady ) - { - isDone = ETrue; - FileManagerDlgUtils::ShowErrorNoteL( R_QTN_MEMC_NOT_AVAILABLE ); - } - else - { - isDone = ETrue; - FileManagerDlgUtils::ShowErrorNoteL( R_QTN_CRITICAL_ERROR ); - } - } - else - { - err = KErrCancel; - isDone = ETrue; - } - } - - if ( text ) - { - CleanupStack::PopAndDestroy( text ); - } - return err; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::SetRemoteDriveConnectionStateL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::SetRemoteDriveConnectionStateL( TBool aState ) - { - TInt drv( 0 ); - - StoreIndex(); - if ( !iEngine.CurrentDirectory().Length() ) - { - TInt index( iContainer->ListBoxCurrentItemIndex() ); - CFileManagerItemProperties* prop = iEngine.GetItemInfoL( index ); - CleanupStack::PushL( prop ); - drv = TDriveUnit( prop->FullPath() ); - CleanupStack::PopAndDestroy( prop ); - } - else - { - TFileManagerDriveInfo& drvInfo( DriveInfo() ); - drv = drvInfo.iDrive; - } - iEngine.SetRemoteDriveConnection( drv, aState ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::OpenRemoteDriveSettingsL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::OpenRemoteDriveSettingsL( - const TDesC& aDriveName ) - { - CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( AppUi() ); - appUi->ActivateRemoteDriveSettingsViewL( aDriveName ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::IsDisconnectedRemoteDrive -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerViewBase::IsDisconnectedRemoteDrive( - CFileManagerItemProperties& aProp ) - { - TUint32 drvState( 0 ); - if ( iEngine.DriveState( drvState, aProp.FullPath() ) == KErrNone ) - { - if ( ( drvState & TFileManagerDriveInfo::EDriveRemote ) && - !( drvState & TFileManagerDriveInfo::EDriveConnected ) ) - { - return ETrue; - } - } - return EFalse; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::RemoteDriveCommonFilteringL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::RemoteDriveCommonFilteringL( CEikMenuPane& aMenuPane ) - { - TBool dimAll( EFalse ); - if ( !FeatureManager().IsRemoteStorageFwSupported() ) - { - dimAll = ETrue; - } - else - { -// CEikListBox& listBox = iContainer->ListBox(); - if ( iContainer->ListBoxNumberOfItems() ) - { - TInt index( iContainer->ListBoxCurrentItemIndex() ); - CFileManagerItemProperties* prop = iEngine.GetItemInfoL( index ); - - TUint32 drvState( 0 ); - TInt err( iEngine.DriveState( drvState, prop->FullPath() ) ); - if ( err == KErrNone && - ( drvState & TFileManagerDriveInfo::EDriveRemote ) ) - { - if ( drvState & TFileManagerDriveInfo::EDriveConnected ) - { - aMenuPane.SetItemDimmed( EFileManagerConnectRemoveDrive, ETrue ); - } - else - { - aMenuPane.SetItemDimmed( EFileManagerDisconnectRemoveDrive, ETrue ); - } - } - else - { - dimAll = ETrue; - } - delete prop; - } - else - { - // List is empty - TFileManagerDriveInfo& drvInfo( DriveInfo() ); - - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) - { - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected ) - { - aMenuPane.SetItemDimmed( EFileManagerConnectRemoveDrive, ETrue ); - } - else - { - aMenuPane.SetItemDimmed( EFileManagerDisconnectRemoveDrive, ETrue ); - } - } - else - { - dimAll = ETrue; - } - } - } - - if ( dimAll ) - { - aMenuPane.SetItemDimmed( EFileManagerConnectRemoveDrive, ETrue ); - aMenuPane.SetItemDimmed( EFileManagerDisconnectRemoveDrive, ETrue ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::LaunchProgressBarL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::LaunchProgressBarL( - TInt aDialogId, - TInt aTextId, - TInt64 aFinalValue, - TInt64 aInitialValue, - TBool aPeriodic, - TBool aImmediatelyVisible ) - { - ClearProgressBarL(); // Clear previous - - if ( aFinalValue ) - { - iProgressDialog = new (ELeave) CAknProgressDialog( - ( reinterpret_cast< CEikDialog** >( &iProgressDialog ) ), aImmediatelyVisible ); - iProgressDialog->PrepareLC( aDialogId ); - - if ( aPeriodic ) - { - iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); - iPeriodic->Start( - KProgressBarUpdateInterval, KProgressBarUpdateInterval, - TCallBack( UpdateProgressBar, this ) ); - } - } - else - { - iProgressDialog = new (ELeave) CAknWaitDialog( - ( reinterpret_cast< CEikDialog** >( &iProgressDialog ) ), aImmediatelyVisible ); - iProgressDialog->PrepareLC( aDialogId ); - } - - if ( aTextId ) - { - HBufC* text = StringLoader::LoadLC( aTextId ); - iProgressDialog->SetTextL( *text ); - CleanupStack::PopAndDestroy( text ); - } - - iProgressDialog->SetCallback(this); - iProgressInfo = iProgressDialog->GetProgressInfoL(); - if ( iProgressInfo ) - { - iProgressInfo->SetFinalValue( static_cast( aFinalValue / KMinificationFactor ) ); - iProgressInfo->SetAndDraw( static_cast( aInitialValue / KMinificationFactor ) ); - } - iProgressDialog->RunLD(); - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::RefreshProgressDelayedStart -// -// ------------------------------------------------------------------------------ -// -TInt CFileManagerViewBase::RefreshProgressDelayedStart( TAny* aPtr ) - { - CFileManagerViewBase* view = static_cast< CFileManagerViewBase* > ( aPtr ); - TRAP_IGNORE( view->RefreshProgressDelayedStartL() ); - return KErrNone; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::RefreshProgressDelayedStartL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::RefreshProgressDelayedStartL() - { - CFileManagerAppUi* app = static_cast< CFileManagerAppUi* >( AppUi() ); - - delete iRefreshProgressDelayedStart; - iRefreshProgressDelayedStart = NULL; - - if( iProgressDialogRefresh ) - { - iProgressDialogRefresh->ProcessFinishedL(); - iProgressDialogRefresh = NULL; - } - iProgressDialogRefresh = new( ELeave ) CAknProgressDialog( - reinterpret_cast< CEikDialog** >( &iProgressDialogRefresh ), - EFalse ); - iProgressDialogRefresh->SetCallback( this ); - - if ( Id() == CFileManagerAppUi::KFileManagerSearchResultsViewId ) - { - iProgressDialogRefresh->ExecuteLD( R_FILEMANAGER_FIND_WAIT_DIALOG ); - } - else - { - iProgressDialogRefresh->ExecuteLD( R_FILEMANAGER_WAIT_NOTE_OPEN ); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::IsRefreshInProgress -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerViewBase::IsRefreshInProgress() - { - if ( iRefreshProgressDelayedStart || iProgressDialogRefresh ) - { - return ETrue; - } - return EFalse; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::ProcessCommandL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::ProcessCommandL( TInt aCommand ) - { - // Suppress commands during refresh - if ( IsRefreshInProgress() ) - { - switch ( aCommand ) - { - case EAknSoftkeyOptions: // FALLTHROUGH - case EAknSoftkeyBack: // FALLTHROUGH - case EAknSoftkeyContextOptions: // FALLTHROUGH - case EAknSoftkeyMark: // FALLTHROUGH - case EAknSoftkeyUnmark: // FALLTHROUGH - case EAknSoftkeySelect: - { - return; - } - default: - { - break; - } - } - } - - // Handle commands directly - switch ( aCommand ) - { - case EAknSoftkeyContextOptions: // FALLTHROUGH - case EAknSoftkeyMark: - { - HandleCommandL( aCommand ); - break; - } - default: - { - CAknView::ProcessCommandL( aCommand ); - break; - } - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::AskPathL -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerViewBase::AskPathL( TDes& aPath, TInt aTextId ) - { - TBool ret( EFalse ); - TInt memType( - AknCommonDialogsDynMem::EMemoryTypePhone | - AknCommonDialogsDynMem::EMemoryTypeMMC ); - - if ( FeatureManager().IsRemoteStorageFwSupported() ) - { - memType |= AknCommonDialogsDynMem::EMemoryTypeRemote; - } - - HBufC* title = StringLoader::LoadLC( aTextId ); - CFileManagerFileSelectionFilter* filter = - new( ELeave ) CFileManagerFileSelectionFilter( iEngine ); - CleanupStack::PushL( filter ); - - ret = AknCommonDialogsDynMem::RunFolderSelectDlgLD( - memType, - aPath, - KNullDesC, - R_FILEMANAGER_FIND_MEMORY_SELECTIONDIALOG, - R_FILEMANAGER_FIND_FOLDER_SELECTIONDIALOG, - *title, - filter ); - - CleanupStack::PopAndDestroy( filter ); - CleanupStack::PopAndDestroy( title ); - return ret; - } - -#ifdef RD_FILE_MANAGER_BACKUP -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::StartSchBackupL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::StartSchBackupL() - { - FUNC_LOG - - CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( AppUi() ); - CFileManagerSchBackupHandler& handler( appUi->SchBackupHandlerL() ); - - if ( FeatureManager().IsFeatureSupported( - EFileManagerFeatureScheduledBackupDisabled ) ) - { - // Scheduled backup is disabled, disable scheduler and cancel backup - INFO_LOG( "CFileManagerViewBase::StartSchBackupL-Backup disabled" ) - - handler.CancelBackupStarter(); - CFileManagerTaskScheduler& scheduler( appUi->TaskSchedulerL() ); - scheduler.EnableBackupScheduleL( EFalse ); - appUi->SchBackupFinishedL( KErrCancel ); - return; - } - - // Start scheduled backup if no process in progress - // Otherwise wait process to finish - if ( iActiveProcess == ENoProcess ) - { - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - TTime schTime( SetCurrentYearMonthAndDay( settings.Time() ) ); - - TTime manualBackupOrRestoreStarted = appUi->BackupOrRestoreStartTime(); - TTime manualBackupOrRestoreEnded = appUi->BackupOrRestoreEndTime(); - - if ( manualBackupOrRestoreStarted.Int64() > 0 && - schTime >= manualBackupOrRestoreStarted && - schTime <= manualBackupOrRestoreEnded ) - { - INFO_LOG( "CFileManagerViewBase::StartSchBackupL-Backup canceled due to manual op" ) - - handler.CancelBackupStarter(); - - appUi->ResetBackupOrRestoreEndTime();// Cancel required only once - } - else - { - INFO_LOG( "CFileManagerViewBase::StartSchBackupL-Start backup" ) - - iSchBackupPending = EFalse; - iActiveProcess = ESchBackupProcess; - iEngine.SetObserver( this ); - handler.StartBackupWithConfirm(); - } - } - // Ignore scheduled backup if backup or restore is in progress - else if ( iActiveProcess == ESchBackupProcess || - iActiveProcess == EBackupProcess || - iActiveProcess == ERestoreProcess ) - { - INFO_LOG( "CFileManagerViewBase::StartSchBackupL-Backup canceled" ) - - handler.CancelBackupStarter(); - } - else - { - INFO_LOG( "CFileManagerViewBase::StartSchBackupL-Backup pending" ) - - iSchBackupPending = ETrue; - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::SchBackupFinishedL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::SchBackupFinishedL() - { - FUNC_LOG - - if ( iActiveProcess == ESchBackupProcess ) - { - iActiveProcess = ENoProcess; - iSchBackupPending = EFalse; - } - } - -#endif // RD_FILE_MANAGER_BACKUP - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::SetCbaMskTextL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::SetCbaMskTextL( const TInt aTextId ) - { - HBufC* text = StringLoader::LoadLC( aTextId ); - CEikButtonGroupContainer* cba = Cba(); - if ( cba->ButtonCount() == KFmgrMSK ) - { - TInt cmdId( cba->ButtonGroup()->CommandId( KFmgrMSK ) ); - cba->SetCommandL( KFmgrMSK, cmdId, *text ); - cba->DrawDeferred(); - } - CleanupStack::PopAndDestroy( text ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::UpdateCbaL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::UpdateCbaL() - { - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::UpdateCommonCbaL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::UpdateCommonCbaL() - { - if ( !iContainer || IsRefreshInProgress() ) - { - return; - } - - CEikButtonGroupContainer* cba = Cba(); - - if ( !iContainer->ListBoxNumberOfItems() ) - { - cba->SetCommandSetL( - R_FILEMANAGER_SOFTKEYS_OPTIONS_BACK__EMPTY ); - } - else if ( iContainer->ListBoxSelectionIndexesCount() ) - { - cba->SetCommandSetL( - R_FILEMANAGER_SOFTKEYS_CONTEXT_OPTIONS_BACK__OPTIONS ); - } - else - { - cba->SetCommandSetL( - R_FILEMANAGER_SOFTKEYS_OPTIONS_BACK__OPEN ); - } - - // Restore right cancel softkey if it has been set by search field - TBool restoreCancel( ETrue ); - if ( iContainer->IsSearchFieldVisible() && - cba->ButtonCount() >= CEikButtonGroupContainer::ERightSoftkeyPosition ) - { - restoreCancel = ( cba->ButtonGroup()->CommandId( - CEikButtonGroupContainer::ERightSoftkeyPosition ) == EAknSoftkeyCancel ); - } - if ( !restoreCancel ) - { - HBufC* cancelText = StringLoader::LoadLC( R_AVKON_SOFTKEY_CANCEL ); - cba->SetCommandL( - CEikButtonGroupContainer::ERightSoftkeyPosition, - EAknSoftkeyCancel, - *cancelText ); - CleanupStack::PopAndDestroy( cancelText ); - } - - cba->DrawDeferred(); - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::RenameDriveL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::RenameDriveL( TBool aForceDefaultName ) - { - TFileManagerDriveInfo drvInfo; - if ( DriveInfoAtCurrentPosL( drvInfo ) < 0 ) - { - return; // No drive selected - } - - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveMassStorage ) - { - return; // Name not allowed - } - - HBufC* drvName = HBufC::NewLC( KMaxVolumeName ); - TPtr name( drvName->Des() ); - // 16-bit chars are required for non western volume names - const TInt KMaxNonWesternVolumeName( KMaxVolumeName / 2 ); - - // Setup query according to variant type, western or non western - TInt resId( R_FILEMANAGER_DRIVE_NAME_QUERY ); - TInt maxLen( KMaxVolumeName ); - if ( !FeatureManager().IsWesternVariant() ) - { - resId = R_FILEMANAGER_DRIVE_NAME_QUERY_NON_WESTERN; - maxLen = KMaxNonWesternVolumeName; - } - - if ( aForceDefaultName || !drvInfo.iName.Length() ) - { - HBufC* defaultName = NULL; - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveUsbMemory ) - { - defaultName = StringLoader::LoadLC( - R_QTN_FMGR_USB_MEMORY_DEFAULT_NAME ); - } - else - { - defaultName = StringLoader::LoadLC( R_QTN_MMC_DEFAULT_NAME ); - } - if ( defaultName->Length() > maxLen ) - { - name.Copy( defaultName->Des().Left( maxLen ) ); - } - else - { - name.Copy( *defaultName ); - } - CleanupStack::PopAndDestroy( defaultName ); - } - else - { - if ( drvInfo.iName.Length() > maxLen ) - { - name.Copy( drvInfo.iName.Left( maxLen ) ); - } - else - { - name.Copy( drvInfo.iName ); - } - } - - // Loop until canceled, accepted or an error occurs - TBool isDone( EFalse ); - while( !isDone ) - { - CAknTextQueryDialog* renameDlg = - CAknTextQueryDialog::NewL( name, CAknQueryDialog::ENoTone ); - renameDlg->SetMaxLength( maxLen ); - TBool ret( EFalse ); - if ( renameDlg->ExecuteLD( resId ) ) - { - ret = ETrue; - } - if( ret && name.Compare( drvInfo.iName ) ) - { - TInt err( iEngine.RenameDrive( drvInfo.iDrive, name ) ); - if( err == KErrNone ) - { - FileManagerDlgUtils::ShowConfirmNoteL( - R_QTN_FMGR_CONFIRM_MEMORY_NAME_CHANGED ); - RefreshDriveInfoL(); - isDone = ETrue; - } - else if( err == KErrBadName ) - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_INVALID_DRIVE_NAME ); - } - else - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_CRITICAL_ERROR ); - isDone = ETrue; - } - } - else - { - // Canceled - isDone = ETrue; - } - } - CleanupStack::PopAndDestroy( drvName ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::CmdRefreshDirectoryL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::CmdRefreshDirectoryL() - { - StoreIndex(); - iEngine.SetObserver( this ); - iEngine.ForcedRefreshDirectory(); - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::ShowEjectQueryL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerViewBase::ShowEjectQueryL() - { - delete iEjectQueryDialog; - iEjectQueryDialog = NULL; - - iEjectDone = EFalse; - iEjectQueryDialog = CAknQueryDialog::NewL(); - HBufC* text = NULL; - TInt index( iContainer->ListBoxCurrentItemIndex() ); - CFileManagerItemProperties* prop = iEngine.GetItemInfoLC( index ); -#ifdef RD_MULTIPLE_DRIVE - text = iEngine.GetFormattedDriveNameLC( - prop->DriveId(), - R_QTN_MEMC_INFO_EJECT_MULTIPLE_DEFAULTNAME, - R_QTN_MEMC_INFO_EJECT_MULTIPLE ); -#else // RD_MULTIPLE_DRIVE - text = StringLoader::LoadLC( R_QTN_INFO_EJECT ); -#endif // RD_MULTIPLE_DRIVE - TRAP_IGNORE( iEjectQueryDialog->ExecuteLD( - R_FILEMANAGER_EJECT_CONFIRM_QUERY, *text ) ); - CleanupStack::PopAndDestroy( text ); - CleanupStack::PopAndDestroy( prop ); - iEjectQueryDialog = NULL; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::IsDriveAvailable -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerViewBase::IsDriveAvailable( const TDesC& aPath ) const - { - TBool ret( EFalse ); - if ( aPath.Length() ) - { - TInt drive = TDriveUnit( aPath ); - ret = IsDriveAvailable( drive ); - } - return ret; - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::IsDriveAvailable -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerViewBase::IsDriveAvailable( const TInt aDrive ) const - { - TUint32 drvState( 0 ); - if ( iEngine.DriveState( drvState, aDrive ) != KErrNone ) - { - return EFalse; - } - if ( drvState & ( TFileManagerDriveInfo::EDriveLocked | - TFileManagerDriveInfo::EDriveCorrupted | - TFileManagerDriveInfo::EDriveInUse ) ) - { - return EFalse; // Drive is unavailable - } - if ( !( drvState & TFileManagerDriveInfo::EDriveRemote ) && - !( drvState & TFileManagerDriveInfo::EDrivePresent ) ) - { - return EFalse; // Drive is not present - } - return ETrue; - } - -// ---------------------------------------------------------------------------- -// CFileManagerViewBase::CheckPhoneState -// -// ---------------------------------------------------------------------------- -// -TBool CFileManagerViewBase::CheckPhoneState() const - { - // Check here all operations, which are supposed - // to prevent manual backup or restore. - TBool err( ETrue ); - TInt syncErr( 0 ); - TInt syncStat( 0 ); - TInt burErr( 0 ); - TInt burStat( 0 ); - - // Check synchronization state - syncErr = RProperty::Get( - KPSUidDataSynchronizationInternalKeys, - KDataSyncStatus, syncStat ); - - // Check backup/restore (e.g. PC Suite initiated) state - burErr = RProperty::Get( - KUidSystemCategory, - KUidBackupRestoreKey, burStat ); - const TBURPartType partType = static_cast< TBURPartType > - ( burStat & KBURPartTypeMask ); - - if ( (syncErr == KErrNone && syncStat > 0) - || (burErr == KErrNone && partType != EBURUnset && partType != EBURNormal ) ) - { - err = EFalse; - } - - return err; - } - -// ---------------------------------------------------------------------------- -// CFileManagerViewBase::StopProgressDialogAndStoreValues -// -// ---------------------------------------------------------------------------- -// -TBool CFileManagerViewBase::StopProgressDialogAndStoreValues() - { - TBool ret( EFalse ); - if ( iProgressDialog && iProgressInfo ) - { - CEikProgressInfo::SInfo info( iProgressInfo->Info() ); - iProgressFinalValue = ( info.iFinalValue ) * KMinificationFactor; - iProgressCurrentValue = ( iProgressInfo->CurrentValue() ) * KMinificationFactor; - if ( !iProgressCurrentValue && iTotalTransferredBytes <= iProgressFinalValue ) - { - iProgressCurrentValue = iTotalTransferredBytes; - } - TRAP_IGNORE( iProgressDialog->ProcessFinishedL() ); - iProgressDialog = NULL; - iProgressInfo = NULL; - ret = ETrue; - } - - delete iRefreshProgressDelayedStart; - iRefreshProgressDelayedStart = NULL; - delete iPeriodic; - iPeriodic = NULL; - - return ret; - } - - -// ---------------------------------------------------------------------------- -// CFileManagerViewBase::CheckPostponedDirectoryRefresh -// -// ---------------------------------------------------------------------------- -// -void CFileManagerViewBase::CheckPostponedDirectoryRefresh() - { - if ( iDirectoryRefreshPostponed ) - { - // Delete was canceled but directory was changed during query - StoreIndex(); - iEngine.SetObserver( this ); - iEngine.RefreshDirectory(); - } - iDirectoryRefreshPostponed = EFalse; - } - -// ---------------------------------------------------------------------------- -// CFileManagerViewBase::DenyDirectoryRefresh -// -// ---------------------------------------------------------------------------- -// -void CFileManagerViewBase::DenyDirectoryRefresh( TBool aDeny ) - { - iDirectoryRefreshDenied = aDeny; - if ( aDeny ) - { - iDirectoryRefreshPostponed = EFalse; // Reset previous value - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerViewBase::SortMenuFilteringL -// -// ---------------------------------------------------------------------------- -// -void CFileManagerViewBase::SortMenuFilteringL( CEikMenuPane& aMenuPane ) - { - TInt selected( EFileManagerSortByName ); - switch ( iEngine.SortMethod() ) - { - case CFileManagerEngine::EByMatch: - { - if ( iEngine.State() == CFileManagerEngine::ESearch ) - { - selected = EFileManagerSortByMatch; - } - break; - } - case CFileManagerEngine::EByName: - { - selected = EFileManagerSortByName; - break; - } - case CFileManagerEngine::EByType: - { - selected = EFileManagerSortByType; - break; - } - case CFileManagerEngine::EMostRecentFirst: - { - selected = EFileManagerSortMostRecentFirst; - break; - } - case CFileManagerEngine::ELargestFirst: - { - selected = EFileManagerSortLargestFirst; - break; - } - default: - { - break; - } - } - TInt position = 0; - if ( aMenuPane.MenuItemExists( selected, position ) ) - { - aMenuPane.SetItemButtonState( selected, EEikMenuItemSymbolOn ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerViewBase::CmdSortL -// -// ---------------------------------------------------------------------------- -// -void CFileManagerViewBase::CmdSortL( TInt aCommand ) - { - CFileManagerEngine::TSortMethod sortMethod( CFileManagerEngine::EByName ); - switch ( aCommand ) - { - case EFileManagerSortByName: - { - sortMethod = CFileManagerEngine::EByName; - break; - } - case EFileManagerSortByType: - { - sortMethod = CFileManagerEngine::EByType; - break; - } - case EFileManagerSortMostRecentFirst: - { - sortMethod = CFileManagerEngine::EMostRecentFirst; - break; - } - case EFileManagerSortLargestFirst: - { - sortMethod = CFileManagerEngine::ELargestFirst; - break; - } - case EFileManagerSortByMatch: - { - sortMethod = CFileManagerEngine::EByMatch; - break; - } - default: - { - return; - } - } - if ( iEngine.SortMethod() != sortMethod ) - { - iIndex = 0; - if ( iContainer ) - { - iContainer->SetCurrentItemIndexAfterSearch( 0 ); - } - iEngine.SetCurrentIndex( 0 ); - iEngine.SetSortMethod( sortMethod ); - iEngine.RefreshSort(); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::FeatureManager -// -// ----------------------------------------------------------------------------- -// -CFileManagerFeatureManager& CFileManagerViewBase::FeatureManager() const - { - return iEngine.FeatureManager(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::NotifyForegroundStatusChange -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::NotifyForegroundStatusChange( TBool /*aForeground*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::ShowDiskSpaceErrorL -// -// ----------------------------------------------------------------------------- -// -#ifdef RD_MULTIPLE_DRIVE - -void CFileManagerViewBase::ShowDiskSpaceErrorL( const TDesC& aFolder ) - { - TInt defaultNameResId( 0 ); - TInt namedResId( 0 ); - TInt drv( KErrNotFound ); - if ( aFolder.Length() ) - { - TFileManagerDriveInfo drvInfo; - drv = TDriveUnit( aFolder ); - iEngine.GetDriveInfoL( drv, drvInfo ); - if ( drvInfo.iState & TFileManagerDriveInfo::EDriveMassStorage ) - { - defaultNameResId = R_QTN_MEMLO_NOT_ENOUGH_MASS_MEMORY; - } - else if ( drvInfo.iState & TFileManagerDriveInfo::EDriveUsbMemory ) - { - defaultNameResId = R_QTN_MEMLO_NOT_ENOUGH_MEMORY_CARD_NAME; - namedResId = R_QTN_MEMLO_NOT_ENOUGH_MEMORY_CARD_NAME; - } - else if ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemovable ) - { - defaultNameResId = R_QTN_MEMLO_NOT_ENOUGH_MEMORY_CARD_DEFAULTNAME; - namedResId = R_QTN_MEMLO_NOT_ENOUGH_MEMORY_CARD_NAME; - } - else if ( !( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) ) - { - defaultNameResId = R_QTN_MEMLO_NOT_ENOUGH_DEVICE_MEMORY; - } - } - if ( defaultNameResId ) - { - HBufC* text = iEngine.GetFormattedDriveNameLC( - drv, defaultNameResId, namedResId ); - FileManagerDlgUtils::ShowConfirmQueryWithOkL( - FileManagerDlgUtils::EErrorIcons, *text ); - CleanupStack::PopAndDestroy( text ); - } - else - { - Error( KErrDiskFull ); // Show general error - } - } - -#else // RD_MULTIPLE_DRIVE - -void CFileManagerViewBase::ShowDiskSpaceErrorL( const TDesC& /*aFolder*/ ) - { - Error( KErrDiskFull ); // Show general error - } - -#endif // RD_MULTIPLE_DRIVE - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::DoLaunchProgressDialogAsync -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::DoLaunchProgressDialogAsync() - { - // Store the bytes value to be restored after new launch - TInt64 prevBytes = iTotalTransferredBytes; - - // Ensure that current progress value is up to date - if ( iTotalTransferredBytes > iProgressCurrentValue && - iTotalTransferredBytes <= iProgressFinalValue ) - { - iProgressCurrentValue = iTotalTransferredBytes; - } - - TRAP_IGNORE( LaunchProgressDialogL( - iProgressFinalValue, iProgressCurrentValue, iActiveProcess, ETrue ) ); - - iTotalTransferredBytes = prevBytes; - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::LaunchProgressDialogAsync -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerViewBase::LaunchProgressDialogAsync( TAny* aPtr ) - { - static_cast< CFileManagerViewBase* >( aPtr )->DoLaunchProgressDialogAsync(); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::FilesCountInSearchField() -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerViewBase::FilesCountInSearchField() - { - TInt count = 0; - - if( iContainer->IsSearchFieldVisible() ) - { - TInt listBoxIndex =0; - for(TInt i(0); iListBoxNumberOfItems();i++ ) - { - listBoxIndex = iContainer->SearchFieldToListBoxIndex( i ); - if( !iEngine.IsFolder( listBoxIndex ) ) - { - count++; - } - } - } - return count; - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::HandleServerAppExit -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::HandleServerAppExit( TInt /*aReason*/ ) - { - iEngine.SetAppExitOb( NULL ); - iEngine.SetObserver( this ); - iEngine.RefreshDirectory(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::EmptyPwd -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::EmptyPwd( TDes& aPwd ) - { - aPwd.FillZ( aPwd.MaxLength( ) ); - aPwd.Zero(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerViewBase::ConvertCharsToPwd -// -// ----------------------------------------------------------------------------- -// -void CFileManagerViewBase::ConvertCharsToPwd( - const TDesC& aWord, TDes8& aConverted ) - { - // Make sure the target password is empty ( can't use the function here ) - aConverted.FillZ( aConverted.MaxLength() ); - aConverted.Zero(); - TInt size( aWord.Size() ); - if ( size ) - { - if ( size > aConverted.MaxLength() ) - { - size = aConverted.MaxLength(); - } - aConverted.Copy( (TUint8*)aWord.Ptr(), size ); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerViewBase::DriveInfoAtCurrentPosL -// -// ------------------------------------------------------------------------------ -// -TInt CFileManagerViewBase::DriveInfoAtCurrentPosL( - TFileManagerDriveInfo& aInfo ) - { - TUid viewId( Id() ); - if ( viewId == CFileManagerAppUi::KFileManagerMemoryStoreViewId || - viewId == CFileManagerAppUi::KFileManagerFoldersViewId ) - { - INFO_LOG1("CFileManagerViewBase::DriveInfoAtCurrentPosL viewId=%D", viewId.iUid) - // Use cached info - aInfo = DriveInfo(); - return aInfo.iDrive; - } - - // Fetch info - if ( !iContainer ) - { - return KErrNotFound; - } - if ( !iContainer->ListBoxNumberOfItems() ) - { - return KErrNotFound; - } - CFileManagerItemProperties* prop = iEngine.GetItemInfoLC( - iContainer->ListBoxCurrentItemIndex() ); - TInt ret( KErrNotFound ); - TPtrC fullPath( prop->FullPath() ); - if ( fullPath.Length() ) - { - ret = TDriveUnit( fullPath ); - iEngine.GetDriveInfoL( ret, aInfo ); - } - CleanupStack::PopAndDestroy( prop ); - return ret; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/App/src/Cfilemanagersearchresultsview.cpp --- a/filemanager/App/src/Cfilemanagersearchresultsview.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,239 +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: View for search results -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include "Cfilemanagersearchresultsview.h" -#include "CFileManagerAppUi.h" -#include "CFileManagerFileListContainer.h" -#include "CFileManagerAppUi.h" -#include "CFileManagerDocument.h" -#include "FileManager.hrh" - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerSearchResultsView::CFileManagerSearchResultsView -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerSearchResultsView::CFileManagerSearchResultsView() - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerSearchResultsView::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CFileManagerSearchResultsView::ConstructL() - { - CFileManagerViewBase::ConstructL( R_FILEMANAGER_FOLDERS_VIEW ); - - CEikStatusPane* sp = StatusPane(); - iNaviPane = static_cast< CAknNavigationControlContainer* > - ( sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerSearchResultsView::NewLC -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CFileManagerSearchResultsView* CFileManagerSearchResultsView::NewLC() - { - CFileManagerSearchResultsView* self = - new( ELeave ) CFileManagerSearchResultsView; - - CleanupStack::PushL( self ); - self->ConstructL(); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerSearchResultsView::~CFileManagerSearchResultsView -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerSearchResultsView::~CFileManagerSearchResultsView() - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerSearchResultsView::DirectoryChangedL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerSearchResultsView::DirectoryChangedL() - { - FUNC_LOG - - RefreshTitleL(); - - if ( iContainer ) - { - iContainer->RefreshListL( iIndex ); - UpdateCbaL(); - } - } -// ----------------------------------------------------------------------------- -// CFileManagerSearchResultsView::Id -// -// ----------------------------------------------------------------------------- -// -TUid CFileManagerSearchResultsView::Id() const - { - return CFileManagerAppUi::KFileManagerSearchResultsViewId; - } - -// ----------------------------------------------------------------------------- -// CFileManagerSearchResultsView::CreateContainerL -// -// ----------------------------------------------------------------------------- -// -CFileManagerContainerBase* CFileManagerSearchResultsView::CreateContainerL() - { - return CFileManagerFileListContainer::NewL( - ClientRect(), - iIndex, - CFileManagerFileListContainer::EListFolder, - R_QTN_FMGR_SEARCH_NOT_FOUND, - KFMGR_HLP_SEARCH_RESULTS ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerSearchResultsView::DoActivateL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerSearchResultsView::DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ) - { - FUNC_LOG - - CFileManagerViewBase::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); - - iEngine.SetState( CFileManagerEngine::ESearch ); - iNaviPane->PushDefaultL( ETrue ); - iNaviDecorator = iNaviPane->Top(); - iEngine.SetObserver( this ); - - if ( !aCustomMessage.Compare( KFileManagerSearchViewRefreshMsg ) ) - { - // Start new search only if explicitly requested - iIndex = 0; - RefreshTitleL(); - iEngine.RefreshDirectory(); - } - else - { - // Update list without new search - DirectoryChangedL(); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerSearchResultsView::DoDeactivate -// -// ----------------------------------------------------------------------------- -// -void CFileManagerSearchResultsView::DoDeactivate() - { - FUNC_LOG - - CFileManagerViewBase::DoDeactivate(); - - iNaviPane->Pop( iNaviDecorator ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerSearchResultsView::HandleCommandL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerSearchResultsView::HandleCommandL( TInt aCommand ) - { - switch( aCommand ) - { - case EFileManagerOpen: - { - StoreIndex(); - CFileManagerViewBase::CmdOpenL(); - break; - } - case EAknSoftkeyBack: - { - CmdBackL(); - break; - } - default: - { - CFileManagerViewBase::HandleCommandL( aCommand ); - break; - } - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerSearchResultsView::UpdateCbaL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerSearchResultsView::UpdateCbaL() - { - UpdateCommonCbaL(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerSearchResultsView::CmdBackL -// ---------------------------------------------------------------------------- -// -void CFileManagerSearchResultsView::CmdBackL() - { - if ( iActiveProcess != ENoProcess ) - { - return; // Ignore to avoid container mess up - } - iIndex = 0; - static_cast< CFileManagerAppUi* >( AppUi() )->CloseSearchResultsViewL(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerSearchResultsView::RefreshTitleL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerSearchResultsView::RefreshTitleL() - { - static_cast< CFileManagerAppUi* >( AppUi() )->SetTitleL( - iEngine.SearchString() ); - iNaviPane->DrawDeferred(); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/BWINS/FILEMANAGERENGINEU.DEF --- a/filemanager/BWINS/FILEMANAGERENGINEU.DEF Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,141 +0,0 @@ -EXPORTS - ??0TFileManagerDriveInfo@@QAE@XZ @ 1 NONAME ; TFileManagerDriveInfo::TFileManagerDriveInfo(void) - ??1CFileManagerActiveDelete@@UAE@XZ @ 2 NONAME ; CFileManagerActiveDelete::~CFileManagerActiveDelete(void) - ??1CFileManagerActiveExecute@@UAE@XZ @ 3 NONAME ; CFileManagerActiveExecute::~CFileManagerActiveExecute(void) - ??1CFileManagerEngine@@UAE@XZ @ 4 NONAME ; CFileManagerEngine::~CFileManagerEngine(void) - ??1CFileManagerIRReceiver@@UAE@XZ @ 5 NONAME ; CFileManagerIRReceiver::~CFileManagerIRReceiver(void) - ??1CFileManagerItemProperties@@UAE@XZ @ 6 NONAME ; CFileManagerItemProperties::~CFileManagerItemProperties(void) - ?AllowedDriveAttMatchMask@CFileManagerBackupSettings@@QBEKXZ @ 7 NONAME ; unsigned long CFileManagerBackupSettings::AllowedDriveAttMatchMask(void) const - ?AnyEjectableDrivePresent@CFileManagerEngine@@QBEHXZ @ 8 NONAME ; int CFileManagerEngine::AnyEjectableDrivePresent(void) const - ?BackstepL@CFileManagerEngine@@QAEXXZ @ 9 NONAME ; void CFileManagerEngine::BackstepL(void) - ?BackupSettingsL@CFileManagerEngine@@QAEAAVCFileManagerBackupSettings@@XZ @ 10 NONAME ; class CFileManagerBackupSettings & CFileManagerEngine::BackupSettingsL(void) - ?CancelExecution@CFileManagerActiveExecute@@QAEXXZ @ 11 NONAME ; void CFileManagerActiveExecute::CancelExecution(void) - ?CancelProcess@CFileManagerEngine@@QAEXW4TFileManagerProcess@MFileManagerProcessObserver@@@Z @ 12 NONAME ; void CFileManagerEngine::CancelProcess(enum MFileManagerProcessObserver::TFileManagerProcess) - ?CancelRefresh@CFileManagerEngine@@QAEHXZ @ 13 NONAME ; int CFileManagerEngine::CancelRefresh(void) - ?ContainsAnyFilesOrFolders@CFileManagerItemProperties@@QAEHXZ @ 14 NONAME ; int CFileManagerItemProperties::ContainsAnyFilesOrFolders(void) - ?Content@CFileManagerBackupSettings@@QBEKXZ @ 15 NONAME ; unsigned long CFileManagerBackupSettings::Content(void) const - ?CreateActiveDeleteL@CFileManagerEngine@@QAEPAVCFileManagerActiveDelete@@AAV?$CArrayFixFlat@H@@@Z @ 16 NONAME ; class CFileManagerActiveDelete * CFileManagerEngine::CreateActiveDeleteL(class CArrayFixFlat &) - ?CurrentDirectory@CFileManagerEngine@@QBE?AVTPtrC16@@XZ @ 17 NONAME ; class TPtrC16 CFileManagerEngine::CurrentDirectory(void) const - ?CurrentDrive@CFileManagerEngine@@QAEHXZ @ 18 NONAME ; int CFileManagerEngine::CurrentDrive(void) - ?CurrentDriveName@CFileManagerEngine@@QAE?AVTPtrC16@@XZ @ 19 NONAME ; class TPtrC16 CFileManagerEngine::CurrentDriveName(void) - ?CurrentIndex@CFileManagerEngine@@QAEHXZ @ 20 NONAME ; int CFileManagerEngine::CurrentIndex(void) - ?Day@CFileManagerBackupSettings@@QBEHXZ @ 21 NONAME ; int CFileManagerBackupSettings::Day(void) const - ?DeleteRemoteDrive@CFileManagerEngine@@QAEHH@Z @ 22 NONAME ; int CFileManagerEngine::DeleteRemoteDrive(int) - ?DeletedDrmItems@CFileManagerActiveDelete@@QAEHAAH@Z @ 23 NONAME ; int CFileManagerActiveDelete::DeletedDrmItems(int &) - ?DriveId@CFileManagerItemProperties@@QBEHXZ @ 24 NONAME ; int CFileManagerItemProperties::DriveId(void) const - ?DriveName@CFileManagerEngine@@QAE?AVTPtrC16@@H@Z @ 25 NONAME ; class TPtrC16 CFileManagerEngine::DriveName(int) - ?DriveName@CFileManagerItemProperties@@QBE?AVTPtrC16@@XZ @ 26 NONAME ; class TPtrC16 CFileManagerItemProperties::DriveName(void) const - ?DriveRootDirectory@CFileManagerEngine@@QBE?AVTPtrC16@@H@Z @ 27 NONAME ; class TPtrC16 CFileManagerEngine::DriveRootDirectory(int) const - ?DriveState@CFileManagerEngine@@QBEHAAKABVTDesC16@@@Z @ 28 NONAME ; int CFileManagerEngine::DriveState(unsigned long &, class TDesC16 const &) const - ?DriveState@CFileManagerEngine@@QBEHAAKH@Z @ 29 NONAME ; int CFileManagerEngine::DriveState(unsigned long &, int) const - ?EnoughSpaceL@CFileManagerEngine@@QBEHABVTDesC16@@_JW4TFileManagerProcess@MFileManagerProcessObserver@@@Z @ 30 NONAME ; int CFileManagerEngine::EnoughSpaceL(class TDesC16 const &, long long, enum MFileManagerProcessObserver::TFileManagerProcess) const - ?EnsureFinalBackslash@CFileManagerUtils@@SAXAAVTDes16@@@Z @ 31 NONAME ; void CFileManagerUtils::EnsureFinalBackslash(class TDes16 &) - ?ExecuteL@CFileManagerActiveExecute@@QAEXW4TFileManagerSwitch@1@@Z @ 32 NONAME ; void CFileManagerActiveExecute::ExecuteL(enum CFileManagerActiveExecute::TFileManagerSwitch) - ?Ext@CFileManagerItemProperties@@QBE?AVTPtrC16@@XZ @ 33 NONAME ; class TPtrC16 CFileManagerItemProperties::Ext(void) const - ?FeatureManager@CFileManagerEngine@@QBEAAVCFileManagerFeatureManager@@XZ @ 34 NONAME ; class CFileManagerFeatureManager & CFileManagerEngine::FeatureManager(void) const - ?FileList@CFileManagerEngine@@QBEPAVMDesC16Array@@XZ @ 35 NONAME ; class MDesC16Array * CFileManagerEngine::FileList(void) const - ?FileSystemEvent@CFileManagerEngine@@QAEXH@Z @ 36 NONAME ; void CFileManagerEngine::FileSystemEvent(int) - ?FileTypeL@CFileManagerEngine@@QBEKABVTDesC16@@@Z @ 37 NONAME ; unsigned long CFileManagerEngine::FileTypeL(class TDesC16 const &) const - ?FileTypeL@CFileManagerEngine@@QBEKH@Z @ 38 NONAME ; unsigned long CFileManagerEngine::FileTypeL(int) const - ?FilesContainedL@CFileManagerItemProperties@@QAEHXZ @ 39 NONAME ; int CFileManagerItemProperties::FilesContainedL(void) - ?FilesInFolderL@CFileManagerEngine@@QAEHXZ @ 40 NONAME ; int CFileManagerEngine::FilesInFolderL(void) - ?FolderLevel@CFileManagerEngine@@QAEHXZ @ 41 NONAME ; int CFileManagerEngine::FolderLevel(void) - ?FoldersContainedL@CFileManagerItemProperties@@QAEHXZ @ 42 NONAME ; int CFileManagerItemProperties::FoldersContainedL(void) - ?ForcedRefreshDirectory@CFileManagerEngine@@QAEXXZ @ 43 NONAME ; void CFileManagerEngine::ForcedRefreshDirectory(void) - ?FullPath@CFileManagerItemProperties@@QBE?AVTPtrC16@@XZ @ 44 NONAME ; class TPtrC16 CFileManagerItemProperties::FullPath(void) const - ?GetDriveInfoL@CFileManagerEngine@@QAEXAAVTFileManagerDriveInfo@@@Z @ 45 NONAME ; void CFileManagerEngine::GetDriveInfoL(class TFileManagerDriveInfo &) - ?GetDriveInfoL@CFileManagerEngine@@QBEXHAAVTFileManagerDriveInfo@@@Z @ 46 NONAME ; void CFileManagerEngine::GetDriveInfoL(int, class TFileManagerDriveInfo &) const - ?GetError@CFileManagerActiveDelete@@QAEHAAVTDes16@@@Z @ 47 NONAME ; int CFileManagerActiveDelete::GetError(class TDes16 &) - ?GetFileSizesL@CFileManagerEngine@@QAE_JABV?$CArrayFixFlat@H@@@Z @ 48 NONAME ; long long CFileManagerEngine::GetFileSizesL(class CArrayFixFlat const &) - ?GetFormattedDriveNameLC@CFileManagerEngine@@QBEPAVHBufC16@@HHH@Z @ 49 NONAME ; class HBufC16 * CFileManagerEngine::GetFormattedDriveNameLC(int, int, int) const - ?GetItemInfoL@CFileManagerEngine@@QAEPAVCFileManagerItemProperties@@H@Z @ 50 NONAME ; class CFileManagerItemProperties * CFileManagerEngine::GetItemInfoL(int) - ?GetItemInfoLC@CFileManagerEngine@@QAEPAVCFileManagerItemProperties@@H@Z @ 51 NONAME ; class CFileManagerItemProperties * CFileManagerEngine::GetItemInfoLC(int) - ?GetMMCInfoL@CFileManagerEngine@@QBE?AVTFileManagerDriveInfo@@XZ @ 52 NONAME ; class TFileManagerDriveInfo CFileManagerEngine::GetMMCInfoL(void) const - ?GetRestoreInfoArrayL@CFileManagerEngine@@QBEXAAV?$RArray@VTInfo@CFileManagerRestoreSettings@@@@H@Z @ 53 NONAME ; void CFileManagerEngine::GetRestoreInfoArrayL(class RArray &, int) const - ?HasFinalBackslash@CFileManagerUtils@@SAHABVTDesC16@@@Z @ 54 NONAME ; int CFileManagerUtils::HasFinalBackslash(class TDesC16 const &) - ?IconIdL@CFileManagerEngine@@QBEHH@Z @ 55 NONAME ; int CFileManagerEngine::IconIdL(int) const - ?IllegalChars@CFileManagerEngine@@QBEHABVTDesC16@@@Z @ 56 NONAME ; int CFileManagerEngine::IllegalChars(class TDesC16 const &) const - ?IndexToFullPathL@CFileManagerEngine@@QBEPAVHBufC16@@H@Z @ 57 NONAME ; class HBufC16 * CFileManagerEngine::IndexToFullPathL(int) const - ?IndexToFullPathLC@CFileManagerEngine@@QBEPAVHBufC16@@H@Z @ 58 NONAME ; class HBufC16 * CFileManagerEngine::IndexToFullPathLC(int) const - ?IsDistributableFile@CFileManagerEngine@@QBEHABVTDesC16@@AAH@Z @ 59 NONAME ; int CFileManagerEngine::IsDistributableFile(class TDesC16 const &, int &) const - ?IsDrive@CFileManagerItemProperties@@QBEHXZ @ 60 NONAME ; int CFileManagerItemProperties::IsDrive(void) const - ?IsDrmFullSupported@CFileManagerFeatureManager@@QBEHXZ @ 61 NONAME ; int CFileManagerFeatureManager::IsDrmFullSupported(void) const - ?IsFeatureSupported@CFileManagerFeatureManager@@QBEHH@Z @ 62 NONAME ; int CFileManagerFeatureManager::IsFeatureSupported(int) const - ?IsFolder@CFileManagerEngine@@QBEHH@Z @ 63 NONAME ; int CFileManagerEngine::IsFolder(int) const - ?IsFromInternalToRemovableDrive@CFileManagerUtils@@SAHAAVRFs@@ABVTDesC16@@1@Z @ 64 NONAME ; int CFileManagerUtils::IsFromInternalToRemovableDrive(class RFs &, class TDesC16 const &, class TDesC16 const &) - ?IsHelpSupported@CFileManagerFeatureManager@@QBEHXZ @ 65 NONAME ; int CFileManagerFeatureManager::IsHelpSupported(void) const - ?IsIrdaSupported@CFileManagerFeatureManager@@QBEHXZ @ 66 NONAME ; int CFileManagerFeatureManager::IsIrdaSupported(void) const - ?IsMmcPassWdSupported@CFileManagerFeatureManager@@QBEHXZ @ 67 NONAME ; int CFileManagerFeatureManager::IsMmcPassWdSupported(void) const - ?IsMmcSwEjectSupported@CFileManagerFeatureManager@@QBEHXZ @ 68 NONAME ; int CFileManagerFeatureManager::IsMmcSwEjectSupported(void) const - ?IsNameFoundL@CFileManagerEngine@@QAEHABVTDesC16@@@Z @ 69 NONAME ; int CFileManagerEngine::IsNameFoundL(class TDesC16 const &) - ?IsRemoteDrive@CFileManagerItemProperties@@QBEHXZ @ 70 NONAME ; int CFileManagerItemProperties::IsRemoteDrive(void) const - ?IsRemoteDrive@CFileManagerUtils@@SAHAAVRFs@@ABVTDesC16@@@Z @ 71 NONAME ; int CFileManagerUtils::IsRemoteDrive(class RFs &, class TDesC16 const &) - ?IsRemoteStorageFwSupported@CFileManagerFeatureManager@@QBEHXZ @ 72 NONAME ; int CFileManagerFeatureManager::IsRemoteStorageFwSupported(void) const - ?IsSystemFolder@CFileManagerEngine@@QBEHABVTDesC16@@@Z @ 73 NONAME ; int CFileManagerEngine::IsSystemFolder(class TDesC16 const &) const - ?IsValidName@CFileManagerEngine@@QBEHABVTDesC16@@0H@Z @ 74 NONAME ; int CFileManagerEngine::IsValidName(class TDesC16 const &, class TDesC16 const &, int) const - ?IsWesternVariant@CFileManagerFeatureManager@@QBEHXZ @ 75 NONAME ; int CFileManagerFeatureManager::IsWesternVariant(void) const - ?LocalizedName@CFileManagerEngine@@QBE?AVTPtrC16@@ABVTDesC16@@@Z @ 76 NONAME ; class TPtrC16 CFileManagerEngine::LocalizedName(class TDesC16 const &) const - ?LocalizedName@CFileManagerItemProperties@@QBE?AVTPtrC16@@XZ @ 77 NONAME ; class TPtrC16 CFileManagerItemProperties::LocalizedName(void) const - ?LocalizedNameOfCurrentDirectory@CFileManagerEngine@@QBE?AVTPtrC16@@XZ @ 78 NONAME ; class TPtrC16 CFileManagerEngine::LocalizedNameOfCurrentDirectory(void) const - ?Memory@CFileManagerEngine@@QBE?AW4TFileManagerMemory@@XZ @ 79 NONAME ; enum TFileManagerMemory CFileManagerEngine::Memory(void) const - ?MimeTypeL@CFileManagerItemProperties@@QAE?AVTPtrC16@@XZ @ 80 NONAME ; class TPtrC16 CFileManagerItemProperties::MimeTypeL(void) - ?ModifiedDate@CFileManagerItemProperties@@QBE?AVTTime@@XZ @ 81 NONAME ; class TTime CFileManagerItemProperties::ModifiedDate(void) const - ?ModifiedLocalDate@CFileManagerItemProperties@@QBEHAAVTTime@@@Z @ 82 NONAME ; int CFileManagerItemProperties::ModifiedLocalDate(class TTime &) const - ?Name@CFileManagerItemProperties@@QBE?AVTPtrC16@@XZ @ 83 NONAME ; class TPtrC16 CFileManagerItemProperties::Name(void) const - ?NameAndExt@CFileManagerItemProperties@@QBE?AVTPtrC16@@XZ @ 84 NONAME ; class TPtrC16 CFileManagerItemProperties::NameAndExt(void) const - ?NavigationLevel@CFileManagerEngine@@QBEHXZ @ 85 NONAME ; int CFileManagerEngine::NavigationLevel(void) const - ?NewFolderL@CFileManagerEngine@@QAEXABVTDesC16@@@Z @ 86 NONAME ; void CFileManagerEngine::NewFolderL(class TDesC16 const &) - ?NewL@CFileManagerActiveExecute@@SAPAV1@AAVCFileManagerEngine@@W4TFileManagerProcess@MFileManagerProcessObserver@@AAV4@AAV?$CArrayFixFlat@H@@ABVTDesC16@@@Z @ 87 NONAME ; class CFileManagerActiveExecute * CFileManagerActiveExecute::NewL(class CFileManagerEngine &, enum MFileManagerProcessObserver::TFileManagerProcess, class MFileManagerProcessObserver &, class CArrayFixFlat &, class TDesC16 const &) - ?NewL@CFileManagerEngine@@SAPAV1@AAVRFs@@@Z @ 88 NONAME ; class CFileManagerEngine * CFileManagerEngine::NewL(class RFs &) - ?NewL@CFileManagerIRReceiver@@SAPAV1@AAVMFileManagerProcessObserver@@ABVTDesC16@@AAVCFileManagerEngine@@@Z @ 89 NONAME ; class CFileManagerIRReceiver * CFileManagerIRReceiver::NewL(class MFileManagerProcessObserver &, class TDesC16 const &, class CFileManagerEngine &) - ?OpenFilesL@CFileManagerItemProperties@@QAEHXZ @ 90 NONAME ; int CFileManagerItemProperties::OpenFilesL(void) - ?OpenL@CFileManagerEngine@@QAEXH@Z @ 91 NONAME ; void CFileManagerEngine::OpenL(int) - ?ReceiveFileL@CFileManagerIRReceiver@@QAEXXZ @ 92 NONAME ; void CFileManagerIRReceiver::ReceiveFileL(void) - ?RefreshDirectory@CFileManagerEngine@@QAEXXZ @ 93 NONAME ; void CFileManagerEngine::RefreshDirectory(void) - ?RefreshL@CFileManagerBackupSettings@@QAEXXZ @ 94 NONAME ; void CFileManagerBackupSettings::RefreshL(void) - ?RefreshL@CFileManagerRestoreSettings@@QAEXXZ @ 95 NONAME ; void CFileManagerRestoreSettings::RefreshL(void) - ?RefreshSort@CFileManagerEngine@@QAEXXZ @ 96 NONAME ; void CFileManagerEngine::RefreshSort(void) - ?RemoveDrivePassword@CFileManagerEngine@@QAEHHABV?$TBuf8@$0BA@@@@Z @ 97 NONAME ; int CFileManagerEngine::RemoveDrivePassword(int, class TBuf8<16> const &) - ?RenameDrive@CFileManagerEngine@@QAEHHABVTDesC16@@@Z @ 98 NONAME ; int CFileManagerEngine::RenameDrive(int, class TDesC16 const &) - ?RenameL@CFileManagerEngine@@QAEXHABVTDesC16@@@Z @ 99 NONAME ; void CFileManagerEngine::RenameL(int, class TDesC16 const &) - ?Reset@TFileManagerDriveInfo@@QAEXXZ @ 100 NONAME ; void TFileManagerDriveInfo::Reset(void) - ?RestoreSettingsL@CFileManagerEngine@@QAEAAVCFileManagerRestoreSettings@@XZ @ 101 NONAME ; class CFileManagerRestoreSettings & CFileManagerEngine::RestoreSettingsL(void) - ?SaveL@CFileManagerBackupSettings@@QAEXXZ @ 102 NONAME ; void CFileManagerBackupSettings::SaveL(void) - ?Scheduling@CFileManagerBackupSettings@@QBEHXZ @ 103 NONAME ; int CFileManagerBackupSettings::Scheduling(void) const - ?SearchString@CFileManagerEngine@@QBE?AVTPtrC16@@XZ @ 104 NONAME ; class TPtrC16 CFileManagerEngine::SearchString(void) const - ?SetContent@CFileManagerBackupSettings@@QAEXK@Z @ 105 NONAME ; void CFileManagerBackupSettings::SetContent(unsigned long) - ?SetCurrentIndex@CFileManagerEngine@@QAEXH@Z @ 106 NONAME ; void CFileManagerEngine::SetCurrentIndex(int) - ?SetDay@CFileManagerBackupSettings@@QAEXH@Z @ 107 NONAME ; void CFileManagerBackupSettings::SetDay(int) - ?SetDirectoryWithBackstepsL@CFileManagerEngine@@QAEXABVTDesC16@@@Z @ 108 NONAME ; void CFileManagerEngine::SetDirectoryWithBackstepsL(class TDesC16 const &) - ?SetDrivePassword@CFileManagerEngine@@QAEHHABV?$TBuf8@$0BA@@@0@Z @ 109 NONAME ; int CFileManagerEngine::SetDrivePassword(int, class TBuf8<16> const &, class TBuf8<16> const &) - ?SetMemoryL@CFileManagerEngine@@QAEHW4TFileManagerMemory@@@Z @ 110 NONAME ; int CFileManagerEngine::SetMemoryL(enum TFileManagerMemory) - ?SetObserver@CFileManagerEngine@@QAEXPAVMFileManagerProcessObserver@@@Z @ 111 NONAME ; void CFileManagerEngine::SetObserver(class MFileManagerProcessObserver *) - ?SetRemoteDriveConnection@CFileManagerEngine@@QAEHHH@Z @ 112 NONAME ; int CFileManagerEngine::SetRemoteDriveConnection(int, int) - ?SetScheduling@CFileManagerBackupSettings@@QAEXH@Z @ 113 NONAME ; void CFileManagerBackupSettings::SetScheduling(int) - ?SetSearchFolderL@CFileManagerEngine@@QAEXABVTDesC16@@@Z @ 114 NONAME ; void CFileManagerEngine::SetSearchFolderL(class TDesC16 const &) - ?SetSearchStringL@CFileManagerEngine@@QAEXABVTDesC16@@@Z @ 115 NONAME ; void CFileManagerEngine::SetSearchStringL(class TDesC16 const &) - ?SetSelection@CFileManagerRestoreSettings@@QAEXAB_K@Z @ 116 NONAME ; void CFileManagerRestoreSettings::SetSelection(unsigned long long const &) - ?SetSortMethod@CFileManagerEngine@@QAEXW4TSortMethod@1@@Z @ 117 NONAME ; void CFileManagerEngine::SetSortMethod(enum CFileManagerEngine::TSortMethod) - ?SetState@CFileManagerEngine@@QAEXW4TState@1@@Z @ 118 NONAME ; void CFileManagerEngine::SetState(enum CFileManagerEngine::TState) - ?SetTargetDrive@CFileManagerBackupSettings@@QAEXH@Z @ 119 NONAME ; void CFileManagerBackupSettings::SetTargetDrive(int) - ?SetTime@CFileManagerBackupSettings@@QAEXABVTTime@@@Z @ 120 NONAME ; void CFileManagerBackupSettings::SetTime(class TTime const &) - ?SettingAt@CFileManagerBackupSettings@@QAEHH@Z @ 121 NONAME ; int CFileManagerBackupSettings::SettingAt(int) - ?SizeL@CFileManagerItemProperties@@QAE_JXZ @ 122 NONAME ; long long CFileManagerItemProperties::SizeL(void) - ?SortMethod@CFileManagerEngine@@QBE?AW4TSortMethod@1@XZ @ 123 NONAME ; enum CFileManagerEngine::TSortMethod CFileManagerEngine::SortMethod(void) const - ?StartBackupProcessL@CFileManagerEngine@@QAEXW4TFileManagerProcess@MFileManagerProcessObserver@@@Z @ 124 NONAME ; void CFileManagerEngine::StartBackupProcessL(enum MFileManagerProcessObserver::TFileManagerProcess) - ?StartEjectProcessL@CFileManagerEngine@@QAEXH@Z @ 125 NONAME ; void CFileManagerEngine::StartEjectProcessL(int) - ?StartFormatProcessL@CFileManagerEngine@@QAEXH@Z @ 126 NONAME ; void CFileManagerEngine::StartFormatProcessL(int) - ?State@CFileManagerEngine@@QBE?AW4TState@1@XZ @ 127 NONAME ; enum CFileManagerEngine::TState CFileManagerEngine::State(void) const - ?StopReceiving@CFileManagerIRReceiver@@QAEXXZ @ 128 NONAME ; void CFileManagerIRReceiver::StopReceiving(void) - ?StripFinalBackslash@CFileManagerUtils@@SA?AVTPtrC16@@ABVTDesC16@@@Z @ 129 NONAME ; class TPtrC16 CFileManagerUtils::StripFinalBackslash(class TDesC16 const &) - ?TargetDrive@CFileManagerBackupSettings@@QBEHXZ @ 130 NONAME ; int CFileManagerBackupSettings::TargetDrive(void) const - ?Time@CFileManagerBackupSettings@@QBEABVTTime@@XZ @ 131 NONAME ; class TTime const & CFileManagerBackupSettings::Time(void) const - ?TypeL@CFileManagerItemProperties@@QAEKXZ @ 132 NONAME ; unsigned long CFileManagerItemProperties::TypeL(void) - ?UnlockDrive@CFileManagerEngine@@QAEHHABV?$TBuf8@$0BA@@@@Z @ 133 NONAME ; int CFileManagerEngine::UnlockDrive(int, class TBuf8<16> const &) - ?IsEmbedded@CFileManagerFeatureManager@@QBEHXZ @ 134 NONAME ; int CFileManagerFeatureManager::IsEmbedded(void) const - ?ToFolder@CFileManagerActiveExecute@@QAE?AVTPtrC16@@XZ @ 135 NONAME ; class TPtrC16 CFileManagerActiveExecute::ToFolder(void) - ?SetCurrentItemName@CFileManagerEngine@@QAEXABVTDesC16@@@Z @ 136 NONAME ; void CFileManagerEngine::SetCurrentItemName(class TDesC16 const &) - ?SetAppExitOb@CFileManagerEngine@@QAEXPAVMAknServerAppExitObserver@@@Z @ 137 NONAME ; void CFileManagerEngine::SetAppExitOb(class MAknServerAppExitObserver *) - ?DeleteBackupsL@CFileManagerEngine@@QAEXXZ @ 138 NONAME ; void CFileManagerEngine::DeleteBackupsL(void) - ?IsDriverMounted@CFileManagerEngine@@QAEHH@Z @ 139 NONAME ; int CFileManagerEngine::IsDriverMounted(int) - diff -r 95243422089a -r 491b3ed49290 filemanager/BWINS/FILEMANAGERVIEWU.DEF --- a/filemanager/BWINS/FILEMANAGERVIEWU.DEF Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -EXPORTS - ??1CFileManagerFolderNavigationPane@@UAE@XZ @ 1 NONAME ; CFileManagerFolderNavigationPane::~CFileManagerFolderNavigationPane(void) - ??1CFileManagerGlobalDlg@@UAE@XZ @ 2 NONAME ; CFileManagerGlobalDlg::~CFileManagerGlobalDlg(void) - ??1CFileManagerIconArray@@UAE@XZ @ 3 NONAME ; CFileManagerIconArray::~CFileManagerIconArray(void) - ?CancelDialog@CFileManagerGlobalDlg@@QAEXXZ @ 4 NONAME ; void CFileManagerGlobalDlg::CancelDialog(void) - ?ChangeRootL@CFileManagerFolderNavigationPane@@QAEXH@Z @ 5 NONAME ; void CFileManagerFolderNavigationPane::ChangeRootL(int) - ?FindIcon@CFileManagerIconArray@@QAEHH@Z @ 6 NONAME ; int CFileManagerIconArray::FindIcon(int) - ?FolderDepth@CFileManagerFolderNavigationPane@@QBEHXZ @ 7 NONAME ; int CFileManagerFolderNavigationPane::FolderDepth(void) const - ?HandleResourceChangeL@CFileManagerFolderNavigationPane@@QAEXH@Z @ 8 NONAME ; void CFileManagerFolderNavigationPane::HandleResourceChangeL(int) - ?NewL@CFileManagerFolderNavigationPane@@SAPAV1@HHAAVTResourceReader@@@Z @ 9 NONAME ; class CFileManagerFolderNavigationPane * CFileManagerFolderNavigationPane::NewL(int, int, class TResourceReader &) - ?NewL@CFileManagerGlobalDlg@@SAPAV1@XZ @ 10 NONAME ; class CFileManagerGlobalDlg * CFileManagerGlobalDlg::NewL(void) - ?NewL@CFileManagerIconArray@@SAPAV1@XZ @ 11 NONAME ; class CFileManagerIconArray * CFileManagerIconArray::NewL(void) - ?ProcessFinished@CFileManagerGlobalDlg@@QAEXXZ @ 12 NONAME ; void CFileManagerGlobalDlg::ProcessFinished(void) - ?SetFolderDepth@CFileManagerFolderNavigationPane@@QAEXH@Z @ 13 NONAME ; void CFileManagerFolderNavigationPane::SetFolderDepth(int) - ?SetObserver@CFileManagerFolderNavigationPane@@QAEXPAVMFileManagerFolderNaviObserver@@@Z @ 14 NONAME ; void CFileManagerFolderNavigationPane::SetObserver(class MFileManagerFolderNaviObserver *) - ?SetObserver@CFileManagerGlobalDlg@@QAEXPAVMFileManagerGlobalDlgObserver@@@Z @ 15 NONAME ; void CFileManagerGlobalDlg::SetObserver(class MFileManagerGlobalDlgObserver *) - ?ShowConfirmNoteL@FileManagerDlgUtils@@SAXH@Z @ 16 NONAME ; void FileManagerDlgUtils::ShowConfirmNoteL(int) - ?ShowConfirmQueryWithOkCancelL@FileManagerDlgUtils@@SAHABVTDesC16@@@Z @ 17 NONAME ; int FileManagerDlgUtils::ShowConfirmQueryWithOkCancelL(class TDesC16 const &) - ?ShowConfirmQueryWithOkCancelL@FileManagerDlgUtils@@SAHHABVTDesC16@@@Z @ 18 NONAME ; int FileManagerDlgUtils::ShowConfirmQueryWithOkCancelL(int, class TDesC16 const &) - ?ShowConfirmQueryWithOkL@FileManagerDlgUtils@@SAXW4TIcons@1@ABVTDesC16@@@Z @ 19 NONAME ; void FileManagerDlgUtils::ShowConfirmQueryWithOkL(enum FileManagerDlgUtils::TIcons, class TDesC16 const &) - ?ShowConfirmQueryWithOkL@FileManagerDlgUtils@@SAXW4TIcons@1@HABVTDesC16@@@Z @ 20 NONAME ; void FileManagerDlgUtils::ShowConfirmQueryWithOkL(enum FileManagerDlgUtils::TIcons, int, class TDesC16 const &) - ?ShowConfirmQueryWithOkL@FileManagerDlgUtils@@SAXW4TIcons@1@HH@Z @ 21 NONAME ; void FileManagerDlgUtils::ShowConfirmQueryWithOkL(enum FileManagerDlgUtils::TIcons, int, int) - ?ShowConfirmQueryWithYesNoL@FileManagerDlgUtils@@SAHABVTDesC16@@@Z @ 22 NONAME ; int FileManagerDlgUtils::ShowConfirmQueryWithYesNoL(class TDesC16 const &) - ?ShowConfirmQueryWithYesNoL@FileManagerDlgUtils@@SAHHABVTDesC16@@@Z @ 23 NONAME ; int FileManagerDlgUtils::ShowConfirmQueryWithYesNoL(int, class TDesC16 const &) - ?ShowDialogL@CFileManagerGlobalDlg@@QAEXW4TType@1@ABVTDesC16@@H@Z @ 24 NONAME ; void CFileManagerGlobalDlg::ShowDialogL(enum CFileManagerGlobalDlg::TType, class TDesC16 const &, int) - ?ShowDialogL@CFileManagerGlobalDlg@@QAEXW4TType@1@HH@Z @ 25 NONAME ; void CFileManagerGlobalDlg::ShowDialogL(enum CFileManagerGlobalDlg::TType, int, int) - ?ShowErrorNoteL@FileManagerDlgUtils@@SAXABVTDesC16@@@Z @ 26 NONAME ; void FileManagerDlgUtils::ShowErrorNoteL(class TDesC16 const &) - ?ShowErrorNoteL@FileManagerDlgUtils@@SAXHABVTDesC16@@@Z @ 27 NONAME ; void FileManagerDlgUtils::ShowErrorNoteL(int, class TDesC16 const &) - ?ShowFileNameQueryL@FileManagerDlgUtils@@SAHHABVTDesC16@@AAVTDes16@@AAVCFileManagerEngine@@@Z @ 28 NONAME ; int FileManagerDlgUtils::ShowFileNameQueryL(int, class TDesC16 const &, class TDes16 &, class CFileManagerEngine &) - ?ShowFolderNameQueryL@FileManagerDlgUtils@@SAHHAAVTDes16@@AAVCFileManagerEngine@@H@Z @ 29 NONAME ; int FileManagerDlgUtils::ShowFolderNameQueryL(int, class TDes16 &, class CFileManagerEngine &, int) - ?ShowInfoNoteL@FileManagerDlgUtils@@SAXABVTDesC16@@@Z @ 30 NONAME ; void FileManagerDlgUtils::ShowInfoNoteL(class TDesC16 const &) - ?ShowInfoNoteL@FileManagerDlgUtils@@SAXHABVTDesC16@@@Z @ 31 NONAME ; void FileManagerDlgUtils::ShowInfoNoteL(int, class TDesC16 const &) - ?ShowInfoNoteL@FileManagerDlgUtils@@SAXHH@Z @ 32 NONAME ; void FileManagerDlgUtils::ShowInfoNoteL(int, int) - ?ShowInfoQueryL@FileManagerDlgUtils@@SAXABVTDesC16@@@Z @ 33 NONAME ; void FileManagerDlgUtils::ShowInfoQueryL(class TDesC16 const &) - ?ShowInfoQueryL@FileManagerDlgUtils@@SAXHABVTDesC16@@@Z @ 34 NONAME ; void FileManagerDlgUtils::ShowInfoQueryL(int, class TDesC16 const &) - ?ShowInfoQueryL@FileManagerDlgUtils@@SAXHH@Z @ 35 NONAME ; void FileManagerDlgUtils::ShowInfoQueryL(int, int) - ?ShowItemInfoPopupL@FileManagerDlgUtils@@SAXAAVCFileManagerItemProperties@@ABVCFileManagerFeatureManager@@@Z @ 36 NONAME ; void FileManagerDlgUtils::ShowItemInfoPopupL(class CFileManagerItemProperties &, class CFileManagerFeatureManager const &) - ?ShowMemoryStoreInfoPopupL@FileManagerDlgUtils@@SAXABVTFileManagerDriveInfo@@@Z @ 37 NONAME ; void FileManagerDlgUtils::ShowMemoryStoreInfoPopupL(class TFileManagerDriveInfo const &) - ?ShowNOfMSettingQueryL@FileManagerDlgUtils@@SAHHHAAKH@Z @ 38 NONAME ; int FileManagerDlgUtils::ShowNOfMSettingQueryL(int, int, unsigned long &, int) - ?ShowOOfMSettingQueryL@FileManagerDlgUtils@@SAHHHAAH@Z @ 39 NONAME ; int FileManagerDlgUtils::ShowOOfMSettingQueryL(int, int, int &) - ?ShowOOfMSettingQueryL@FileManagerDlgUtils@@SAHHPBVMDesC16Array@@AAH@Z @ 40 NONAME ; int FileManagerDlgUtils::ShowOOfMSettingQueryL(int, class MDesC16Array const *, int &) - ?ShowPasswordQueryL@FileManagerDlgUtils@@SAHAAVTDes16@@@Z @ 41 NONAME ; int FileManagerDlgUtils::ShowPasswordQueryL(class TDes16 &) - ?ShowSimplePasswordQueryL@FileManagerDlgUtils@@SAHABVTDesC16@@AAVTDes16@@@Z @ 42 NONAME ; int FileManagerDlgUtils::ShowSimplePasswordQueryL(class TDesC16 const &, class TDes16 &) - ?ShowSimplePasswordQueryL@FileManagerDlgUtils@@SAHHAAVTDes16@@@Z @ 43 NONAME ; int FileManagerDlgUtils::ShowSimplePasswordQueryL(int, class TDes16 &) - ?ShowTimeSettingQueryL@FileManagerDlgUtils@@SAHHAAVTTime@@@Z @ 44 NONAME ; int FileManagerDlgUtils::ShowTimeSettingQueryL(int, class TTime &) - ?ShowWarningNoteL@FileManagerDlgUtils@@SAXH@Z @ 45 NONAME ; void FileManagerDlgUtils::ShowWarningNoteL(int) - ?ShowWeekdayQueryL@FileManagerDlgUtils@@SAHHAAW4TDay@@@Z @ 46 NONAME ; int FileManagerDlgUtils::ShowWeekdayQueryL(int, enum TDay &) - ?UpdateIconsL@CFileManagerIconArray@@QAEXXZ @ 47 NONAME ; void CFileManagerIconArray::UpdateIconsL(void) - ?UpdateProgressDialog@CFileManagerGlobalDlg@@QAEXHH@Z @ 48 NONAME ; void CFileManagerGlobalDlg::UpdateProgressDialog(int, int) - ?LoadIconL@CFileManagerIconArray@@SAPAVCGulIcon@@ABVTDesC16@@HHHHH@Z @ 49 NONAME ; class CGulIcon * CFileManagerIconArray::LoadIconL(class TDesC16 const &, int, int, int, int, int) - diff -r 95243422089a -r 491b3ed49290 filemanager/BWINS/GFLMU.DEF --- a/filemanager/BWINS/GFLMU.DEF Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -EXPORTS - ?BackstepL@CGflmNavigatorModel@@QAEXXZ @ 1 NONAME ; void CGflmNavigatorModel::BackstepL(void) - ?CancelRefresh@CGflmFileListModel@@QAEXXZ @ 2 NONAME ; void CGflmFileListModel::CancelRefresh(void) - ?ClearCache@CGflmFileListModel@@QAEXXZ @ 3 NONAME ; void CGflmFileListModel::ClearCache(void) - ?ClearDriveInfo@CGflmFileListModel@@QAEXXZ @ 4 NONAME ; void CGflmFileListModel::ClearDriveInfo(void) - ?CreateGroupL@CGflmFileListModel@@QAEPAVMGflmItemGroup@@H@Z @ 5 NONAME ; class MGflmItemGroup * CGflmFileListModel::CreateGroupL(int) - ?CreateGroupL@CGflmFileListModel@@QAEPAVMGflmItemGroup@@HI@Z @ 6 NONAME ; class MGflmItemGroup * CGflmFileListModel::CreateGroupL(int, unsigned int) - ?CurrentDirectory@CGflmNavigatorModel@@QBE?AVTPtrC16@@XZ @ 7 NONAME ; class TPtrC16 CGflmNavigatorModel::CurrentDirectory(void) const - ?CurrentDrive@CGflmNavigatorModel@@QBEPAVCGflmDriveItem@@XZ @ 8 NONAME ; class CGflmDriveItem * CGflmNavigatorModel::CurrentDrive(void) const - ?Drive@CGflmDriveItem@@QBEHXZ @ 9 NONAME ; int CGflmDriveItem::Drive(void) const - ?DriveFromId@CGflmFileListModel@@QBEPAVCGflmDriveItem@@H@Z @ 10 NONAME ; class CGflmDriveItem * CGflmFileListModel::DriveFromId(int) const - ?DriveFromPath@CGflmFileListModel@@QBEPAVCGflmDriveItem@@ABVTDesC16@@@Z @ 11 NONAME ; class CGflmDriveItem * CGflmFileListModel::DriveFromPath(class TDesC16 const &) const - ?DriveStatus@CGflmDriveItem@@QBEIXZ @ 12 NONAME ; unsigned int CGflmDriveItem::DriveStatus(void) const - ?EnableSearchMode@CGflmFileListModel@@QAEXH@Z @ 13 NONAME ; void CGflmFileListModel::EnableSearchMode(int) - ?EnsureFinalBackslash@GflmUtils@@SAXAAVTDes16@@@Z @ 14 NONAME ; void GflmUtils::EnsureFinalBackslash(class TDes16 &) - ?Entry@CGflmFileSystemItem@@QBEABVTEntry@@XZ @ 15 NONAME ; class TEntry const & CGflmFileSystemItem::Entry(void) const - ?FindGroupById@CGflmFileListModel@@QAEPAVMGflmItemGroup@@H@Z @ 16 NONAME ; class MGflmItemGroup * CGflmFileListModel::FindGroupById(int) - ?FullPathL@CGflmFileSystemItem@@QBEPAVHBufC16@@XZ @ 17 NONAME ; class HBufC16 * CGflmFileSystemItem::FullPathL(void) const - ?FullPathL@GflmUtils@@SAPAVHBufC16@@ABVTDesC16@@ABVTEntry@@@Z @ 18 NONAME ; class HBufC16 * GflmUtils::FullPathL(class TDesC16 const &, class TEntry const &) - ?FullPathLC@CGflmFileSystemItem@@QBEPAVHBufC16@@XZ @ 19 NONAME ; class HBufC16 * CGflmFileSystemItem::FullPathLC(void) const - ?FullPathLC@GflmUtils@@SAPAVHBufC16@@ABVTDesC16@@ABVTEntry@@@Z @ 20 NONAME ; class HBufC16 * GflmUtils::FullPathLC(class TDesC16 const &, class TEntry const &) - ?GetFullPath@CGflmFileSystemItem@@QBEXAAVTDes16@@@Z @ 21 NONAME ; void CGflmFileSystemItem::GetFullPath(class TDes16 &) const - ?GetFullPath@GflmUtils@@SAXABVTDesC16@@ABVTEntry@@AAVTDes16@@@Z @ 22 NONAME ; void GflmUtils::GetFullPath(class TDesC16 const &, class TEntry const &, class TDes16 &) - ?GetIconId@CGflmGroupItem@@QAEHAAH@Z @ 23 NONAME ; int CGflmGroupItem::GetIconId(int &) - ?GoToDirectoryL@CGflmNavigatorModel@@QAEXABVTDesC16@@0@Z @ 24 NONAME ; void CGflmNavigatorModel::GoToDirectoryL(class TDesC16 const &, class TDesC16 const &) - ?GoToDirectoryL@CGflmNavigatorModel@@QAEXABVTDesC16@@H@Z @ 25 NONAME ; void CGflmNavigatorModel::GoToDirectoryL(class TDesC16 const &, int) - ?HasFinalBackslash@GflmUtils@@SAHABVTDesC16@@@Z @ 26 NONAME ; int GflmUtils::HasFinalBackslash(class TDesC16 const &) - ?Id@CGflmGlobalActionItem@@QBEHXZ @ 27 NONAME ; int CGflmGlobalActionItem::Id(void) const - ?IsCorrupt@CGflmFileListModel@@QBEHXZ @ 28 NONAME ; int CGflmFileListModel::IsCorrupt(void) const - ?Item@CGflmFileListModel@@QBEPAVCGflmGroupItem@@H@Z @ 29 NONAME ; class CGflmGroupItem * CGflmFileListModel::Item(int) const - ?LocalizedName@CGflmFileListModel@@QBE?AVTPtrC16@@ABVTDesC16@@@Z @ 30 NONAME ; class TPtrC16 CGflmFileListModel::LocalizedName(class TDesC16 const &) const - ?LocalizedNameOfCurrentDirectory@CGflmNavigatorModel@@QBE?AVTPtrC16@@XZ @ 31 NONAME ; class TPtrC16 CGflmNavigatorModel::LocalizedNameOfCurrentDirectory(void) const - ?NavigationLevel@CGflmNavigatorModel@@QBEHXZ @ 32 NONAME ; int CGflmNavigatorModel::NavigationLevel(void) const - ?NewL@CGflmFileListModel@@SAPAV1@AAVRFs@@@Z @ 33 NONAME ; class CGflmFileListModel * CGflmFileListModel::NewL(class RFs &) - ?NewL@CGflmNavigatorModel@@SAPAV1@AAVRFs@@@Z @ 34 NONAME ; class CGflmNavigatorModel * CGflmNavigatorModel::NewL(class RFs &) - ?RefreshListL@CGflmFileListModel@@QAEXAAVTRequestStatus@@W4TGflmRefreshMode@@@Z @ 35 NONAME ; void CGflmFileListModel::RefreshListL(class TRequestStatus &, enum TGflmRefreshMode) - ?ResetModel@CGflmFileListModel@@QAEXXZ @ 36 NONAME ; void CGflmFileListModel::ResetModel(void) - ?ResolveMimeTypeL@CGflmFileListModel@@QAE?AVTPtrC16@@ABVTDesC16@@@Z @ 37 NONAME ; class TPtrC16 CGflmFileListModel::ResolveMimeTypeL(class TDesC16 const &) - ?RootDirectory@CGflmDriveItem@@QBE?AVTPtrC16@@XZ @ 38 NONAME ; class TPtrC16 CGflmDriveItem::RootDirectory(void) const - ?SetCustomFilter@CGflmFileListModel@@QAEXPAVMGflmItemFilter@@@Z @ 39 NONAME ; void CGflmFileListModel::SetCustomFilter(class MGflmItemFilter *) - ?SetIconId@CGflmGroupItem@@QAEXH@Z @ 40 NONAME ; void CGflmGroupItem::SetIconId(int) - ?SetLocalizedNameL@CGflmDriveItem@@QAEXABVTDesC16@@@Z @ 41 NONAME ; void CGflmDriveItem::SetLocalizedNameL(class TDesC16 const &) - ?SetLocalizedNameL@CGflmFileSystemItem@@QAEXABVTDesC16@@@Z @ 42 NONAME ; void CGflmFileSystemItem::SetLocalizedNameL(class TDesC16 const &) - ?SetRootDirectoryL@CGflmDriveItem@@QAEXABVTDesC16@@@Z @ 43 NONAME ; void CGflmDriveItem::SetRootDirectoryL(class TDesC16 const &) - ?SetSearchFolderL@CGflmFileListModel@@QAEXABVTDesC16@@@Z @ 44 NONAME ; void CGflmFileListModel::SetSearchFolderL(class TDesC16 const &) - ?SetSearchStringL@CGflmFileListModel@@QAEXABVTDesC16@@@Z @ 45 NONAME ; void CGflmFileListModel::SetSearchStringL(class TDesC16 const &) - ?SetSortMethod@CGflmFileListModel@@QAEXW4TGflmSortMethod@@@Z @ 46 NONAME ; void CGflmFileListModel::SetSortMethod(enum TGflmSortMethod) - ?SortMethod@CGflmFileListModel@@QBE?AW4TGflmSortMethod@@XZ @ 47 NONAME ; enum TGflmSortMethod CGflmFileListModel::SortMethod(void) const - ?StripFinalBackslash@GflmUtils@@SA?AVTPtrC16@@ABVTDesC16@@@Z @ 48 NONAME ; class TPtrC16 GflmUtils::StripFinalBackslash(class TDesC16 const &) - ?VolumeInfo@CGflmDriveItem@@QBEABVTVolumeInfo@@XZ @ 49 NONAME ; class TVolumeInfo const & CGflmDriveItem::VolumeInfo(void) const - ?VolumeStatus@CGflmDriveItem@@QBEHXZ @ 50 NONAME ; int CGflmDriveItem::VolumeStatus(void) const - ?FlushCache@CGflmFileListModel@@QAEXXZ @ 51 NONAME ; void CGflmFileListModel::FlushCache(void) - ?SearchMode@CGflmFileListModel@@QAEHXZ @ 52 NONAME ; int CGflmFileListModel::SearchMode(void) - diff -r 95243422089a -r 491b3ed49290 filemanager/BWINS/filemanagerbkupengineU.DEF --- a/filemanager/BWINS/filemanagerbkupengineU.DEF Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -EXPORTS - ??1CMMCScBkupDriveAndOperationTypeManager@@UAE@XZ @ 1 NONAME ; CMMCScBkupDriveAndOperationTypeManager::~CMMCScBkupDriveAndOperationTypeManager(void) - ??1CMMCScBkupEngine@@UAE@XZ @ 2 NONAME ; CMMCScBkupEngine::~CMMCScBkupEngine(void) - ??1CMMCScBkupOpParamsBackupFull@@UAE@XZ @ 3 NONAME ; CMMCScBkupOpParamsBackupFull::~CMMCScBkupOpParamsBackupFull(void) - ??1CMMCScBkupOpParamsBase@@UAE@XZ @ 4 NONAME ; CMMCScBkupOpParamsBase::~CMMCScBkupOpParamsBase(void) - ??1CMMCScBkupOpParamsRestoreFull@@UAE@XZ @ 5 NONAME ; CMMCScBkupOpParamsRestoreFull::~CMMCScBkupOpParamsRestoreFull(void) - ?ActiveTransferType@CMMCScBkupOpParamsBackupFull@@UBE?AW4TTransferDataType@conn@@XZ @ 6 NONAME ; enum conn::TTransferDataType CMMCScBkupOpParamsBackupFull::ActiveTransferType(void) const - ?ActiveTransferType@CMMCScBkupOpParamsRestoreFull@@UBE?AW4TTransferDataType@conn@@XZ @ 7 NONAME ; enum conn::TTransferDataType CMMCScBkupOpParamsRestoreFull::ActiveTransferType(void) const - ?AssociatedOpType@CMMCScBkupOpParamsBackupFull@@UBE?AW4TMMCScBkupOperationType@@XZ @ 8 NONAME ; enum TMMCScBkupOperationType CMMCScBkupOpParamsBackupFull::AssociatedOpType(void) const - ?AssociatedOpType@CMMCScBkupOpParamsRestoreFull@@UBE?AW4TMMCScBkupOperationType@@XZ @ 9 NONAME ; enum TMMCScBkupOperationType CMMCScBkupOpParamsRestoreFull::AssociatedOpType(void) const - ?CancelOperation@CMMCScBkupEngine@@QAEXXZ @ 10 NONAME ; void CMMCScBkupEngine::CancelOperation(void) - ?Category@CMMCScBkupArchiveInfo@@QBE?AV?$TBitFlagsT@K@@XZ @ 11 NONAME ; class TBitFlagsT CMMCScBkupArchiveInfo::Category(void) const - ?Close@RMMCScBkupArchiveBuf@@QAEXXZ @ 12 NONAME ; void RMMCScBkupArchiveBuf::Close(void) - ?DateTime@CMMCScBkupArchiveInfo@@QBEABVTTime@@XZ @ 13 NONAME ; class TTime const & CMMCScBkupArchiveInfo::DateTime(void) const - ?Drive@CMMCScBkupArchiveInfo@@QBE?AW4TDriveNumber@@XZ @ 14 NONAME ; enum TDriveNumber CMMCScBkupArchiveInfo::Drive(void) const - ?DriveAndOperations@CMMCScBkupOpParamsBase@@QBEABVCMMCScBkupDriveAndOperationTypeManager@@XZ @ 15 NONAME ; class CMMCScBkupDriveAndOperationTypeManager const & CMMCScBkupOpParamsBase::DriveAndOperations(void) const - ?FileName@CMMCScBkupArchiveInfo@@QBEABVTDesC16@@XZ @ 16 NONAME ; class TDesC16 const & CMMCScBkupArchiveInfo::FileName(void) const - ?IncrementType@CMMCScBkupOpParamsBackupFull@@UBE?AW4TBackupIncType@conn@@XZ @ 17 NONAME ; enum conn::TBackupIncType CMMCScBkupOpParamsBackupFull::IncrementType(void) const - ?IncrementType@CMMCScBkupOpParamsRestoreFull@@UBE?AW4TBackupIncType@conn@@XZ @ 18 NONAME ; enum conn::TBackupIncType CMMCScBkupOpParamsRestoreFull::IncrementType(void) const - ?ListArchivesL@CMMCScBkupEngine@@QBEXAAV?$RPointerArray@VCMMCScBkupArchiveInfo@@@@PAVCMMCScBkupOpParamsBase@@KH@Z @ 19 NONAME ; void CMMCScBkupEngine::ListArchivesL(class RPointerArray &, class CMMCScBkupOpParamsBase *, unsigned long, int) const - ?NewL@CMMCScBkupDriveAndOperationTypeManager@@SAPAV1@AAVTResourceReader@@@Z @ 20 NONAME ; class CMMCScBkupDriveAndOperationTypeManager * CMMCScBkupDriveAndOperationTypeManager::NewL(class TResourceReader &) - ?NewL@CMMCScBkupEngine@@SAPAV1@AAVRFs@@@Z @ 21 NONAME ; class CMMCScBkupEngine * CMMCScBkupEngine::NewL(class RFs &) - ?NewL@CMMCScBkupOpParamsBackupFull@@SAPAV1@AAVTResourceReader@@0W4TDriveNumber@@V?$TBitFlagsT@K@@@Z @ 22 NONAME ; class CMMCScBkupOpParamsBackupFull * CMMCScBkupOpParamsBackupFull::NewL(class TResourceReader &, class TResourceReader &, enum TDriveNumber, class TBitFlagsT) - ?NewL@CMMCScBkupOpParamsRestoreFull@@SAPAV1@AAVTResourceReader@@V?$TBitFlagsT@K@@@Z @ 23 NONAME ; class CMMCScBkupOpParamsRestoreFull * CMMCScBkupOpParamsRestoreFull::NewL(class TResourceReader &, class TBitFlagsT) - ?PackageTransferType@CMMCScBkupOpParamsBackupFull@@UBE?AW4TPackageDataType@conn@@XZ @ 24 NONAME ; enum conn::TPackageDataType CMMCScBkupOpParamsBackupFull::PackageTransferType(void) const - ?PackageTransferType@CMMCScBkupOpParamsRestoreFull@@UBE?AW4TPackageDataType@conn@@XZ @ 25 NONAME ; enum conn::TPackageDataType CMMCScBkupOpParamsRestoreFull::PackageTransferType(void) const - ?PartType@CMMCScBkupOpParamsBackupFull@@UBE?AW4TBURPartType@conn@@XZ @ 26 NONAME ; enum conn::TBURPartType CMMCScBkupOpParamsBackupFull::PartType(void) const - ?PartType@CMMCScBkupOpParamsRestoreFull@@UBE?AW4TBURPartType@conn@@XZ @ 27 NONAME ; enum conn::TBURPartType CMMCScBkupOpParamsRestoreFull::PartType(void) const - ?PassiveTransferType@CMMCScBkupOpParamsBackupFull@@UBE?AW4TTransferDataType@conn@@XZ @ 28 NONAME ; enum conn::TTransferDataType CMMCScBkupOpParamsBackupFull::PassiveTransferType(void) const - ?PassiveTransferType@CMMCScBkupOpParamsRestoreFull@@UBE?AW4TTransferDataType@conn@@XZ @ 29 NONAME ; enum conn::TTransferDataType CMMCScBkupOpParamsRestoreFull::PassiveTransferType(void) const - ?RebootRequired@CMMCScBkupEngine@@QBEHXZ @ 30 NONAME ; int CMMCScBkupEngine::RebootRequired(void) const - ?SetArchiveInfosL@CMMCScBkupOpParamsBase@@QAEXAAV?$RPointerArray@VCMMCScBkupArchiveInfo@@@@@Z @ 31 NONAME ; void CMMCScBkupOpParamsBase::SetArchiveInfosL(class RPointerArray &) - ?StartOperationL@CMMCScBkupEngine@@QAEXW4TMMCScBkupOperationType@@AAVMMMCScBkupEngineObserver@@PAVCMMCScBkupOpParamsBase@@@Z @ 32 NONAME ; void CMMCScBkupEngine::StartOperationL(enum TMMCScBkupOperationType, class MMMCScBkupEngineObserver &, class CMMCScBkupOpParamsBase *) - ?TotalOperationSizeL@CMMCScBkupEngine@@QBE_JXZ @ 33 NONAME ; long long CMMCScBkupEngine::TotalOperationSizeL(void) const - ?ValidArchiveForRestore@CMMCScBkupEngine@@QAEHABVTDesC16@@@Z @ 34 NONAME ; int CMMCScBkupEngine::ValidArchiveForRestore(class TDesC16 const &) - diff -r 95243422089a -r 491b3ed49290 filemanager/EABI/FileManagerEngineU.DEF --- a/filemanager/EABI/FileManagerEngineU.DEF Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -EXPORTS - _ZN17CFileManagerUtils13IsRemoteDriveER3RFsRK7TDesC16 @ 1 NONAME - _ZN17CFileManagerUtils17HasFinalBackslashERK7TDesC16 @ 2 NONAME - _ZN17CFileManagerUtils19StripFinalBackslashERK7TDesC16 @ 3 NONAME - _ZN17CFileManagerUtils20EnsureFinalBackslashER6TDes16 @ 4 NONAME - _ZN17CFileManagerUtils30IsFromInternalToRemovableDriveER3RFsRK7TDesC16S4_ @ 5 NONAME - _ZN18CFileManagerEngine10NewFolderLERK7TDesC16 @ 6 NONAME - _ZN18CFileManagerEngine10SetMemoryLE18TFileManagerMemory @ 7 NONAME - _ZN18CFileManagerEngine11FolderLevelEv @ 8 NONAME - _ZN18CFileManagerEngine11RefreshSortEv @ 9 NONAME - _ZN18CFileManagerEngine11RenameDriveEiRK7TDesC16 @ 10 NONAME - _ZN18CFileManagerEngine11SetObserverEP27MFileManagerProcessObserver @ 11 NONAME - _ZN18CFileManagerEngine11UnlockDriveEiRK5TBuf8ILi16EE @ 12 NONAME - _ZN18CFileManagerEngine12CurrentDriveEv @ 13 NONAME - _ZN18CFileManagerEngine12CurrentIndexEv @ 14 NONAME - _ZN18CFileManagerEngine12GetItemInfoLEi @ 15 NONAME - _ZN18CFileManagerEngine12IsNameFoundLERK7TDesC16 @ 16 NONAME - _ZN18CFileManagerEngine13CancelProcessEN27MFileManagerProcessObserver19TFileManagerProcessE @ 17 NONAME - _ZN18CFileManagerEngine13CancelRefreshEv @ 18 NONAME - _ZN18CFileManagerEngine13GetDriveInfoLER21TFileManagerDriveInfo @ 19 NONAME - _ZN18CFileManagerEngine13GetFileSizesLERK13CArrayFixFlatIiE @ 20 NONAME - _ZN18CFileManagerEngine13GetItemInfoLCEi @ 21 NONAME - _ZN18CFileManagerEngine13SetSortMethodENS_11TSortMethodE @ 22 NONAME - _ZN18CFileManagerEngine14FilesInFolderLEv @ 23 NONAME - _ZN18CFileManagerEngine15BackupSettingsLEv @ 24 NONAME - _ZN18CFileManagerEngine15FileSystemEventEi @ 25 NONAME - _ZN18CFileManagerEngine15SetCurrentIndexEi @ 26 NONAME - _ZN18CFileManagerEngine16CurrentDriveNameEv @ 27 NONAME - _ZN18CFileManagerEngine16RefreshDirectoryEv @ 28 NONAME - _ZN18CFileManagerEngine16RestoreSettingsLEv @ 29 NONAME - _ZN18CFileManagerEngine16SetDrivePasswordEiRK5TBuf8ILi16EES3_ @ 30 NONAME - _ZN18CFileManagerEngine16SetSearchFolderLERK7TDesC16 @ 31 NONAME - _ZN18CFileManagerEngine16SetSearchStringLERK7TDesC16 @ 32 NONAME - _ZN18CFileManagerEngine17DeleteRemoteDriveEi @ 33 NONAME - _ZN18CFileManagerEngine18StartEjectProcessLEi @ 34 NONAME - _ZN18CFileManagerEngine19CreateActiveDeleteLER13CArrayFixFlatIiE @ 35 NONAME - _ZN18CFileManagerEngine19RemoveDrivePasswordEiRK5TBuf8ILi16EE @ 36 NONAME - _ZN18CFileManagerEngine19StartBackupProcessLEN27MFileManagerProcessObserver19TFileManagerProcessE @ 37 NONAME - _ZN18CFileManagerEngine19StartFormatProcessLEi @ 38 NONAME - _ZN18CFileManagerEngine22ForcedRefreshDirectoryEv @ 39 NONAME - _ZN18CFileManagerEngine24SetRemoteDriveConnectionEii @ 40 NONAME - _ZN18CFileManagerEngine26SetDirectoryWithBackstepsLERK7TDesC16 @ 41 NONAME - _ZN18CFileManagerEngine4NewLER3RFs @ 42 NONAME - _ZN18CFileManagerEngine5OpenLEi @ 43 NONAME - _ZN18CFileManagerEngine7RenameLEiRK7TDesC16 @ 44 NONAME - _ZN18CFileManagerEngine8SetStateENS_6TStateE @ 45 NONAME - _ZN18CFileManagerEngine9BackstepLEv @ 46 NONAME - _ZN18CFileManagerEngine9DriveNameEi @ 47 NONAME - _ZN18CFileManagerEngineD0Ev @ 48 NONAME - _ZN18CFileManagerEngineD1Ev @ 49 NONAME - _ZN18CFileManagerEngineD2Ev @ 50 NONAME - _ZN21TFileManagerDriveInfo5ResetEv @ 51 NONAME - _ZN21TFileManagerDriveInfoC1Ev @ 52 NONAME - _ZN21TFileManagerDriveInfoC2Ev @ 53 NONAME - _ZN22CFileManagerIRReceiver12ReceiveFileLEv @ 54 NONAME - _ZN22CFileManagerIRReceiver13StopReceivingEv @ 55 NONAME - _ZN22CFileManagerIRReceiver4NewLER27MFileManagerProcessObserverRK7TDesC16R18CFileManagerEngine @ 56 NONAME - _ZN22CFileManagerIRReceiverD0Ev @ 57 NONAME - _ZN22CFileManagerIRReceiverD1Ev @ 58 NONAME - _ZN22CFileManagerIRReceiverD2Ev @ 59 NONAME - _ZN24CFileManagerActiveDelete15DeletedDrmItemsERi @ 60 NONAME - _ZN24CFileManagerActiveDelete8GetErrorER6TDes16 @ 61 NONAME - _ZN24CFileManagerActiveDeleteD0Ev @ 62 NONAME - _ZN24CFileManagerActiveDeleteD1Ev @ 63 NONAME - _ZN24CFileManagerActiveDeleteD2Ev @ 64 NONAME - _ZN25CFileManagerActiveExecute15CancelExecutionEv @ 65 NONAME - _ZN25CFileManagerActiveExecute4NewLER18CFileManagerEngineN27MFileManagerProcessObserver19TFileManagerProcessERS2_R13CArrayFixFlatIiERK7TDesC16 @ 66 NONAME - _ZN25CFileManagerActiveExecute8ExecuteLENS_18TFileManagerSwitchE @ 67 NONAME - _ZN25CFileManagerActiveExecuteD0Ev @ 68 NONAME - _ZN25CFileManagerActiveExecuteD1Ev @ 69 NONAME - _ZN25CFileManagerActiveExecuteD2Ev @ 70 NONAME - _ZN26CFileManagerBackupSettings10SetContentEm @ 71 NONAME - _ZN26CFileManagerBackupSettings13SetSchedulingEi @ 72 NONAME - _ZN26CFileManagerBackupSettings14SetTargetDriveEi @ 73 NONAME - _ZN26CFileManagerBackupSettings5SaveLEv @ 74 NONAME - _ZN26CFileManagerBackupSettings6SetDayEi @ 75 NONAME - _ZN26CFileManagerBackupSettings7SetTimeERK5TTime @ 76 NONAME - _ZN26CFileManagerBackupSettings8RefreshLEv @ 77 NONAME - _ZN26CFileManagerBackupSettings9SettingAtEi @ 78 NONAME - _ZN26CFileManagerItemProperties10OpenFilesLEv @ 79 NONAME - _ZN26CFileManagerItemProperties15FilesContainedLEv @ 80 NONAME - _ZN26CFileManagerItemProperties17FoldersContainedLEv @ 81 NONAME - _ZN26CFileManagerItemProperties25ContainsAnyFilesOrFoldersEv @ 82 NONAME - _ZN26CFileManagerItemProperties5SizeLEv @ 83 NONAME - _ZN26CFileManagerItemProperties5TypeLEv @ 84 NONAME - _ZN26CFileManagerItemProperties9MimeTypeLEv @ 85 NONAME - _ZN27CFileManagerRestoreSettings12SetSelectionERKy @ 86 NONAME - _ZN27CFileManagerRestoreSettings8RefreshLEv @ 87 NONAME - _ZNK18CFileManagerEngine10DriveStateERmRK7TDesC16 @ 88 NONAME - _ZNK18CFileManagerEngine10DriveStateERmi @ 89 NONAME - _ZNK18CFileManagerEngine10SortMethodEv @ 90 NONAME - _ZNK18CFileManagerEngine11GetMMCInfoLEv @ 91 NONAME - _ZNK18CFileManagerEngine11IsValidNameERK7TDesC16S2_i @ 92 NONAME - _ZNK18CFileManagerEngine12EnoughSpaceLERK7TDesC16xN27MFileManagerProcessObserver19TFileManagerProcessE @ 93 NONAME - _ZNK18CFileManagerEngine12IllegalCharsERK7TDesC16 @ 94 NONAME - _ZNK18CFileManagerEngine12SearchStringEv @ 95 NONAME - _ZNK18CFileManagerEngine13GetDriveInfoLEiR21TFileManagerDriveInfo @ 96 NONAME - _ZNK18CFileManagerEngine13LocalizedNameERK7TDesC16 @ 97 NONAME - _ZNK18CFileManagerEngine14FeatureManagerEv @ 98 NONAME - _ZNK18CFileManagerEngine14IsSystemFolderERK7TDesC16 @ 99 NONAME - _ZNK18CFileManagerEngine15NavigationLevelEv @ 100 NONAME - _ZNK18CFileManagerEngine16CurrentDirectoryEv @ 101 NONAME - _ZNK18CFileManagerEngine16IndexToFullPathLEi @ 102 NONAME - _ZNK18CFileManagerEngine17IndexToFullPathLCEi @ 103 NONAME - _ZNK18CFileManagerEngine18DriveRootDirectoryEi @ 104 NONAME - _ZNK18CFileManagerEngine19IsDistributableFileERK7TDesC16Ri @ 105 NONAME - _ZNK18CFileManagerEngine20GetRestoreInfoArrayLER6RArrayIN27CFileManagerRestoreSettings5TInfoEEi @ 106 NONAME - _ZNK18CFileManagerEngine23GetFormattedDriveNameLCEiii @ 107 NONAME - _ZNK18CFileManagerEngine24AnyEjectableDrivePresentEv @ 108 NONAME - _ZNK18CFileManagerEngine31LocalizedNameOfCurrentDirectoryEv @ 109 NONAME - _ZNK18CFileManagerEngine5StateEv @ 110 NONAME - _ZNK18CFileManagerEngine6MemoryEv @ 111 NONAME - _ZNK18CFileManagerEngine7IconIdLEi @ 112 NONAME - _ZNK18CFileManagerEngine8FileListEv @ 113 NONAME - _ZNK18CFileManagerEngine8IsFolderEi @ 114 NONAME - _ZNK18CFileManagerEngine9FileTypeLERK7TDesC16 @ 115 NONAME - _ZNK18CFileManagerEngine9FileTypeLEi @ 116 NONAME - _ZNK26CFileManagerBackupSettings10SchedulingEv @ 117 NONAME - _ZNK26CFileManagerBackupSettings11TargetDriveEv @ 118 NONAME - _ZNK26CFileManagerBackupSettings24AllowedDriveAttMatchMaskEv @ 119 NONAME - _ZNK26CFileManagerBackupSettings3DayEv @ 120 NONAME - _ZNK26CFileManagerBackupSettings4TimeEv @ 121 NONAME - _ZNK26CFileManagerBackupSettings7ContentEv @ 122 NONAME - _ZNK26CFileManagerFeatureManager15IsHelpSupportedEv @ 123 NONAME - _ZNK26CFileManagerFeatureManager15IsIrdaSupportedEv @ 124 NONAME - _ZNK26CFileManagerFeatureManager16IsWesternVariantEv @ 125 NONAME - _ZNK26CFileManagerFeatureManager18IsDrmFullSupportedEv @ 126 NONAME - _ZNK26CFileManagerFeatureManager18IsFeatureSupportedEi @ 127 NONAME - _ZNK26CFileManagerFeatureManager20IsMmcPassWdSupportedEv @ 128 NONAME - _ZNK26CFileManagerFeatureManager21IsMmcSwEjectSupportedEv @ 129 NONAME - _ZNK26CFileManagerFeatureManager26IsRemoteStorageFwSupportedEv @ 130 NONAME - _ZNK26CFileManagerItemProperties10NameAndExtEv @ 131 NONAME - _ZNK26CFileManagerItemProperties12ModifiedDateEv @ 132 NONAME - _ZNK26CFileManagerItemProperties13IsRemoteDriveEv @ 133 NONAME - _ZNK26CFileManagerItemProperties13LocalizedNameEv @ 134 NONAME - _ZNK26CFileManagerItemProperties17ModifiedLocalDateER5TTime @ 135 NONAME - _ZNK26CFileManagerItemProperties3ExtEv @ 136 NONAME - _ZNK26CFileManagerItemProperties4NameEv @ 137 NONAME - _ZNK26CFileManagerItemProperties7DriveIdEv @ 138 NONAME - _ZNK26CFileManagerItemProperties7IsDriveEv @ 139 NONAME - _ZNK26CFileManagerItemProperties8FullPathEv @ 140 NONAME - _ZNK26CFileManagerItemProperties9DriveNameEv @ 141 NONAME - _ZNK26CFileManagerFeatureManager10IsEmbeddedEv @ 142 NONAME - _ZN25CFileManagerActiveExecute8ToFolderEv @ 143 NONAME - _ZN18CFileManagerEngine18SetCurrentItemNameERK7TDesC16 @ 144 NONAME - _ZN18CFileManagerEngine12SetAppExitObEP25MAknServerAppExitObserver @ 145 NONAME - _ZN18CFileManagerEngine14DeleteBackupsLEv @ 146 NONAME - _ZN18CFileManagerEngine15IsDriverMountedEi @ 147 NONAME - diff -r 95243422089a -r 491b3ed49290 filemanager/EABI/FileManagerViewU.DEF --- a/filemanager/EABI/FileManagerViewU.DEF Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -EXPORTS - _ZN19FileManagerDlgUtils13ShowInfoNoteLERK7TDesC16 @ 1 NONAME - _ZN19FileManagerDlgUtils13ShowInfoNoteLEiRK7TDesC16 @ 2 NONAME - _ZN19FileManagerDlgUtils13ShowInfoNoteLEii @ 3 NONAME - _ZN19FileManagerDlgUtils14ShowErrorNoteLERK7TDesC16 @ 4 NONAME - _ZN19FileManagerDlgUtils14ShowErrorNoteLEiRK7TDesC16 @ 5 NONAME - _ZN19FileManagerDlgUtils14ShowInfoQueryLERK7TDesC16 @ 6 NONAME - _ZN19FileManagerDlgUtils14ShowInfoQueryLEiRK7TDesC16 @ 7 NONAME - _ZN19FileManagerDlgUtils14ShowInfoQueryLEii @ 8 NONAME - _ZN19FileManagerDlgUtils16ShowConfirmNoteLEi @ 9 NONAME - _ZN19FileManagerDlgUtils16ShowWarningNoteLEi @ 10 NONAME - _ZN19FileManagerDlgUtils17ShowWeekdayQueryLEiR4TDay @ 11 NONAME - _ZN19FileManagerDlgUtils18ShowFileNameQueryLEiRK7TDesC16R6TDes16R18CFileManagerEngine @ 12 NONAME - _ZN19FileManagerDlgUtils18ShowItemInfoPopupLER26CFileManagerItemPropertiesRK26CFileManagerFeatureManager @ 13 NONAME - _ZN19FileManagerDlgUtils18ShowPasswordQueryLER6TDes16 @ 14 NONAME - _ZN19FileManagerDlgUtils20ShowFolderNameQueryLEiR6TDes16R18CFileManagerEnginei @ 15 NONAME - _ZN19FileManagerDlgUtils21ShowNOfMSettingQueryLEiiRmi @ 16 NONAME - _ZN19FileManagerDlgUtils21ShowOOfMSettingQueryLEiPK12MDesC16ArrayRi @ 17 NONAME - _ZN19FileManagerDlgUtils21ShowOOfMSettingQueryLEiiRi @ 18 NONAME - _ZN19FileManagerDlgUtils21ShowTimeSettingQueryLEiR5TTime @ 19 NONAME - _ZN19FileManagerDlgUtils23ShowConfirmQueryWithOkLENS_6TIconsERK7TDesC16 @ 20 NONAME - _ZN19FileManagerDlgUtils23ShowConfirmQueryWithOkLENS_6TIconsEiRK7TDesC16 @ 21 NONAME - _ZN19FileManagerDlgUtils23ShowConfirmQueryWithOkLENS_6TIconsEii @ 22 NONAME - _ZN19FileManagerDlgUtils24ShowSimplePasswordQueryLERK7TDesC16R6TDes16 @ 23 NONAME - _ZN19FileManagerDlgUtils24ShowSimplePasswordQueryLEiR6TDes16 @ 24 NONAME - _ZN19FileManagerDlgUtils25ShowMemoryStoreInfoPopupLERK21TFileManagerDriveInfo @ 25 NONAME - _ZN19FileManagerDlgUtils26ShowConfirmQueryWithYesNoLERK7TDesC16 @ 26 NONAME - _ZN19FileManagerDlgUtils26ShowConfirmQueryWithYesNoLEiRK7TDesC16 @ 27 NONAME - _ZN19FileManagerDlgUtils29ShowConfirmQueryWithOkCancelLERK7TDesC16 @ 28 NONAME - _ZN19FileManagerDlgUtils29ShowConfirmQueryWithOkCancelLEiRK7TDesC16 @ 29 NONAME - _ZN21CFileManagerGlobalDlg11SetObserverEP29MFileManagerGlobalDlgObserver @ 30 NONAME - _ZN21CFileManagerGlobalDlg11ShowDialogLENS_5TTypeERK7TDesC16i @ 31 NONAME - _ZN21CFileManagerGlobalDlg11ShowDialogLENS_5TTypeEii @ 32 NONAME - _ZN21CFileManagerGlobalDlg12CancelDialogEv @ 33 NONAME - _ZN21CFileManagerGlobalDlg15ProcessFinishedEv @ 34 NONAME - _ZN21CFileManagerGlobalDlg20UpdateProgressDialogEii @ 35 NONAME - _ZN21CFileManagerGlobalDlg4NewLEv @ 36 NONAME - _ZN21CFileManagerGlobalDlgD0Ev @ 37 NONAME - _ZN21CFileManagerGlobalDlgD1Ev @ 38 NONAME - _ZN21CFileManagerGlobalDlgD2Ev @ 39 NONAME - _ZN21CFileManagerIconArray12UpdateIconsLEv @ 40 NONAME - _ZN21CFileManagerIconArray4NewLEv @ 41 NONAME - _ZN21CFileManagerIconArray8FindIconEi @ 42 NONAME - _ZN21CFileManagerIconArrayD0Ev @ 43 NONAME - _ZN21CFileManagerIconArrayD1Ev @ 44 NONAME - _ZN21CFileManagerIconArrayD2Ev @ 45 NONAME - _ZN32CFileManagerFolderNavigationPane11ChangeRootLEi @ 46 NONAME - _ZN32CFileManagerFolderNavigationPane11SetObserverEP30MFileManagerFolderNaviObserver @ 47 NONAME - _ZN32CFileManagerFolderNavigationPane14SetFolderDepthEi @ 48 NONAME - _ZN32CFileManagerFolderNavigationPane21HandleResourceChangeLEi @ 49 NONAME - _ZN32CFileManagerFolderNavigationPane4NewLEiiR15TResourceReader @ 50 NONAME - _ZN32CFileManagerFolderNavigationPaneD0Ev @ 51 NONAME - _ZN32CFileManagerFolderNavigationPaneD1Ev @ 52 NONAME - _ZN32CFileManagerFolderNavigationPaneD2Ev @ 53 NONAME - _ZNK32CFileManagerFolderNavigationPane11FolderDepthEv @ 54 NONAME - _ZTI21CFileManagerGlobalDlg @ 55 NONAME ; ## - _ZTI21CFileManagerIconArray @ 56 NONAME ; ## - _ZTI32CFileManagerFolderNavigationPane @ 57 NONAME ; ## - _ZTV21CFileManagerGlobalDlg @ 58 NONAME ; ## - _ZTV21CFileManagerIconArray @ 59 NONAME ; ## - _ZTV32CFileManagerFolderNavigationPane @ 60 NONAME ; ## - _ZN21CFileManagerIconArray9LoadIconLERK7TDesC16iiiii @ 61 NONAME - diff -r 95243422089a -r 491b3ed49290 filemanager/EABI/GFLMU.DEF --- a/filemanager/EABI/GFLMU.DEF Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -EXPORTS - _ZN14CGflmDriveItem17SetLocalizedNameLERK7TDesC16 @ 1 NONAME - _ZN14CGflmDriveItem17SetRootDirectoryLERK7TDesC16 @ 2 NONAME - _ZN14CGflmGroupItem9GetIconIdERi @ 3 NONAME - _ZN14CGflmGroupItem9SetIconIdEi @ 4 NONAME - _ZN18CGflmFileListModel10ClearCacheEv @ 5 NONAME - _ZN18CGflmFileListModel10ResetModelEv @ 6 NONAME - _ZN18CGflmFileListModel12CreateGroupLEi @ 7 NONAME - _ZN18CGflmFileListModel12CreateGroupLEij @ 8 NONAME - _ZN18CGflmFileListModel12RefreshListLER14TRequestStatus16TGflmRefreshMode @ 9 NONAME - _ZN18CGflmFileListModel13CancelRefreshEv @ 10 NONAME - _ZN18CGflmFileListModel13FindGroupByIdEi @ 11 NONAME - _ZN18CGflmFileListModel13SetSortMethodE15TGflmSortMethod @ 12 NONAME - _ZN18CGflmFileListModel14ClearDriveInfoEv @ 13 NONAME - _ZN18CGflmFileListModel15SetCustomFilterEP15MGflmItemFilter @ 14 NONAME - _ZN18CGflmFileListModel16EnableSearchModeEi @ 15 NONAME - _ZN18CGflmFileListModel16ResolveMimeTypeLERK7TDesC16 @ 16 NONAME - _ZN18CGflmFileListModel16SetSearchFolderLERK7TDesC16 @ 17 NONAME - _ZN18CGflmFileListModel16SetSearchStringLERK7TDesC16 @ 18 NONAME - _ZN18CGflmFileListModel4NewLER3RFs @ 19 NONAME - _ZN19CGflmFileSystemItem17SetLocalizedNameLERK7TDesC16 @ 20 NONAME - _ZN19CGflmNavigatorModel14GoToDirectoryLERK7TDesC16S2_ @ 21 NONAME - _ZN19CGflmNavigatorModel14GoToDirectoryLERK7TDesC16i @ 22 NONAME - _ZN19CGflmNavigatorModel4NewLER3RFs @ 23 NONAME - _ZN19CGflmNavigatorModel9BackstepLEv @ 24 NONAME - _ZN9GflmUtils10FullPathLCERK7TDesC16RK6TEntry @ 25 NONAME - _ZN9GflmUtils11GetFullPathERK7TDesC16RK6TEntryR6TDes16 @ 26 NONAME - _ZN9GflmUtils17HasFinalBackslashERK7TDesC16 @ 27 NONAME - _ZN9GflmUtils19StripFinalBackslashERK7TDesC16 @ 28 NONAME - _ZN9GflmUtils20EnsureFinalBackslashER6TDes16 @ 29 NONAME - _ZN9GflmUtils9FullPathLERK7TDesC16RK6TEntry @ 30 NONAME - _ZNK14CGflmDriveItem10VolumeInfoEv @ 31 NONAME - _ZNK14CGflmDriveItem11DriveStatusEv @ 32 NONAME - _ZNK14CGflmDriveItem12VolumeStatusEv @ 33 NONAME - _ZNK14CGflmDriveItem13RootDirectoryEv @ 34 NONAME - _ZNK14CGflmDriveItem5DriveEv @ 35 NONAME - _ZNK18CGflmFileListModel10SortMethodEv @ 36 NONAME - _ZNK18CGflmFileListModel11DriveFromIdEi @ 37 NONAME - _ZNK18CGflmFileListModel13DriveFromPathERK7TDesC16 @ 38 NONAME - _ZNK18CGflmFileListModel13LocalizedNameERK7TDesC16 @ 39 NONAME - _ZNK18CGflmFileListModel4ItemEi @ 40 NONAME - _ZNK18CGflmFileListModel9IsCorruptEv @ 41 NONAME - _ZNK19CGflmFileSystemItem10FullPathLCEv @ 42 NONAME - _ZNK19CGflmFileSystemItem11GetFullPathER6TDes16 @ 43 NONAME - _ZNK19CGflmFileSystemItem5EntryEv @ 44 NONAME - _ZNK19CGflmFileSystemItem9FullPathLEv @ 45 NONAME - _ZNK19CGflmNavigatorModel12CurrentDriveEv @ 46 NONAME - _ZNK19CGflmNavigatorModel15NavigationLevelEv @ 47 NONAME - _ZNK19CGflmNavigatorModel16CurrentDirectoryEv @ 48 NONAME - _ZNK19CGflmNavigatorModel31LocalizedNameOfCurrentDirectoryEv @ 49 NONAME - _ZNK21CGflmGlobalActionItem2IdEv @ 50 NONAME - _ZTI14CGflmDriveItem @ 51 NONAME ; ## - _ZTI14CGflmGroupItem @ 52 NONAME ; ## - _ZTI18CGflmFileListModel @ 53 NONAME ; ## - _ZTI19CGflmFileFinderItem @ 54 NONAME ; ## - _ZTI19CGflmFileSystemItem @ 55 NONAME ; ## - _ZTI19CGflmNavigatorModel @ 56 NONAME ; ## - _ZTI21CGflmGlobalActionItem @ 57 NONAME ; ## - _ZTV14CGflmDriveItem @ 58 NONAME ; ## - _ZTV14CGflmGroupItem @ 59 NONAME ; ## - _ZTV18CGflmFileListModel @ 60 NONAME ; ## - _ZTV19CGflmFileFinderItem @ 61 NONAME ; ## - _ZTV19CGflmFileSystemItem @ 62 NONAME ; ## - _ZTV19CGflmNavigatorModel @ 63 NONAME ; ## - _ZTV21CGflmGlobalActionItem @ 64 NONAME ; ## - _ZN18CGflmFileListModel10FlushCacheEv @ 65 NONAME - _ZN18CGflmFileListModel10SearchModeEv @ 66 NONAME - diff -r 95243422089a -r 491b3ed49290 filemanager/EABI/filemanagerbkupengineU.DEF --- a/filemanager/EABI/filemanagerbkupengineU.DEF Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -EXPORTS - _ZN16CMMCScBkupEngine15CancelOperationEv @ 1 NONAME - _ZN16CMMCScBkupEngine15StartOperationLE23TMMCScBkupOperationTypeR24MMMCScBkupEngineObserverP22CMMCScBkupOpParamsBase @ 2 NONAME - _ZN16CMMCScBkupEngine22ValidArchiveForRestoreERK7TDesC16 @ 3 NONAME - _ZN16CMMCScBkupEngine4NewLER3RFs @ 4 NONAME - _ZN16CMMCScBkupEngineD0Ev @ 5 NONAME - _ZN16CMMCScBkupEngineD1Ev @ 6 NONAME - _ZN16CMMCScBkupEngineD2Ev @ 7 NONAME - _ZN20RMMCScBkupArchiveBuf5CloseEv @ 8 NONAME - _ZN22CMMCScBkupOpParamsBase16SetArchiveInfosLER13RPointerArrayI21CMMCScBkupArchiveInfoE @ 9 NONAME - _ZN22CMMCScBkupOpParamsBaseD0Ev @ 10 NONAME - _ZN22CMMCScBkupOpParamsBaseD1Ev @ 11 NONAME - _ZN22CMMCScBkupOpParamsBaseD2Ev @ 12 NONAME - _ZN28CMMCScBkupOpParamsBackupFull4NewLER15TResourceReaderS1_12TDriveNumber10TBitFlagsTImE @ 13 NONAME - _ZN28CMMCScBkupOpParamsBackupFullD0Ev @ 14 NONAME - _ZN28CMMCScBkupOpParamsBackupFullD1Ev @ 15 NONAME - _ZN28CMMCScBkupOpParamsBackupFullD2Ev @ 16 NONAME - _ZN29CMMCScBkupOpParamsRestoreFull4NewLER15TResourceReader10TBitFlagsTImE @ 17 NONAME - _ZN29CMMCScBkupOpParamsRestoreFullD0Ev @ 18 NONAME - _ZN29CMMCScBkupOpParamsRestoreFullD1Ev @ 19 NONAME - _ZN29CMMCScBkupOpParamsRestoreFullD2Ev @ 20 NONAME - _ZN38CMMCScBkupDriveAndOperationTypeManager4NewLER15TResourceReader @ 21 NONAME - _ZN38CMMCScBkupDriveAndOperationTypeManagerD0Ev @ 22 NONAME - _ZN38CMMCScBkupDriveAndOperationTypeManagerD1Ev @ 23 NONAME - _ZN38CMMCScBkupDriveAndOperationTypeManagerD2Ev @ 24 NONAME - _ZNK16CMMCScBkupEngine13ListArchivesLER13RPointerArrayI21CMMCScBkupArchiveInfoEP22CMMCScBkupOpParamsBasemi @ 25 NONAME - _ZNK16CMMCScBkupEngine14RebootRequiredEv @ 26 NONAME - _ZNK16CMMCScBkupEngine19TotalOperationSizeLEv @ 27 NONAME - _ZNK21CMMCScBkupArchiveInfo5DriveEv @ 28 NONAME - _ZNK21CMMCScBkupArchiveInfo8CategoryEv @ 29 NONAME - _ZNK21CMMCScBkupArchiveInfo8DateTimeEv @ 30 NONAME - _ZNK21CMMCScBkupArchiveInfo8FileNameEv @ 31 NONAME - _ZNK22CMMCScBkupOpParamsBase18DriveAndOperationsEv @ 32 NONAME - _ZNK28CMMCScBkupOpParamsBackupFull13IncrementTypeEv @ 33 NONAME - _ZNK28CMMCScBkupOpParamsBackupFull16AssociatedOpTypeEv @ 34 NONAME - _ZNK28CMMCScBkupOpParamsBackupFull18ActiveTransferTypeEv @ 35 NONAME - _ZNK28CMMCScBkupOpParamsBackupFull19PackageTransferTypeEv @ 36 NONAME - _ZNK28CMMCScBkupOpParamsBackupFull19PassiveTransferTypeEv @ 37 NONAME - _ZNK28CMMCScBkupOpParamsBackupFull8PartTypeEv @ 38 NONAME - _ZNK29CMMCScBkupOpParamsRestoreFull13IncrementTypeEv @ 39 NONAME - _ZNK29CMMCScBkupOpParamsRestoreFull16AssociatedOpTypeEv @ 40 NONAME - _ZNK29CMMCScBkupOpParamsRestoreFull18ActiveTransferTypeEv @ 41 NONAME - _ZNK29CMMCScBkupOpParamsRestoreFull19PackageTransferTypeEv @ 42 NONAME - _ZNK29CMMCScBkupOpParamsRestoreFull19PassiveTransferTypeEv @ 43 NONAME - _ZNK29CMMCScBkupOpParamsRestoreFull8PartTypeEv @ 44 NONAME - _ZTI22CMMCScBkupDataStrategy @ 45 NONAME ; ## - _ZTI37CMMCScBkupStateRequestSizeOfDataOwner @ 46 NONAME ; ## - _ZTI44CMMCScBkupStateRequestSpecificPublicFileInfo @ 47 NONAME ; ## - _ZTV22CMMCScBkupDataStrategy @ 48 NONAME ; ## - _ZTV37CMMCScBkupStateRequestSizeOfDataOwner @ 49 NONAME ; ## - _ZTV44CMMCScBkupStateRequestSpecificPublicFileInfo @ 50 NONAME ; ## - diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/data/FileManagerEngine.rss --- a/filemanager/Engine/data/FileManagerEngine.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,591 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource definitions for project FileManagerEngine -* -*/ - - -// RESOURCE IDENTIFIER -NAME FMGE // 4 letter ID - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include "FileManagerEngine.rh" -#include "FileManagerEngine.hrh" -#include "BKupEngine.rh" -#include "BkupEngine.hrh" -#include "TMMCScBkupOwnerDataType.h" - -// RESOURCE DEFINITIONS - -RESOURCE RSS_SIGNATURE { } - -#ifndef RD_MULTIPLE_DRIVE - -RESOURCE ARRAY r_filemanager_default_folders - { - items = - { - FILEMANAGER_DEFAULT_FOLDER - { - root = text_phone_memory_root_path; - folder = text_games_path; - isMediaFolder = 0; - }, - FILEMANAGER_DEFAULT_FOLDER - { - root = text_phone_memory_root_path; - folder = text_images_path; - isMediaFolder = 1; - }, - FILEMANAGER_DEFAULT_FOLDER - { - root = text_phone_memory_root_path; - folder = text_gms_pictures_path; - isMediaFolder = 1; - }, - FILEMANAGER_DEFAULT_FOLDER - { - root = text_phone_memory_root_path; - folder = text_mms_background_images_path; - isMediaFolder = 1; - }, -#ifdef __DPB - FILEMANAGER_DEFAULT_FOLDER - { - root = text_phone_memory_root_path; - folder = text_presence_logos_path; - isMediaFolder = 1; - }, -#endif - FILEMANAGER_DEFAULT_FOLDER - { - root = text_phone_memory_root_path; - folder = text_installs_path; - isMediaFolder = 0; - }, - FILEMANAGER_DEFAULT_FOLDER - { - root = text_phone_memory_root_path; - folder = text_others_path; - isMediaFolder = 0; - }, - FILEMANAGER_DEFAULT_FOLDER - { - root = text_phone_memory_root_path; - folder = text_sounds_path; - isMediaFolder = 1; - }, - FILEMANAGER_DEFAULT_FOLDER - { - root = text_phone_memory_root_path; - folder = text_digital_sounds_path; - isMediaFolder = 1; - }, - FILEMANAGER_DEFAULT_FOLDER - { - root = text_phone_memory_root_path; - folder = text_simple_sounds_path; - isMediaFolder = 1; - }, - FILEMANAGER_DEFAULT_FOLDER - { - root = text_phone_memory_root_path; - folder = text_videos_path; - isMediaFolder = 1; - }, - FILEMANAGER_DEFAULT_FOLDER - { - root = text_memory_card_root_path; - folder = text_images_path; - isMediaFolder = 1; - }, - FILEMANAGER_DEFAULT_FOLDER - { - root = text_memory_card_root_path; - folder = text_others_path; - isMediaFolder = 0; - }, - FILEMANAGER_DEFAULT_FOLDER - { - root = text_memory_card_root_path; - folder = text_sounds_path; - isMediaFolder = 1; - }, - FILEMANAGER_DEFAULT_FOLDER - { - root = text_memory_card_root_path; - folder = text_digital_sounds_path; - isMediaFolder = 1; - }, - FILEMANAGER_DEFAULT_FOLDER - { - root = text_memory_card_root_path; - folder = text_simple_sounds_path; - isMediaFolder = 1; - }, - FILEMANAGER_DEFAULT_FOLDER - { - root = text_memory_card_root_path; - folder = text_videos_path; - isMediaFolder = 1; - } - }; - } - -#endif // RD_MULTIPLE_DRIVE - -RESOURCE ARRAY r_filemanager_mime_icon_mapper - { - items = - { - FILEMANAGER_ICON_MAPPER - { - mimeType = "mpegurl"; - iconId = EFileManagerPlaylistFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "ram"; - iconId = EFileManagerLinkFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "ota"; - iconId = EFileManagerPictureMsgFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "image"; - iconId = EFileManagerImageFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "presence"; - iconId = EFileManagerDycLogoFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "wml"; - iconId = EFileManagerLinkFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "amr"; - iconId = EFileManagerVoicerecFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "ringing-tone"; - iconId = EFileManagerVoicerecFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "awb"; - iconId = EFileManagerVoicerecFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "audio"; - iconId = EFileManagerSoundFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "java-archive"; - iconId = EFileManagerAppFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "x-zip"; - iconId = EFileManagerAppFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "j2me.app"; - iconId = EFileManagerAppFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "text"; - iconId = EFileManagerNoteFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "sis"; - iconId = EFileManagerAppFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "video"; - iconId = EFileManagerVideoFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "realmedia"; - iconId = EFileManagerVideoFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "game"; - iconId = EFileManagerGameFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "other"; - iconId = EFileManagerOtherFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "shockwave-flash"; - iconId = EFileManagerFlashFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "application/pdf"; - iconId = EFileManagerNoteFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "ms-powerpoint"; - iconId = EFileManagerNoteFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "ms-excel"; - iconId = EFileManagerNoteFileIcon; - }, - FILEMANAGER_ICON_MAPPER - { - mimeType = "ms-word"; - iconId = EFileManagerNoteFileIcon; - } - }; - } - -#ifdef RD_MULTIPLE_DRIVE - -RESOURCE MMC_SECURE_BACKUP_DRIVES_AND_OPERATIONS r_filemanager_backup_restore_drives_and_operations - { - drivesAndOperations = - { - MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE - { - drive = EBkupDeviceMemories | EBkupInternalMassStorages; - type = EMMCScBkupOwnerDataTypeDataOwner; - }, - MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE - { - drive = EBkupDeviceMemories | EBkupInternalMassStorages; - type = EMMCScBkupOwnerDataTypeJavaData; - }, - MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE - { - drive = EBkupDeviceMemories | EBkupInternalMassStorages; - type = EMMCScBkupOwnerDataTypePublicData; - }, - MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE - { - drive = EBkupDeviceMemories | EBkupInternalMassStorages; - type = EMMCScBkupOwnerDataTypeSystemData; - }, - MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE - { - drive = EBkupDeviceMemories | EBkupInternalMassStorages; - type = EMMCScBkupOwnerDataTypeActiveData; - }, - MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE - { - drive = EBkupDeviceMemories | EBkupInternalMassStorages; - type = EMMCScBkupOwnerDataTypePassiveData; - } - }; - } - -#else // RD_MULTIPLE_DRIVE - -RESOURCE MMC_SECURE_BACKUP_DRIVES_AND_OPERATIONS r_filemanager_backup_restore_drives_and_operations - { - /** - * - * By default we only backup & restore to/from the internal C: drive - * to MMC - * - */ - drivesAndOperations = - { - //////////////////////////////////////////////////////////// - // DRIVE C => Back up & restore everything.... - //////////////////////////////////////////////////////////// - - MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE - { - drive = EMMCDriveNumberC; - type = EMMCScBkupOwnerDataTypeDataOwner; - }, - MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE - { - drive = EMMCDriveNumberC; - type = EMMCScBkupOwnerDataTypeJavaData; - }, - MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE - { - drive = EMMCDriveNumberC; - type = EMMCScBkupOwnerDataTypePublicData; - }, - MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE - { - drive = EMMCDriveNumberC; - type = EMMCScBkupOwnerDataTypeSystemData; - }, - MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE - { - drive = EMMCDriveNumberC; - type = EMMCScBkupOwnerDataTypeActiveData; - }, - MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE - { - drive = EMMCDriveNumberC; - type = EMMCScBkupOwnerDataTypePassiveData; - } - - //////////////////////////////////////////////////////////// - // DRIVE E => Not backing up anything currently - //////////////////////////////////////////////////////////// -/* - MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE - { - drive = EMMCDriveNumberE; - type = EMMCScBkupOwnerDataTypeSystemData; - } -*/ - }; - } - -#endif // RD_MULTIPLE_DRIVE - -RESOURCE BACKUPCATEGORYARRAY r_filemanager_backup_categories - { - backupcategory= - { - //////////////////////////////////////////////////////////// - // Note! EBUCatAllInOne is used for creating old style backup, - // where all contents is in one archive. See howto from - // CMMCScBkupOperationParameters.cpp and BkupEngine.hrh - //////////////////////////////////////////////////////////// - BACKUPCATEGORY - { - category=EBUCatAllInOne; - archive_name="Backup.arc"; - special_flags=EBUCatSpecAll; - exclude_special_flags=EBUCatSpecNone; - uids= - { - }; - exclude_uids= - { - }; - }, - //////////////////////////////////////////////////////////// - // Note! EBUCatSettings basicly contains everything else, but - // sis and java installations and components, which are not - // in the list of excluded UIDs'. It is supposed at least - // Messages, Contacts, Calendar and Bookmarks should not be - // included. Additionally call register information falls better - // into EBUCatUserFiles as well as MediaGallery and Notepad - //////////////////////////////////////////////////////////// - BACKUPCATEGORY - { - category=EBUCatSettings; - archive_name="Settings.arc"; - special_flags=EBUCatSpecAll; - exclude_special_flags=EBUCatSpecSystem+EBUCatSpecJava; - uids= - { - }; - exclude_uids= - { - 0x1000484b, // Message store (EBUCatMessages) - 0x100058db, // MMS-settings (EBUCatMessages) - 0x100058eb, // E-mail-settings (EBUCatMessages) - 0x10003a73, // Contacts model (EBUCatContacts) - 0x101f4cce, // Phonebook-app (EBUCatContacts) - 0x10003a5b, // Agenda model (EBUCatCalendar) - 0x10005901, // Calendar-app (EBUCatCalendar) - 0x10008d38, // Bookmarks (EBUCatBookmarks) - 0x101f401d, // Logs (EBUCatUserFiles) - 0x101f8599, // MediaGallery, i.e. basicly all user data (EBUCatUserFiles) - 0x101f84eb, // FileManager - 0x10005907, // Notepad (EBUCatUserFiles) - 0x1028246F, // Java Backup process - 0x200211DC, // Java Captain process - 0x102033E6 // MIDP2 Runtime process - }; - }, - BACKUPCATEGORY - { - category=EBUCatMessages; - archive_name="Messages.arc"; - special_flags=EBUCatSpecNone; - exclude_special_flags=EBUCatSpecNone; - uids= - { - 0x1000484b, // Message store - 0x100058db, // MMS-settings - 0x100058eb // E-mail-settings - }; - exclude_uids= - { - }; - }, - BACKUPCATEGORY - { - category=EBUCatContacts; - archive_name="Contacts.arc"; - special_flags=EBUCatSpecNone; - exclude_special_flags=EBUCatSpecNone; - uids= - { - 0x10003a73, // Contacts model - 0x101f4cce // Phonebook-app - }; - exclude_uids= - { - }; - }, - BACKUPCATEGORY - { - category=EBUCatCalendar; - archive_name="Calendar.arc"; - special_flags=EBUCatSpecNone; - exclude_special_flags=EBUCatSpecNone; - uids= - { - 0x10003a5b, // Agenda model - 0x10005901 // Calendar-app - }; - exclude_uids= - { - }; - }, - BACKUPCATEGORY - { - category=EBUCatBookmarks; - archive_name="Bookmarks.arc"; - special_flags=EBUCatSpecNone; - exclude_special_flags=EBUCatSpecNone; - uids= - { - 0x10008d38 - }; - exclude_uids= - { - }; - }, - //////////////////////////////////////////////////////////// - // Note! We have to explicitly define what belongs to EBUCatUserFiles: - // EBUCatSpecSystem => SIS-installations, EBUCatSpecJava => midlets - // We do not specify EBUCatSpecPublic, because several data owners might - // have "public" data in :\xxx folders. Instead MediaGallery defines - // user data area for backup (currently C:\Data) in its backup configuration - // (z:\private\101F8599\backup_registration.xml) file. - //////////////////////////////////////////////////////////// - BACKUPCATEGORY - { - category=EBUCatUserFiles; - archive_name="UserFiles.arc"; - special_flags=EBUCatSpecSystem+EBUCatSpecJava; - exclude_special_flags=EBUCatSpecNone; - uids= - { - 0x101f401d, // Logs - //0x101f8599, // MediaGallery, i.e. basicly all user data - 0x101f84eb, // FileManager - 0x10005907, // Notepad - 0x1028246F, // Java Backup process - 0x200211DC, // Java Captain process - 0x102033E6 // MIDP2 Runtime process - }; - exclude_uids= - { - }; - } - }; - } - -RESOURCE TBUF r_text_mmc_backup_file { buf = "\\Backup\\Backup.arc"; } -RESOURCE TBUF r_text_phone_memory { buf = qtn_fmgr_main_phone; } -RESOURCE TBUF r_text_memory_card_default { buf = qtn_fmgr_main_card_default; } - -#ifdef RD_FILE_MANAGER_BACKUP -RESOURCE TBUF r_qtn_fmgr_backup_contents { buf = qtn_fmgr_backup_contents; } -RESOURCE TBUF r_qtn_fmgr_backup_scheduling { buf = qtn_fmgr_backup_scheduling; } -RESOURCE TBUF r_qtn_fmgr_backup_weekday { buf = qtn_fmgr_backup_weekday; } -RESOURCE TBUF r_qtn_fmgr_backup_time { buf = qtn_fmgr_backup_time; } -RESOURCE TBUF r_qtn_fmgr_backup_destination { buf = qtn_fmgr_backup_destination; } - -RESOURCE TBUF r_qtn_fmgr_backup_no_scheduling { buf = qtn_fmgr_backup_no_scheduling; } -RESOURCE TBUF r_qtn_fmgr_backup_daily { buf = qtn_fmgr_backup_daily; } -RESOURCE TBUF r_qtn_fmgr_backup_weekly { buf = qtn_fmgr_backup_weekly; } - -RESOURCE TBUF r_qtn_fmgr_backup_content_all { buf = qtn_fmgr_backup_content_all; } -RESOURCE TBUF r_qtn_fmgr_backup_content_selected { buf = qtn_fmgr_backup_content_selected; } -RESOURCE TBUF r_qtn_fmgr_backup_content_settings { buf = qtn_fmgr_backup_content_settings; } -RESOURCE TBUF r_qtn_fmgr_backup_content_messages { buf = qtn_fmgr_backup_content_messages; } -RESOURCE TBUF r_qtn_fmgr_backup_content_contacts { buf = qtn_fmgr_backup_content_contacts; } -RESOURCE TBUF r_qtn_fmgr_backup_content_calendar { buf = qtn_fmgr_backup_content_calendar; } -RESOURCE TBUF r_qtn_fmgr_backup_content_bookmarks { buf = qtn_fmgr_backup_content_bookmarks; } -RESOURCE TBUF r_qtn_fmgr_backup_content_userfiles { buf = qtn_fmgr_backup_content_userfiles; } - -RESOURCE TBUF r_qtn_fmgr_restore_settings { buf = qtn_fmgr_restore_settings; } -RESOURCE TBUF r_qtn_fmgr_restore_messages { buf = qtn_fmgr_restore_messages; } -RESOURCE TBUF r_qtn_fmgr_restore_contacts { buf = qtn_fmgr_restore_contacts; } -RESOURCE TBUF r_qtn_fmgr_restore_calendar { buf = qtn_fmgr_restore_calendar; } -RESOURCE TBUF r_qtn_fmgr_restore_bookmarks { buf = qtn_fmgr_restore_bookmarks; } -RESOURCE TBUF r_qtn_fmgr_restore_userfiles { buf = qtn_fmgr_restore_userfiles; } -RESOURCE TBUF r_qtn_fmgr_main_backup { buf = qtn_fmgr_main_backup; } -#endif // RD_FILE_MANAGER_BACKUP - -RESOURCE TBUF r_qtn_fmgr_main_phone { buf = qtn_fmgr_main_phone; } -RESOURCE TBUF r_qtn_fmgr_main_card_default { buf = qtn_fmgr_main_card_default; } -RESOURCE TBUF r_qtn_fmgr_title_phone_mem { buf = qtn_fmgr_title_phone_mem; } -RESOURCE TBUF r_qtn_fmgr_title_mem_card { buf = qtn_fmgr_title_mem_card; } - -#ifdef RD_MULTIPLE_DRIVE -RESOURCE TBUF r_qtn_fmgr_main_device_memory { buf = qtn_fmgr_main_device_memory; } -RESOURCE TBUF r_qtn_fmgr_main_mass_storage { buf = qtn_fmgr_main_mass_storage; } -RESOURCE TBUF r_qtn_fmgr_main_memory_card_default { buf = qtn_fmgr_main_memory_card_default; } -RESOURCE TBUF r_qtn_fmgr_main_named_memory_card { buf = qtn_fmgr_main_named_memory_card; } - -RESOURCE TBUF r_qtn_fmgr_title_device_memory { buf = qtn_fmgr_title_device_memory; } -RESOURCE TBUF r_qtn_fmgr_title_mass_storage { buf = qtn_fmgr_title_mass_storage; } -RESOURCE TBUF r_qtn_fmgr_title_named_memory_card { buf = qtn_fmgr_title_named_memory_card; } -RESOURCE TBUF r_qtn_fmgr_title_memory_card_default { buf = qtn_fmgr_title_memory_card_default; } -#endif // RD_MULTIPLE_DRIVE - -RESOURCE TBUF r_qtn_fmgr_main_usb_default { buf = qtn_fmgr_main_usb_default; } -RESOURCE TBUF r_qtn_fmgr_title_usb_default { buf = qtn_fmgr_title_usb_default; } -RESOURCE TBUF r_qtn_fmgr_backup_content_device_memory { buf = qtn_fmgr_backup_content_device_memory; } -RESOURCE TBUF r_qtn_fmgr_backup_content_mass_storage{ buf = qtn_fmgr_backup_content_mass_storage; } -RESOURCE TBUF r_qtn_fmgr_restore_device_memory { buf = qtn_fmgr_restore_device_memory; } -RESOURCE TBUF r_qtn_fmgr_restore_mass_storage { buf = qtn_fmgr_restore_mass_storage; } -RESOURCE TBUF r_qtn_fmgr_usb_memory_default_name { buf = qtn_fmgr_usb_memory_default_name; } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerActiveBase.h --- a/filemanager/Engine/inc/CFileManagerActiveBase.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +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: Wraps wait note and real work thread -* -*/ - - - -#ifndef CFILEMANAGERACTIVEBASE_H -#define CFILEMANAGERACTIVEBASE_H - -// INCLUDES -#include -#include -#include "MFileManagerThreadFunction.h" - -// FORWARD DECLARATIONS -class CFileManagerThreadWrapper; - -// CLASS DECLARATION -/** -* Class wraps wait note and real work thread to avoid long running steps -* in the main thread that freezes the UI. -* -* @lib FileManagerEngine.lib -* @since 3.2 -*/ -NONSHARABLE_CLASS(CFileManagerActiveBase) : public CBase, - public MAknBackgroundProcess, - public MFileManagerThreadFunction - { - public: - /** - * Constructor for subclasses. - */ - void BaseConstructL(); - - /** - * Destructor. - */ - ~CFileManagerActiveBase(); - - TInt Result() const; - - private: // From MAknBackgroundProcess - void StepL(); - - TBool IsProcessDone() const; - - void DialogDismissedL( TInt aButtonId ); - - private: // From MFileManagerThreadFunction - void ThreadStepL(); - - TBool IsThreadDone(); - - void NotifyThreadClientL( TNotifyType aType, TInt aValue ); - - protected: - /** - * For subclasses to handle all processing in work thread - */ - virtual void ThreadFunctionL( const TBool& aCanceled ) = 0; - - /** - * For subclasses to request cancel in work thread - */ - virtual void CancelThreadFunction(); - - protected: - /** - * C++ default constructor. - */ - CFileManagerActiveBase(); - - private: // Data - // Wraps work thread control. Own. - CFileManagerThreadWrapper* iThreadWrapper; - - // Indicates if background process is done or not - TBool iDone; - - // Indicates if thread is canceled - TBool iCanceled; - - // Indicates the result - TInt iResult; - - }; - -#endif // CFILEMANAGERACTIVEBASE_H - -// End of File - diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerActiveExecute.h --- a/filemanager/Engine/inc/CFileManagerActiveExecute.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,284 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Handles the copy/move operation -* -*/ - - - -#ifndef CFILEMANAGERACTIVEEXECUTE_H -#define CFILEMANAGERACTIVEEXECUTE_H - -// INCLUDES -#include -#include -#include -#include "FileManagerEngine.hrh" -#include "MFileManagerProcessObserver.h" -#include "MFileManagerThreadFunction.h" - -// FORWARD DECLARATIONS -class CFileManagerEngine; -class MFileManagerItemIterator; -//class CMGXFileManager; -class CFileManagerThreadWrapper; - -/** -* CFileManagerActiveExecute -* -* Handles the copy and move operations. -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CFileManagerActiveExecute) : public CActive, - public MFileManagerThreadFunction - - { - - public: - - /** - * Overwrite file switch - */ - enum TFileManagerSwitch - { - ENoOverWrite = 1, - EOverWrite - }; - - /** - * Two-phased constructor. - * @since 2.0 - * @param aEngine reference to CFileManagerEngine instance - * @param aOperation defines type of operation copy or move - * @param aObserver reference to MFileManagerProcess implemented - * instance - * @param aIndexList list of indexes from current view which needs operation - * @param aToFolder folder where items are moved or copied - * @return Newly constructed CFileManagerActiveExecute - */ - IMPORT_C static CFileManagerActiveExecute* NewL( - CFileManagerEngine& aEngine, - MFileManagerProcessObserver::TFileManagerProcess aOperation, - MFileManagerProcessObserver& aObserver, - CArrayFixFlat& aIndexList, - const TDesC& aToFolder ); - - /** - * Destructor - */ - IMPORT_C ~CFileManagerActiveExecute(); - - /** - * Executes one operation at time, one file copy/move or directory creation - * @since 2.0 - * @param aOverWrite Over write the file or not - */ - IMPORT_C void ExecuteL( TFileManagerSwitch aOverWrite ); - - /** - * Cancel the operation - * @since 2.0 - */ - IMPORT_C void CancelExecution(); - - /** - * Gets destination folder - * @since 3.2 - */ - IMPORT_C TPtrC ToFolder(); - - private: - - // From CActive - void DoCancel(); - void RunL(); - TInt RunError(TInt aError); - - private: - /** - * C++ default constructor. - */ - CFileManagerActiveExecute( CFileManagerEngine& aEngine, - MFileManagerProcessObserver::TFileManagerProcess aOperation, - MFileManagerProcessObserver& aObserver ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( CArrayFixFlat& aIndexList, - const TDesC& aToFolder ); - - private: - - /** - * Item operation was succesfully carried on, move to next item - */ - void KErrNoneActionL(); - - /** - * Item operation was not succesful because there was target item already - * This function deals that situation - */ - void KErrAlreadyExistsActionL(); - - /** - * Takes last folder name on other string and appends it to other - * @param aResult Stores the result as full path - * @param aSrc source full path which last folder name is taken - * @param aDst target path where source last path is appended - */ - void AddLastFolder( TDes& aResult, const TDesC& aSrc, const TDesC& aDst ); - - /** - * Performs a copy or move operation - * - * @param aSwitch indicate destination file to be overwritten or not - * @return system wide error code - */ - TInt DoOperation( TInt aSwitch ); - - /** - * Checks if directory is empty - * - * @param aDir Full path of the directory - * @return ETrue if directory is empty, otherwise EFalse - */ - TBool IsEmptyDir( const TDesC& aDir ); - - /** - * Completes operation - * - * @param aError Operation result - */ - void CompleteL( TInt aError ); - - /** - * Updates MG2 notifications - * - * @param aForceFlush Indicates if notications are flushed - * @param aError Indicates the result - */ - void UpdateNotifications( TBool aFlush, TInt aError ); - - static void AppendArrayIfNotFound( - CDesCArray& aArray, const TDesC& aFullPath ); - - void FlushArray( CDesCArray& aArray ); - - void ThreadCopyOrMoveStepL(); - - void ThreadFinalizeMoveStepL(); - - private: // From MFileManagerThreadFunction - - void ThreadStepL(); - - TBool IsThreadDone(); - - void NotifyThreadClientL( TNotifyType aType, TInt aValue ); - - private: - - // index to current CDir array - TInt iCurrentIndex; - - // Own: Source item with full path - HBufC* iFullPath; - - // Own: Destination item with full path - HBufC* iDestination; - - // Has user cancelled the operation - TBool iCancelled; - - // Source directory is empty so special operations are needed - TBool iEmptyDir; - - // Needed to get the item locations behind given index(es) - CFileManagerEngine& iEngine; - - // Ref: Shareable file server session - RFs& iFs; - - // Move or copy operation - MFileManagerProcessObserver::TFileManagerProcess iOperation; - - // Own: Array of user selected items to be copied/moved - CArrayFixFlat< TInt >* iIndexList; - - // Own: user given destination folder - HBufC* iToFolder; - - // Own: This is either CFileManagerIndexIterator or CFileManagerFileSystemIterator - // depending of source item type, file or folder - MFileManagerItemIterator* iItemIterator; - - // Ref: File operation phases are signaled through this interface - MFileManagerProcessObserver& iObserver; - - // Ref: Current source item with full path - // Needed for file already exist situations. - HBufC* iSrc; - - // Ref: Current destination item with full path - // Needed for file already exist situations. - HBufC* iDst; - - // Total transferred bytes, used for progress note - // except in same drive move operation - TUint iBytesTransferredTotal; - - // Total transferred files, used for progress note - // This is used if move operation is done inside drive - TInt iFilesTransferredTotal; - - // Current error - TInt iError; - - // Ref: MG2 update notification object - //CMGXFileManager* iMgxFileManager; - - // Own: Thread wrapper for the operation - CFileManagerThreadWrapper* iThreadWrapper; - - // Indicates the used operation switches - TInt iSwitch; - - // Own: Buffer for storing changed items for MG2 notifications - CDesCArray* iChangedSrcItems; - - // Own: Buffer for storing changed items for MG2 notifications - CDesCArray* iChangedDstItems; - - // Indicates that the operation is done inside same drive - TBool iOperationOnSameDrive; - - // Indicates that move operation is finalizing - TBool iFinalizeMove; - - // Indicates that source of the operation is on remote drive - TBool iIsSrcRemoteDrive; - - // Indicates that destination of the operation is on remote drive - TBool iIsDstRemoteDrive; - - // Stores type of the current item - TFileManagerTypeOfItem iItemType; - }; - -#endif // CFILEMANAGERACTIVEEXECUTE_H - - // End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerActiveRename.h --- a/filemanager/Engine/inc/CFileManagerActiveRename.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +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: Class wraps rename operation -* -*/ - - - -#ifndef CFILEMANAGERACTIVERENAME_H -#define CFILEMANAGERACTIVERENAME_H - -// INCLUDES -#include -#include "CFileManagerActiveBase.h" - -// FORWARD DECLARATIONS -class RFs; -class CFileManagerEngine; -class CFileManagerUtils; - -// CLASS DECLARATION -/** -* Class wraps rename operation. -* -* @lib FileManagerEngine.lib -* @since 3.2 -*/ -NONSHARABLE_CLASS( CFileManagerActiveRename ) : public CFileManagerActiveBase - { - public: - /** - * Constructor. - */ - static CFileManagerActiveRename* NewL( - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils, - const TDesC& aName, - const TDesC& aNewName ); - - /** - * Destructor. - */ - ~CFileManagerActiveRename(); - - private: // From CFileManagerActiveBase - void ThreadFunctionL( const TBool& aCanceled ); - - void CancelThreadFunction(); - - private: - /** - * C++ default constructor. - */ - CFileManagerActiveRename( - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils ); - - void ConstructL( const TDesC& aName, const TDesC& aNewName ); - - TInt ThreadGetMaxSubfolderPathL( const TBool& aCanceled ); - - private: // Data - // Ref: File Manager engine - CFileManagerEngine& iEngine; - - // Ref: File Manager utils - CFileManagerUtils& iUtils; - - // Ref: Shareable file server session - RFs& iFs; - - // Own: Stores name. - HBufC* iName; - - // Own: Stores new name. - HBufC* iNewName; - - // Indicates if operation is done in remote drive - TBool iIsRemoteDrive; - }; - -#endif // CFILEMANAGERACTIVERENAME_H - -// End of File - diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerBackupSettings.h --- a/filemanager/Engine/inc/CFileManagerBackupSettings.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,320 +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: Backup settings -* -*/ - - -#ifndef C_FILEMANAGERBACKUPSETTINGS_H -#define C_FILEMANAGERBACKUPSETTINGS_H - - -// INCLUDE FILES -#include -#include - - -// FORWARD DECLARATIONS -class CFileManagerEngine; -class CRepository; - - -// CLASS DECLARATION -/** - * This class is used for storing backup settings - * - * @lib FileManagerEngine.lib - * @since S60 3.1 - */ -NONSHARABLE_CLASS(CFileManagerBackupSettings) : public CBase, - public MDesCArray - { - -public: - /** Backup setting type */ - enum TSettingType - { - ENone = 0, - EContents, - EScheduling, - EWeekday, - ETime, - ETarget - }; - - /** - * Two-phased constructor. - */ - static CFileManagerBackupSettings* NewL( - CFileManagerEngine& aEngine ); - - /** - * Destructor - */ - ~CFileManagerBackupSettings(); - - /** - * Sets backup contents - * - * @since S60 3.1 - * @param aContent Content bitmask - */ - IMPORT_C void SetContent( const TUint32 aContent ); - - /** - * Sets backup scheduling - * - * @since S60 3.1 - * @param aScheduling Scheduling type - */ - IMPORT_C void SetScheduling( const TInt aScheduling ); - - /** - * Sets backup weekday - * - * @since S60 3.1 - * @param aDay Backup weekday (See TDay) - */ - IMPORT_C void SetDay( const TInt aDay ); - - /** - * Sets backup time - * - * @since S60 3.1 - * @param aTime Time from 00:00 - */ - IMPORT_C void SetTime( const TTime& aTime ); - - /** - * Sets backup target drive - * - * @since S60 3.1 - * @param aDrive Target drive (See TDriveNumber) - */ - IMPORT_C void SetTargetDrive( const TInt aDrive ); - - /** - * Gets backup contents - * - * @since S60 3.1 - * @return Content bitmask - */ - IMPORT_C TUint32 Content() const; - - /** - * Gets backup scheduling - * - * @since S60 3.1 - * @return Scheduling type - */ - IMPORT_C TInt Scheduling() const; - - /** - * Gets backup weekday - * - * @since S60 3.1 - * @return Backup weekday (See TDay) - */ - IMPORT_C TInt Day() const; - - /** - * Gets backup time - * - * @since S60 3.1 - * @return Backup time - */ - IMPORT_C const TTime& Time() const; - - /** - * Gets backup target drive - * - * @since S60 3.1 - * @return Backup time - */ - IMPORT_C TInt TargetDrive() const; - - /** - * Saves backup settings - * - * @since S60 3.1 - */ - IMPORT_C void SaveL(); - - /** - * Gets setting type at position - * - * @since S60 3.1 - * @param aIndex Position - * @return Setting type - */ - IMPORT_C TInt SettingAt( const TInt aIndex ); - - /** - * Refreshes backup settings - * - * @since S60 3.1 - */ - IMPORT_C void RefreshL(); - - /** - * Gets textid from content bit - * - * @since S60 3.1 - * @param aContent content bit - * @return Textid - */ - static TInt ContentToTextId( const TUint32 aContent ); - - /** - * Gets allowed drive attribute match mask - * - * @since S60 3.1 - * @return drive attribute mask - */ - IMPORT_C TUint32 AllowedDriveAttMatchMask() const; - -public: // From MDesCArray - TInt MdcaCount() const; - - TPtrC MdcaPoint( TInt aIndex ) const; - -private: - /** Backup setting entry */ - NONSHARABLE_CLASS(CEntry) : public CBase - { - public: - ~CEntry(); - - HBufC* iText; - TSettingType iType; - }; - -private: - /** - * Constructors - */ - CFileManagerBackupSettings( CFileManagerEngine& aEngine ); - - void ConstructL(); - - /** - * Gets the count of contents selected - */ - TInt ContentsSelected() const; - - /** - * Creates backup setting entry - */ - CEntry* CreateEntryLC( - const TSettingType aType, - const TInt aTitleId, - const TInt aTextId, - const TInt aValue = 0 ); - - /** - * Creates backup setting entry - */ - CEntry* CreateEntryLC( - const TSettingType aType, - const TInt aTitleId, - const TDesC& aText ); - - /** - * Creates backup setting content entry - */ - CEntry* CreateContentsEntryLC(); - - /** - * Creates backup setting time entry - */ - CEntry* CreateTimeEntryLC(); - - /** - * Loads saved backup settings - */ - void LoadL(); - - /** - * Refreshes backup setting list entries - */ - void RefreshListL(); - - /** - * Creates backup setting target drive entry - */ - CEntry* CreateTargetDriveEntryLC(); - - /** - * Checks for multiple backup targets - */ - TBool HasMultipleBackupTargets(); - -private: // Data - /** - * Reference to file manager engine - * Not own. - */ - CFileManagerEngine& iEngine; - - /** - * Content bitmask - */ - TUint32 iContent; - - /** - * Scheduling type - */ - TInt iScheduling; - - /** - * Scheduled backup weekday - */ - TInt iDay; - - /** - * Scheduled backup time from 00:00 - */ - TTime iTime; - - /** - * Backup target drive - */ - TInt iTargetDrive; - - /** - * Backup setting list items - */ - RPointerArray< CEntry > iList; - - /** - * Allowed drive match mask - */ - TUint32 iAllowedDriveMatchMask; - - /** - * Pointer to CenRep - * Own. - */ - CRepository* iCenRep; - - /** - * Feature configuration - */ - TInt iFileManagerFeatures; - - }; - -#endif // C_FILEMANAGERBACKUPSETTINGS_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerCommonDefinitions.h --- a/filemanager/Engine/inc/CFileManagerCommonDefinitions.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2002-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: Common file manager definitions -* -*/ - - -#ifndef CFILEMANAGERCOMMONDEFINITIONS_H -#define CFILEMANAGERCOMMONDEFINITIONS_H - - -// CONSTANTS -_LIT( KFmgrBackslash, "\\" ); -const TInt KFmgrBackslashSpace = 1; - -// Left to right and right to left markers -_LIT( KFmgrDirectionalChars, "\x202A\x202B\x202C\x202D\x200E\x200F" ); - -_LIT( KFmgrTab, "\t" ); -_LIT( KFmgrLineFeed, "\n" ); -_LIT( KFmgrParagraphSeparator, "\x2029" ); -_LIT( KFmgrSpace, " " ); - -const TInt KFmgrDoubleMaxFileName = KMaxFileName * 2; - -_LIT( KFmgrFatFSName, "Fat" ); - -#endif // CFILEMANAGERCOMMONDEFINITIONS_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerDocHandler.h --- a/filemanager/Engine/inc/CFileManagerDocHandler.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* -* Copyright (c) 2004-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: Wraps document handler functions -* -*/ - - - -#ifndef CFILEMANAGERDOCHANDLER_H -#define CFILEMANAGERDOCHANDLER_H - -// INCLUDES -#include -#include -#include -#include "MFileManagerThreadFunction.h" - -// FORWARD DECLARATIONS -class CDocumentHandler; -class CFileManagerEngine; -class CFileManagerUtils; -class CEikProcess; -class CFileManagerThreadWrapper; -class MFileManagerProcessObserver; - - -// CLASS DECLARATION -/** -* This class wraps dochandler functions -* -* @lib FileManagerEngine.lib -* @since 2.7 -*/ -NONSHARABLE_CLASS(CFileManagerDocHandler) : public CBase, - public MAknServerAppExitObserver, - public MFileManagerThreadFunction - { - public: - - /** - * Two-phased constructor. - */ - static CFileManagerDocHandler* NewL( - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils ); - - /** - * Destructor. - */ - ~CFileManagerDocHandler(); - - private: // From MAknServerAppExitObserver - void HandleServerAppExit( TInt aReason ); - - private: // From MFileManagerThreadFunction - - void ThreadStepL(); - - TBool IsThreadDone(); - - void NotifyThreadClientL( TNotifyType aType, TInt aValue ); - - public: // New functions - void OpenFileL( - const TDesC& aFullPath, MFileManagerProcessObserver* aObserver ); - - void CancelFileOpen(); - - private: - /** - * C++ default constructor. - */ - CFileManagerDocHandler( - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - void OpenShareableFileL( RFile64& aShareableFile, const TDesC8& aMime ); - - private: - - // Ref: To notify engine of embedded application - CFileManagerEngine& iEngine; - - // Ref: For using utilities - CFileManagerUtils& iUtils; - - // Ref: Shareable file server session - RFs& iFs; - - // Own: For launching files - CDocumentHandler* iDocHandler; - - // Own: Shareable file - RFile64 iFile; - - // Own: File ready indicator - TBool iFileReady; - - // Own: File fullpath - HBufC* iFileFullPath; - - // Own: File MIME type - HBufC8* iFileMime; - - // Ref: Observer for document open status - MFileManagerProcessObserver* iObserver; - - // Own: For async file open for downloading file to cache - CFileManagerThreadWrapper* iThreadWrapper; - - // Own: For getting app uids - RApaLsSession iApaSession; - - // Own: Indicates the file open status - TBool iEmbeddedAppOpen; - - }; - -#endif // CFILEMANAGERDOCHANDLER_H diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerEngine.h --- a/filemanager/Engine/inc/CFileManagerEngine.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,928 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Main class of the File Manager Engine -* -*/ - - - -#ifndef CFILEMANAGERENGINE_H -#define CFILEMANAGERENGINE_H - -// INCLUDES -#include -#include -#include -#include -#include "MFileManagerProcessObserver.h" -#include "FileManagerEngine.hrh" -#include "TFileManagerDriveInfo.h" -#include "CFileManagerRestoreSettings.h" - -// CONSTANTS -// File Manager engine spcific error codes -// defined numbers should be far away from system wide error code numbers -const TInt KErrFmgrSeveralFilesInUse = -4500; -const TInt KErrFmgrDefaultFolder = -4501; -const TInt KErrFmgrNotSupportedRemotely = -4502; - -// FORWARD DECLARATIONS -class CGflmNavigatorModel; -class CFileManagerItemProperties; -class CFileManagerActiveDelete; -class CFileManagerActiveSize; -class CFileManagerActiveExecute; -class CFileManagerRefresher; -class CFileManagerFileSystemEvent; -class CFileManagerUtils; -//class CMGXFileManager; -class CFileManagerItemFilter; -class CFileManagerRemovableDriveHandler; -class CFileManagerRemoteDriveHandler; -class CFileManagerDocHandler; -class CFileManagerBackupSettings; -class CFileManagerRestoreSettings; -class CFileManagerActiveRename; -class CFileManagerFeatureManager; -class MAknServerAppExitObserver; - - -// CLASS DECLARATION -/** -* This class implements the main functionalities of File Manager Engine -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CFileManagerEngine) : public CBase - { - - public: - - // Engine state - enum TState - { - ENavigation = 0, // For using navigation list model - ESearch // For using search list model - }; - - // Sort method - enum TSortMethod - { - EByName = 0, - EByType, - EMostRecentFirst, - ELargestFirst, - EByMatch - }; - - public: - /** - * Two-phased constructor. - * @param aFs Shareable file server session, see RFs::ShareProtected() - * @return Pointer to a CFileManagerEngine instance - */ - IMPORT_C static CFileManagerEngine* NewL( RFs& aFs ); - - /** - * Destructor. - */ - IMPORT_C ~CFileManagerEngine(); - - public: // Interface - - /** - * Set currently viewed memory - * @since 2.0 - * @param aMemory The memory type - * @return system wide error code - */ - IMPORT_C TInt SetMemoryL( TFileManagerMemory aMemory ); - - /** - * Returns the currently viewed memory - * @since 2.0 - * @return TFileManagerMemory, the memory type - */ - IMPORT_C TFileManagerMemory Memory() const; - - /** - * Returns selected views item in array, which ListBox can show - * @since 2.0 - * @return Array of formatted strings of current view - */ - IMPORT_C MDesCArray* FileList() const; - - /** - * Engine signals events with this observer - * @since 2.0 - * @param aObserver The process observer or NULL, ownership is not transferred - */ - IMPORT_C void SetObserver( MFileManagerProcessObserver* aObserver ); - - /** - * Returns full path of the current directory - * @since 2.0 - * @return Full path of current directory - */ - IMPORT_C TPtrC CurrentDirectory() const; - - /** - * Returns localized name of the current directory - * @since 2.0 - * @return Full path of current directory - */ - IMPORT_C TPtrC LocalizedNameOfCurrentDirectory() const; - - /** - * This backsteps the navigator to previously visible folder - * @since 2.0 - */ - IMPORT_C void BackstepL(); - - /** - * Returns the type of given item index in CFileManagerItemProperties bitmask - * @since 2.0 - * @param aIndex The index to current view index. - * @return CFileManagerItemProperties bitmask - */ - IMPORT_C TUint32 FileTypeL( const TInt aIndex ) const; - - /** - * Returns the type of given item index in CFileManagerItemProperties bitmask - * @since 2.0 - * @param aFullPath Full path to item which type is needed.. - * @return CFileManagerItemProperties bitmask - */ - IMPORT_C TUint32 FileTypeL( const TDesC& aFullPath ) const; - - /** - * Delete file(s) or folder, caller should delete the returned object. - * @since 2.0 - * @param aIndexList List of indexes from current directory which is going to be deleted - * @return pointer to newly created CFileManagerActiveDelete object - */ - IMPORT_C CFileManagerActiveDelete* CreateActiveDeleteL( - CArrayFixFlat< TInt >& aIndexList ); - - /** - * Creates a new folder - * @since 2.0 - * @param aFolderName Name of the new folder which is created current directory - */ - IMPORT_C void NewFolderL( const TDesC& aFolderName ); - - /** - * Set the current item name - * @since 5.0 - * @param aFileName File name to be set - */ - IMPORT_C void SetCurrentItemName( const TDesC& aFileName ); - - /** - * Rename the file or folder. - * @since 3.2 - * @param aIndex index of the file or folder from current directory - * @param aNewFileName name where that file or folder name is changed - * @return System wide error code - */ - IMPORT_C void RenameL( const TInt aIndex, const TDesC& aNewFileName ); - - /** - * Opens the file or folder - * @since 2.0 - * @param aIndex from the current directory list - */ - IMPORT_C void OpenL( const TInt aIndex ); - - /** - * Returns the depth of the current folder - * @since 2.0 - * @return Current depth in folder tree, 0 is root, 1 one folder down - */ - IMPORT_C TInt FolderLevel(); - - /** - * Checks from current directory, if the name is found - * @since 2.0 - * @param aString Name which is matched with current directory files and folders - * @return ETrue if exists - * EFalse if not exists in current directory - */ - IMPORT_C TBool IsNameFoundL(const TDesC& aString); - - /** - * returns number of the current drive. - * @since 2.0 - * @returns TDriveNumber type, or KErrNotFound if no current drive set - */ - IMPORT_C TInt CurrentDrive(); - - /** - * returns info class of the item - * @since 2.0 - * @param aIndex to current directory item - * @return class which contains all necessary data for info box, receiver must delete it - */ - IMPORT_C CFileManagerItemProperties* GetItemInfoL( const TInt aIndex ); - - /** - * returns info about MMC status - * @since 2.0 - * @return class which contains all necessary data for MMC status - */ - IMPORT_C TFileManagerDriveInfo GetMMCInfoL() const; - - /** - * Sets the state of the engine - * @since 2.0 - * @param aState TState, the state type - */ - IMPORT_C void SetState( TState aState ); - - /** - * Gets the state of the engine - * @since 2.0 - * @return TState, the state type - */ - IMPORT_C CFileManagerEngine::TState State() const; - - /** - * Updates the current view - * @since 2.0 - */ - IMPORT_C void RefreshDirectory(); - - /** - * Returns string which was used for finding items - * @since 2.0 - * @return Ref to string - */ - IMPORT_C TPtrC SearchString() const; - - /** - * Is given file name valid - * @since 2.0 - * @param aDriveAndPath root path - * @param aName name of the file - * @param aIsFolder ETrue folder and EFalse file name - * @return ETrue if file name is valid - */ - IMPORT_C TBool IsValidName( - const TDesC& aDriveAndPath, - const TDesC& aName, - TBool aIsFolder ) const; - - /** - * Check that if given file name contains illegal characters - * @since 2.0 - * @param aName name of the file - * @return ETrue if file name is valid - */ - IMPORT_C TBool IllegalChars( const TDesC& aName ) const; - - /** - * Check that there is enough memory to do specific operation - * @since 2.0 - * @param aToFolder Target memory - * @param aSize Space needed bytes - * @param aOperation Move or Copy - * @return ETrue if there is enough space for operation - */ - IMPORT_C TBool EnoughSpaceL( - const TDesC& aToFolder, - TInt64 aSize, - MFileManagerProcessObserver::TFileManagerProcess aOperation ) const; - - /** - * Sets the file system event on or off - * @since 2.0 - * @param aSet ETrue sets file system event - * EFalse turns events off - */ - IMPORT_C void FileSystemEvent( TBool aEventOn ); - - /** - * Returns the current focus index if rename, copy/move or new folder - * operation has happened - * @since 2.0 - * @return index to current focused item, - * KErrNotFound if not found - */ - IMPORT_C TInt CurrentIndex(); - - /** - * returns the file name with full path which is behind given index - * @since 2.0 - * @param aIndex to current directory item - * @return HBufC buffer which caller must release after usage - */ - IMPORT_C HBufC* IndexToFullPathL( const TInt aIndex) const; - - /** - * returns the file name with full path which is behind given index - * @since 3.2 - * @param aIndex to current directory item - * @return HBufC buffer which caller must release after usage - */ - IMPORT_C HBufC* IndexToFullPathLC( const TInt aIndex ) const; - - /** - * Checks given item that can it be deleted. - * @since 2.0 - * @param aFullPath full path to item which is checked - * @returns ETrue if item can be deleted, EFalse if not - */ - TBool CanDelete( const TDesC& aFullPath ) const; - - /** - * returns localized name of the given item - * @since 2.0 - * @param aFullPath full path to item which is checked - * @returns TDesC reference to localized name - */ - IMPORT_C TPtrC LocalizedName( const TDesC& aFullPath ) const; - - /** - * returns the count of files in folder - * @since 2.0 - * @return count of files in folder - */ - IMPORT_C TInt FilesInFolderL(); - - /** - * Cancels the refresh operation - * @since 2.0 - * @return ETrue if refresh process is cancelled, - * EFalse if there wasn't any refresh process ongoing - */ - IMPORT_C TBool CancelRefresh(); - - /** - * Checks given index is it folder, this call is very quick - * because it uses icon information to retrieve item type - * @since 2.0 - * @param aIndex index to item - * @return ETrue item behind the index is folder - * EFalse item behind the index is not folder - */ - IMPORT_C TBool IsFolder( const TInt aIndex ) const; - - /** - * Asynchronous notifies about drive added or changed - * @since 5.2 - * @param aPtr Pointer to an instance of this class - * @return 0 - */ - static TInt DriveAddedOrChangeAsyncL( TAny* aPtr ); - - /** - * Notifies about drive added or changed - * @since 3.1 - */ - void DriveAddedOrChangedL(); - - /** - * Notifies about folder content changed - * @since 3.2 - */ - void FolderContentChangedL(); - - /** - * Resolves the icon id of the given item index - * @since 2.7 - * @param aIndex index to item - * @return Icon id of the item behind the index - * - */ - IMPORT_C TInt IconIdL( const TInt aIndex ) const; - - /** - * Checks is given folder system folder - * @since 3.1 - * @param aFull Full path to item - * @return ETrue if folder is system folder, EFalse if not - */ - IMPORT_C TBool IsSystemFolder( const TDesC& aFullPath ) const; - - /** - * Gets current drive name - * @since 3.2 - * @return Drive name - */ - IMPORT_C TPtrC CurrentDriveName(); - - /** - * Renames the current drive - * @since 3.1 - * @param aDrive Drive number EDriveA...EDriveZ - * @param aName The new name - * @return System wide error code - */ - IMPORT_C TInt RenameDrive( - const TInt aDrive, const TDesC& aName ); - - /** - * Retrieves current drive information - * @param aInfo A reference to a TFileManagerDriveInfo object - */ - IMPORT_C void GetDriveInfoL( TFileManagerDriveInfo& aInfo ); - - /** - * Sets password on current drive - * @since 3.1 - * @param aDrive Drive number EDriveA...EDriveZ - * @param aOld The old password - * @param aNew The new password - * @return System wide error code - */ - IMPORT_C TInt SetDrivePassword( - const TInt aDrive, - const TMediaPassword& aOld, - const TMediaPassword& aNew ); - - /** - * Removes password from current drive - * @since 3.1 - * @param aDrive Drive number EDriveA...EDriveZ - * @param aPwd The current password - * @return System wide error code - */ - IMPORT_C TInt RemoveDrivePassword( - const TInt aDrive, - const TMediaPassword& aPwd ); - - /** - * Unlocks the current drive - * @since 3.1 - * @param aDrive Drive number EDriveA...EDriveZ - * @param aPwd The current password - * @return System wide error code - */ - IMPORT_C TInt UnlockDrive( - const TInt aDrive, - const TMediaPassword& aPwd ); - - /** - * Starts format process - * @since 3.1 - * @param aDrive Drive number EDriveA...EDriveZ - */ - IMPORT_C void StartFormatProcessL( const TInt aDrive ); - - /** - * Starts eject process - * @since 3.2 - * @param aDrive Drive number EDriveA...EDriveZ - */ - IMPORT_C void StartEjectProcessL( const TInt aDrive ); - - /** - * Initiates backup or restore process - * @since 3.1 - * @param aProcess The process to start: - * EBackupProcess or ERestoreProcess - */ - IMPORT_C void StartBackupProcessL( - MFileManagerProcessObserver::TFileManagerProcess aProcess ); - - /** - * Cancels ongoing process - * @since 3.1 - * @param aProcess The process to cancel - */ - IMPORT_C void CancelProcess( - MFileManagerProcessObserver::TFileManagerProcess aProcess ); - - /** - * Get drive state - * @since 3.1 - * @param aState For TFileManagerDriveInfo::TDriveState bits - * @param aPath Only drive letter is used - * @return System wide error code - */ - IMPORT_C TInt DriveState( TUint32& aState, const TDesC& aPath ) const; - - /** - * Get drive state - * @since 3.1 - * @param aState For TFileManagerDriveInfo::TDriveState bits - * @param aDrive - * @return System wide error code - */ - IMPORT_C TInt DriveState( TUint32& aState, const TInt aDrive ) const; - - /** - * Determine if given file must be protected (kept on the device) - * @since 3.1 - * @param aFullPath Full path to item - * @param aIsProtected The protection status - * @return System wide error code - */ - IMPORT_C TInt IsDistributableFile( const TDesC& aFullPath, - TBool& aIsProtected ) const; - - /** - * Connects or disconnects remote drive - * @since 3.1 - * @param aDrive Drive number EDriveA...EDriveZ - * @param aConnect ETrue when connecting, EFalse when disconnecting - * @return System wide error code - */ - IMPORT_C TInt SetRemoteDriveConnection( - const TInt aDrive, TBool aConnect ); - - /** - * Deletes the remote drive settings from remote storage framework - * @since 3.1 - * @param aDrive Drive number EDriveA...EDriveZ - * @return System wide error code - */ - IMPORT_C TInt DeleteRemoteDrive( const TInt aDrive ); - - /** - * Gets drive root directory - * @since 3.1 - * @param aDrive Drive number EDriveA...EDriveZ - * @return Reference to root directory string - */ - IMPORT_C TPtrC DriveRootDirectory( const TInt aDrive ) const; - - /** - * Gets backup settings - * @since 3.1 - * @return Reference to backup settings. - */ - IMPORT_C CFileManagerBackupSettings& BackupSettingsL(); - - /** - * Gets restore settings - * @since 3.1 - * @return Reference to restore settings. - */ - IMPORT_C CFileManagerRestoreSettings& RestoreSettingsL(); - - /** - * Gets drive name - * @since 3.1 - * @param aDrive Drive that name is required - * @return Reference to drive name. - */ - IMPORT_C TPtrC DriveName( const TInt aDrive ); - - /** - * Gets drive info - * @since 3.1 - * @param aDrive Drive that info is required - * @param aInfo For storing drive info - */ - IMPORT_C void GetDriveInfoL( - const TInt aDrive, TFileManagerDriveInfo& aInfo ) const; - - /** - * Gets restore info array - * @since 3.1 - * @param aArray For storing restore info - * @param aDrive For getting info from specific drive - */ - IMPORT_C void GetRestoreInfoArrayL( - RArray< CFileManagerRestoreSettings::TInfo >& aArray, - const TInt aDrive = KErrNotFound ) const; - - /** - * Checks if any ejectable drive is present - * @since 3.1 - * @return ETrue if present, otherwise EFalse - */ - IMPORT_C TBool AnyEjectableDrivePresent() const; - - /** - * Ensures that contents of a directory are up to date - * including remote drives when current view is updated - * @since 3.1 - */ - IMPORT_C void ForcedRefreshDirectory(); - - /** - * Calculates the total size of given items - * @since 3.2 - * @param aIndexList List of indexes from current directory - * @return Total size - */ - IMPORT_C TInt64 GetFileSizesL( - const CArrayFixFlat< TInt >& aIndexList ); - - /** - * Gets navigation level, the depth of backstep stack - * @since 3.2 - * @return The navigation level - */ - IMPORT_C TInt NavigationLevel() const; - - /** - * Gets drive name and letter as combined formatted text. - * @since 5.0 - * @param aDrive Drive number EDriveA...EDriveZ - * @param aTextIdForDefaultName TextId of default name format string - * @param aTextIdForName TextId of name format string - * @return Text containing drive letter and name - */ - IMPORT_C HBufC* GetFormattedDriveNameLC( - const TInt aDrive, - const TInt aTextIdForDefaultName, - const TInt aTextIdForName = 0 ) const; - - /** - * Returns info class of the item - * @since 5.0 - * @param aIndex to current directory item - * @return class which contains all necessary data for info box, receiver must delete it - */ - IMPORT_C CFileManagerItemProperties* GetItemInfoLC( const TInt aIndex ); - - /** - * Sets search string. - * @since 3.2 - * @param aSearchString Search string - */ - IMPORT_C void SetSearchStringL( const TDesC& aSearchString ); - - /** - * Sets search folder. - * @since 3.2 - * @param aSearchString Search folder - */ - IMPORT_C void SetSearchFolderL( const TDesC& aSearchFolder ); - - /** - * Sets the directory with backsteps. - * @since 3.2 - * @param aDirectory New current directory - */ - IMPORT_C void SetDirectoryWithBackstepsL( const TDesC& aDirectory ); - - /** - * Stores current navigation index. - * @since 3.2 - * @param aIndex The index to current view index. - */ - IMPORT_C void SetCurrentIndex( const TInt aIndex ); - - /** - * Sets the sort method of the engine - * @since 5.0 - * @param aSortMethod TSortMethod, the sort method type - */ - IMPORT_C void SetSortMethod( TSortMethod aSortMethod ); - - /** - * Gets the sort method of the engine - * @since 5.0 - * @return TSortMethod, the sort method type - */ - IMPORT_C CFileManagerEngine::TSortMethod SortMethod() const; - - /** - * Re-sorts the current view - * @since 5.0 - */ - IMPORT_C void RefreshSort(); - - /** - * Gets the feature manager - * @since 3.2 - */ - IMPORT_C CFileManagerFeatureManager& FeatureManager() const; - - /** - * Set server application exit observer - * @Param aObserver The ServerAppExit observer or NULL, ownership is not transferred - */ - IMPORT_C void SetAppExitOb( MAknServerAppExitObserver* aObserver ); - - /** - * Deletes the backup archives selected using - * CFileManagerRestoreSettings::SetSelection() method. - * @since 5.0 - */ - IMPORT_C void DeleteBackupsL(); - - /** - * Check if a drive is mounted - * @Param aDrive The target drive to check - * @Return TBool to indicate check result - * @since 5.2 - */ - IMPORT_C TBool IsDriverMounted( TInt aDrive ); - - public: - - /** - * Set whether the file is a sis file - * @Param aSisFile file is or not a sis file - */ - void SetSisFile( TBool aSisFile ); - - /* - * Notice the ServerAppExit event - * @Param aReason the reason of the server application exit - */ - void NoticeServerAppExit( TInt aReason ); - - /** - * Sets embedded app status - * @param aStatus ETrue if embedded app on, EFalse if not - */ - void EmbeddedAppStatus( TBool aStatus ); - - /* MFileManagerWaitNote */ - void ShowWaitDialogL( MAknBackgroundProcess& aProcess ); - - //CMGXFileManager& MGXFileManagerL(); - - RFs& Fs() const; - - TBool HasAppRemoteDriveSupport( TUid aUid ); - - TBool IsRemoteDriveConnected( const TInt aDrive ) const; - - TBool BackupFileExistsL( const TInt aDrive ) const; - - // Ensures that drive info is refreshed on next update - void ClearDriveInfo(); - - // Cancels ongoing transfer - void CancelTransfer( const TDesC& aFullPath ); - - /** - * Gets the latest backup time - * @since 5.0 - * @param aBackupTime Stores the latest backup time - * @return System wide error code - */ - TInt LatestBackupTime( TTime& aBackupTime ); - - private: - /** - * C++ default constructor. - */ - CFileManagerEngine( RFs& aFs ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - // Adds current dir fullpath to given name, returns HBufC buffer which must be released - HBufC* AddFullPathLC( const TDesC& aName, const TBool aIsFolder ); - - // Sets file system event watcher for given path - void SetFileSystemEventL( const TDesC& aFullPath = KNullDesC ); - - // For checking mount state - TInt CheckDriveMountL( TInt aDrive ) const; - - // For getting drive info - void GetDriveInfoL( - const TDesC& aPath, TFileManagerDriveInfo& aInfo ) const; - - // Opens file - void OpenFileL( const TDesC& aFullPath ); - - // Opens directory - void OpenDirectoryL( const TDesC& aFullPath ); - - // Checks is current drive available - TBool CurrentDriveAvailable(); - - /** - * Start asynchronous disk event notification timer - * @since 5.2 - */ - void StartDiskEventNotifyTimerAsyncL(); - - /** - * Stop asynchronous disk event notification timer - * @since 5.2 - */ - void StopDiskEventNotifyTimerAsync(); - - private: - - // Own: General File List Model is used via this object. - CGflmNavigatorModel* iNavigator; - - // Ref: For file operations - RFs& iFs; - - // Normal or search state - TState iState; - - // Own: String which was used in latest search - HBufC* iSearchString; - - // Own: String which is used for search process - HBufC* iSearchProcessString; - - // Own: AO for async GFLM refresh operation - CFileManagerRefresher* iRefresher; - - // Ref: Handle to current observer - MFileManagerProcessObserver* iProcessObserver; - - // Own: Handles file system events - CFileManagerFileSystemEvent* iFileSystemEvent; - - // item name of current index, used to search current index - TFileName iCurrentItemName; - - // Own: Folder size calculation - CFileManagerActiveSize* iActiveSize; - - // Own: Checks drive notifications - CFileManagerFileSystemEvent* iDiskEvent; - - // Own: Indicates if embedded application is on - TBool iEmbeddedApplicationOn; - - // Own: MG2 update notification object - //CMGXFileManager* iMgxFileManager; - - // Own: Compines services of couple classes - CFileManagerUtils* iUtils; - - // Own: Used for item filtering - CFileManagerItemFilter* iItemFilter; - - // Own: Used for handling memory card etc functinalities - CFileManagerRemovableDriveHandler* iRemovableDrvHandler; - - // Own: Used for handling remote drive functinalities - CFileManagerRemoteDriveHandler* iRemoteDrvHandler; - - // Own: Used for opening files - CFileManagerDocHandler* iDocHandler; - - // Own: Used for backup settings - CFileManagerBackupSettings* iBackupSettings; - - // Own: Used for restore settings - CFileManagerRestoreSettings* iRestoreSettings; - - // Own: Indicates last drive available status - TBool iLastDriveAvailable; - - // Own: Stores current drive info - TFileManagerDriveInfo iCurrentDriveInfo; - - // Own: Indicates if current drive info is refreshed - TBool iCurrentDriveInfoRefreshed; - - // Own: Indicates if wait dialog is on - TBool iWaitDialogOn; - - // Own: Stores drive name - HBufC* iDriveName; - - // Own: Navigation indices - RArray< TInt > iNavigationIndices; - - // Own: Used for rename - CFileManagerActiveRename* iActiveRename; - - // Own: Used for storing search folder - HBufC* iSearchFolder; - - // Own: Indicates file system event status - TBool iFileSystemEventEnabled; - - // Own: Indicates if drive added or changed update is postponed - TBool iDriveAddedOrChangedPostponed; - - // Own: Manages runtime variated features - CFileManagerFeatureManager* iFeatureManager; - - // Ref: Handle to current ServerAppExit observer - MAknServerAppExitObserver* iObserver; - - //Own: Whether the file was a sis type - TBool iSisFile; - - //Own: postpone disk event notification while disk refresh is ongoing - CPeriodic* iDelayedDiskEventNotify; - }; - -#endif // CFILEMANAGERENGINE_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerFeatureManager.h --- a/filemanager/Engine/inc/CFileManagerFeatureManager.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This class manages the runtime variated features -* -*/ - - - -#ifndef C_FILEMANAGERFEATUREMANAGER_H -#define C_FILEMANAGERFEATUREMANAGER_H - -#include - -/** -* This class manages the runtime variated features -* -* @lib FileManagerEngine.lib -* @since 3.2 -*/ -NONSHARABLE_CLASS(CFileManagerFeatureManager) : public CBase - { -public: - /** - * Two-phased constructor. - */ - static CFileManagerFeatureManager* NewL(); - - /** - * Destructor. - */ - virtual ~CFileManagerFeatureManager(); - - /** - * Checks if feature is supported - * @since 3.2 - */ - IMPORT_C TBool IsDrmFullSupported() const; - - /** - * Checks if feature is supported - * @since 3.2 - */ - IMPORT_C TBool IsHelpSupported() const; - - /** - * Checks if feature is supported - * @since 3.2 - */ - IMPORT_C TBool IsIrdaSupported() const; - - /** - * Checks if feature is supported - * @since 3.2 - */ - IMPORT_C TBool IsRemoteStorageFwSupported() const; - - /** - * Checks if feature is supported - * @since 3.2 - */ - IMPORT_C TBool IsMmcPassWdSupported() const; - - /** - * Checks if feature is supported - * @since 3.2 - */ - IMPORT_C TBool IsWesternVariant() const; - - /** - * Checks if feature is supported - * @since 3.2 - */ - IMPORT_C TBool IsMmcSwEjectSupported() const; - - /** - * Checks if feature specified by TFileManagerFeatures is supported - * @since 3.2 - */ - IMPORT_C TBool IsFeatureSupported( TInt aFileManagerFeature ) const; - - /** - * Checks if the application is in embedded mode - * @since 3.2 - */ - IMPORT_C TBool IsEmbedded() const; - -private: - /** - * C++ default constructor. - */ - CFileManagerFeatureManager(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - -private: // Data - TBool iDrmFullSupported; - TBool iHelpSupported; - TBool iIrdaSupported; - TBool iRemoteStorageFwSupported; - TBool iMmcPassWdSupported; - TBool iWesternVariant; - TBool iMmcSwEjectSupported; - TBool iEmbedded; - TInt iFileManagerFeatures; - }; - -#endif // C_FILEMANAGERFEATUREMANAGER_H diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerFileSystemIterator.h --- a/filemanager/Engine/inc/CFileManagerFileSystemIterator.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* -* Copyright (c) 2002-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: Goes through folder tree one item at time -* -*/ - - -#ifndef CFILEMANAGERFILESYSTEMITERATOR_H -#define CFILEMANAGERFILESYSTEMITERATOR_H - -// INCLUDES -#include -#include -#include "Mfilemanageritemiterator.h" - - -class CFileManagerEngine; - -/** -* Goes through all the folder items of given folder. Implements the -* MFileManagerItemIterator. -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CFileManagerFileSystemIterator) : - public CBase, - public MFileManagerItemIterator - { - public: - - /** - * Two-phased constructor. - */ - static CFileManagerFileSystemIterator* NewL( - RFs& aFs, - const TDesC& aSrcDir, - const TDesC& aDstDir, - CFileManagerEngine& aEngine ); - - /** - * Destructor. - */ - ~CFileManagerFileSystemIterator(); - - public: // From MFileManagerItemIterator - void CurrentL( - HBufC** aSrc, HBufC** aDst, TFileManagerTypeOfItem& aItemType ); - - TBool NextL(); - - public: - - /** - * returns localized path - * @since 2.0 - * @return reference to localized path string - */ - TPtrC LocalizedAbbreviatedPath(); - - private: - /** - * C++ default constructor. - */ - CFileManagerFileSystemIterator( - const TDesC& aDstDir, CFileManagerEngine& aEngine ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( RFs& aFs, const TDesC& aSrcDir ); - - private: - // Own: With this folders are scan through - CDirScan* iDirScan; - - // Own: CDirScan returns this, contains one folder content at time - CDir* iDir; - - // Index to current CDir array item which is processed - TInt iCount; - - // Own: Current item source fullpath - // reserved here so that caller can then use this via reference - HBufC* iSrc; - - // Own: Current item destination fullpath - // reserved here so that caller can then use this via reference - HBufC* iDst; - - // Ref: Destination directory - const TDesC& iDstDir; - - // Set when all folders are gone through - TBool iFolderScanDone; - - // Own: Source directory - HBufC* iSrcDir; - - // Ref: File Manager engine - CFileManagerEngine& iEngine; - - // Own: Localized Abbreviated Path - TFileName iLocalizedAbbreviatedPath; - - }; - -#endif // CFILEMANAGERFILESYSTEMITERATOR_H - diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerFolderEntry.h --- a/filemanager/Engine/inc/CFileManagerFolderEntry.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2002-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: Holds one default folder entry -* -*/ - - -#ifndef CFILEMANAGERFOLDERENTRY_H -#define CFILEMANAGERFOLDERENTRY_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class TResourceReader; - -/** -* One default folder entry. -* Contains fullpath of the default folder and information -* is it media folder or nor. -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CFileManagerFolderEntry) : public CBase - { - public: - /** - * Two-phased constructors. - */ - static CFileManagerFolderEntry* NewLC( TResourceReader& aReader ); - - static CFileManagerFolderEntry* NewL( TResourceReader& aReader ); - - static CFileManagerFolderEntry* NewLC( - const TInt aDrive, const TDesC& aPath ); - - /** - * Destructor. - */ - ~CFileManagerFolderEntry(); - public: // New functions - - /** - * Is the default folder media folder or not - * @since 2.0 - * @return ETrue if default folder is media folder, EFalse if not - */ - TBool IsMediaFolder() const; - - /** - * Returns reference to full path information of default folder - * @since 2.0 - * @return Reference to default folder full path descriptor. - */ - TPtrC Name() const; - - /** - * Used for sorting folder entries - * @since 3.2 - * @param aFirst Reference to the first folder entry - * @param aSecond Reference to the second folder entry - * @return Comparison result. - */ - static TInt CompareSort( - const CFileManagerFolderEntry& aFirst, - const CFileManagerFolderEntry& aSecond ); - - /** - * Used for finding folder from sorted entries - * @since 3.2 - * @param aPath Path to find - * @param aItem Reference to the folder entry - * @return Comparison result. - */ - static TInt CompareFind( - const TDesC* aPath, - const CFileManagerFolderEntry& aItem ); - - private: - /** - * C++ default constructor. - */ - CFileManagerFolderEntry(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructFromResourceL( TResourceReader& aReader); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( const TInt aDrive, const TDesC& aPath ); - - private: // Date - // Own: Full path information of default folder - HBufC* iName; - - // Is the default folder media folder - TBool iIsMediaFolder; - - }; - - -#endif // CFILEMANAGERFOLDERENTRY_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerIRReceiver.h --- a/filemanager/Engine/inc/CFileManagerIRReceiver.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,203 +0,0 @@ -/* -* Copyright (c) 2002-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: Receives obex object via InfraRed, used to receive files -* -*/ - - - -#ifndef CFILEMANAGERIRRECEIVER_H -#define CFILEMANAGERIRRECEIVER_H - -// INCLUDES -#include -#include - -// FORWARD DECLARATIONS -class CObexServer; -class CObexBufObject; -class MFileManagerProcessObserver; -class CFileManagerEngine; - -// CLASS DECLARATION -/** -* Handles the file receiving via infrared -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CFileManagerIRReceiver) : public CBase, - public MObexServerNotify - { - public: - - /** - * Two-phased constructor. - */ - IMPORT_C static CFileManagerIRReceiver* NewL( - MFileManagerProcessObserver& aObserver, - const TDesC& aPath, - CFileManagerEngine& aEngine ); - - /** - * Destructor. - */ - IMPORT_C ~CFileManagerIRReceiver(); - - /** - * Receives file through IR and stores it to - * iPath location. Filename is get from - * sent file and not included in iPath. - */ - IMPORT_C void ReceiveFileL(); - - /** - * Stops receive process and discards all received data. - */ - IMPORT_C void StopReceiving(); - - public: // From MObexServerNotify - /** - * @see MObexServerNotify - */ - void ErrorIndication (TInt aError); - /** - * @see MObexServerNotify - */ - void TransportUpIndication (); - /** - * @see MObexServerNotify - */ - void TransportDownIndication (); - /** - * @see MObexServerNotify - */ - TBool TargetHeaderReceived(TDesC8& aTargetHeader); - /** - * @see MObexServerNotify - */ - TInt ObexConnectIndication( - const TObexConnectInfo& aRemoteInfo, const TDesC8& aInfo ); - /** - * @see MObexServerNotify - */ - void ObexDisconnectIndication (const TDesC8& aInfo); - /** - * @see MObexServerNotify - */ - CObexBufObject* PutRequestIndication (); - /** - * @see MObexServerNotify - */ - TInt PutPacketIndication (); - /** - * @see MObexServerNotify - */ - TInt PutCompleteIndication (); - /** - * @see MObexServerNotify - */ - CObexBufObject* GetRequestIndication( - CObexBaseObject* aRequiredObject ); - /** - * @see MObexServerNotify - */ - TInt GetPacketIndication (); - /** - * @see MObexServerNotify - */ - TInt GetCompleteIndication (); - /** - * @see MObexServerNotify - */ - TInt SetPathIndication( - const CObex::TSetPathInfo& aPathInfo, const TDesC8& aInfo ); - /** - * @see MObexServerNotify - */ - void AbortIndication (); - private: - /** - * C++ default constructor. - */ - CFileManagerIRReceiver( - MFileManagerProcessObserver& aObserver, - CFileManagerEngine& aEngine, - RFs& aFs ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( const TDesC& aPath ); - - /** - * Resets inactivity timer. - */ - void ResetInactivityTimer(); - - /** - * Stops inactivity timer. - */ - void StopInactivityTimer(); - - /** - * Handles inactivity timeout. - */ - static TInt InactivityTimeout( TAny* aPtr ); - - /** - * Closes connection on timeout. - */ - void CloseConnection(); - - private: - // Caller is informed about starting and stopping of the process. Also - // the processed percentage is updated with this observer. - MFileManagerProcessObserver& iObserver; - - // Own: Handles the obex object transfer - CObexServer* iObexServer; - - // Own: Obex object of the received file - CObexBufObject* iObexBufObject; - - // Own: Destination directory where the received file will be stored - HBufC* iTempFile; - - // Ref. For checking file exists situation - CFileManagerEngine& iEngine; - - // Error code - TInt iError; - - // Is disk space already checked - TBool iDiskSpaceChecked; - - // is there enought space - TBool iEnoughSpace; - - // Ref: File server session - RFs& iFs; - - // Own: temp buffer - CBufFlat* iBuffer; - - // Own: Inactivity timer - CPeriodic* iInactivityTimer; - - }; - -#endif // CFILEMANAGERIRRECEIVER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerItemFilter.h --- a/filemanager/Engine/inc/CFileManagerItemFilter.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +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: Filter GFLM items -* -*/ - - -#ifndef C_FILEMANAGERITEMFILTER_H -#define C_FILEMANAGERITEMFILTER_H - - -// INCLUDES -#include -#include -#include "MGflmItemFilter.h" - - -// FORWARD DECLARATIONS -class CFileManagerEngine; - - -// CLASS DECLARATION -/** -* This class handles GFLM item filtering -* -* @lib FileManagerEngine.lib -* @since 3.1 -*/ -NONSHARABLE_CLASS(CFileManagerItemFilter) : public CBase, - public MGflmItemFilter - { - -public: // Constructors and destructor - /** - * Two-phased constructor. - */ - static CFileManagerItemFilter* NewL( CFileManagerEngine& aEngine ); - - /** - * Destructor. - */ - virtual ~CFileManagerItemFilter(); - -public: // From MGflmItemFilter - /** - * @see MGflmItemFilter - */ - TBool FilterItemL( - CGflmGroupItem* aItem, TInt aGroupId, CGflmDriveItem* aDrive ); - -private: - /** - * C++ default constructor. - */ - CFileManagerItemFilter( CFileManagerEngine& aEngine ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - -private: // Data - /** - * Reference to file manager engine - * Not own. - */ - CFileManagerEngine& iEngine; - - /** - * For file name handling - */ - TFileName iFileNameBuffer; - - /** - * Contains phone memory root path - * Own. - */ - HBufC* iPhoneMemoryRootPath; - - /** - * Contains phone memory default name - * Own. - */ - HBufC* iInternalDefaultName; - - /** - * Contains memory card default name - * Own. - */ - HBufC* iRemovableDefaultName; - - }; - -#endif // C_FILEMANAGERITEMFILTER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerItemProperties.h --- a/filemanager/Engine/inc/CFileManagerItemProperties.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,307 +0,0 @@ -/* -* Copyright (c) 2002-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: Holds item information -* -*/ - - - -#ifndef CFILEMANAGERITEMPROPERTIES_H_ -#define CFILEMANAGERITEMPROPERTIES_H_ - -// INCLUDES -#include -#include - -// FORWARD DECLARATIONS -class CFileManagerActiveSize; -class CFileManagerUtils; -class CFileManagerActiveCount; -class CGflmGroupItem; -class CFileManagerEngine; - -/** -* Engine gathers the item information to this object. -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CFileManagerItemProperties) : public CBase - { - public: - /* Bitmask bits of the item types */ - enum TFileManagerFileType - { - ENotDefined = 0x00, - EFolder = 0x01, - EDefault = 0x02, - EMedia = 0x04, - EFile = 0x08, - EForwardLocked = 0x10, - EPlaylist = 0x20, - ELink = 0x40, - EOpen = 0x80, - EReadOnly = 0x100, - EDrmProtected = 0x200, - EDrmLocalDataFile = 0x400 - }; - public: - /** - * Two-phased constructor. - */ - static CFileManagerItemProperties* NewL( - const TDesC& aFullPath, - CFileManagerUtils& aUtils, - CFileManagerEngine& aEngine ); - - /** - * Two-phased constructor. - */ - static CFileManagerItemProperties* NewL( - const CGflmGroupItem& aItem, - CFileManagerUtils& aUtils, - CFileManagerEngine& aEngine ); - - /** - * Destructor. - */ - IMPORT_C ~CFileManagerItemProperties(); - - public: - - /** - * Gets the name of the item - * @since 2.7 - * @return Name of the item, file name without extension - * or directory name - */ - IMPORT_C TPtrC Name() const; - - /** - * Gets the item modification time (universal time) - * @since 2.7 - * @return TTime when item was last modified - */ - IMPORT_C TTime ModifiedDate() const; - - /** - * Size of the item, size of the file or size of the dir - * @since 2.7 - * @return Item size in bytes - */ - IMPORT_C TInt64 SizeL(); - - /** - * Count of files in directory, subdirectories not included - * @since 2.7 - * @return File count in dir, -1 if item is file - */ - IMPORT_C TInt FilesContainedL(); - - /** - * Count of folders in directory, - * directories in subdirectories are not included - * @since 2.7 - * @return Folder count in dir, -1 if item is file - */ - IMPORT_C TInt FoldersContainedL(); - - /** - * Count of open files in directory - * @since 2.7 - * @return count of open files in directory, -1 if item is file - */ - IMPORT_C TInt OpenFilesL(); - - /** - * Returns item type information - * @since 2.7 - * @return TFileManagerFileType information of item - */ - IMPORT_C TUint32 TypeL(); - - /** - * Item extension - * @since 2.7 - * @return File extension, empty if item is dir - */ - IMPORT_C TPtrC Ext() const; - - /** - * Fullpath of item, includes drive, path and name with extension - * @since 2.7 - * @return fullpath - */ - IMPORT_C TPtrC FullPath() const; - - /** - * Gets the name of the item with extension - * @since 2.7 - * @return Name of the item - */ - IMPORT_C TPtrC NameAndExt() const; - - /** - * Localized name of item if found, if not Name() is returned - * @since 2.7 - * @return Localized name - */ - IMPORT_C TPtrC LocalizedName() const; - - /** - * Gets the item modification time (local time) - * @since 3.1 - * @param aTime For local time - * @return Error code - */ - IMPORT_C TInt ModifiedLocalDate( TTime& aTime ) const; - - /** - * Checks if item contains any files or folders - * @since 3.1 - * @return ETrue if contains any items, EFalse if not - */ - IMPORT_C TBool ContainsAnyFilesOrFolders(); - - /** - * Gets MIME type of file - * @since 3.1 - * @return MIME type - */ - IMPORT_C TPtrC MimeTypeL(); - - /** - * Checks if item is a drive item - * @since 3.1 - * @return ETrue if drive item, otherwise EFalse - */ - IMPORT_C TBool IsDrive() const; - - /** - * Gets drive name - * @since 3.1 - * @return drive name - */ - IMPORT_C TPtrC DriveName() const; - - /** - * Checks if item is on remote drive - * @since 3.2 - * @return ETrue if item on remote drive, otherwise EFalse - */ - IMPORT_C TBool IsRemoteDrive() const; - - /** - * Gets drive id - * @since 5.0 - * @return Drive id - */ - IMPORT_C TInt DriveId() const; - - private: - /** - * C++ default constructor. - */ - CFileManagerItemProperties( - CFileManagerUtils& aUtils, - CFileManagerEngine& aEngine ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( const TDesC& aFullPath ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( const TDesC& aFullPath, const TEntry& aEntry ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( const CGflmGroupItem& aItem ); - - // Counts file sizes in given folder - TInt64 FolderSizeL( const TDesC& aFullPath ); - - // Counts items in directory, given parameter defines the type of count - TInt CountItemsL( - const TFileManagerFileType& aType ); - - void EnsureEntryDataFetched() const; - - void SetEntryData( const TEntry& aEntry ) const; - - private: - - // Own: Location in file system - HBufC* iFullPath; - - // Size of the file in bytes. In case of folder, this is a sum of all items - // under the folder including the subfolders. - mutable TInt64 iSize; - - // How many files are inside the folder, subfolders not counted - // In case of file this is undefined - TInt iFilesContained; - - // How many folders are inside the folder, subfolders are not counted - // In case of file this is undefined - TInt iFoldersContained; - - // How many open files are inside the folder - // In case of file this is undefined - TInt iOpenFiles; - - // type of item, TFileManagerFileType bitmask - TUint32 iType; - - // Own: Folder size calculation - CFileManagerActiveSize* iActiveSize; - - // Own: Folder properties - CFileManagerActiveCount* iActiveCount; - - // Item modification day, copied from items TEntry - mutable TTime iModified; - - // Ref: Contains some useful common services, localizer, RFs... - CFileManagerUtils& iUtils; - - // Ref: Contains some useful common services - CFileManagerEngine& iEngine; - - enum TItemState // Internal state bit definitions - { - EItemDirectory = 0x1, - EItemDrive = 0x2, - EItemAction = 0x4, - EItemFile = 0x8, - EItemHasFilesOrFolders = 0x10, - EItemHasNoFilesOrFolders = 0x20, - EItemRemoteDrive = 0x40, - EItemEntryDataFetched = 0x80, - EItemNotFileOrDir = EItemDrive | EItemAction - }; - // Internal item state bits, see above - mutable TUint32 iState; - - // Own: Item name - HBufC* iName; - - }; - - - -#endif // CFILEMANAGERITEMPROPERTIES_H_ \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerPropertySubscriber.h --- a/filemanager/Engine/inc/CFileManagerPropertySubscriber.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +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: Subscriber (Publish & Subscribe) -* -*/ - - - -#ifndef CFILEMANAGERPROPERTYSUBSCRIBER_H -#define CFILEMANAGERPROPERTYSUBSCRIBER_H - -// INCLUDES -#include -#include -#include "MFileManagerPropertyObserver.h" - -// CLASS DECLARATION -/** -* This class provides P&S event subscriber -* -* @lib FileManagerEngine.lib -* @since 3.1 -*/ -NONSHARABLE_CLASS(CFileManagerPropertySubscriber) : public CActive -{ - public: - /** - * Two-phased constructor. - */ - static CFileManagerPropertySubscriber* NewL( - MFileManagerPropertyObserver& aObserver, - const TUid& aCategory, - const TUint aKey ); - - /** - * Destructor. - */ - ~CFileManagerPropertySubscriber(); - - private: - CFileManagerPropertySubscriber( - MFileManagerPropertyObserver& aObserver, - const TUid& aCategory, - const TUint aKey ); - - void ConstructL(); - - void Subscribe(); - - private: // from CActive - void RunL(); - - TInt RunError( TInt aError ); - - void DoCancel(); - - private: - // Ref: Reference to observer interface - MFileManagerPropertyObserver& iObserver; - // Own: PS handle - RProperty iProperty; - // Own: PS category Uid - TUid iCategory; - // Own: PS key id - TUint iKey; -}; - -#endif // CFILEMANAGERPROPERTYSUBSCRIBER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerRefresher.h --- a/filemanager/Engine/inc/CFileManagerRefresher.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2002-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: Asynchronous refresher for CGflmNavigatorModel -* -*/ - - -#ifndef CFILEMANAGERREFRESHER_H -#define CFILEMANAGERREFRESHER_H - -// INCLUDES -#include -#include "GFLM.hrh" - -// FORWARD DECLARATIONS -class CGflmNavigatorModel; -class MFileManagerProcessObserver; - -// CLASS DECLARATION - -/** -* This class start asynchronous refreshing of given CGflmNavigatorModel. -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CFileManagerRefresher) : public CActive - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CFileManagerRefresher* NewL( CGflmNavigatorModel& aModel ); - - /** - * Destructor. - */ - virtual ~CFileManagerRefresher(); - - public: // New functions - - /** - * Refreshes the model. - * @since 2.0 - * @param aRefreshMode Given refresh mode. - */ - void Refresh( TGflmRefreshMode aRefreshMode = ERefreshItems ); - - /** - * Sets observer - * @since 2.0 - * @param aObserver Observer for the operation or NULL, - * ownership is not transferred. - */ - void SetObserver( MFileManagerProcessObserver* aObserver ); - - /** - * Cancels refresh. - * @since 2.0 - */ - TBool CancelRefresh(); - - protected: // From CActive - - void RunL(); - - TInt RunError( TInt aError ); - - void DoCancel(); - - private: - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * C++ default constructor. - */ - CFileManagerRefresher( CGflmNavigatorModel& aModel ); - - private: // Data - - // Ref: Reference to the model instance that will be refreshed - CGflmNavigatorModel& iModel; - - // Ref: Pointer to the observer that will be notified - MFileManagerProcessObserver* iObserver; - - }; - -#endif // CFILEMANAGERREFRESHER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerRemoteDriveHandler.h --- a/filemanager/Engine/inc/CFileManagerRemoteDriveHandler.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +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: Wraps remote drive functionality -* -*/ - - -#ifndef C_FILEMANAGERREMOTEDRIVEHANDLER_H -#define C_FILEMANAGERREMOTEDRIVEHANDLER_H - - -// INCLUDES -#include -#include "MFileManagerPropertyObserver.h" - - -// FORWARD DECLARATIONS -class CRsfwMountMan; -class CFileManagerEngine; -class CFileManagerPropertySubscriber; -class CFileManagerUtils; - - -// CLASS DECLARATION -/** - * This class wraps remote drive functionality - * - * @lib FileManagerEngine.lib - * @since S60 3.1 - */ -NONSHARABLE_CLASS(CFileManagerRemoteDriveHandler) : - public CBase, - MFileManagerPropertyObserver - { - -public: - /** - * Two-phased constructor. - */ - static CFileManagerRemoteDriveHandler* NewL( - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils ); - - /** - * Destructor - */ - ~CFileManagerRemoteDriveHandler(); - -public: // New functions - /** - * Gets remote drive connection state - * @param aDrive Drive number EDriveA...EDriveZ - * @return ETrue if connected. Otherwise EFalse. - */ - TBool IsConnected( const TInt aDrive ); - - /** - * Connects or disconnects remote drive - * @param aDrive Drive number EDriveA...EDriveZ - * @return System wide error code. - */ - TInt SetConnection( TInt aDrive, TBool aConnect ); - - /** - * Deletes remote drive settings - * @param aDrive Drive number EDriveA...EDriveZ - * @return System wide error code. - */ - TInt DeleteSettings( const TInt aDrive ); - - /** - * Ensures that contents of a remote directory are up to date - * when directory is refreshed - * @param aFullPath Full path to remote directory - * @return error code. - */ - TInt RefreshDirectory( const TDesC& aFullPath ); - - /** - * Checks does application have support for remote drives - * @param aUid Application uid - * @return ETrue if the app has support. Otherwise EFalse. - */ - TBool HasAppRemoteDriveSupport( TUid aUid ); - - /** - * Cancels incoming or outgoing remote drive transfer - * @param aFullPath Full path to remote file or directory - */ - void CancelTransfer( const TDesC& aFullPath ); - -public: // From MFileManagerPropertyObserver - void PropertyChangedL( const TUid& aCategory, const TUint aKey ); - -private: - /** - * Constructors - */ - CFileManagerRemoteDriveHandler( - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils ); - - void ConstructL(); - -private: // Data - /** - * For remote drive mounting and state handling - * Own. - */ - CRsfwMountMan* iMountMan; - - /** - * Reference to file manager engine - * Not own. - */ - CFileManagerEngine& iEngine; - - /** - * Reference to utils - * Not own. - */ - CFileManagerUtils& iUtils; - - /** - * For PS subscribing - * Own. - */ - CFileManagerPropertySubscriber* iSubscriber; - - /** - * Indicates if remote drives are supported or not - */ - TBool iRemoteStorageFwSupported; - - }; - -#endif // C_FILEMANAGERREMOTEDRIVEHANDLER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerRemovableDriveHandler.h --- a/filemanager/Engine/inc/CFileManagerRemovableDriveHandler.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,309 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Wraps removable drive functionality -* -*/ - - -#ifndef C_FILEMANAGERREMOVABLEDRIVEHANDLER_H -#define C_FILEMANAGERREMOVABLEDRIVEHANDLER_H - - -// INCLUDES -#include -#include -#include "MFileManagerProcessObserver.h" -#include "MMMCScBkupEngineObserver.h" -#include "CMMCScBkupArchiveInfo.h" -#include "CFileManagerRestoreSettings.h" - - -// FORWARD DECLARATIONS -class CMMCScBkupEngine; -class CFileManagerUtils; -class CFileManagerEngine; -class CBaBackupSessionWrapper; -class CFileManagerBackupSettings; - - -// CLASS DECLARATION -/** -* This class wraps removable drive functionality -* -* @lib FileManagerEngine.lib -* @since S60 3.1 -*/ -NONSHARABLE_CLASS(CFileManagerRemovableDriveHandler) : - public CActive, - public MMMCScBkupEngineObserver - { - -public: - /** - * Two-phased constructor. - */ - static CFileManagerRemovableDriveHandler* NewL( - RFs& aFs, - CFileManagerUtils& aUtils, - CFileManagerEngine& aEngine ); - - /** - * Destructor - */ - virtual ~CFileManagerRemovableDriveHandler(); - -public: // New methods - /** - * Sets process observer for memory card operations - * @param aObserver Pointer to observer or NULL, - * ownership is not transferred - */ - void SetObserver( MFileManagerProcessObserver* aObserver ); - - /** - * Starts eject process - */ - void StartEjectL(); - - /** - * Starts format process - * @param aDrive Drive number EDriveA...EDriveZ - */ - void StartFormatL( const TInt aDrive ); - - /** - * Cancels ongoing process - */ - void CancelProcess(); - - /** - * Checks does backup file exists - * @return ETrue if exists. Otherwise EFalse. - */ - TBool BackupFileExistsL( const TInt aDrive ); - - /** - * Starts backup process - * @param aProcess Backup process to start - */ - void StartBackupL( - MFileManagerProcessObserver::TFileManagerProcess aProcess ); - - /** - * Starts restore process - */ - void StartRestoreL(); - - /** - * Gets restore info array - * @param aArray For storing restore info - * @param aDrive For getting info from specific drive - */ - void GetRestoreInfoArrayL( - RArray< CFileManagerRestoreSettings::TInfo >& aArray, - const TInt aDrive ); - - /** - * Checks is process ongoing - */ - TBool IsProcessOngoing() const; - - /** - * Gets create time of the latest backup archive - * @param aBackupTime Stores the time - */ - void LatestBackupTimeL( TTime& aBackupTime ); - - /** - * Deletes selected backups - */ - void DeleteBackupsL(); - -private: // From CActive - /** - * @see CActive - */ - void DoCancel(); - - /** - * @see CActive - */ - void RunL(); - - /** - * @see CActive - */ - TInt RunError( TInt aError ); - -private: - /** - * Constructors - */ - CFileManagerRemovableDriveHandler( - RFs& aFs, - CFileManagerUtils& aUtils, - CFileManagerEngine& aEngine ); - - void ConstructL(); - - /** - * For periodic eject scan - */ - static TInt EjectScanAndShutdownApps( TAny* ptr ); - - /** - * For periodic eject scan - */ - void DoEjectScanAndShutdownL(); - - /** - * For periodic eject scan - */ - void EjectComplete( TInt aErr ); - - /** - * Gets backup file name - */ - HBufC* BackupFileNameLC( TBool aFullPath ) const; - - /** - * Starts eject scan - */ - void StartEjectScanL(); - - void InformStartL( TInt aTotalCount ); - - void InformUpdateL( TInt aCount ); - - void InformFinishL( ); - - void InformError( TInt aErr ); - - void StartFormatProcessL(); - - void EndFormatProcessL( TInt aErr ); - - void CloseAppsL(); - - void RestartAppsL(); - - static void ResetAndDestroyArchives( TAny* aPtr ); - - static TUint32 BkupToFmgrMask( const TUint32 aBkupMask ); - - static TUint32 FmgrToBkupMask( const TUint32 aFmrgMask ); - - void PublishBurStatus( TInt aType ); - - TBool IsInternalMassStorage( TInt aDrive ); - - void StoreVolumeNameL( TInt aDrive ); - - void RestoreVolumeNameL( TInt aDrive ); - - void ListArchivesL( - RPointerArray< CMMCScBkupArchiveInfo >& aArchives, - const CFileManagerBackupSettings& aBackupSettings ); - -private: // From MMMCScBkupEngineObserver - TInt HandleBkupEngineEventL( - MMMCScBkupEngineObserver::TEvent aEvent, TInt aAssociatedData ); - -private: // Data - /** - * Backup engine - * Own. - */ - CMMCScBkupEngine* iBkupEngine; - - /** - * Pointer to observer - * Not own. - */ - MFileManagerProcessObserver* iObserver; - - /** - * Observed process - */ - MFileManagerProcessObserver::TFileManagerProcess iProcess; - - /** - * For file operations - * Not own. - */ - RFs& iFs; - - /** - * For utility access - * Not own. - */ - CFileManagerUtils& iUtils; - - /** - * For file manager engine access - * Not own. - */ - CFileManagerEngine& iEngine; - - /** - * Last process error - */ - TInt iLastError; - - /** - * Final progress value - */ - TInt iFinalValue; - - /** - * For timed eject scanning steps - * Own. - */ - CPeriodic* iEjectScanPeriodic; - - /** - * For eject scan round counting - */ - TInt iEjectScanRounds; - - /** - * Indicates if backup or restore is in progress - */ - TBool iBackupRestoreInprogress; - - /** - * For formatting drives - */ - RFormat iFormatter; - - /** - * For keeping track of formatting process progress - */ - TPckgBuf< TInt > iFormatCountBuf; - - /** - * For closing and restarting open files while formatting - */ - CBaBackupSessionWrapper* iBSWrapper; - - /** - * Target drive of the process - */ - TInt iDrive; - - }; - -#endif // C_FILEMANAGERREMOVABLEDRIVEHANDLER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerRestoreSettings.h --- a/filemanager/Engine/inc/CFileManagerRestoreSettings.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,146 +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: Restore settings -* -*/ - - -#ifndef C_FILEMANAGERBACKUPARRAY_H -#define C_FILEMANAGERBACKUPARRAY_H - - -// INCLUDE FILES -#include -#include - - -// FORWARD DECLARATIONS -class CFileManagerEngine; - - -// CLASS DECLARATION -/** - * This class is used for storing restore settings - * - * @lib FileManagerEngine.lib - * @since S60 3.1 - */ -NONSHARABLE_CLASS(CFileManagerRestoreSettings) : public CBase, - public MDesCArray - { - -public: - /** Restore icon type */ - enum TIconId - { - EIconCheckBoxOn = 0, - EIconCheckBoxOff, - EIconMemoryCard, - EIconUsbMemory - }; - - /** Restore info */ - NONSHARABLE_CLASS(TInfo) - { - public: - TUint32 iContent; - TTime iTime; - TInt iDrive; - }; - - /** - * Two-phased constructor. - */ - static CFileManagerRestoreSettings* NewL( - CFileManagerEngine& aEngine ); - - /** - * Destructor - */ - ~CFileManagerRestoreSettings(); - - /** - * Sets restore selection - * - * @since S60 3.1 - */ - IMPORT_C void SetSelection( const TUint64& aSelection ); - - /** - * Refreshes restore settings - * - * @since S60 3.1 - */ - IMPORT_C void RefreshL(); - - /** - * Gets restore selection - * - * @since S60 3.1 - */ - void GetSelectionL( RArray< TInfo >& aInfoArray ) const; - -public: // From MDesCArray - TInt MdcaCount() const; - - TPtrC MdcaPoint( TInt aIndex ) const; - -private: - /** Restore setting entry */ - NONSHARABLE_CLASS(CEntry) : public CBase - { - public: - ~CEntry(); - - HBufC* iText; - TInfo iInfo; - }; - -private: - /** - * Constructors - */ - CFileManagerRestoreSettings( CFileManagerEngine& aEngine ); - - void ConstructL(); - - /** - * Creates a new restore setting entry - */ - CEntry* CreateEntryLC( const TInfo& aInfo ); - - static HBufC* DateTimeStringLC( const TTime& aTime ); - -private: // Data - /** - * Restore setting entries - */ - RPointerArray< CEntry > iList; - - /** - * Reference to file manager engine - * Not own. - */ - CFileManagerEngine& iEngine; - - /** - * Restore selection - */ - TUint64 iSelection; - - }; - -#endif // C_FILEMANAGERBACKUPARRAY_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerThreadWrapper.h --- a/filemanager/Engine/inc/CFileManagerThreadWrapper.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +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: Background thread functionality wrapper -* -*/ - - - -#ifndef CFILEMANAGERTHREADWRAPPER_H -#define CFILEMANAGERTHREADWRAPPER_H - - -// INCLUDES -#include -#include "MFileManagerThreadFunction.h" - - -// CLASS DECLARATION -/** -* The class implements a background thread functionality wrapper -* -* @lib FileManagerEngine.lib -* @since 3.1 -*/ -NONSHARABLE_CLASS(CFileManagerThreadWrapper) : public CActive - { - public: - static CFileManagerThreadWrapper* NewL(); - - ~CFileManagerThreadWrapper(); - - public: // New functions - /** - * Starts background thread. Can be used only by client thread. - * @since 3.1 - * @param aFunction Reference to background thread abstraction. - * @param aPriority background thread priority - * @param aNotify client notify flags - * see MFileManagerThreadFunction::TNotifyType - * @return System wide error code - */ - TInt StartThread( - MFileManagerThreadFunction& aFunction, - TUint aNotify, - TThreadPriority aPriority ); - - /** - * Cancels background thread. - * Background thread is exited when ongoing ThreadStepL is finished. - * Can be used only by client thread. - * @since 3.1 - */ - void CancelThread(); - - /** - * Checks if background thread has been canceled. - * Can be used by both client and background threads. - * E.g. checks can be done inside long running ThreadStepL. - * @since 3.1 - * @return ETrue if canceled, otherwise EFalse - */ - TBool IsThreadCanceled() const; - - /** - * Resumes thread when called after error or step finished - * notification. Can only be used by client thread. - * @since 3.2 - */ - void ResumeThread(); - - /** - * Checks if thread has been started - * notification. Can only be used by client thread. - * @since 3.2 - * @return ETrue if started, otherwise EFalse - */ - TBool IsThreadStarted() const; - - private: // From CActive - void RunL(); - - TInt RunError( TInt aErr ); - - void DoCancel(); - - private: - CFileManagerThreadWrapper(); - - void ConstructL(); - - static TInt ThreadFunction( TAny* ptr ); - - void ThreadFunctionL(); - - TInt NotifyClientAndWaitConfirm( TInt aErr ); - - void DoNotifyL( TInt aErr ); - - NONSHARABLE_CLASS(CNotifyObserver) : public CActive - { - public: - static CNotifyObserver* NewL( - CFileManagerThreadWrapper& aWrapper ); - - ~CNotifyObserver(); - - void Activate(); - - void Complete( RThread& aThread, TInt aResult ); - - private: // From CActive - void RunL(); - - TInt RunError( TInt aErr ); - - void DoCancel(); - - private: - CNotifyObserver( CFileManagerThreadWrapper& aWrapper ); - - private: - CFileManagerThreadWrapper& iWrapper; - }; - - private: // Data - // Own: For synchronising client and background thread - RSemaphore iSemaphore; - // Own: Client thread id - TThreadId iClientId; - // Ref: Pointer to thread function - MFileManagerThreadFunction* iFunction; - // Own: Client notify type flags, Client writes and thread only reads - TUint iNotify; - // Own: Thread cancel indicator, Client writes and thread only reads - TBool iCancel; - // Own: Observer wrapper to notify client about thread events - CNotifyObserver* iNotifyObserver; - // Own: Thread resume pending indicator, Client reads and writes - TBool iResumePending; - }; - -#endif // CFILEMANAGERTHREADWRAPPER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFileManagerUtils.h --- a/filemanager/Engine/inc/CFileManagerUtils.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,409 +0,0 @@ -/* -* Copyright (c) 2002-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: Util methods for File Manager -* -*/ - - - -#ifndef CFILEMANAGERUTILS_H -#define CFILEMANAGERUTILS_H - - -// INCLUDES -#include -#include -#include - - -// FORWARD DECLARATIONS -class CFileManagerMimeIconArray; -class CFileManagerFolderArray; -class CCommonContentPolicy; -class CGflmNavigatorModel; -class CGflmGroupItem; -#if defined( __KEEP_DRM_CONTENT_ON_PHONE ) && defined ( FILE_MANAGER_USE_DISTRIBUTABLECHECKER ) - class CDistributableChecker; -#endif // __KEEP_DRM_CONTENT_ON_PHONE && FILE_MANAGER_USE_DISTRIBUTABLECHECKER -class CFileManagerFeatureManager; - - -/** -* -* Collection of utility functions for file manager -* -* @lib FileManagerEngine.lib -* @since 2.7 -*/ -NONSHARABLE_CLASS(CFileManagerUtils) : public CBase - { - public: - /** - * Two-phased constructors. - */ - static CFileManagerUtils* NewL( - RFs& aFs, - CGflmNavigatorModel& aNavigator, - CFileManagerFeatureManager& aFeatureManager ); - - /** - * Destructor. - */ - ~CFileManagerUtils(); - public: // New functions - - /** - * Gets the reference to open file server session - * @since 2.7 - * @return reference to open file server session - */ - RFs& Fs() const; - - /** - * Checks is given file forward locked - * @since 2.7 - * @param aFullPath file name with full path - * @return ETrue if file is forward locked, EFalse if not. - */ - TBool IsForwardLockedFile( const TDesC& aFullPath ); - - /** - * Checks is given file drm protected - * @since 2.7 - * @param aFullPath file name with full path - * @return ETrue if file is drm protected, EFalse if not. - */ - TBool IsDrmProtectedFileL( const TDesC& aFullPath ) const; - - /** - * Gets the icon id of the item - * @since 2.7 - * @param aFullPath Item with full path information - * @return Icon id of the item. If not found other icon id is used. - */ - TInt ResolveIconL( const TDesC& aFullPath ) const; - - /** - * Checks is given folder a default folder - * @since 2.7 - * @param aFullPath Item with full path information - * @return ETrue if folder is default folder, EFalse if not. - */ - TBool DefaultFolder( const TDesC& aFullPath ) const; - - /** - * Checks is given file drm local data file (LDF) - * @since 3.1 - * @param aFullPath file name with full path - * @return ETrue if file is local data file, EFalse if not. - */ - TBool IsDrmLocalDataFile( const TDesC& aFullPath ) const; - - /** - * Checks given item that can it be deleted. - * @since 3.1 - * @param aFullPath full path to item which is checked - * @returns ETrue if item can be deleted, EFalse if not - */ - TBool CanDelete( const TDesC& aFullPath ) const; - - /** - * Returns the type of given item in CFileManagerItemProperties bitmask - * @since 3.1 - * @param aFullPath full path to item - * @return CFileManagerItemProperties bitmask - */ - TUint32 FileTypeL( const TDesC& aFullPath ); - - /** - * Gets the icon id of the item - * @since 3.1 - * @param aItem GFLM struct of the item - * @return Icon id of the item. If not found other icon id is returned. - */ - TInt ResolveIconL( CGflmGroupItem& aItem ) const; - - /** - * Checks does given folder have any items with specified attributes - * @since 3.1 - * @param aFs open file server session - * @param aFullPath folder name with full path - * @param aAttMask attribute mask - * @return ETrue if folder has any specified items, EFalse if not. - */ - static TBool HasAny( - RFs& aFs, const TDesC& aFullPath, TUint aAttMask ); - - /** - * Checks does given folder has any subfolder - * @since 3.1 - * @param aFullPath folder name with full path - * @return ETrue if folder has any subfolders, EFalse if not. - */ - TBool HasSubFolders( const TDesC& aFullPath ) const; - - /** - * Checks does given folder has any files - * @since 3.1 - * @param aFullPath folder name with full path - * @return ETrue if folder has any files, EFalse if not. - */ - TBool HasFiles( const TDesC& aFullPath ) const; - - /** - * Create default folders - * @since 3.2 - * @param aDrive Drive which default folders are created - * @param aForced Selects forced or normal creation - */ - void CreateDefaultFolders( - const TInt aDrive, const TBool aForced = ETrue ) const; - - /** - * Checks is path located in remote drive - * @since 3.1 - * @param aPath path to check - * @return ETrue if remote drive. Otherwise EFalse. - */ - TBool IsRemoteDrive( const TDesC& aPath ) const; - - /** - * Determine if given file must be protected (kept on the device) - * @since 3.1 - * @param aFullPath file to check - * @param aIsProtected for storing result - * @return System wide error code - */ - TInt IsDistributableFile( const TDesC& aFullPath, - TBool& aIsProtected ); - - /** - * Gets MIME type of file - * @since 3.1 - * @return MIME type - */ - TPtrC MimeTypeL( const TDesC& aFullPath ) const; - - /** - * Gets drive id array with specified attribute mask - * @since 3.2 - * @param aDrives array for ids - * @param aAttMask drive attribute match mask - */ - void DriveList( - RArray< TInt >& aDrives, const TInt aAttMask ) const; - - /** - * Checks is drive removable - * @since 3.2 - * @param aPath path to check - * @return ETrue if removable drive. Otherwise EFalse - */ - TBool IsRemovableDrive( const TDesC& aPath ) const; - - /** - * Gets item full path - * @since 3.2 - * @param aDir Parent directory path - * @param aEntry File system entry - * @param aFullPath Full path to item - */ - static void GetFullPath( - const TDesC& aDir, const TEntry& aEntry, TDes& aFullPath ); - - /** - * Removes final backslash if exists - * @since 3.2 - * @param aPath Directory path - * @return Pointer without backslash - */ - IMPORT_C static TPtrC StripFinalBackslash( const TDesC& aPath ); - - /** - * Ensures final backslash exists - * @since 3.2 - * @param aPath Directory path - */ - IMPORT_C static void EnsureFinalBackslash( TDes& aPath ); - - /** - * Removes all directional chars if exist - * @since 3.2 - * @param aText The text - * @return Pointer to cleaned up text, ownership is transferred - */ - static HBufC* StripDirectionalCharsLC( const TDesC& aText ); - - /** - * Checks if final backslash exist - * @since 3.2 - * @param aPath Directory path - */ - IMPORT_C static TBool HasFinalBackslash( const TDesC& aPath ); - - /** - * Checks if file is copied/moved from internal to removable drive - * @since 3.2 - * @param aFs Open file server session - * @param aSrcPath Source directory path - * @param aDstPath Destination directory path - * @return ETrue if from internal to removable, otherwise EFalse - */ - IMPORT_C static TBool IsFromInternalToRemovableDrive( - RFs& aFs, const TDesC& aSrcPath, const TDesC& aDstPath ); - - /** - * Removes read only attribute if it is set for given item - * @since 3.2 - * @param aFs Open file server session - * @param aFullPath Full path of the item - * @param aEntry Entry data of the item - * @return System wide error code - */ - static TInt RemoveReadOnlyAttribute( - RFs& aFs, const TDesC& aFullPath, const TEntry& aEntry ); - - /** - * Removes read only attribute if it is set for given item - * @since 3.2 - * @param aFs Open file server session - * @param aFullPath Full path of the item - * @return System wide error code - */ - static TInt RemoveReadOnlyAttribute( - RFs& aFs, const TDesC& aFullPath ); - - /* Drive name layouts for selecting the most suitable text */ - enum TDriveNameLayout - { - EMainLayout = 0, - ETitleLayout, - ELayoutCount // Must be the last - }; - - /** - * Gets drive name and letter as combined single text. - * @since 5.0 - * @param aDrive Drive number EDriveA...EDriveZ - * @param aLayout Text layout. See TDriveNameLayout. - * @return Text containing drive letter and name - */ - HBufC* GetDriveNameL( - const TInt aDrive, - const TDriveNameLayout aLayout ) const; - - /** - * Gets drive name and letter as combined formatted text. - * @since 5.0 - * @param aDrive Drive number EDriveA...EDriveZ - * @param aTextIdForDefaultName TextId of default name format string - * @param aTextIdForName TextId of name format string - * @return Text containing drive letter and name - */ - HBufC* GetFormattedDriveNameLC( - const TInt aDrive, - const TInt aTextIdForDefaultName, - const TInt aTextIdForName ) const; - - /** - * Checks is path located in remote drive - * @since 3.2 - * @param aFs Open file server session - * @param aPath path to check - * @return ETrue if remote drive, otherwise EFalse - */ - IMPORT_C static TBool IsRemoteDrive( RFs& aFs, const TDesC& aPath ); - - /** - * Returns localized name of the given item - * @since 3.2 - * @param aFullPath full path to item which is checked - * @returns TPtrC reference to localized name, - * KNullDesC if no localization is used - */ - TPtrC LocalizedName( const TDesC& aFullPath ) const; - - /** - * Checks is name found, the comparison includes localized folder names - * @since 3.2 - * @param aFullPath full path to item which is checked - * @returns ETrue if name is found, otherwise EFalse. - */ - TBool IsNameFoundL( const TDesC& aFullPath ) const; - - /** - * Flush Cache - */ - void FlushCache() const; - - private: - /** - * C++ default constructor. - */ - CFileManagerUtils( - RFs& aFs, - CGflmNavigatorModel& aNavigator, - CFileManagerFeatureManager& aFeatureManager ); - - void ConstructL(); - - static void IsFlkOrLdfFileL( - const TDesC& aFullPath, TBool& aIsFlk, TBool& aIsLdf ); - - static TBool IsInternalDrive( RFs& aFs, const TInt aDrive ); - - CDesCArray* GetDriveNameArrayLC( - const TInt aDrive, - TUint& aDriveStatus ) const; - - static TBool IsDrive( - RFs& aFs, const TDesC& aPath, const TUint aAttMask ); - - static TBool IsDrive( - RFs& aFs, const TInt aDrive, const TUint aAttMask ); - - private: - - // Ref: reference to open file server session - RFs& iFs; - - //Own: List of default folders - CFileManagerFolderArray* iDefaultFolders; - - // Own: Handle to common content policy service to find - // out is file in a Closed Content List or forward locked - CCommonContentPolicy* iCommonContentPolicy; - - // Own: Mime icon mapper - CFileManagerMimeIconArray* iMimeIconMapper; - - // Ref: GFLM navigator instance - CGflmNavigatorModel& iNavigator; - -#if defined( __KEEP_DRM_CONTENT_ON_PHONE ) && defined ( FILE_MANAGER_USE_DISTRIBUTABLECHECKER ) - // Own: content protection checking - CDistributableChecker* iDistributableChecker; -#endif // __KEEP_DRM_CONTENT_ON_PHONE && FILE_MANAGER_USE_DISTRIBUTABLECHECKER - - // Flag to indicate if feature is supported - TBool iDrmFullSupported; - - // Ref: reference to feature manager - CFileManagerFeatureManager& iFeatureManager; - - }; - -#endif // CFILEMANAGERUTILS_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFilemanagerActiveCount.h --- a/filemanager/Engine/inc/CFilemanagerActiveCount.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* Copyright (c) 2002-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: Calculates directory size -* -*/ - - -#ifndef CFILEMANAGERACTIVECOUNT_H -#define CFILEMANAGERACTIVECOUNT_H - -// INCLUDES -#include -#include -#include "CFileManagerItemProperties.h" - -// FORWARD DECLARATIONS -class CDirScan; - -// CLASS DECLARATION -/** -* -* Calculates folder size, one folder at time. -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CFileManagerActiveCount) : public CBase, - public MAknBackgroundProcess - { - public: - /** - * Two-phased constructor. - */ - static CFileManagerActiveCount* NewL( - RFs& aFs, - const TDesC& aRootFolder, - const CFileManagerItemProperties::TFileManagerFileType aType ); - /** - * Destructor. - */ - ~CFileManagerActiveCount(); - - public: // From MAknBackgroundProcess - /** - * Completes one cycle of the process. - */ - void StepL(); - - /** - * Return true when the process is done. - */ - TBool IsProcessDone() const; - - public: - - /** - * Get the result, - * @since 2.0 - * @return count of - */ - TInt FolderCount() const; - - /** - * Get the result, - * @since 2.0 - * @return count of - */ - TInt FileCount() const; - - /** - * Get the result, - * @since 2.0 - * @return count of - */ - TInt OpenFiles() const; - - private: - /** - * C++ default constructor. - */ - CFileManagerActiveCount( - RFs& aFs ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( - const TDesC& aRootFolder, - const CFileManagerItemProperties::TFileManagerFileType aType ); - - private: // Data - - /// Own: Used to go through all the folders in given directory - CDirScan* iDirScan; - - /// Own: CDirScan returns this - CDir* iDir; - - /// File Server session - RFs& iFs; - - /// When all folders are through, this is set - TBool iProcessDone; - - /// Index to currently checked CDir item - TInt iFileCounter; - - // Folder count - TInt iFolders; - - // Folder count - TInt iFiles; - - // Folder count - TInt iOpenFiles; - - // Processed entry fullpath - TFileName iFileName; - - }; - -#endif // CFILEMANAGERACTIVECOUNT_H - -// End of File - diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/CFilemanagerMimeIconArray.h --- a/filemanager/Engine/inc/CFilemanagerMimeIconArray.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* -* Copyright (c) 2002-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: Maps the mime or file extension to icon -* -*/ - - -#ifndef CFILEMANAGERMIMEICONARRAY_H -#define CFILEMANAGERMIMEICONARRAY_H - -// INCLUDES -#include -#include "FileManagerEngine.hrh" - -// FORWARD DECLARATIONS -class CGflmNavigatorModel; - -// CLASS DECLARATION - -/** -* Contains the array of the icons. Formats the given string with given item. -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CFileManagerMimeIconArray) : public CBase - { - public: - - /** - * Two-phased constructor. - * @param aResId resource id of mime icon array - * @param aNavigator ref to GFLM navigator - * @return pointer to CFileManagerMimeIconArray object - */ - static CFileManagerMimeIconArray* NewL( - TInt aResId, CGflmNavigatorModel& aNavigator ); - - /** - * Gets the icon id of the item - * @since 2.0 - * @param aFullPath Item with full path information - * @return TFileManagerIconId, icon id of the item. - * If not found other icon id is used. - */ - TInt ResolveIconL( const TDesC& aFullPath ); - - /** - * Destructor. - */ - ~CFileManagerMimeIconArray(); - - private: - - /** - * C++ default constructor. - */ - CFileManagerMimeIconArray( CGflmNavigatorModel& aNavigator ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructFromResourceL( TInt aResId ); - - NONSHARABLE_CLASS(CMimeIconEntry) : public CBase - { - public: // Constructor and destructor - static CMimeIconEntry* NewLC( - const TDesC& aMime, const TInt aIconId ); - - CMimeIconEntry( const TInt aIconId ); - - void ConstructL( const TDesC& aMime ); - - ~CMimeIconEntry(); - public: // Data - // Own: MIME type string - HBufC* iMime; - // ID of the icon this entry represents. - TInt iIconId; - - }; - - private: // Data - // Own: Array of icons - RPointerArray< CMimeIconEntry > iArray; - - // Ref: To get the current directory and MIME type of the item - CGflmNavigatorModel& iNavigator; - - }; - -#endif // CFILEMANAGERMIMEICONARRAY_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/Cfilemanageractivedelete.h --- a/filemanager/Engine/inc/Cfilemanageractivedelete.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,207 +0,0 @@ -/* -* Copyright (c) 2002-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: Deletes items -* -*/ - - -#ifndef CFILEMANAGERACTIVEDELETE_H -#define CFILEMANAGERACTIVEDELETE_H - -// INCLUDES -#include -#include -#include -// FORWARD DECLARATIONS -class CFileManagerEngine; -class CDirScan; -//class CMGXFileManager; -class CFileManagerUtils; - - -// CLASS DECLARATION -/** -* Deletes items -* Delete operation is done one item at time, so that it can be cancelled -* during operation. -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CFileManagerActiveDelete) : public CBase, - public MAknBackgroundProcess - { - public: - /** - * Two-phased constructor. - */ - static CFileManagerActiveDelete* NewL( - CArrayFixFlat< TInt >& aIndexList, - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils ); - - /** - * Destructor. - */ - IMPORT_C ~CFileManagerActiveDelete(); - - public: // From MAknBackgroundProcess - - void StepL(); - - TBool IsProcessDone() const; - - void DialogDismissedL( TInt aButtonId ); - - public: - - /** - * Returns last known error code - * @since 2.0 - * @param aFileName a refence to reserved buffer - where file name related to error can be copied - * @return common error code - */ - IMPORT_C TInt GetError(TDes& aFileName); - - /** - * Returns count of deleted DRM items - * @since 2.0 - * @param aTotalCount (out) returns total count of deleted items - * @return count of deleted DRM items - */ - IMPORT_C TInt DeletedDrmItems( TInt& aTotalCount ); - - - private: - /** - * Constructor - */ - CFileManagerActiveDelete( - RFs& aFs, - CArrayFixFlat< TInt >& aIndexList, - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: - - /** - * This function handles the directory item deletion. - * Deletes one item per call - */ - TBool DeleteItemsInDirectoryL(); - - /** - * This function handles the file deletion. - */ - void DeleteFileL( - const TDesC& aFullPath, const TBool aReadOnlyChecked = EFalse ); - - /** - * This function checks is item file or directory. - */ - TBool IsDir( const TDesC& aFullPath ); - - /** - * This function sets the name returned to user. - */ - void SetName( const TDesC& aFullPath, TBool aOverWrite = EFalse ); - - /** - * This function checks is error ignored by delete. - */ - TBool IsError( TInt aErr ); - - /** - * This function sets the error returned to user. - */ - void SetError( TInt aErr, const TDesC& aFullPath ); - - /** - * This function flushes the notification array. - */ - void FlushNotifications(); - - private: // Data - /// Ref: reference to engine created file server session - RFs& iFs; - - /// Ref: array of items to be deleted from current view - CArrayFixFlat< TInt >& iIndexList; - - /// Current index in given array - TInt iCurrentIndex; - - /// When all folders are through, this is set - TBool iProcessDone; - - /// Latest error - TInt iError; - - /// Own: latest deleted file name or file name which delete has failed - TFileName iFileName; - - /// current file index in CDirScan - TInt iFileIndex; - - /// Own: Used to scan directories - CDirScan* iDirScan; - - /// Own: Scan result is stored here - CDir* iDir; - - /// Count of not deleted items - TInt iNotDeletedItems; - - /// Count of open items - TInt iOpenFiles; - - /// Own: buffer for storing the current item name to be deleted - HBufC* iStringBuffer; - - /// Ref: reference to engine instance - CFileManagerEngine& iEngine; - - /// Own: full path of the item to be deleted - HBufC* iFullPath; - - /// Count of deleted drm files - TInt iDeletedDrmItems; - - /// Count of deleted items - TInt iDeletedItems; - - // Ref: MG2 update notification object - //CMGXFileManager* iMgxFileManager; - - // Ref: reference to utils instance - CFileManagerUtils& iUtils; - - // Own: Set if current drive is remote drive - TBool iIsRemoteDrive; - - // Own: Buffer for storing delete items for MG2 notifications - CDesCArray* iRemovedItems; - - }; - -#endif // CFileManagerActiveFind_H - -// End of File - diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/Cfilemanageractivesize.h --- a/filemanager/Engine/inc/Cfilemanageractivesize.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2002-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: Calculates directory size -* -*/ - - - -#ifndef CFILEMANAGERACTIVESIZE_H -#define CFILEMANAGERACTIVESIZE_H - -// INCLUDES -#include -#include - -// FORWARD DECLARATIONS -class CDirScan; - -// CLASS DECLARATION -/** -* -* Calculates folder size, one folder at time. -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CFileManagerActiveSize) : public CBase, - public MAknBackgroundProcess - { - public: - /** - * Two-phased constructor. - */ - static CFileManagerActiveSize* NewL( - RFs& aFs, const TDesC& aRootFolder ); - /** - * Destructor. - */ - ~CFileManagerActiveSize(); - - public: // From MAknBackgroundProcess - /** - * Completes one cycle of the process. - */ - void StepL(); - - /** - * Return true when the process is done. - */ - TBool IsProcessDone() const; - - public: - - /** - * Get the result, size of the folder - * @since 2.0 - * @return Size of the folder in bytes - */ - TInt64 GetFolderSize() const; - - private: - /** - * C++ default constructor. - */ - CFileManagerActiveSize( RFs& aFs ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( const TDesC& aRootFolder ); - - private: // Data - - /// Own: Used to go through all the folders in given directory - CDirScan* iDirScan; - - /// Own: CDirScan returns this - CDir* iDir; - - /// File Server session - RFs& iFs; - - /// When all folders are through, this is set - TBool iProcessDone; - - /// Index to currently checked CDir item - TInt iFileCounter; - - // Folder Size - TInt64 iSize; - }; - -#endif // CFILEMANAGERACTIVESIZE_H - -// End of File - diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/Cfilemanagerfilesystemevent.h --- a/filemanager/Engine/inc/Cfilemanagerfilesystemevent.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* -* Copyright (c) 2002-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: This AO is signaled when directory entry is added or removed -* from file system -* -*/ - - -#ifndef CFILEMANAGERFILESYSTEMEVENT_H -#define CFILEMANAGERFILESYSTEMEVENT_H - - -// INCLUDES -#include -#include - - -// FORWARD DECLARATIONS -class CFileManagerEngine; - - -// CLASS DECLARATION - -/** -* This class listens file system events -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CFileManagerFileSystemEvent) : public CActive - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CFileManagerFileSystemEvent* NewL( RFs& aFs, - CFileManagerEngine& aEngine, - TNotifyType aNotifyType, - const TDesC& aFullPath = KNullDesC ); - - /** - * Destructor. - */ - virtual ~CFileManagerFileSystemEvent(); - - public: - - /** - * Sets file system event - * @since 2.0 - */ - void Setup(); - - /** - * This calls refresh if file system event has happened - * @since 2.0 - */ - void CheckFileSystemEvent(); - - - protected: // Functions from base classes - - /** - * From CActive Called when asynchronous request has completed - * @since 2.0 - */ - void RunL(); - - /** - * From CActive Called when asynchronous request has failed - * @since 2.0 - */ - TInt RunError( TInt aError ); - - /** - * From CActive Called when asynchronous request was cancelled - * @since 2.0 - */ - void DoCancel(); - - private: - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( const TDesC& aFullPath ); - - /** - * C++ default constructor. - */ - CFileManagerFileSystemEvent( - RFs& aFs, - CFileManagerEngine& aEngine, - TNotifyType aNotifyType ); - - private: // Data - // Ref: Reference to opened File System session - RFs& iFs; - - // Ref: This object is called when RunL occurs - CFileManagerEngine& iEngine; - - // Type of the notify, entry or disk. - TNotifyType iNotifyType; - - // Full path of folder from where notification is needed - HBufC* iFullPath; - - // Indicates if the event has been received - TBool iIsReceived; - - }; - -#endif // CFILEMANAGERFILESYSTEMEVENT_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/Cfilemanagerfolderarray.h --- a/filemanager/Engine/inc/Cfilemanagerfolderarray.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* Copyright (c) 2002-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: Holds the array of CFileManagerFolderEntry -* -*/ - - - -#ifndef CFILEMANAGERFOLDERARRAY_H -#define CFILEMANAGERFOLDERARRAY_H - - -// INCLUDES -#include - - -// FORWARD DECLARATIONS -#ifndef RD_MULTIPLE_DRIVE -class CFileManagerFolderEntry; -#endif // RD_MULTIPLE_DRIVE -class CFileManagerUtils; - - -// CLASS DECLARATION - - -/** -* Array of CFileManagerFolderEntry's -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CFileManagerFolderArray) : public CBase - { - public: - /** - * Two-phased constructors. - */ -#ifdef RD_MULTIPLE_DRIVE - static CFileManagerFolderArray* NewL( CFileManagerUtils& aUtils ); -#else // RD_MULTIPLE_DRIVE - static CFileManagerFolderArray* NewL( - TInt aResId, CFileManagerUtils& aUtils ); -#endif // RD_MULTIPLE_DRIVE - - /** - * Is the given folder in the default folder list - * @since 2.0 - * @param aFolderName folder which is compared to default folder list - * @return ETrue if the given folder is in list, EFalse if not - */ - TBool Contains( const TDesC& aFolderName ); - - /** - * Create folders from array - * @since 3.2 - * @param aDrive Drive which default folders are created - * @param aForced Selects forced or normal creation - */ - void CreateFolders( - const TInt aDrive = KErrNotFound, - const TBool aForced = ETrue ); - - /** - * Destructor. - */ - ~CFileManagerFolderArray(); - private: - /** - * C++ default constructor. - */ - CFileManagerFolderArray( CFileManagerUtils& aUtils ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( TInt aResId ); - -#ifndef RD_MULTIPLE_DRIVE - /** - * Goes through the array of CFileManagerEntry's and tries to - * lookup if the given folder is in the array. - * @since 2.0 - * @return CFileManagerFolderEntry if found, otherwise NULL. - */ - CFileManagerFolderEntry* FindFolder( const TDesC& aFolderName ); -#endif // RD_MULTIPLE_DRIVE - - void DoCreateFoldersL( const TInt aDrive ); - - private: // Data - // Ref: Reference to utils - CFileManagerUtils& iUtils; - - // Own: For checking if folder creation has been done or not - TUint iCreateCheckMask; - -#ifndef RD_MULTIPLE_DRIVE - // Own: Array of CFileManagerFolderEntry's - RPointerArray< CFileManagerFolderEntry > iFolderArray; - - // Own: Indicates if folder array has been sorted - TBool iSorted; -#endif // RD_MULTIPLE_DRIVE - - }; - -#endif // CFILEMANAGERFOLDERARRAY_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/Cfilemanagerindexiterator.h --- a/filemanager/Engine/inc/Cfilemanagerindexiterator.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* Copyright (c) 2002-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: Goes through the list of given files -* -*/ - - -#ifndef CFILEMANAGERINDEXITERATOR_H -#define CFILEMANAGERINDEXITERATOR_H - -// INCLUDES -#include -#include "Mfilemanageritemiterator.h" - -// FORWARD DECLARATIONS -class CFileManagerEngine; - -/** -* Goes through the given file list. Implements the -* MFileManagerItemIterator. -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CFileManagerIndexIterator) : - public CBase, - public MFileManagerItemIterator - { - public: - - /** - * Two-phased constructor. - */ - static CFileManagerIndexIterator* NewL( - CFileManagerEngine& aEngine, - CArrayFixFlat< TInt >& aIndexList, - const TDesC& aDstDir ); - - /** - * Destructor. - */ - ~CFileManagerIndexIterator(); - - public: // From MFileManagerItemIterator - - void CurrentL( - HBufC** aSrc, HBufC** aDst, TFileManagerTypeOfItem& aItemType); - - TBool NextL(); - - private: - - /** - * C++ default constructor. - */ - CFileManagerIndexIterator( - CFileManagerEngine& aEngine, - CArrayFixFlat< TInt >& aIndexList, - const TDesC& aDstDir ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: - // Index to currently processed item in given array - TInt iCurrentIndex; - - // To get the full path information - CFileManagerEngine& iEngine; - - // User chosen list of files - CArrayFixFlat< TInt >& iIndexList; - - // Destination directory - const TDesC& iDstDir; - - // Own: Source of the currently processed item with full path - HBufC* iSrc; - - // Own: Destination of the currently processes item with full path - HBufC* iDst; - - }; - -#endif // CFILEMANAGERINDEXITERATOR_H \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/FileManagerDebug.h --- a/filemanager/Engine/inc/FileManagerDebug.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,179 +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: Common debug definitions -* -*/ - - -#ifndef FILEMANAGERDEBUG_H -#define FILEMANAGERDEBUG_H - - -// INCLUDES -#include -#include - - -//#define FILE_MANAGER_INFO_LOG_ENABLED - -#ifdef _DEBUG - #define FILE_MANAGER_ERROR_LOG_ENABLED -#endif // _DEBUG - - -// Info logging -#ifdef FILE_MANAGER_INFO_LOG_ENABLED - - #define INFO_LOG( aMsg ) { _LIT( KMsg, aMsg ); RDebug::Print( KMsg ); } - - #define INFO_LOG1( aMsg, aArg1 )\ - { _LIT( KMsg, aMsg ); RDebug::Print( KMsg, aArg1 ); } - - #define INFO_LOG2( aMsg, aArg1, aArg2 )\ - { _LIT( KMsg, aMsg ); RDebug::Print( KMsg, aArg1, aArg2 ); } - - #define INFO_LOG3( aMsg, aArg1, aArg2, aArg3 )\ - { _LIT( KMsg, aMsg ); RDebug::Print( KMsg, aArg1, aArg2, aArg3 ); } - -// Function log object -_LIT8( KFuncNameTerminator, "(" ); -_LIT8( KFuncLeavePattern, "L" ); - -class TFuncLog - { -public: - static void Cleanup( TAny* aPtr ) - { - TFuncLog* self = static_cast< TFuncLog* >( aPtr ); - self->iLeft = ETrue; - RDebug::Printf( "%S-LEAVE", &self->iFunc ); // Leave detected - } - - inline TFuncLog( const char* aFunc ) : - iFunc( aFunc ? _S8( aFunc ) : _S8("") ), - iLeft( EFalse ), - iCanLeave( EFalse ) - { - TInt pos( iFunc.Find( KFuncNameTerminator ) ); - if( pos != KErrNotFound ) - { - iFunc.Set( iFunc.Left( pos ) ); - TInt patLen( KFuncLeavePattern().Length() ); - iCanLeave = iFunc.Length() > patLen && - !iFunc.Right( patLen ).Compare( KFuncLeavePattern ); - } - RDebug::Printf( "%S-START", &iFunc ); - } - - inline ~TFuncLog() - { - if ( !iLeft ) - { - if ( iCanLeave ) - { - CleanupStack::Pop( this ); // Pop the cleanup item - } - RDebug::Printf( "%S-END", &iFunc ); // Normally finished - } - } - - TPtrC8 iFunc; - TBool iLeft; - TBool iCanLeave; - }; - - #define FUNC_LOG\ - TFuncLog _fl( __PRETTY_FUNCTION__ );\ - TCleanupItem _flCi( TFuncLog::Cleanup, &_fl );\ - if ( _fl.iCanLeave ) { CleanupStack::PushL( _flCi ); } - - #define TIMESTAMP( aCaption )\ - {\ - TTime t;\ - t.HomeTime();\ - RDebug::Printf( "%s %d us", aCaption, I64INT( t.Int64() ) );\ - } - -#else // FILE_MANAGER_INFO_LOG_ENABLED - - #define INFO_LOG( aMsg ) - - #define INFO_LOG1( aMsg, aArg1 ) - - #define INFO_LOG2( aMsg, aArg1, aArg2 ) - - #define INFO_LOG3( aMsg, aArg1, aArg2, aArg3 ) - - #define FUNC_LOG - - #define TIMESTAMP( aCaption ) - -#endif // FILE_MANAGER_INFO_LOG_ENABLED - - -// Error logging -#ifdef FILE_MANAGER_ERROR_LOG_ENABLED - - #define ERROR_LOG( aMsg ) { _LIT( KMsg, aMsg ); RDebug::Print( KMsg ); } - - #define ERROR_LOG1( aMsg, aArg1 )\ - { _LIT( KMsg, aMsg ); RDebug::Print( KMsg, aArg1 ); } - - #define ERROR_LOG2( aMsg, aArg1, aArg2 )\ - { _LIT( KMsg, aMsg ); RDebug::Print( KMsg, aArg1, aArg2 ); } - - #define ERROR_LOG3( aMsg, aArg1, aArg2, aArg3 )\ - { _LIT( KMsg, aMsg ); RDebug::Print( KMsg, aArg1, aArg2, aArg3 ); } - - #define LOG_IF_ERROR( aErr, aMsg )\ - if ( ( aErr ) != KErrNone )\ - { _LIT( KMsg, aMsg ); RDebug::Print( KMsg ); } - - #define LOG_IF_ERROR1( aErr, aMsg, aArg1 )\ - if ( ( aErr ) != KErrNone )\ - { _LIT( KMsg, aMsg ); RDebug::Print( KMsg, aArg1 ); } - - #define LOG_IF_ERROR2( aErr, aMsg, aArg1, aArg2 )\ - if ( ( aErr ) != KErrNone )\ - { _LIT( KMsg, aMsg ); RDebug::Print( KMsg, aArg1, aArg2 ); } - - #define LOG_IF_ERROR3( aErr, aMsg, aArg1, aArg2, aArg3 )\ - if ( ( aErr ) != KErrNone )\ - { _LIT( KMsg, aMsg ); RDebug::Print( KMsg, aArg1, aArg2, aArg3 ); } - -#else // FILE_MANAGER_ERROR_LOG_ENABLED - - #define ERROR_LOG( aMsg ) - - #define ERROR_LOG1( aMsg, aArg1 ) - - #define ERROR_LOG2( aMsg, aArg1, aArg2 ) - - #define ERROR_LOG3( aMsg, aArg1, aArg2, aArg3 ) - - // Remove compiler warning - #define LOG_IF_ERROR( aErr, aMsg ) ( aErr ) = ( aErr ); - - #define LOG_IF_ERROR1( aErr, aMsg, aArg1 ) ( aErr ) = ( aErr ); - - #define LOG_IF_ERROR2( aErr, aMsg, aArg1, aArg2 ) ( aErr ) = ( aErr ); - - #define LOG_IF_ERROR3( aErr, aMsg, aArg1, aArg2, aArg3 ) ( aErr ) = ( aErr ); - -#endif // FILE_MANAGER_ERROR_LOG_ENABLED - - -#endif // FILEMANAGERDEBUG_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/FileManagerEngine.hrh --- a/filemanager/Engine/inc/FileManagerEngine.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* Copyright (c) 2002-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 headers for project FileManagerEngine -* -*/ - - -#ifndef FILEMANAGERENGINE_HRH -#define FILEMANAGERENGINE_HRH - -#include - -#define commondialogs_mbm_file_location "z:\\resource\\apps\\CommonDialogs.mbm" -#define filemanager_mbm_file_location "z:\\resource\\apps\\FileManager.mbm" -#define avkon_mbm_file_location AVKON_ICON_FILE - -// Icons for the listview display -enum TFileManagerIconId - { - // Mark icon - EFileManagerMarkIcon, - // Folder icons - EFileManagerFolderIcon, - EFileManagerFolderSubIcon, - EFileManagerFolderEmptyIcon, - // Memory icons - EFileManagerMemoryCardIcon, - EFileManagerPhoneMemoryIcon, - // File icons - EFileManagerImageFileIcon, - EFileManagerPictureMsgFileIcon, - EFileManagerDycLogoFileIcon, - EFileManagerLinkFileIcon, - EFileManagerVoicerecFileIcon, - EFileManagerSoundFileIcon, - EFileManagerPlaylistFileIcon, - EFileManagerCompoFileIcon, - EFileManagerNoteFileIcon, - EFileManagerAppFileIcon, - EFileManagerVideoFileIcon, - EFileManagerGameFileIcon, - EFileManagerOtherFileIcon, - EFileManagerFlashFileIcon, - // Main view icons - EFileManagerPhoneMemoryMainIcon, - EFileManagerMemoryCardPresentMainIcon, - EFileManagerMemoryCardNotPresentMainIcon, - EFileManagerBackupMainIcon, - EFileManagerRemoteDriveConnectedIcon, - EFileManagerRemoteDriveMainIcon, - EFileManagerMassStorageMainIcon, - EFileManagerUsbMemoryMainIcon - }; - -// Type of the item -// Needed for App to create correct softmenu for the item -enum TFileManagerTypeOfItem - { - EFileManagerFolder = 1, - EFileManagerDefaultFolder, - EFileManagerForwardLockedFile, - EFileManagerFile, - EFileManagerNoType - }; - -enum TFileManagerMemory - { - EFmPhoneMemory = 0, - EFmMemoryCard, - EFmRemoteDrive, - EFmMassStorage, - EFmUsbMemory, - EFmMemoryCount // must remain last one - }; - -enum TFileManagerActionId - { - EFileManagerBackupAction = 0 - }; - -enum TFileManagerGroupId - { - EFileManagerDrivesGroup = 0, - EFileManagerFilesGroup - }; - -#endif // FILEMANAGERENGINE_HRH diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/FileManagerEngine.rh --- a/filemanager/Engine/inc/FileManagerEngine.rh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2002-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 for project FileManagerEngine -* -*/ - - -#ifndef FILEMANAGERENGINE_RH -#define FILEMANAGERENGINE_RH - -// STRUCTURE DEFINITIONS - -// ----------------------------------------------------------------------------- -// FILEMANAGER_DEFAULT_FOLDER -// This struct is used for mapping default folders -// ----------------------------------------------------------------------------- -// - -STRUCT FILEMANAGER_DEFAULT_FOLDER - { - LTEXT root; // root under which the folder is - LTEXT folder; // name of the folder - BYTE isMediaFolder = 0; // 1 if this is media folder, 0 otherwise - } - -// ----------------------------------------------------------------------------- -// FILEMANAGER_ICON_MAPPER -// This struct is used for mapping MIME type to icon id -// ----------------------------------------------------------------------------- -// - -STRUCT FILEMANAGER_ICON_MAPPER - { - LTEXT mimeType; // MIME type of item - WORD iconId; // icon ID corresponding to MIME type - } - -#endif // FILEMANAGERENGINE_RH - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/FileManagerPrivateCRKeys.h --- a/filemanager/Engine/inc/FileManagerPrivateCRKeys.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Private Central Repository definitions of the -* File Manager subsystem -* -*/ - - - -#ifndef FILEMANAGERPRIVATECRKEYS_H -#define FILEMANAGERPRIVATECRKEYS_H - - -/** File manager repository uid */ -const TUid KCRUidFileManagerSettings = { 0x1020506B }; - -/** Defines the backup content */ -const TUint32 KFileManagerBackupContent = 0x1; - -/** Contains the possible bitmask values of KFileManagerBackupContent key. */ -enum TFileManagerBackupContentMask - { - EFileManagerBackupContentAll = 0x1, - EFileManagerBackupContentSettings = 0x2, - EFileManagerBackupContentMessages = 0x4, - EFileManagerBackupContentContacts = 0x8, - EFileManagerBackupContentCalendar = 0x10, - EFileManagerBackupContentBookmarks = 0x20, - EFileManagerBackupContentUserFiles = 0x40, - EFileManagerBackupContentFirst = 0x2, - EFileManagerBackupContentLast = 0x40 - }; - -/** Defines the backup scheduling mode */ -const TUint32 KFileManagerBackupScheduling = 0x2; - -/** Contains the possible values of KFileManagerBackupScheduling key. */ -enum TFileManagerBackupSchedule - { - EFileManagerBackupScheduleNone = 0, - EFileManagerBackupScheduleDaily, - EFileManagerBackupScheduleWeekly - }; - -/** Defines the scheduled backup weekday. See day definitions from TDay. - * Negative value means the first day of the week. - */ -const TUint32 KFileManagerBackupDay = 0x3; - -/** Defines the scheduled backup time in minutes starting from 00:00 midnight */ -const TUint32 KFileManagerBackupTime = 0x4; - -/** Defines the backup target path as string */ -const TUint32 KFileManagerBackupTargetPath = 0x5; - -/** Defines the status of the last scheduled backup */ -const TUint32 KFileManagerLastSchBackupStatus = 0x6; - -/** Contains the possible values of KFileManagerLastSchBackupStatus key. */ -enum TFileManagerSchBackupStatus - { - EFileManagerSchBackupStatusOk = 0, - EFileManagerSchBackupStatusFailed, - EFileManagerSchBackupStatusStarting, - EFileManagerSchBackupStatusInProgress, - EFileManagerSchBackupStatusCanceled - }; - -/** Defines file manager local variation configuration */ -const TUint32 KFileManagerFeatures = 0x7; - -/** Contains the possible bitmask values of KFileManagerFeatures key. */ -enum TFileManagerFeatures - { - EFileManagerFeatureBackupAllowAllDrives = 0x1, - EFileManagerFeatureNotUsedAnymore = 0x2, - EFileManagerFeatureRightLeftNaviSupported = 0x4, - EFileManagerFeatureScheduledBackupDisabled = 0x8, - EFileManagerFeatureOwnFastScrollDisabled = 0x10 - }; - -/** Defines the file manager application to be launched for the AIW service. -The value of this key is an application UID or zero. */ -const TUint32 KFileManagerAppUidForAiwService = 0x8; - -/** Defines default volume name for non user nameable mass storage. -The default name will be used after format only if the stored volume name is undefined -for the drive. The name is visible only in Windows Explorer during USB mass storage mode and -in 3rd party File Manager(s). */ -const TUint32 KFileManagerDefaultInternalMassStorageVolumeName = 0x9; - -/** Defines a store for keeping existing non user nameable mass storage volume name over -format operation. The data is stored in binary as TFileManagerVolumeNameStore. */ -const TUint32 KFileManagerStoredInternalMassStorageVolumeName = 0xA; - -#endif // FILEMANAGERPRIVATECRKEYS_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/FileManagerSchDefinitions.h --- a/filemanager/Engine/inc/FileManagerSchDefinitions.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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: Common scheduled task definitions -* -*/ - - -#ifndef FILEMANAGERSCHDEFINITIONS_H -#define FILEMANAGERSCHDEFINITIONS_H - - -// For scheduled backup task -_LIT( KSchBackupStarterExe, "filemanagerschbkup.exe" ); -_LIT( KSchBackupTaskName, "StartBackup" ); - - -#endif // FILEMANAGERBACKUPDEFINITIONS_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/MFileManagerProcessObserver.h --- a/filemanager/Engine/inc/MFileManagerProcessObserver.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +0,0 @@ -/* -* Copyright (c) 2002-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: Defines an interface for handling engine events -* -*/ - - - -#ifndef MFILEMANAGERPROCESSOBSERVER_H -#define MFILEMANAGERPROCESSOBSERVER_H - -class MAknBackgroundProcess; - - -// CLASS DECLARATION -/** -* Defines an interface for handling engine events. -* -* @since 2.0 -*/ -class MFileManagerProcessObserver - { - public: - /* Process which is observed*/ - enum TFileManagerProcess - { - ENoProcess = 0, - ECopyProcess, - EMoveProcess, - EIRReceiveProcess, - EDeleteProcess, - EFormatProcess, - EBackupProcess, - ERestoreProcess, - EEjectProcess, - ESchBackupProcess, - EFileOpenProcess - }; - - /** Event which is notified */ - enum TFileManagerNotify - { - ENotifyActionSelected = 0, // Action item is selected - ENotifyDisksChanged, // Disk state changes (disk added, removed etc) - ENotifyBackupMemoryLow, // Low memory for storing backup data - ENotifyForcedFormat, // Forced format - ENotifyFileOpenDenied // File open denied (DRM checks before open etc) - }; - - /** - * Start the refresh process - * @since 2.0 - */ - virtual void RefreshStartedL() = 0; - - /** - * Stops the refresh process - * @since 2.0 - */ - virtual void RefreshStoppedL() = 0; - - /** - * Process has been started - * @since 2.0 - * @param aProcess Started process - * @param aFinalValue Executed progress final value - */ - virtual void ProcessStartedL( - TFileManagerProcess aProcess, - TInt aFinalValue = 0 ) = 0; - - /** - * Process finished - * @since 2.0 - * @param aError Finish status - * @param aName Finish status related text - */ - virtual void ProcessFinishedL( - TInt aError, const TDesC& aName = KNullDesC ) = 0; - - /** - * During execution of process bytes (file copy) or - * percentage (Infrared file receiving) - * is updated via this method - * @since 2.0 - * @param aValue Execution progress related value - */ - virtual void ProcessAdvanceL( TInt aValue ) = 0; - - /** - * Query file overwrite from user - * @since 2.0 - * @param aOldFileName old name of the item - * @param aNewFileName new name of the item - * @param aProcess Move or Copy in progress - * @return ETrue if user want's to overwrite the name, EFalse if not - */ - virtual TBool ProcessQueryOverWriteL( - const TDesC& aOldFileName, - TDes& aNewFileName, - TFileManagerProcess aProcess ) = 0; - - /** - * Query rename item from user - * @param aOldFileName old name of the item - * @param aNewFileName new name of the item - * @param aProcess Move or Copy in progress - * @since 2.0 - * @return ETrue if user want's to change the name, EFalse if not - */ - virtual TBool ProcessQueryRenameL( - const TDesC& aOldFileName, - TDes& aNewFileName, - TFileManagerProcess aProcess ) = 0; - - /** - * Creates and displays wait note - * @since 2.0 - * @param aProcess reference to object which implements - * the Wait Note Wrapper API - */ - virtual void ShowWaitDialogL( MAknBackgroundProcess& aProcess ) = 0; - - /** - * Engine reports that there is an error - * @param aError error code - * @since 2.0 - */ - virtual void Error( TInt aError ) = 0; - - /** - * Handles engine notification - * @since 3.1 - * @param aType Notification type - * @param aData Notification related data - * @param aName Notification related text - * @return A notification related value - */ - virtual TInt NotifyL( - TFileManagerNotify aType, - TInt aData = 0, - const TDesC& aName = KNullDesC ) = 0; - - }; - -#endif // MFILEMANAGERPROCESSOBSERVER_H - -// End of File \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/MFileManagerPropertyObserver.h --- a/filemanager/Engine/inc/MFileManagerPropertyObserver.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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: Interface to handle async P&S property notifications -* -*/ - - - -#ifndef CFILEMANAGERPROPERTYOBSERVER_H -#define CFILEMANAGERPROPERTYOBSERVER_H - -// INCLUDES -#include - - -// CLASS DECLARATION -/** -* Defines an interface for handling async P&S property changes. -* -* @since 3.1 -*/ -class MFileManagerPropertyObserver - { - public: - /** - * Informs about property changes - * @since 3.1 - * @param aCategory Property category Uid - * @param aKey Property key id - */ - virtual void PropertyChangedL( - const TUid& aCategory, const TUint aKey ) = 0; - }; - -#endif // CFILEMANAGERPROPERTYOBSERVER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/MFileManagerThreadFunction.h --- a/filemanager/Engine/inc/MFileManagerThreadFunction.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +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: Background thread abstraction -* -*/ - - -#ifndef MFILEMANAGERTHREADFUNCTION_H -#define MFILEMANAGERTHREADFUNCTION_H - - -// INCLUDES -#include - - -// CLASS DECLARATION -/** -* Defines an interface for background thread abstraction. -* -* @since 3.1 -*/ -class MFileManagerThreadFunction - { - public: // Background thread space executed callbacks - - /** - * Inits background thread owned handles and data. - * Executed always on background thread start. - * @since 3.1 - */ - virtual void InitThreadL() {} - - /** - * Releases background thread owned handles and data. - * Executed always on background thread exit. - * @since 3.1 - */ - virtual void ReleaseThread() {} - - /** - * Runs background thread. - * @since 3.1 - */ - virtual void ThreadStepL() = 0; - - /** - * Checks is background thread done. - * @since 3.1 - * @return ETrue if thread is done and should be finished, - * EFalse if ThreadStepL should be executed. - */ - virtual TBool IsThreadDone() = 0; - - - public: // Client thread space executed callbacks - enum TNotifyType // Notify type flags - { - ENotifyNone = 0x0, - ENotifyError = 0x1, - ENotifyFinished = 0x2, // Notifies thread's death - ENotifyStepFinished = 0x4 // Notifies step completion - }; - /** - * Notifies client about background thread events. - * Background thread is stopped during notification and - * it is safe to modify shared data to handle errors etc. - * @since 3.1 - * @param aType notification type - * @param aValue notification value - */ - virtual void NotifyThreadClientL( - TNotifyType aType, TInt aValue ) = 0; - - }; - -#endif // MFILEMANAGERTHREADFUNCTION_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/Mfilemanageritemiterator.h --- a/filemanager/Engine/inc/Mfilemanageritemiterator.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* -* Copyright (c) 2002-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: Interface to go through file(s) and folder(s) in copy and move -* -*/ - - - -#ifndef MFILEMANAGERITEMITERATOR_H -#define MFILEMANAGERITEMITERATOR_H - -// INCLUDES -#include "FileManagerEngine.hrh" - -// CLASS DECLARATION -/** -* Defines an interface for iterating file(s) and folder(s). -* -* @since 2.0 -*/ -class MFileManagerItemIterator - { - public: - - /** - * Gets the current processed item source and destination with full path - * @since 2.0 - * @param aSrc Returns pointer to item source with full path - * if this parameter is null and aDst contains destination folder - * it means that destination is folder which should be created - * @param aDst Returns pointer to item destination with full path - */ - virtual void CurrentL( - HBufC** aSrc, - HBufC** aDst, - TFileManagerTypeOfItem& aItemType ) = 0; - - /** - * Goes to next item - * @since 2.0 - * @return ETrue if next item found, EFalse if end reached - */ - virtual TBool NextL() = 0; - - /** - * Virtual desctructor - * This is required because the ownership transfer does not work without - */ - virtual ~MFileManagerItemIterator() {} - }; - -#endif // MFILEMANAGERITEMITERATOR_H \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/TFileManagerDriveInfo.h --- a/filemanager/Engine/inc/TFileManagerDriveInfo.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* -* Copyright (c) 2002-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: Drive info storage -* -*/ - - -#ifndef TFILEMANAGERDRIVEINFO_H -#define TFILEMANAGERDRIVEINFO_H - - -// INCLUDES -#include - - -// CONSTANTS -const TInt KMaxVolumeName = 11; // Limited by FAT -// Remove these when there is API available for checking -const TInt KFmgrSystemDrive = EDriveC; -const TInt KFmgrMemoryCardDrive = EDriveE; -const TInt KFmgrRomDrive = EDriveZ; -const TInt KFmgrRamDrive = EDriveD; - - -// FORWARD DECLARATIONS -class RFs; -class CFileManagerEngine; - - -// CLASS DECLARATION -/** -* TFileManagerDriveInfo is used for storing drive info -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -class TFileManagerDriveInfo - { - public: - /** - * C++ default constructor. - */ - IMPORT_C TFileManagerDriveInfo(); - - /** - * Resets contents - */ - IMPORT_C void Reset(); - - TBuf< KMaxVolumeName > iName; - TInt64 iCapacity; - TInt64 iSpaceFree; - TUint iUid; - TInt iDrive; // EDriveA...EDriveZ - // Drive state bits - enum TDriveState - { - EDrivePresent = 0x1, - EDriveLocked = 0x2, - EDriveCorrupted = 0x4, - EDriveWriteProtected = 0x8, - EDriveRemovable = 0x10, - EDriveRemote = 0x20, - EDriveFormattable = 0x40, - EDriveFormatted = 0x80, - EDriveLockable = 0x100, - EDrivePasswordProtected = 0x200, - EDriveBackupped = 0x400, - EDriveConnected = 0x800, - EDriveEjectable = 0x1000, - EDriveInUse = 0x2000, - EDriveMassStorage = 0x4000, - EDriveUsbMemory = 0x8000 - }; - TUint32 iState; - - public: - /** - * Gets drive info - * @since 3.1 - * @param aEngine Reference to engine - * @param aDrive Drive that info is required - */ - void GetInfoL( const CFileManagerEngine& aEngine, const TInt aDrive ); - - private: - void CheckMountL( RFs& aFs, const TInt aDrive ) const; - - TInt FillStateFromDriveInfo( - RFs& aFs, const TInt aDrive, const TDriveInfo& aDrvInfo ); - - TInt FillStateFromVolumeInfo( RFs& aFs, const TInt aDrive ); - - }; - -#endif // TFILEMANAGERDRIVEINFO_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/inc/filemanagerprivatepskeys.h --- a/filemanager/Engine/inc/filemanagerprivatepskeys.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +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: Declaration of private ps-keys -* -*/ - - -#ifndef FILEMANAGEPRIVATEPSKEYS_H -#define FILEMANAGEPRIVATEPSKEYS_H - -// INCLUDES -#include - -// ============================================================================= -// FileManager Status PubSub API -// ============================================================================= -const TUid KPSUidFileManagerStatus = { 0x101F84EB }; // File Manager SID - -/** -* Backup status. -* The value is controlled by FileManager and status observed by backup checker -*/ -const TUint32 KFileManagerBkupStatus = 0x00000001; - -enum TFileManagerBkupStatusType - { - EFileManagerBkupStatusUnset = 0x00000000, - EFileManagerBkupStatusBackup = 0x00000001, - EFileManagerBkupStatusRestore = 0x00000002 - }; - -#endif // FILEMANAGERPRIVATEPSKEYS_H - -// End of File - diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerActiveBase.cpp --- a/filemanager/Engine/src/CFileManagerActiveBase.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +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: Wraps wait note and real work thread -* -*/ - - -// INCLUDES -#include -#include -#include "CFileManagerActiveBase.h" -#include "CFileManagerThreadWrapper.h" - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerActiveBase::CFileManagerActiveBase -// ----------------------------------------------------------------------------- -// -CFileManagerActiveBase::CFileManagerActiveBase() : - iResult( KErrCancel ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveBase::~CFileManagerActiveBase -// ----------------------------------------------------------------------------- -// -CFileManagerActiveBase::~CFileManagerActiveBase() - { - iCanceled = ETrue; - delete iThreadWrapper; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveBase::BaseConstructL -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveBase::BaseConstructL() - { - iThreadWrapper = CFileManagerThreadWrapper::NewL(); - User::LeaveIfError( iThreadWrapper->StartThread( - *this, - MFileManagerThreadFunction::ENotifyFinished, - EPriorityNormal ) ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveBase::StepL -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveBase::StepL() - { - // Just do nothing. All processing is done by ThreadFunctionL(). - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveBase::IsProcessDone -// ----------------------------------------------------------------------------- -// -TBool CFileManagerActiveBase::IsProcessDone() const - { - return iDone; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveBase::DialogDismissedL -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveBase::DialogDismissedL( TInt aButtonId ) - { - if ( aButtonId == EAknSoftkeyCancel ) - { - CancelThreadFunction(); - iCanceled = ETrue; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveBase::ThreadStepL -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveBase::ThreadStepL() - { - ThreadFunctionL( iCanceled ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveBase::IsThreadDone -// ----------------------------------------------------------------------------- -// -TBool CFileManagerActiveBase::IsThreadDone() - { - return ETrue; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveBase::NotifyThreadClientL -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveBase::NotifyThreadClientL( - TNotifyType /*aType*/, TInt aValue) - { - iResult = aValue; - iDone = ETrue; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveBase::Result -// ----------------------------------------------------------------------------- -// -TInt CFileManagerActiveBase::Result() const - { - return iResult; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveBase::CancelThreadFunction -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveBase::CancelThreadFunction() - { - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerActiveExecute.cpp --- a/filemanager/Engine/src/CFileManagerActiveExecute.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1178 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Handles the copy/move operation -* -*/ - - -// INCLUDE FILES -#include -//#include -//#include -#include "CFileManagerActiveExecute.h" -#include "MFileManagerProcessObserver.h" -#include "CFileManagerEngine.h" -#include "CFileManagerFileSystemIterator.h" -#include "Cfilemanagerindexiterator.h" -#include "CFileManagerCommonDefinitions.h" -#include "CFileManagerUtils.h" -#include "FileManagerDebug.h" -#include "CFileManagerThreadWrapper.h" - -// CONSTANTS -const TInt KFileManagerNotificationArrayGranularity = 64; - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::NewL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerActiveExecute* CFileManagerActiveExecute::NewL( - CFileManagerEngine& aEngine, - MFileManagerProcessObserver::TFileManagerProcess aOperation, - MFileManagerProcessObserver& aObserver, - CArrayFixFlat& aIndexList, - const TDesC& aToFolder ) - { - CFileManagerActiveExecute* self = - new( ELeave ) CFileManagerActiveExecute( - aEngine, - aOperation, - aObserver ); - CleanupStack::PushL( self ); - self->ConstructL( aIndexList, aToFolder ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::~CFileManagerActiveExecute -// -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerActiveExecute::~CFileManagerActiveExecute() - { - Cancel(); - delete iThreadWrapper; - delete iItemIterator; - delete iFullPath; - delete iDestination; - delete iToFolder; - delete iIndexList; - delete iChangedSrcItems; - delete iChangedDstItems; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::ExecuteL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerActiveExecute::ExecuteL( TFileManagerSwitch aOverWrite ) - { - TInt error( KErrNone ); - - if ( iCancelled ) - { - TFileName newName; - TParsePtrC parse( *iFullPath ); - if ( parse.NameOrExtPresent() ) - { - newName.Copy( parse.NameAndExt() ); - } - else - { - TPtrC name( iEngine.LocalizedName( *iFullPath ) ); - if ( name.Length() > 0 ) - { - newName.Copy( name ); - } - else - { - newName = BaflUtils::FolderNameFromFullName( *iFullPath ); - } - } - iObserver.ProcessFinishedL( iError, newName ); - return; - } - - if ( aOverWrite == ENoOverWrite ) - { - iItemIterator->CurrentL( &iSrc, &iDst, iItemType ); - } - - if ( iDst && iDst->Length() > KMaxFileName ) - { - error = KErrBadName; - TRequestStatus* status = &iStatus; - User::RequestComplete( status, error ); - } - else if ( iItemType == EFileManagerFile ) - { -#ifdef __KEEP_DRM_CONTENT_ON_PHONE - if ( iSrc && iDst && - CFileManagerUtils::IsFromInternalToRemovableDrive( iFs, *iSrc, *iDst ) ) - { - TBool protectedFile( EFalse ); - - // silently ignore this file if it is protected, or if there - // was an error in checking. - // Did consider leaving, but what about eg KErrNotFound - eg another - // process moving/deleting the file... - TInt ret( iEngine.IsDistributableFile( *iSrc, protectedFile ) ); - if( protectedFile || ret != KErrNone ) - { - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone ); - SetActive(); - return; - } - } -#endif - DoOperation( aOverWrite ); - return; - } - else if ( iItemType == EFileManagerFolder ) - { - if ( !iIsDstRemoteDrive && iEngine.IsNameFoundL( *iDst ) ) - { - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrAlreadyExists ); - SetActive(); - return; - } - DoOperation( aOverWrite ); - return; - } - else - { - // We must complete this - TRequestStatus* status = &iStatus; - User::RequestComplete( status, error ); - } - SetActive(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::CancelExecution -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerActiveExecute::CancelExecution() - { - FUNC_LOG - - iCancelled = ETrue; - - if ( iSrc ) - { - iEngine.CancelTransfer( *iSrc ); - } - if ( iDst ) - { - iEngine.CancelTransfer( *iDst ); - } - delete iThreadWrapper; // Cancel thread - iThreadWrapper = NULL; - Cancel(); - TRAP_IGNORE( CompleteL( KErrCancel ) ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::DoCancel -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveExecute::DoCancel() - { - iCancelled = ETrue; - - if ( iSrc ) - { - iEngine.CancelTransfer( *iSrc ); - } - if ( iDst ) - { - iEngine.CancelTransfer( *iDst ); - } - delete iThreadWrapper; // Cancel thread - iThreadWrapper = NULL; - } - -// ------------------------------------------------------------------------------ -// CFileManagerActiveExecute::KErrNoneAction -// -// ------------------------------------------------------------------------------ -// -void CFileManagerActiveExecute::KErrNoneActionL() - { - UpdateNotifications( EFalse, KErrNone ); - if ( iItemIterator->NextL() ) - { - ExecuteL( ENoOverWrite ); - } - else - { - if ( iOperation == MFileManagerProcessObserver::EMoveProcess && - iEngine.IsFolder( iIndexList->At( 0 ) ) ) - { - if ( !iFinalizeMove ) - { - // Finalize move in the thread, the finalizing way take time - iFinalizeMove = ETrue; - DoOperation( ENoOverWrite ); - return; - } - } - UpdateNotifications( ETrue, KErrNone ); - iObserver.ProcessFinishedL( KErrNone ); - } - - } - -// ------------------------------------------------------------------------------ -// CFileManagerActiveExecute::KErrAlreadyExistsAction -// -// ------------------------------------------------------------------------------ -// -void CFileManagerActiveExecute::KErrAlreadyExistsActionL() - { - TParsePtrC dstParse( *iDst ); - HBufC* name = HBufC::NewLC( KMaxFileName ); - TPtr ptrName( name->Des() ); - TBool doContinue( EFalse ); - - // Depending on target file can it be delete, we ask overwrite or rename. - // If source and target is same, then rename is only possible choice. - if ( iItemType == EFileManagerFile && iEngine.CanDelete( *iDst ) && iSrc->FindF( *iDst ) ) - { - if ( iObserver.ProcessQueryOverWriteL( *iDst, ptrName, iOperation ) ) - { - ExecuteL( EOverWrite ); - } - else - { - // user does not want to overwrite item and ptrName should now contain - // user given new name - if ( ptrName.Length() > 0 ) - { - ptrName.Insert( 0, dstParse.DriveAndPath() ); - if ( !iDst->CompareF( ptrName ) ) - { - DoOperation( ENoOverWrite ); - } - else - { - iDst->Des().Copy( ptrName ); - // Overwrite, because user already queried by overwrite - DoOperation( EOverWrite ); - } - } - else - { - // User is not willing to rename item, continue current operation - doContinue = ETrue; - } - } - } - else - { - // item can't be overwrite - if ( iObserver.ProcessQueryRenameL( *iDst, ptrName, iOperation ) ) - { - if ( ptrName.Length() > 0 ) - { - if ( iItemType == EFileManagerFile ) - { - ptrName.Insert( 0, dstParse.DriveAndPath() ); - iDst->Des().Copy( ptrName ); - } - else if ( iItemType == EFileManagerFolder ) - { - TPtr ptr( iDst->Des() ); - AddLastFolder( ptr, ptrName, *iToFolder ); - iDestination->Des().Copy( ptr ); - } - // Overwrite, because user already queried by rename - ExecuteL( EOverWrite ); - } - else if ( iItemType == EFileManagerFolder ) - { - iCancelled = ETrue; - iError = KErrCancel; - ExecuteL( ENoOverWrite ); - } - else - { - // User is not willing to rename item, continue current operation - doContinue = ETrue; - } - } - else if ( iItemType == EFileManagerFolder ) - { - iCancelled = ETrue; - iError = KErrCancel; - ExecuteL( ENoOverWrite ); - } - else - { - // User is not willing to rename item, continue current operation - doContinue = ETrue; - } - } - - CleanupStack::PopAndDestroy( name ); - - if ( doContinue ) - { - if ( iItemIterator->NextL() ) - { - ExecuteL( ENoOverWrite ); - } - else - { - UpdateNotifications( ETrue, KErrNone ); - iObserver.ProcessFinishedL( KErrNone ); - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::RunL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveExecute::RunL() - { - CompleteL( iStatus.Int() ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::CompleteL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveExecute::CompleteL( TInt aError ) - { - if ( iCancelled || !iItemIterator ) - { - UpdateNotifications( ETrue, iError ); - TParsePtrC parse( CFileManagerUtils::StripFinalBackslash( - *iDestination ) ); - if ( parse.NameOrExtPresent() ) - { - iObserver.ProcessFinishedL( iError, parse.NameAndExt() ); - } - else if ( parse.DrivePresent() ) - { - iObserver.ProcessFinishedL( iError, parse.Drive() ); - } - else - { - iObserver.ProcessFinishedL( iError ); - } - return; - } - - // Symbian returns KErrNone if source and destination - // in moving is same. Here we have to treat it as error. - if( iSrc && iDst ) - { - if ( !iSrc->CompareF( *iDst ) && aError == KErrNone ) - { - aError = KErrInUse; - } - } - - ERROR_LOG1( "CFileManagerActiveExecute::CompleteL()-aError=%d", aError ) - - switch ( aError ) - { - case KErrNone: - { - KErrNoneActionL(); - break; - } - case KErrAlreadyExists: - { - KErrAlreadyExistsActionL(); - break; - } - case KErrCancel: // Suppressed errors - { - UpdateNotifications( ETrue, KErrNone ); - iObserver.ProcessFinishedL( KErrNone ); - break; - } - default: - { - if ( iSrc ) - { - // Try rename when moving and the target file exists and is in use - if ( iOperation == MFileManagerProcessObserver::EMoveProcess && - aError == KErrInUse && - iDst && - iEngine.CanDelete( *iSrc ) && - iEngine.IsNameFoundL( *iDst ) ) - { - KErrAlreadyExistsActionL(); - } - else - { - UpdateNotifications( ETrue, aError ); - TParsePtrC parse( *iSrc ); - iObserver.ProcessFinishedL( aError, parse.NameAndExt() ); - } - } - else - { - UpdateNotifications( ETrue, aError ); - iObserver.ProcessFinishedL( aError ); - } - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::RunError -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerActiveExecute::RunError(TInt aError) - { - return aError; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::CFileManagerActiveExecute -// -// ----------------------------------------------------------------------------- -// -CFileManagerActiveExecute::CFileManagerActiveExecute( - CFileManagerEngine& aEngine, - MFileManagerProcessObserver::TFileManagerProcess aOperation, - MFileManagerProcessObserver& aObserver ) : - CActive( CActive::EPriorityLow ), // Use low to avoid progress note mess up - iEngine( aEngine ), - iFs( aEngine.Fs() ), - iOperation( aOperation ), - iObserver( aObserver ) - { - CActiveScheduler::Add( this ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveExecute::ConstructL( CArrayFixFlat& aIndexList, - const TDesC& aToFolder ) - { - iChangedSrcItems = new( ELeave ) CDesCArrayFlat( - KFileManagerNotificationArrayGranularity ); - iChangedDstItems = new( ELeave ) CDesCArrayFlat( - KFileManagerNotificationArrayGranularity ); - - iToFolder = aToFolder.AllocL(); - TInt count( aIndexList.Count() ); - iIndexList = new( ELeave ) CArrayFixFlat< TInt >( count ); - for( TInt i( 0 ); i < count; ++i ) - { - // make own copy of index list because caller may - // destroy the original one. - iIndexList->AppendL( aIndexList.At( i ) ); - } - - TInt index( iIndexList->At( iCurrentIndex ) ); - - iFullPath = iEngine.IndexToFullPathL( index ); - - TBool isDirectory( iEngine.IsFolder( index ) ); - - iDestination = HBufC::NewL( KFmgrDoubleMaxFileName ); - - if ( isDirectory ) - { - TPtr ptr( iDestination->Des() ); - AddLastFolder( ptr, *iFullPath, *iToFolder ); - } - else - { - iDestination->Des().Copy( aToFolder ); - } - - // Check that we are not copying/moving folder to inside it ( recursive copy ) - if ( isDirectory && !iDestination->FindF( *iFullPath ) && - iDestination->Length() > iFullPath->Length() ) - { - iCancelled = ETrue; - iError = KErrAccessDenied; - } - // Is destination path too long for file system - else if ( iDestination->Length() > KMaxFileName ) - { - iCancelled = ETrue; - iError = KErrBadName; - } - else if ( isDirectory ) - { - iItemIterator = CFileManagerFileSystemIterator::NewL( - iFs, *iFullPath, *iDestination, iEngine ); - } - else - { - iItemIterator = CFileManagerIndexIterator::NewL( - iEngine, aIndexList, *iDestination ); - } - - // MG2 notification object - //iMgxFileManager = &iEngine.MGXFileManagerL(); - - // Check are operation source and target on the same drive - TParsePtrC srcParse( *iFullPath ); - TParsePtrC dstParse( *iDestination ); - TPtrC srcDrv( srcParse.Drive() ); - TPtrC dstDrv( dstParse.Drive() ); - iOperationOnSameDrive = !( srcDrv.CompareF( dstDrv ) ); - iIsSrcRemoteDrive = CFileManagerUtils::IsRemoteDrive( iFs, srcDrv ); - iIsDstRemoteDrive = CFileManagerUtils::IsRemoteDrive( iFs, dstDrv ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::AddLastFolder -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveExecute::AddLastFolder( TDes& aResult, - const TDesC& aSrc, - const TDesC& aDst ) - { - TInt lastBackslash = aSrc.LocateReverse( KFmgrBackslash()[0] ); - if ( lastBackslash != KErrNotFound ) - { - // source is full path - aResult.Copy( aSrc.Left( lastBackslash - 1 ) ); - // Last backslash is now temporary removed check next last backslash - TInt secondLastBackslash( aResult.LocateReverse( KFmgrBackslash()[0] ) ); - // Now we know the coordinates of the last path - aResult.Copy( iEngine.LocalizedName( aSrc ) ); - if ( aResult.Length() > 0 ) - { - aResult.Insert( 0, aDst ); - aResult.Append( KFmgrBackslash ); - } - else - { - aResult.Append( aDst ); - // Skip '\\' - TInt startingPoint( secondLastBackslash + 1 ); - aResult.Append( aSrc.Mid( startingPoint, - lastBackslash - secondLastBackslash ) ); - } - } - else - { - // source is only one folder name - aResult.Copy( aDst ); - aResult.Append( aSrc ); - aResult.Append( KFmgrBackslash ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::DoOperation -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerActiveExecute::DoOperation( TInt aSwitch ) - { - // Source and destination must be different - if ( iSrc && iDst && !iDst->CompareF( *iSrc ) ) - { - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrAlreadyExists ); - SetActive(); - return KErrAlreadyExists; - } - TInt err( KErrNone ); - - iSwitch = aSwitch; - - if ( !iThreadWrapper ) - { - TRAP( err, iThreadWrapper = CFileManagerThreadWrapper::NewL() ); - if ( err != KErrNone ) - { - TRequestStatus* status = &iStatus; - User::RequestComplete( status, err ); - SetActive(); - return err; - } - } - if ( iThreadWrapper->IsThreadStarted() ) - { - iThreadWrapper->ResumeThread(); - } - else - { - err = iThreadWrapper->StartThread( - *this, ENotifyStepFinished, EPriorityLess ); - if ( err != KErrNone ) - { - TRequestStatus* status = &iStatus; - User::RequestComplete( status, err ); - SetActive(); - return err; - } - } - return err; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::IsEmptyDir -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerActiveExecute::IsEmptyDir( const TDesC& aDir ) - { - return !CFileManagerUtils::HasAny( - iFs, aDir, KEntryAttMatchMask | KEntryAttNormal ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::ThreadCopyOrMoveStepL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveExecute::ThreadCopyOrMoveStepL() - { - FUNC_LOG - - INFO_LOG2( "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-%S=>%S", - iSrc, iDst ) - - TInt err( KErrNone ); - - if ( iItemType == EFileManagerFolder ) - { - // Handle folders - err = iFs.MkDir( *iDst ); // Try faster way first - LOG_IF_ERROR1( - err, - "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-MkDir,err=%d", - err ) - if ( err != KErrNone && err != KErrCancel ) - { - err = iFs.MkDirAll( *iDst ); - LOG_IF_ERROR1( - err, - "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-MkDirAll,err=%d", - err ) - } - if ( err == KErrNone ) - { - TEntry entry; - err = iFs.Entry( *iSrc, entry ); - if ( err == KErrNone ) - { - iFs.SetEntry( *iDst, entry.iModified, entry.iAtt, 0 ); // Ignore error - } - } - User::LeaveIfError( err ); - return; - } - - // Handle files - if ( iOperationOnSameDrive && - iOperation == MFileManagerProcessObserver::EMoveProcess ) - { - INFO_LOG( - "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-MoveInsideDrive" ) - - if ( iSwitch == EOverWrite ) - { - INFO_LOG( "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-Overwrite" ) - - err = iFs.Replace( *iSrc, *iDst ); - } - else - { - INFO_LOG( "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-NoOverwrite" ) - - err = iFs.Rename( *iSrc, *iDst ); - } - - LOG_IF_ERROR1( - err, - "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-OnSameDrive,err=%d", - err ) - - if ( err == KErrNone || err == KErrCancel ) - { - // Optimized move was successful or cancelled - User::LeaveIfError( err ); - // If move the files in the same drive, the application - // just calculate the amount of the files, so it should - // notify the observer that how many files have been moved. - iBytesTransferredTotal++; - TRAP_IGNORE( iObserver.ProcessAdvanceL( - iBytesTransferredTotal ) ); - return; - } - } - - TInt64 fileSize( 0 ); - RFile64 srcFile; - - // Open source file - if ( iOperation == MFileManagerProcessObserver::EMoveProcess ) - { - INFO_LOG( "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-Move" ) - - User::LeaveIfError( srcFile.Open( - iFs, *iSrc, EFileRead | EFileShareExclusive ) ); - } - else - { - INFO_LOG( "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-Copy" ) - - User::LeaveIfError( srcFile.Open( - iFs, *iSrc, EFileRead | EFileShareReadersOnly ) ); - } - CleanupClosePushL( srcFile ); - User::LeaveIfError( srcFile.Size( fileSize ) ); - - // Open destination file - RFile64 dstFile; - if ( iSwitch == EOverWrite ) - { - INFO_LOG( "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-Overwrite" ) - - User::LeaveIfError( dstFile.Replace( - iFs, *iDst, EFileWrite | EFileShareExclusive ) ); - } - else - { - INFO_LOG( "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-NoOverwrite" ) - - User::LeaveIfError( dstFile.Create( - iFs, *iDst, EFileWrite | EFileShareExclusive ) ); - } - CleanupClosePushL( dstFile ); - - dstFile.SetSize( fileSize ); // Setting the size first speeds up operation - - INFO_LOG1( - "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-FileSize=%d", - fileSize ) - - // Create buffer and copy file data using it. - // Note that buffer size should not be too big to make it is possible - // to cancel the operation in reasonable time from the main thread. - - // Move these to CenRep to make configuration and fine tuning easier. - const TInt64 KBigBufSize = 0x40000; // 256KB - const TInt64 KMediumBufSize = 0x10000; // 64KB - const TInt64 KSmallBufSize = 0x2000; // 8KB - - HBufC8* buf = HBufC8::New( - Max( KSmallBufSize, Min( fileSize, KBigBufSize ) ) ); - if ( !buf ) - { - buf = HBufC8::New( KMediumBufSize ); - } - if ( !buf ) - { - buf = HBufC8::New( KSmallBufSize ); - } - if ( !buf ) - { - User::Leave( KErrNoMemory ); - } - CleanupStack::PushL( buf ); - - TPtr8 block( buf->Des() ); - - INFO_LOG1( - "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-BlockSize=%d", - block.MaxSize() ) - - while ( err == KErrNone && fileSize > 0 ) - { - if ( iThreadWrapper->IsThreadCanceled() ) - { - err = KErrCancel; - break; - } - TInt blockSize( Min( fileSize, static_cast(block.MaxSize() ) ) ); - err = srcFile.Read( block, blockSize ); - if ( err == KErrNone ) - { - if ( block.Length() == blockSize ) - { - err = dstFile.Write( block, blockSize ); - if ( err == KErrNone ) - { - fileSize -= blockSize; - - // Do not update the latest file transfer progress here. - // Flushing file below may take a long time and - // progress indicator should not get full before it. - TRAP_IGNORE( iObserver.ProcessAdvanceL( - iBytesTransferredTotal ) ); - iBytesTransferredTotal += blockSize; - } - } - else - { - err = KErrCorrupt; - } - } - } - - INFO_LOG2( - "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-BytesNotWritten=%d,err=%d", - fileSize, err ) - - CleanupStack::PopAndDestroy( buf ); - - // Copy attributes - TTime mod; - if ( err == KErrNone ) - { - err = srcFile.Modified( mod ); - - INFO_LOG1( - "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-ModifiedRead,err=%d", - err ) - - } - if ( err == KErrNone ) - { - err = dstFile.SetModified( mod ); - - INFO_LOG1( - "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-ModifiedWritten,err=%d", - err ) - } - TUint att( 0 ); - if ( err == KErrNone ) - { - err = srcFile.Att( att ); - - INFO_LOG2( - "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-AttributesRead,err=%d,att=%d", - err, att ) - } - if ( err == KErrNone ) - { - // Ignore fail, because some drives like remote drives - // do not support attributes at all - dstFile.SetAtt( att, ( ~att ) & KEntryAttMaskSupported ); - - INFO_LOG( - "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-AttributesWritten" ) - } - // Flush file and finalize transfer progress of this file. - // Don't flush if copying failed because it causes save dialog to appear - // when remote drives are involved. - if ( err == KErrNone ) - { - err = dstFile.Flush(); - - INFO_LOG1( - "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-Flushed,err=%d", - err ) - } - TRAP_IGNORE( iObserver.ProcessAdvanceL( iBytesTransferredTotal ) ); - - CleanupStack::PopAndDestroy( &dstFile ); - CleanupStack::PopAndDestroy( &srcFile ); - - // Delete source if move was succesful so far - if ( err == KErrNone && - iOperation == MFileManagerProcessObserver::EMoveProcess ) - { - // Ensure that read-only is removed before delete - if ( att & KEntryAttReadOnly ) - { - CFileManagerUtils::RemoveReadOnlyAttribute( iFs, *iSrc ); - } - err = iFs.Delete( *iSrc ); - - INFO_LOG1( - "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-MoveSourceDeleted,err=%d", - err ) - } - - // Delete incomplete destination if error - if ( err != KErrNone ) - { - // Ensure that read-only is removed before delete - if ( att & KEntryAttReadOnly ) - { - CFileManagerUtils::RemoveReadOnlyAttribute( iFs, *iDst ); - } - iFs.Delete( *iDst ); - - ERROR_LOG1( - "CFileManagerActiveExecute::ThreadCopyOrMoveStepL-FailedDstDeleted,fail=%d", - err ) - } - - User::LeaveIfError( err ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::IsThreadDone() -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerActiveExecute::IsThreadDone() - { - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::NotifyThreadClientL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveExecute::NotifyThreadClientL( - TNotifyType aType, TInt aValue ) - { - switch ( aType ) - { - case ENotifyStepFinished: - { - CompleteL( aValue ); - break; - } - default: - { - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::AppendArrayIfNotFound() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveExecute::AppendArrayIfNotFound( - CDesCArray& aArray, const TDesC& aFullPath ) - { - // Append if not already appended to the last item - TBool append( ETrue ); - TInt count( aArray.MdcaCount() ); - if ( count > 0 ) - { - TPtrC ptr( aArray.MdcaPoint( count - 1 ) ); - if ( !ptr.Compare( aFullPath ) ) - { - append = EFalse; - } - } - if ( append ) - { - TRAPD( err, aArray.AppendL( aFullPath ) ); - if ( err != KErrNone ) - { - ERROR_LOG1( - "CFileManagerActiveExecute::AppendArrayIfNotFound-err=%d", - err ) - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::FlushArray() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveExecute::FlushArray( CDesCArray& aArray ) - { - if ( aArray.MdcaCount() > 0 ) - { -// TRAP_IGNORE( iMgxFileManager->UpdateL( aArray ) ); - aArray.Reset(); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::UpdateNotifications() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveExecute::UpdateNotifications( - TBool aFlush, TInt aError ) - { - // Append notification item if operation was successful and - // item does not already exist - if ( aError == KErrNone && iSrc && iDst && iItemType == EFileManagerFile ) - { - // Notifications are relevant only for local drives - if ( iOperation == MFileManagerProcessObserver::EMoveProcess && - !iIsSrcRemoteDrive ) - { - AppendArrayIfNotFound( *iChangedSrcItems, *iSrc ); - } - if ( !iIsDstRemoteDrive ) - { - AppendArrayIfNotFound( *iChangedDstItems, *iDst ); - } - } - if ( aFlush ) - { - FlushArray( *iChangedSrcItems ); - FlushArray( *iChangedDstItems ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::ThreadFinalizeMoveStepL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveExecute::ThreadFinalizeMoveStepL() - { - FUNC_LOG - - HBufC* folderToDelete = HBufC::NewLC( KMaxFileName ); - TPtr ptrFolderToDelete( folderToDelete->Des() ); - CDirScan* dirScan = CDirScan::NewLC( iFs ); - dirScan->SetScanDataL( - *iFullPath, - KEntryAttNormal|KEntryAttHidden|KEntryAttSystem| - KEntryAttDir|KEntryAttMatchExclusive, - ESortNone, - CDirScan::EScanUpTree ); - CDir* dir = NULL; - dirScan->NextL( dir ); - while( dir ) - { - CFileManagerUtils::RemoveReadOnlyAttribute( - iFs, dirScan->FullPath() ); - CleanupStack::PushL( dir ); - TInt count( dir->Count() ); - for( TInt i( 0 ); i < count; ++i ) - { - if ( iThreadWrapper->IsThreadCanceled() ) - { - User::Leave( KErrCancel ); - } - TPtrC abbrPath( dirScan->AbbreviatedPath() ); - const TEntry& entry( ( *dir )[ i ] ); - ptrFolderToDelete.Copy( *iFullPath ); - ptrFolderToDelete.Append( - abbrPath.Right( abbrPath.Length() - 1 ) ); - ptrFolderToDelete.Append( entry.iName ); - ptrFolderToDelete.Append( KFmgrBackslash ); -#ifdef __KEEP_DRM_CONTENT_ON_PHONE - if ( iSrc && iDst && - CFileManagerUtils::IsFromInternalToRemovableDrive( iFs, *iSrc, *iDst ) ) - { - HBufC* targetFolderToDelete = HBufC::NewLC( KMaxFileName ); - TPtr ptrTargetFolderToDelete( targetFolderToDelete->Des() ); - ptrTargetFolderToDelete.Append( *iDestination ); - ptrTargetFolderToDelete.Append( - abbrPath.Right( abbrPath.Length() - 1 ) ); - ptrTargetFolderToDelete.Append( entry.iName ); - ptrTargetFolderToDelete.Append( KFmgrBackslash ); - - if ( IsEmptyDir( ptrFolderToDelete ) ) - { - User::LeaveIfError( iFs.RmDir( ptrFolderToDelete ) ); - } - else if ( IsEmptyDir( ptrTargetFolderToDelete )) - { - User::LeaveIfError( iFs.RmDir( ptrTargetFolderToDelete ) ); - } - CleanupStack::PopAndDestroy( targetFolderToDelete ); - } - else - { - User::LeaveIfError( iFs.RmDir( ptrFolderToDelete ) ); - } -#else - User::LeaveIfError( iFs.RmDir( ptrFolderToDelete ) ); -#endif - } - if ( iThreadWrapper->IsThreadCanceled() ) - { - User::Leave( KErrCancel ); - } - CleanupStack::PopAndDestroy( dir ); - dir = NULL; - dirScan->NextL( dir ); - } - CleanupStack::PopAndDestroy( dirScan ); - CleanupStack::PopAndDestroy( folderToDelete ); -#ifdef __KEEP_DRM_CONTENT_ON_PHONE - if ( iSrc && iDst && - CFileManagerUtils::IsFromInternalToRemovableDrive( iFs, *iSrc, *iDst ) ) - { - if ( IsEmptyDir( *iFullPath ) ) - { - User::LeaveIfError( iFs.RmDir( *iFullPath ) ); - } - } - else - { - User::LeaveIfError( iFs.RmDir( *iFullPath ) ); - } -#else - User::LeaveIfError( iFs.RmDir( *iFullPath ) ); -#endif - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::ThreadStepL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveExecute::ThreadStepL() - { - FUNC_LOG - - if ( !iFinalizeMove ) - { - ThreadCopyOrMoveStepL(); - } - else - { - ThreadFinalizeMoveStepL(); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveExecute::ToFolder() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CFileManagerActiveExecute::ToFolder() - { - if ( iToFolder ) - { - return iToFolder->Des(); - } - return TPtrC( KNullDesC ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerActiveRename.cpp --- a/filemanager/Engine/src/CFileManagerActiveRename.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,205 +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: Class wraps rename operation -* -*/ - - -// INCLUDES -#include -#include "CFileManagerActiveRename.h" -#include "CFileManagerEngine.h" -#include "CFileManagerUtils.h" -#include "CFileManagerCommonDefinitions.h" -#include "FileManagerDebug.h" - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerActiveRename::CFileManagerActiveRename -// ----------------------------------------------------------------------------- -// -CFileManagerActiveRename::CFileManagerActiveRename( - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils ) : - iEngine( aEngine ), - iUtils( aUtils ), - iFs( aEngine.Fs() ) - { - FUNC_LOG - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveRename::~CFileManagerActiveRename -// ----------------------------------------------------------------------------- -// -CFileManagerActiveRename::~CFileManagerActiveRename() - { - FUNC_LOG - - delete iName; - delete iNewName; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveRename::NewL -// ----------------------------------------------------------------------------- -// -CFileManagerActiveRename* CFileManagerActiveRename::NewL( - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils, - const TDesC& aName, - const TDesC& aNewName ) - { - FUNC_LOG - - CFileManagerActiveRename* self = new ( ELeave ) CFileManagerActiveRename( - aEngine, aUtils ); - CleanupStack::PushL( self ); - self->ConstructL( aName, aNewName ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveRename::ConstructL -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveRename::ConstructL( - const TDesC& aName, const TDesC& aNewName ) - { - FUNC_LOG - - iName = aName.AllocL(); - iNewName = aNewName.AllocL(); - // Remove white spaces from end, file server also ignores those - iNewName->Des().TrimRight(); - iName->Des().TrimRight(); - - iIsRemoteDrive = iUtils.IsRemoteDrive( aName ); - BaseConstructL(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveRename::ThreadFunctionL -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveRename::ThreadFunctionL( const TBool& aCanceled ) - { - FUNC_LOG - - TInt maxSubPath( 0 ); - TBool isFolder( CFileManagerUtils::HasFinalBackslash( *iName ) ); - if ( isFolder && !iIsRemoteDrive ) - { - // On local drives, solve maximum subfolder path to avoid too long paths - maxSubPath = ThreadGetMaxSubfolderPathL( aCanceled ); - } - if ( iNewName->Length() + maxSubPath > KMaxFileName ) - { - User::Leave( KErrBadName ); - } - if ( isFolder ) - { - User::LeaveIfError( iFs.Rename( *iName, *iNewName ) ); - } - else - { - // Replace the target item if exist - // if we have came here, it is already asked that - // user want's to overwrite other item - User::LeaveIfError( iFs.Replace( *iName, *iNewName ) ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveRename::ThreadGetMaxSubfolderPathL -// ----------------------------------------------------------------------------- -// -TInt CFileManagerActiveRename::ThreadGetMaxSubfolderPathL( - const TBool& aCanceled ) - { - FUNC_LOG - - CDirScan* dirScan = CDirScan::NewLC( iFs ); - - // Set scanning from current directory, - // take files and folder including the hidden and system files - // No sorting needed - dirScan->SetScanDataL( - *iName, - KEntryAttNormal | KEntryAttDir | KEntryAttHidden | KEntryAttSystem, - ESortNone ); - - TInt ret( 0 ); - CDir* dir = NULL; - dirScan->NextL( dir ); - while( dir ) - { - CleanupStack::PushL( dir ); - if ( aCanceled ) - { - User::Leave( KErrCancel ); - } - TInt count( dir->Count() ); - for ( TInt i( 0 ); i < count; ++i ) - { - if ( aCanceled ) - { - User::Leave( KErrCancel ); - } - const TEntry& entry( ( *dir )[ i ] ); - TPtrC abbrPath( dirScan->AbbreviatedPath() ); - TInt abbrPathLen( abbrPath.Length() ); - if ( abbrPathLen && abbrPath[ 0 ] == KFmgrBackslash()[ 0 ] ) - { - --abbrPathLen; // Initial backslash is already included - } - TInt pathLen( abbrPathLen + entry.iName.Length() ); - if( entry.IsDir() ) // Add space for trailing backslash - { - ++pathLen; - } - if( pathLen > ret ) - { - ret = pathLen; - } - if ( pathLen > KMaxFileName ) - { - User::Leave( KErrBadName ); - } - } - CleanupStack::PopAndDestroy( dir ); - dirScan->NextL( dir ); - } - CleanupStack::PopAndDestroy( dirScan ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveRename::CancelThreadFunction -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveRename::CancelThreadFunction() - { - FUNC_LOG - - if ( iName ) - { - iEngine.CancelTransfer( *iName ); - } - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerBackupSettings.cpp --- a/filemanager/Engine/src/CFileManagerBackupSettings.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,217 +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: Empty backup settings to maintain library BC. -* Remove this file when cleaning up RnD flags -* -*/ - - - -// INCLUDE FILES -#include "cfilemanagerbackupsettings.h" - - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::CFileManagerBackupSettings -// ---------------------------------------------------------------------------- -// -CFileManagerBackupSettings::CFileManagerBackupSettings( - CFileManagerEngine& aEngine ) : - iEngine( aEngine ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::~CFileManagerBackupSettings -// ---------------------------------------------------------------------------- -// -CFileManagerBackupSettings::~CFileManagerBackupSettings() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::NewL -// ---------------------------------------------------------------------------- -// -CFileManagerBackupSettings* CFileManagerBackupSettings::NewL( - CFileManagerEngine& aEngine ) - { - CFileManagerBackupSettings* self = - new ( ELeave ) CFileManagerBackupSettings( - aEngine ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::ConstructL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupSettings::ConstructL() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::SetContent -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerBackupSettings::SetContent( - const TUint32 /*aContent*/ ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::SetScheduling -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerBackupSettings::SetScheduling( - const TInt /*aScheduling*/ ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::SetDay -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerBackupSettings::SetDay( const TInt /*aDay*/ ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::SetTime -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerBackupSettings::SetTime( const TTime& /*aTime*/ ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::SetTargetDrive -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerBackupSettings::SetTargetDrive( - const TInt /*aDrive*/ ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::Content -// ---------------------------------------------------------------------------- -// -EXPORT_C TUint32 CFileManagerBackupSettings::Content() const - { - return iContent; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::Scheduling -// ---------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerBackupSettings::Scheduling() const - { - return 0; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::Day -// ---------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerBackupSettings::Day() const - { - return 0; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::Time -// ---------------------------------------------------------------------------- -// -EXPORT_C const TTime& CFileManagerBackupSettings::Time() const - { - return iTime; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::TargetDrive -// ---------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerBackupSettings::TargetDrive() const - { - return 0; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::SaveL -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerBackupSettings::SaveL() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::MdcaCount -// ---------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerBackupSettings::SettingAt( const TInt /*aIndex*/ ) - { - return 0; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::MdcaCount -// ---------------------------------------------------------------------------- -// -TInt CFileManagerBackupSettings::MdcaCount() const - { - return 0; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::MdcaPoint -// ---------------------------------------------------------------------------- -// -TPtrC CFileManagerBackupSettings::MdcaPoint( TInt /*aIndex*/ ) const - { - return TPtrC( KNullDesC ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::CEntry::~CEntry -// ---------------------------------------------------------------------------- -// -CFileManagerBackupSettings::CEntry::~CEntry() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::RefreshL -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerBackupSettings::RefreshL() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::AllowedDriveAttMatchMask -// ---------------------------------------------------------------------------- -// -EXPORT_C TUint32 CFileManagerBackupSettings::AllowedDriveAttMatchMask() const - { - return KDriveAttRemovable; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerBackupSettingsFull.cpp --- a/filemanager/Engine/src/CFileManagerBackupSettingsFull.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,679 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Backup settings -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#ifdef RD_MULTIPLE_DRIVE -#include -#endif // RD_MULTIPLE_DRIVE -#include -#include "FileManagerDebug.h" -#include "CFileManagerEngine.h" -#include "FileManagerPrivateCRKeys.h" -#include "CFileManagerBackupSettings.h" -#include "CFileManagerCommonDefinitions.h" - -// CONSTANTS -_LIT( KSeparator, "\t" ); -const TInt KSeparatorSpace = 3; -_LIT( KTimeFormatBefore, " %-B %J:%T" ); -_LIT( KTimeFormatAfter, " %J:%T %+B" ); -const TInt KTimeStrMax = 20; - -const TInt KSchedulingTextLookup[] = { - R_QTN_FMGR_BACKUP_NO_SCHEDULING, // CFileManagerBackupSettings::ENoScheduling - R_QTN_FMGR_BACKUP_DAILY, // CFileManagerBackupSettings::EDaily - R_QTN_FMGR_BACKUP_WEEKLY // CFileManagerBackupSettings::EWeekly -}; - -const TInt KMinToMicroSecMultiplier = 60000000; -const TInt KTargetDriveStrMax = 4; -_LIT( KTimeSeparatorPlaceHolder, ":" ); -const TInt KHourMinSeparator = 1; - - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::CFileManagerBackupSettings -// ---------------------------------------------------------------------------- -// -CFileManagerBackupSettings::CFileManagerBackupSettings( - CFileManagerEngine& aEngine ) : - iEngine( aEngine ) - { - FUNC_LOG - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::~CFileManagerBackupSettings -// ---------------------------------------------------------------------------- -// -CFileManagerBackupSettings::~CFileManagerBackupSettings() - { - FUNC_LOG - delete iCenRep; - iList.ResetAndDestroy(); - iList.Close(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::NewL -// ---------------------------------------------------------------------------- -// -CFileManagerBackupSettings* CFileManagerBackupSettings::NewL( - CFileManagerEngine& aEngine ) - { - CFileManagerBackupSettings* self = - new ( ELeave ) CFileManagerBackupSettings( - aEngine ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::ConstructL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupSettings::ConstructL() - { - FUNC_LOG - - iCenRep = CRepository::NewL( KCRUidFileManagerSettings ); - - RefreshL(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::SetContent -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerBackupSettings::SetContent( - const TUint32 aContent ) - { - iContent = aContent; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::SetScheduling -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerBackupSettings::SetScheduling( - const TInt aScheduling ) - { - iScheduling = aScheduling; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::SetDay -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerBackupSettings::SetDay( const TInt aDay ) - { - iDay = aDay; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::SetTime -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerBackupSettings::SetTime( const TTime& aTime ) - { - iTime = aTime; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::SetTargetDrive -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerBackupSettings::SetTargetDrive( const TInt aDrive ) - { - iTargetDrive = aDrive; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::Content -// ---------------------------------------------------------------------------- -// -EXPORT_C TUint32 CFileManagerBackupSettings::Content() const - { - return iContent; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::Scheduling -// ---------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerBackupSettings::Scheduling() const - { - return iScheduling; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::Day -// ---------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerBackupSettings::Day() const - { - return iDay; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::Time -// ---------------------------------------------------------------------------- -// -EXPORT_C const TTime& CFileManagerBackupSettings::Time() const - { - return iTime; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::TargetDrive -// ---------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerBackupSettings::TargetDrive() const - { - return iTargetDrive; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::ContentCount -// ---------------------------------------------------------------------------- -// -TInt CFileManagerBackupSettings::ContentsSelected() const - { - TInt ret( 0 ); - // Count selected only - TUint32 mask( iContent ); - while ( mask ) - { - if ( mask & 1 ) - { - ++ret; - } - mask >>= 1; - } - return ret; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::SaveL -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerBackupSettings::SaveL() - { - FUNC_LOG - - TInt err( KErrNone ); - - err = iCenRep->Set( - KFileManagerBackupContent, static_cast< TInt >( iContent ) ); - LOG_IF_ERROR1( err, "CFileManagerBackupSettings::SaveL-Content-err%d", - err ) - - err = iCenRep->Set( - KFileManagerBackupScheduling, static_cast< TInt >( iScheduling ) ); - LOG_IF_ERROR1( err, "CFileManagerBackupSettings::SaveL-Scheduling-err%d", - err ) - - err = iCenRep->Set( - KFileManagerBackupDay, static_cast< TInt >( iDay ) ); - LOG_IF_ERROR1( err, "CFileManagerBackupSettings::SaveL-Day-err%d", - err ) - - // Convert micro secs to minutes - TInt minutes( iTime.Int64() / KMinToMicroSecMultiplier ); - err = iCenRep->Set( KFileManagerBackupTime, minutes ); - LOG_IF_ERROR1( err, "CFileManagerBackupSettings::SaveL-Time-err%d", - err ) - - TChar ch; - User::LeaveIfError( RFs::DriveToChar( iTargetDrive, ch ) ); - TBuf< KTargetDriveStrMax > drive; - drive.Append( ch ); - err = iCenRep->Set( KFileManagerBackupTargetPath, drive ); - LOG_IF_ERROR1( err, "CFileManagerBackupSettings::SaveL-Target-err%d", - err ) - - RefreshListL(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::LoadL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupSettings::LoadL() - { - FUNC_LOG - - TInt buffer( 0 ); - TInt err( KErrNone ); - err = iCenRep->Get( KFileManagerBackupContent, buffer ); - LOG_IF_ERROR1( err, "CFileManagerBackupSettings::LoadL-Content-err%d", - err ) - - iContent = buffer; - if ( !iContent ) - { - iContent |= EFileManagerBackupContentAll; - } - - buffer = 0; - err = iCenRep->Get( KFileManagerBackupScheduling, buffer ); - LOG_IF_ERROR1( err, "CFileManagerBackupSettings::LoadL-Scheduling-err%d", - err ) - - iScheduling = buffer; - - buffer = 0; - err = iCenRep->Get( KFileManagerBackupDay, buffer ); - LOG_IF_ERROR1( err, "CFileManagerBackupSettings::LoadL-Day-err%d", - err ) - - iDay = buffer; - if ( iDay == KErrNotFound ) - { - TLocale locale; - iDay = locale.StartOfWeek(); - } - // Convert minutes to micro secs - buffer = 0; - err = iCenRep->Get( KFileManagerBackupTime, buffer ); - LOG_IF_ERROR1( err, "CFileManagerBackupSettings::LoadL-Time-err%d", - err ) - - TInt64 microSecs( buffer ); - microSecs *= KMinToMicroSecMultiplier; - iTime = microSecs; - - HBufC* path = HBufC::NewLC( KMaxPath ); - TPtr ptr( path->Des() ); - err = iCenRep->Get( KFileManagerBackupTargetPath, ptr ); - LOG_IF_ERROR1( err, "CFileManagerBackupSettings::LoadL-Target-err%d", - err ) - - if ( !ptr.Length() ) - { - User::Leave( KErrNotFound ); - } - - _LIT( KDefault, "?" ); - if ( ptr[ 0 ] == KDefault()[ 0 ] ) - { -#ifdef RD_MULTIPLE_DRIVE - err = DriveInfo::GetDefaultDrive( - DriveInfo::EDefaultRemovableMassStorage, iTargetDrive ); - LOG_IF_ERROR1( err, "CFileManagerBackupSettings::LoadL-GetDefaultDrive-err%d", - err ) - User::LeaveIfError( err ); -#else // RD_MULTIPLE_DRIVE - iTargetDrive = KFmgrMemoryCardDrive; -#endif // RD_MULTIPLE_DRIVE - } - else - { - User::LeaveIfError( RFs::CharToDrive( ptr[ 0 ], iTargetDrive ) ); - } - CleanupStack::PopAndDestroy( path ); - - // Get allowed drive mask - err = iCenRep->Get( KFileManagerFeatures, iFileManagerFeatures ); - if ( err != KErrNone ) - { - ERROR_LOG1( "CFileManagerBackupSettings::LoadL-Features-err%d", - err ) - iFileManagerFeatures = 0; - } - INFO_LOG1( - "CFileManagerBackupSettings::LoadL-iFileManagerFeatures=0x%x", - iFileManagerFeatures ) - if ( iFileManagerFeatures & EFileManagerFeatureBackupAllowAllDrives ) - { - iAllowedDriveMatchMask = KDriveAttRemovable | KDriveAttRemote; - } - else - { - iAllowedDriveMatchMask = KDriveAttRemovable; - } - - RefreshListL(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::SettingAt -// ---------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerBackupSettings::SettingAt( const TInt aIndex ) - { - TInt type( ENone ); - if ( aIndex >= 0 && aIndex < iList.Count() ) - { - type = iList[ aIndex ]->iType; - } - return type; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::MdcaCount -// ---------------------------------------------------------------------------- -// -TInt CFileManagerBackupSettings::MdcaCount() const - { - return iList.Count(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::MdcaPoint -// ---------------------------------------------------------------------------- -// -TPtrC CFileManagerBackupSettings::MdcaPoint( TInt aIndex ) const - { - return TPtrC( *( iList[ aIndex ]->iText ) ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::CEntry::~CEntry -// ---------------------------------------------------------------------------- -// -CFileManagerBackupSettings::CEntry::~CEntry() - { - delete iText; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::CreateEntryLC -// ---------------------------------------------------------------------------- -// -CFileManagerBackupSettings::CEntry* CFileManagerBackupSettings::CreateEntryLC( - const TSettingType aType, - const TInt aTitleId, - const TInt aTextId, - const TInt aValue ) - { - HBufC* value = NULL; - if ( aValue ) - { - value = StringLoader::LoadLC( aTextId, aValue ); - } - else - { - value = StringLoader::LoadLC( aTextId ); - } - - CEntry* entry = CreateEntryLC( aType, aTitleId, *value ); - CleanupStack::Pop( entry ); - CleanupStack::PopAndDestroy( value ); - CleanupStack::PushL( entry ); - return entry; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::CreateEntryLC -// ---------------------------------------------------------------------------- -// -CFileManagerBackupSettings::CEntry* CFileManagerBackupSettings::CreateEntryLC( - const TSettingType aType, - const TInt aTitleId, - const TDesC& aText ) - { - CEntry* entry = new ( ELeave ) CEntry; - CleanupStack::PushL( entry ); - - HBufC* title = StringLoader::LoadLC( aTitleId ); - entry->iText = HBufC::NewL( - title->Length() + aText.Length() + KSeparatorSpace ); - - // "\tFirstLabel\t\tValueText" - TPtr ptr( entry->iText->Des() ); - ptr.Append( KSeparator ); - ptr.Append( *title ); - ptr.Append( KSeparator ); - ptr.Append( KSeparator ); - ptr.Append( aText ); - - entry->iType = aType; - - CleanupStack::PopAndDestroy( title ); - return entry; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::CreateContentsEntryLC -// ---------------------------------------------------------------------------- -// -CFileManagerBackupSettings::CEntry* - CFileManagerBackupSettings::CreateContentsEntryLC() - { - TInt selected( ContentsSelected() ); - if ( !( iContent & EFileManagerBackupContentAll ) && selected > 1 ) - { - return CreateEntryLC( - EContents, - R_QTN_FMGR_BACKUP_CONTENTS, - R_QTN_FMGR_BACKUP_CONTENT_SELECTED, - selected ); - } - TInt textId( ContentToTextId( iContent ) ); - return CreateEntryLC( EContents, R_QTN_FMGR_BACKUP_CONTENTS, textId ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::CreateTimeEntryLC -// ---------------------------------------------------------------------------- -// -CFileManagerBackupSettings::CEntry* - CFileManagerBackupSettings::CreateTimeEntryLC() - { - TBuf< KTimeStrMax > timeFormatStr; - TLocale local; - if ( local.AmPmSymbolPosition() == ELocaleBefore ) - { - timeFormatStr.Copy( KTimeFormatBefore ); - } - else - { - timeFormatStr.Copy( KTimeFormatAfter ); - } - TChar timeSeparator( local.TimeSeparator( KHourMinSeparator ) ); - AknTextUtils::ReplaceCharacters( - timeFormatStr, KTimeSeparatorPlaceHolder, timeSeparator ); - TBuf< KTimeStrMax > timeStr; - iTime.FormatL( timeStr, timeFormatStr ); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( timeStr ); - return CreateEntryLC( ETime, R_QTN_FMGR_BACKUP_TIME, timeStr ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::RefreshListL -// ---------------------------------------------------------------------------- -// -void CFileManagerBackupSettings::RefreshListL() - { - iList.ResetAndDestroy(); - - // Contents - CEntry* entry = CreateContentsEntryLC(); - iList.AppendL( entry ); - CleanupStack::Pop( entry ); - - if ( !( iFileManagerFeatures & EFileManagerFeatureScheduledBackupDisabled ) ) - { - // Scheduling - entry = CreateEntryLC( - EScheduling, - R_QTN_FMGR_BACKUP_SCHEDULING, - KSchedulingTextLookup[ iScheduling ] ); - iList.AppendL( entry ); - CleanupStack::Pop( entry ); - - // Weekday - if ( iScheduling == EFileManagerBackupScheduleWeekly ) - { - TDayName dayName( static_cast< TDay >( iDay ) ); - entry = CreateEntryLC( - EWeekday, - R_QTN_FMGR_BACKUP_WEEKDAY, - dayName ); - iList.AppendL( entry ); - CleanupStack::Pop( entry ); - } - - // Time - if ( iScheduling == EFileManagerBackupScheduleWeekly || - iScheduling == EFileManagerBackupScheduleDaily ) - { - entry = CreateTimeEntryLC(); - iList.AppendL( entry ); - CleanupStack::Pop( entry ); - } - } - - // Target drive - if ( HasMultipleBackupTargets() ) - { - entry = CreateTargetDriveEntryLC(); - iList.AppendL( entry ); - CleanupStack::Pop( entry ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::ContentToTextId -// ---------------------------------------------------------------------------- -// -TInt CFileManagerBackupSettings::ContentToTextId( const TUint32 aContent ) - { - TInt ret( R_QTN_FMGR_BACKUP_CONTENT_ALL ); - - if ( aContent & EFileManagerBackupContentAll ) - { - ret = R_QTN_FMGR_BACKUP_CONTENT_ALL; - } - else if ( aContent & EFileManagerBackupContentSettings ) - { - ret = R_QTN_FMGR_BACKUP_CONTENT_SETTINGS; - } - else if ( aContent & EFileManagerBackupContentMessages ) - { - ret = R_QTN_FMGR_BACKUP_CONTENT_MESSAGES; - } - else if ( aContent & EFileManagerBackupContentContacts ) - { - ret = R_QTN_FMGR_BACKUP_CONTENT_CONTACTS; - } - else if ( aContent & EFileManagerBackupContentCalendar ) - { - ret = R_QTN_FMGR_BACKUP_CONTENT_CALENDAR; - } - else if ( aContent & EFileManagerBackupContentBookmarks ) - { - ret = R_QTN_FMGR_BACKUP_CONTENT_BOOKMARKS; - } - else if ( aContent & EFileManagerBackupContentUserFiles ) - { - ret = R_QTN_FMGR_BACKUP_CONTENT_USERFILES; - } - return ret; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::RefreshL -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerBackupSettings::RefreshL() - { - LoadL(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::CreateTargetDriveEntryLC -// ---------------------------------------------------------------------------- -// -CFileManagerBackupSettings::CEntry* - CFileManagerBackupSettings::CreateTargetDriveEntryLC() - { - TPtrC driveName( iEngine.DriveName( iTargetDrive ) ); - - if ( driveName.Length() ) - { - return CreateEntryLC( - ETarget, R_QTN_FMGR_BACKUP_DESTINATION, driveName ); - } - - TChar ch; - User::LeaveIfError( RFs::DriveToChar( iTargetDrive, ch ) ); - TBuf< KTargetDriveStrMax > drive; - drive.Append( ch ); - return CreateEntryLC( ETarget, R_QTN_FMGR_BACKUP_DESTINATION, drive ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::AllowedDriveAttMatchMask -// ---------------------------------------------------------------------------- -// -EXPORT_C TUint32 CFileManagerBackupSettings::AllowedDriveAttMatchMask() const - { - return iAllowedDriveMatchMask; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBackupSettings::HasMultipleBackupTargets -// ---------------------------------------------------------------------------- -// -TBool CFileManagerBackupSettings::HasMultipleBackupTargets() - { -#ifdef RD_MULTIPLE_DRIVE - TBool count( 0 ); - TUint32 driveAttMask( AllowedDriveAttMatchMask() ); - RFs& fs( iEngine.Fs() ); - - for ( TInt i( 0 ); i < KMaxDrives; ++i ) - { - TDriveInfo driveInfo; - if ( fs.Drive( driveInfo, i ) == KErrNone ) - { - // Do not allow backup for internal drives - TUint driveStatus( 0 ); - DriveInfo::GetDriveStatus( fs, i, driveStatus ); - if ( driveStatus & DriveInfo::EDriveInternal ) - { - continue; - } - if ( driveInfo.iDriveAtt & driveAttMask ) - { - ++count; - } - } - if ( count > 1 ) - { - break; - } - } - return count > 1; -#else // RD_MULTIPLE_DRIVE - return EFalse; -#endif // RD_MULTIPLE_DRIVE - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerDocHandler.cpp --- a/filemanager/Engine/src/CFileManagerDocHandler.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,366 +0,0 @@ -/* -* Copyright (c) 2004-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: Wraps document handler functions -* -*/ - - - -// INCLUDES -#include -#include -#include -#include "CFileManagerDocHandler.h" -#include "CFileManagerEngine.h" -#include "CFileManagerUtils.h" -#include "CFileManagerThreadWrapper.h" -#include "MFileManagerProcessObserver.h" -#include "FileManagerDebug.h" - - -// ----------------------------------------------------------------------------- -// CFileManagerDocHandler::CFileManagerDocHandler() -// -// ----------------------------------------------------------------------------- -// -CFileManagerDocHandler::CFileManagerDocHandler( - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils ) : - iEngine( aEngine ), - iUtils( aUtils ), - iFs( aEngine.Fs() ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocHandler::NewL() -// -// ------------------------------------------------------------------------------ -// -CFileManagerDocHandler* CFileManagerDocHandler::NewL( - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils ) - { - CFileManagerDocHandler* self = new (ELeave) CFileManagerDocHandler( - aEngine, aUtils ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocHandler::~CFileManagerDocHandler() -// -// ------------------------------------------------------------------------------ -// -CFileManagerDocHandler::~CFileManagerDocHandler() - { - iApaSession.Close(); - delete iThreadWrapper; - delete iFileMime; - delete iFileFullPath; - delete iDocHandler; - iFile.Close(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocHandler::HandleServerAppExit() -// -// ----------------------------------------------------------------------------- -void CFileManagerDocHandler::HandleServerAppExit( TInt aReason ) - { - if ( iEmbeddedAppOpen ) - { - iEngine.NoticeServerAppExit( aReason ); - iEngine.EmbeddedAppStatus( EFalse ); - iEmbeddedAppOpen = EFalse; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocHandler::ConstructL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerDocHandler::ConstructL() - { - iDocHandler = CDocumentHandler::NewL(); - iDocHandler->SetExitObserver( this ); - User::LeaveIfError( iApaSession.Connect() ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocHandler::OpenFileL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerDocHandler::OpenFileL( - const TDesC& aFullPath, MFileManagerProcessObserver* aObserver ) - { - if ( iEmbeddedAppOpen ) - { - ERROR_LOG( "CFileManagerDocHandler::OpenFileL-OpenAlreadyOngoing" ) - return; // Ignore too fast open events to prevent mess up - } - - delete iThreadWrapper; - iThreadWrapper = NULL; - - delete iFileFullPath; - iFileFullPath = NULL; - - delete iFileMime; - iFileMime = NULL; - - iFileReady = EFalse; - iFile.Close(); - - iObserver = aObserver; - - //Judge the file extention, if a sis file, notify Engine to flush the cache - if ( EFileManagerAppFileIcon == iUtils.ResolveIconL( aFullPath ) ) - { - iEngine.SetSisFile( ETrue ); - } - - // Get fullpath and MIME type - TPtrC mime16( iUtils.MimeTypeL( aFullPath ) ); - iFileMime = HBufC8::NewL( mime16.Length() ); - iFileMime->Des().Copy( mime16 ); - iFileFullPath = aFullPath.AllocL(); - - if ( iUtils.IsRemoteDrive( *iFileFullPath ) ) - { - iThreadWrapper = CFileManagerThreadWrapper::NewL(); - User::LeaveIfError( iThreadWrapper->StartThread( - *this, - MFileManagerThreadFunction::ENotifyFinished, EPriorityNormal ) ); - - // Async file open - if ( iObserver ) - { - TRAP_IGNORE( iObserver->ProcessStartedL( - MFileManagerProcessObserver::EFileOpenProcess, KErrNone ) ); - } - } - else - { - // Sync file open - if ( iObserver ) - { - TRAP_IGNORE( iObserver->ProcessStartedL( - MFileManagerProcessObserver::EFileOpenProcess, KErrNone ) ); - } - - RFile64 sharableFile; - TRAPD( err, iDocHandler->OpenTempFileL( *iFileFullPath, sharableFile ) ); - if ( err == KErrNone ) - { - TRAP( err, OpenShareableFileL( sharableFile, *iFileMime ) ); - } - sharableFile.Close(); - - if ( iObserver ) - { - TRAP_IGNORE( iObserver->ProcessFinishedL( err ) ); - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocHandler::OpenShareableFileL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerDocHandler::OpenShareableFileL( - RFile64& aShareableFile, const TDesC8& aMime ) - { - // Check if iFileFullPath is NULL - if ( !iFileFullPath ) - { - User::Leave( KErrNotFound ); - } - - // Check if file open is denied - if ( iObserver ) - { - if ( iObserver->NotifyL( - MFileManagerProcessObserver::ENotifyFileOpenDenied, - 0, - *iFileFullPath ) ) - { - return; - } - } - - TDataType dataType( aMime ); - CAiwGenericParamList& paramList( iDocHandler->InParamListL() ); - - // If remote drive, make sure that file can be opened remotely - if ( iUtils.IsRemoteDrive( *iFileFullPath ) ) - { - TUid appUid; - TDataType fileType; - User::LeaveIfError( iApaSession.AppForDocument( - aShareableFile, appUid, fileType ) ); - if ( !iEngine.HasAppRemoteDriveSupport( appUid ) ) - { - User::Leave( KErrFmgrNotSupportedRemotely ); - } - dataType = fileType; - } - // Otherwise just make sure that file exists before opening it - else if ( !BaflUtils::FileExists( iEngine.Fs(), *iFileFullPath ) ) - { - User::Leave( KErrNotFound ); - } - - TInt err( KErrNone ); - TInt err2( KErrNone ); - - TRAP( err, err2 = iDocHandler->OpenFileEmbeddedL( - aShareableFile, dataType, paramList ) ); - - LOG_IF_ERROR1( err, - "CFileManagerDocHandler::OpenShareableFileL-err=%d", err ) - LOG_IF_ERROR1( err2, - "CFileManagerDocHandler::OpenShareableFileL-err2=%d", err2 ) - - // Make sure that not supported functionality is handled properly - if ( err2 == KErrNotSupported || err2 == KMimeNotSupported || - err == KErrNotSupported || err == KMimeNotSupported ) - { - User::Leave( KErrNotSupported ); - } - else if ( err == KErrNotFound || err2 == KErrNotFound ) - { - User::Leave( KErrGeneral ); - } - User::LeaveIfError( err ); - User::LeaveIfError( err2 ); - - iEngine.EmbeddedAppStatus( ETrue ); - iEmbeddedAppOpen = ETrue; - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocHandler::ThreadStepL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerDocHandler::ThreadStepL() - { - // Open shareable file and make sure that it is loaded to file cache - // before opening the file with app - TInt err( iFile.Open( iFs, *iFileFullPath, EFileShareReadersOnly ) ); - if ( err == KErrInUse ) - { - User::LeaveIfError( iFile.Open( - iFs, *iFileFullPath, EFileShareReadersOrWriters ) ); - } - else - { - User::LeaveIfError( err ); - } - - TInt64 pos( 0 ); - TInt64 size( 0 ); - TInt readSize( 0 ); - const TInt KReadBufferSize = 16384; // 16KB - HBufC8* buffer = HBufC8::NewLC( KReadBufferSize ); - TPtr8 ptr( buffer->Des() ); - - User::LeaveIfError( iFile.Size( size ) ); - while ( size > 0 ) - { - if ( iThreadWrapper->IsThreadCanceled() ) - { - User::Leave( KErrCancel ); - } - - readSize = Min( size, ptr.MaxSize() ); - User::LeaveIfError( iFile.Read( pos, ptr, readSize ) ); - size -= readSize; - } - - CleanupStack::PopAndDestroy( buffer ); - iFileReady = ETrue; - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocHandler::IsThreadDone() -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerDocHandler::IsThreadDone() - { - return iFileReady; - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocHandler::NotifyThreadClientL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerDocHandler::NotifyThreadClientL( - TNotifyType aType, TInt aValue ) - { - switch ( aType ) - { - case ENotifyFinished: - { - // Open shareable file with app and inform observer - if ( aValue == KErrNone && iFileReady ) - { - TRAP( aValue, OpenShareableFileL( iFile, *iFileMime ) ); - } - iFile.Close(); - - if ( iObserver ) - { - TRAP_IGNORE( iObserver->ProcessFinishedL( aValue ) ); - } - if ( aValue != KErrNone ) - { - // Ensure that the status gets updated on error - HandleServerAppExit( 0 ); - } - break; - } - default: - { - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerDocHandler::CancelFileOpen() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerDocHandler::CancelFileOpen() - { - if ( iFileFullPath ) - { - iEngine.CancelTransfer( *iFileFullPath ); - } - if ( iThreadWrapper ) - { - iThreadWrapper->CancelThread(); - } - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerEngine.cpp --- a/filemanager/Engine/src/CFileManagerEngine.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2301 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Main class of the filemanagerengine -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -//#include -//#include -//#include -#include -#include -#include -#ifdef RD_MULTIPLE_DRIVE -#include -#endif // RD_MULTIPLE_DRIVE -#include "CFileManagerEngine.h" -#include "CGflmNavigatorModel.h" -#include "CGflmGroupItem.h" -#include "CGflmFileSystemItem.h" -#include "CGflmDriveItem.h" -#include "CGflmGlobalActionItem.h" -#include "MGflmItemGroup.h" -#include "Cfilemanagerfolderarray.h" -#include "CFilemanagerMimeIconArray.h" -#include "CFileManagerActiveExecute.h" -#include "CFileManagerRefresher.h" -#include "Cfilemanagerfilesystemevent.h" -#include "Cfilemanageractivesize.h" -#include "Cfilemanageractivedelete.h" -#include "FileManagerEngine.hrh" -#include "CFileManagerCommonDefinitions.h" -#include "CFileManagerUtils.h" -#include "CFileManagerItemFilter.h" -#include "CFileManagerDocHandler.h" -#include "FileManagerDebug.h" -#include "CFileManagerItemProperties.h" -#include "CFileManagerRemovableDriveHandler.h" -#include "CFileManagerRemoteDriveHandler.h" -#include "CFileManagerBackupSettings.h" -#include "CFileManagerRestoreSettings.h" -#include "CFileManagerActiveRename.h" -#include "CFileManagerFeatureManager.h" - -// CONSTANTS -const TUint16 KIllegalChars[] = { - '<', '>', '"', '/', '\\', '|', ':', '*', '?', - 0xFF02, // Full width quote - 0xFF0A, // Full width asterisk - 0xFF0F, // Full width slash - 0xFF1A, // Full width colon - 0xFF1C, // Full width left arrow - 0xFF1E, // Full width right arrow - 0xFF1F, // Full width question mark - 0xFF3C, // Full width back slash - 0xFF5C, // Full width pipe - 0x201C, // Left quote - 0x201D, // Right quote - 0x201F, // Reversed quote - 0x21B2, // Downwards arrow with tip leftwards - 0, // Array terminator -}; -const TUint KDiskEventCheckInterval = 100000; // microseconds - - - -// ============================ LOCAL FUNCTIONS ================================ -// ----------------------------------------------------------------------------- -// SearchMGAlbumIdL -// ----------------------------------------------------------------------------- -// -/*static TInt SearchMGAlbumIdL( - CMGAlbumManager& aAlbumManager, const TDesC& aFilename ) - { - CDesCArray* fileArray = - new ( ELeave ) CDesCArraySeg( KMGFileArrayGranularity ); - CleanupStack::PushL( fileArray ); - TInt albumCount( aAlbumManager.AlbumCount() ); - TInt ret( KErrNotFound ); - for( TInt i( 0 ); i < albumCount; ++i ) - { - CMGAlbumInfo* albumInfo = aAlbumManager.AlbumInfoLC( i ); - TInt albumId( albumInfo->Id() ); - CleanupStack::PopAndDestroy( albumInfo ); - fileArray->Reset(); - aAlbumManager.GetAlbumFileArrayL( albumId, *fileArray ); - TInt pos( 0 ); - if( !fileArray->Find( aFilename, pos ) ) - { - ret = albumId; - break; - } - } - CleanupStack::PopAndDestroy( fileArray ); - return ret; - } -*/ - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::CFileManagerEngine -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerEngine::CFileManagerEngine( RFs& aFs ) : - iFs( aFs ), iObserver( NULL ), iSisFile( EFalse ),iDelayedDiskEventNotify( NULL ) - { - FUNC_LOG - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerEngine* CFileManagerEngine::NewL( RFs& aFs ) - { - CFileManagerEngine* self = new ( ELeave ) CFileManagerEngine( aFs ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::ConstructL -// ----------------------------------------------------------------------------- -// -void CFileManagerEngine::ConstructL() - { - FUNC_LOG - - INFO_LOG( "CFileManagerEngine::ConstructL()-Create Feature Manager" ) - iFeatureManager = CFileManagerFeatureManager::NewL(); - - iState = ENavigation; - - INFO_LOG( "CFileManagerEngine::ConstructL()-Create navigator" ) - iNavigator = CGflmNavigatorModel::NewL( iFs ); - - // Create drives group - MGflmItemGroup* newGroup = iNavigator->CreateGroupL( - EFileManagerDrivesGroup, EDrives ); -#ifdef RD_FILE_MANAGER_BACKUP - // Set backup action - HBufC* actionCaption = StringLoader::LoadLC( R_QTN_FMGR_MAIN_BACKUP ); - newGroup->AddActionItemL( EFileManagerBackupAction, *actionCaption ); - CleanupStack::PopAndDestroy( actionCaption ); -#endif // RD_FILE_MANAGER_BACKUP - - // Create files and folders groups - iNavigator->CreateGroupL( EFileManagerFilesGroup, EDirectories | EFiles ); - - INFO_LOG( "CFileManagerEngine::ConstructL()-Create refresher" ) - iRefresher = CFileManagerRefresher::NewL( *iNavigator ); - - INFO_LOG( "CFileManagerEngine::ConstructL()-Create utils" ) - iUtils = CFileManagerUtils::NewL( iFs, *iNavigator, *iFeatureManager ); - - INFO_LOG( "CFileManagerEngine::ConstructL()-Create disk event" ) - iDiskEvent = CFileManagerFileSystemEvent::NewL( iFs, *this, ENotifyDisk ); - - INFO_LOG( "CFileManagerEngine::ConstructL()-Create removable drive handler" ) - iRemovableDrvHandler = CFileManagerRemovableDriveHandler::NewL( - iFs, *iUtils, *this ); - INFO_LOG( "CFileManagerEngine::ConstructL()-Create remote drive handler" ) - iRemoteDrvHandler = CFileManagerRemoteDriveHandler::NewL( - *this, *iUtils ); - - INFO_LOG( "CFileManagerEngine::ConstructL()-Create item filter" ) - iItemFilter = CFileManagerItemFilter::NewL( *this ); - iNavigator->SetCustomFilter( iItemFilter ); - - // Store new starting index - iNavigationIndices.AppendL( KErrNotFound ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::~CFileManagerEngine -// Destructor -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerEngine::~CFileManagerEngine() - { - delete iActiveRename; - iNavigationIndices.Reset(); - delete iRemoteDrvHandler; - delete iBackupSettings; - delete iRestoreSettings; - delete iRemovableDrvHandler; - delete iDocHandler; - //delete iMgxFileManager; - delete iFileSystemEvent; - delete iRefresher; - delete iNavigator; - delete iItemFilter; - delete iSearchString; - delete iSearchFolder; - delete iActiveSize; - delete iDiskEvent; - delete iUtils; - delete iDriveName; - delete iFeatureManager; - if( iDelayedDiskEventNotify != NULL ) - { - iDelayedDiskEventNotify->Cancel(); - delete iDelayedDiskEventNotify; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SetFileSystemEventL -// ----------------------------------------------------------------------------- -// -void CFileManagerEngine::SetFileSystemEventL( const TDesC& aFullPath ) - { - delete iFileSystemEvent; - iFileSystemEvent = NULL; - if ( aFullPath != KNullDesC ) - { - iFileSystemEvent = CFileManagerFileSystemEvent::NewL( - iFs, *this, ENotifyEntry, aFullPath ); - } - else - { - iFileSystemEvent = CFileManagerFileSystemEvent::NewL( - iFs, *this, ENotifyEntry ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::IndexToFullPathL -// ----------------------------------------------------------------------------- -// -EXPORT_C HBufC* CFileManagerEngine::IndexToFullPathL( - const TInt aIndex ) const - { - if ( aIndex < 0 || aIndex >= iNavigator->MdcaCount() ) - { - User::Leave( KErrNotFound ); - } - CGflmGroupItem* item = iNavigator->Item( aIndex ); - HBufC* fullPath = NULL; - switch ( item->Type() ) - { - case CGflmGroupItem::EFile: // Fall through - case CGflmGroupItem::EDirectory: - { - CGflmFileSystemItem* fsItem = - static_cast< CGflmFileSystemItem* >( item ); - fullPath = fsItem->FullPathL(); - break; - } - case CGflmGroupItem::EDrive: - { - CGflmDriveItem* drvItem = - static_cast< CGflmDriveItem* >( item ); - fullPath = drvItem->RootDirectory().AllocL(); - break; - } - default: - { - User::Leave( KErrNotFound ); - break; - } - } - return fullPath; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::IndexToFullPathLC -// ----------------------------------------------------------------------------- -// -EXPORT_C HBufC* CFileManagerEngine::IndexToFullPathLC( - const TInt aIndex ) const - { - HBufC* fullPath = IndexToFullPathL( aIndex ); - CleanupStack::PushL( fullPath ); - return fullPath; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::AddFullPathLC -// ----------------------------------------------------------------------------- -// -HBufC* CFileManagerEngine::AddFullPathLC( - const TDesC& aName, const TBool aIsFolder ) - { - TPtrC dir( iNavigator->CurrentDirectory() ); - TInt len( dir.Length() + aName.Length() ); - if ( aIsFolder ) - { - ++len; // Ensure space for backslash - } - HBufC* fullPath = HBufC::NewLC( len ); - TPtr ptr( fullPath->Des() ); - ptr.Append( dir ); - ptr.Append( aName ); - if ( aIsFolder ) - { - CFileManagerUtils::EnsureFinalBackslash( ptr ); - } - return fullPath; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SetMemoryL -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerEngine::SetMemoryL( TFileManagerMemory /*aMemory*/ ) - { - // Just check current drive avaibility, no matter what memory is set - iLastDriveAvailable = CurrentDriveAvailable(); - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::Memory -// ----------------------------------------------------------------------------- -// -EXPORT_C TFileManagerMemory CFileManagerEngine::Memory() const - { -#ifdef RD_MULTIPLE_DRIVE - CGflmDriveItem* drvItem = iNavigator->CurrentDrive(); - if ( drvItem ) - { - TUint driveStatus( drvItem->DriveStatus() ); - if ( driveStatus & DriveInfo::EDriveInternal ) - { - if ( driveStatus & DriveInfo::EDriveExternallyMountable ) - { - return EFmMassStorage; - } - return EFmPhoneMemory; - } - else if ( driveStatus & DriveInfo::EDriveUsbMemory ) - { - return EFmUsbMemory; - } - else if ( driveStatus & DriveInfo::EDriveRemovable ) - { - return EFmMemoryCard; - } - else if ( driveStatus & DriveInfo::EDriveRemote ) - { - return EFmRemoteDrive; - } - } - return EFmPhoneMemory; -#else // RD_MULTIPLE_DRIVE - CGflmDriveItem* drvItem = iNavigator->CurrentDrive(); - if ( drvItem ) - { - const TVolumeInfo vol( drvItem->VolumeInfo() ); - if ( vol.iDrive.iDriveAtt & KDriveAttInternal ) - { - return EFmPhoneMemory; - } - else if ( vol.iDrive.iDriveAtt & KDriveAttRemovable ) - { - return EFmMemoryCard; - } - else if ( vol.iDrive.iDriveAtt & KDriveAttRemote ) - { - return EFmRemoteDrive; - } - } - return EFmPhoneMemory; -#endif // RD_MULTIPLE_DRIVE - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::FileList -// ----------------------------------------------------------------------------- -// -EXPORT_C MDesCArray* CFileManagerEngine::FileList() const - { - return iNavigator; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::OpenL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::OpenL( const TInt aIndex ) - { - // Store drive letter for current drive changed checking - TChar prevDrive( 0 ); - TPtrC prevDir( iNavigator->CurrentDirectory() ); - if ( prevDir.Length() ) - { - prevDrive = prevDir[ 0 ]; - } - - if ( aIndex < 0 || aIndex >= iNavigator->MdcaCount() ) - { - User::Leave( KErrNotFound ); - } - CGflmGroupItem* item = iNavigator->Item( aIndex ); - switch ( item->Type() ) - { - case CGflmGroupItem::EFile: // Fall through - case CGflmGroupItem::EDirectory: // Fall through - case CGflmGroupItem::EDrive: - { - -#ifdef RD_MULTIPLE_DRIVE - // Ensure that default folders exist - if ( item->Type() == CGflmGroupItem::EDrive ) - { - CGflmDriveItem* drvItem = - static_cast< CGflmDriveItem* >( item ); - iUtils->CreateDefaultFolders( - drvItem->Drive(), EFalse ); - } -#endif // RD_MULTIPLE_DRIVE - - // Store navigation position - SetCurrentIndex( aIndex ); - - HBufC* fullPath = IndexToFullPathLC( aIndex ); - if ( item->Type() == CGflmGroupItem::EFile ) - { - OpenFileL( *fullPath ); - } - else - { - OpenDirectoryL( *fullPath ); - - // Setup new navigation position - iNavigationIndices.AppendL( 0 ); - } - CleanupStack::PopAndDestroy( fullPath ); - break; - } - case CGflmGroupItem::EGlobalActionItem: - { - CGflmGlobalActionItem* actItem = - static_cast< CGflmGlobalActionItem* >( item ); - if ( iProcessObserver ) - { - iProcessObserver->NotifyL( - MFileManagerProcessObserver::ENotifyActionSelected, - actItem->Id() ); - } - break; - } - default: - { - break; - } - } - - // Ensure that cached current drive info gets updated if drive was changed - TPtrC dir( iNavigator->CurrentDirectory() ); - if ( dir.Length() ) - { - if ( dir[ 0 ] != prevDrive ) - { - iCurrentDriveInfoRefreshed = EFalse; - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SetObserver -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::SetObserver( - MFileManagerProcessObserver* aObserver ) - { - iProcessObserver = aObserver; - iRefresher->SetObserver( aObserver ); - iRemovableDrvHandler->SetObserver( aObserver ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::CurrentDirectory -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CFileManagerEngine::CurrentDirectory() const - { - return iNavigator->CurrentDirectory(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::CurrentDirectory -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CFileManagerEngine::LocalizedNameOfCurrentDirectory() const - { - return iNavigator->LocalizedNameOfCurrentDirectory(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::BackstepL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::BackstepL() - { - // Store drive letter for current drive changed checking - TChar prevDrive( 0 ); - // Note that prevDir gets invalid after BackstepL - TPtrC prevDir( iNavigator->CurrentDirectory() ); - if ( prevDir.Length() ) - { - prevDrive = prevDir[ 0 ]; - } - - // Setup backstep navigation index - if ( !iNavigator->NavigationLevel() ) - { - // Always first for initial root level - iCurrentItemName.Zero(); - } - else if( !iCurrentItemName.Length() ) - { - // Otherwise previously opened folder - iCurrentItemName.Copy( - iNavigator->LocalizedNameOfCurrentDirectory() ); - } - TInt pos( iNavigationIndices.Count() - 1 ); - if ( pos >= 0 ) - { - iNavigationIndices.Remove( pos ); - } - - iNavigator->BackstepL(); - - // Ensure that cached current drive info gets updated if drive was changed - TPtrC dir( iNavigator->CurrentDirectory() ); - if ( dir.Length() ) - { - if ( dir[ 0 ] != prevDrive ) - { - iCurrentDriveInfoRefreshed = EFalse; - } - } - else - { - // Make sure that drive info is refreshed - ClearDriveInfo(); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::FileTypeL -// ----------------------------------------------------------------------------- -// -EXPORT_C TUint32 CFileManagerEngine::FileTypeL( const TInt aIndex ) const - { - TUint32 fileType( CFileManagerItemProperties::ENotDefined ); - if ( aIndex >= 0 ) - { - HBufC* fullPath = IndexToFullPathLC( aIndex ); - fileType = FileTypeL( *fullPath ); - CleanupStack::PopAndDestroy( fullPath ); - } - return fileType; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::FileTypeL -// ----------------------------------------------------------------------------- -// -EXPORT_C TUint32 CFileManagerEngine::FileTypeL( const TDesC& aFullPath ) const - { - return iUtils->FileTypeL( aFullPath ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::DeleteL -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerActiveDelete* CFileManagerEngine::CreateActiveDeleteL( - CArrayFixFlat< TInt >& aIndexList ) - { - - CFileManagerActiveDelete* activeDelete = - CFileManagerActiveDelete::NewL( aIndexList, *this, *iUtils ); - return activeDelete; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::NewFolder -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::NewFolderL( const TDesC& aFolderName ) - { - // Add backslash to end so that MkDir realizes that it is directory - HBufC* fullPath = AddFullPathLC( aFolderName, ETrue ); - TPtr ptr( fullPath->Des() ); - - if ( ptr.Length() <= KMaxFileName ) - { - iCurrentItemName.Copy( aFolderName ); - - // Remove white spaces from end, file server also ignores those - iCurrentItemName.TrimRight(); - - User::LeaveIfError( iFs.MkDir( ptr ) ); - } - else - { - User::Leave( KErrBadName ); - } - - CleanupStack::PopAndDestroy( fullPath ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SetCurrentItemName -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::SetCurrentItemName( const TDesC& aFileName ) - { - - iCurrentItemName.Copy( aFileName ); - - // Remove white spaces from end, file server also ignores those - iCurrentItemName.TrimRight(); - - } -// ----------------------------------------------------------------------------- -// CFileManagerEngine::RenameL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::RenameL( - const TInt aIndex, - const TDesC& aNewFileName ) - { - FUNC_LOG - - // Make those given names as full paths - TBool isFolder( IsFolder( aIndex ) ); - HBufC* fullPathOld = IndexToFullPathLC( aIndex ); - HBufC* fullPathNew = AddFullPathLC( aNewFileName, isFolder ); - - if ( !fullPathOld->Compare( *fullPathNew ) ) - { - // The name has not changed, rename is not required - CleanupStack::PopAndDestroy( fullPathNew ); - CleanupStack::PopAndDestroy( fullPathOld ); - return; - } - - // Gallery notification is relevant only for local drives - TBool isRemoteDrive( iUtils->IsRemoteDrive( *fullPathOld ) ); - - // Media Gallery albums get easily messed up when files are renamed. - // Direct album editing seems a trick but it is seems to only way - // to update Gallery properly. - /*CMGAlbumManager* albumManager = MGAlbumManagerFactory::NewAlbumManagerL(); - CleanupStack:: PushL( albumManager ); - TInt albumId( KErrNotFound ); - if ( !isFolder && !isRemoteDrive ) - { - // Do album search for files only - TRAPD( err, albumId = SearchMGAlbumIdL( *albumManager, *fullPathOld ) ); - if( err != KErrNone ) - { - albumId = KErrNotFound; - } - } -*/ - // Handle rename - delete iActiveRename; - iActiveRename = NULL; - iActiveRename = CFileManagerActiveRename::NewL( - *this, *iUtils, *fullPathOld, *fullPathNew ); - ShowWaitDialogL( *iActiveRename ); - User::LeaveIfError( iActiveRename->Result() ); - - // Update Media Gallery album if file exist in album - /*if( albumId != KErrNotFound ) - { - TRAP_IGNORE( { albumManager->RemoveFromAlbumL( *fullPathOld, albumId ); - albumManager->AddToAlbumL( *fullPathNew, albumId ); } ); - } - CleanupStack::PopAndDestroy( albumManager );*/ - - iCurrentItemName.Copy( aNewFileName ); - - /*if ( !isRemoteDrive ) - { - // Notify Media Gallery again - TRAP_IGNORE( MGXFileManagerL().UpdateL( *fullPathOld, *fullPathNew ) ); - }*/ - - CleanupStack::PopAndDestroy( fullPathNew ); - CleanupStack::PopAndDestroy( fullPathOld ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::FolderLevel -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerEngine::FolderLevel() - { - CGflmDriveItem* drvItem = iNavigator->CurrentDrive(); - if ( !drvItem ) - { - return KErrNotFound; // Main level - } - TPtrC dir( iNavigator->CurrentDirectory() ); - TInt count( dir.Length() ); - if ( !count ) - { - return KErrNotFound; // Main level - } - // Count how many backslashes is in string to figure out the deepness - TInt min( drvItem->RootDirectory().Length() ); - TInt bsCount( 0 ); - while( count > min ) - { - --count; - if ( dir[ count ] == KFmgrBackslash()[ 0 ] ) - { - ++bsCount; - } - } - return bsCount; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::IsNameFoundL -// ----------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerEngine::IsNameFoundL( const TDesC& aName ) - { - return iUtils->IsNameFoundL( aName ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::CurrentDrive -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerEngine::CurrentDrive() - { - TInt ret( KErrNotFound ); - TPtrC ptr( iNavigator->CurrentDirectory() ); - if ( ptr.Length() ) - { - if( RFs::CharToDrive( ptr[ 0 ], ret ) != KErrNone ) - { - ret = KErrNotFound; - } - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::GetItemInfoL -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerItemProperties* CFileManagerEngine::GetItemInfoL( - const TInt aIndex ) - { - if ( aIndex < 0 || aIndex >= iNavigator->MdcaCount() ) - { - User::Leave( KErrNotFound ); - } - CGflmGroupItem* item = iNavigator->Item( aIndex ); - return CFileManagerItemProperties::NewL( *item, *iUtils, *this ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SetState -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::SetState( TState aState ) - { - iState = aState; - iNavigator->EnableSearchMode( iState == ESearch ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SetState -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerEngine::TState CFileManagerEngine::State() const - { - return iState; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::RefreshDirectory -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::RefreshDirectory() - { - FUNC_LOG - -#ifdef FILE_MANAGER_INFO_LOG_ENABLED - if ( iState == ENavigation ) - { - TPtrC dir( iNavigator->CurrentDirectory() ); - INFO_LOG1( "CFileManagerEngine::RefreshDirectory-dir=%S", &dir ); - } -#endif // FILE_MANAGER_INFO_LOG_ENABLED - - iRefresher->Refresh(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::GetMMCInfoL -// ----------------------------------------------------------------------------- -// -EXPORT_C TFileManagerDriveInfo CFileManagerEngine::GetMMCInfoL() const - { - TFileManagerDriveInfo drvInfo; - GetDriveInfoL( - PathInfo::MemoryCardRootPath(), drvInfo ); - return drvInfo; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SearchString -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CFileManagerEngine::SearchString() const - { - if ( iSearchString ) - { - return iSearchString->Des(); - } - return TPtrC( KNullDesC ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::IsValidName -// ----------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerEngine::IsValidName( - const TDesC& aDriveAndPath, const TDesC& aName, TBool aIsFolder ) const - { - // Check name for bad chars - const TUint16 KMinAllowedChar = 0x0020; - const TUint16 KParagraphSeparator = 0x2029; - const TUint16 KDot = '.'; - TFileName nameAfterTrim( aName ); - nameAfterTrim.TrimRight(); - TInt nameLen( nameAfterTrim.Length() ); - if ( !nameLen ) - { - return EFalse; - } - for ( TInt i( 0 ); i < nameLen; i++ ) - { - TUint16 ch( nameAfterTrim[ i ] ); - if ( ch < KMinAllowedChar || ch == KParagraphSeparator ) - { - return EFalse; - } - } - // File system ignores totally dot in the end of name, so - // we set here as not valid name, so that user gets correctly informed - if ( nameAfterTrim[ nameLen - 1 ] == KDot || IllegalChars( nameAfterTrim ) ) - { - return EFalse; - } - // Get full path length - TPtrC pathPtr( aDriveAndPath.Length() ? - TPtrC( aDriveAndPath ) : TPtrC( iNavigator->CurrentDirectory() ) ); - TInt pathLen( pathPtr.Length() ); - if ( !pathLen ) - { - return EFalse; - } - TInt fullPathLen( pathLen ); - if ( !CFileManagerUtils::HasFinalBackslash( pathPtr ) ) - { - ++fullPathLen; // Add backslash before name - } - fullPathLen += nameLen; - if ( aIsFolder ) - { - ++fullPathLen; // Add folder final backslash - } - - TBool ret( EFalse ); - if ( fullPathLen <= KMaxFileName ) - { - // Check full path - HBufC* fullPath = HBufC::New( KMaxFileName ); - if ( fullPath ) - { - TPtr ptr( fullPath->Des() ); - ptr.Copy( pathPtr ); - CFileManagerUtils::EnsureFinalBackslash( ptr ); // Add backslash before name - ptr.Append( nameAfterTrim ); - ret = iFs.IsValidName( ptr ); - delete fullPath; - } - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::IllegalChars -// ----------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerEngine::IllegalChars( const TDesC& aName ) const - { - for ( TInt i( 0 ); KIllegalChars[ i ]; i++ ) - { - if ( aName.Locate( KIllegalChars[ i ] ) != KErrNotFound ) - { - return ETrue; - } - } - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::EnoughSpaceL -// ----------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerEngine::EnoughSpaceL( - const TDesC& aToFolder, - TInt64 aSize, - MFileManagerProcessObserver::TFileManagerProcess aOperation ) const - { - TPtrC src( iNavigator->CurrentDirectory() ); - TInt srcDrv( KErrNotFound ); - if ( src.Length() ) - { - User::LeaveIfError( RFs::CharToDrive( src[ 0 ], srcDrv ) ); - } - TInt dstDrv( KErrNotFound ); - if ( aToFolder.Length() ) - { - User::LeaveIfError( RFs::CharToDrive( aToFolder[ 0 ], dstDrv ) ); - } - else - { - return ETrue; // Invalid destination - } - - TBool ret( EFalse ); - - // if operation is move and drive is same so there is always enough memory - if ( srcDrv == dstDrv && - aOperation == MFileManagerProcessObserver::EMoveProcess ) - { - ret = ETrue; - } - else - { - ret = !SysUtil::DiskSpaceBelowCriticalLevelL( - &iFs, aSize , dstDrv ); - } - - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::FileSystemEvent -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::FileSystemEvent( TBool aEventOn ) - { - INFO_LOG2( - "CFileManagerEngine::FileSystemEvent-aEventOn=%d,iFileSystemEventEnabled=%d", - aEventOn, iFileSystemEventEnabled ) - - INFO_LOG2( - "CFileManagerEngine::FileSystemEvent-iDriveAddedOrChangedPostponed=%d,iEmbeddedApplicationOn=%d ", - iDriveAddedOrChangedPostponed, iEmbeddedApplicationOn ) - - if ( !iFileSystemEventEnabled && aEventOn ) - { - iDriveAddedOrChangedPostponed = EFalse; - iFileSystemEventEnabled = ETrue; - } - else if ( iFileSystemEventEnabled && !aEventOn ) - { - iFileSystemEventEnabled = EFalse; - if ( iDriveAddedOrChangedPostponed ) - { - iDriveAddedOrChangedPostponed = EFalse; - TRAP_IGNORE( DriveAddedOrChangedL() ); - } - } - - if ( iUtils->IsRemoteDrive( iNavigator->CurrentDirectory() ) ) - { - // At the moment no use to have event for remote drives - delete iFileSystemEvent; - iFileSystemEvent = NULL; - return; - } - - // Set event on when there is no embedded app with event - if ( aEventOn && - !( iEmbeddedApplicationOn && iFileSystemEvent ) ) - { - TInt err( KErrNone ); - switch ( iState ) - { - case ENavigation: - { - TRAP( err, SetFileSystemEventL( iNavigator->CurrentDirectory() ) ); - break; - } - case ESearch: - { - TRAP( err, SetFileSystemEventL() ); - break; - } - default: - { - break; - } - } - if ( err != KErrNone && iProcessObserver ) - { - iProcessObserver->Error( err ); - } - } - // Check event and set it off when there is no embedded app - else if( !iEmbeddedApplicationOn && iFileSystemEvent ) - { - iFileSystemEvent->CheckFileSystemEvent(); - delete iFileSystemEvent; - iFileSystemEvent = NULL; - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerEngine::CurrentIndex -// -// ------------------------------------------------------------------------------ -// -EXPORT_C TInt CFileManagerEngine::CurrentIndex() - { - if ( iCurrentItemName.Length() ) - { - TInt count( iNavigator->MdcaCount() ); - for( TInt i( 0 ); i < count; ++i ) - { - CGflmGroupItem* item = iNavigator->Item( i ); - if ( !item->Name().CompareF( iCurrentItemName ) ) - { - iCurrentItemName.Zero(); - return i; - } - } - iCurrentItemName.Zero(); - } - - // Top navigation index - TInt pos( iNavigationIndices.Count() - 1 ); - if ( pos >= 0 ) - { - return iNavigationIndices[ pos ]; - } - return KErrNotFound; - } - -// ------------------------------------------------------------------------------ -// CFileManagerEngine::CanDelete -// -// ------------------------------------------------------------------------------ -// -TBool CFileManagerEngine::CanDelete( const TDesC& aFileName ) const - { - return iUtils->CanDelete( aFileName ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerEngine::LocalizedName -// -// ------------------------------------------------------------------------------ -// -EXPORT_C TPtrC CFileManagerEngine::LocalizedName( - const TDesC& aFullPath ) const - { - return iUtils->LocalizedName( aFullPath ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerEngine::FilesInFolderL -// -// ------------------------------------------------------------------------------ -// -EXPORT_C TInt CFileManagerEngine::FilesInFolderL() - { - TInt ret( 0 ); - switch ( iState ) - { - case ENavigation: // Fall through - case ESearch: - { - TInt count( iNavigator->MdcaCount() ); - for( TInt i( 0 ); i < count; ++i ) - { - CGflmGroupItem* item = iNavigator->Item( i ); - if ( item->Type() == CGflmGroupItem::EFile ) - { - ++ret; - } - } - break; - } - default: - { - break; - } - } - return ret; - } - -// ------------------------------------------------------------------------------ -// CFileManagerEngine::CancelRefresh -// -// ------------------------------------------------------------------------------ -// -EXPORT_C TBool CFileManagerEngine::CancelRefresh() - { - switch ( iState ) - { - case ENavigation: - { - CancelTransfer( iNavigator->CurrentDirectory() ); - break; - } - case ESearch: - { - if ( iSearchFolder ) - { - CancelTransfer( *iSearchFolder ); - } - break; - } - default: - { - break; - } - } - return iRefresher->CancelRefresh(); - } - -// ------------------------------------------------------------------------------ -// CFileManagerEngine::DriveAddedOrChangeAsyncL -// -// ------------------------------------------------------------------------------ -// -TInt CFileManagerEngine::DriveAddedOrChangeAsyncL( TAny* aPtr ) - { - static_cast( aPtr )->DriveAddedOrChangedL(); - - //return value will be ignored by CPeriodic that calls this function - //following line keeps the compiler happy - return 0; - } - -// ------------------------------------------------------------------------------ -// CFileManagerEngine::DriveAddedOrChangedL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerEngine::DriveAddedOrChangedL() - { - FUNC_LOG - - if( iDiskEvent ) - { - iDiskEvent->Setup(); - } - - TBool processOngoing( iRemovableDrvHandler->IsProcessOngoing() ); - - INFO_LOG3( "CFileManagerEngine::DriveAddedOrChangedL-event=%d,process=%d,postponed=%d ", - iFileSystemEventEnabled, processOngoing, iDriveAddedOrChangedPostponed ) - - if ( iFileSystemEventEnabled || processOngoing ) - { - iDriveAddedOrChangedPostponed = ETrue; - } - else - { - iDriveAddedOrChangedPostponed = EFalse; - ClearDriveInfo(); - if ( iProcessObserver && - !iEmbeddedApplicationOn && - !iWaitDialogOn && - !iRefresher->IsActive() ) - { - StopDiskEventNotifyTimerAsync(); - TPtrC dir( iNavigator->CurrentDirectory() ); - if ( dir.Length() ) - { - TBool isAvailable( CurrentDriveAvailable() ); - - if ( iUtils->IsRemoteDrive( dir ) ) - { - // Notify whether remote drive has become available - // So when receiving remote drive connection event, - // View will be refreshed - //if ( !iLastDriveAvailable && isAvailable ) - // { - iProcessObserver->NotifyL( - MFileManagerProcessObserver::ENotifyDisksChanged, 0 ); - // } - } - else - { - // Notify if drive has become unavailable or - // avaibility has changed - if ( !isAvailable || - isAvailable != iLastDriveAvailable ) - { - iProcessObserver->NotifyL( - MFileManagerProcessObserver::ENotifyDisksChanged, 0 ); - } - } - } - else - { - // Notify always when no folder is opened - iProcessObserver->NotifyL( - MFileManagerProcessObserver::ENotifyDisksChanged, 0 ); - } - } - else - { - if( ( iProcessObserver == NULL ) || iEmbeddedApplicationOn ) - { - //Do not refresh while embedded application is running or process observer is not set - StopDiskEventNotifyTimerAsync(); - } - else - { - if( iRefresher->IsActive() ) - { - //start Timer and notify disk event until current disk refresh finishes - StartDiskEventNotifyTimerAsyncL(); - } - } - } - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerEngine::FolderContentChangedL -// -// ------------------------------------------------------------------------------ -// -void CFileManagerEngine::FolderContentChangedL() - { - if( iProcessObserver ) - { - iProcessObserver->NotifyL( - MFileManagerProcessObserver::ENotifyDisksChanged, 0 ); - } - else - { - RefreshDirectory(); - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerEngine::IsFolder -// -// ------------------------------------------------------------------------------ -// -EXPORT_C TBool CFileManagerEngine::IsFolder( const TInt aIndex ) const - { - if ( aIndex < 0 || aIndex >= iNavigator->MdcaCount() ) - { - return EFalse; - } - CGflmGroupItem* item = iNavigator->Item( aIndex ); - TBool ret( EFalse ); - switch ( item->Type() ) - { - case CGflmGroupItem::EDirectory: // Fallthrough - case CGflmGroupItem::EDrive: // Fallthrough - case CGflmGroupItem::EGlobalActionItem: - { - ret = ETrue; - break; - } - default: - { - break; - } - } - return ret; - } - -// ------------------------------------------------------------------------------ -// CFileManagerEngine::IconIdL -// -// ------------------------------------------------------------------------------ -// -EXPORT_C TInt CFileManagerEngine::IconIdL( const TInt aIndex ) const - { - if ( aIndex < 0 || aIndex >= iNavigator->MdcaCount() ) - { - User::Leave( KErrNotFound ); - } - CGflmGroupItem* item = iNavigator->Item( aIndex ); - return iUtils->ResolveIconL( *item ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::ShowWaitDialogL( MAknBackgroundProcess& aProcess ) -// -// ----------------------------------------------------------------------------- -// -void CFileManagerEngine::ShowWaitDialogL( MAknBackgroundProcess& aProcess ) - { - iWaitDialogOn = ETrue; - TRAPD( err, iProcessObserver->ShowWaitDialogL( aProcess ) ); - iWaitDialogOn = EFalse; - User::LeaveIfError( err ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::EmbeddedAppStatus( TBool aStatus ) -// -// ----------------------------------------------------------------------------- -// -void CFileManagerEngine::EmbeddedAppStatus( TBool aStatus ) - { - iEmbeddedApplicationOn = aStatus; - FileSystemEvent( aStatus ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::IsSystemFolder -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerEngine::IsSystemFolder( const TDesC& aFullPath ) const - { - _LIT( KSystemFolder, "?:\\system\\*" ); - _LIT( KSysFolder, "?:\\sys\\*" ); - _LIT( KPrivateFolder, "?:\\private\\*" ); - _LIT( KResourceFolder, "?:\\resource\\*" ); - - if ( aFullPath.MatchF( KSystemFolder ) != KErrNotFound || - aFullPath.MatchF( KSysFolder ) != KErrNotFound || - aFullPath.MatchF( KResourceFolder ) != KErrNotFound || - aFullPath.MatchF( KPrivateFolder ) != KErrNotFound ) - { - return ETrue; - } - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::CurrentDriveName() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CFileManagerEngine::CurrentDriveName() - { -#ifdef RD_MULTIPLE_DRIVE - TPtrC dir( iNavigator->CurrentDirectory() ); - if ( dir.Length() ) - { - TInt drive = TDriveUnit( dir ); - return DriveName( drive ); - } -#else // RD_MULTIPLE_DRIVE - CGflmDriveItem* drvItem = iNavigator->CurrentDrive(); - if ( drvItem ) - { - return drvItem->Name(); - } -#endif // RD_MULTIPLE_DRIVE - return TPtrC( KNullDesC ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::GetDriveInfoL() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::GetDriveInfoL( - TFileManagerDriveInfo& aInfo ) - { - if ( iCurrentDriveInfoRefreshed ) - { - // Use cached info - aInfo = iCurrentDriveInfo; - return; - } - - CGflmDriveItem* drvItem = iNavigator->CurrentDrive(); - if ( drvItem ) - { - GetDriveInfoL( drvItem->Drive(), aInfo ); - - // Store info for later use - iCurrentDriveInfo = aInfo; - iCurrentDriveInfoRefreshed = ETrue; - } - else - { - User::Leave( KErrNotFound ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::IsDistributableFile() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerEngine::IsDistributableFile( - const TDesC& aFullPath, TBool& aIsProtected ) const - { - return iUtils->IsDistributableFile( aFullPath, aIsProtected ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::RenameDrive() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerEngine::RenameDrive( - const TInt aDrive, - const TDesC& aName ) - { - TInt len( aName.Length( ) ); - for( TInt i( 0 ); i < len; i++ ) - { - TChar ch( aName[ i ] ); - // If not alphadigit or space, return error - if( !ch.IsAlphaDigit() && !ch.IsSpace() ) - { - return KErrBadName; - } - } - TInt err( iFs.SetVolumeLabel( aName, aDrive ) ); - if ( err == KErrNone ) - { - // Refresh drive info after rename - ClearDriveInfo(); - } - return err; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SetDrivePassword() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerEngine::SetDrivePassword( - const TInt aDrive, - const TMediaPassword& aOld, - const TMediaPassword& aNew ) - { - ClearDriveInfo(); - TInt err( iFs.LockDrive( aDrive, aOld, aNew, ETrue ) ); - INFO_LOG1( "CFileManagerEngine::SetDrivePassword err %d", err ); - return err; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::RemoveDrivePassword() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerEngine::RemoveDrivePassword( - const TInt aDrive, - const TMediaPassword& aPwd ) - { - ClearDriveInfo(); - TInt err( iFs.ClearPassword( aDrive, aPwd ) ); - INFO_LOG1( "CFileManagerEngine::RemoveDrivePassword err %d", err ); - return err; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::UnlockDrive() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerEngine::UnlockDrive( - const TInt aDrive, - const TMediaPassword& aPwd ) - { - ClearDriveInfo(); - TInt err( iFs.UnlockDrive( aDrive, aPwd, ETrue ) ); - INFO_LOG1( "CFileManagerEngine::UnlockDrive err %d", err ); - return err; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::StartFormatProcessL() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::StartFormatProcessL( - const TInt aDrive ) - { - ClearDriveInfo(); - iRemovableDrvHandler->StartFormatL( aDrive ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::StartEjectProcessL() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::StartEjectProcessL( const TInt /*aDrive*/ ) - { - ClearDriveInfo(); - iRemovableDrvHandler->StartEjectL(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::StartBackupProcessL() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::StartBackupProcessL( - MFileManagerProcessObserver::TFileManagerProcess aProcess ) - { - switch( aProcess ) - { - case MFileManagerProcessObserver::EBackupProcess: // FALLTHROUGH - case MFileManagerProcessObserver::ESchBackupProcess: - { - // Make sure that there is no embedded apps open - delete iDocHandler; - iDocHandler = NULL; - - ClearDriveInfo(); - iRemovableDrvHandler->StartBackupL( aProcess ); - break; - } - case MFileManagerProcessObserver::ERestoreProcess: - { - ClearDriveInfo(); - iRemovableDrvHandler->StartRestoreL(); - break; - } - default: - { - User::Leave( KErrNotSupported ); - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::CancelProcess() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::CancelProcess( - MFileManagerProcessObserver::TFileManagerProcess aProcess ) - { - switch( aProcess ) - { - case MFileManagerProcessObserver::EFormatProcess: - case MFileManagerProcessObserver::EBackupProcess: // FALLTHROUGH - case MFileManagerProcessObserver::ERestoreProcess: // FALLTHROUGH - case MFileManagerProcessObserver::ESchBackupProcess: // FALLTHROUGH - { - iRemovableDrvHandler->CancelProcess(); - break; - } - case MFileManagerProcessObserver::EFileOpenProcess: - { - if ( iDocHandler ) - { - iDocHandler->CancelFileOpen(); - } - break; - } - default: - { - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::GetDriveInfoL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerEngine::GetDriveInfoL( - const TDesC& aPath, - TFileManagerDriveInfo& aInfo ) const - { - if ( !aPath.Length() ) - { - User::Leave( KErrNotFound ); - } - TInt drv( 0 ); - User::LeaveIfError( RFs::CharToDrive( aPath[ 0 ], drv ) ); - GetDriveInfoL( drv, aInfo ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::DriveState() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerEngine::DriveState( - TUint32& aState, const TDesC& aPath ) const - { - TFileManagerDriveInfo info; - TRAPD( err, GetDriveInfoL( aPath, info ) ); - if ( err == KErrNone ) - { - aState = info.iState; - } - else - { - aState = 0; - } - return err; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::DriveState() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerEngine::DriveState( - TUint32& aState, const TInt aDrive ) const - { - TFileManagerDriveInfo info; - TRAPD( err, GetDriveInfoL( aDrive, info ) ); - if ( err == KErrNone ) - { - aState = info.iState; - } - else - { - aState = 0; - } - return err; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::MGXFileManagerL() -// -// ----------------------------------------------------------------------------- -// -/*CMGXFileManager& CFileManagerEngine::MGXFileManagerL() - { - // MG2 notification object - if ( !iMgxFileManager ) - { - INFO_LOG( "CFileManagerEngine::MGXFileManagerL()-Create" ) - iMgxFileManager = MGXFileManagerFactory::NewFileManagerL( iFs ); - } - return *iMgxFileManager; - }*/ - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::Fs() -// -// ----------------------------------------------------------------------------- -// -RFs& CFileManagerEngine::Fs() const - { - return iFs; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::IsRemoteDriveConnected() -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerEngine::IsRemoteDriveConnected( const TInt aDrive ) const - { - return iRemoteDrvHandler->IsConnected( aDrive ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SetRemoteDriveConnection() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerEngine::SetRemoteDriveConnection( - const TInt aDrive, TBool aConnect ) - { - return iRemoteDrvHandler->SetConnection( aDrive, aConnect ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::DeleteRemoteDrive() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerEngine::DeleteRemoteDrive( const TInt aDrive ) - { - return iRemoteDrvHandler->DeleteSettings( aDrive ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::BackupFileExistsL() -// -// ----------------------------------------------------------------------------- -// -#ifndef RD_FILE_MANAGER_BACKUP - -TBool CFileManagerEngine::BackupFileExistsL( const TInt aDrive ) const - { - return iRemovableDrvHandler->BackupFileExistsL( aDrive ); - } - -#endif // RD_FILE_MANAGER_BACKUP - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::OpenFileL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerEngine::OpenFileL( const TDesC& aFullPath ) - { - if ( !iDocHandler ) - { - iDocHandler = CFileManagerDocHandler::NewL( *this, *iUtils ); - } - iDocHandler->OpenFileL( aFullPath, iProcessObserver ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::OpenDirectoryL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerEngine::OpenDirectoryL( const TDesC& aFullPath ) - { - iNavigator->GoToDirectoryL( aFullPath, ETrue ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::DriveRootDirectory() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CFileManagerEngine::DriveRootDirectory( TInt aDrive ) const - { - CGflmDriveItem* drvItem = iNavigator->DriveFromId( aDrive ); - if ( drvItem ) - { - return drvItem->RootDirectory(); - } - return TPtrC( KNullDesC ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::BackupSettingsL() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerBackupSettings& CFileManagerEngine::BackupSettingsL() - { - if ( !iBackupSettings ) - { - INFO_LOG( "CFileManagerEngine::BackupSettingsL()-Create" ) - iBackupSettings = CFileManagerBackupSettings::NewL( *this ); - } - return *iBackupSettings; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::RestoreSettingsL() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerRestoreSettings& CFileManagerEngine::RestoreSettingsL() - { - if ( !iRestoreSettings ) - { - INFO_LOG( "CFileManagerEngine::RestoreSettingsL()-Create" ) - iRestoreSettings = CFileManagerRestoreSettings::NewL( *this ); - } - return *iRestoreSettings; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::GetRestoreInfoArrayL() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::GetRestoreInfoArrayL( - RArray< CFileManagerRestoreSettings::TInfo >& aArray, - const TInt aDrive ) const - { - return iRemovableDrvHandler->GetRestoreInfoArrayL( aArray, aDrive ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::DriveName() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CFileManagerEngine::DriveName( const TInt aDrive ) - { - CGflmDriveItem* drvItem = iNavigator->DriveFromId( aDrive ); - if ( drvItem ) - { -#ifdef RD_MULTIPLE_DRIVE - delete iDriveName; - iDriveName = NULL; - - TRAPD( err, iDriveName = iUtils->GetDriveNameL( - drvItem->Drive(), CFileManagerUtils::ETitleLayout ) ); - if ( err == KErrNone ) - { - return iDriveName->Des(); - } -#else // RD_MULTIPLE_DRIVE - return drvItem->Name(); -#endif // RD_MULTIPLE_DRIVE - } - return TPtrC( KNullDesC ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::GetDriveInfoL() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::GetDriveInfoL( - const TInt aDrive, TFileManagerDriveInfo& aInfo ) const - { - aInfo.GetInfoL( *this, aDrive ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::CurrentDriveAvailable() -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerEngine::CurrentDriveAvailable() - { - TFileManagerDriveInfo info; - TRAPD( err, GetDriveInfoL( info ) ); - if ( err != KErrNone ) - { - return EFalse; - } - - TInt ret( ETrue ); - if ( info.iState & ( - TFileManagerDriveInfo::EDriveCorrupted | - TFileManagerDriveInfo::EDriveLocked ) ) - { - ret = EFalse; - } - else if ( !( info.iState & TFileManagerDriveInfo::EDrivePresent ) ) - { - ret = EFalse; - } - - if ( ( info.iState & TFileManagerDriveInfo::EDriveRemote ) && - !( info.iState & TFileManagerDriveInfo::EDriveConnected ) ) - { - ret = EFalse; - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::ClearDriveInfo() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerEngine::ClearDriveInfo() - { - iCurrentDriveInfoRefreshed = EFalse; - iNavigator->ClearDriveInfo(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::AnyEjectableDrivePresent() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerEngine::AnyEjectableDrivePresent() const - { - RArray< TInt > drives; - iUtils->DriveList( drives, KDriveAttRemovable ); - TInt ret( EFalse ); - TInt count( drives.Count() ); - const TInt KPresentBits( - TFileManagerDriveInfo::EDriveEjectable | - TFileManagerDriveInfo::EDrivePresent ); - for( TInt i( 0 ); i < count; ++i ) - { - TUint32 state( 0 ); - if ( DriveState( state, drives[ i ] ) == KErrNone ) - { - if ( ( state & KPresentBits ) == KPresentBits ) - { - ret = ETrue; - break; - } - } - } - drives.Close(); - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::ForcedRefreshDirectory() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::ForcedRefreshDirectory() - { - TPtrC ptr( iNavigator->CurrentDirectory() ); - if ( ptr.Length() && iUtils->IsRemoteDrive( ptr ) ) - { - // Ensure that remote directory is reloaded - iRemoteDrvHandler->RefreshDirectory( ptr ); - } - RefreshDirectory(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::HasAppRemoteDriveSupport() -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerEngine::HasAppRemoteDriveSupport( TUid aUid ) - { - return iRemoteDrvHandler->HasAppRemoteDriveSupport( aUid ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::GetFileSizesL() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt64 CFileManagerEngine::GetFileSizesL( - const CArrayFixFlat& aIndexList ) - { - FUNC_LOG - - TBool isCanceled( EFalse ); - TInt64 size( 0 ); - TInt count( aIndexList.Count() ); - - for( TInt i( 0 ); i < count; ++i ) - { - CGflmGroupItem* item = iNavigator->Item( aIndexList.At( i ) ); - switch ( item->Type() ) - { - case CGflmGroupItem::EFile: - { - CGflmFileSystemItem* fsItem = - static_cast< CGflmFileSystemItem* >( item ); - size += fsItem->Entry().FileSize(); - break; - } - case CGflmGroupItem::EDirectory: - { - CGflmFileSystemItem* fsItem = - static_cast< CGflmFileSystemItem* >( item ); - HBufC* fullPath = fsItem->FullPathLC(); - - delete iActiveSize; - iActiveSize = NULL; - - iActiveSize = CFileManagerActiveSize::NewL( - iFs, *fullPath ); - - ShowWaitDialogL( *iActiveSize ); - - TInt64 folderSize( iActiveSize->GetFolderSize() ); - if ( folderSize == KErrNotFound ) - { - // Calculation was canceled by the user - isCanceled = ETrue; - } - else - { - size += folderSize; - } - - CleanupStack::PopAndDestroy( fullPath ); - break; - } - default: - { - break; - } - } - - if ( isCanceled ) - { - break; - } - } - - if ( isCanceled ) - { - return KErrNotFound; - } - return size; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::CancelTransfer() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerEngine::CancelTransfer( const TDesC& aFullPath ) - { - if ( iUtils->IsRemoteDrive( aFullPath ) ) - { - iRemoteDrvHandler->CancelTransfer( aFullPath ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::NavigationLevel -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerEngine::NavigationLevel() const - { - return iNavigator->NavigationLevel(); - } - -#ifdef RD_MULTIPLE_DRIVE -// ----------------------------------------------------------------------------- -// CFileManagerEngine::GetFormattedDriveNameLC -// ----------------------------------------------------------------------------- -// -EXPORT_C HBufC* CFileManagerEngine::GetFormattedDriveNameLC( - const TInt aDrive, - const TInt aTextIdForDefaultName, - const TInt aTextIdForName ) const - { - return iUtils->GetFormattedDriveNameLC( - aDrive, aTextIdForDefaultName, aTextIdForName ); - } -#else // RD_MULTIPLE_DRIVE -EXPORT_C HBufC* CFileManagerEngine::GetFormattedDriveNameLC( - const TInt /*aDrive*/, - const TInt /*aTextIdForDefaultName*/, - const TInt /*aTextIdForName*/ ) const - { - User::Leave( KErrNotSupported ); - return NULL; - } -#endif // RD_MULTIPLE_DRIVE - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::GetItemInfoLC -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerItemProperties* CFileManagerEngine::GetItemInfoLC( - const TInt aIndex ) - { - CFileManagerItemProperties* ret = GetItemInfoL( aIndex ); - CleanupStack::PushL( ret ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SetSearchStringL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::SetSearchStringL( const TDesC& aSearchString ) - { - delete iSearchString; - iSearchString = NULL; - iSearchString = aSearchString.AllocL(); - iNavigator->SetSearchStringL( aSearchString ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SetSearchFolderL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::SetSearchFolderL( const TDesC& aSearchFolder ) - { - delete iSearchFolder; - iSearchFolder = NULL; - iSearchFolder = aSearchFolder.AllocL(); - iNavigator->SetSearchFolderL( aSearchFolder ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SetDirectoryWithBackstepsL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::SetDirectoryWithBackstepsL( - const TDesC& aDirectory ) - { - CGflmDriveItem* drvItem = iNavigator->DriveFromPath( aDirectory ); - if ( !drvItem ) - { - return; - } - // Build backsteps - iNavigator->GoToDirectoryL( drvItem->RootDirectory(), aDirectory ); - - // Build navigation indices - iNavigationIndices.Reset(); - iNavigationIndices.AppendL( KErrNotFound ); // Set initial - TInt count( iNavigator->NavigationLevel() ); // Set backsteps - for( TInt i( 0 ); i < count; ++i ) - { - iNavigationIndices.AppendL( KErrNotFound ); - } - iNavigationIndices.AppendL( KErrNotFound ); // Set current - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SetCurrentIndex -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::SetCurrentIndex( const TInt aIndex ) - { - TInt pos( iNavigationIndices.Count() - 1 ); - if ( pos >= 0 ) - { - iNavigationIndices[ pos ] = aIndex; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SetSortMethod -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::SetSortMethod( TSortMethod aSortMethod ) - { - switch ( aSortMethod ) - { - case EByName: // Fallthrough - case EByType: // Fallthrough - case EMostRecentFirst: // Fallthrough - case ELargestFirst: // Fallthrough - case EByMatch: - { - // Make sure that the enums do match - iNavigator->SetSortMethod( - static_cast< TGflmSortMethod >( aSortMethod ) ); - break; - } - default: - { - ERROR_LOG1( - "CFileManagerEngine::SetSortMethod-InvalidMethod=%d", - aSortMethod ) - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SortMethod -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerEngine::TSortMethod CFileManagerEngine::SortMethod() const - { - // Make sure that the enums do match - return static_cast< TSortMethod >( iNavigator->SortMethod() ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::RefreshSort -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::RefreshSort() - { - iRefresher->Refresh( ERefreshSort ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::FeatureManager -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerFeatureManager& CFileManagerEngine::FeatureManager() const - { - return *iFeatureManager; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SetAppExitOb -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::SetAppExitOb( MAknServerAppExitObserver* aObserver ) - { - iObserver = aObserver; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::NoticeServerAppExit -// ----------------------------------------------------------------------------- -// -void CFileManagerEngine::NoticeServerAppExit( TInt aReason ) - { - if ( iObserver && iSisFile ) - { - iUtils->FlushCache(); - iObserver->HandleServerAppExit( aReason ); - iSisFile = EFalse; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::SetSisFile -// ----------------------------------------------------------------------------- -// -void CFileManagerEngine::SetSisFile( TBool aSisFile ) - { - iSisFile = aSisFile; - } - -// --------------------------------------------------------------------------- -// CFileManagerEngine::LatestBackupTimeL() -// --------------------------------------------------------------------------- -// -TInt CFileManagerEngine::LatestBackupTime( TTime& aBackupTime ) - { - TRAPD( err, iRemovableDrvHandler->LatestBackupTimeL( aBackupTime ) ); - return err; - } - -// --------------------------------------------------------------------------- -// CFileManagerEngine::DeleteBackupsL() -// --------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerEngine::DeleteBackupsL() - { - iRemovableDrvHandler->DeleteBackupsL(); - } - -// --------------------------------------------------------------------------- -// CFileManagerEngine::StartDiskEventNotifyTimerAsyncL() -// --------------------------------------------------------------------------- -// -void CFileManagerEngine::StartDiskEventNotifyTimerAsyncL() - { - if ( iDelayedDiskEventNotify == NULL ) - { - iDelayedDiskEventNotify = CPeriodic::NewL( CActive::EPriorityStandard ); - } - if ( !iDelayedDiskEventNotify->IsActive() ) - { - //ignore disk event notification while timer is already active - iDelayedDiskEventNotify->Start( KDiskEventCheckInterval, - KDiskEventCheckInterval, - TCallBack( DriveAddedOrChangeAsyncL, this ) ); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerEngine::StopDiskEventNotifyTimerAsync() -// --------------------------------------------------------------------------- -// -void CFileManagerEngine::StopDiskEventNotifyTimerAsync() - { - if ( iDelayedDiskEventNotify != NULL ) - { - iDelayedDiskEventNotify->Cancel(); - delete iDelayedDiskEventNotify; - iDelayedDiskEventNotify = NULL; - } - } - -// --------------------------------------------------------------------------- -// CFileManagerEngine::IsDriverMounted() -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerEngine::IsDriverMounted( TInt aDrive ) - { - TVolumeInfo volInfo; - return ( KErrNone == iFs.Volume( volInfo, aDrive ) ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerFeatureManager.cpp --- a/filemanager/Engine/src/CFileManagerFeatureManager.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This class manages the runtime variated features -* -*/ - - -#include -#include -#include -#include -#include "CFileManagerFeatureManager.h" -#include "FileManagerDebug.h" -#include "FileManagerPrivateCRKeys.h" - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// CFileManagerFeatureManager::CFileManagerFeatureManager -// ---------------------------------------------------------------------------- -// -CFileManagerFeatureManager::CFileManagerFeatureManager() - { - FUNC_LOG; - } - -// ---------------------------------------------------------------------------- -// CFileManagerFeatureManager::ConstructL -// ---------------------------------------------------------------------------- -// -void CFileManagerFeatureManager::ConstructL() - { - FUNC_LOG; - - // Get the feature manager variations - FeatureManager::InitializeLibL(); - iDrmFullSupported = FeatureManager::FeatureSupported( KFeatureIdDrmFull ); - iHelpSupported = FeatureManager::FeatureSupported( KFeatureIdHelp ); - iIrdaSupported = FeatureManager::FeatureSupported( KFeatureIdIrda ); - iRemoteStorageFwSupported = - FeatureManager::FeatureSupported( KFeatureIdRemoteStorageFw ); - iMmcPassWdSupported = FeatureManager::FeatureSupported( KFeatureIdMmcLock ); - iWesternVariant = !( FeatureManager::FeatureSupported( KFeatureIdChinese ) ); - iMmcSwEjectSupported = - ( FeatureManager::FeatureSupported( KFeatureIdMmcHotswap ) && - FeatureManager::FeatureSupported( KFeatureIdMmcEject ) ); - FeatureManager::UnInitializeLib(); - - iEmbedded = CEikonEnv::Static()->StartedAsServerApp(); - - // Get the local variations - CRepository* cenRep = CRepository::NewLC( KCRUidFileManagerSettings ); - TInt err( cenRep->Get( KFileManagerFeatures, iFileManagerFeatures ) ); - if ( err != KErrNone ) - { - ERROR_LOG1( - "CFileManagerFeatureManager::ConstructL()-LocalVariationError=%d", - err ); - iFileManagerFeatures = 0; - } - INFO_LOG1( - "CFileManagerFeatureManager::ConstructL()-iFileManagerFeatures=0x%x", - iFileManagerFeatures ); - CleanupStack::PopAndDestroy( cenRep ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerFeatureManager::NewL -// ---------------------------------------------------------------------------- -// -CFileManagerFeatureManager* CFileManagerFeatureManager::NewL() - { - FUNC_LOG; - - CFileManagerFeatureManager* self = - new ( ELeave ) CFileManagerFeatureManager(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerFeatureManager::~CFileManagerFeatureManager -// ---------------------------------------------------------------------------- -// -CFileManagerFeatureManager::~CFileManagerFeatureManager() - { - FUNC_LOG; - } - -// ---------------------------------------------------------------------------- -// CFileManagerFeatureManager::IsDrmFullSupported -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerFeatureManager::IsDrmFullSupported() const - { - return iDrmFullSupported; - } - -// ---------------------------------------------------------------------------- -// CFileManagerFeatureManager::IsHelpSupported -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerFeatureManager::IsHelpSupported() const - { - return iHelpSupported; - } - -// ---------------------------------------------------------------------------- -// CFileManagerFeatureManager::IsIrdaSupported -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerFeatureManager::IsIrdaSupported() const - { - return iIrdaSupported; - } - -// ---------------------------------------------------------------------------- -// CFileManagerFeatureManager::IsRemoteStorageFwSupported -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerFeatureManager::IsRemoteStorageFwSupported() const - { - return iRemoteStorageFwSupported; - } - -// ---------------------------------------------------------------------------- -// CFileManagerFeatureManager::IsMmcPassWdSupported -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerFeatureManager::IsMmcPassWdSupported() const - { - return iMmcPassWdSupported; - } - -// ---------------------------------------------------------------------------- -// CFileManagerFeatureManager::IsWesternVariant -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerFeatureManager::IsWesternVariant() const - { - return iWesternVariant; - } -// ---------------------------------------------------------------------------- -// CFileManagerFeatureManager::IsMmcSwEjectSupported -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerFeatureManager::IsMmcSwEjectSupported() const - { - return iMmcSwEjectSupported; - } - -// ---------------------------------------------------------------------------- -// CFileManagerFeatureManager::IsFeatureSupported -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerFeatureManager::IsFeatureSupported( - TInt aFileManagerFeature ) const - { - return ( iFileManagerFeatures & aFileManagerFeature ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerFeatureManager::IsEmbedded -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerFeatureManager::IsEmbedded() const - { - return iEmbedded; - } diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerFileSystemIterator.cpp --- a/filemanager/Engine/src/CFileManagerFileSystemIterator.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,245 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Goes through folder tree one item at time -* -*/ - - - -// INCLUDE FILES -#include "CFileManagerFileSystemIterator.h" -#include "CFileManagerEngine.h" -#include "CFileManagerCommonDefinitions.h" - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerFileSystemIterator::NewL -// -// ----------------------------------------------------------------------------- -// -CFileManagerFileSystemIterator* CFileManagerFileSystemIterator::NewL( - RFs& aFs, - const TDesC& aSrcDir, - const TDesC& aDstDir, - CFileManagerEngine& aEngine ) - { - CFileManagerFileSystemIterator* self = - new (ELeave) CFileManagerFileSystemIterator( aDstDir, aEngine ); - CleanupStack::PushL( self ); - self->ConstructL( aFs, aSrcDir ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileSystemIterator::CFileManagerFileSystemIterator -// -// ----------------------------------------------------------------------------- -// -CFileManagerFileSystemIterator::CFileManagerFileSystemIterator( - const TDesC& aDstDir, CFileManagerEngine& aEngine ) : - iCount( KErrNotFound ), - iDstDir( aDstDir ), - iEngine( aEngine ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileSystemIterator::~CFileManagerFileSystemIterator -// -// ----------------------------------------------------------------------------- -// -CFileManagerFileSystemIterator::~CFileManagerFileSystemIterator() - { - delete iSrcDir; - delete iSrc; - delete iDst; - delete iDir; - delete iDirScan; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileSystemIterator::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileSystemIterator::ConstructL( - RFs& aFs, const TDesC& aSrcDir ) - { - iDirScan = CDirScan::NewL( aFs ); - // Go through the folders first - iDirScan->SetScanDataL( - aSrcDir, - KEntryAttNormal | KEntryAttHidden | KEntryAttSystem | - KEntryAttDir | KEntryAttMatchExclusive, - ESortNone ); - iSrc = HBufC::NewL( KMaxFileName ); - // We need double destination size - // because source and target folder can be - // KMaxFileName sized and those are append - // to same buffer. - iDst = HBufC::NewL( KFmgrDoubleMaxFileName ); - iDst->Des().Copy( iDstDir ); - iDirScan->NextL( iDir ); - iSrcDir = aSrcDir.AllocL(); - iSrc->Des().Copy( aSrcDir ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileSystemIterator::CurrentL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileSystemIterator::CurrentL( - HBufC** aSrc, HBufC** aDst, TFileManagerTypeOfItem& aItemType ) - { - *aSrc = NULL; - *aDst = NULL; - - if( iCount == KErrNotFound ) - { - // Handle destination root folder first - aItemType = EFileManagerFolder; - *aSrc = iSrc; // contains iSrcDir - *aDst = iDst; // contains iDstDir - } - else if( iDir && iCount < iDir->Count() ) - { - // Handle folder contents - if( !iFolderScanDone ) - { - const TEntry& entry( ( *iDir )[ iCount ] ); - - TPtr ptrSrc( iSrc->Des() ); - ptrSrc.Copy( iDirScan->FullPath() ); - ptrSrc.Append( entry.iName ); - ptrSrc.Append( KFmgrBackslash ); - - TPtr ptrDst( iDst->Des() ); - ptrDst.Copy( iDstDir ); - ptrDst.Append( LocalizedAbbreviatedPath() ); - - TPtrC ptr( iEngine.LocalizedName( *iSrc ) ); - if( ptr.Length() ) - { - ptrDst.Append( ptr ); - } - else - { - ptrDst.Append( entry.iName ); - } - ptrDst.Append( KFmgrBackslash ); - - aItemType = EFileManagerFolder; - } - else - { - const TEntry& entry( ( *iDir )[ iCount ] ); - - TPtr ptrSrc( iSrc->Des() ); - ptrSrc.Copy( iDirScan->FullPath() ); - ptrSrc.Append( entry.iName ); - - TPtr ptrDst( iDst->Des() ); - ptrDst.Copy( iDstDir ); - ptrDst.Append( LocalizedAbbreviatedPath() ); - ptrDst.Append( entry.iName ); - - aItemType = EFileManagerFile; - } - *aSrc = iSrc; - *aDst = iDst; - } - else - { - aItemType = EFileManagerNoType; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileSystemIterator::NextL -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerFileSystemIterator::NextL() - { - if ( !iDir ) - { - return EFalse; - } - - ++iCount; - - // Get next dir - if( iCount >= iDir->Count() ) - { - delete iDir; - iDir = NULL; - iCount = 0; - iDirScan->NextL( iDir ); - iLocalizedAbbreviatedPath.Zero(); - } - - // Are we done - if( iDir ) - { - return ETrue; - } - - // Folders have been scanned through, now same scanning with files - if( !iFolderScanDone ) - { - iDirScan->SetScanDataL( *iSrcDir, - KEntryAttNormal | KEntryAttHidden | KEntryAttSystem, - ESortNone ); - iDirScan->NextL( iDir ); - iLocalizedAbbreviatedPath.Zero(); - iCount = 0; - iFolderScanDone = ETrue; - return ETrue; - } - - return EFalse; - } - -// ------------------------------------------------------------------------------ -// CFileManagerFileSystemIterator::LocalizedAbbreviatedPath -// -// ------------------------------------------------------------------------------ -// -TPtrC CFileManagerFileSystemIterator::LocalizedAbbreviatedPath() - { - TPtrC abbrPath( iDirScan->AbbreviatedPath() ); - - if( !iLocalizedAbbreviatedPath.Length() && abbrPath.Length() > 1 ) - { - iLocalizedAbbreviatedPath.Append( - iEngine.LocalizedName( iDirScan->FullPath() ) ); - - if( !iLocalizedAbbreviatedPath.Length() ) - { - iLocalizedAbbreviatedPath.Append( - abbrPath.Right( abbrPath.Length() - 1 ) ); - } - else - { - iLocalizedAbbreviatedPath.Append( KFmgrBackslash ); - } - } - return iLocalizedAbbreviatedPath; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerFolderEntry.cpp --- a/filemanager/Engine/src/CFileManagerFolderEntry.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,175 +0,0 @@ -/* -* Copyright (c) 2002-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: Holds one default folder entry -* -*/ - - - -// INCLUDE FILES -#include "CFileManagerFolderEntry.h" -#include // TResourceReader -#include // BaflUtils::EnsurePathExists -#include // CCoeEnv -#include "CFileManagerUtils.h" -#include "CFileManagerCommonDefinitions.h" - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerFolderEntry::NewLC -// -// ----------------------------------------------------------------------------- -// -CFileManagerFolderEntry* CFileManagerFolderEntry::NewLC( - TResourceReader& aReader ) - { - CFileManagerFolderEntry* self = new( ELeave ) CFileManagerFolderEntry; - CleanupStack::PushL( self ); - self->ConstructFromResourceL( aReader ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderEntry::NewL -// -// ----------------------------------------------------------------------------- -// -CFileManagerFolderEntry* CFileManagerFolderEntry::NewL( - TResourceReader& aReader ) - { - CFileManagerFolderEntry* self = CFileManagerFolderEntry::NewLC( aReader ); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderEntry::NewLC -// -// ----------------------------------------------------------------------------- -// -CFileManagerFolderEntry* CFileManagerFolderEntry::NewLC( - const TInt aDrive, const TDesC& aPath ) - { - CFileManagerFolderEntry* self = new( ELeave ) CFileManagerFolderEntry; - CleanupStack::PushL( self ); - self->ConstructL( aDrive, aPath ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderEntry::CFileManagerFolderEntry -// -// ----------------------------------------------------------------------------- -// -CFileManagerFolderEntry::CFileManagerFolderEntry() - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderEntry::~CFileManagerFolderEntry -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerFolderEntry::~CFileManagerFolderEntry() - { - delete iName; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderEntry::ConstructFromResourceL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFolderEntry::ConstructFromResourceL( TResourceReader& aReader ) - { - const TPtrC root( aReader.ReadTPtrC() ); - const TPtrC path( aReader.ReadTPtrC() ); - - iIsMediaFolder = aReader.ReadInt8(); - iName = HBufC::NewL( - root.Length() + - path.Length() + - KFmgrBackslashSpace + - KFmgrBackslashSpace ); - - TPtr ptr( iName->Des() ); - ptr.Copy( root ); - CFileManagerUtils::EnsureFinalBackslash( ptr ); - ptr.Append( path ); - CFileManagerUtils::EnsureFinalBackslash( ptr ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderEntry::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFolderEntry::ConstructL( - const TInt aDrive, const TDesC& aPath ) - { - TChar driveLetter; - - User::LeaveIfError( RFs::DriveToChar( aDrive, driveLetter ) ); - iName = aPath.AllocL(); - iName->Des()[ 0 ] = driveLetter; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderEntry::IsMediaFolder -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerFolderEntry::IsMediaFolder() const - { - return iIsMediaFolder; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderEntry::Name -// -// ----------------------------------------------------------------------------- -// -TPtrC CFileManagerFolderEntry::Name() const - { - return iName->Des(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderEntry::CompareSort -// ----------------------------------------------------------------------------- -// -TInt CFileManagerFolderEntry::CompareSort( - const CFileManagerFolderEntry& aFirst, - const CFileManagerFolderEntry& aSecond ) - { - return aFirst.iName->Des().CompareF( *( aSecond.iName ) ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderEntry::CompareFind -// ----------------------------------------------------------------------------- -// -TInt CFileManagerFolderEntry::CompareFind( - const TDesC* aPath, - const CFileManagerFolderEntry& aItem ) - { - return aPath->CompareF( *( aItem.iName ) ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerIRReceiver.cpp --- a/filemanager/Engine/src/CFileManagerIRReceiver.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,604 +0,0 @@ -/* -* Copyright (c) 2002-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: Receives obex object via InfraRed, used to receive files -* -*/ - - -// INCLUDE FILES -#include -#include "CFileManagerIRReceiver.h" -#include "MFileManagerProcessObserver.h" -#include "CFileManagerEngine.h" -#include "CFileManagerUtils.h" -#include "CFileManagerCommonDefinitions.h" -#include "FileManagerDebug.h" - - -// CONSTANTS -const TUint KDefaultObexPort = 65; -const TUint KBufferGranularity = 2048; -const TInt KFullPercentage = 100; -const TInt KInactiveTimeout = 60000000; - -// Required for IR -_LIT( KTransportTinyTp, "IrTinyTP" ); -_LIT8( KClassNameObex, "OBEX" ); -_LIT8( KAttName, "IrDA:TinyTP:LsapSel" ); -_LIT( KTemporaryFile, "__FileManagerIrdaReceive.tmp" ); - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::CFileManagerEngine -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerIRReceiver::CFileManagerIRReceiver( - MFileManagerProcessObserver& aObserver, - CFileManagerEngine& aEngine, - RFs& aFs ) : - iObserver( aObserver ), - iEngine( aEngine ), - iFs( aFs ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerIRReceiver* CFileManagerIRReceiver::NewL( - MFileManagerProcessObserver& aObserver, - const TDesC& aPath, - CFileManagerEngine& aEngine ) - { - FUNC_LOG - - CFileManagerIRReceiver* self = new( ELeave ) CFileManagerIRReceiver( - aObserver, - aEngine, - aEngine.Fs() ); - - CleanupStack::PushL( self ); - self->ConstructL( aPath ); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerIRReceiver::ConstructL( const TDesC& aPath ) - { - TPtrC ptrPath( CFileManagerUtils::StripFinalBackslash( aPath ) ); - TInt len( ptrPath.Length() + - KFmgrBackslashSpace + KTemporaryFile().Length() ); - if ( len > KMaxFileName ) - { - User::Leave( KErrBadName ); - } - iTempFile = HBufC::NewL( len ); - TPtr ptr( iTempFile->Des() ); - ptr.Append( ptrPath ); - CFileManagerUtils::EnsureFinalBackslash( ptr ); - ptr.Append( KTemporaryFile ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::ReceiveFileL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerIRReceiver::ReceiveFileL() - { - FUNC_LOG - - ResetInactivityTimer(); - - TObexIrProtocolInfo obexIrInfo; - obexIrInfo.iAddr.SetPort( KDefaultObexPort ); - obexIrInfo.iTransport = KTransportTinyTp; - obexIrInfo.iClassName = KClassNameObex; - obexIrInfo.iAttributeName = KAttName; - - iObexServer = CObexServer::NewL( obexIrInfo ); - - User::LeaveIfError( iObexServer->Start( this ) ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::~CFileManagerIRReceiver -// Destructor -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerIRReceiver::~CFileManagerIRReceiver() - { - FUNC_LOG - - if ( iObexServer ) - { - if ( iObexServer->IsStarted() ) - { - iObexServer->Stop(); - } - delete iObexServer; - } - delete iObexBufObject; - - if ( iTempFile ) - { - iFs.Delete( *iTempFile ); - delete iTempFile; - } - delete iBuffer; - delete iInactivityTimer; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::StopReceiving -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerIRReceiver::StopReceiving() - { - FUNC_LOG - - iError = KErrCancel; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::ErrorIndication -// -// ----------------------------------------------------------------------------- -// -void CFileManagerIRReceiver::ErrorIndication(TInt aError ) - { - ERROR_LOG1( "CFileManagerIRReceiver::ErrorIndication-aError=%d", aError ) - - if ( iError == KErrNone ) - { - iError = aError; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::TransportUpIndication -// -// ----------------------------------------------------------------------------- -// -void CFileManagerIRReceiver::TransportUpIndication() - { - FUNC_LOG - - StopInactivityTimer(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::TransportDownIndication -// -// ----------------------------------------------------------------------------- -// -void CFileManagerIRReceiver::TransportDownIndication() - { - FUNC_LOG - - TInt err( KErrNone ); - if ( iObexBufObject ) - { - // transfer has been cancelled, set temp buffer so obexobject won't - // create temp file again - delete iBuffer; - iBuffer = NULL; - TRAP( err, iBuffer = CBufFlat::NewL( KBufferGranularity ) ); - if ( err == KErrNone ) - { - TRAP( err, iObexBufObject->SetDataBufL( iBuffer ) ); - } - } - - if ( iTempFile ) - { - iFs.Delete( *iTempFile ); - } - - TRAP( err, iObserver.ProcessFinishedL( iError ) ); - if ( err != KErrNone ) - { - iObserver.Error( err ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::TargetHeaderReceived -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerIRReceiver::TargetHeaderReceived(TDesC8& /* aTargetHeader */ ) - { - FUNC_LOG - - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::ObexConnectIndication -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerIRReceiver::ObexConnectIndication - ( const TObexConnectInfo& /* aRemoteInfo */, - const TDesC8& /* aInfo */ ) - { - FUNC_LOG - - if ( iError == KErrCancel ) - { - return KErrCancel; - } - - TRAPD( err, iObserver.ProcessStartedL( - MFileManagerProcessObserver::EIRReceiveProcess ) ); - - return err; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::ObexDisconnectIndication -// -// ----------------------------------------------------------------------------- -// -void CFileManagerIRReceiver::ObexDisconnectIndication(const TDesC8& /* aInfo */ ) - { - FUNC_LOG - // from MObexServerNotify - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::PutRequestIndication -// -// ----------------------------------------------------------------------------- -// -CObexBufObject* CFileManagerIRReceiver::PutRequestIndication() - { - FUNC_LOG - - // delete old buffer if it exists - delete iObexBufObject; - iObexBufObject = NULL; - iFs.Delete( *iTempFile ); - - TRAPD( err, iObexBufObject = CObexBufObject::NewL( NULL ) ); - if ( err == KErrNone ) - { - TRAP( err, iObexBufObject->SetDataBufL( *iTempFile ) ); - } - - if ( err != KErrNone ) - { - return NULL; - } - - return iObexBufObject; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::PutPacketIndication -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerIRReceiver::PutPacketIndication() - { - FUNC_LOG - - if ( iError == KErrCancel ) - { - return KErrCancel; - } - - const TInt size( iObexBufObject->Length() ); - - if ( !iDiskSpaceChecked ) - { - TParsePtrC parse( *iTempFile ); - TRAP( iError, iEnoughSpace = iEngine.EnoughSpaceL( - parse.DriveAndPath(), size, - MFileManagerProcessObserver::EIRReceiveProcess ) ); - iDiskSpaceChecked = ETrue; - } - - if ( iError == KErrNone && iEnoughSpace ) - { - const TInt received( iObexBufObject->BytesReceived()); - TInt percent( 0 ); - if ( size != 0) - { - percent = KFullPercentage * received / size; - } - TRAPD( error, iObserver.ProcessAdvanceL( percent ) ); - if ( iError == KErrNone ) - { - iError = error; - } - } - else if ( !iEnoughSpace ) - { - if ( iError == KErrNone ) - { - iError = KErrDiskFull; - } - } - - return iError; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::PutCompleteIndication -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerIRReceiver::PutCompleteIndication() - { - FUNC_LOG - - if ( iError == KErrCancel ) - { - iFs.Delete( *iTempFile ); - iDiskSpaceChecked = EFalse; - return KErrNone; - } - - TInt error( KErrNone ); - TFileName fileName; - TParsePtrC parse( *iTempFile ); - fileName.Append( parse.DriveAndPath() ); - TPtrC objName( iObexBufObject->Name() ); - - if ( fileName.Length() + objName.Length() > KMaxFileName ) - { - iFs.Delete( *iTempFile ); - iDiskSpaceChecked = EFalse; - iObserver.Error( KErrBadName ); - return KErrBadName; - } - - fileName.Append( objName ); - delete iObexBufObject; - iObexBufObject = NULL; - TBool nameFound( EFalse ); - TRAP( error, nameFound = iEngine.IsNameFoundL( fileName ) ); - if ( error == KErrNone && nameFound ) - { - TFileName name; - TBool overWrite( ETrue ); - TRAP( error, overWrite = iObserver.ProcessQueryOverWriteL( - fileName, name, - MFileManagerProcessObserver::EIRReceiveProcess ) ); - - if ( error == KErrNone ) - { - if ( overWrite ) - { - error = iFs.Delete( fileName ); - if ( error == KErrNone ) - { - iFs.Rename( *iTempFile, fileName ); - } - if ( error != KErrNone ) - { - iObserver.Error( error ); - } - } - else - { - TBool askAgain( ETrue ); - TRAP( error, nameFound = iEngine.IsNameFoundL( name ) ); - while( error == KErrNone && nameFound && askAgain ) - { - TFileName newName; - TRAP( error, overWrite = - iObserver.ProcessQueryOverWriteL( - name, - newName, - MFileManagerProcessObserver::EIRReceiveProcess - ) ); - if ( error != KErrNone ) - { - iError = error; - askAgain = EFalse; - name.Zero(); - } - else if ( !overWrite ) - { - name.Zero(); - name.Append( newName ); - } - else - { - askAgain = EFalse; - } - } - if ( name.Length() > 0 ) - { - TParsePtrC parse( *iTempFile ); - name.Insert( 0, parse.DriveAndPath() ); - iFs.Rename( *iTempFile, name ); - } - } - } - else - { - iError = error; - } - } - else - { - - iFs.Rename( *iTempFile, fileName ); - } - iFs.Delete( *iTempFile ); - iDiskSpaceChecked = EFalse; - - return error; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::GetRequestIndication -// Empty because needed only for send functionality -// ----------------------------------------------------------------------------- -// -CObexBufObject* CFileManagerIRReceiver::GetRequestIndication - (CObexBaseObject* /* aRequiredObject */) - { - FUNC_LOG - - return NULL; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::GetPacketIndication -// Empty because needed only for send functionality -// ----------------------------------------------------------------------------- -// -TInt CFileManagerIRReceiver::GetPacketIndication() - { - FUNC_LOG - - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::GetCompleteIndication -// Empty because needed only for send functionality -// ----------------------------------------------------------------------------- -// -TInt CFileManagerIRReceiver::GetCompleteIndication() - { - FUNC_LOG - - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::SetPathIndication -// Empty because setpath not supported -// ----------------------------------------------------------------------------- -// -TInt CFileManagerIRReceiver::SetPathIndication( - const CObex::TSetPathInfo& /* aPathInfo*/ , const TDesC8& /* aInfo */) - { - FUNC_LOG - - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::AbortIndication -// Empty because needed only for send functionality -// ----------------------------------------------------------------------------- -// -void CFileManagerIRReceiver::AbortIndication() - { - FUNC_LOG - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::ResetInactivityTimer -// -// ----------------------------------------------------------------------------- -// -void CFileManagerIRReceiver::ResetInactivityTimer() - { - FUNC_LOG - - StopInactivityTimer(); - - TRAPD( err, iInactivityTimer = - CPeriodic::NewL( CActive::EPriorityStandard ) ); - if ( err == KErrNone ) - { - iInactivityTimer->Start( - KInactiveTimeout, - KInactiveTimeout, - TCallBack( InactivityTimeout, this ) ); - - INFO_LOG( "CFileManagerIRReceiver::ResetInactivityTimer-Timer started" ) - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::InactivityTimeout -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerIRReceiver::InactivityTimeout( TAny* aPtr ) - { - FUNC_LOG - - CFileManagerIRReceiver* self = - static_cast< CFileManagerIRReceiver* >( aPtr ); - - self->StopInactivityTimer(); - self->CloseConnection(); - - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::StopInactivityTimer -// -// ----------------------------------------------------------------------------- -// -void CFileManagerIRReceiver::StopInactivityTimer() - { - FUNC_LOG - - delete iInactivityTimer; - iInactivityTimer = NULL; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIRReceiver::CloseConnection -// -// ----------------------------------------------------------------------------- -// -void CFileManagerIRReceiver::CloseConnection() - { - FUNC_LOG - - StopReceiving(); - - if ( iObexServer ) - { - if ( iObexServer->IsStarted() ) - { - INFO_LOG( "CFileManagerIRReceiver::CloseConnection-Stop server" ) - - iObexServer->Stop(); - } - } - - TRAPD( err, iObserver.ProcessFinishedL( KErrCancel ) ); - if ( err != KErrNone ) - { - iObserver.Error( err ); - } - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerItemFilter.cpp --- a/filemanager/Engine/src/CFileManagerItemFilter.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,292 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Filter GFLM items -* -*/ - - - -// INCLUDE FILES -#include "CFileManagerItemFilter.h" -#include "CFileManagerEngine.h" -#include "CGflmGroupItem.h" -#include "CGflmFileSystemItem.h" -#include "CGflmDriveItem.h" -#include "CGflmGlobalActionItem.h" -#include "CFileManagerCommonDefinitions.h" -#include "FileManagerDebug.h" -#include "TFileManagerDriveInfo.h" -#include "CFileManagerFeatureManager.h" -#include -#include -#include -#ifdef RD_MULTIPLE_DRIVE -#include -#endif // RD_MULTIPLE_DRIVE - - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// CFileManagerItemFilter::CFileManagerItemFilter -// ---------------------------------------------------------------------------- -// -CFileManagerItemFilter::CFileManagerItemFilter( CFileManagerEngine& aEngine ) - : iEngine( aEngine ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerItemFilter::ConstructL -// ---------------------------------------------------------------------------- -// -void CFileManagerItemFilter::ConstructL() - { - // Phone memory root path - iPhoneMemoryRootPath = PathInfo::PhoneMemoryRootPath().AllocL(); - iInternalDefaultName = - StringLoader::LoadL( R_TEXT_PHONE_MEMORY ); - iRemovableDefaultName = - StringLoader::LoadL( R_TEXT_MEMORY_CARD_DEFAULT ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerItemFilter::NewL -// ---------------------------------------------------------------------------- -// -CFileManagerItemFilter* CFileManagerItemFilter::NewL( - CFileManagerEngine& aEngine ) - { - CFileManagerItemFilter* self = new( ELeave ) CFileManagerItemFilter( - aEngine ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerItemFilter::~CFileManagerItemFilter -// ---------------------------------------------------------------------------- -// -CFileManagerItemFilter::~CFileManagerItemFilter() - { - delete iPhoneMemoryRootPath; - delete iInternalDefaultName; - delete iRemovableDefaultName; - } - -// ---------------------------------------------------------------------------- -// CFileManagerItemFilter::FilterItemL -// ---------------------------------------------------------------------------- -// -TBool CFileManagerItemFilter::FilterItemL( - CGflmGroupItem* aItem, - TInt /*aGroupId*/, - CGflmDriveItem* /*aDrive*/ ) - { - switch( aItem->Type() ) - { - case CGflmGroupItem::EGlobalActionItem: - { - CGflmGlobalActionItem* actItem = - static_cast< CGflmGlobalActionItem* >( aItem ); - switch( actItem->Id() ) - { - case EFileManagerBackupAction: - { - // Disable backup in embedded mode, because it messes up - // backup and restore operations since embedded apps are closed. - if ( iEngine.FeatureManager().IsEmbedded() ) - { - return EFalse; - } - actItem->SetIconId( EFileManagerBackupMainIcon ); - break; - } - default: - { - break; - } - } - break; - } - case CGflmGroupItem::EDirectory: - { - CGflmFileSystemItem* fsItem = - static_cast< CGflmFileSystemItem* >( aItem ); - fsItem->GetFullPath( iFileNameBuffer ); - return !iEngine.IsSystemFolder( iFileNameBuffer ); - } - case CGflmGroupItem::EDrive: - { - CGflmDriveItem* drvItem = static_cast< CGflmDriveItem* >( aItem ); - -#ifndef RD_MULTIPLE_DRIVE - const TVolumeInfo& vol( drvItem->VolumeInfo() ); - TInt drive( drvItem->Drive() ); -#endif // RD_MULTIPLE_DRIVE - - INFO_LOG1( "CFileManagerItemFilter::FilterItemL()-drive=%d", - drvItem->Drive() ) - - INFO_LOG1( "CFileManagerItemFilter::FilterItemL()-driveAtt=%d", - drvItem->VolumeInfo().iDrive.iDriveAtt ) - - INFO_LOG1( "CFileManagerItemFilter::FilterItemL()-mediaAtt=%d", - drvItem->VolumeInfo().iDrive.iMediaAtt ) - - INFO_LOG1( "CFileManagerItemFilter::FilterItemL()-driveUniqueId=%u", - drvItem->VolumeInfo().iUniqueID ) - - INFO_LOG1( "CFileManagerItemFilter::FilterItemL()-driveSize=%lu", - drvItem->VolumeInfo().iSize ) - - INFO_LOG1( "CFileManagerItemFilter::FilterItemL()-VolumeStatus=%d", - drvItem->VolumeStatus() ) - - INFO_LOG1( "CFileManagerItemFilter::FilterItemL()-DriveStatus=%d", - drvItem->DriveStatus() ) - -#ifdef RD_MULTIPLE_DRIVE - // Setup drive icon - TUint driveStatus( drvItem->DriveStatus() ); - if ( !( driveStatus & DriveInfo::EDriveUserVisible ) ) - { - ERROR_LOG( "CFileManagerItemFilter::FilterItemL()-Hidden-1" ) - return EFalse; - } - TInt icon( 0 ); - if ( driveStatus & DriveInfo::EDriveInternal ) - { - icon = EFileManagerPhoneMemoryMainIcon; - if ( driveStatus & DriveInfo::EDriveExternallyMountable ) - { - icon = EFileManagerMassStorageMainIcon; - } - } - else if ( driveStatus & DriveInfo::EDriveUsbMemory ) - { - icon = EFileManagerUsbMemoryMainIcon; - } - else if ( driveStatus & DriveInfo::EDriveRemovable ) - { - icon = EFileManagerMemoryCardNotPresentMainIcon; - if ( driveStatus & DriveInfo::EDrivePresent ) - { - icon = EFileManagerMemoryCardPresentMainIcon; - } - } - else if ( driveStatus & DriveInfo::EDriveRemote ) - { - icon = EFileManagerRemoteDriveMainIcon; - } - else - { - ERROR_LOG( "CFileManagerItemFilter::FilterItemL()-Hidden-2" ) - return EFalse; - } - drvItem->SetIconId( icon ); - // Setup root directory - if ( PathInfo::GetRootPath( iFileNameBuffer, drvItem->Drive() ) != KErrNone ) - { - ERROR_LOG( "CFileManagerItemFilter::FilterItemL()-Hidden-3" ) - return EFalse; - } - drvItem->SetRootDirectoryL( iFileNameBuffer ); - INFO_LOG( "CFileManagerItemFilter::FilterItemL()-Visible" ) - -#else // RD_MULTIPLE_DRIVE - - TBool isPhoneMem( EFalse ); - TPtrC root( drvItem->RootDirectory() ); - TPtrC phoneMemRoot( *iPhoneMemoryRootPath ); - TInt len( Min( root.Length(), phoneMemRoot.Length() ) ); - if ( !root.CompareF( phoneMemRoot.Left( len ) ) ) - { - // Drive is defined to phone memory - isPhoneMem = ETrue; - drvItem->SetRootDirectoryL( *iPhoneMemoryRootPath ); - } - else if ( vol.iDrive.iDriveAtt & KDriveAttInternal ) - { - if ( drive == KFmgrRamDrive || drive == KFmgrRomDrive ) - { - // Drive is not allowed internal drive - return EFalse; - } - } - if ( vol.iDrive.iDriveAtt & KDriveAttSubsted ) - { - // Substed drives are not allowed - return EFalse; - } - // Setup drive name - if ( !drvItem->Name().Length() ) - { - if ( isPhoneMem ) - { - drvItem->SetLocalizedNameL( *iInternalDefaultName ); - } - else if ( ( vol.iDrive.iDriveAtt & KDriveAttRemovable ) || - drive == KFmgrMemoryCardDrive ) - { - drvItem->SetLocalizedNameL( *iRemovableDefaultName ); - } - else - { - drvItem->SetLocalizedNameL( drvItem->RootDirectory() ); - } - } - // Setup drive icon - if ( isPhoneMem ) - { - drvItem->SetIconId( EFileManagerPhoneMemoryMainIcon ); - } - else if ( ( vol.iDrive.iDriveAtt & KDriveAttRemovable ) || - drive == KFmgrMemoryCardDrive ) - { - if ( vol.iDrive.iType == EMediaNotPresent ) - { - drvItem->SetIconId( EFileManagerMemoryCardNotPresentMainIcon ); - } - else - { - drvItem->SetIconId( EFileManagerMemoryCardPresentMainIcon ); - } - } - else if ( vol.iDrive.iDriveAtt & KDriveAttRemote ) - { - drvItem->SetIconId( EFileManagerRemoteDriveMainIcon ); - } - else - { - return EFalse; - } - INFO_LOG( "CFileManagerItemFilter::FilterItemL()-driveAllowed" ) - -#endif // RD_MULTIPLE_DRIVE - break; - } - default: - { - break; - } - } - return ETrue; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerItemProperties.cpp --- a/filemanager/Engine/src/CFileManagerItemProperties.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,606 +0,0 @@ -/* -* Copyright (c) 2002-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: Holds item information -* -*/ - - -// INCLUDES -#include -#include -#include -#include "CFileManagerItemProperties.h" -#include "CFileManagerUtils.h" -#include "CFilemanagerMimeIconArray.h" -#include "Cfilemanagerfolderarray.h" -#include "Cfilemanageractivesize.h" -#include "CFilemanagerActiveCount.h" -#include "CFileManagerEngine.h" -#include "CGflmGroupItem.h" -#include "CGflmFileSystemItem.h" -#include "CGflmDriveItem.h" -#include "CGflmGlobalActionItem.h" - - -// ============================ MEMBER FUNCTIONS =============================== -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::CFileManagerItemProperties -// -// ----------------------------------------------------------------------------- -// -CFileManagerItemProperties::CFileManagerItemProperties( - CFileManagerUtils& aUtils, - CFileManagerEngine& aEngine ) : - iSize( KErrNotFound ), - iFilesContained( KErrNotFound ), - iFoldersContained( KErrNotFound ), - iOpenFiles( KErrNotFound ), - iUtils( aUtils ), - iEngine( aEngine ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::NewL -// -// ----------------------------------------------------------------------------- -// -CFileManagerItemProperties* CFileManagerItemProperties::NewL( - const TDesC& aFullPath, - CFileManagerUtils& aUtils, - CFileManagerEngine& aEngine ) - { - CFileManagerItemProperties* self = - new (ELeave) CFileManagerItemProperties( aUtils, aEngine ); - CleanupStack::PushL( self ); - self->ConstructL( aFullPath ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::NewL -// -// ----------------------------------------------------------------------------- -// -CFileManagerItemProperties* CFileManagerItemProperties::NewL( - const CGflmGroupItem& aItem, - CFileManagerUtils& aUtils, - CFileManagerEngine& aEngine ) - { - CFileManagerItemProperties* self = - new (ELeave) CFileManagerItemProperties( aUtils, aEngine ); - CleanupStack::PushL( self ); - self->ConstructL( aItem ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerItemProperties::ConstructL( const TDesC& aFullPath ) - { - iFullPath = aFullPath.AllocL(); - - // Setup the rest of entry data when needed first time - if ( CFileManagerUtils::HasFinalBackslash( aFullPath ) ) - { - iState |= EItemDirectory; - } - else - { - iState |= EItemFile; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerItemProperties::ConstructL( - const TDesC& aFullPath, const TEntry& aEntry ) - { - iFullPath = aFullPath.AllocL(); - - // Setup all entry data now - SetEntryData( aEntry ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerItemProperties::ConstructL( const CGflmGroupItem& aItem ) - { - switch ( aItem.Type() ) - { - case CGflmGroupItem::EFile: - case CGflmGroupItem::EDirectory: - { - const CGflmFileSystemItem& fsItem = - static_cast< const CGflmFileSystemItem& >( aItem ); - HBufC* fullPath = fsItem.FullPathLC(); - ConstructL( *fullPath, fsItem.Entry() ); - if ( iUtils.IsRemoteDrive( *fullPath ) ) - { - iState |= EItemRemoteDrive; - } - CleanupStack::PopAndDestroy( fullPath ); - break; - } - case CGflmGroupItem::EDrive: - { - const CGflmDriveItem& drvItem = - static_cast< const CGflmDriveItem& >( aItem ); - iFullPath = drvItem.RootDirectory().AllocL(); -#ifdef RD_MULTIPLE_DRIVE - iName = iUtils.GetDriveNameL( - drvItem.Drive(), - CFileManagerUtils::EMainLayout ); -#else // RD_MULTIPLE_DRIVE - iName = drvItem.Name().AllocL(); -#endif // RD_MULTIPLE_DRIVE - iState |= EItemDrive; - if ( iUtils.IsRemoteDrive( *iFullPath ) ) - { - iState |= EItemRemoteDrive; - } - break; - } - case CGflmGroupItem::EGlobalActionItem: - { - const CGflmGlobalActionItem& actItem = - static_cast< const CGflmGlobalActionItem& >( aItem ); - if ( actItem.Id() == EFileManagerBackupAction ) - { - // Ignore error - iEngine.LatestBackupTime( iModified ); - } - iName = aItem.Name().AllocL(); - // Action items do not have entry data, so mark it as fetched - iState |= EItemAction | EItemEntryDataFetched; - break; - } - default: - { - User::Leave( KErrNotFound ); - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::~CFileManagerItemProperties -// -// ----------------------------------------------------------------------------- -// -CFileManagerItemProperties::~CFileManagerItemProperties() - { - delete iFullPath; - delete iActiveSize; - delete iActiveCount; - delete iName; - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::Name() const -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CFileManagerItemProperties::Name() const - { - if ( iState & EItemNotFileOrDir ) - { - return iName->Des(); - } - TParsePtrC parse( CFileManagerUtils::StripFinalBackslash( *iFullPath ) ); - return parse.Name(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::ModifiedDate() const -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TTime CFileManagerItemProperties::ModifiedDate() const - { - EnsureEntryDataFetched(); - return iModified; - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::SizeL() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt64 CFileManagerItemProperties::SizeL() - { - if ( iState & EItemNotFileOrDir ) - { - return 0; - } - if( iSize == KErrNotFound ) - { - if ( iState & EItemFile ) - { - EnsureEntryDataFetched(); - } - else - { - iSize = FolderSizeL( *iFullPath ); - } - } - return iSize; - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::FilesContainedL() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerItemProperties::FilesContainedL() - { - if( iFilesContained == KErrNotFound ) - { - CountItemsL( CFileManagerItemProperties::EFile ); - } - return iFilesContained; - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::FoldersContainedL() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerItemProperties::FoldersContainedL() - { - if( iFoldersContained == KErrNotFound ) - { - CountItemsL( CFileManagerItemProperties::EFolder ); - } - return iFoldersContained; - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::OpenFilesL() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerItemProperties::OpenFilesL() - { - if( iOpenFiles == KErrNotFound ) - { - CountItemsL( CFileManagerItemProperties::EOpen ); - } - return iOpenFiles; - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::TypeL() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TUint32 CFileManagerItemProperties::TypeL() - { - if( iType == CFileManagerItemProperties::ENotDefined ) - { - iType = iUtils.FileTypeL( *iFullPath ); - } - return iType; - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::Ext() const -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CFileManagerItemProperties::Ext() const - { - if ( iState & EItemNotFileOrDir ) - { - return TPtrC( KNullDesC ); - } - TParsePtrC parse( *iFullPath ); - TPtrC ext( parse.Ext() ); - return ext; - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::CountItemsL -// ----------------------------------------------------------------------------- -// -TInt CFileManagerItemProperties::CountItemsL( - const TFileManagerFileType& aType ) - { - if ( !( iState & ( EItemDirectory | EItemDrive ) ) ) - { - // It's not a folder - return KErrNotFound; - } - - delete iActiveCount; - iActiveCount = NULL; - - iActiveCount = CFileManagerActiveCount::NewL( - iEngine.Fs(), *iFullPath, aType ); - - if ( !iActiveCount->IsProcessDone() ) - { - iEngine.ShowWaitDialogL( *iActiveCount ); - } - - if ( iFilesContained == KErrNotFound ) - { - iFilesContained = iActiveCount->FileCount(); - } - - if ( iFoldersContained == KErrNotFound ) - { - iFoldersContained = iActiveCount->FolderCount(); - } - - if ( iOpenFiles == KErrNotFound ) - { - iOpenFiles = iActiveCount->OpenFiles(); - } - - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::FolderSizeL -// ----------------------------------------------------------------------------- -// -TInt64 CFileManagerItemProperties::FolderSizeL( const TDesC& aFullPath ) - { - if ( !( iState & EItemDirectory ) ) - { - // It's not a folder - return KErrNotFound; - } - - delete iActiveSize; - iActiveSize = NULL; - iActiveSize = CFileManagerActiveSize::NewL( iEngine.Fs(), aFullPath ); - iEngine.ShowWaitDialogL( *iActiveSize ); - if ( !iActiveSize->IsProcessDone() ) - { - User::Leave( KErrCancel ); - } - return iActiveSize->GetFolderSize(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::FullPath() const -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CFileManagerItemProperties::FullPath() const - { - if ( iFullPath ) - { - return iFullPath->Des(); - } - return TPtrC( KNullDesC ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::NameAndExt() const -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CFileManagerItemProperties::NameAndExt() const - { - if ( iState & EItemNotFileOrDir ) - { - return iName->Des(); - } - TParsePtrC parse( CFileManagerUtils::StripFinalBackslash( *iFullPath ) ); - return parse.NameAndExt(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::LocalizedName() const -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CFileManagerItemProperties::LocalizedName() const - { - if (iState & EItemDirectory ) - { - TPtrC ptr( iUtils.LocalizedName( *iFullPath ) ); - if ( ptr.Length() ) - { - return ptr; - } - } - return NameAndExt(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::ModifiedLocalDate() const -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerItemProperties::ModifiedLocalDate( - TTime& aTime ) const - { - aTime = ModifiedDate(); // convert from universal time - RTz tz; - TInt err( tz.Connect() ); - if ( err == KErrNone ) - { - err = tz.ConvertToLocalTime( aTime ); - if ( err != KErrNone ) - { - aTime = ModifiedDate(); // use universal time - } - tz.Close(); - } - return err; - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::ContainsAnyFilesOrFolders() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerItemProperties::ContainsAnyFilesOrFolders() - { - if ( !( iState & EItemDirectory ) || - ( iState & EItemHasNoFilesOrFolders ) ) - { - return EFalse; - } - if ( iState & EItemHasFilesOrFolders ) - { - return ETrue; - } - TBool ret( CFileManagerUtils::HasAny( - iEngine.Fs(), - *iFullPath, - KEntryAttNormal | KEntryAttDir | KEntryAttHidden | KEntryAttSystem ) ); - if ( ret ) - { - iState |= EItemHasFilesOrFolders; - } - else - { - iState |= EItemHasNoFilesOrFolders; - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::MimeTypeL() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CFileManagerItemProperties::MimeTypeL() - { - if ( iState & EItemNotFileOrDir ) - { - return TPtrC( KNullDesC ); - } - return iUtils.MimeTypeL( *iFullPath ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::IsDrive() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerItemProperties::IsDrive() const - { - if ( iState & EItemDrive ) - { - return ETrue; - } - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::DriveName() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CFileManagerItemProperties::DriveName() const - { - if ( iState & EItemDrive ) - { - return Name(); - } - return iEngine.CurrentDriveName(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::IsRemoteDrive() -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerItemProperties::IsRemoteDrive() const - { - if ( iState & EItemRemoteDrive ) - { - return ETrue; - } - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::EnsureEntryDataFetched -// -// ----------------------------------------------------------------------------- -// -void CFileManagerItemProperties::EnsureEntryDataFetched() const - { - if ( iState & EItemEntryDataFetched ) - { - return; - } - - iState |= EItemEntryDataFetched; // Do not try fetch more than once - - TEntry entry; - if ( iEngine.Fs().Entry( *iFullPath, entry ) != KErrNone ) - { - return; - } - - SetEntryData( entry ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::SetEntryData -// -// ----------------------------------------------------------------------------- -// -void CFileManagerItemProperties::SetEntryData( const TEntry& aEntry ) const - { - iState |= EItemEntryDataFetched; - - iModified = aEntry.iModified; - - if ( aEntry.IsDir() ) - { - iState |= EItemDirectory; - } - else - { - iState |= EItemFile; - iSize = (TUint) aEntry.iSize; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerItemProperties::DriveId -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerItemProperties::DriveId() const - { - TInt ret( KErrNotFound ); - if ( iFullPath ) - { - ret = TDriveUnit( *iFullPath ); - } - return ret; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerPropertySubscriber.cpp --- a/filemanager/Engine/src/CFileManagerPropertySubscriber.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +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: Subscriber (Publish & Subscribe) -* -*/ - - -// INCLUDES -#include "CFileManagerPropertySubscriber.h" -#include "FileManagerDebug.h" - -// ============================= MEMBER FUNCTIONS ============================= - -// ---------------------------------------------------------------------------- -// CFileManagerPropertySubscriber::NewL() -// -// ---------------------------------------------------------------------------- -CFileManagerPropertySubscriber* CFileManagerPropertySubscriber::NewL( - MFileManagerPropertyObserver& aObserver, - const TUid& aCategory, - const TUint aKey ) - { - CFileManagerPropertySubscriber* self = new (ELeave) - CFileManagerPropertySubscriber( - aObserver, aCategory, aKey ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerPropertySubscriber::ConstructL() -// -// ---------------------------------------------------------------------------- -void CFileManagerPropertySubscriber::ConstructL() - { - CActiveScheduler::Add( this ); - User::LeaveIfError( iProperty.Attach( iCategory, iKey ) ); - Subscribe(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerPropertySubscriber::Subscribe() -// -// ---------------------------------------------------------------------------- -void CFileManagerPropertySubscriber::Subscribe() - { - iProperty.Subscribe( iStatus ); - SetActive(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerPropertySubscriber::CFileManagerPropertySubscriber() -// -// ---------------------------------------------------------------------------- -CFileManagerPropertySubscriber::CFileManagerPropertySubscriber( - MFileManagerPropertyObserver& aObserver, - const TUid& aCategory, - const TUint aKey ) : - CActive( EPriorityStandard ), - iObserver( aObserver ), - iCategory( aCategory), - iKey( aKey ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerPropertySubscriber::RunL() -// -// ---------------------------------------------------------------------------- -void CFileManagerPropertySubscriber::RunL() - { - Subscribe(); - iObserver.PropertyChangedL( iCategory, iKey ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerPropertySubscriber::DoCancel() -// -// ---------------------------------------------------------------------------- -void CFileManagerPropertySubscriber::DoCancel() - { - iProperty.Cancel(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerPropertySubscriber::RunError() -// -// ---------------------------------------------------------------------------- -TInt CFileManagerPropertySubscriber::RunError( TInt aError ) - { - ERROR_LOG1( "CFileManagerPropertySubscriber::RunError()-error=%d", aError ) - return aError; - } - -// ---------------------------------------------------------------------------- -// CFileManagerPropertySubscriber::~CFileManagerPropertySubscriber() -// -// ---------------------------------------------------------------------------- -CFileManagerPropertySubscriber::~CFileManagerPropertySubscriber() - { - Cancel(); - iProperty.Close(); - } - -// End of File - - diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerRefresher.cpp --- a/filemanager/Engine/src/CFileManagerRefresher.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,202 +0,0 @@ -/* -* Copyright (c) 2002-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: Asynchronous refresher for refreshing the CGflmNavigatorModel -* -*/ - - - -// INCLUDE FILES -#include "CFileManagerRefresher.h" -#include "MFileManagerProcessObserver.h" -#include "CGflmNavigatorModel.h" -#include "FileManagerDebug.h" -#include - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerRefresher::CFileManagerRefresher -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerRefresher::CFileManagerRefresher( CGflmNavigatorModel& aModel ) : - CActive( CActive::EPriorityStandard ), - iModel( aModel ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerRefresher::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CFileManagerRefresher::ConstructL() - { - CActiveScheduler::Add( this ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerRefresher::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CFileManagerRefresher* CFileManagerRefresher::NewL( CGflmNavigatorModel& aModel ) - { - CFileManagerRefresher* self = - new( ELeave ) CFileManagerRefresher( aModel ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerRefresher::~CFileManagerRefresher() -// -// ----------------------------------------------------------------------------- -// -CFileManagerRefresher::~CFileManagerRefresher() - { - Cancel(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerRefresher::RunL -// ----------------------------------------------------------------------------- -// -void CFileManagerRefresher::RunL() - { - FUNC_LOG - - TInt err( iStatus.Int() ); - - LOG_IF_ERROR1( err, "CFileManagerRefresher::RunL()-err=%d", err ) - - if( iObserver ) - { - iObserver->RefreshStoppedL(); - if ( err == KErrCancel ) - { - // For going back to parent folder - iObserver->Error( KErrPathNotFound ); - } - } - - // Forward OOM, suppress other errors - if ( err == KErrNoMemory ) - { - User::Leave( err ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerRefresher::RunError -// ----------------------------------------------------------------------------- -// -TInt CFileManagerRefresher::RunError( TInt aError ) - { - ERROR_LOG1( "CFileManagerRefresher::RunError()-err=%d", aError ) - return aError; - } - -// ----------------------------------------------------------------------------- -// CFileManagerRefresher::DoCancel -// ----------------------------------------------------------------------------- -// -void CFileManagerRefresher::DoCancel() - { - FUNC_LOG - - iModel.CancelRefresh(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerRefresher::Refresh -// Initiates the model refreshing -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CFileManagerRefresher::Refresh( TGflmRefreshMode aRefreshMode ) - { - FUNC_LOG - - // If already active, return - if( IsActive() ) - { - ERROR_LOG( "CFileManagerRefresher::Refresh()-Already active" ) - return; - } - - TInt err( KErrNone ); - if ( iObserver ) - { - TRAP( err, iObserver->RefreshStartedL() ); - } - - if ( err ) - { - ERROR_LOG1( "CFileManagerRefresher::Refresh()-Before err=%d", err ) - return; - } - - // Try to start the refresh operation - TRAP( err, iModel.RefreshListL( iStatus, aRefreshMode ) ); - - // If refreshing couldn't be started, notify observer and return - if ( err ) - { - ERROR_LOG1( "CFileManagerRefresher::Refresh()-After err=%d", err ) - if( iObserver ) - { - TRAP_IGNORE( iObserver->RefreshStoppedL() ); - } - return; - } - - // Refreshing was started, set active and wait for asynchronous - // request to complete - SetActive(); - } - -// ------------------------------------------------------------------------------ -// CFileManagerRefresher::SetObserver -// ------------------------------------------------------------------------------ -// -void CFileManagerRefresher::SetObserver( MFileManagerProcessObserver* aObserver ) - { - // Set the observer if not active - if( !IsActive() ) - { - iObserver = aObserver; - } - } - -// ------------------------------------------------------------------------------ -// CFileManagerRefresher::CancelRefresh -// ------------------------------------------------------------------------------ -// -TBool CFileManagerRefresher::CancelRefresh() - { - FUNC_LOG - - TBool ret( IsActive() ); - Cancel(); - return ret; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerRemoteDriveHandler.cpp --- a/filemanager/Engine/src/CFileManagerRemoteDriveHandler.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,252 +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: Wraps remote drive functionality -* -*/ - - - -// INCLUDES -#include -#include "CFileManagerRemoteDriveHandler.h" -#include "CGflmNavigatorModel.h" -#include "CFileManagerEngine.h" -#include "CFileManagerPropertySubscriber.h" -#include "CFileManagerUtils.h" -#include "FileManagerDebug.h" -#include "CFileManagerFeatureManager.h" - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CFileManagerRemoteDriveHandler::CFileManagerRemoteDriveHandler() -// --------------------------------------------------------------------------- -// -CFileManagerRemoteDriveHandler::CFileManagerRemoteDriveHandler( - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils ) : - iEngine( aEngine ), - iUtils( aUtils ) - { - FUNC_LOG - } - -// --------------------------------------------------------------------------- -// CFileManagerRemoteDriveHandler::NewL( const CFileManagerEngine& aEngine ) -// --------------------------------------------------------------------------- -// -CFileManagerRemoteDriveHandler* CFileManagerRemoteDriveHandler::NewL( - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils ) - { - FUNC_LOG - - CFileManagerRemoteDriveHandler* self = - new (ELeave) CFileManagerRemoteDriveHandler( - aEngine, aUtils ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CFileManagerRemoteDriveHandler::~CFileManagerRemoteDriveHandler() -// --------------------------------------------------------------------------- -// -CFileManagerRemoteDriveHandler::~CFileManagerRemoteDriveHandler() - { - FUNC_LOG - - delete iMountMan; - delete iSubscriber; - } - -// --------------------------------------------------------------------------- -// CFileManagerRemoteDriveHandler::ConstructL() -// --------------------------------------------------------------------------- -// -void CFileManagerRemoteDriveHandler::ConstructL() - { - FUNC_LOG - - // Check and set value to indicate if the feature is supported - iRemoteStorageFwSupported = - iEngine.FeatureManager().IsRemoteStorageFwSupported(); - if ( !iRemoteStorageFwSupported ) - { - return; - } - iMountMan = CRsfwMountMan::NewL( 0, NULL ); -#ifdef FILE_MANAGER_MOUNT_REMOTE_DRIVES_ON_STARTUP - // Make sure that remote drives are mounted - _LIT( KMounterExe, "rsfwbootmounter.exe" ); - RProcess mounter; - if ( mounter.Create( KMounterExe, KNullDesC ) == KErrNone ) - { - mounter.Resume(); - mounter.Close(); - } -#endif // FILE_MANAGER_MOUNT_REMOTE_DRIVES_ON_STARTUP - iSubscriber = CFileManagerPropertySubscriber::NewL( - *this, KRfeServerSecureUid, ERsfwPSKeyConnect ); - } - -// --------------------------------------------------------------------------- -// CFileManagerRemoteDriveHandler::IsConnected() -// --------------------------------------------------------------------------- -// -TBool CFileManagerRemoteDriveHandler::IsConnected( const TInt aDrive ) - { - FUNC_LOG - - if ( !iRemoteStorageFwSupported ) - { - return EFalse; - } - TBool ret( EFalse ); - TChar drv( 0 ); - if ( RFs::DriveToChar( aDrive, drv ) == KErrNone ) - { - TRsfwMountInfo info; - if ( iMountMan->GetMountInfo( drv, info ) == KErrNone ) - { - ret = ( info.iMountStatus.iConnectionState == - KMountStronglyConnected ); - } - } - return ret; - } - -// --------------------------------------------------------------------------- -// CFileManagerRemoteDriveHandler::SetConnection() -// --------------------------------------------------------------------------- -// -TInt CFileManagerRemoteDriveHandler::SetConnection( - TInt aDrive, TBool aConnect ) - { - FUNC_LOG - - if ( !iRemoteStorageFwSupported ) - { - return KErrNone; - } - TChar drv( 0 ); - TInt err( RFs::DriveToChar( aDrive, drv ) ); - if ( err != KErrNone ) - { - return err; - } - err = iMountMan->SetMountConnectionStateBlind( - drv, - aConnect ? KMountStronglyConnected : KMountNotConnected ); - if ( err == KErrCancel ) - { - err = KErrPathNotFound; - } - return err; - } - -// --------------------------------------------------------------------------- -// CFileManagerRemoteDriveHandler::DeleteSettings() -// --------------------------------------------------------------------------- -// -TInt CFileManagerRemoteDriveHandler::DeleteSettings( - const TInt aDrive ) - { - FUNC_LOG - - if ( !iRemoteStorageFwSupported ) - { - return KErrNone; - } - TChar drv( 0 ); - TInt err( RFs::DriveToChar( aDrive, drv ) ); - if ( err != KErrNone ) - { - return err; - } - TRAP( err, iMountMan->DeleteMountEntryL( drv ) ); - return err; - } - -// --------------------------------------------------------------------------- -// CFileManagerRemoteDriveHandler::PropertyChangedL() -// --------------------------------------------------------------------------- -// -void CFileManagerRemoteDriveHandler::PropertyChangedL( - const TUid& /*aCategory*/, const TUint /*aKey*/ ) - { - FUNC_LOG - - iEngine.DriveAddedOrChangedL(); - } - -// --------------------------------------------------------------------------- -// CFileManagerRemoteDriveHandler::RefreshDirectory() -// --------------------------------------------------------------------------- -// -TInt CFileManagerRemoteDriveHandler::RefreshDirectory( - const TDesC& aFullPath ) - { - FUNC_LOG - - if ( !iRemoteStorageFwSupported ) - { - return KErrNone; - } - return iMountMan->RefreshDirectory( aFullPath ); - } - -// --------------------------------------------------------------------------- -// CFileManagerRemoteDriveHandler::HasAppRemoteDriveSupport() -// --------------------------------------------------------------------------- -// -TBool CFileManagerRemoteDriveHandler::HasAppRemoteDriveSupport( - TUid aUid ) - { - FUNC_LOG - - if ( !iRemoteStorageFwSupported ) - { - return EFalse; - } - if ( aUid == KNullUid ) - { - return ETrue; - } - return !iMountMan->IsAppOnBlackList( aUid ); - } - -// --------------------------------------------------------------------------- -// CFileManagerRemoteDriveHandler::CancelTransfer() -// --------------------------------------------------------------------------- -// -void CFileManagerRemoteDriveHandler::CancelTransfer( - const TDesC& aFullPath ) - { - FUNC_LOG - - if ( !iRemoteStorageFwSupported ) - { - return; - } - INFO_LOG1( - "CFileManagerRemoteDriveHandler::CancelTransfer=%S", - &aFullPath ) - iMountMan->CancelRemoteTransfer( aFullPath ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerRemovableDriveHandler.cpp --- a/filemanager/Engine/src/CFileManagerRemovableDriveHandler.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1337 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Wraps removable drive functionality -* -*/ - - - -// INCLUDE FILES -#include -#include "CFileManagerRemovableDriveHandler.h" -#include "MFileManagerProcessObserver.h" -#include "CFileManagerUtils.h" -#include "CFileManagerEngine.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef RD_MULTIPLE_DRIVE -#include -#endif // RD_MULTIPLE_DRIVE -#include -#include -#include "CMMCScBkupEngine.h" -#include "MMCScBkupOperations.h" -#include "CMMCScBkupOperationParameters.h" -#include "CFileManagerItemProperties.h" -#include "CFileManagerBackupSettings.h" -#include "FileManagerPrivateCRKeys.h" -#include "BkupEngine.hrh" -#include "FileManagerDebug.h" -#include "CFileManagerCommonDefinitions.h" -#include "FileManagerUID.h" -#include "filemanagerprivatepskeys.h" - - -// CONSTANTS -const TInt KEjectScanInterval = 1000000; // 1 second -const TInt KEjectScanRoundsMax = 7; -NONSHARABLE_CLASS(TMaskLookup) - { - public: - TUint32 iBkupMask; - TUint32 iFmgrMask; - }; - -const TMaskLookup KMaskLookup[] = { - { EBUCatSettings, EFileManagerBackupContentSettings }, - { EBUCatMessages, EFileManagerBackupContentMessages }, - { EBUCatContacts, EFileManagerBackupContentContacts }, - { EBUCatCalendar, EFileManagerBackupContentCalendar }, - { EBUCatBookmarks, EFileManagerBackupContentBookmarks }, - { EBUCatUserFiles, EFileManagerBackupContentUserFiles } -}; -const TUint32 KMaskLookupLen = - sizeof( KMaskLookup ) / sizeof( KMaskLookup[ 0 ] ); - -const TInt KForcedFormatTimeout = 1000000; -const TInt KAppCloseTimeout = 1000000; -const TInt KFileManagerAppUid = 0x101F84EB; - -NONSHARABLE_CLASS(TFileManagerVolumeNameStore) - { -public: - inline TFileManagerVolumeNameStore() : iDrive( KErrNotFound ), iName( KNullDesC ) {}; - - TInt iDrive; // The drive using the store - TFileName iName; // Use the same length than TVolumeInfo - }; - -typedef TPckg< TFileManagerVolumeNameStore > TFileManagerVolumeNameStorePckg; - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::CFileManagerRemovableDriveHandler -// --------------------------------------------------------------------------- -// -CFileManagerRemovableDriveHandler::CFileManagerRemovableDriveHandler( - RFs& aFs, - CFileManagerUtils& aUtils, - CFileManagerEngine& aEngine ) : - CActive( CActive::EPriorityStandard ), - iFs( aFs ), - iUtils( aUtils ), - iEngine( aEngine ) - { - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::ConstructL -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::ConstructL() - { - CActiveScheduler::Add( this ); - iBkupEngine = CMMCScBkupEngine::NewL( iFs ); - PublishBurStatus( EFileManagerBkupStatusUnset ); - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::NewL -// --------------------------------------------------------------------------- -// -CFileManagerRemovableDriveHandler* CFileManagerRemovableDriveHandler::NewL( - RFs& aFs, - CFileManagerUtils& aUtils, - CFileManagerEngine& aEngine ) - { - CFileManagerRemovableDriveHandler* self = - new( ELeave ) CFileManagerRemovableDriveHandler( - aFs, aUtils, aEngine ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::~CFileManagerRemovableDriveHandler -// --------------------------------------------------------------------------- -// -CFileManagerRemovableDriveHandler::~CFileManagerRemovableDriveHandler() - { - Cancel(); - delete iBSWrapper; - delete iEjectScanPeriodic; - delete iBkupEngine; - iFormatter.Close(); - PublishBurStatus( EFileManagerBkupStatusUnset ); - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::EjectScanAndShutdownApps -// --------------------------------------------------------------------------- -// -TInt CFileManagerRemovableDriveHandler::EjectScanAndShutdownApps( TAny* ptr ) - { - CFileManagerRemovableDriveHandler* self = - static_cast< CFileManagerRemovableDriveHandler* >( ptr ); - TRAPD( err, self->DoEjectScanAndShutdownL() ); - if ( err != KErrNone ) - { - self->EjectComplete( err ); - } - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::DoEjectScanAndShutdownL -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::DoEjectScanAndShutdownL() - { - RWsSession wsSession; - User::LeaveIfError( wsSession.Connect() ); - CleanupClosePushL( wsSession ); - - const TInt KDefaultWgIdArraySize = 4; - CArrayFixFlat* wgIds = new( ELeave ) CArrayFixFlat< TInt >( - KDefaultWgIdArraySize ); - CleanupStack::PushL( wgIds ); - User::LeaveIfError( wsSession.WindowGroupList( 0, wgIds ) ); - TInt last( wgIds->Count() - 1 ); - TInt appsToShutDown( 0 ); - - for ( TInt i( last ); i >= 0; i-- ) - { - CApaWindowGroupName* doomedApp = - CApaWindowGroupName::NewLC( wsSession, wgIds->At( i ) ); - TBool systemApp( doomedApp->IsSystem() ); - TBool hiddenApp( doomedApp->Hidden() ); - - if ( !systemApp && !hiddenApp && doomedApp->AppUid().iUid != KFileManagerAppUid ) - { - appsToShutDown++; - TApaTask* task = new (ELeave) TApaTask( wsSession ); - CleanupDeletePushL( task ); - task->SetWgId( wgIds->At( i ) ); - - if ( !iEjectScanRounds ) - { - // applications are kindly requested to close themselves - // on the first round - task->EndTask(); - } - else if ( iEjectScanRounds >= KEjectScanRoundsMax ) - { - task->KillTask(); - } - CleanupStack::PopAndDestroy( task ); - } - CleanupStack::PopAndDestroy( doomedApp ); - } - CleanupStack::PopAndDestroy( wgIds ); - - if ( !appsToShutDown || iEjectScanRounds >= KEjectScanRoundsMax ) - { - EjectComplete( KErrNone ); - } - iEjectScanRounds++; - - CleanupStack::PopAndDestroy( &wsSession ); - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::EjectComplete -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::EjectComplete( TInt aErr ) - { - delete iEjectScanPeriodic; - iEjectScanPeriodic = NULL; - iLastError = aErr; - - TRAP_IGNORE( InformFinishL() ); - - RProperty::Set( - KPSUidCoreApplicationUIs, - KCoreAppUIsMmcRemovedWithoutEject, - ECoreAppUIsEjectCommandNotUsed ); - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::InformStartL -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::InformStartL( TInt aTotalCount ) - { - iLastError = KErrNone; - if ( iObserver ) - { - iObserver->ProcessStartedL( iProcess, aTotalCount ); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::InformUpdateL -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::InformUpdateL( TInt aCount ) - { - if ( iObserver ) - { - iObserver->ProcessAdvanceL( aCount ); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::InformFinishL -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::InformFinishL() - { - iEngine.ClearDriveInfo(); - PublishBurStatus( EFileManagerBkupStatusUnset ); - iProcess = MFileManagerProcessObserver::ENoProcess; - if ( iObserver ) - { - iObserver->ProcessFinishedL( iLastError, KNullDesC ); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::InformError -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::InformError( TInt aErr ) - { - iLastError = aErr; - if ( iObserver ) - { - iObserver->Error( aErr ); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::HandleBkupEngineEventL -// --------------------------------------------------------------------------- -// -TInt CFileManagerRemovableDriveHandler::HandleBkupEngineEventL( - MMMCScBkupEngineObserver::TEvent aEvent, TInt aAssociatedData ) - { - TInt ret( KErrNone ); - switch( aEvent ) - { - case MMMCScBkupEngineObserver::ECommonOperationStarting: - { - iFinalValue = KMaxTInt; - InformStartL( KMaxTInt ); - break; - } - case MMMCScBkupEngineObserver::ECommonSizeOfTaskUnderstood: - { - iFinalValue = aAssociatedData; - InformStartL( aAssociatedData ); - break; - } - case MMMCScBkupEngineObserver::ECommonOperationPrepareEnded: - { - PublishBurStatus( EFileManagerBkupStatusUnset ); - // In order to show finished dialog prior SysAp's note, - // inform observer already at prepare-ended state. - if( iProcess == MFileManagerProcessObserver::ERestoreProcess ) - { - if ( iFinalValue ) - { - InformUpdateL( iFinalValue ); - } - InformFinishL(); - } - break; - } - case MMMCScBkupEngineObserver::ECommonOperationEnded: - { - PublishBurStatus( EFileManagerBkupStatusUnset ); - if( iProcess != MFileManagerProcessObserver::ERestoreProcess ) - { - if ( iFinalValue ) - { - InformUpdateL( iFinalValue ); - } - InformFinishL(); - } - break; - } - case MMMCScBkupEngineObserver::ECommonOperationError: - { - iLastError = aAssociatedData; - break; - } - case MMMCScBkupEngineObserver::ECommonProgress: - { - InformUpdateL( aAssociatedData ); - break; - } - case MMMCScBkupEngineObserver::EBackupAnalysingData: - { - if ( iObserver && - iProcess == MFileManagerProcessObserver::EBackupProcess ) - { - ret = iObserver->NotifyL( - MFileManagerProcessObserver::ENotifyBackupMemoryLow, - aAssociatedData ); - } - break; - } - default: - { - break; - } - } - return ret; - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::SetObserver -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::SetObserver( - MFileManagerProcessObserver* aObserver ) - { - iObserver = aObserver; - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::BackupFileNameLC -// --------------------------------------------------------------------------- -// -HBufC* CFileManagerRemovableDriveHandler::BackupFileNameLC( - TBool aFullPath ) const - { - HBufC* file = CCoeEnv::Static()->AllocReadResourceLC( - R_TEXT_MMC_BACKUP_FILE ); - if ( !aFullPath ) - { - return file; // Get just name - } - // Get full path -#ifdef RD_MULTIPLE_DRIVE - TInt drive( 0 ); - User::LeaveIfError( DriveInfo::GetDefaultDrive( - DriveInfo::EDefaultRemovableMassStorage, drive ) ); - TDriveUnit driveUnit( drive ); -#else // RD_MULTIPLE_DRIVE - TDriveUnit driveUnit( PathInfo::MemoryCardRootPath() ); -#endif // RD_MULTIPLE_DRIVE - HBufC* fileAndPath = HBufC::NewLC( KMaxFileName ); - TPtr ptr( fileAndPath->Des() ); - TPtr filePtr( file->Des() ); - ptr.Copy( driveUnit.Name() ); - ptr.Append( filePtr ); - CleanupStack::Pop( fileAndPath ); - CleanupStack::PopAndDestroy( file ); - CleanupStack::PushL( fileAndPath ); - return fileAndPath; - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::StartFormatL() -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::StartFormatL( - const TInt aDrive ) - { - TInt err( KErrNone ); - - iDrive = aDrive; - iProcess = MFileManagerProcessObserver::EFormatProcess; - iFinalValue = 0; - - TRAP( err, InformStartL( 0 ) ); - if ( err == KErrNone ) - { - // Close apps and then start format - TRAP( err, CloseAppsL() ); - } - if ( err != KErrNone ) - { - EndFormatProcessL( err ); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::StartEjectL() -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::StartEjectL() - { - TRAPD( err, StartEjectScanL() ); - if ( err != KErrNone ) - { - iProcess = MFileManagerProcessObserver::ENoProcess; - User::Leave( err ); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::StartEjectScanL() -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::StartEjectScanL() - { - iProcess = MFileManagerProcessObserver::EEjectProcess; - InformStartL( 0 ); - - RProperty::Set( - KPSUidCoreApplicationUIs, - KCoreAppUIsMmcRemovedWithoutEject, - ECoreAppUIsEjectCommandUsed ); - - iEjectScanRounds = 0; - iEjectScanPeriodic = CPeriodic::NewL( CActive::EPriorityLow ); - iEjectScanPeriodic->Start( - KEjectScanInterval, - KEjectScanInterval, - TCallBack( EjectScanAndShutdownApps, this ) ); - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::CancelProcess() -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::CancelProcess() - { - switch( iProcess ) - { - case MFileManagerProcessObserver::EFormatProcess: - { - Cancel(); - break; - } - case MFileManagerProcessObserver::EBackupProcess: // FALLTHROUGH - case MFileManagerProcessObserver::ERestoreProcess: - case MFileManagerProcessObserver::ESchBackupProcess: - { - PublishBurStatus( EFileManagerBkupStatusUnset ); - iBkupEngine->CancelOperation(); - break; - } - default: - { - break; - } - } - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::BackupFileExistsL() -// --------------------------------------------------------------------------- -// -TBool CFileManagerRemovableDriveHandler::BackupFileExistsL( - const TInt /*aDrive*/ ) - { - HBufC* backupFile = BackupFileNameLC( ETrue ); - TBool ret( iBkupEngine->ValidArchiveForRestore( *backupFile ) ); - CleanupStack::PopAndDestroy( backupFile ); - return ret; - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::StartBackupL() -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::StartBackupL( - MFileManagerProcessObserver::TFileManagerProcess aProcess ) - { - if ( aProcess != MFileManagerProcessObserver::EBackupProcess && - aProcess != MFileManagerProcessObserver::ESchBackupProcess ) - { - User::Leave( KErrNotSupported ); - } - - CCoeEnv* coeEnv = CCoeEnv::Static(); - - // Create backup params - ownership is transferred to - // secure backup engine - TResourceReader driveReader; - coeEnv->CreateResourceReaderLC( - driveReader, - R_FILEMANAGER_BACKUP_RESTORE_DRIVES_AND_OPERATIONS ); - TResourceReader categoryReader; - coeEnv->CreateResourceReaderLC( - categoryReader, - R_FILEMANAGER_BACKUP_CATEGORIES ); - -#ifdef RD_FILE_MANAGER_BACKUP - - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - TUint32 bkupContent( FmgrToBkupMask( settings.Content() ) ); - TInt drive( settings.TargetDrive() ); - - CMMCScBkupOpParamsBackupFull* params = - CMMCScBkupOpParamsBackupFull::NewL( - driveReader, - categoryReader, - TDriveNumber( drive ), - bkupContent ); - -#else // RD_FILE_MANAGER_BACKUP - - HBufC* backupFile = BackupFileNameLC( ETrue ); - TInt drive = TDriveUnit( *backupFile ); - CleanupStack::PopAndDestroy( backupFile ); - - CMMCScBkupOpParamsBackupFull* params = - CMMCScBkupOpParamsBackupFull::NewL( driveReader, - categoryReader, - TDriveNumber( drive ), - EBUCatAllInOne ); - -#endif // RD_FILE_MANAGER_BACKUP - - CleanupStack::PopAndDestroy(); // categoryReader - CleanupStack::PopAndDestroy(); // driveReader - - CleanupStack::PushL( params ); - TBool diskFull( SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, 0, drive ) ); - CleanupStack::Pop( params ); - - if ( diskFull ) - { - iProcess = aProcess; - TRAP_IGNORE( InformStartL( KMaxTInt ) ); - iLastError = KErrDiskFull; - TRAP_IGNORE( InformFinishL() ); - iProcess = MFileManagerProcessObserver::ENoProcess; - delete params; - } - else - { - // Start the process - engine owns the parameters immediately - iProcess = aProcess; - - PublishBurStatus( EFileManagerBkupStatusBackup ); - TRAPD( err, iBkupEngine->StartOperationL( - EMMCScBkupOperationTypeFullBackup, *this, params ) ); - if ( err != KErrNone ) - { - PublishBurStatus( EFileManagerBkupStatusUnset ); - iProcess = MFileManagerProcessObserver::ENoProcess; - User::Leave( err ); - } - } - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::StartRestoreL() -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::StartRestoreL() - { - TBool diskFull( SysUtil::DiskSpaceBelowCriticalLevelL( - &iFs, 0, KFmgrSystemDrive ) ); - if ( diskFull ) - { - iProcess = MFileManagerProcessObserver::ERestoreProcess; - TRAP_IGNORE( InformStartL( KMaxTInt ) ); - iLastError = KErrDiskFull; - TRAP_IGNORE( InformFinishL() ); - iProcess = MFileManagerProcessObserver::ENoProcess; - return; - } - - CFileManagerBackupSettings& bkupSettings( iEngine.BackupSettingsL() ); - - // Create restore params - ownership is transferred to - // secure backup engine - TResourceReader driveReader; - CCoeEnv::Static()->CreateResourceReaderLC( - driveReader, - R_FILEMANAGER_BACKUP_RESTORE_DRIVES_AND_OPERATIONS ); - -#ifdef RD_FILE_MANAGER_BACKUP - - CMMCScBkupOpParamsRestoreFull* params = - CMMCScBkupOpParamsRestoreFull::NewL( - driveReader, - EBUCatAllSeparately ); - CleanupStack::PopAndDestroy(); // driveReader - CleanupStack::PushL( params ); - - // Get list of all archives - RPointerArray< CMMCScBkupArchiveInfo > archives; - TCleanupItem cleanupItem( ResetAndDestroyArchives, &archives ); - CleanupStack::PushL( cleanupItem ); - iBkupEngine->ListArchivesL( - archives, - params, - bkupSettings.AllowedDriveAttMatchMask() ); - - // Get user set restore selection - RArray< CFileManagerRestoreSettings::TInfo > selection; - CleanupClosePushL( selection ); - CFileManagerRestoreSettings& rstSettings( iEngine.RestoreSettingsL() ); - rstSettings.GetSelectionL( selection ); - - // Remove non user selected archives - TInt i( 0 ); - while ( i < archives.Count() ) - { - TBool remove( ETrue ); - - // Compare archives category and drive - CMMCScBkupArchiveInfo* archiveInfo = archives[ i ]; - TUint32 fmgrContent( - BkupToFmgrMask( archiveInfo->Category().iFlags ) ); - TInt drive( archiveInfo->Drive() ); - - TInt count( selection.Count() ); - for( TInt j( 0 ); j < count; ++j ) - { - const CFileManagerRestoreSettings::TInfo& info( selection[ j ] ); - if ( ( drive == info.iDrive ) && ( fmgrContent & info.iContent ) ) - { - // Found user selected archive - // Do not check this archive again - selection.Remove( j ); - remove = EFalse; - break; - } - } - if ( remove ) - { - // Remove non selected archive - archives.Remove( i ); - delete archiveInfo; - } - else - { - // Move to next archive - ++i; - } - } - - CleanupStack::PopAndDestroy( &selection ); - params->SetArchiveInfosL( archives ); - CleanupStack::Pop( &archives ); - archives.Close(); - CleanupStack::Pop( params ); - -#else // RD_FILE_MANAGER_BACKUP - - CMMCScBkupOpParamsRestoreFull* params = - CMMCScBkupOpParamsRestoreFull::NewL( driveReader, EBUCatAllInOne ); - CleanupStack::PopAndDestroy(); // driveReader - - // Get list of all archives - RPointerArray< CMMCScBkupArchiveInfo > archives; - TCleanupItem cleanupItem( ResetAndDestroyArchives, &archives ); - CleanupStack::PushL( cleanupItem ); - iBkupEngine->ListArchivesL( - archives, - params, - bkupSettings.AllowedDriveAttMatchMask() ); - params->SetArchiveInfosL( archives ); - CleanupStack::Pop( &archives ); - -#endif // RD_FILE_MANAGER_BACKUP - - // Start the process - engine owns the parameters immediately - iProcess = MFileManagerProcessObserver::ERestoreProcess; - PublishBurStatus( EFileManagerBkupStatusRestore ); - TRAPD( err, iBkupEngine->StartOperationL( - EMMCScBkupOperationTypeFullRestore, *this, params ) ); - if ( err != KErrNone ) - { - PublishBurStatus( EFileManagerBkupStatusUnset ); - iProcess = MFileManagerProcessObserver::ENoProcess; - User::Leave( err ); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::GetRestoreInfoArrayL -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::GetRestoreInfoArrayL( - RArray< CFileManagerRestoreSettings::TInfo >& aArray, - const TInt aDrive ) - { - - CleanupClosePushL( aArray ); - - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); - aArray.Reset(); - - TResourceReader driveReader; - CCoeEnv::Static()->CreateResourceReaderLC( - driveReader, - R_FILEMANAGER_BACKUP_RESTORE_DRIVES_AND_OPERATIONS ); - - CMMCScBkupOpParamsRestoreFull* params = - CMMCScBkupOpParamsRestoreFull::NewL( - driveReader, EBUCatAllSeparately ); - CleanupStack::PopAndDestroy(); // driveReader - CleanupStack::PushL( params ); - - // Get list of all archives - RPointerArray< CMMCScBkupArchiveInfo > archives; - TCleanupItem cleanupItem( ResetAndDestroyArchives, &archives ); - CleanupStack::PushL( cleanupItem ); - iBkupEngine->ListArchivesL( - archives, - params, - settings.AllowedDriveAttMatchMask(), - aDrive ); - - // Prepare time zone conversion - RTz tz; - User::LeaveIfError( tz.Connect() ); - CleanupClosePushL( tz ); - - // Fill restore info - CFileManagerRestoreSettings::TInfo info; - TInt count( archives.Count() ); - aArray.ReserveL( count ); - - for( TInt i( 0 ); i < count; ++i ) - { - // Content - CMMCScBkupArchiveInfo& archiveInfo( *archives[ i ] ); - info.iContent = BkupToFmgrMask( archiveInfo.Category().iFlags ); - - // Local time - info.iTime = archiveInfo.DateTime(); - User::LeaveIfError( tz.ConvertToLocalTime( info.iTime ) ); - - // Drive - info.iDrive = archiveInfo.Drive(); - - aArray.AppendL( info ); - } - - CleanupStack::PopAndDestroy( &tz ); - CleanupStack::PopAndDestroy( &archives ); - CleanupStack::PopAndDestroy( params ); - CleanupStack::Pop( &aArray ) ; - - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::DoCancel -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::DoCancel() - { - switch( iProcess ) - { - case MFileManagerProcessObserver::EFormatProcess: - { - TRAP_IGNORE( EndFormatProcessL( KErrCancel ) ); - break; - } - default: - { - break; - } - } - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::RunL -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::RunL() - { - TInt err( iStatus.Int() ); - switch( iProcess ) - { - case MFileManagerProcessObserver::EFormatProcess: - { - if( err != KErrNone ) - { - if ( !iFinalValue && err == KErrInUse ) - { - // Some app remained open, try still to start format - StartFormatProcessL(); - } - else - { - // Format failed - EndFormatProcessL( err ); - } - } - else if( !iFinalValue ) - { - // Apps have been closed. Start format. - StartFormatProcessL(); - } - else if( iFormatCountBuf() > 0 ) - { - // Update observer and format next track - InformUpdateL( iFinalValue - iFormatCountBuf() ); - iFormatter.Next( iFormatCountBuf, iStatus ); - SetActive( ); - } - else - { - // Format complete - EndFormatProcessL( KErrNone ); - } - break; - } - default: - { - break; - } - } - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::RunError -// --------------------------------------------------------------------------- -// -TInt CFileManagerRemovableDriveHandler::RunError( TInt aError ) - { - switch( iProcess ) - { - case MFileManagerProcessObserver::EFormatProcess: - { - TRAP_IGNORE( EndFormatProcessL( aError ) ); - break; - } - default: - { - break; - } - } - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::EndFormatProcessL -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::EndFormatProcessL( TInt aErr ) - { - iFormatter.Close(); - iLastError = aErr; - if( aErr == KErrNone ) - { - // Restore the volume name stored before format operation. - TRAPD( err, RestoreVolumeNameL( iDrive ) ); - LOG_IF_ERROR1( err, - "FileManagerRemovableDriveHandler::EndFormatProcessL-RestoreVolumeName %d", - err ); - iUtils.CreateDefaultFolders( iDrive ); - } - else if ( aErr != KErrCancel ) - { - InformError( aErr ); - } - TRAPD( err, RestartAppsL() ); - LOG_IF_ERROR1( err, - "FileManagerRemovableDriveHandler::EndFormatProcessL-Restart apps %d", - err ); - InformFinishL(); - - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::StartFormatProcessL -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::StartFormatProcessL() - { - // Store the current volume name over format operation. - TRAPD( err, StoreVolumeNameL( iDrive ) ); - LOG_IF_ERROR1( - err, - "FileManagerRemovableDriveHandler::StartFormatProcessL-StoreVolumeName %d", - err ); - TDriveName driveName( TDriveUnit( iDrive ).Name() ); - // Resolve drive character and open formatter - iFormatter.Close(); - err = iFormatter.Open( - iFs, driveName, EFullFormat, iFinalValue ); - // Forced format for locked card - if ( err == KErrLocked ) - { - // Erase password and try again - err = iFs.ErasePassword( iDrive ); - if (err == KErrNone) - { - err = iFormatter.Open(iFs, driveName, EFullFormat , iFinalValue ); - } - } - if (err == KErrInUse) - { - TBool reallyFormat = ETrue; - if (reallyFormat) - { - err = iFormatter.Open( - iFs, driveName, EFullFormat | EForceFormat, iFinalValue ); - } - } - TFullName fsName; - if (err == KErrNone) - { - err = iFs.FileSystemName( fsName, iDrive ); - - if ( err == KErrNone && fsName.Length() > 0 ) - { - // Prevent SysAp shutting down applications - RProperty::Set( - KPSUidCoreApplicationUIs, - KCoreAppUIsMmcRemovedWithoutEject, - ECoreAppUIsEjectCommandUsed ); - } - else - { - // Don't continue with format if there is no file system name - // or file system name could not be obtained. - err = KErrCancel; - } - } - - // On successful open of RFormat::Open(), iFinalValue contains the number of - // tracks to be formatted - - if ( iFinalValue && err == KErrNone ) - { - TRAP( err, InformStartL( iFinalValue ) ); - if ( err == KErrNone ) - { - iFormatCountBuf = iFinalValue; - iFormatter.Next( iFormatCountBuf, iStatus ); - SetActive(); - } - } - if ( !iFinalValue || err != KErrNone ) - { - EndFormatProcessL( err ); - } - } -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::CloseAppsL -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::CloseAppsL() - { - delete iBSWrapper; - iBSWrapper = NULL; - - iBSWrapper = CBaBackupSessionWrapper::NewL(); - - TBackupOperationAttributes atts( - MBackupObserver::EReleaseLockNoAccess, - MBackupOperationObserver::EStart ); - iBSWrapper->NotifyBackupOperationL( atts ); - iBSWrapper->CloseAll( MBackupObserver::EReleaseLockNoAccess, iStatus ); - SetActive(); - - // Memory card formatting cannot be executed if there are open files on it. - // It has been detected, that in some cases memory card using applications - // have no time to close file handles before formatting is tried to be executed. - // To address this issue, we need to add a delay here after client-notification - // about pending format and real formatting procedure. - User::After( KAppCloseTimeout ); - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::RestartAppsL -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::RestartAppsL() - { - if ( !iBSWrapper ) - { - return; - } - - TBackupOperationAttributes atts( - MBackupObserver::ETakeLock, MBackupOperationObserver::EEnd ); - iBSWrapper->NotifyBackupOperationL( atts ); - iBSWrapper->RestartAll(); - - // Get rid of the wrapper instance - delete iBSWrapper; - iBSWrapper = NULL; - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::ResetAndDestroyArchives -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::ResetAndDestroyArchives( TAny* aPtr ) - { - RPointerArray< CMMCScBkupArchiveInfo >* archive = - static_cast< RPointerArray< CMMCScBkupArchiveInfo >* >( aPtr ); - archive->ResetAndDestroy(); - archive->Close(); - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::BkupToFmgrMask -// --------------------------------------------------------------------------- -// -TUint32 CFileManagerRemovableDriveHandler::BkupToFmgrMask( - const TUint32 aBkupMask ) - { - TUint32 ret( 0 ); - - for( TInt i( 0 ); i < KMaskLookupLen; ++i ) - { - if ( aBkupMask & KMaskLookup[ i ].iBkupMask ) - { - ret |= KMaskLookup[ i ].iFmgrMask; - } - } - return ret; - } - -#ifdef RD_FILE_MANAGER_BACKUP -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::FmgrToBkupMask -// --------------------------------------------------------------------------- -// -TUint32 CFileManagerRemovableDriveHandler::FmgrToBkupMask( - const TUint32 aFmrgMask ) - { - TUint32 ret( 0 ); - - for( TInt i( 0 ); i < KMaskLookupLen; ++i ) - { - if ( ( aFmrgMask & EFileManagerBackupContentAll ) || - ( aFmrgMask & KMaskLookup[ i ].iFmgrMask ) ) - { - ret |= KMaskLookup[ i ].iBkupMask; - } - } - return ret; - } -#endif // RD_FILE_MANAGER_BACKUP - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::IsProcessOngoing -// --------------------------------------------------------------------------- -// -TBool CFileManagerRemovableDriveHandler::IsProcessOngoing() const - { - return iProcess != MFileManagerProcessObserver::ENoProcess; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::PublishBurStatus() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::PublishBurStatus( TInt aType ) - { - _LIT_SECURITY_POLICY_S0( KFileManagerBkupWritePolicy, KFileManagerUID3 ); - _LIT_SECURITY_POLICY_PASS( KFileManagerBkupReadPolicy ); - - TInt err( RProperty::Set( - KPSUidFileManagerStatus, KFileManagerBkupStatus, aType ) ); - if ( err != KErrNone ) - { - err = RProperty::Define( - KPSUidFileManagerStatus, KFileManagerBkupStatus, - RProperty::EInt, KFileManagerBkupReadPolicy, - KFileManagerBkupWritePolicy ); - if ( err == KErrNone || err == KErrAlreadyExists ) - { - err = RProperty::Set( - KPSUidFileManagerStatus, KFileManagerBkupStatus, aType ); - } - } - LOG_IF_ERROR1( - err, "FileManagerRemovableDriveHandler::PublishBurStatus-err=%d", err ) - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::IsMassStorageDrive() -// -// ----------------------------------------------------------------------------- -// -#ifdef RD_MULTIPLE_DRIVE - -TBool CFileManagerRemovableDriveHandler::IsInternalMassStorage( TInt aDrive ) - { - FUNC_LOG; - - TBool ret( EFalse ); - TUint driveStatus( 0 ); - DriveInfo::GetDriveStatus( iFs, aDrive, driveStatus ); - if ( ( driveStatus & DriveInfo::EDriveInternal ) && - ( driveStatus & DriveInfo::EDriveExternallyMountable ) ) - { - ret = ETrue; - } - INFO_LOG2( - "FileManagerRemovableDriveHandler::IsInternalMassStorage-drive=%d,ret=%d", - aDrive, ret ); - return ret; - } - -#else // RD_MULTIPLE_DRIVE - -TBool CFileManagerRemovableDriveHandler::IsInternalMassStorage( TInt /*aDrive*/ ) - { - FUNC_LOG; - - TInt ret( EFalse ); - return ret; - } - -#endif // RD_MULTIPLE_DRIVE - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::StoreVolumeNameL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::StoreVolumeNameL( TInt aDrive ) - { - FUNC_LOG; - - if ( IsInternalMassStorage( aDrive ) ) - { - TVolumeInfo volumeInfo; - User::LeaveIfError( iFs.Volume( volumeInfo, aDrive ) ); - CRepository* cenRep = CRepository::NewLC( KCRUidFileManagerSettings ); - TFileManagerVolumeNameStore volumeStore; - TFileManagerVolumeNameStorePckg volumeStorePckg( volumeStore ); - volumeStore.iDrive = aDrive; - volumeStore.iName.Copy( volumeInfo.iName ); - User::LeaveIfError( cenRep->Set( - KFileManagerStoredInternalMassStorageVolumeName, volumeStorePckg ) ); - CleanupStack::PopAndDestroy( cenRep ); - INFO_LOG2( - "FileManagerRemovableDriveHandler::StoreVolumeNameL-drive=%d,name=%S", - aDrive, &volumeStore.iName ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::RestoreVolumeNameL() -// -// ----------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::RestoreVolumeNameL( TInt aDrive ) - { - FUNC_LOG; - - if ( IsInternalMassStorage( aDrive ) ) - { - TFileName volumeName; - CRepository* cenRep = CRepository::NewLC( KCRUidFileManagerSettings ); - TFileManagerVolumeNameStore volumeStore; - TFileManagerVolumeNameStorePckg volumeStorePckg( volumeStore ); - TInt err( cenRep->Get( - KFileManagerStoredInternalMassStorageVolumeName, volumeStorePckg ) ); - if ( err == KErrNone && volumeStore.iDrive == aDrive ) - { - volumeName.Copy( volumeStore.iName ); - } - if ( !volumeName.Length() ) - { - User::LeaveIfError( cenRep->Get( - KFileManagerDefaultInternalMassStorageVolumeName, volumeName ) ); - } - if ( volumeName.Length() > 0 ) - { - User::LeaveIfError( iFs.SetVolumeLabel( volumeName, aDrive ) ); - } - CleanupStack::PopAndDestroy( cenRep ); - INFO_LOG2( - "FileManagerRemovableDriveHandler::RestoreVolumeNameL-drive=%d,name=%S", - aDrive, &volumeName ); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::ListArchivesL -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::ListArchivesL( - RPointerArray< CMMCScBkupArchiveInfo >& aArchives, - const CFileManagerBackupSettings& aBackupSettings ) - { - aArchives.ResetAndDestroy(); - TResourceReader driveReader; - CCoeEnv::Static()->CreateResourceReaderLC( - driveReader, - R_FILEMANAGER_BACKUP_RESTORE_DRIVES_AND_OPERATIONS ); - CMMCScBkupOpParamsRestoreFull* params = - CMMCScBkupOpParamsRestoreFull::NewL( - driveReader, EBUCatAllSeparately ); - CleanupStack::PopAndDestroy(); // driveReader - CleanupStack::PushL( params ); - iBkupEngine->ListArchivesL( - aArchives, params, aBackupSettings.AllowedDriveAttMatchMask() ); - CleanupStack::PopAndDestroy( params ); - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::LatestBackupTimeL -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::LatestBackupTimeL( - TTime& aBackupTime ) - { - aBackupTime = 0; - CFileManagerBackupSettings& bkupSettings( iEngine.BackupSettingsL() ); - RPointerArray< CMMCScBkupArchiveInfo > archives; - TCleanupItem cleanupItem( ResetAndDestroyArchives, &archives ); - CleanupStack::PushL( cleanupItem ); - ListArchivesL( archives, bkupSettings ); - - // Find the latest archive - TBool found( EFalse ); - TInt count( archives.Count() ); - for( TInt i( 0 ); i < count; ++i ) - { - TTime time( archives[ i ]->DateTime() ); - if ( time > aBackupTime ) - { - aBackupTime = time; - found = ETrue; - } - } - CleanupStack::PopAndDestroy( &archives ); - if ( !found ) - { - User::Leave( KErrNotFound ); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerRemovableDriveHandler::DeleteBackupsL -// --------------------------------------------------------------------------- -// -void CFileManagerRemovableDriveHandler::DeleteBackupsL() - { - CFileManagerBackupSettings& bkupSettings( iEngine.BackupSettingsL() ); - RPointerArray< CMMCScBkupArchiveInfo > archives; - TCleanupItem cleanupItem( ResetAndDestroyArchives, &archives ); - CleanupStack::PushL( cleanupItem ); - ListArchivesL( archives, bkupSettings ); - - // Get the user set selection - RArray< CFileManagerRestoreSettings::TInfo > selection; - CleanupClosePushL( selection ); - CFileManagerRestoreSettings& rstSettings( iEngine.RestoreSettingsL() ); - rstSettings.GetSelectionL( selection ); - - // Delete selected archives - TInt archivesCount( archives.Count() ); - for ( TInt i( 0 ); i < archivesCount; ++i ) - { - CMMCScBkupArchiveInfo* archiveInfo = archives[ i ]; - TUint32 fmgrContent( - BkupToFmgrMask( archiveInfo->Category().iFlags ) ); - TInt drive( archiveInfo->Drive() ); - TInt selectionCount( selection.Count() ); - for( TInt j( 0 ); j < selectionCount; ++j ) - { - const CFileManagerRestoreSettings::TInfo& info( selection[ j ] ); - if ( ( drive == info.iDrive ) && ( fmgrContent & info.iContent ) ) - { - TPtrC fullPath( archiveInfo->FileName() ); - User::LeaveIfError( - CFileManagerUtils::RemoveReadOnlyAttribute( - iFs, fullPath ) ); - User::LeaveIfError( iFs.Delete( fullPath ) ); - selection.Remove( j ); // Do not check again - break; - } - } - } - CleanupStack::PopAndDestroy( &selection ); - CleanupStack::PopAndDestroy( &archives ); - } - - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerRestoreSettings.cpp --- a/filemanager/Engine/src/CFileManagerRestoreSettings.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +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: Empty restore settings to maintain library BC. -* Remove this file when cleaning up RnD flags -* -*/ - - - -// INCLUDE FILES -#include "CFileManagerRestoreSettings.h" -#include "CFilemanagerBackupSettings.h" - - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::CFileManagerRestoreSettings -// ---------------------------------------------------------------------------- -// -CFileManagerRestoreSettings::CFileManagerRestoreSettings( - CFileManagerEngine& aEngine ) : - iEngine( aEngine ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::~CFileManagerRestoreSettings -// ---------------------------------------------------------------------------- -// -CFileManagerRestoreSettings::~CFileManagerRestoreSettings() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::NewL -// ---------------------------------------------------------------------------- -// -CFileManagerRestoreSettings* CFileManagerRestoreSettings::NewL( - CFileManagerEngine& aEngine ) - { - CFileManagerRestoreSettings* self = - new ( ELeave ) CFileManagerRestoreSettings( - aEngine ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::ConstructL -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreSettings::ConstructL() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::SetSelection -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerRestoreSettings::SetSelection( - const TUint64& /*aSelection*/ ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::RefreshL -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerRestoreSettings::RefreshL() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::CEntry::MdcaCount -// ---------------------------------------------------------------------------- -// -TInt CFileManagerRestoreSettings::MdcaCount() const - { - return 0; - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::CEntry::MdcaPoint -// ---------------------------------------------------------------------------- -// -TPtrC CFileManagerRestoreSettings::MdcaPoint( TInt /*aIndex*/ ) const - { - return TPtrC( KNullDesC ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::CEntry::~CEntry -// ---------------------------------------------------------------------------- -// -CFileManagerRestoreSettings::CEntry::~CEntry() - { - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerRestoreSettingsFull.cpp --- a/filemanager/Engine/src/CFileManagerRestoreSettingsFull.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,296 +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: Restore settings -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include "FileManagerEngine.hrh" -#include "CFileManagerEngine.h" -#include "CFileManagerRestoreSettings.h" -#include "CFileManagerBackupSettings.h" -#include "TFileManagerDriveInfo.h" -#include "FileManagerPrivateCRKeys.h" -#include "FileManagerDebug.h" - - -// CONSTANTS -_LIT( KDateFormat1, "%1" ); -_LIT( KDateFormat2, "%2" ); -_LIT( KDateFormat3, "%3" ); -_LIT( KTimeFormatBefore, " %-B %J:%T" ); -_LIT( KTimeFormatAfter, " %J:%T %+B" ); -_LIT( KEmptyChar, " " ); -const TUint KSecondSeparator = 1; -const TUint KThirdSeparator = 2; -const TInt KTimeStrMax = 20; -_LIT( KSeparator, "\t" ); -const TInt KSeparatorSpace = 9; -_LIT( KIconFormat, "%d" ); -const TInt KIconIdStrMax = 3; -_LIT( KTimeSeparatorPlaceHolder, ":" ); -const TInt KHourMinSeparator = 1; - - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::CFileManagerRestoreSettings -// ---------------------------------------------------------------------------- -// -CFileManagerRestoreSettings::CFileManagerRestoreSettings( - CFileManagerEngine& aEngine ) : - iEngine( aEngine ) - { - FUNC_LOG - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::~CFileManagerRestoreSettings -// ---------------------------------------------------------------------------- -// -CFileManagerRestoreSettings::~CFileManagerRestoreSettings() - { - FUNC_LOG - - iList.ResetAndDestroy(); - iList.Close(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::NewL -// ---------------------------------------------------------------------------- -// -CFileManagerRestoreSettings* CFileManagerRestoreSettings::NewL( - CFileManagerEngine& aEngine ) - { - CFileManagerRestoreSettings* self = - new ( ELeave ) CFileManagerRestoreSettings( - aEngine ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::ConstructL -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreSettings::ConstructL() - { - FUNC_LOG - - RefreshL(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::SetSelection -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerRestoreSettings::SetSelection( - const TUint64& aSelection ) - { - iSelection = aSelection; - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::RefreshL -// ---------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerRestoreSettings::RefreshL() - { - FUNC_LOG - - iList.ResetAndDestroy(); - - RArray< TInfo > infoArray; - CleanupClosePushL( infoArray ); - iEngine.GetRestoreInfoArrayL( infoArray ); - - TInt count( infoArray.Count() ); - TUint32 mask( EFileManagerBackupContentFirst); - while ( mask <= EFileManagerBackupContentLast ) - { - for ( TInt i( 0 ); i < count; ++i ) - { - TInfo& info( infoArray[ i ] ); - if ( info.iContent & mask ) - { - CEntry* entry = CreateEntryLC( info ); - iList.AppendL( entry ); - CleanupStack::Pop( entry ); - } - } - mask <<= 1; - } - CleanupStack::PopAndDestroy( &infoArray ); - - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::CEntry::MdcaCount -// ---------------------------------------------------------------------------- -// -TInt CFileManagerRestoreSettings::MdcaCount() const - { - return iList.Count(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::CEntry::MdcaPoint -// ---------------------------------------------------------------------------- -// -TPtrC CFileManagerRestoreSettings::MdcaPoint( TInt aIndex ) const - { - return TPtrC( *( iList[ aIndex ]->iText ) ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::CEntry::CreateEntryLC -// ---------------------------------------------------------------------------- -// -CFileManagerRestoreSettings::CEntry* - CFileManagerRestoreSettings::CreateEntryLC( - const TInfo& aInfo ) - { - TBuf< KIconIdStrMax > iconStr; - CEntry* entry = new ( ELeave ) CEntry; - CleanupStack::PushL( entry ); - - TInt titleId( CFileManagerBackupSettings::ContentToTextId( aInfo.iContent ) ); - HBufC* title = StringLoader::LoadLC( titleId ); - HBufC* timeAndDate = DateTimeStringLC( aInfo.iTime ); - entry->iText = HBufC::NewL( - title->Length() + timeAndDate->Length() + KSeparatorSpace ); - - // "0\tFirstLabel\tSecondLabel\t0" - TPtr ptr( entry->iText->Des() ); - iconStr.Copy( KIconFormat ); - iconStr.Format( KIconFormat, EIconCheckBoxOff ); - ptr.Append( iconStr ); - ptr.Append( KSeparator ); - ptr.Append( *title ); - ptr.Append( KSeparator ); - ptr.Append( *timeAndDate ); - ptr.Append( KSeparator ); - - TUint32 drvState( 0 ); - if ( iEngine.DriveState( drvState, aInfo.iDrive ) == KErrNone ) - { - TInt icon( KErrNotFound ); - if ( drvState & TFileManagerDriveInfo::EDriveUsbMemory ) - { - icon = EIconUsbMemory; - } - else if ( drvState & TFileManagerDriveInfo::EDriveRemovable ) - { - icon = EIconMemoryCard; - } - if ( icon >= 0 ) - { - iconStr.Copy( KIconFormat ); - iconStr.Format( KIconFormat, icon ); - ptr.Append( iconStr ); - } - } - entry->iInfo = aInfo; - - CleanupStack::PopAndDestroy( timeAndDate ); - CleanupStack::PopAndDestroy( title ); - return entry; - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::CEntry::~CEntry -// ---------------------------------------------------------------------------- -// -CFileManagerRestoreSettings::CEntry::~CEntry() - { - delete iText; - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::GetSelectionL -// ---------------------------------------------------------------------------- -// -void CFileManagerRestoreSettings::GetSelectionL( - RArray< TInfo >& aInfoArray ) const - { - CleanupClosePushL( aInfoArray ); - aInfoArray.Reset(); - - TInt count( iList.Count() ); - - for ( TInt i( 0 ); i < count; ++i ) - { - if ( ( ( ( TUint64 ) 1 ) << i ) & iSelection ) - { - aInfoArray.AppendL( iList[ i ]->iInfo ); - } - } - CleanupStack::Pop( &aInfoArray ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerRestoreSettings::DateTimeStringLC -// ---------------------------------------------------------------------------- -// -HBufC* CFileManagerRestoreSettings::DateTimeStringLC( const TTime& aTime ) - { - TBuf< KTimeStrMax > dateStr; - TBuf< KTimeStrMax > dateStrFormat; - - // Localized date separator form - TLocale local; - dateStrFormat.Append( KDateFormat1 ); - dateStrFormat.Append( local.DateSeparator( KSecondSeparator ) ); - dateStrFormat.Append( KDateFormat2 ); - dateStrFormat.Append( local.DateSeparator( KThirdSeparator ) ); - dateStrFormat.Append( KDateFormat3 ); - aTime.FormatL( dateStr, dateStrFormat ); - - TBuf< KTimeStrMax > timeFormatStr; - if ( local.AmPmSymbolPosition() == ELocaleBefore ) - { - timeFormatStr.Copy( KTimeFormatBefore ); - } - else - { - timeFormatStr.Copy( KTimeFormatAfter ); - } - - TChar timeSeparator( local.TimeSeparator( KHourMinSeparator ) ); - AknTextUtils::ReplaceCharacters( - timeFormatStr, KTimeSeparatorPlaceHolder, timeSeparator ); - TBuf< KTimeStrMax > timeStr; - aTime.FormatL( timeStr, timeFormatStr ); - - HBufC* buf = HBufC::NewLC( dateStr.Length() + - KEmptyChar().Length() + - timeStr.Length() ); - TPtr ptrBuffer( buf->Des() ); - ptrBuffer.Append( timeStr ); - ptrBuffer.Append( KEmptyChar ); - ptrBuffer.Append( dateStr ); - - return buf; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerThreadWrapper.cpp --- a/filemanager/Engine/src/CFileManagerThreadWrapper.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,408 +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: Background thread functionality wrapper -* -*/ - - - -// INCLUDE FILES -#include "CFileManagerThreadWrapper.h" -#include "FileManagerDebug.h" - - -// ============================= MEMBER FUNCTIONS ============================= - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::CFileManagerThreadWrapper() -// -// ---------------------------------------------------------------------------- -CFileManagerThreadWrapper::CFileManagerThreadWrapper() : - CActive( CActive::EPriorityStandard ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::~CFileManagerThreadWrapper() -// -// ---------------------------------------------------------------------------- -CFileManagerThreadWrapper::~CFileManagerThreadWrapper() - { - Cancel(); - delete iNotifyObserver; - iSemaphore.Close(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::NewL() -// -// ---------------------------------------------------------------------------- -CFileManagerThreadWrapper* CFileManagerThreadWrapper::NewL() - { - CFileManagerThreadWrapper* self = - new (ELeave) CFileManagerThreadWrapper(); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::ConstructL() -// -// ---------------------------------------------------------------------------- -void CFileManagerThreadWrapper::ConstructL() - { - CActiveScheduler::Add( this ); - User::LeaveIfError( iSemaphore.CreateLocal( 0 ) ); - iNotifyObserver = CNotifyObserver::NewL( *this ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::RunL() -// -// ---------------------------------------------------------------------------- -void CFileManagerThreadWrapper::RunL() - { - iNotifyObserver->Cancel(); - - TInt err( iStatus.Int() ); - LOG_IF_ERROR1( err, "CFileManagerThreadWrapper::RunL()-err=%d", err ) - - if ( iNotify & MFileManagerThreadFunction::ENotifyFinished ) - { - TRAP_IGNORE( iFunction->NotifyThreadClientL( - MFileManagerThreadFunction::ENotifyFinished, err ) ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::DoNotifyL() -// -// ---------------------------------------------------------------------------- - -void CFileManagerThreadWrapper::DoNotifyL( TInt aErr ) - { - LOG_IF_ERROR1( aErr, "CFileManagerThreadWrapper::DoNotifyL()-aErr=%d", aErr ) - - iResumePending = ETrue; - - if ( aErr != KErrNone && - ( iNotify & MFileManagerThreadFunction::ENotifyError ) ) - { - iFunction->NotifyThreadClientL( - MFileManagerThreadFunction::ENotifyError, aErr ); - } - else if ( iNotify & MFileManagerThreadFunction::ENotifyStepFinished ) - { - iFunction->NotifyThreadClientL( - MFileManagerThreadFunction::ENotifyStepFinished, aErr ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::RunError() -// -// ---------------------------------------------------------------------------- -TInt CFileManagerThreadWrapper::RunError( TInt aErr ) - { - if ( aErr != KErrNone ) - { - ERROR_LOG1( "CFileManagerThreadWrapper::RunError()-err=%d", aErr ) - iCancel = ETrue; - ResumeThread(); - } - return aErr; - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::DoCancel() -// -// ---------------------------------------------------------------------------- -void CFileManagerThreadWrapper::DoCancel() - { - FUNC_LOG - - CancelThread(); - iSemaphore.Signal(); // To avoid deadlock - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::StartThread() -// -// ---------------------------------------------------------------------------- -TInt CFileManagerThreadWrapper::StartThread( - MFileManagerThreadFunction& aFunction, - TUint aNotify, - TThreadPriority aPriority ) - { - FUNC_LOG - - TInt err( KErrAlreadyExists ); - - if ( !IsActive() ) - { - RThread thread; - err = thread.Create( - KNullDesC, ThreadFunction, KDefaultStackSize, NULL, this ); - if ( err == KErrNone ) - { - thread.SetPriority( aPriority ); - thread.Logon( iStatus ); - - iClientId = RThread().Id(); - iFunction = &aFunction; - iNotify = aNotify; - iCancel = EFalse; - - iNotifyObserver->Activate(); - SetActive(); - - thread.Resume(); - thread.Close(); - } - } - - LOG_IF_ERROR1( err, "CFileManagerThreadWrapper::StartThread()-err=%d", - err ) - - return err; - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::ThreadFunction() -// -// ---------------------------------------------------------------------------- -TInt CFileManagerThreadWrapper::ThreadFunction( TAny* ptr ) - { - FUNC_LOG - - CFileManagerThreadWrapper* self = - static_cast< CFileManagerThreadWrapper* >( ptr ); - - CTrapCleanup* cleanupStack = CTrapCleanup::New(); - if ( !cleanupStack ) - { - return KErrNoMemory; - } - - TRAPD( err, self->ThreadFunctionL() ); - - self->iFunction->ReleaseThread(); - - delete cleanupStack; - - return err; - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::ThreadFunctionL() -// -// ---------------------------------------------------------------------------- -void CFileManagerThreadWrapper::ThreadFunctionL() - { - FUNC_LOG - - iFunction->InitThreadL(); - - while ( !iCancel ) - { - TRAPD( err, iFunction->ThreadStepL() ); - - if ( !iCancel ) - { - if ( err != KErrNone && - ( iNotify & MFileManagerThreadFunction::ENotifyError ) ) - { - User::LeaveIfError( NotifyClientAndWaitConfirm( err ) ); - } - else if ( iNotify & - MFileManagerThreadFunction::ENotifyStepFinished ) - { - User::LeaveIfError( NotifyClientAndWaitConfirm( err ) ); - } - else - { - User::LeaveIfError( err ); - } - } - if ( iFunction->IsThreadDone() ) - { - break; - } - } - - if ( iCancel ) - { - User::LeaveIfError( KErrCancel ); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::CancelThread() -// -// ---------------------------------------------------------------------------- -void CFileManagerThreadWrapper::CancelThread() - { - FUNC_LOG - - iCancel = ETrue; - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::IsThreadCanceled() -// -// ---------------------------------------------------------------------------- -TBool CFileManagerThreadWrapper::IsThreadCanceled() const - { - return iCancel; - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::NotifyClientAndWaitConfirm() -// -// ---------------------------------------------------------------------------- -TInt CFileManagerThreadWrapper::NotifyClientAndWaitConfirm( TInt aErr ) - { - FUNC_LOG - - RThread client; - TInt err( client.Open( iClientId ) ); - - if ( err == KErrNone ) - { - iNotifyObserver->Complete( client, aErr ); - client.Close(); - iSemaphore.Wait(); // Wait resume from client - } - return err; - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::ResumeThread() -// -// ---------------------------------------------------------------------------- -void CFileManagerThreadWrapper::ResumeThread() - { - FUNC_LOG - - if ( !iNotifyObserver->IsActive() && iResumePending ) - { - iResumePending = EFalse; - iNotifyObserver->Activate(); - iSemaphore.Signal(); // Resume thread stepping - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::IsThreadStarted() -// -// ---------------------------------------------------------------------------- -TBool CFileManagerThreadWrapper::IsThreadStarted() const - { - return IsActive(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::CNotifyObserver::CNotifyObserver() -// -// ---------------------------------------------------------------------------- -CFileManagerThreadWrapper::CNotifyObserver::CNotifyObserver( - CFileManagerThreadWrapper& aWrapper ) : - CActive( CActive::EPriorityStandard ), - iWrapper( aWrapper ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::CNotifyObserver::NewL() -// -// ---------------------------------------------------------------------------- -CFileManagerThreadWrapper::CNotifyObserver* - CFileManagerThreadWrapper::CNotifyObserver::NewL( - CFileManagerThreadWrapper& aWrapper ) - { - CNotifyObserver* self = new (ELeave) CNotifyObserver( aWrapper ); - CActiveScheduler::Add( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::CNotifyObserver::~CNotifyObserver() -// -// ---------------------------------------------------------------------------- -CFileManagerThreadWrapper::CNotifyObserver::~CNotifyObserver() - { - Cancel(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::CNotifyObserver::RunL() -// -// ---------------------------------------------------------------------------- -void CFileManagerThreadWrapper::CNotifyObserver::RunL() - { - iWrapper.DoNotifyL( iStatus.Int() ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::CNotifyObserver::RunError() -// -// ---------------------------------------------------------------------------- -TInt CFileManagerThreadWrapper::CNotifyObserver::RunError( TInt aErr ) - { - return iWrapper.RunError( aErr ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::CNotifyObserver::DoCancel() -// -// ---------------------------------------------------------------------------- -void CFileManagerThreadWrapper::CNotifyObserver::DoCancel() - { - // Just complete status immediately since - // background thread does not complete status anymore - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrCancel ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::CNotifyObserver::Activate() -// -// ---------------------------------------------------------------------------- -void CFileManagerThreadWrapper::CNotifyObserver::Activate() - { - if ( !IsActive() ) - { - iStatus = KRequestPending; - SetActive(); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerThreadWrapper::CNotifyObserver::Complete() -// -// ---------------------------------------------------------------------------- -void CFileManagerThreadWrapper::CNotifyObserver::Complete( - RThread& aThread, TInt aResult ) - { - if ( IsActive() ) - { - TRequestStatus* status = &iStatus; - aThread.RequestComplete( status, aResult ); - } - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFileManagerUtils.cpp --- a/filemanager/Engine/src/CFileManagerUtils.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1127 +0,0 @@ -/* -* Copyright (c) 2002-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: Util methods for File Manager -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef RD_MULTIPLE_DRIVE -#include -#endif // RD_MULTIPLE_DRIVE -#if defined( __KEEP_DRM_CONTENT_ON_PHONE ) && defined ( FILE_MANAGER_USE_DISTRIBUTABLECHECKER ) - #include -#endif // __KEEP_DRM_CONTENT_ON_PHONE && FILE_MANAGER_USE_DISTRIBUTABLECHECKER -#include "GflmUtils.h" -#include -#include "CFileManagerUtils.h" -#include "CFilemanagerMimeIconArray.h" -#include "Cfilemanagerfolderarray.h" -#include "CGflmNavigatorModel.h" -#include "CFileManagerItemProperties.h" -#include "CFileManagerCommonDefinitions.h" -#include "CGflmGroupItem.h" -#include "CGflmFileSystemItem.h" -#include "CGflmDriveItem.h" -#include "CFileManagerFeatureManager.h" - -// CONSTANTS -_LIT( KFlk, "flk:" ); -_LIT( KLdf, "ldf:" ); - -#ifdef RD_MULTIPLE_DRIVE -const TInt KDriveNameArrayLen = 2; -const TInt KDriveLetterIndex = 0; -const TInt KDriveNameIndex = 1; -enum TFmgrDriveNameType - { - EFmgrDeviceMemory = 0, - EFmgrMassStorage, - EFmgrNamedMemoryCard, - EFmgrDefaultMemoryCard, - EFmgrDefaultUsbMemory, - EFmgrDriveNameTypeCount // Must be the last - }; - -typedef TInt TFmgrDriveNameLayoutText[ EFmgrDriveNameTypeCount ]; -const TFmgrDriveNameLayoutText KFmgrDriveNames[] = -{ - { // CFileManagerUtils::EMainLayout - R_QTN_FMGR_MAIN_DEVICE_MEMORY, // EFmgrDeviceMemory - R_QTN_FMGR_MAIN_MASS_STORAGE, // EFmgrMassStorage - R_QTN_FMGR_MAIN_NAMED_MEMORY_CARD, // EFmgrNamedMemoryCard - R_QTN_FMGR_MAIN_MEMORY_CARD_DEFAULT, // EFmgrDefaultMemoryCard - R_QTN_FMGR_MAIN_USB_DEFAULT // EFmgrDefaultUsbMemory - }, - { // CFileManagerUtils::ETitleLayout - R_QTN_FMGR_TITLE_DEVICE_MEMORY, // EFmgrDeviceMemory - R_QTN_FMGR_TITLE_MASS_STORAGE, // EFmgrMassStorage - R_QTN_FMGR_TITLE_NAMED_MEMORY_CARD, // EFmgrNamedMemoryCard - R_QTN_FMGR_TITLE_MEMORY_CARD_DEFAULT, // EFmgrDefaultMemoryCard - R_QTN_FMGR_TITLE_USB_DEFAULT, // EFmgrDefaultUsbMemory - } -}; -#endif // RD_MULTIPLE_DRIVE - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::CFileManagerUtils -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerUtils::CFileManagerUtils( - RFs& aFs, - CGflmNavigatorModel& aNavigator, - CFileManagerFeatureManager& aFeatureManager ) : - iFs( aFs ), - iNavigator( aNavigator ), - iFeatureManager( aFeatureManager ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CFileManagerUtils::ConstructL() - { - // Check and set value to indicate if the feature is supported - iDrmFullSupported = iFeatureManager.IsDrmFullSupported(); - - iMimeIconMapper = CFileManagerMimeIconArray::NewL( - R_FILEMANAGER_MIME_ICON_MAPPER, iNavigator ); - -#ifdef RD_MULTIPLE_DRIVE - iDefaultFolders = CFileManagerFolderArray::NewL( *this ); -#else // RD_MULTIPLE_DRIVE - iDefaultFolders = CFileManagerFolderArray::NewL( - R_FILEMANAGER_DEFAULT_FOLDERS, *this ); - iDefaultFolders->CreateFolders(); -#endif // RD_MULTIPLE_DRIVE - - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CFileManagerUtils* CFileManagerUtils::NewL( - RFs& aFs, - CGflmNavigatorModel& aNavigator, - CFileManagerFeatureManager& aFeatureManager ) - { - CFileManagerUtils* self = - new( ELeave ) CFileManagerUtils( aFs, aNavigator, aFeatureManager ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::~CFileManagerUtils -// -// ----------------------------------------------------------------------------- -// -CFileManagerUtils::~CFileManagerUtils() - { -#if defined( __KEEP_DRM_CONTENT_ON_PHONE ) && defined ( FILE_MANAGER_USE_DISTRIBUTABLECHECKER ) - delete iDistributableChecker; -#endif // __KEEP_DRM_CONTENT_ON_PHONE && FILE_MANAGER_USE_DISTRIBUTABLECHECKER - delete iMimeIconMapper; - delete iDefaultFolders; - delete iCommonContentPolicy; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::Fs() const -// -// ----------------------------------------------------------------------------- -// -RFs& CFileManagerUtils::Fs() const - { - return iFs; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::IsForwardLockedFile -// ----------------------------------------------------------------------------- -// -TBool CFileManagerUtils::IsForwardLockedFile( const TDesC& aFullPath ) - { - if ( iDrmFullSupported ) - { - return EFalse; // Full DRM is used - } - TBool ret( EFalse ); - - if ( !iCommonContentPolicy ) - { - TRAPD( err, iCommonContentPolicy = CCommonContentPolicy::NewL() ); - if ( err != KErrNone ) - { - _LIT( KReason, "No Common Content Policy" ); - User::Panic( KReason, err ); - } - } - - if( iCommonContentPolicy ) - { - TRAPD( err, ret = iCommonContentPolicy->IsClosedFileL( aFullPath ) ); - if ( err != KErrNone ) - { - ret = EFalse; - } - } - - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::IsDrmProtectedFile -// ----------------------------------------------------------------------------- -// -TBool CFileManagerUtils::IsDrmProtectedFileL( const TDesC& aFullPath ) const - { - if ( !iDrmFullSupported ) - { - return EFalse; // Partial DRM is used - } -#if 0 - // Check from file extension, this is the fastest possible check - _LIT( KOdfExt, ".odf" ); - _LIT( KDcfExt, ".dcf" ); - TParsePtrC parse( aFullPath ); - TPtrC ext( parse.Ext() ); - return ( !ext.CompareF( KOdfExt ) || !ext.CompareF( KDcfExt ) ); -#else - // Do similar quick check than in old DRMCommon - - RFile64 drmFile; - - TInt err = drmFile.Open( - iFs, aFullPath, EFileRead | EFileShareReadersOrWriters ); - if( err != KErrNone ) - { - // Just assume it is not protected when we fail to open it. - drmFile.Close(); - return EFalse; - } - CleanupClosePushL( drmFile ); - DRM::CDrmUtility *drmCheck = DRM::CDrmUtility::NewLC(); - - TBool isProtected( EFalse ); - TRAP_IGNORE( isProtected = drmCheck->IsProtectedL( drmFile ) ); - - CleanupStack::PopAndDestroy( drmCheck ); - CleanupStack::PopAndDestroy( &drmFile ); - - return isProtected; -#endif - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::ResolveIconL -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerUtils::ResolveIconL( const TDesC& aFullPath ) const - { - TInt iconId( EFileManagerOtherFileIcon ); - if ( HasFinalBackslash( aFullPath ) ) - { - // Do not check for subfolders for remote drives - iconId = EFileManagerFolderIcon; - if ( !IsRemoteDrive( aFullPath ) ) - { - if ( HasSubFolders( aFullPath ) ) - { - iconId = EFileManagerFolderSubIcon; - } - else if ( !HasFiles( aFullPath ) ) - { - iconId = EFileManagerFolderEmptyIcon; - } - } - } - else - { - iconId = iMimeIconMapper->ResolveIconL( aFullPath ); - } - return iconId; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::DefaultFolder -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerUtils::DefaultFolder( const TDesC& aFullPath ) const - { - return iDefaultFolders->Contains( aFullPath ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::IsDrmLocalDataFile -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerUtils::IsDrmLocalDataFile( const TDesC& aFullPath ) const - { - if ( !iDrmFullSupported ) - { - return EFalse; // Partial DRM is used - } - - TBool isFlk( EFalse ); - TBool isLdf( EFalse ); - TRAP_IGNORE( IsFlkOrLdfFileL( aFullPath, isFlk, isLdf ) ); - return isLdf; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::CanDelete -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerUtils::CanDelete( const TDesC& aFileName ) const - { - TEntry entry; - TBool ret( EFalse ); - TBool fileOpen( EFalse ); - if ( KErrNone == iFs.Entry( aFileName, entry ) && - KErrNone == iFs.IsFileOpen( aFileName, fileOpen ) ) - { - if ( !entry.IsReadOnly() && !entry.IsSystem() && !fileOpen ) - { - ret = ETrue; - } - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::FileTypeL -// -// ----------------------------------------------------------------------------- -// -TUint32 CFileManagerUtils::FileTypeL( const TDesC& aFullPath ) - { - TUint32 fileType( CFileManagerItemProperties::ENotDefined ); - - _LIT( KRootFolder, "?:\\" ); - if ( !aFullPath.MatchF( KRootFolder ) ) - { - // RFs::Entry cannot be used for root folders - fileType |= CFileManagerItemProperties::EFolder; - } - else if ( !IsRemoteDrive( aFullPath ) ) - { - // Full check for local and removable drives - TEntry entry; - User::LeaveIfError( iFs.Entry( aFullPath, entry ) ); - - if ( HasFinalBackslash( aFullPath ) || entry.IsDir() ) - { - fileType |= CFileManagerItemProperties::EFolder; - - if ( DefaultFolder( aFullPath ) ) - { - fileType |= CFileManagerItemProperties::EDefault; - } - } - else - { - fileType |= CFileManagerItemProperties::EFile; - - if ( IsDrmProtectedFileL( aFullPath) ) - { - fileType |= CFileManagerItemProperties::EDrmProtected; - if ( IsDrmLocalDataFile( aFullPath ) ) - { - fileType |= CFileManagerItemProperties::EDrmLocalDataFile; - } - } - if ( IsForwardLockedFile( aFullPath ) ) - { - fileType |= CFileManagerItemProperties::EForwardLocked; - } - // MimeIcon mapper knowledge is used to determine file type - TInt id( iMimeIconMapper->ResolveIconL( aFullPath ) ); - if ( id == EFileManagerLinkFileIcon ) - { - fileType |= CFileManagerItemProperties::ELink; - } - if ( id == EFileManagerPlaylistFileIcon ) - { - fileType |= CFileManagerItemProperties::EPlaylist; - } - - TBool fileOpen( EFalse ); - if ( iFs.IsFileOpen( aFullPath, fileOpen ) == KErrNone ) - { - if ( fileOpen ) - { - fileType |= CFileManagerItemProperties::EOpen; - } - } - if ( fileOpen || entry.IsReadOnly() || entry.IsSystem() ) - { - fileType |= CFileManagerItemProperties::EReadOnly; - } - } - } - else - { - // Simple check for remote drives - if ( HasFinalBackslash( aFullPath ) ) - { - fileType |= CFileManagerItemProperties::EFolder; - } - else - { - fileType |= CFileManagerItemProperties::EFile; - } - } - - return fileType; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::ResolveIconL -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerUtils::ResolveIconL( CGflmGroupItem& aItem ) const - { - TInt iconId( EFileManagerOtherFileIcon ); - if ( aItem.GetIconId( iconId ) == KErrNone ) - { - // Use already mapped icon - return iconId; - } - - // Map icon - switch ( aItem.Type() ) - { - case CGflmGroupItem::EFile: - { - CGflmFileSystemItem& fsItem = - static_cast< CGflmFileSystemItem& >( aItem ); - HBufC* fullPath = fsItem.FullPathLC(); - iconId = iMimeIconMapper->ResolveIconL( *fullPath ); - fsItem.SetIconId( iconId ); - CleanupStack::PopAndDestroy( fullPath ); - break; - } - case CGflmGroupItem::EDirectory: - { - CGflmFileSystemItem& fsItem = - static_cast< CGflmFileSystemItem& >( aItem ); - HBufC* fullPath = fsItem.FullPathLC(); - - // Do not check for subfolders for remote drives - iconId = EFileManagerFolderIcon; - if ( !IsRemoteDrive( *fullPath ) ) - { - if ( HasSubFolders( *fullPath ) ) - { - iconId = EFileManagerFolderSubIcon; - } - else if ( !HasFiles( *fullPath ) ) - { - iconId = EFileManagerFolderEmptyIcon; - } - } - fsItem.SetIconId( iconId ); - CleanupStack::PopAndDestroy( fullPath ); - break; - } - case CGflmGroupItem::EDrive: // Fall through - case CGflmGroupItem::EGlobalActionItem: - { - break; - } - default: - { - User::Leave( KErrNotFound ); - break; - } - } - - return iconId; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::HasAny -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerUtils::HasAny( - RFs& aFs, const TDesC& aFullPath, TUint aAttMask ) - { - RDir dir; - TBool ret( EFalse ); - if ( dir.Open( aFs, aFullPath, aAttMask ) != KErrNone ) - { - return EFalse; - } - TEntry entry; - if ( dir.Read( entry ) == KErrNone ) - { - ret = ETrue; - } - dir.Close(); - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::HasSubFolders -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerUtils::HasSubFolders( const TDesC& aFullPath ) const - { - return HasAny( iFs, aFullPath, KEntryAttDir | KEntryAttMatchExclusive ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::HasFiles -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerUtils::HasFiles( const TDesC& aFullPath ) const - { - return HasAny( iFs, aFullPath, KEntryAttNormal ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::IsRemoteDrive -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerUtils::IsRemoteDrive( const TDesC& aPath ) const - { - TBool ret( EFalse ); - - if ( aPath.Length() ) - { - CGflmDriveItem* drvItem = iNavigator.DriveFromPath( aPath ); - if ( drvItem ) - { - const TVolumeInfo& vol( drvItem->VolumeInfo() ); - if ( vol.iDrive.iDriveAtt & KDriveAttRemote ) - { - ret = ETrue; - } - } - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::CreateDefaultFolders -// -// ----------------------------------------------------------------------------- -// -void CFileManagerUtils::CreateDefaultFolders( - const TInt aDrive, const TBool aForced ) const - { - iDefaultFolders->CreateFolders( aDrive, aForced ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::IsDistributableFile -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerUtils::IsDistributableFile( - const TDesC& aFullPath, TBool& aIsProtected ) - { -#if defined( __KEEP_DRM_CONTENT_ON_PHONE ) && defined ( FILE_MANAGER_USE_DISTRIBUTABLECHECKER ) - if ( !iDistributableChecker ) - { - TRAPD( err, iDistributableChecker = CDistributableChecker::NewL() ); - if ( err != KErrNone ) - { - _LIT( KReason, "No Distributablechecker" ); - User::Panic( KReason, err ); - } - } - return iDistributableChecker->Check( aFullPath, aIsProtected ); -#else // __KEEP_DRM_CONTENT_ON_PHONE && FILE_MANAGER_USE_DISTRIBUTABLECHECKER - aIsProtected = EFalse; - TBool isFlk( EFalse ); - TBool isLdf( EFalse ); - TRAPD( err, IsFlkOrLdfFileL( aFullPath, isFlk, isLdf ) ); - // Do similar check than in old DRMCommon - aIsProtected = ( isFlk || isLdf ); - return err; -#endif // __KEEP_DRM_CONTENT_ON_PHONE && FILE_MANAGER_USE_DISTRIBUTABLECHECKER - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::MimeTypeL -// -// ----------------------------------------------------------------------------- -// -TPtrC CFileManagerUtils::MimeTypeL( const TDesC& aFullPath ) const - { - return iNavigator.ResolveMimeTypeL( aFullPath ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::DriveList -// -// ----------------------------------------------------------------------------- -// -void CFileManagerUtils::DriveList( - RArray< TInt >& aDrives, const TInt aAttMask ) const - { - aDrives.Reset(); - TDriveList drivesList; - if ( iFs.DriveList( drivesList ) != KErrNone ) - { - return; - } - for ( TInt i( 0 ); i < KMaxDrives; i++ ) - { - if ( drivesList[ i ] ) - { - TBool append( EFalse ); - TDriveInfo drvInfo; - if ( iFs.Drive( drvInfo, i ) == KErrNone ) - { - if ( drvInfo.iDriveAtt & aAttMask ) - { - append = ETrue; - } - } - if ( append ) - { - aDrives.Append( i ); - } - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::IsRemovableDrive -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerUtils::IsRemovableDrive( const TDesC& aPath ) const - { - return IsDrive( iFs, aPath, KDriveAttRemovable ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::GetFullPath -// ----------------------------------------------------------------------------- -// -void CFileManagerUtils::GetFullPath( - const TDesC& aDir, const TEntry& aEntry, TDes& aFullPath ) - { - GflmUtils::GetFullPath( aDir, aEntry, aFullPath ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::StripFinalBackslash -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CFileManagerUtils::StripFinalBackslash( const TDesC& aPath ) - { - return GflmUtils::StripFinalBackslash( aPath ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::EnsureFinalBackslash -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerUtils::EnsureFinalBackslash( TDes& aPath ) - { - GflmUtils::EnsureFinalBackslash( aPath ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::StripDirectionalCharsLC -// ----------------------------------------------------------------------------- -// -HBufC* CFileManagerUtils::StripDirectionalCharsLC( const TDesC& aText ) - { - HBufC* text = aText.AllocLC(); - TPtr ptr( text->Des() ); - AknTextUtils::StripCharacters( ptr, KFmgrDirectionalChars ); - return text; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::IsFlkOrLdfFileL -// ----------------------------------------------------------------------------- -// -void CFileManagerUtils::IsFlkOrLdfFileL( - const TDesC& aFullPath, TBool& aIsFlk, TBool& aIsLdf ) - { - aIsFlk = EFalse; - aIsLdf = EFalse; - ContentAccess::CContent* content = - ContentAccess::CContent::CContent::NewLC( - aFullPath, EContentShareReadOnly ); - HBufC* contentId = HBufC::NewLC( KMaxFileName ); - TPtr ptrContentId( contentId->Des() ); - TInt err( content->GetStringAttribute( - ContentAccess::EContentID, ptrContentId ) ); - if ( err != KErrNone && err != KErrCANotSupported ) - { - User::Leave( err ); - } - if ( !ptrContentId.Left( KFlk().Length() ).Compare( KFlk ) ) - { - aIsFlk = ETrue; - } - else if ( !ptrContentId.Left( KLdf().Length() ).Compare( KLdf ) ) - { - aIsLdf = ETrue; - } - CleanupStack::PopAndDestroy( contentId ); - CleanupStack::PopAndDestroy( content ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::HasFinalBackslash -// ----------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerUtils::HasFinalBackslash( const TDesC& aPath ) - { - return GflmUtils::HasFinalBackslash( aPath ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::IsInternalDrive -// ----------------------------------------------------------------------------- -// -TBool CFileManagerUtils::IsInternalDrive( RFs& aFs, const TInt aDrive ) - { - return IsDrive( aFs, aDrive, KDriveAttInternal ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::IsFromInternalToRemovableDrive -// ----------------------------------------------------------------------------- -// -EXPORT_C TBool CFileManagerUtils::IsFromInternalToRemovableDrive( - RFs& aFs, const TDesC& aSrcPath, const TDesC& aDstPath ) - { - TInt srcDrv = TDriveUnit( aSrcPath ); - TInt dstDrv = TDriveUnit( aDstPath ); - if ( srcDrv == dstDrv ) - { - return EFalse; - } - return ( IsInternalDrive( aFs, srcDrv ) && - !IsInternalDrive( aFs, dstDrv ) ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::RemoveReadOnlyAttribute -// ----------------------------------------------------------------------------- -// -TInt CFileManagerUtils::RemoveReadOnlyAttribute( - RFs& aFs, const TDesC& aFullPath, const TEntry& aEntry ) - { - TInt ret( KErrNone ); - if( aEntry.IsReadOnly() ) - { - ret = aFs.SetEntry( - aFullPath, aEntry.iModified, 0, KEntryAttReadOnly ); - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::RemoveReadOnlyAttribute -// ----------------------------------------------------------------------------- -// -TInt CFileManagerUtils::RemoveReadOnlyAttribute( - RFs& aFs, const TDesC& aFullPath ) - { - TEntry entry; - TInt ret( aFs.Entry( aFullPath, entry ) ); - if ( ret == KErrNone ) - { - ret = RemoveReadOnlyAttribute( aFs, aFullPath, entry ); - } - return ret; - } - -#ifdef RD_MULTIPLE_DRIVE -// ----------------------------------------------------------------------------- -// CFileManagerUtils::GetDriveNameArrayLC -// ----------------------------------------------------------------------------- -// -CDesCArray* CFileManagerUtils::GetDriveNameArrayLC( - const TInt aDrive, TUint& aDriveStatus ) const - { - CGflmDriveItem* drvItem = iNavigator.DriveFromId( aDrive ); - if ( !drvItem ) - { - User::Leave( KErrNotFound ); - } - aDriveStatus = drvItem->DriveStatus(); - CDesCArray* ret = new( ELeave ) CDesCArrayFlat( KDriveNameArrayLen ); - CleanupStack::PushL( ret ); - ret->AppendL( TDriveUnit( aDrive ).Name() ); - - if ( aDriveStatus & DriveInfo::EDriveInternal ) - { - // Device memory and mass storage drives - return ret; - } - // Other drives - TPtrC drvName( drvItem->Name() ); - if ( drvName.Length() ) - { - ret->AppendL( drvName ); - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::GetDriveNameL -// ----------------------------------------------------------------------------- -// -HBufC* CFileManagerUtils::GetDriveNameL( - const TInt aDrive, const TDriveNameLayout aLayout ) const - { - if ( aLayout < 0 || aLayout >= ELayoutCount ) - { - User::Leave( KErrArgument ); - } - TUint driveStatus( 0 ); - CDesCArray* array = GetDriveNameArrayLC( aDrive, driveStatus ); - HBufC* ret = NULL; - if ( driveStatus & DriveInfo::EDriveInternal ) - { - // Device memory and mass storage drives - if ( driveStatus & DriveInfo::EDriveExternallyMountable ) - { - ret = StringLoader::LoadL( - KFmgrDriveNames[ aLayout ][ EFmgrMassStorage ], - array->MdcaPoint( KDriveLetterIndex ) ); - } - else - { - ret = StringLoader::LoadL( - KFmgrDriveNames[ aLayout ][ EFmgrDeviceMemory ], - array->MdcaPoint( KDriveLetterIndex ) ); - } - } - else if ( driveStatus & DriveInfo::EDriveRemovable ) - { - // Physically removable drives - if ( array->MdcaCount() > 1 ) - { - ret = StringLoader::LoadL( - KFmgrDriveNames[ aLayout ][ EFmgrNamedMemoryCard ], - *array ); - } - else - { - TInt driveType( EFmgrDefaultMemoryCard ); - if ( driveStatus & DriveInfo::EDriveUsbMemory ) - { - driveType = EFmgrDefaultUsbMemory; - } - ret = StringLoader::LoadL( - KFmgrDriveNames[ aLayout ][ driveType ], - array->MdcaPoint( KDriveLetterIndex ) ); - } - } - else if ( array->MdcaCount() > 1 ) - { - // Other drives - ret = array->MdcaPoint( KDriveNameIndex ).AllocL(); - } - else - { - User::Leave( KErrNotFound ); - } - CleanupStack::PopAndDestroy( array ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::GetFormattedDriveNameLC -// ----------------------------------------------------------------------------- -// -HBufC* CFileManagerUtils::GetFormattedDriveNameLC( - const TInt aDrive, - const TInt aTextIdForDefaultName, - const TInt aTextIdForName ) const - { - TUint driveStatus( 0 ); - HBufC* ret = NULL; - CDesCArray* array = GetDriveNameArrayLC( aDrive, driveStatus ); - if ( aTextIdForName && array->MdcaCount() > 1 ) - { - ret = StringLoader::LoadL( - aTextIdForName, - *array ); - } - else if ( aTextIdForDefaultName ) - { - if( driveStatus & DriveInfo::EDriveUsbMemory ) - { - CDesCArray* usbLetterName = new ( ELeave ) CDesCArrayFlat( KDriveNameArrayLen ); - CleanupStack::PushL( usbLetterName ); - - TPtrC16 driveletter=array->MdcaPoint( KDriveLetterIndex ); - usbLetterName->AppendL( driveletter ); - HBufC* usbDriveDefaultName = NULL; - if(array->MdcaCount() > 1 ) - { - TPtrC16 drivename=array->MdcaPoint( KDriveNameIndex ); - usbLetterName->AppendL( drivename ); - } - else - { - usbDriveDefaultName = StringLoader::LoadLC( R_QTN_FMGR_USB_MEMORY_DEFAULT_NAME ); - TPtrC16 drivename = usbDriveDefaultName->Des(); - usbLetterName->AppendL( drivename ); - } - - - ret = StringLoader::LoadL( - aTextIdForDefaultName,*usbLetterName ); - - CleanupStack::PopAndDestroy( usbLetterName ); - if ( usbDriveDefaultName ) - { - CleanupStack::PopAndDestroy( usbDriveDefaultName ); - } - } - else - { - ret = StringLoader::LoadL(aTextIdForDefaultName, array->MdcaPoint( - KDriveLetterIndex)); - } - } - else if ( array->MdcaCount() > 1 ) - { - ret = array->MdcaPoint( KDriveNameIndex ).AllocL(); - } - else - { - User::Leave( KErrNotFound ); - } - CleanupStack::PopAndDestroy( array ); - CleanupStack::PushL( ret ); - return ret; - } - -#endif // RD_MULTIPLE_DRIVE - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::IsRemoteDrive -// ----------------------------------------------------------------------------- -EXPORT_C TBool CFileManagerUtils::IsRemoteDrive( - RFs& aFs, const TDesC& aPath ) - { - return IsDrive( aFs, aPath, KDriveAttRemote ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::IsDrive -// ----------------------------------------------------------------------------- -TBool CFileManagerUtils::IsDrive( - RFs& aFs, const TDesC& aPath, const TUint aAttMask ) - { - TInt drv( 0 ); - if ( aPath.Length() && - RFs::CharToDrive( aPath[ 0 ], drv ) == KErrNone ) - { - return IsDrive( aFs, drv, aAttMask ); - } - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::IsDrive -// ----------------------------------------------------------------------------- -TBool CFileManagerUtils::IsDrive( - RFs& aFs, const TInt aDrive, const TUint aAttMask ) - { - TDriveInfo drvInfo; - if ( aFs.Drive( drvInfo, aDrive ) == KErrNone ) - { - if ( drvInfo.iDriveAtt & aAttMask ) - { - return ETrue; - } - } - return EFalse; - } - -// ------------------------------------------------------------------------------ -// CFileManagerUtils::LocalizedName -// -// ------------------------------------------------------------------------------ -// -TPtrC CFileManagerUtils::LocalizedName( const TDesC& aFullPath ) const - { - return iNavigator.LocalizedName( aFullPath ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerUtils::IsNameFoundL -// ----------------------------------------------------------------------------- -// -TBool CFileManagerUtils::IsNameFoundL( const TDesC& aFullPath ) const - { - TParsePtrC parse( CFileManagerUtils::StripFinalBackslash( aFullPath ) ); - TPtrC baseDir( parse.DriveAndPath() ); - TPtrC currentDir( iNavigator.CurrentDirectory() ); - TBool ret( EFalse ); - HBufC* name1 = CFileManagerUtils::StripDirectionalCharsLC( parse.NameAndExt() ); - // Remove white spaces from end, file server also ignores those - name1->Des().TrimRight(); - if ( !parse.PathPresent() || - ( currentDir.Length() && !currentDir.CompareF( baseDir ) ) ) - { - TBool searchmode = iNavigator.SearchMode(); - iNavigator.EnableSearchMode( EFalse ); - // Do check from current directory, all items are cached - TInt count( iNavigator.MdcaCount() ); - for( TInt i( 0 ); i < count; ++i ) - { - CGflmGroupItem* item = iNavigator.Item( i ); - TInt itemType( item->Type() ); - switch (itemType ) - { - case CGflmGroupItem::EFile: // FALLTHROUGH - case CGflmGroupItem::EDirectory: - { - // Compare with file system name - CGflmFileSystemItem* fsItem = - static_cast< CGflmFileSystemItem* >( item ); - HBufC* name2 = CFileManagerUtils::StripDirectionalCharsLC( - fsItem->Entry().iName ); - ret = !( name1->CompareF( *name2 ) ); - CleanupStack::PopAndDestroy( name2 ); - if ( !ret && itemType == CGflmGroupItem::EDirectory ) - { - // Compare with localized name - name2 = CFileManagerUtils::StripDirectionalCharsLC( - fsItem->Name() ); - if ( name2->Length() ) - { - ret = !( name1->CompareF( *name2 ) ); - } - CleanupStack::PopAndDestroy( name2 ); - } - break; - } - default: - { - break; - } - } - if ( ret ) - { - break; - } - } - iNavigator.EnableSearchMode( searchmode ); - } - else - { - // Do check from any directory - HBufC* buffer = HBufC::NewLC( - Max( KMaxFileName, aFullPath.Length() + KFmgrBackslashSpace ) ); - TPtr ptr( buffer->Des() ); - ptr.Copy( aFullPath ); - CFileManagerUtils::EnsureFinalBackslash( ptr ); - ret = ( BaflUtils::FolderExists( iFs, ptr ) || - BaflUtils::FileExists( iFs, - CFileManagerUtils::StripFinalBackslash( aFullPath ) ) ); - if ( !ret && - !IsRemoteDrive( aFullPath ) && - BaflUtils::PathExists( iFs, baseDir ) ) - { - // Check directory for localized items on local drives - CDir* dir = NULL; - User::LeaveIfError( iFs.GetDir( - baseDir, KEntryAttMatchMask | KEntryAttNormal, ESortNone, dir ) ); - CleanupStack::PushL( dir ); - ptr.Zero(); - TInt count( dir->Count() ); - for ( TInt i ( 0 ); i < count; ++i ) - { - HBufC* name2 = NULL; - const TEntry& entry( ( *dir )[ i ] ); - if( entry.IsDir() ) - { - // Compare with localized name - CFileManagerUtils::GetFullPath( baseDir, entry, ptr ); - TPtrC ptr2( iNavigator.LocalizedName( ptr ) ); - if ( ptr2.Length() ) - { - name2 = CFileManagerUtils::StripDirectionalCharsLC( ptr2 ); - } - } - if ( !name2 ) - { - // Compare with file system name - name2 = CFileManagerUtils::StripDirectionalCharsLC( entry.iName ); - } - ret = !( name1->CompareF( *name2 ) ); - CleanupStack::PopAndDestroy( name2 ); - if ( ret ) - { - break; - } - } - CleanupStack::PopAndDestroy( dir ); - } - CleanupStack::PopAndDestroy( buffer ); - } - CleanupStack::PopAndDestroy( name1 ); - return ret; - } -// ----------------------------------------------------------------------------- -// CFileManagerUtils::FlushCache -// ----------------------------------------------------------------------------- -// -void CFileManagerUtils::FlushCache() const - { - iNavigator.FlushCache(); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CFilemanagerMimeIconArray.cpp --- a/filemanager/Engine/src/CFilemanagerMimeIconArray.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Maps the mime or file extension to icon -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include "CFilemanagerMimeIconArray.h" -#include "CGflmNavigatorModel.h" -#include "CDirectoryLocalizer.h" -#include "CFileManagerCommonDefinitions.h" - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerMimeIconArray::NewL -// -// ----------------------------------------------------------------------------- -// -CFileManagerMimeIconArray* CFileManagerMimeIconArray::NewL( - TInt aResId, CGflmNavigatorModel& aNavigator ) - { - CFileManagerMimeIconArray* self = new( ELeave ) - CFileManagerMimeIconArray( aNavigator ); - - CleanupStack::PushL( self ); - self->ConstructFromResourceL( aResId ); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerMimeIconArray::CFileManagerMimeIconArray -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerMimeIconArray::CFileManagerMimeIconArray( - CGflmNavigatorModel& aNavigator ) - : iNavigator( aNavigator ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerMimeIconArray::ConstructFromResourceL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerMimeIconArray::ConstructFromResourceL( TInt aResId ) - { - TResourceReader reader; - CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId ); - - TInt count( reader.ReadInt16() ); - - iArray.ReserveL( count ); - - for( TInt i( 0 ); i < count; i++ ) - { - const TPtrC mime( reader.ReadTPtrC() ); - const TInt iconId( reader.ReadInt16() ); - CMimeIconEntry* entry = CMimeIconEntry::NewLC( mime, iconId ); - iArray.AppendL( entry ); - CleanupStack::Pop( entry ); - } - - CleanupStack::PopAndDestroy(); // reader - } - -// ----------------------------------------------------------------------------- -// CFileManagerMimeIconArray::~CFileManagerMimeIconArray -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerMimeIconArray::~CFileManagerMimeIconArray() - { - iArray.ResetAndDestroy(); - iArray.Close(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerMimeIconArray::ResolveIconL -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerMimeIconArray::ResolveIconL( const TDesC& aFullPath ) - { - TPtrC fileType( iNavigator.ResolveMimeTypeL( aFullPath ) ); - TParsePtrC parse( aFullPath ); - TPtrC fileExt( parse.Ext() ); - TInt count( iArray.Count() ); - - for( TInt i( 0 ); i < count; ++i ) - { - CMimeIconEntry* entry = iArray[ i ]; - TPtrC mime( entry->iMime->Des() ); - if ( fileType.FindF( mime ) != KErrNotFound || - fileExt.FindF( mime ) != KErrNotFound ) - { - return entry->iIconId; - } - } - if ( fileType.Length() ) - { - // File is recognized, but there is no own icon defined for this type. - // Use note icon to indicate the user that file is not unsupported. - return EFileManagerNoteFileIcon; - } - return EFileManagerOtherFileIcon; - } - -//------------------------------------------------------------------------------- -// CFileManagerMimeIconArray::CMimeIconEntry::CMimeIconEntry -// -// ----------------------------------------------------------------------------- -// -CFileManagerMimeIconArray::CMimeIconEntry::CMimeIconEntry( - const TInt aIconId ) : - iIconId( aIconId ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerMimeIconArray::CMimeIconEntry::~CMimeIconEntry -// -// ----------------------------------------------------------------------------- -// -CFileManagerMimeIconArray::CMimeIconEntry::~CMimeIconEntry() - { - delete iMime; - } - -// ----------------------------------------------------------------------------- -// CFileManagerMimeIconArray::CMimeIconEntry::NewLC -// -// ----------------------------------------------------------------------------- -// -CFileManagerMimeIconArray::CMimeIconEntry* - CFileManagerMimeIconArray::CMimeIconEntry::NewLC( - const TDesC& aMime, const TInt aIconId ) - { - CMimeIconEntry* self = new( ELeave ) CMimeIconEntry( aIconId ); - CleanupStack::PushL( self ); - self->ConstructL( aMime ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerMimeIconArray::CMimeIconEntry::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerMimeIconArray::CMimeIconEntry::ConstructL( - const TDesC& aMime ) - { - iMime = aMime.AllocL(); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CfilemanagerActiveCount.cpp --- a/filemanager/Engine/src/CfilemanagerActiveCount.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,236 +0,0 @@ -/* -* Copyright (c) 2002-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: Calculates given folder size -* -*/ - - -// INCLUDE FILES -#include "CFilemanagerActiveCount.h" - -// CONSTANTS -const TInt KFileManagerProcessFilesPerCycle = 20; - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerActiveCount::CFileManagerActiveCount -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerActiveCount::CFileManagerActiveCount( RFs& aFs ) : - iFs( aFs ), - iFolders( KErrNotFound ), - iFiles( KErrNotFound), - iOpenFiles( KErrNotFound ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveCount::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CFileManagerActiveCount* CFileManagerActiveCount::NewL( - RFs& aFs, - const TDesC& aRootFolder, - const CFileManagerItemProperties::TFileManagerFileType aType - ) - { - CFileManagerActiveCount* self = new( ELeave ) CFileManagerActiveCount( - aFs ); - CleanupStack::PushL( self ); - self->ConstructL( aRootFolder, aType ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveCount::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveCount::ConstructL( - const TDesC& aRootFolder, - const CFileManagerItemProperties::TFileManagerFileType aType ) - { - - iDirScan = CDirScan::NewL( iFs ); - - if ( aType == CFileManagerItemProperties::EFolder ) - { - // Set scanning from current directory, take only folders - // No sorting needed - iDirScan->SetScanDataL( - aRootFolder, - KEntryAttDir | KEntryAttMatchExclusive, - ESortNone ); - } - else if ( aType == CFileManagerItemProperties::EFile || - aType == CFileManagerItemProperties::EOpen || - aType == CFileManagerItemProperties::EReadOnly ) - { - // Set scanning from current directory, take only file - // No sorting needed - iDirScan->SetScanDataL( - aRootFolder, - KEntryAttNormal | KEntryAttHidden | KEntryAttSystem, - ESortNone ); - } - else - { - // Set scanning from current directory, - // take file and folders except hidden and system files - // No sorting needed - iDirScan->SetScanDataL( aRootFolder, KEntryAttDir, ESortNone ); - } - - TRAPD( err, iDirScan->NextL( iDir ) ); - - if ( err == KErrNone && iDir ) - { - if ( aType == CFileManagerItemProperties::EOpen || - aType == CFileManagerItemProperties::EReadOnly ) - { - iFiles = iDir->Count(); - iOpenFiles = 0; - } - else if ( aType == CFileManagerItemProperties::EFolder ) - { - iFolders = iDir->Count(); - delete iDir; - iDir = NULL; - iProcessDone = ETrue; - } - else if ( aType == CFileManagerItemProperties::EFile ) - { - iFiles = iDir->Count(); - delete iDir; - iDir = NULL; - iProcessDone = ETrue; - } - } - - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveCount::~CFileManagerActiveCount -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerActiveCount::~CFileManagerActiveCount() - { - delete iDirScan; - delete iDir; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveCount::IsProcessDone -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerActiveCount::IsProcessDone() const - { - return iProcessDone; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveCount::StepL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveCount::StepL() - { - if( !iDir ) - { - iProcessDone = ETrue; - return; - } - - TInt processCount( KFileManagerProcessFilesPerCycle ); - while( iFileCounter < iDir->Count() && processCount ) - { - const TEntry& entry( ( *iDir )[ iFileCounter ] ); - iFileName.Copy( iDirScan->FullPath() ); - iFileName.Append( entry.iName ); - TBool fileIsOpen( EFalse ); - if ( KErrNone == iFs.IsFileOpen( iFileName, fileIsOpen ) ) - { - if ( fileIsOpen ) - { - ++iOpenFiles; - } - } - ++iFileCounter; - --processCount; - } - - if ( iFileCounter >= iDir->Count() ) - { - delete iDir; - iDir = NULL; - iDirScan->NextL( iDir ); - if ( !iDir ) - { - iProcessDone = ETrue; - } - iFileCounter = 0; - } - - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveCount::FolderCount() -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerActiveCount::FolderCount() const - { - if ( iProcessDone ) - { - return iFolders; - } - return KErrNotFound; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveCount::FileCount() -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerActiveCount::FileCount() const - { - if ( iProcessDone ) - { - return iFiles; - } - return KErrNotFound; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveCount::OpenFiles() -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerActiveCount::OpenFiles() const - { - if ( iProcessDone ) - { - return iOpenFiles; - } - return KErrNotFound; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/CfilemanageractiveDelete.cpp --- a/filemanager/Engine/src/CfilemanageractiveDelete.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,467 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Deletes files -* -*/ - - -// INCLUDE FILES -#include "Cfilemanageractivedelete.h" -#include "MFileManagerProcessObserver.h" -#include "CFileManagerEngine.h" -#include "CFileManagerCommonDefinitions.h" -#include "CFileManagerUtils.h" -#include "FileManagerDebug.h" -//#include - -// CONSTANTS -const TInt KFileManagerDeletionPerStep = 20; -const TInt64 KFileManagerMaxStepTime = 1000000; // 1s -const TInt KFileManagerNotificationArrayGranularity = 64; - - -// ============================ LOCAL FUNCTIONS ================================ -// ----------------------------------------------------------------------------- -// GetTimeStamp -// ----------------------------------------------------------------------------- -// -static TInt64 GetTimeStamp() - { - TTime time; - time.UniversalTime(); - return time.Int64(); - } - -// ----------------------------------------------------------------------------- -// IsTimedOut -// ----------------------------------------------------------------------------- -// -static TBool IsTimedOut( const TInt64& aStartTime ) - { - TInt64 time( GetTimeStamp() ); - TBool ret( time - aStartTime > KFileManagerMaxStepTime ); - if ( ret ) - { - INFO_LOG("CFileManagerActiveDelete-TimedOut"); - } - return ret; - } - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerActiveDelete::CFileManagerActiveDelete -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerActiveDelete::CFileManagerActiveDelete( - RFs& aFs, - CArrayFixFlat< TInt >& aIndexList, - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils ) : - iFs( aFs ), - iIndexList( aIndexList ), - iError( KErrNone ), - iEngine( aEngine ), - iUtils( aUtils ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveDelete::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CFileManagerActiveDelete* CFileManagerActiveDelete::NewL( - CArrayFixFlat< TInt >& aIndexList, - CFileManagerEngine& aEngine, - CFileManagerUtils& aUtils ) - { - CFileManagerActiveDelete* self = new( ELeave ) CFileManagerActiveDelete( - aEngine.Fs(), aIndexList, aEngine, aUtils ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveDelete::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveDelete::ConstructL() - { - iStringBuffer = HBufC::NewL( KMaxFileName ); - //MG2 notification object - //iMgxFileManager = &iEngine.MGXFileManagerL(); - iRemovedItems = new( ELeave ) CDesCArrayFlat( - KFileManagerNotificationArrayGranularity ); - iIsRemoteDrive = iUtils.IsRemoteDrive( iEngine.CurrentDirectory() ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveDelete::~CFileManagerActiveDelete -// Destructor -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerActiveDelete::~CFileManagerActiveDelete() - { - delete iStringBuffer; - delete iFullPath; - delete iDirScan; - delete iDir; - delete iRemovedItems; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveDelete::IsProcessDone -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerActiveDelete::IsProcessDone() const - { - return iProcessDone; - } - -// ----------------------------------------------------------------------------- -// CFileManagerEngine::DeleteItemsInDirectoryL -// ----------------------------------------------------------------------------- -// -TBool CFileManagerActiveDelete::DeleteItemsInDirectoryL() - { - if ( !iDirScan ) - { - iDirScan = CDirScan::NewL( iFs ); - // Set scanning from current directory, take all files - // No sorting needed - iDirScan->SetScanDataL( *iFullPath, - KEntryAttNormal | KEntryAttHidden | KEntryAttSystem, - ESortNone ); - } - - if ( iDir && iFileIndex < iDir->Count() ) - { - // Delete file item - const TEntry& item = ( *iDir )[ iFileIndex ]; - TPtr ptr( iStringBuffer->Des() ); - CFileManagerUtils::GetFullPath( - iDirScan->FullPath(), item, ptr ); - CFileManagerUtils::RemoveReadOnlyAttribute( iFs, ptr, item ); - DeleteFileL( ptr, ETrue ); - ++iFileIndex; - } - else - { - // Fetch next directory - delete iDir; - iDir = NULL; - iDirScan->NextL( iDir ); - iFileIndex = 0; - - if ( iDir ) - { - CFileManagerUtils::RemoveReadOnlyAttribute( - iFs, iDirScan->FullPath() ); - } - } - - if ( !iDir ) - { - // Items are deleted now, report done - if ( !iNotDeletedItems ) - { - // Delete all directories - CFileMan* fileMan = CFileMan::NewL( iFs ); - SetError( fileMan->RmDir( *iFullPath ), *iFullPath ); - delete fileMan; - } - return ETrue; - } - return EFalse; // Still items left - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveDelete::StepL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveDelete::StepL() - { - FUNC_LOG - - TInt64 startTime( GetTimeStamp() ); - TInt indexCount( iIndexList.Count() ); - TInt i( KFileManagerDeletionPerStep ); - TBool timedOut( EFalse ); - - while ( iCurrentIndex < indexCount && i && !timedOut ) - { - TBool isItemDone( EFalse ); - - // Fetch item path if missing - if ( !iFullPath ) - { - iFullPath = iEngine.IndexToFullPathL( - iIndexList.At( iCurrentIndex ) ); - if ( IsDir( *iFullPath ) ) - { - // Ignore default folders - if ( iUtils.DefaultFolder( *iFullPath ) ) - { - SetError( KErrFmgrDefaultFolder, *iFullPath ); - isItemDone = ETrue; - } - } - } - // Delete item - if ( !isItemDone ) - { - if ( IsDir( *iFullPath ) ) - { - // Delete directory item - while ( iCurrentIndex < indexCount && i && !isItemDone && !timedOut ) - { - isItemDone = DeleteItemsInDirectoryL(); - --i; - - // Adjust amount of deleted files per step by consumed time. - // This is an attempt to avoid long periods of time, - // where the UI does not respond to user activity. - timedOut = IsTimedOut( startTime ); - } - } - else - { - // Delete file item - DeleteFileL( *iFullPath ); - isItemDone = ETrue; - --i; - - // Adjust amount of deleted files per step by consumed time. - // This is an attempt to avoid long periods of time, - // where the UI does not respond to user activity. - timedOut = IsTimedOut( startTime ); - } - } - - // Move to next item if done - if ( isItemDone ) - { - delete iFullPath; - iFullPath = NULL; - ++iCurrentIndex; - } - } - - if ( iCurrentIndex >= indexCount ) - { - iProcessDone = ETrue; - FlushNotifications(); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveDelete::DialogDismissedL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveDelete::DialogDismissedL( TInt aButtonId ) - { - if ( aButtonId == EAknSoftkeyCancel ) - { - FlushNotifications(); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveDelete::GetError -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerActiveDelete::GetError( TDes& aFileName ) - { - if( iFileName.Length() > 0) - { - aFileName.Zero(); - aFileName.Append( iFileName ); - } - if ( iOpenFiles > 1 ) - { - iError = KErrFmgrSeveralFilesInUse; - } - return iError; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveDelete::DeletedDrmItems -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerActiveDelete::DeletedDrmItems(TInt& aTotalCount ) - { - aTotalCount = iDeletedItems; - return iDeletedDrmItems; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveDelete::DeleteFileL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveDelete::DeleteFileL( - const TDesC& aFullPath, const TBool aReadOnlyChecked ) - { -#ifndef RD_DRM_RIGHTS_MANAGER_REMOVAL - TBool isLocalDataFile( EFalse ); - TBool isDrmProtected( EFalse ); - if ( !iIsRemoteDrive ) - { - // Check DRM protection - isDrmProtected = iUtils.IsDrmProtectedFile( aFullPath ); - if ( isDrmProtected ) - { - isLocalDataFile = iUtils.IsDrmLocalDataFile( aFullPath ); - } - } -#endif // RD_DRM_RIGHTS_MANAGER_REMOVAL - - TInt err( iFs.Delete( aFullPath ) ); - if ( err == KErrAccessDenied && !aReadOnlyChecked ) - { - // Remove readonly and retry - TEntry entry; - if( iFs.Entry( aFullPath, entry ) == KErrNone ) - { - CFileManagerUtils::RemoveReadOnlyAttribute( - iFs, aFullPath, entry ); - err = iFs.Delete( aFullPath ); - } - } - if ( !IsError( err ) ) - { - ++iDeletedItems; - // Notification is relevant only for local drives - if ( !iIsRemoteDrive ) - { - TRAPD( err2, iRemovedItems->AppendL( aFullPath ) ); - if ( err2 != KErrNone ) - { - ERROR_LOG1( - "CFileManagerActiveExecute::DeleteFileL-NotificationAppend-err=%d", - err2 ) - } - } -#ifndef RD_DRM_RIGHTS_MANAGER_REMOVAL - // Inform deletion of DRM protected files except local data files - if( isDrmProtected && !isLocalDataFile ) - { - ++iDeletedDrmItems; - SetName( aFullPath ); - } -#endif // RD_DRM_RIGHTS_MANAGER_REMOVAL - } - else - { - // Delete failed, update error info - SetError( err, aFullPath ); - if ( err == KErrInUse ) - { - ++iOpenFiles; - } - ++iNotDeletedItems; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveDelete::IsDir -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerActiveDelete::IsDir( const TDesC& aFullPath ) - { - return CFileManagerUtils::HasFinalBackslash( aFullPath ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveDelete::SetName -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveDelete::SetName( const TDesC& aFullPath, - TBool aOverWrite ) - { - if ( !aOverWrite && iFileName.Length() ) - { - return; - } - iFileName.Zero(); - if ( aFullPath.Length() ) - { - if ( IsDir( aFullPath ) ) - { - TParsePtrC parse( aFullPath.Left( aFullPath.Length() - 1 ) ); - iFileName.Append( parse.Name() ); - } - else - { - TParsePtrC parse( aFullPath ); - iFileName.Append( parse.NameAndExt() ); - } - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveDelete::IsError -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerActiveDelete::IsError( TInt aErr ) - { - return ( aErr != KErrNone && - aErr != KErrCorrupt && - aErr != KErrNotFound && - aErr != KErrPathNotFound ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveDelete::SetError -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveDelete::SetError( TInt aErr, const TDesC& aFullPath ) - { - if ( iError == KErrNone && IsError( aErr ) ) - { - iError = aErr; - SetName( aFullPath, ETrue ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveDelete::FlushNotifications -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveDelete::FlushNotifications() - { - if ( iRemovedItems->MdcaCount() > 0 ) - { - //TRAP_IGNORE( iMgxFileManager->UpdateL( *iRemovedItems ) ); - iRemovedItems->Reset(); - } - } - -// End of file diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/Cfilemanageractivesize.cpp --- a/filemanager/Engine/src/Cfilemanageractivesize.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ -/* -* Copyright (c) 2002-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: Calculates given folder size -* -*/ - - -// INCLUDES -#include "Cfilemanageractivesize.h" - -// CONSTANTS -const TInt KFileManagerProcessFilesPerCycle = 20; - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerActiveSize::CFileManagerActiveSize -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerActiveSize::CFileManagerActiveSize( RFs& aFs ) : - iFs( aFs ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveSize::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CFileManagerActiveSize* CFileManagerActiveSize::NewL( - RFs& aFs, const TDesC& aRootFolder ) - { - CFileManagerActiveSize* self = new( ELeave ) CFileManagerActiveSize( - aFs ); - CleanupStack::PushL( self ); - self->ConstructL( aRootFolder ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveSize::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveSize::ConstructL( const TDesC& aRootFolder ) - { - iDirScan = CDirScan::NewL( iFs ); - // Set scanning from current directory, - // take files and folder including the hidden and system files - // No sorting needed - iDirScan->SetScanDataL( - aRootFolder, - KEntryAttNormal | KEntryAttHidden | KEntryAttSystem, - ESortNone ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveSize::~CFileManagerActiveSize -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerActiveSize::~CFileManagerActiveSize() - { - delete iDirScan; - delete iDir; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveSize::IsProcessDone -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerActiveSize::IsProcessDone() const - { - return iProcessDone; - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveSize::StepL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerActiveSize::StepL() - { - if ( !iDir ) - { - iDirScan->NextL( iDir ); - if( !iDir ) - { - iProcessDone = ETrue; - return; - } - } - - TInt processCount( KFileManagerProcessFilesPerCycle ); - while( iFileCounter < iDir->Count() && processCount ) - { - const TEntry& item( ( *iDir )[ iFileCounter ] ); - iSize += item.FileSize(); - ++iFileCounter; - --processCount; - } - - if ( iFileCounter >= iDir->Count() ) - { - delete iDir; - iDir = NULL; - iFileCounter = 0; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerActiveSize::GetFolderSize() -// -// ----------------------------------------------------------------------------- -// -TInt64 CFileManagerActiveSize::GetFolderSize() const - { - if( iProcessDone ) - { - return iSize; - } - return KErrNotFound; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/Cfilemanagerfilesystemevent.cpp --- a/filemanager/Engine/src/Cfilemanagerfilesystemevent.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,188 +0,0 @@ -/* -* Copyright (c) 2002-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: This AO is signaled when directory entry is added or removed -* from file system -* -*/ - - - -// INCLUDE FILES -#include -#include "Cfilemanagerfilesystemevent.h" -#include "CFileManagerEngine.h" -#include "FileManagerDebug.h" - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerFileSystemEvent::CFileManagerFileSystemEvent -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// - -CFileManagerFileSystemEvent::CFileManagerFileSystemEvent( - RFs& aFs, - CFileManagerEngine& aEngine, - TNotifyType aNotifyType ) : - CActive( CActive::EPriorityLow ), - iFs( aFs ), - iEngine( aEngine), - iNotifyType( aNotifyType ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileSystemEvent::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CFileManagerFileSystemEvent::ConstructL( const TDesC& aFullPath ) - { - CActiveScheduler::Add( this ); - - if ( aFullPath.Length() ) - { - iFullPath = aFullPath.AllocL(); - } - - Setup(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileSystemEvent::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CFileManagerFileSystemEvent* CFileManagerFileSystemEvent::NewL( - RFs& aFs, - CFileManagerEngine& aEngine, - TNotifyType aNotifyType, - const TDesC& aFullPath ) - { - CFileManagerFileSystemEvent* self = - new( ELeave ) CFileManagerFileSystemEvent( - aFs, - aEngine, - aNotifyType ); - - CleanupStack::PushL( self ); - self->ConstructL( aFullPath ); - CleanupStack::Pop( self ); - - return self; - } - -// ------------------------------------------------------------------------------ -// CFileManagerFileSystemEvent::~CFileManagerFileSystemEvent -// -// ------------------------------------------------------------------------------ -CFileManagerFileSystemEvent::~CFileManagerFileSystemEvent() - { - Cancel(); - delete iFullPath; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileSystemEvent::RunL -// From CActive. Called when asynchronous request is completed. -// Notifies the observer -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CFileManagerFileSystemEvent::RunL() - { - TInt err( iStatus.Int() ); - - LOG_IF_ERROR1( err, "CFileManagerFileSystemEvent::RunL-err=%d", err ) - - // Mark as received if there is no error - if ( err == KErrNone ) - { - iIsReceived = ETrue; - } - - // If not ENotifyDisk, do refresh when event is checked - // using CheckFileSystemEvent - if ( iNotifyType == ENotifyDisk ) - { - iEngine.DriveAddedOrChangedL(); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileSystemEvent::RunError -// From CActive. Called when error occurred in asynchronous request -// Notifies the observer -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt CFileManagerFileSystemEvent::RunError( TInt /*aError*/ ) - { - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileSystemEvent::DoCancel -// From CActive. Called when asynchronous request is canceled -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CFileManagerFileSystemEvent::DoCancel() - { - iFs.NotifyChangeCancel( iStatus ); - } - -// ------------------------------------------------------------------------------ -// CFileManagerFileSystemEvent::Setup -// -// ------------------------------------------------------------------------------ -// -void CFileManagerFileSystemEvent::Setup() - { - if( IsActive() ) - { - return; - } - - iIsReceived = EFalse; - - if( iFullPath ) - { - iFs.NotifyChange( iNotifyType, iStatus, *iFullPath ); - } - else - { - iFs.NotifyChange( iNotifyType, iStatus ); - } - - SetActive(); - } - -// ------------------------------------------------------------------------------ -// CFileManagerFileSystemEvent::CheckFileSystemEvent -// -// ------------------------------------------------------------------------------ -// -void CFileManagerFileSystemEvent::CheckFileSystemEvent() - { - if( iIsReceived ) - { - TRAP_IGNORE( iEngine.FolderContentChangedL() ); - } - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/Cfilemanagerfolderarray.cpp --- a/filemanager/Engine/src/Cfilemanagerfolderarray.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,356 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Holds the array of CFileManagerFolderEntry -* -*/ - - -// INCLUDE FILES -#include // TResourceReader -#include // BaflUtils::EnsurePathExists -#include // CCoeEnv -#ifdef RD_MULTIPLE_DRIVE - #include - #include -#endif // RD_MULTIPLE_DRIVE -#include "Cfilemanagerfolderarray.h" -#ifndef RD_MULTIPLE_DRIVE - #include "cfilemanagerfolderentry.h" -#endif // RD_MULTIPLE_DRIVE -#include "CFileManagerCommonDefinitions.h" -#include "CFileManagerUtils.h" - - -// CONSTANTS -const TInt KCreateCheckMaskMax = 32; - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerFolderArray::NewL -// -// ----------------------------------------------------------------------------- -// -#ifdef RD_MULTIPLE_DRIVE -CFileManagerFolderArray* CFileManagerFolderArray::NewL( - CFileManagerUtils& aUtils ) - { - return new ( ELeave ) CFileManagerFolderArray( aUtils ); - } -#else // RD_MULTIPLE_DRIVE -CFileManagerFolderArray* CFileManagerFolderArray::NewL( - TInt aResId, CFileManagerUtils& aUtils ) - { - CFileManagerFolderArray* self = - new( ELeave ) CFileManagerFolderArray( - aUtils ); - - CleanupStack::PushL( self ); - self->ConstructL( aResId ); - CleanupStack::Pop( self ); - - return self; - } -#endif // RD_MULTIPLE_DRIVE - -// ----------------------------------------------------------------------------- -// CFileManagerFolderArray::CFileManagerFolderArray -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerFolderArray::CFileManagerFolderArray( - CFileManagerUtils& aUtils ) : - iUtils( aUtils ) - { - } - -#ifndef RD_MULTIPLE_DRIVE -// ----------------------------------------------------------------------------- -// CFileManagerFolderArray::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFolderArray::ConstructL( TInt aResId ) - { - RArray< TInt > removableDrives; - CleanupClosePushL( removableDrives ); - - iUtils.DriveList( removableDrives, KDriveAttRemovable ); - TInt drvCount( removableDrives.Count() ); - - TResourceReader reader; - CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId ); - TInt count( reader.ReadInt16() ); - - TChar drvLetter( 0 ); - TBool isRemovable( EFalse ); - - for( TInt i( 0 ); i < count; i++ ) - { - CFileManagerFolderEntry* entry = - CFileManagerFolderEntry::NewLC( reader ); - iFolderArray.AppendL( entry ); - CleanupStack::Pop( entry ); - - // The default folders are same to all removable drives. - // Add the folders dynamically for undefined removable drives. - TPtrC ptr( entry->Name() ); - if ( ptr[ 0 ] != drvLetter ) - { - drvLetter = ptr[ 0 ]; - isRemovable = iUtils.IsRemovableDrive( ptr ); - } - if ( isRemovable ) - { - TInt baseDrv = TDriveUnit( ptr ); - for( TInt j( 0 ); j < drvCount; j++ ) - { - TInt drv( removableDrives[ j ] ); - if ( drv != baseDrv ) - { - entry = CFileManagerFolderEntry::NewLC( drv, ptr ); - iFolderArray.AppendL( entry ); - CleanupStack::Pop( entry ); - } - } - } - } - - CleanupStack::PopAndDestroy(); // reader - CleanupStack::PopAndDestroy( &removableDrives ); - } -#endif // RD_MULTIPLE_DRIVE - -// ----------------------------------------------------------------------------- -// CFileManagerFolderArray::~CFileManagerFolderArray -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerFolderArray::~CFileManagerFolderArray() - { -#ifndef RD_MULTIPLE_DRIVE - iFolderArray.ResetAndDestroy(); - iFolderArray.Close(); -#endif // RD_MULTIPLE_DRIVE - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderArray::Contains -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerFolderArray::Contains( const TDesC& aFolderName ) - { -#ifdef RD_MULTIPLE_DRIVE - // Remote drives has no default folders - if ( !iUtils.IsRemoteDrive( aFolderName ) ) - { - TInt pathType( PathInfo::PathType( aFolderName ) ); - switch ( pathType ) - { - // If non default folder but localized, - // handle it here as default folder - case PathInfo::ENotSystemPath: - { - TPtrC ptr( iUtils.LocalizedName( aFolderName ) ); - if ( ptr.Length() ) - { - return ETrue; - } - return EFalse; - } - // Ignore root folders - case PathInfo::EPhoneMemoryRootPath: // FALL THROUGH - case PathInfo::EMemoryCardRootPath: // FALL THROUGH - case PathInfo::ERomRootPath: - { - return EFalse; - } - // Accept other folders - default: - { - return ETrue; - } - } - } - return EFalse; -#else // RD_MULTIPLE_DRIVE - CFileManagerFolderEntry* entry = FindFolder( aFolderName ); - return ( entry ? ETrue : EFalse ); -#endif // RD_MULTIPLE_DRIVE - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderArray::CreateFolders -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFolderArray::CreateFolders( - const TInt aDrive, const TBool aForced ) - { - // If not forced creation, check if folders have been already created - if ( !aForced && aDrive >= 0 && aDrive < KCreateCheckMaskMax ) - { - if ( ( 1 << aDrive ) & iCreateCheckMask ) - { - return; // Folders have already been created - } - } -#ifdef RD_MULTIPLE_DRIVE - if ( aDrive != KErrNotFound ) // Support only explicitly given drive id - { - TRAP_IGNORE( DoCreateFoldersL( aDrive ) ); - // Update folder creation mask - iCreateCheckMask |= 1 << aDrive; - } -#else // RD_MULTIPLE_DRIVE - RFs& fs( iUtils.Fs() ); - TInt count( iFolderArray.Count() ); - for( TInt i( 0 ); i < count; i++ ) - { - TPtrC defFolder( iFolderArray[ i ]->Name() ); - - TInt drv = TDriveUnit( defFolder ); - if ( aDrive >= 0 ) - { - // Apply drive filtering - if ( drv != aDrive ) - { - continue; - } - } - - // Update folder creation mask - iCreateCheckMask |= 1 << drv; - - // Make sure that path exists - fs.MkDirAll( defFolder ); - - // Clear the possible hidden flag, all default folders - // should be visible - TEntry entry; - if ( fs.Entry( defFolder, entry ) == KErrNone ) - { - if( entry.IsHidden() ) - { - // If setting fails, File Manager can still go on - fs.SetEntry( - defFolder, entry.iModified, 0, KEntryAttHidden ); - } - } - } -#endif // RD_MULTIPLE_DRIVE - } - -#ifndef RD_MULTIPLE_DRIVE -// ----------------------------------------------------------------------------- -// CFileManagerFolderArray::FindFolder -// -// ----------------------------------------------------------------------------- -// -CFileManagerFolderEntry* CFileManagerFolderArray::FindFolder( - const TDesC& aFolderName ) - { - if ( !iSorted ) - { - TLinearOrder< CFileManagerFolderEntry > key( - CFileManagerFolderEntry::CompareSort ); - iFolderArray.Sort( key ); - iSorted = ETrue; - } - - TInt index( iFolderArray.FindInOrder( - aFolderName, CFileManagerFolderEntry::CompareFind ) ); - if ( index >= 0 && index < iFolderArray.Count() ) - { - // Match found - return iFolderArray[ index ]; - } - - return NULL; - } -#endif // RD_MULTIPLE_DRIVE - -#ifdef RD_MULTIPLE_DRIVE -// ----------------------------------------------------------------------------- -// CFileManagerFolderArray::DoCreateFolders -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFolderArray::DoCreateFoldersL( const TInt aDrive ) - { - TUint drvStatus( 0 ); - RFs& fs( iUtils.Fs() ); - User::LeaveIfError( DriveInfo::GetDriveStatus( fs, aDrive, drvStatus ) ); - if ( !( drvStatus & DriveInfo::EDriveUserVisible ) || - ( drvStatus & ( DriveInfo::EDriveRemote | - DriveInfo::EDriveReadOnly | - DriveInfo::EDriveUsbMemory ) ) ) - { - return; // Default folder creation is not allowed for this drive type - } - - TEntry entry; - CDesCArray* array = PathInfo::GetListOfPathsLC( aDrive ); - TInt count( array->MdcaCount() ); - for ( TInt i( 0 ); i < count; ++i ) - { - TPtrC fullPath( array->MdcaPoint( i ) ); - TBool allow( ETrue ); - - if ( drvStatus & DriveInfo::EDriveRemovable ) - { - // Filter few folder types from physically removable memory cards - TInt pathType( PathInfo::PathType( fullPath ) ); - switch( pathType ) - { - case PathInfo::EGamesPath: // FALL THROUGH - case PathInfo::EInstallsPath: // FALL THROUGH - case PathInfo::EGsmPicturesPath: // FALL THROUGH - case PathInfo::EMmsBackgroundImagesPath: // FALL THROUGH - case PathInfo::EPresenceLogosPath: - { - allow = EFalse; - } - default: - { - break; - } - } - } - - if ( allow ) - { - fs.MkDirAll( fullPath ); // Ignore error - - // Clear the possible hidden flag, all default folders - // should be visible - if ( fs.Entry( fullPath, entry ) == KErrNone ) - { - if( entry.IsHidden() ) - { - // If setting fails, File Manager can still go on - fs.SetEntry( - fullPath, entry.iModified, 0, KEntryAttHidden ); - } - } - } - } - CleanupStack::PopAndDestroy( array ); - } -#endif // RD_MULTIPLE_DRIVE - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/Cfilemanagerindexiterator.cpp --- a/filemanager/Engine/src/Cfilemanagerindexiterator.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -/* -* Copyright (c) 2002-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: Goes through the list of given files -* -*/ - - -// INCLUDE FILES -#include "Cfilemanagerindexiterator.h" -#include "CFileManagerEngine.h" -#include "CFileManagerCommonDefinitions.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerIndexIterator::NewL -// -// ----------------------------------------------------------------------------- -// -CFileManagerIndexIterator* CFileManagerIndexIterator::NewL - ( CFileManagerEngine& aEngine, - CArrayFixFlat& aIndexList, - const TDesC& aDstDir ) - { - CFileManagerIndexIterator* self = new( ELeave ) - CFileManagerIndexIterator( aEngine, aIndexList, aDstDir ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIndexIterator::CFileManagerIndexIterator -// -// ----------------------------------------------------------------------------- -// -CFileManagerIndexIterator::CFileManagerIndexIterator - ( CFileManagerEngine& aEngine, - CArrayFixFlat< TInt >& aIndexList, - const TDesC& aDstDir ): - iEngine( aEngine ), - iIndexList( aIndexList ), - iDstDir( aDstDir ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerIndexIterator::~CFileManagerIndexIterator -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerIndexIterator::~CFileManagerIndexIterator() - { - delete iSrc; - delete iDst; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIndexIterator::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerIndexIterator::ConstructL() - { - // We need double destination size - // because source and target folder can be - // KMaxFileName sized and those are append - // to same buffer. - iDst = HBufC::NewL( KFmgrDoubleMaxFileName ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerIndexIterator::CurrentL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerIndexIterator::CurrentL( - HBufC** aSrc, - HBufC** aDst, - TFileManagerTypeOfItem& aItemType ) - { - delete iSrc; - iSrc = NULL; - iSrc = iEngine.IndexToFullPathL( iIndexList.At( iCurrentIndex ) ); - - TPtr ptrDst( iDst->Des() ); - ptrDst.Copy( iDstDir ); - TParsePtrC parse( *iSrc ); - ptrDst.Append( parse.NameAndExt() ); - - *aSrc = iSrc; - *aDst = iDst; - - aItemType = EFileManagerFile; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIndexIterator::NextL -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerIndexIterator::NextL() - { - ++iCurrentIndex; - if( iCurrentIndex < iIndexList.Count()) - { - return ETrue; - } - - return EFalse; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/Engine/src/TFileManagerDriveInfo.cpp --- a/filemanager/Engine/src/TFileManagerDriveInfo.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,319 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Drive info storage -* -*/ - - -// INCLUDE FILES -#include -#include "TFileManagerDriveInfo.h" -#include "CFileManagerEngine.h" -#include "FileManagerDebug.h" -#include "CFileManagerCommonDefinitions.h" -#include "CFileManagerFeatureManager.h" -#ifdef RD_MULTIPLE_DRIVE -#include -#endif // RD_MULTIPLE_DRIVE - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// TFileManagerDriveInfo::TFileManagerDriveInfo -// ----------------------------------------------------------------------------- -// -EXPORT_C TFileManagerDriveInfo::TFileManagerDriveInfo() - { - Reset(); - } - -// ----------------------------------------------------------------------------- -// TFileManagerDriveInfo::TFileManagerDriveInfo -// ----------------------------------------------------------------------------- -// -EXPORT_C void TFileManagerDriveInfo::Reset() - { - iName.Zero(); - iCapacity = 0; - iSpaceFree = 0; - iUid = 0; - iDrive = 0; - iState = 0; - } - -// ----------------------------------------------------------------------------- -// TFileManagerDriveInfo::GetInfoL -// ----------------------------------------------------------------------------- -// -void TFileManagerDriveInfo::GetInfoL( - const CFileManagerEngine& aEngine, const TInt aDrive ) - { - FUNC_LOG - - INFO_LOG1( "TFileManagerDriveInfo::GetInfoL - aDrive %d", aDrive ) - - Reset(); - iDrive = aDrive; - - RFs& fs( aEngine.Fs() ); - CheckMountL( fs, aDrive ); - TInt err( FillStateFromVolumeInfo( fs, aDrive ) ); - if ( err == KErrInUse ) - { - iState |= EDriveInUse; - } - else if ( err == KErrCorrupt ) - { - iState |= EDrivePresent | EDriveCorrupted; - } - else if ( err == KErrLocked ) - { - iState |= EDrivePresent | EDriveLocked | EDriveFormatted | - EDrivePasswordProtected | EDriveLockable; - } - else if ( err == KErrNone ) - { - if ( iState & EDriveRemote ) - { - if ( aEngine.IsRemoteDriveConnected( aDrive ) ) - { - iState |= EDriveConnected; - } - } - -#ifndef RD_FILE_MANAGER_BACKUP - if ( iState & EDriveRemovable ) - { - if ( aEngine.BackupFileExistsL( aDrive ) ) - { - iState |= EDriveBackupped; - } - } -#endif // RD_FILE_MANAGER_BACKUP - - } - - INFO_LOG3( "TFileManagerDriveInfo::GetInfoL - aDrive %d, err %d, iState 0x%x", - aDrive, err, iState ) - - if ( aEngine.FeatureManager().IsEmbedded() ) - { - // Disable format in embedded mode, because it messes up - // operations since embedded apps are closed. - iState &= ~EDriveFormattable; - } - } - -// ----------------------------------------------------------------------------- -// TFileManagerDriveInfo::CheckMountL() -// ----------------------------------------------------------------------------- -// -void TFileManagerDriveInfo::CheckMountL( - RFs& aFs, const TInt aDrive ) const - { - FUNC_LOG - - HBufC* fullname = HBufC::NewLC( KMaxFullName ); - TPtr name( fullname->Des() ); - TInt err( aFs.FileSystemName( name, aDrive ) ); - if ( err == KErrNone && !name.Length() ) - { - // Drive isn't mounted at present, so try it now.... - // Returns KErrLocked, if locked and the password - // is not in store - err = aFs.MountFileSystem( KFmgrFatFSName, aDrive ); - } - CleanupStack::PopAndDestroy( fullname ); - - LOG_IF_ERROR1( err, "TFileManagerDriveInfo::CheckMountL-err=%d", err ) - } - -// ----------------------------------------------------------------------------- -// TFileManagerDriveInfo::FillStateFromDriveInfo() -// ----------------------------------------------------------------------------- -// -TInt TFileManagerDriveInfo::FillStateFromDriveInfo( -#ifdef RD_MULTIPLE_DRIVE - RFs& aFs, -#else // RD_MULTIPLE_DRIVE - RFs& /*aFs*/, -#endif // RD_MULTIPLE_DRIVE - const TInt aDrive, - const TDriveInfo& aDrvInfo ) - { - FUNC_LOG - - TInt ret( KErrNone ); - -#ifdef RD_MULTIPLE_DRIVE - TUint drvStatus( 0 ); - TInt err( DriveInfo::GetDriveStatus( aFs, aDrive, drvStatus ) ); - if ( err != KErrNone ) - { - ERROR_LOG2( "TFileManagerDriveInfo::FillStateFromDriveInfo - aDrive %d, Status err %d", - aDrive, err ) - } - INFO_LOG2( "TFileManagerDriveInfo::FillStateFromDriveInfo - Media type %d, drvStatus 0x%x", - aDrvInfo.iType, drvStatus ) - if ( aDrvInfo.iType != EMediaNotPresent && ( drvStatus & DriveInfo::EDriveInUse ) ) - { - ret = KErrInUse; // Drive is reserved for exclusive usage like file transfer - } - if ( ( drvStatus & DriveInfo::EDriveInternal ) && - ( drvStatus & DriveInfo::EDriveExternallyMountable ) ) - { - // Handle mass storage bits here - iState |= EDriveMassStorage | EDriveRemovable; - if ( aDrvInfo.iMediaAtt & KMediaAttFormattable ) - { - iState |= EDriveFormattable; - } - if ( aDrvInfo.iMediaAtt & KMediaAttLocked ) - { - // Locking internal drives is not supported - iState |= EDriveCorrupted; - ret = KErrCorrupt; - } - return ret; - } - if ( drvStatus & DriveInfo::EDriveUsbMemory ) - { - iState |= EDriveUsbMemory; - } -#endif // RD_MULTIPLE_DRIVE - - // Setup flags from drive info - if ( aDrvInfo.iMediaAtt & KMediaAttWriteProtected ) - { - iState |= EDriveWriteProtected; - } - if ( aDrvInfo.iMediaAtt & KMediaAttLocked ) - { - iState |= EDriveLocked; - ret = KErrLocked; - } - if ( aDrvInfo.iMediaAtt & KMediaAttFormattable ) - { - iState |= EDriveFormattable; - } - if ( aDrvInfo.iMediaAtt & KMediaAttLockable ) - { - iState |= EDriveLockable; - } - if ( aDrvInfo.iMediaAtt & KMediaAttHasPassword ) - { - iState |= EDrivePasswordProtected; - } - if ( ( aDrvInfo.iDriveAtt & KDriveAttRemovable ) || - aDrive == KFmgrMemoryCardDrive ) - { - iState |= EDriveRemovable; -#ifdef RD_MULTIPLE_DRIVE - if ( drvStatus & DriveInfo::EDriveSwEjectable ) - { - iState |= EDriveEjectable; - } -#else // RD_MULTIPLE_DRIVE - // Eject is possible for external memory cards - if ( !( aDrvInfo.iDriveAtt & KDriveAttInternal ) || - aDrive == KFmgrMemoryCardDrive ) - { - iState |= EDriveEjectable; - } -#endif // RD_MULTIPLE_DRIVE - } - if ( aDrvInfo.iDriveAtt & KDriveAttRemote ) - { - iState |= EDriveRemote; - } - - return ret; - } - -// ----------------------------------------------------------------------------- -// TFileManagerDriveInfo::FillStateFromVolumeInfo() -// ----------------------------------------------------------------------------- -// -TInt TFileManagerDriveInfo::FillStateFromVolumeInfo( - RFs& aFs, const TInt aDrive ) - { - FUNC_LOG - - TVolumeInfo volInfo; - TInt ret( aFs.Volume( volInfo, aDrive ) ); - LOG_IF_ERROR1( ret, - "TFileManagerDriveInfo::FillStateFromVolumeInfo - Volume err %d", ret ); - if ( ret == KErrNone ) - { - // Get all information from volume info - TInt maxLen( Min( volInfo.iName.Length(), KMaxVolumeName ) ); - - iName = volInfo.iName.Left( maxLen ); - iUid = volInfo.iUniqueID; - iCapacity = volInfo.iSize; - iSpaceFree = volInfo.iFree; - - iState |= EDrivePresent; - - if ( volInfo.iSize ) - { - iState |= EDriveFormatted; - } - - ret = FillStateFromDriveInfo( aFs, aDrive, volInfo.iDrive ); - } - else - { - // Get all information from drive info - TDriveInfo& drvInfo( volInfo.iDrive ); - TInt err( aFs.Drive( drvInfo, aDrive ) ); - LOG_IF_ERROR1( err, - "TFileManagerDriveInfo::FillStateFromVolumeInfo - Drive err %d", err ); - if ( err == KErrNone ) - { - err = FillStateFromDriveInfo( aFs, aDrive, drvInfo ); - - // If memory card is not ready but type is present, - // then check if it is reserved. - if( err == KErrNone && - ret == KErrNotReady && - drvInfo.iType != EMediaNotPresent ) - { - // Check USB file transfer state - TInt prop( ECoreAppUIsUSBFileTransferUninitialized ); - RProperty::Get( - KPSUidCoreApplicationUIs, - KCoreAppUIsUSBFileTransfer, prop ); - if ( prop == ECoreAppUIsUSBFileTransferActive ) - { - ret = KErrInUse; // Reserved for file transfer - } - INFO_LOG2( "TFileManagerDriveInfo::FillStateFromVolumeInfo-prop=%d,ret=%d", - prop, ret ) - } - } - if ( err != KErrNone ) - { - ret = err; - } - } - - LOG_IF_ERROR2( ret, - "TFileManagerDriveInfo::FillStateFromVolumeInfo - aDrive %d, Ret %d", - aDrive, ret ) - - return ret; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/data/GflmFileExtensionMimeTypes.rss --- a/filemanager/GFLM/data/GflmFileExtensionMimeTypes.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +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 for GFLM extension MIME types -* -*/ - - -#include -#include - -#include "GflmFileExtensionMimeTypes.rh" - -// RESOURCE IDENTIFIER -NAME FWMT - -RESOURCE RSS_SIGNATURE { } - -RESOURCE EXT_MIME_PAIR_LIST r_ext_mime_pairs -{ - pairs = - { - - // Images - EXT_MIME_PAIR { extension = ".jpg"; mime_type = "image/jpeg"; }, - EXT_MIME_PAIR { extension = ".jpeg"; mime_type = "image/jpeg"; }, - EXT_MIME_PAIR { extension = ".gif"; mime_type = "image/gif"; }, - EXT_MIME_PAIR { extension = ".png"; mime_type = "image/png"; }, - EXT_MIME_PAIR { extension = ".ota"; mime_type = "image/x-ota-bitmap"; }, - EXT_MIME_PAIR { extension = ".tif"; mime_type = "image/tiff"; }, - EXT_MIME_PAIR { extension = ".mbm"; mime_type = "image/x-epoc-mbm"; }, - EXT_MIME_PAIR { extension = ".bmp"; mime_type = "image/x-bmp"; }, - EXT_MIME_PAIR { extension = ".wbmp"; mime_type = "image/vnd.wap.wbmp"; }, - EXT_MIME_PAIR { extension = ".svg"; mime_type = "image/svg+xml"; }, - EXT_MIME_PAIR { extension = ".wmf"; mime_type = "image/x-wmf"; }, - - // Audios - EXT_MIME_PAIR { extension = ".mid"; mime_type = "audio/midi"; }, - EXT_MIME_PAIR { extension = ".au"; mime_type = "audio/au"; }, - EXT_MIME_PAIR { extension = ".amr"; mime_type = "audio/amr"; }, - EXT_MIME_PAIR { extension = ".awb"; mime_type = "audio/amr-wb"; }, - EXT_MIME_PAIR { extension = ".rmf"; mime_type = "audio/x-beatnik-rmf"; }, - EXT_MIME_PAIR { extension = ".aiff"; mime_type = "audio/aiff"; }, - EXT_MIME_PAIR { extension = ".aif"; mime_type = "audio/aiff"; }, - EXT_MIME_PAIR { extension = ".wav"; mime_type = "audio/wav"; }, - EXT_MIME_PAIR { extension = ".rng"; mime_type = "application/vnd.nokia.ringing-tone"; }, - EXT_MIME_PAIR { extension = ".nrt"; mime_type = "application/vnd.nokia.ringing-tone"; }, - EXT_MIME_PAIR { extension = ".mp3"; mime_type = "audio/mp3"; }, - - // Videos - EXT_MIME_PAIR { extension = ".nim"; mime_type = "video/sdp"; }, - EXT_MIME_PAIR { extension = ".sdp"; mime_type = "application/sdp"; } - - }; -} - -// Remote drive specific file extension mime mappings for faster recognition. -// Mime types are resolved from extension by remote storage framework anyway. -RESOURCE EXT_MIME_PAIR_LIST r_remote_ext_mime_pairs -{ - pairs = - { - - // Audios - EXT_MIME_PAIR { extension = ".m4a"; mime_type = "audio/mp4"; }, - EXT_MIME_PAIR { extension = ".aac"; mime_type = "audio/aac"; }, - EXT_MIME_PAIR { extension = ".3g2"; mime_type = "audio/3gpp2"; }, - EXT_MIME_PAIR { extension = ".mxmf"; mime_type = "audio/vnd.nokia.mobile-xmf"; }, - EXT_MIME_PAIR { extension = ".mid"; mime_type = "audio/midi"; }, - EXT_MIME_PAIR { extension = ".wma"; mime_type = "audio/x-ms-wma"; }, - - // Videos - EXT_MIME_PAIR { extension = ".mp4"; mime_type = "video/mp4"; }, - EXT_MIME_PAIR { extension = ".mpeg4"; mime_type = "video/mp4"; }, - EXT_MIME_PAIR { extension = ".mpeg"; mime_type = "video/mp4"; }, - EXT_MIME_PAIR { extension = ".3gp"; mime_type = "video/3gpp"; }, - - // Other - EXT_MIME_PAIR { extension = ".txt"; mime_type = "text/plain"; }, - EXT_MIME_PAIR { extension = ".sis"; mime_type = "sis"; }, - EXT_MIME_PAIR { extension = ".sisx"; mime_type = "sis"; }, - EXT_MIME_PAIR { extension = ".jar"; mime_type = "java-archive"; }, - EXT_MIME_PAIR { extension = ".jad"; mime_type = "java-archive"; } - - }; -} - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/CGflmDirectoryListingCache.h --- a/filemanager/GFLM/inc/CGflmDirectoryListingCache.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* Copyright (c) 2002-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: Provides directory listing cache -* -*/ - - - -#ifndef CGFLMDIRECTORYLISTINGCACHE_H -#define CGFLMDIRECTORYLISTINGCACHE_H - - -// INCLUDES -#include -#include "GFLM.hrh" - - -// CLASS DECLARATION - -/** -* A class that encapsulates reading and storing the contents of a -* directory. When a directory listing is read, the results are -* cached so that the same listing can be used in other groups -* without having to re-read the same directory. -* -* @lib GFLM.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CGflmDirectoryListingCache) : public CBase - { - public: - typedef CArrayPakFlat< TEntry > CEntryArray; - - private: - /** - * An internal data structure for storing directory name and listing - * pairs. - */ - NONSHARABLE_CLASS(CListingNamePair) : public CBase - { - public: - ~CListingNamePair(); - static CListingNamePair* NewLC( const TDesC& aDirectory ); - private: - void ConstructL( const TDesC& aDirectory ); - public: - HBufC* iDirectory; - CEntryArray* iListing; - }; - - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @since 2.0 - * @param aFss A reference to a valid and open file server session - * @param aCancelIndicator A reference to cancel indicator - */ - static CGflmDirectoryListingCache* NewL( - RFs& aFss, - const TBool& aCancelIndicator ); - - /** - * Destructor. - */ - virtual ~CGflmDirectoryListingCache(); - - public: // New functions - - /** - * Clears the contents of the cache - * @since 2.0 - */ - void ClearCache(); - - /** - * Retrieves a directory listing - * @since 2.0 - * @param aDirectory Path of the directory - * @return A pointer to a CEntryArray object that contains the requested items - */ - const CEntryArray* ListingL( const TDesC& aDirectory ); - - private: - - /** - * C++ default constructor. - */ - CGflmDirectoryListingCache( - RFs& aFss, - const TBool& aCancelIndicator ); - - void GetDirL( CListingNamePair& aPair ); - - private: // Data - // For caching directory contents. Owned. - CListingNamePair* iCache; - - // An open fileserver session. Not owned. - RFs& iFss; - - // Read only cancel indicator. Not owned - const TBool& iCancelIndicator; - - // A buffer for reading directory contents - TEntryArray iEntryBuffer; - - // An indicator if cache must be cleared - TBool iClearCache; - - }; - -#endif // CGFLMDIRECTORYLISTINGCACHE_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/CGflmDriveItem.h --- a/filemanager/GFLM/inc/CGflmDriveItem.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +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: Drive item definitions -* -*/ - - - -#ifndef CGFLMDRIVEITEM_H -#define CGFLMDRIVEITEM_H - - -// INCLUDES -#include -#include -#include "CGflmGroupItem.h" - - -// CLASS DECLARATION -/** -* A class representing drive items. -* -* @lib GFLM.lib -* @since 3.1 -*/ -class CGflmDriveItem : public CGflmGroupItem - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CGflmDriveItem* NewLC( - const TInt aDrive, - const TVolumeInfo& aFSVolume, - const TInt aVolumeStatus, - const TUint aDriveStatus ); - - /** - * Destructor. - */ - virtual ~CGflmDriveItem( ); - - public: // New functions - - /** - * Sets the localized name of the item. - * @since 3.1 - * @param aName A descriptor containing the localized name for the - entry. A copy of the name is created. - */ - IMPORT_C void SetLocalizedNameL( const TDesC& aName ); - - /** - * Sets the root directory of the item. - * @since 3.1 - * @param aName A descriptor containing the path for the - entry. A copy of the path is created. - */ - IMPORT_C void SetRootDirectoryL( const TDesC& aPath ); - - /** - * Gets the root directory of the item. - * @since 3.1 - * @return A pointer descriptor to root directory - */ - IMPORT_C TPtrC RootDirectory() const; - - /** - * Gets the volume info of the item. - * @since 3.1 - * @return A reference to volume info - */ - IMPORT_C const TVolumeInfo& VolumeInfo() const; - - /** - * Get the drive id - * @since 3.1 - * @return Drive id. - */ - IMPORT_C TInt Drive() const; - - /** - * Get the volume status - * @since 3.1 - * @return volume status - */ - IMPORT_C TInt VolumeStatus() const; - - /** - * Get the drive status - * @since 3.2 - * @return drive status - */ - IMPORT_C TUint DriveStatus() const; - - public: // From CGflmGroupItem - - TGflmItemType Type() const; - - TPtrC Name() const; - - TTime Date() const; - - TInt64 Size() const; - - TPtrC Ext() const; - - private: - - /** - * C++ default constructor. - */ - CGflmDriveItem( - const TInt aDrive, - const TVolumeInfo& aFSVolume, - const TInt aVolumeStatus, - const TUint aDriveStatus ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Data - // A TVolumeInfo object that is the actual entry - TVolumeInfo iVolume; - - // The drive numeric id. - TInt iDrive; - - // The root directory of the entry. - HBufC* iRootDir; - - // The localised name of the entry. - HBufC* iLocalizedName; - - // Holds volume status i.e return value of drive or volume info - TInt iVolumeStatus; - - // Holds drive status i.e the value from DriveInfo::GetDriveStatus - TUint iDriveStatus; - - }; - -#endif // CGFLMDRIVEITEM_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/CGflmDriveResolver.h --- a/filemanager/GFLM/inc/CGflmDriveResolver.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* -* Copyright (c) 2002-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: Resolves different media types' drive letters -* -*/ - - -#ifndef CGFLMDRIVERESOLVER_H -#define CGFLMDRIVERESOLVER_H - - -// INCLUDES -#include -#include "GFLM.hrh" - -// CONSTANTS -const TInt KGflmReadBufferLen = 256; - -// FORWARD DECLARATIONS -class CGflmDriveItem; -class MGflmItemFilter; - - -// CLASS DECLARATION -/** -* Resolves different media types' drive letters -* -* @lib GFLM.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CGflmDriveResolver) : public CBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CGflmDriveResolver* NewL( RFs& aFs ); - - /** - * Destructor. - */ - virtual ~CGflmDriveResolver(); - - public: // New functions - /** - * Refreshes drive information - * @param aFs Reference to file system handle - * @param aFilter Pointer to filter - * @return System wide error code. - * @since 3.2 - */ - TInt RefreshDrives( MGflmItemFilter* aFilter ); - - /** - * Gets number of drives - * @since 3.1 - * @return A number of drives - */ - TInt DriveCount() const; - - /** - * Gets drive item at position - * @since 3.1 - * @param aIndex Given position - * @return A pointer to drive item (not owned). - */ - CGflmDriveItem* DriveAt( const TInt aIndex ) const; - - /** - * Gets drive item from given path - * @since 3.1 - * @param aPath Given path - * @return A pointer to drive item (not owned) - * or NULL if drive not found. - */ - CGflmDriveItem* DriveFromPath( const TDesC& aPath ) const; - - /** - * Clears drive information - * @since 3.1 - */ - void ClearDrives(); - - /** - * Checks if path is drive root path - * @since 3.1 - */ - TBool IsRootPath( const TDesC& aPath ) const; - - /** - * Checks if path is on remote drive - * @since 3.1 - */ - TBool IsRemoteDrive( const TDesC& aPath ) const; - - /** - * Gets drive item from given id - * @since 3.2 - * @param aDrive Given drive id - * @return A pointer to drive item (not owned) - * or NULL if drive not found. - */ - CGflmDriveItem* DriveFromId( const TInt aDrive ) const; - - private: - - /** - * C++ default constructor. - */ - CGflmDriveResolver( RFs& aFs ); - - void ConstructL(); - - void AppendDriveL( - const TInt aDrive, MGflmItemFilter* aFilter ); - - void RefreshDrivesL( MGflmItemFilter* aFilter ); - - private: // Data - // Shareable file server session. - RFs& iFs; - - // List of drives. Owned. - RPointerArray< CGflmDriveItem > iDrives; - - TBool iRefreshed; - - RCriticalSection iCs; - - TBuf< KGflmReadBufferLen > iReadBuffer; - }; - -#endif // CGFLMDRIVERESOLVER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/CGflmFileFinder.h --- a/filemanager/GFLM/inc/CGflmFileFinder.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +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: Searches items matching with given string in given file system -* -*/ - - -#ifndef CGFLMITEMFINDER_H -#define CGFLMITEMFINDER_H - -// INCLUDES -#include -#include -#include -#include "GFLM.hrh" -#include "MGflmItemGroup.h" - -// FORWARD DECLARATIONS -class CGflmItemLocalizer; -class CGflmDriveResolver; -class MGflmItemFilter; -class CGflmGroupItem; - -// CLASS DECLARATION -/** -* Finds the items matching with given string in given folder -* -* @lib GFLM.lib -* @since 3.2 -*/ -NONSHARABLE_CLASS(CGflmFileFinder) : public CBase, - public MGflmItemGroup - { - public: - /** - * Two-phased constructor. - */ - static CGflmFileFinder* NewL( - RFs& aFss, - CGflmItemLocalizer& aLocalizer, - CGflmDriveResolver& aResolver, - const TBool& aCancelIndicator ); - - /** - * Destructor. - */ - ~CGflmFileFinder(); - - public: - /** - * Sets search folder - * @since 3.2 - * @param aSearchFolder Given search folder - */ - void SetSearchFolderL( const TDesC& aSearchFolder ); - - /** - * Sets search string. Wild cards are allowed. - * @since 3.2 - * @param aSearchString Given search string - */ - void SetSearchStringL( const TDesC& aSearchString ); - - /** - * Refreshes the model - * @since 3.2 - * @param aFilter Pointer to filter. NULL if not used. - * @param aSortMethod Sort method - * @param aRefreshMode Refresh mode - */ - void RefreshL( - MGflmItemFilter* aFilter, - TGflmSortMethod aSortMethod, - TGflmRefreshMode aRefreshMode ); - - public: // From MGflmItemGroup - - TInt Id() const; - - TInt ItemCount() const; - - CGflmGroupItem* Item( TInt aIndex ); - - void AddSourceL( const TDesC& aDirectory ); - - void ResetSources(); - - void AddActionItemL( TInt aId, const TDesC& aCaption ); - - void SetInclusion( TUint aInclusion ); - - const TCollationMethod* CollationMethod(); - - private: - /** - * C++ default constructor. - */ - CGflmFileFinder( - RFs& aFss, - CGflmItemLocalizer& aLocalizer, - CGflmDriveResolver& aResolver, - const TBool& aCancelIndicator ); - - void ConstructL(); - - void DoSearchL( MGflmItemFilter* aFilter ); - - private: // Data - // Ref: An open shareable file server session - RFs& iFss; - - // Ref: Item localizer - CGflmItemLocalizer& iItemLocalizer; - - // Ref: Drive resolver - CGflmDriveResolver& iDriveResolver; - - // Own: Read only cancel indicator - const TBool& iCancelIndicator; - - // Own: Contains folder string - HBufC* iSearchFolder; - - // Own: Contains folder path with search string with wild cards - HBufC* iSearchFolderWild; - - // Own: Contains search string - HBufC* iSearchString; - - // Own: Contains search string with wild cards - HBufC* iSearchStringWild; - - // Own: Contains found items - RPointerArray< CGflmGroupItem > iSearchResults; - - // Own: Buffer for full path handling - TFileName iFullPath; - - // Own: Used collation method - TCollationMethod iSortCollationMethod; - }; - -#endif // CGFLMITEMFINDER_H - -// End of File - diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/CGflmFileFinderItem.h --- a/filemanager/GFLM/inc/CGflmFileFinderItem.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +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: File finder item definitions -* -*/ - - - -#ifndef CGFLMFILEFINDERITEM_H -#define CGFLMFILEFINDERITEM_H - - -// INCLUDES -#include -#include "CGflmFileSystemItem.h" - - -// FORWARD DECLARATIONS - - -// CLASS DECLARATION - -/** -* A class representing a file system item. -* A file system item is either a file or a directory. -* -* @lib GFLM.lib -* @since 3.2 -*/ -class CGflmFileFinderItem : public CGflmFileSystemItem - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CGflmFileFinderItem* NewLC( - const TEntry& aEntry, - const TDesC& aBasePath ); - - /** - * Destructor. - */ - virtual ~CGflmFileFinderItem(); - - /** - * Compares items by match - * @since 3.2 - * @param aFirst Given first item for comparison - * @param aSecond Given second item for comparison - * @return Comparison result - */ - static TInt CompareByMatch( - const CGflmGroupItem& aFirst, - const CGflmGroupItem& aSecond ); - - /** - * Prepares item for by match sorting - * @since 3.2 - * @param aSearchString Given search string - */ - void PrepareSort( const TDesC& aSearchString ); - - private: - - /** - * C++ default constructor. - */ - CGflmFileFinderItem( const TEntry& aFSEntry ); - - void ConstructL( const TDesC& aBasePath ); - - private: // Data - TEntry iEntry; - HBufC* iBasePath; - TInt16 iSortValue; - }; - -#endif // CGFLMFILEFINDERITEM_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/CGflmFileListModel.h --- a/filemanager/GFLM/inc/CGflmFileListModel.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,355 +0,0 @@ -/* -* Copyright (c) 2002-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: File list model -* -*/ - - - -#ifndef CGFLMFILELISTMODEL_H -#define CGFLMFILELISTMODEL_H - - -// INCLUDES -#include -#include // MDesCArray -#include // RFs -#include "GFLM.hrh" - - -// FORWARD DECLARATIONS -class MGflmItemGroup; -class CGflmItemGroupImpl; -class CGflmGroupItem; -class MGflmItemFilter; -class CGflmDirectoryListingCache; -class CGflmFileRecognizer; -class CGflmItemLocalizer; -class CGflmDriveResolver; -class CGflmDriveItem; -class CGflmFileFinder; - - -// CLASS DECLARATION -/** -* A class that implements the basic file list functionality. -* @lib GFLM.lib -* @since 2.0 -*/ -class CGflmFileListModel : public CActive, public MDesCArray - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @since 3.2 - * @param aFs Shareable file server session, see RFs::ShareProtected() - * @return Pointer to a CGflmFileListModel instance - */ - IMPORT_C static CGflmFileListModel* NewL( RFs& aFs ); - - /** - * Destructor. - */ - virtual ~CGflmFileListModel(); - - public: // New functions - - /** - * Refreshes the model - * @since 2.0 - * @param aStatus A reference to a TRequestStatus object that - * is used to notify the client thread about completion of - * the refresh - * @param aRefreshMode Refresh mode - */ - IMPORT_C void RefreshListL( - TRequestStatus& aStatus, - TGflmRefreshMode aRefreshMode = ERefreshItems ); - - /** - * Cancels the asynchronous refresh request - * @since 2.0 - */ - IMPORT_C void CancelRefresh(); - - /** - * Obtains a pointer to a CGflmGroupItem object. - * The item is indexed by a global index. - * Raises a panic (EGlobalIndexOutOfBounds) if the index refers to a - * non-existent item. - * @since 2.0 - * @param aIndex Global index of the item. - * @return A pointer to a CGflmGroupItem object. - */ - IMPORT_C CGflmGroupItem* Item( TInt aIndex ) const; - - /** - * Resets the model. All item groups are destroyed. - * @since 2.0 - */ - IMPORT_C void ResetModel(); - - /** - * Obtains a pointer to a MGflmItemGroup object. - * Raises a panic (EInvalidGroupId) if a group is not found with given id. - * @since 2.0 - * @param aId Id of the group - * @return A pointer to a MGflmItemGroup object. - */ - IMPORT_C MGflmItemGroup* FindGroupById( TInt aId ); - - /** - * Creates a new item group with a given id. - * @since 2.0 - * @param aId The id given to the created group - * @return A pointer to the created MGflmItemGroup object - */ - IMPORT_C MGflmItemGroup* CreateGroupL( TInt aId ); - - /** - * Creates a new item group with a given id. - * @since 3.1 - * @param aId The id given to the created group - * @param aInclusion The group item inclusion - * @return A pointer to the created MGflmItemGroup object - */ - IMPORT_C MGflmItemGroup* CreateGroupL( - TInt aId, TUint aInclusion ); - - /** - * Recognizes a file and resolves it's MIME-type. - * This method accesses GFLM's internal recognizer cache - * and is thus recomended for efficiency. NOTE: The file doesn't - * have to belong to the current state of the model. - * @since 2.0 - * @param aFilename Full path of the file to be recognized - * @return A pointer descriptor containing the MIME-type of the item. - * If the MIME-type couldn't be recognized, returns KNullDesC - */ - IMPORT_C TPtrC ResolveMimeTypeL( const TDesC& aFilename ); - - /** - * Sets the item filter object for the model to use. - * If aOwned is ETrue the model gets the ownership of the object. - * @since 2.0 - * @param aFilter A pointer to a MGflmItemFilter object to be used - */ - IMPORT_C void SetCustomFilter( MGflmItemFilter* aFilter ); - - /** - * Returns the validity of the model. If the refresh operation failed - * or was canceled the model is corrupt and it's items shouldn't be - * accessed - * @since 2.0 - * @return ETrue if the model is corrupt. EFalse if the model is in - * valid state. - */ - IMPORT_C TBool IsCorrupt() const; - - /** - * Returns the localized name of a file or a directory - * @since 2.0 - * @param aPath Full path to the file or directory - * @return A pointer descriptor containing the localized name - * without the full path - */ - IMPORT_C TPtrC LocalizedName( const TDesC& aPath ) const; - - /** - * Clears the contents of the file cache - * @since 2.0 - */ - IMPORT_C void ClearCache(); - - /** - * Clears the contents of the drive info - * @since 3.1 - */ - IMPORT_C void ClearDriveInfo(); - - /** - * Gets drive item from given path - * @since 3.1 - * @param aPath Given path - * @return A pointer to drive item (not owned) - * or NULL if drive not found. - */ - IMPORT_C CGflmDriveItem* DriveFromPath( const TDesC& aPath ) const; - - /** - * Gets drive item from given id - * @since 3.2 - * @param aDrive Given drive id - * @return A pointer to drive item (not owned) - * or NULL if drive not found. - */ - IMPORT_C CGflmDriveItem* DriveFromId( const TInt aDrive ) const; - - /** - * Enables and disables search mode - * @since 3.2 - * @param aEnabled Enable or disable - */ - IMPORT_C void EnableSearchMode( const TBool aEnabled ); - - /** - * Get search mode - * @since 5.0 - * @return search mode - */ - IMPORT_C TBool SearchMode(); - /** - * Sets search string. Wild cards are allowed. - * @since 3.2 - * @param aSearchString Given search string - */ - IMPORT_C void SetSearchStringL( const TDesC& aSearchString ); - - /** - * Sets search folder - * @since 3.2 - * @param aSearchFolder Given search folder - */ - IMPORT_C void SetSearchFolderL( const TDesC& aSearchFolder ); - - /** - * Sets sort method - * @since 5.0 - * @param aSortMethod Given sort method - */ - IMPORT_C void SetSortMethod( TGflmSortMethod aSortMethod ); - - /** - * Gets sort method - * @since 5.0 - * @return Currently used sort method - */ - IMPORT_C TGflmSortMethod SortMethod() const; - - /** - * Flush cache in CGflmFileRecognizer - */ - IMPORT_C void FlushCache(); - - public: // MDesCArray - - TInt MdcaCount() const; - - TPtrC MdcaPoint( TInt aIndex ) const; - - private: // CActive - - void RunL(); - - TInt RunError( TInt aError ); - - void DoCancel(); - - protected: // New functions - - /** - * C++ default constructor. - */ - CGflmFileListModel( RFs& aFs ); - - /** - * 2nd phase constructor - */ - void ConstructL(); - - private: - - static TInt WorkThreadStart( TAny* aPtr ); - - void WorkThread(); - - void NotifyClient( TInt aErr ); - - void GetGroupAndLocalIndex( - const TInt aGlobalIndex, - TInt& aLocalIndex, - MGflmItemGroup*& aGroup ) const; - - void DoRefreshL(); - - protected: // Data - - // Ref: An open shareable file server session - RFs& iFs; - - // Request status of the work thread client - TRequestStatus* iClientStatus; - - // Dynamic array containing all the CGflmItemGroupImpl objects that - // belong to the model. Owned. - CArrayPtrSeg< CGflmItemGroupImpl >* iGroups; - - // Instance of CGflmDirectoryListingCache. Owned. - CGflmDirectoryListingCache* iListingCache; - - // Instance of CGflmFileRecognizer. Owned. - CGflmFileRecognizer* iFileRecognizer; - - // Instance of CGflmItemLocalizer. Owned. - CGflmItemLocalizer* iItemLocalizer; - - // Instance of CGflmDriveResolver. Owned. - CGflmDriveResolver* iDriveResolver; - - // A boolean indicating wether the model is corrupt and needs to be - // refreshed - TBool iCorrupt; - - // A pointer to a class implementing MGflmItemFilter interface - MGflmItemFilter* iFilter; - - // Own: For synchronising client and work thread - RSemaphore iSemaphore; - - // Own: Client thread id to be informed - TThreadId iClientId; - - // A boolean indicating wether the model is shutting down - // Main thread is allowed write and work thread is allowed to read only - TBool iShutdown; - - // A boolean indicating wether the refresh is canceled - // Main thread is allowed write and work thread is allowed to read only - TBool iCanceled; - - // A boolean indicating if search mode enabled or disabled - // Main thread is allowed write and work thread is allowed to read only - TBool iSearchEnabled; - - // Own: For finding files and directories from file system - CGflmFileFinder* iFileFinder; - - // Own: Stores currently used sort method - // Main thread is allowed write and work thread is allowed to read only - TGflmSortMethod iSortMethod; - - // Own: Stores currently used sort method in search mode - // Main thread is allowed write and work thread is allowed to read only - TGflmSortMethod iSearchSortMethod; - - // Own: Stores currently used refresh mode - // Main thread is allowed write and work thread is allowed to read only - TGflmRefreshMode iRefreshMode; - - }; - -#endif // CGFLMFILELISTMODEL_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/CGflmFileRecognizer.h --- a/filemanager/GFLM/inc/CGflmFileRecognizer.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +0,0 @@ -/* -* Copyright (c) 2002-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: Recogniser wrapper -* -*/ - - - -#ifndef CGFLMFILERECOGNIZER_H -#define CGFLMFILERECOGNIZER_H - - -// INCLUDES -#include -#include -#include - - -// FORWARD DECLARATIONS -class CGflmDriveResolver; - - -// CLASS DECLARATION - -/** -* A class for wrapping recogniser functionality. -* -* @lib GFLM.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CGflmFileRecognizer) : public CBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CGflmFileRecognizer* NewL( - RFs& aFs, - TInt aMemoryConsumption, - CGflmDriveResolver* aDriveResolver ); - - /** - * Destructor. - */ - virtual ~CGflmFileRecognizer(); - - public: // New functions - - /** - * Recognises a MIME type of file. - * @since S60 3.1 - * @param aFilename A name of the file - * @return Pointer to MIME type. KNullDesC if not recognised. - */ - TPtrC RecognizeL( const TDesC& aFilename ); - - /** - * Flushed recogniser cache. - * @since S60 3.1 - */ - void FlushCache(); - - private: - - NONSHARABLE_CLASS(CPathTypePair) : public CBase - { - public: - static CPathTypePair* NewLC( const TDesC& aFilename ); - void ConstructL( const TDesC& aFilename ); - CPathTypePair(); - ~CPathTypePair(); - TInt Size() const; - - public: - TDblQueLink iLink; - TInt iTypeIndex; - HBufC* iFilename; - }; - - NONSHARABLE_CLASS(CExtMimePair) : public CBase - { - public: - ~CExtMimePair(); - - public: - HBufC* iExt; - HBufC* iMime; - }; - - /** - * C++ default constructor. - */ - CGflmFileRecognizer( - CGflmDriveResolver* aDriveResolver, - RFs& aFs ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( TInt aMemoryConsumption ); - - /** - * Cleans old entries from cache according to specified per cent - * - */ - void CleanupCache( ); - - /** - * Constructs file extension mime pairs - * - */ - void ConstructExtMimePairsL( - RResourceFile& aResFile, - TInt aResId, - RPointerArray< CExtMimePair >& aPairs ); - - /** - * Finds mime from file extension - * - */ - TPtrC FindMimeFromExt( - const TDesC& aExt, RPointerArray< CExtMimePair >& aPairs ); - - /** - * Does actual recognition - * - */ - TPtrC DoRecognizeL( const TDesC& aFilename ); - - /** - * Reset and Destroy the RPointArray of CExtMimePair - * - */ - static void ResetAndDestroyExtMimePairs( TAny* aPtr ); - - private: // Data - // Own: For using the apparc recognisers - RApaLsSession iApaSession; - - // Array for mime types, owned - CDesCArraySeg* iMimeTypes; - - // Mime type cache, owned - TDblQue< CPathTypePair > iCache; - - // Current memory usage for cache - TInt iCacheMemoryUsage; - - // Maximum memory usage for cache - TInt iCacheMaxMemoryUsage; - - // Ref: Pointer to drive resolver - CGflmDriveResolver* iDriveResolver; - - // Own: General file extension mime pairs - RPointerArray< CExtMimePair > iExtMimePairs; - - // Own: Remote drive specific file extension mime pairs - RPointerArray< CExtMimePair > iRemoteExtMimePairs; - - // Ref: Open file server session - RFs& iFs; - - }; - -#endif // CGFLMFILERECOGNIZER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/CGflmFileSystemItem.h --- a/filemanager/GFLM/inc/CGflmFileSystemItem.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +0,0 @@ -/* -* Copyright (c) 2002-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: File system item definitions -* -*/ - - - -#ifndef CGFLMFILESYSTEMITEM_H -#define CGFLMFILESYSTEMITEM_H - - -// INCLUDES -#include -#include "CGflmGroupItem.h" - - -// FORWARD DECLARATIONS -class TEntry; - - -// CLASS DECLARATION - -/** -* A class representing a file system item. -* A file system item is either a file or a directory. -* -* @lib GFLM.lib -* @since 2.0 -*/ -class CGflmFileSystemItem : public CGflmGroupItem - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CGflmFileSystemItem* NewLC( - const TEntry& aFSEntry, - const TDesC& aBasePath ); - - /** - * Destructor. - */ - virtual ~CGflmFileSystemItem( ); - - public: // New functions - - /** - * Get the full path of the item. - * @since 2.0 - * @param aPath Modifiable descriptor with atleast the size of - * KMaxFileName. The full path of the item will be - * placed in this descriptor. - */ - IMPORT_C void GetFullPath( TDes& aPath ) const; - - /** - * Sets the localized name of the item. - * @since 2.0 - * @param aName A descriptor containing the localized name for the - entry. A copy of the name is created. - */ - IMPORT_C void SetLocalizedNameL( const TDesC& aName ); - - /** - * Get reference to TEntry object of the item. - * @since 3.1 - * @return A reference to TEntry object. - */ - IMPORT_C const TEntry& Entry() const; - - /** - * Get the full path of the item. - * @since 3.2 - * @return Item full path. The pointer must be freed. - */ - IMPORT_C HBufC* FullPathLC() const; - - /** - * Get the full path of the item. - * @since 3.2 - * @return Item full path. The pointer must be freed. - */ - IMPORT_C HBufC* FullPathL() const; - - public: // From CGflmGroupItem - - TGflmItemType Type() const; - - TPtrC Name() const; - - TTime Date() const; - - TInt64 Size() const; - - TPtrC Ext() const; - - private: - - void SetExt(); - - protected: - - /** - * C++ default constructor. - */ - CGflmFileSystemItem( - const TEntry& aFSEntry, - const TDesC& aBasePath ); - - inline CGflmFileSystemItem() - { - } - - inline void SetBasePath( const TDesC& aBasePath ) - { - iBasePath.Set( aBasePath ); - } - - void SetEntry( const TEntry& aFSEntry ); - - private: // Data - // A reference to a TEntry object that is the actual filesystem entry - const TEntry* iFSEntry; - - // A pointer descriptor that contains the base path of the - // filesystem entry. - TPtrC iBasePath; - - // The localized name of the entry. NULL if it doesn't have one. - HBufC* iLocalizedName; - - // A pointer descriptor that contains the file extension - TPtrC iExt; - - }; - -#endif // CGFLMFILESYSTEMITEM_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/CGflmGlobalActionItem.h --- a/filemanager/GFLM/inc/CGflmGlobalActionItem.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* -* Copyright (c) 2002-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: Global action item definitions -* -*/ - - - -#ifndef CGFLMGLOBALACTIONITEM_H -#define CGFLMGLOBALACTIONITEM_H - - -// INCLUDES -#include -#include "CGflmGroupItem.h" - - -// CLASS DECLARATION - -/** -* A class representing a global action item. -* A global item item is visible all the time in a group. -* -* @lib GFLM.lib -* @since 2.0 -*/ -class CGflmGlobalActionItem : public CGflmGroupItem - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CGflmGlobalActionItem* NewLC( - TInt aId, const TDesC& aCaption ); - - /** - * Destructor. - */ - virtual ~CGflmGlobalActionItem(); - - public: // New functions - /** - * Returns the id of the action item - * @since 2.0 - * @return Id of the item - */ - IMPORT_C TInt Id() const; - - public: // From CGflmGroupItem - - TGflmItemType Type() const; - - TPtrC Name() const; - - TTime Date() const; - - TInt64 Size() const; - - TPtrC Ext() const; - - protected: // New functions - - /** - * C++ default constructor. - */ - CGflmGlobalActionItem(); - - private: - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( const TDesC& aCaption ); - - private: // Data - - // Id of the action item - TInt iId; - - // Caption of the action item - HBufC* iCaption; - - }; - -#endif // CGFLMGLOBALACTIONITEM_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/CGflmGroupItem.h --- a/filemanager/GFLM/inc/CGflmGroupItem.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,219 +0,0 @@ -/* -* Copyright (c) 2002-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: Group item definitions -* -*/ - - - -#ifndef CGFLMGROUPITEM_H -#define CGFLMGROUPITEM_H - - -// INCLUDES -#include -#include "GFLM.hrh" - -// FORWARD DECLARATIONS -class MGflmItemGroup; - -// CLASS DECLARATION - -/** -* A base class for all GFLM item classes -* -* @lib GFLM.lib -* @since 2.0 -*/ -class CGflmGroupItem : public CBase - { - - public: - // Data types in default priority order - enum TGflmItemType - { - EGlobalActionItem = 0, - EDrive, - EDirectory, - EFile - }; - - public: // Constructors and destructor - - /** - * Destructor. - */ - virtual ~CGflmGroupItem(); - - public: // New functions - - /** - * Returns the type of the item. - * @since 2.0 - * @return Type of the item. - */ - virtual TGflmItemType Type() const = 0; - - /** - * Returns the name of the item. - * @since 2.0 - * @return A pointer descriptor containing the name of the item. - */ - virtual TPtrC Name() const = 0; - - /** - * Returns the date of the item. - * @since 2.0 - * @return A TTime object containing the date of the item. - */ - virtual TTime Date() const = 0; - - /** - * Returns the size. - * @since 5.0 - * @return Size in bytes - */ - virtual TInt64 Size() const = 0; - - /** - * Returns the extension of the item. - * @since 5.0 - * @return A pointer descriptor containing the extension of the item - */ - virtual TPtrC Ext() const = 0; - - /** - * Returns the icon id of the item. - * @since 3.1 - * @param aIconId Reference of icon id. Filled if icon is defined. - * @return KErrNotFound if icon id is undefined. - * Otherwise KErrNone. - */ - IMPORT_C TInt GetIconId( TInt& aIconId ); - - /** - * Stores the icon id of the item. - * @since 3.1 - * @param aIconId Icon id of the item. - */ - IMPORT_C void SetIconId( const TInt aIconId ); - - /** - * Checks if simple name comparison can be used that is - * significantly faster compared to normal comparison. - * @since 3.2 - * @return ETrue if simple name comparison can be used, otherwise EFalse - */ - TBool CanUseCompareF() const; - - /** - * Sets the group owning the item - * @since 3.2 - * @param Pointer to the group or NULL - */ - void SetGroup( MGflmItemGroup* aGroup ); - - /** - * Gets sort function from method - * @since 5.0 - * @param aSortMethod Given sort method - */ - static TLinearOrder< CGflmGroupItem > GetSortL( TGflmSortMethod aSortMethod ); - - /** - * Compares items by name and ignores item type - * @since 5.0 - * @param aFirst Given first item for comparison - * @param aSecond Given second item for comparison - * @return Comparison result - */ - static TInt CompareByNameWithoutItemType( - const CGflmGroupItem& aFirst, - const CGflmGroupItem& aSecond ); - - /** - * Compares items by name with item type - * @since 5.0 - * @param aFirst Given first item for comparison - * @param aSecond Given second item for comparison - * @return Comparison result - */ - static TInt CompareByName( - const CGflmGroupItem& aFirst, - const CGflmGroupItem& aSecond ); - - /** - * Compares items by type - * @since 5.0 - * @param aFirst Given first item for comparison - * @param aSecond Given second item for comparison - * @return Comparison result - */ - static TInt CompareByType( - const CGflmGroupItem& aFirst, - const CGflmGroupItem& aSecond ); - - /** - * Compares items by modified date and time - * @since 5.0 - * @param aFirst Given first item for comparison - * @param aSecond Given second item for comparison - * @return Comparison result - */ - static TInt CompareMostRecentFirst( - const CGflmGroupItem& aFirst, - const CGflmGroupItem& aSecond ); - - /** - * Compares items by size - * @since 5.0 - * @param aFirst Given first item for comparison - * @param aSecond Given second item for comparison - * @return Comparison result - */ - static TInt CompareLargestFirst( - const CGflmGroupItem& aFirst, - const CGflmGroupItem& aSecond ); - - protected: // New functions - - /** - * C++ default constructor. - */ - CGflmGroupItem(); - - private: - // Internal status flags - enum TStatus - { - ECanUseCompareF = 0x1, - ECannotUseCompareF = 0x2 - }; - - static TInt CompareByItemType( - const CGflmGroupItem& aFirst, - const CGflmGroupItem& aSecond ); - - private: // Data - // Icon id of the item. - TInt iIconId; - // Internal status of the item. - mutable TUint iStatus; - // Group owning the item. Not owned. - MGflmItemGroup* iGroup; - }; - -#endif // CGFLMGROUPITEM_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/CGflmItemGroupImpl.h --- a/filemanager/GFLM/inc/CGflmItemGroupImpl.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +0,0 @@ -/* -* Copyright (c) 2002-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: Concrete implementation of MGflmItemGroup interface -* -*/ - - - -#ifndef CGFLMITEMGROUPIMPL_H -#define CGFLMITEMGROUPIMPL_H - - -// INCLUDES -#include "MGflmItemGroup.h" -#include -#include -#include - - -// FORWARD DECLARATIONS -class RFs; -class CGflmDirectoryListingCache; -class CGflmFileRecognizer; -class CGflmItemLocalizer; -class CGflmDriveResolver; -class MGflmItemFilter; - - -// CLASS DECLARATION - -/** -* Concrete implementation of MGflmItemGroup interface -* -* @lib GFLM.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CGflmItemGroupImpl) : public CBase, public MGflmItemGroup - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aId The new id - * @param aFss A reference to an open and valid file server session - * @param aCache A constructed directory listing cache - * @param aRecognizer A constructed file recognizer - * @param aLocalizer A constructed item localizer - * @param aResolver A constructed drive letter resolver - */ - static CGflmItemGroupImpl* NewLC( - const TInt aId, - RFs& aFss, - CGflmDirectoryListingCache& aCache, - CGflmItemLocalizer& aLocalizer, - CGflmDriveResolver& aResolver ); - - /** - * Destructor. - */ - virtual ~CGflmItemGroupImpl(); - - public: // New functions - - /** - * Refreshes and reformats the contents of the group - * @since 2.0 - * @param aFilter MGflmItemFilter object used to to filter the contents - * @param aSortMethod Sort method - * @param aRefreshMode Refresh mode - */ - void RefreshL( - MGflmItemFilter* aFilter, - TGflmSortMethod aSortMethod, - TGflmRefreshMode aRefreshMode ); - - public: // From MGflmItemGroup - - TInt Id() const; - - TInt ItemCount() const; - - CGflmGroupItem* Item( TInt aIndex ); - - void AddSourceL( const TDesC& aDirectory ); - - void ResetSources(); - - void AddActionItemL( TInt aId, const TDesC& aCaption ); - - void SetInclusion( TUint aInclusion ); - - const TCollationMethod* CollationMethod(); - - private: - - /** - * Constructor. - * @param aId The new id - * @param aFss A reference to an open and valid file server session - * @param aCache A constructed directory listing cache - * @param aLocalizer A constructed item localizer - * @param aResolver A constructed drive letter resolver - */ - CGflmItemGroupImpl( - const TInt aId, - RFs& aFss, - CGflmDirectoryListingCache& aCache, - CGflmItemLocalizer& aLocalizer, - CGflmDriveResolver& aResolver ); - - void ConstructL(); - - void PopulateReferenceListL( MGflmItemFilter* aFilter ); - - private: // Data - - // Id of the group - TInt iId; - - // Reference to an open fileserver session - RFs& iFss; - - // Inclusion type - TUint iInclusion; - - // Contains (and owns) static items (action items and symbolic - // links) of this group - RPointerArray< CGflmGroupItem > iStaticItems; - - // Contains (and owns) volatile items (information aquired from - // the filesystem) of this group - RPointerArray< CGflmGroupItem > iVolatileItems; - - // Contains the same items as iStaticItems and iVolatileItems, - // but doesn't own them - RPointerArray< CGflmGroupItem > iItemReferences; - - // Directory name - HBufC* iDirectory; - - // Reference to a CGflmDirectoryListingCache object. Not owned. - CGflmDirectoryListingCache& iListingCache; - - // Reference to an CGflmItemLocalizer object. Not owned. - CGflmItemLocalizer& iItemLocalizer; - - // Reference to an CGflmDriveResolver object. Not owned. - CGflmDriveResolver& iDriveResolver; - - // Used collation method - TCollationMethod iSortCollationMethod; - - }; - -#endif // CGFLMITEMGROUPIMPL_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/CGflmItemLocalizer.h --- a/filemanager/GFLM/inc/CGflmItemLocalizer.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* -* Copyright (c) 2002-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: This class is used to provide localized names -* -*/ - - - -#ifndef CGFLMITEMLOCALIZER_H -#define CGFLMITEMLOCALIZER_H - - -// INCLUDES -#include - - -// FORWARD DECLARATIONS -class CDirectoryLocalizer; - - -// CLASS DECLARATION - -/** -* This class is used to provide localized names to files and directories -* -* @lib GFLM.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CGflmItemLocalizer) : public CBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CGflmItemLocalizer* NewL(); - - /** - * Destructor. - */ - virtual ~CGflmItemLocalizer(); - - public: // New functions - - /** - * Get the localized name of a file or a directory by it's path. - * Works only in main thread context. - * @since 2.0 - * @param aPath A descriptor containing the full path to be localized - * @return A TPtrC object containing the localized name. KNullDesC - * if no localized name is defined. - */ - TPtrC Localize( const TDesC& aPath ) const; - - /** - * Get the localized name of a file or a directory by it's path - * Works only in work thread context. - * @since 3.2 - * @param aPath A descriptor containing the full path to be localized - * @return A TPtrC object containing the localized name. KNullDesC - * if no localized name is defined. - */ - TPtrC LocalizeFromWorkThread( const TDesC& aPath ) const; - - /** - * Setups localizer for work thread - * Works only in work thread context. - * @since 3.2 - */ - void SetupWorkThreadLocalizerL(); - - /** - * Releases localizer used by work thread - * Works only in work thread context. - * @since 3.2 - */ - void ReleaseWorkThreadLocalizer(); - - private: - - /** - * C++ default constructor. - */ - CGflmItemLocalizer(); - - void ConstructL(); - - TPtrC Localize( - CDirectoryLocalizer& aLocalizer, const TDesC& aPath ) const; - - private: // Data - // Own: For localising in main thread context - CDirectoryLocalizer* iLocalizer; - - // Own: For localising in work thread context - CDirectoryLocalizer* iWorkThreadLocalizer; - - }; - -#endif // CGFLMITEMLOCALIZER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/CGflmNavigatorModel.h --- a/filemanager/GFLM/inc/CGflmNavigatorModel.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* -* Copyright (c) 2002-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: Navigable file list model -* -*/ - - - -#ifndef CGFLMNAVIGATORMODEL_H -#define CGFLMNAVIGATORMODEL_H - - -// INCLUDES -#include "CGflmFileListModel.h" - - -// FORWARD DECLARATIONS -class CGflmDriveItem; - - -// CLASS DECLARATION - -/** -* Decorates the file list model with navigator functionality -* -* @lib GFLM.lib -* @since 2.0 -*/ -class CGflmNavigatorModel : public CGflmFileListModel - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - IMPORT_C static CGflmNavigatorModel* NewL( RFs& aFs ); - - /** - * Destructor. - */ - virtual ~CGflmNavigatorModel(); - - public: // New functions - - /** - * Sets the navigator's basepath to a given directory - * @since 2.0 - * @param aPath A descriptor containing the directory to enter - * @param aBackstepping If false the backstepping stack is reset - */ - IMPORT_C void GoToDirectoryL( const TDesC& aPath, - TBool aBackstepping = ETrue ); - - /** - * Sets the navigator's basepath to a given directory and - * constructs a backstepping stack that leads from the base path - * to the top path one intermediate directory at a time - * @since 2.0 - * @param aBasePath A descriptor containing the base path - * @param aTopPath A descriptor containing the directory to enter - */ - IMPORT_C void GoToDirectoryL( const TDesC& aBasePath, - const TDesC& aTopPath ); - - /** - * Navigates one step backwards. - * @since 2.0 - */ - IMPORT_C void BackstepL(); - - /** - * Returns the current navigation directory - * @since 2.0 - * @return A pointer descriptor containing the current navigation - * directory. - */ - IMPORT_C TPtrC CurrentDirectory() const; - - /** - * Returns the localized name of the current navigation directory - * @since 2.0 - * @return A pointer descriptor containing the localized name - * of the current navigation directory. - */ - IMPORT_C TPtrC LocalizedNameOfCurrentDirectory() const; - - /** - * Returns the current navigation level, the depth of backstep stack - * @since 2.0 - * @return Current navigation level - */ - IMPORT_C TInt NavigationLevel() const; - - /** - * Obtains a pointer to current drive (not own). - * @since 3.1 - * @return Pointer to current drive or NULL. - */ - IMPORT_C CGflmDriveItem* CurrentDrive() const; - - private: - - /** - * C++ default constructor. - */ - CGflmNavigatorModel( RFs& aFs ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Sets the navigator's base directory - * @since 2.0 - * @param aDirectory The new base directory - */ - void SetBaseDirectoryL( const TDesC& aDirectory ); - - void SetSourceL( const TDesC& aSource ); - - TBool IsValidSource( const TDesC& aSource ) const; - - private: // Data - - // An dynamic array holding backstepping information - CDesCArraySeg* iBackstepStack; - - }; - -#endif // CGFLMNAVIGATORMODEL_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/GFLM.hrh --- a/filemanager/GFLM/inc/GFLM.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2002-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: GFLM resource header file -* -*/ - - - -#ifndef GFLM_HRH -#define GFLM_HRH - - -// DATA TYPES - -enum TGflmSortMethod - { - EByName = 0, - EByType, - EMostRecentFirst, - ELargestFirst, - EByMatch - }; - -enum TGflmFSItemInclusion - { - ENothing = 0, - EFiles = 0x1, - EDirectories = 0x2, - EDrives = 0x4 - }; - -enum TGflmPanicReason - { - EGlobalIndexOutOfBounds = 0, - EUnknownSortMethod, - ENotADirectory, - EInvalidGroupId, - ENotAnActionItem - }; - -enum TGflmRefreshMode - { - ERefreshItems = 0, - ERefreshSort - }; - -#endif - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/GFLMConsts.h --- a/filemanager/GFLM/inc/GFLMConsts.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2002-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: Contains constants of GFLM -* -*/ - - - -#ifndef GFLMCONSTS_H -#define GFLMCONSTS_H - - -// CONSTANTS -_LIT( KGFLMPanicText, "GFLM" ); -_LIT( KGFLMWorkThreadName, "GFLM work thread" ); -const TInt KGFLMWorkThreadStackSize( 8192 ); // 8KB -const TInt KGFLMFileRecognizerCacheSize( 16384 ); // 16KB -_LIT( KGFLMBackslash, "\\" ); -_LIT( KGFLMDot, "." ); - -#endif // GFLMCONSTS_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/GFLMUid.h --- a/filemanager/GFLM/inc/GFLMUid.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2002-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: Defines UIDs for GFLM -* -*/ - - - -#ifndef GFLMUID_H -#define GFLMUID_H - -// MACROS -#define KSymbianDLLUid2 0x1000008d // Symbian defined -#define KGflmUid3 0x101F84EA - -#endif // GFLMUID_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/GflmFileExtensionMimeTypes.rh --- a/filemanager/GFLM/inc/GflmFileExtensionMimeTypes.rh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2002-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 for GFLM extension MIME types -* -*/ - - -STRUCT EXT_MIME_PAIR -{ - LTEXT extension; - LTEXT mime_type; -} - -STRUCT EXT_MIME_PAIR_LIST -{ - STRUCT pairs []; -} - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/GflmUtils.h --- a/filemanager/GFLM/inc/GflmUtils.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* -* Copyright (c) 2002-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: Static utility class for GFLM -* -*/ - - - -#ifndef GFLMUTILS_H -#define GFLMUTILS_H - - -// INCLUDES -#include -#include -#include "FileManagerDebug.h" - -// FORWARD DECLARATIONS -class TEntry; - -// CLASS DECLARATION -/** -* GflmUtils is a static utility class -* -* @lib GFLM.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(GflmUtils) - { - public: - - /** - * Returns the index of a Nth character in a descriptor. The search - * is started from the end of the descriptor - * @since 2.0 - * @param aDescriptor The descriptor upon which the search is made - * @param aChar The character that is located - * @param aNth Tells how many matches are made - * @return Index to the located character. KErrNotFound if the character - * was not found. KErrArgument if aNth was <= 0 - */ - static TInt LocateReverseNth( - const TDesC& aDescriptor, TChar aChar, const TInt aNth); - - /** - * Ensures that final backslash is set - * @since 3.1 - * @param aPath - */ - IMPORT_C static void EnsureFinalBackslash( TDes& aPath ); - - /** - * Strips final backslash if it exists - * @since 3.1 - * @param aPath - * @return Pointer to stripped path - */ - IMPORT_C static TPtrC StripFinalBackslash( const TDesC& aPath ); - - /** - * Checks if final backslash exist - * @since 3.2 - * @param aPath Directory path - */ - IMPORT_C static TBool HasFinalBackslash( const TDesC& aPath ); - - /** - * Gets item full path - * @since 3.2 - * @param aDir Parent directory path - * @param aEntry File system entry - * @param aFullPath Full path to item - */ - IMPORT_C static void GetFullPath( - const TDesC& aDir, const TEntry& aEntry, TDes& aFullPath ); - - /** - * Gets item full path - * @since 3.2 - * @param aDir Parent directory path - * @param aEntry File system entry - * @return Pointer to full path - */ - IMPORT_C static HBufC* FullPathLC( - const TDesC& aDir, const TEntry& aEntry ); - - /** - * Gets item full path - * @since 3.2 - * @param aDir Parent directory path - * @param aEntry File system entry - * @return Pointer to full path - */ - IMPORT_C static HBufC* FullPathL( - const TDesC& aDir, const TEntry& aEntry ); - - /** - * Strips final dot if it exists - * @since 3.1 - * @param aPath - * @return Pointer to stripped path - */ - static TPtrC StripFinalDot( const TDesC& aPath ); - - /** - * Strips given string from end if it exists - * @since 3.2 - * @param aString - * @param aStringToStrip - * @return Pointer to stripped string - */ - static TPtrC StripFinal( const TDesC& aString, const TDesC& aStringToStrip ); - - /** - * Checks if string contains any wild cards - * @since 3.2 - * @param aString - * @return ETrue if string contains a wild card. Otherwise EFalse. - */ - static TBool HasWildCard( const TDesC& aString ); - - }; - -#endif // GFLMUTILS_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/MGflmItemFilter.h --- a/filemanager/GFLM/inc/MGflmItemFilter.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* -* Copyright (c) 2002-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: Defines an interface for making a custom filter to GFLM -* -*/ - - - -#ifndef MGFLMITEMFILTER_H -#define MGFLMITEMFILTER_H - - -// INCLUDES -#include - - -// FORWARD DECLARATIONS -class CGflmGroupItem; -class CGflmDriveItem; - - -// CLASS DECLARATION - -/** -* Defines an interface for making a custom filter to GFLM. -* -* @lib GFLM.lib -* @since 2.0 -*/ -class MGflmItemFilter - { - public: // New functions - - /** - * This method is called for every item to be filtered - * Note that the method is run in work thread space - * @since 2.0 - * @param aItem Group item to be filtered - * @param aGroupId Id of the group to which the item belongs - * @param aDrive The drive where item is located, NULL if data is unavailable - * @return True if item was accepted, false if not - */ - virtual TBool FilterItemL( - CGflmGroupItem* aItem, - TInt aGroupId, - CGflmDriveItem* aDrive ) = 0; - - }; - -#endif // MGFLMITEMFILTER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/inc/MGflmItemGroup.h --- a/filemanager/GFLM/inc/MGflmItemGroup.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* -* Copyright (c) 2002-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: Defines an interface for GFLM clients to access item groups -* -*/ - - - -#ifndef MGFLMITEMGROUP_H -#define MGFLMITEMGROUP_H - - -// INCLUDES -#include "GFLM.hrh" -#include - - -// FORWARD DECLARATIONS -class CGflmGroupItem; - - -// CLASS DECLARATION - -/** -* Defines an interface for GFLM clients to access item groups -* -* @lib GFLM.lib -* @since 2.0 -*/ -class MGflmItemGroup - { - public: // New functions - - /** - * Returns the Id of the group - * @since 2.0 - * @return Id of the group - */ - virtual TInt Id() const = 0; - - /** - * Returns the number of items in the group - * @since 2.0 - * @return Number of items in the group - */ - virtual TInt ItemCount() const = 0; - - /** - * Returns a pointer to a specific item in the group by its index - * @since 2.0 - * @param aIndex Index of the requested CGflmGroupItem object - * @return Pointer to a CGflmGroupItem object - */ - virtual CGflmGroupItem* Item( TInt aIndex ) = 0; - - /** - * Adds a new filesystem source to the group - * @since 2.0 - * @param aDirectory Path of the directory to add to the group - */ - virtual void AddSourceL( const TDesC& aDirectory ) = 0; - - /** - * Resets the list of filesystem sources - * @since 2.0 - */ - virtual void ResetSources() = 0; - - /** - * Adds a new action item to the group - * @since 2.0 - * @param aId Id of the new action item - * @param aCaption Caption of the new action item - */ - virtual void AddActionItemL( TInt aId, const TDesC& aCaption ) = 0; - - /** - * Sets the inclusion mode (files/directories) of the group - * @since 2.0 - * @param aInclusion New inclusion mode. See TGflmFSItemInclusion. - */ - virtual void SetInclusion( TUint aInclusion ) = 0; - - /** - * Gets the collation method - * @since 5.0 - * @return Pointer to collation method - */ - virtual const TCollationMethod* CollationMethod() = 0; - - }; - -#endif // MGFLMITEMGROUP_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/src/CGflmDirectoryListingCache.cpp --- a/filemanager/GFLM/src/CGflmDirectoryListingCache.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,217 +0,0 @@ -/* -* Copyright (c) 2002-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: Provides directory listing cache -* -*/ - - - -// INCLUDE FILES -#include "CGflmDirectoryListingCache.h" -#include "GFLM.hrh" -#include "GflmUtils.h" -#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS -#include -#else -#include -#include -#endif -#include - - -// CONSTANTS -const TInt KListingGranularity = 0x2000; // 8KB - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGflmDirectoryListingCache::CGflmDirectoryListingCache -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CGflmDirectoryListingCache::CGflmDirectoryListingCache( - RFs& aFss, - const TBool& aCancelIndicator ) : - iFss( aFss ), - iCancelIndicator( aCancelIndicator ) - { - } - -// ----------------------------------------------------------------------------- -// CGflmDirectoryListingCache::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CGflmDirectoryListingCache* CGflmDirectoryListingCache::NewL( - RFs& aFss, - const TBool& aCancelIndicator ) - { - return new( ELeave ) CGflmDirectoryListingCache( - aFss, aCancelIndicator ); - } - -// ----------------------------------------------------------------------------- -// CGflmDirectoryListingCache::~CGflmDirectoryListingCache() -// ----------------------------------------------------------------------------- -// -CGflmDirectoryListingCache::~CGflmDirectoryListingCache() - { - delete iCache; - } - -// ----------------------------------------------------------------------------- -// CGflmDirectoryListingCache::ClearCache() -// ----------------------------------------------------------------------------- -// -void CGflmDirectoryListingCache::ClearCache() - { - iClearCache = ETrue; - } - -// ----------------------------------------------------------------------------- -// CGflmDirectoryListingCache::ListingL() -// Looks if a directory's listing is already loaded and returns it. If the -// the listing is not found, it's read and added to the cache. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -const CGflmDirectoryListingCache::CEntryArray* - CGflmDirectoryListingCache::ListingL( const TDesC& aDirectory ) - { - - TIMESTAMP( "GFLM listing fetch started: " ) - - // Clear directory cache first if needed - if ( iClearCache ) - { - delete iCache; - iCache = NULL; - iClearCache = EFalse; - } - - // Check if directory is already cached - TBool found( EFalse ); - if ( iCache && !aDirectory.Compare( *( iCache->iDirectory ) ) ) - { - found = ETrue; - } - - if ( !found ) - { - // Read directory to cache - CListingNamePair* newPair = CListingNamePair::NewLC( aDirectory ); - GetDirL( *newPair ); - CleanupStack::Pop( newPair ); - delete iCache; - iCache = NULL; - iCache = newPair; - } - - TIMESTAMP( "GFLM listing fetch ended: " ) - - return iCache->iListing; - } - -// ----------------------------------------------------------------------------- -// CGflmDirectoryListingCache::GetDirL -// ----------------------------------------------------------------------------- -// -void CGflmDirectoryListingCache::GetDirL( CListingNamePair& aPair ) - { - RDir dir; - User::LeaveIfError( dir.Open( - iFss, - *aPair.iDirectory, - KEntryAttNormal | KEntryAttDir ) ); - CleanupClosePushL( dir ); - - TInt err( KErrNone ); - - do - { - if ( iCancelIndicator ) - { - // User has canceled the operation, abort - User::Leave( KErrCancel ); - } - - err = dir.Read( iEntryBuffer ); - if ( err == KErrNone || err == KErrEof ) - { - TInt entryCount( iEntryBuffer.Count() ); - if ( !entryCount ) - { - break; - } - for ( TInt i( 0 ); i < entryCount; i++ ) - { - const TEntry& entry( iEntryBuffer[ i ] ); - TInt entrySize( EntrySize( entry, ETrue ) ); - aPair.iListing->AppendL( entry, entrySize ); - } - } - - }while ( err == KErrNone ); - - if ( err != KErrNone && err != KErrEof ) - { - User::Leave( err ); - } - - CleanupStack::PopAndDestroy( &dir ); - } - -// ----------------------------------------------------------------------------- -// CGflmDirectoryListingCache::CListingNamePair::~CListingNamePair() -// ----------------------------------------------------------------------------- -// -CGflmDirectoryListingCache::CListingNamePair::~CListingNamePair() - { - delete iDirectory; - - if ( iListing ) - { - iListing->Reset(); - delete iListing; - } - } - -// ----------------------------------------------------------------------------- -// CGflmDirectoryListingCache::CListingNamePair::ConstructL() -// ----------------------------------------------------------------------------- -// -void CGflmDirectoryListingCache::CListingNamePair::ConstructL( - const TDesC& aDirectory ) - { - iDirectory = aDirectory.AllocL(); - iListing = new( ELeave ) CEntryArray( KListingGranularity ); - } - -// ----------------------------------------------------------------------------- -// CGflmDirectoryListingCache::CListingNamePair::NewLC() -// ----------------------------------------------------------------------------- -// -CGflmDirectoryListingCache::CListingNamePair* - CGflmDirectoryListingCache::CListingNamePair::NewLC( - const TDesC& aDirectory ) - { - CListingNamePair* self = new ( ELeave ) CListingNamePair(); - CleanupStack::PushL( self ); - self->ConstructL( aDirectory ); - return self; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/src/CGflmDriveItem.cpp --- a/filemanager/GFLM/src/CGflmDriveItem.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,222 +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: Drive item definitions -* -*/ - - - -// INCLUDE FILES -#include "CGflmDriveItem.h" -#include "GflmUtils.h" - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::CGflmDriveItem -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CGflmDriveItem::CGflmDriveItem( - const TInt aDrive, - const TVolumeInfo& aVolume, - const TInt aVolumeStatus, - const TUint aDriveStatus ) - : iVolume( aVolume ), - iDrive( aDrive ), - iVolumeStatus( aVolumeStatus ), - iDriveStatus( aDriveStatus ) - { - } - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CGflmDriveItem* CGflmDriveItem::NewLC( - const TInt aDrive, - const TVolumeInfo& aVolume, - const TInt aVolumeStatus, - const TUint aDriveStatus ) - { - CGflmDriveItem* self = new( ELeave ) CGflmDriveItem( - aDrive, - aVolume, - aVolumeStatus, - aDriveStatus ); - - CleanupStack::PushL( self ); - self->ConstructL(); - - return self; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CGflmDriveItem::ConstructL() - { - SetRootDirectoryL( TDriveUnit( iDrive ).Name() ); - } - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::~CGflmDriveItem -// -// ----------------------------------------------------------------------------- -// -CGflmDriveItem::~CGflmDriveItem() - { - delete iLocalizedName; - delete iRootDir; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::Type -// -// ----------------------------------------------------------------------------- -// -CGflmGroupItem::TGflmItemType CGflmDriveItem::Type() const - { - return EDrive; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::Name -// -// ----------------------------------------------------------------------------- -// -TPtrC CGflmDriveItem::Name() const - { - if ( iLocalizedName ) - { - return iLocalizedName->Des(); - } - return TPtrC( iVolume.iName ); - } - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::Date -// -// ----------------------------------------------------------------------------- -// -TTime CGflmDriveItem::Date() const - { - return TTime( 0 ); - } - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::Size -// -// ----------------------------------------------------------------------------- -// -TInt64 CGflmDriveItem::Size() const - { - return 0; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::Ext -// -// ----------------------------------------------------------------------------- -// -TPtrC CGflmDriveItem::Ext() const - { - return TPtrC( KNullDesC ); - } - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::SetLocalizedNameL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmDriveItem::SetLocalizedNameL( const TDesC& aName ) - { - HBufC* temp = aName.AllocL(); - delete iLocalizedName; - iLocalizedName = temp; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::SetRootDirectoryL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmDriveItem::SetRootDirectoryL( const TDesC& aPath ) - { - const TInt KFmgrBackslashSpace = 1; - TInt len( aPath.Length() ); - HBufC* temp = HBufC::NewL( len + KFmgrBackslashSpace ); - TPtr ptr( temp->Des() ); - ptr.Copy( aPath ); - GflmUtils::EnsureFinalBackslash( ptr ); - delete iRootDir; - iRootDir = temp; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::RootDirectory -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CGflmDriveItem::RootDirectory() const - { - return iRootDir->Des(); - } - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::GetVolumeInfo -// -// ----------------------------------------------------------------------------- -// -EXPORT_C const TVolumeInfo& CGflmDriveItem::VolumeInfo() const - { - return iVolume; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::Drive -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CGflmDriveItem::Drive() const - { - return iDrive; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::VolumeStatus -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CGflmDriveItem::VolumeStatus() const - { - return iVolumeStatus; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveItem::DriveStatus -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TUint CGflmDriveItem::DriveStatus() const - { - return iDriveStatus; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/src/CGflmDriveResolver.cpp --- a/filemanager/GFLM/src/CGflmDriveResolver.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,309 +0,0 @@ -/* -* Copyright (c) 2002-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: Resolves different media types' drive letters -* -*/ - - - -// INCLUDE FILES -#include "CGflmDriveResolver.h" -#include "CGflmDriveItem.h" -#include "MGflmItemFilter.h" -#include "GflmUtils.h" -#include -#ifdef RD_MULTIPLE_DRIVE - #include -#endif // RD_MULTIPLE_DRIVE - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGflmDriveResolver::CGflmDriveResolver -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CGflmDriveResolver::CGflmDriveResolver( RFs& aFs ) : - iFs( aFs ) - { - } - -// ----------------------------------------------------------------------------- -// CGflmDriveResolver::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CGflmDriveResolver* CGflmDriveResolver::NewL( RFs& aFs ) - { - CGflmDriveResolver* self = new ( ELeave ) CGflmDriveResolver( aFs ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveResolver::ConstructL -// ----------------------------------------------------------------------------- -// -void CGflmDriveResolver::ConstructL() - { - User::LeaveIfError( iCs.CreateLocal() ); - } - -// ----------------------------------------------------------------------------- -// CGflmDriveResolver::~CGflmDriveResolver -// -// ----------------------------------------------------------------------------- -// -CGflmDriveResolver::~CGflmDriveResolver() - { - iDrives.ResetAndDestroy(); - iDrives.Close(); - iCs.Close(); - } - -// ----------------------------------------------------------------------------- -// CGflmDriveResolver::RefreshDrives() -// -// ----------------------------------------------------------------------------- -// -TInt CGflmDriveResolver::RefreshDrives( MGflmItemFilter* aFilter ) - { - iCs.Wait(); - - TRAPD( ret, RefreshDrivesL( aFilter ) ); - - LOG_IF_ERROR1( - ret, "CGflmDriveResolver::RefreshDrives-ret=%d", ret ) - - iCs.Signal(); - - return ret; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveResolver::RefreshDrivesL() -// -// ----------------------------------------------------------------------------- -// -void CGflmDriveResolver::RefreshDrivesL( MGflmItemFilter* aFilter ) - { - TIMESTAMP( "GFLM refresh drives started: " ) - - if ( !iRefreshed ) - { - iDrives.ResetAndDestroy(); - TDriveList drives; - User::LeaveIfError( iFs.DriveList( drives, KDriveAttAll ) ); - TInt count( drives.Length() ); - for ( TInt i( 0 ); i < count; i++ ) - { - if ( drives[ i ] ) - { - AppendDriveL( i, aFilter ); - } - } - iRefreshed = ETrue; - } - - TIMESTAMP( "GFLM refresh drives ended: " ) - } - -// ----------------------------------------------------------------------------- -// CGflmDriveResolver::DriveCount() -// -// ----------------------------------------------------------------------------- -// -TInt CGflmDriveResolver::DriveCount() const - { - return iDrives.Count(); - } - -// ----------------------------------------------------------------------------- -// CGflmDriveResolver::DriveAt() -// -// ----------------------------------------------------------------------------- -// -CGflmDriveItem* CGflmDriveResolver::DriveAt( const TInt aIndex ) const - { - return iDrives[ aIndex ]; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveResolver::DriveFromPath() -// -// ----------------------------------------------------------------------------- -// -CGflmDriveItem* CGflmDriveResolver::DriveFromPath( const TDesC& aPath ) const - { - TInt drv( 0 ); - if ( aPath.Length() && - RFs::CharToDrive( aPath[ 0 ], drv ) == KErrNone ) - { - return DriveFromId( drv ); - } - return NULL; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveResolver::ClearDrives() -// -// ----------------------------------------------------------------------------- -// -void CGflmDriveResolver::ClearDrives() - { - iRefreshed = EFalse; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveResolver::IsRootPath() -// -// ----------------------------------------------------------------------------- -// -TBool CGflmDriveResolver::IsRootPath( const TDesC& aPath ) const - { - TInt count( iDrives.Count() ); - TInt pathLen( aPath.Length() ); - - for ( TInt i( 0 ); i < count; i++ ) - { - CGflmDriveItem* drvItem = iDrives[ i ]; - TPtrC root( drvItem->RootDirectory() ); - - if ( pathLen == root.Length() && !root.CompareF( aPath ) ) - { - return ETrue; - } - } - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveResolver::AppendDriveL() -// -// ----------------------------------------------------------------------------- -// -void CGflmDriveResolver::AppendDriveL( - const TInt aDrive, MGflmItemFilter* aFilter ) - { - INFO_LOG1( "CGflmDriveResolver::AppendDriveL()-aDrive=%d", aDrive ) - - TVolumeInfo volInfo; - TInt err( iFs.Volume( volInfo, aDrive ) ); - - LOG_IF_ERROR1( err, "CGflmDriveResolver::AppendDriveL()-err=%d", err ) - - if ( err != KErrNone ) - { - TInt err2( iFs.Drive( volInfo.iDrive, aDrive ) ); - - LOG_IF_ERROR1( err2, "CGflmDriveResolver::AppendDriveL()-err2=%d", err ) - - if ( err2 != KErrNone ) - { - return; - } - } - - TDriveInfo& drvInfo( volInfo.iDrive ); - if ( drvInfo.iMediaAtt & KMediaAttLocked ) - { - err = KErrLocked; - } - if ( drvInfo.iType == EMediaNotPresent ) - { - err = KErrNotReady; - } - - TUint drvStatus( 0 ); - -#ifdef RD_MULTIPLE_DRIVE - TInt err3( DriveInfo::GetDriveStatus( iFs, aDrive, drvStatus ) ); - LOG_IF_ERROR1( err3, "CGflmDriveResolver::AppendDriveL()-err3=%d", err3 ) - if ( err3 != KErrNone ) - { - // Supress error - } -#endif // RD_MULTIPLE_DRIVE - - CGflmDriveItem* drvItem = CGflmDriveItem::NewLC( - aDrive, volInfo, err, drvStatus ); - - if ( drvInfo.iDriveAtt & KDriveAttRemote ) - { - // Get remote drive name - if ( iFs.GetDriveName( aDrive, iReadBuffer ) == KErrNone ) - { - drvItem->SetLocalizedNameL( iReadBuffer ); - } - } - - TBool allowed( ETrue ); - if ( aFilter ) - { - allowed = aFilter->FilterItemL( drvItem, 0, NULL ); - } - if ( allowed ) - { - iDrives.AppendL( drvItem ); - CleanupStack::Pop( drvItem ); - } - else - { - CleanupStack::PopAndDestroy( drvItem ); - } - } - -// ----------------------------------------------------------------------------- -// CGflmDriveResolver::IsRemoteDrive() -// -// ----------------------------------------------------------------------------- -// -TBool CGflmDriveResolver::IsRemoteDrive( const TDesC& aPath ) const - { - CGflmDriveItem* drv = DriveFromPath( aPath ); - if ( drv ) - { - const TVolumeInfo& vol( drv->VolumeInfo() ); - if ( vol.iDrive.iDriveAtt & KDriveAttRemote ) - { - return ETrue; - } - } - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CGflmDriveResolver::DriveFromId() -// -// ----------------------------------------------------------------------------- -// -CGflmDriveItem* CGflmDriveResolver::DriveFromId( const TInt aDrive ) const - { - TInt count( iDrives.Count() ); - for ( TInt i( 0 ); i < count; i++ ) - { - CGflmDriveItem* drvItem = iDrives[ i ]; - if ( aDrive == drvItem->Drive() ) - { - return drvItem; - } - } - return NULL; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/src/CGflmFileFinder.cpp --- a/filemanager/GFLM/src/CGflmFileFinder.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,408 +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: Searches items matching with given string in given file system -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include "CGflmFileFinder.h" -#include "CGflmFileFinderItem.h" -#include "CGflmDriveItem.h" -#include "CGflmDriveResolver.h" -#include "CGflmItemLocalizer.h" -#include "MGflmItemFilter.h" -#include "GflmUtils.h" - -// CONSTANTS -const TInt KWildCardSpace = 2; -_LIT( KWildCard, "*" ); -const TInt KSearchResultsGranularity = 32; - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// MakeWildStringL -// ----------------------------------------------------------------------------- -// -static HBufC* MakeWildStringL( const TDesC& aString ) - { - if ( GflmUtils::HasWildCard( aString ) ) - { - return aString.AllocL(); - } - HBufC* ret = HBufC::NewL( aString.Length() + KWildCardSpace ); - TPtr ptr( ret->Des() ); - ptr.Copy( KWildCard ); - ptr.Append( aString ); - ptr.Append( KWildCard ); - return ret; - } - -// ----------------------------------------------------------------------------- -// MakeWildPathL -// ----------------------------------------------------------------------------- -// -#if 0 -static HBufC* MakeWildPathL( const TDesC& aFolder, const TDesC& aString ) - { - const TInt KBackslashSpace = 1; - if ( !GflmUtils::HasWildCard( aString ) ) - { - return aFolder.AllocL(); - } - HBufC* ret = HBufC::NewL( - aFolder.Length() + aString.Length() + KBackslashSpace ); - TPtr ptr( ret->Des() ); - ptr.Copy( aFolder ); - GflmUtils::EnsureFinalBackslash( ptr ); - ptr.Append( aString ); - return ret; - } -#endif // 0 - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::CGflmFileFinder -// ----------------------------------------------------------------------------- -// -CGflmFileFinder::CGflmFileFinder( - RFs& aFss, - CGflmItemLocalizer& aLocalizer, - CGflmDriveResolver& aResolver, - const TBool& aCancelIndicator ) : - iFss( aFss ), - iItemLocalizer( aLocalizer ), - iDriveResolver( aResolver ), - iCancelIndicator( aCancelIndicator ), - iSearchResults( KSearchResultsGranularity ) - { - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::NewL -// ----------------------------------------------------------------------------- -// -CGflmFileFinder* CGflmFileFinder::NewL( - RFs& aFss, - CGflmItemLocalizer& aLocalizer, - CGflmDriveResolver& aResolver, - const TBool& aCancelIndicator ) - { - CGflmFileFinder* self = new( ELeave ) CGflmFileFinder( - aFss, aLocalizer, aResolver, aCancelIndicator ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::ConstructL -// ----------------------------------------------------------------------------- -// -void CGflmFileFinder::ConstructL() - { - iSortCollationMethod = *Mem::CollationMethodByIndex( 0 ); - iSortCollationMethod.iFlags |= - TCollationMethod::EIgnoreNone | TCollationMethod::EFoldCase; - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::~CGflmFileFinder -// ----------------------------------------------------------------------------- -// -CGflmFileFinder::~CGflmFileFinder() - { - delete iSearchFolder; - delete iSearchFolderWild; - delete iSearchString; - delete iSearchStringWild; - iSearchResults.ResetAndDestroy(); - iSearchResults.Close(); - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::SetSearchFolderL -// ----------------------------------------------------------------------------- -// -void CGflmFileFinder::SetSearchFolderL( const TDesC& aSearchFolder ) - { - delete iSearchFolderWild; - iSearchFolderWild = NULL; - - delete iSearchFolder; - iSearchFolder = NULL; - iSearchFolder = aSearchFolder.AllocL(); - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::SetSearchStringL -// ----------------------------------------------------------------------------- -// -void CGflmFileFinder::SetSearchStringL( const TDesC& aSearchString ) - { - delete iSearchFolderWild; - iSearchFolderWild = NULL; - - delete iSearchString; - iSearchString = NULL; - iSearchString = aSearchString.AllocL(); - - delete iSearchStringWild; - iSearchStringWild = NULL; - iSearchStringWild = MakeWildStringL( aSearchString ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::RefreshL -// ----------------------------------------------------------------------------- -// -void CGflmFileFinder::RefreshL( - MGflmItemFilter* aFilter, - TGflmSortMethod aSortMethod, - TGflmRefreshMode aRefreshMode ) - { - FUNC_LOG - - INFO_LOG2( - "CGflmItemGroupImpl::RefreshL-aRefreshMode=%d, aSortMethod=%d", - aRefreshMode, aSortMethod ) - - if ( aRefreshMode == ERefreshItems ) - { - TRAPD( err, DoSearchL( aFilter ) ); - - // If error just log it and show already found items - if ( err != KErrNone ) - { - ERROR_LOG1( "CGflmFileFinder::RefreshL-err=%d", err ) - } - } - - if ( aSortMethod == EByMatch ) - { - iSearchResults.Sort( CGflmFileFinderItem::CompareByMatch ); - } - else - { - iSearchResults.Sort( CGflmGroupItem::GetSortL( aSortMethod ) ); - } - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::DoSearchL -// ----------------------------------------------------------------------------- -// -void CGflmFileFinder::DoSearchL( MGflmItemFilter* aFilter ) - { - FUNC_LOG - - iSearchResults.ResetAndDestroy(); - - // Ensure that search data is defined - if ( !iSearchFolder || !iSearchString || !iSearchStringWild ) - { - return; - } - // Ensure that search drive exists - CGflmDriveItem* drvItem = iDriveResolver.DriveFromPath( *iSearchFolder ); - if ( !drvItem ) - { - return; - } - if ( !iSearchFolderWild ) - { -#if 0 - if ( iDriveResolver.IsRemoteDrive( *iSearchFolder ) ) - { - // Some remote drives are case sensitive with wild cards. - // Therefore, wild cards cannot be used for remote drives, - // because then it is not possible to do case - // insensitive comparison like it is done for local drives. - iSearchFolderWild = iSearchFolder->AllocL(); - } - else - { - // Do search using the folder with wild string for better performance. - // It is faster to let file server do the wild matching instead of - // reading all subitems under search folder to be matched here. - - // Prepare search folder with wild search string - iSearchFolderWild = MakeWildPathL( - *iSearchFolder, *iSearchStringWild ); - } -#else - // Because of problems with localized folder names, - // wild card folder string cannot be given to file server since - // file server is not aware of localized names. - // This search operation is slower because all items are transferred - // here for comparison. - iSearchFolderWild = iSearchFolder->AllocL(); -#endif - } - - INFO_LOG1( "CGflmFileFinder::DoSearchL-CDirScan::NewLC-%S", - iSearchFolderWild ) - CDirScan* dirScan = CDirScan::NewLC( iFss ); - - INFO_LOG( "CGflmFileFinder::DoSearchL-CDirScan::SetScanDataL" ) - dirScan->SetScanDataL( *iSearchFolderWild, KEntryAttDir, ESortNone ); - - INFO_LOG( "CGflmFileFinder::DoSearchL-CDirScan::NextL" ) - CDir* dir = NULL; - dirScan->NextL( dir ); - - while( dir ) - { - CleanupStack::PushL( dir ); - if ( iCancelIndicator ) - { - User::Leave( KErrCancel ); - } - TPtrC basePath( dirScan->FullPath() ); - INFO_LOG1( "CGflmFileFinder::DoSearchL-Search-%S", &basePath ) - - TInt count( dir->Count() ); - for ( TInt i( 0 ); i < count; ++i ) - { - if ( iCancelIndicator ) - { - User::Leave( KErrCancel ); - } - const TEntry& entry( ( *dir )[ i ] ); - TPtrC name( entry.iName ); - TBool isLocalized( EFalse ); - TBool isDir( entry.IsDir() ); - if( isDir ) - { - // Handle localized name - GflmUtils::GetFullPath( basePath, entry, iFullPath ); - TPtrC localizedName( - iItemLocalizer.LocalizeFromWorkThread( iFullPath ) ); - if ( localizedName.Length() ) - { - name.Set( localizedName ); - isLocalized = ETrue; - } - } - // Append matching items - if( name.MatchC( *iSearchStringWild ) != KErrNotFound ) - { - CGflmFileFinderItem* finderItem = CGflmFileFinderItem::NewLC( - entry, basePath ); - if ( isLocalized ) - { - finderItem->SetLocalizedNameL( name ); - } - // Filter out unwanted items - if ( !aFilter || - ( aFilter && aFilter->FilterItemL( - finderItem, - isDir ? CGflmGroupItem::EDirectory : CGflmGroupItem::EFile, - drvItem ) ) ) - { - finderItem->PrepareSort( *iSearchString ); - finderItem->SetGroup( this ); - iSearchResults.AppendL( finderItem ); - CleanupStack::Pop( finderItem ); - } - else - { - CleanupStack::PopAndDestroy( finderItem ); - } - } - } - CleanupStack::PopAndDestroy( dir ); - - INFO_LOG( "CGflmFileFinder::DoSearchL-CDirScan::NextL" ) - dirScan->NextL( dir ); - } - CleanupStack::PopAndDestroy( dirScan ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::ItemCount -// ----------------------------------------------------------------------------- -// -TInt CGflmFileFinder::ItemCount() const - { - return iSearchResults.Count(); - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::Item -// ----------------------------------------------------------------------------- -// -CGflmGroupItem* CGflmFileFinder::Item( TInt aIndex ) - { - return iSearchResults[ aIndex ]; - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::Id -// ----------------------------------------------------------------------------- -// -TInt CGflmFileFinder::Id() const - { - return KErrNotFound; - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::AddSourceL -// ----------------------------------------------------------------------------- -// -void CGflmFileFinder::AddSourceL( const TDesC& /*aDirectory*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::ResetSources -// ----------------------------------------------------------------------------- -// -void CGflmFileFinder::ResetSources() - { - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::AddActionItemL -// ----------------------------------------------------------------------------- -// -void CGflmFileFinder::AddActionItemL( TInt /*aId*/, const TDesC& /*aCaption*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::SetInclusion -// ----------------------------------------------------------------------------- -// -void CGflmFileFinder::SetInclusion( TUint /*aInclusion*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinder::CollationMethod -// ----------------------------------------------------------------------------- -// -const TCollationMethod* CGflmFileFinder::CollationMethod() - { - return &iSortCollationMethod; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/src/CGflmFileFinderItem.cpp --- a/filemanager/GFLM/src/CGflmFileFinderItem.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +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: File finder item definitions -* -*/ - - - -// INCLUDE FILES -#include -#include -#include "CGflmFileFinderItem.h" -#include "GflmUtils.h" - -// CONSTANTS -const TInt16 KExactMatch = 0; -const TInt16 KBeginMatch = 1; -const TInt16 KNoMatch = KMaxTInt16; - - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// GetSortValue -// ----------------------------------------------------------------------------- -// -TInt16 GetSortValue( const TDesC& aName, const TDesC& aSearchString ) - { - TInt16 ret( 0 ); - TInt pos( 0 ); - if ( GflmUtils::HasWildCard( aSearchString ) ) - { - pos = aName.MatchC( aSearchString ); - if ( pos != KErrNotFound ) - { - ret = KBeginMatch + pos; - } - else - { - ret = KNoMatch; - } - } - else - { - pos = aName.FindC( aSearchString ); - if ( !pos && aName.Length() == aSearchString.Length() ) - { - ret = KExactMatch; - } - else if ( pos != KErrNotFound ) - { - ret = KBeginMatch + pos; - } - else - { - ret = KNoMatch; - } - } - return ret; - } - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGflmFileFinderItem::CGflmFileFinderItem -// ----------------------------------------------------------------------------- -// -CGflmFileFinderItem::CGflmFileFinderItem( const TEntry& aEntry ) : - iEntry( aEntry ) - { - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinderItem::NewLC -// ----------------------------------------------------------------------------- -// -CGflmFileFinderItem* CGflmFileFinderItem::NewLC( - const TEntry& aFSEntry, - const TDesC& aBasePath ) - { - CGflmFileFinderItem* self = new( ELeave ) CGflmFileFinderItem( aFSEntry ); - - CleanupStack::PushL( self ); - self->ConstructL( aBasePath ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinderItem::ConstructL -// ----------------------------------------------------------------------------- -// -void CGflmFileFinderItem::ConstructL( const TDesC& aBasePath ) - { - iBasePath = aBasePath.AllocL(); - SetBasePath( *iBasePath ); - SetEntry( iEntry ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinderItem::~CGflmFileFinderItem -// ----------------------------------------------------------------------------- -// -CGflmFileFinderItem::~CGflmFileFinderItem() - { - delete iBasePath; - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinderItem::PrepareSort -// ----------------------------------------------------------------------------- -// -void CGflmFileFinderItem::PrepareSort( - const TDesC& aSearchString ) - { - iSortValue = GetSortValue( Name(), aSearchString ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileFinderItem::CompareByMatch -// ----------------------------------------------------------------------------- -// -TInt CGflmFileFinderItem::CompareByMatch( - const CGflmGroupItem& aFirst, - const CGflmGroupItem& aSecond ) - { - const CGflmFileFinderItem& first( - static_cast< const CGflmFileFinderItem& >( aFirst ) ); - const CGflmFileFinderItem& second( - static_cast< const CGflmFileFinderItem& >( aSecond ) ); - - if ( first.iSortValue == second.iSortValue ) - { - // If both sort value is the same then the directory should be first - TBool isFirstDir( first.iEntry.IsDir() ); - TBool isSecondDir( second.iEntry.IsDir() ); - if ( isFirstDir && !isSecondDir ) - { - return -1; - } - if ( !isFirstDir && isSecondDir ) - { - return 1; - } - // If even then alphabetical order is used - return CompareByNameWithoutItemType( aFirst, aSecond ); - } - if ( first.iSortValue < second.iSortValue ) - { - return -1; - } - return 1; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/src/CGflmFileListModel.cpp --- a/filemanager/GFLM/src/CGflmFileListModel.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,686 +0,0 @@ -/* -* Copyright (c) 2002-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: File list model -* -*/ - - - -// INCLUDE FILES -#include "CGflmFileListModel.h" -#include "MGflmItemGroup.h" -#include "CGflmItemGroupImpl.h" -#include "CGflmDirectoryListingCache.h" -#include "CGflmFileRecognizer.h" -#include "CGflmDriveResolver.h" -#include "CGflmItemLocalizer.h" -#include "CGflmFileSystemItem.h" -#include "CGflmGlobalActionItem.h" -#include "CGflmFileFinder.h" -#include "MGflmItemFilter.h" -#include "GflmUtils.h" -#include "GFLMConsts.h" -#include "GFLM.hrh" -#include -#include -#include - - -// CONSTANTS - -// Granularity of iGroups array -const TInt KItemGroupArrayGranularity = 3; - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::CGflmFileListModel -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CGflmFileListModel::CGflmFileListModel( RFs& aFs ) : - CActive( CActive::EPriorityStandard ), - iFs( aFs ) - { - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -EXPORT_C CGflmFileListModel* CGflmFileListModel::NewL( RFs& aFs ) - { - CGflmFileListModel* self = new( ELeave ) CGflmFileListModel( aFs ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CGflmFileListModel::ConstructL() - { - FUNC_LOG - - CActiveScheduler::Add( this ); - - iGroups = new( ELeave ) - CArrayPtrSeg< CGflmItemGroupImpl > - ( KItemGroupArrayGranularity ); - iListingCache = CGflmDirectoryListingCache::NewL( iFs, iCanceled ); - iDriveResolver = CGflmDriveResolver::NewL( iFs ); - iFileRecognizer = CGflmFileRecognizer::NewL( - iFs, KGFLMFileRecognizerCacheSize, iDriveResolver ); - iItemLocalizer = CGflmItemLocalizer::NewL(); - iFileFinder = CGflmFileFinder::NewL( - iFs, *iItemLocalizer, *iDriveResolver, iCanceled ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::~CGflmFileListModel -// -// ----------------------------------------------------------------------------- -// -CGflmFileListModel::~CGflmFileListModel() - { - FUNC_LOG - - Cancel(); - if ( iGroups ) - { - iGroups->ResetAndDestroy(); - delete iGroups; - } - delete iFileFinder; - delete iListingCache; - delete iFileRecognizer; - delete iItemLocalizer; - delete iDriveResolver; - iSemaphore.Close(); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::RefreshListL() -// Creates and starts the work thread that refreshes the model -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmFileListModel::RefreshListL( - TRequestStatus& aStatus, TGflmRefreshMode aRefreshMode ) - { - FUNC_LOG - - if ( aStatus == KRequestPending ) - { - return; - } - - iCorrupt = ETrue; - iClientStatus = &aStatus; - *iClientStatus = KRequestPending; - iClientId = RThread().Id(); - - if ( iShutdown ) - { - // Ensure client completion - NotifyClient( KErrNone ); - return; - } - - iCanceled = EFalse; - - if ( !IsActive() ) - { - // Create the work thread to do refresh - iSemaphore.Close(); - User::LeaveIfError( iSemaphore.CreateLocal( 0 ) ); - - RThread workThread; - TInt err( workThread.Create( - KGFLMWorkThreadName, - WorkThreadStart, - KGFLMWorkThreadStackSize, - NULL, - this ) ); - LOG_IF_ERROR1( err, "CGflmFileListModel::RefreshListL-err1=%d", err ) - User::LeaveIfError( err ); - workThread.SetPriority( EPriorityLess ); - workThread.Logon( iStatus ); - SetActive(); - iRefreshMode = aRefreshMode; - workThread.Resume(); - workThread.Close(); - } - else - { - // Signal the work thread to do refresh - iRefreshMode = aRefreshMode; - iSemaphore.Signal(); - } - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::WorkThreadStart() -// An entry point function for the work thread -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt CGflmFileListModel::WorkThreadStart( TAny* aPtr ) - { - FUNC_LOG - - CGflmFileListModel* self = static_cast< CGflmFileListModel* >( aPtr ); - CTrapCleanup* cleanupStack = CTrapCleanup::New(); - if ( !cleanupStack ) - { - ERROR_LOG1( - "CGflmFileListModel::WorkThreadStart-err1=%d", KErrNoMemory ) - return KErrNoMemory; - } - - TRAPD( err, self->iItemLocalizer->SetupWorkThreadLocalizerL() ); - LOG_IF_ERROR1( err, "CGflmFileListModel::WorkThreadStart-err2=%d", err ) - - self->WorkThread(); - self->iItemLocalizer->ReleaseWorkThreadLocalizer(); - delete cleanupStack; - - return err; - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::WorkThread() -// ----------------------------------------------------------------------------- -// -void CGflmFileListModel::WorkThread() - { - TInt err( KErrNone ); - do - { - - // Do refresh - iCorrupt = ETrue; - err = KErrNone; - - TRAP( err, DoRefreshL() ); - if ( err == KErrNone ) - { - iCorrupt = EFalse; - } - - LOG_IF_ERROR1( err, "CGflmFileListModel::WorkThread-err=%d", err ) - - NotifyClient( err ); - - iSemaphore.Wait(); // Wait for refresh signal from main thread - - } while ( !iShutdown ); - - if ( iShutdown ) - { - // Disable list usage and ensure client completion - iCorrupt = ETrue; - NotifyClient( err ); - } - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::NotifyClient() -// ----------------------------------------------------------------------------- -// -void CGflmFileListModel::NotifyClient( TInt aErr ) - { - FUNC_LOG - - if ( iClientStatus ) - { - RThread client; - if ( client.Open( iClientId ) == KErrNone ) - { - client.RequestComplete( iClientStatus, aErr ); - client.Close(); - } - } - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::DoRefreshL() -// This method does the actual refreshing. It's not static so it can access -// member data and it can leave as it's trap harnessed in RefreshAndNotify() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CGflmFileListModel::DoRefreshL() - { - TIMESTAMP( "GFLM refresh files and folders started: " ) - - INFO_LOG1( - "CGflmFileListModel::DoRefreshL-iSearchEnabled=%d", - iSearchEnabled ) - - if ( iSearchEnabled ) - { - User::LeaveIfError( iDriveResolver->RefreshDrives( iFilter ) ); - iFileFinder->RefreshL( iFilter, iSearchSortMethod, iRefreshMode ); - } - else - { - if ( iRefreshMode == ERefreshItems ) - { - iListingCache->ClearCache(); - } - User::LeaveIfError( iDriveResolver->RefreshDrives( iFilter ) ); - - TInt groupCount( iGroups->Count() ); - for ( TInt i( 0 ); i < groupCount; i++ ) - { - iGroups->At( i )->RefreshL( iFilter, iSortMethod, iRefreshMode ); - } - } - - TIMESTAMP( "GFLM refresh files and folders ended: " ) - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::CancelRefresh() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmFileListModel::CancelRefresh() - { - FUNC_LOG - - iCanceled = ETrue; - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::MdcaCount() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt CGflmFileListModel::MdcaCount() const - { - if ( iCorrupt ) - { - return 0; - } - if ( iSearchEnabled ) - { - return iFileFinder->ItemCount(); - } - - // Count the total number of items in groups - TInt groupCount( iGroups->Count() ); - TInt itemCount( 0 ); - for( TInt i( 0 ); i < groupCount; i++ ) - { - itemCount += iGroups->At( i )->ItemCount(); - } - return itemCount; - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::MdcaPoint() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TPtrC CGflmFileListModel::MdcaPoint( TInt aIndex ) const - { - if ( iSearchEnabled ) - { - return iFileFinder->Item( aIndex )->Name(); - } - - // Return the formatted presentation by global index - MGflmItemGroup* group = NULL; - TInt localIndex( 0 ); - GetGroupAndLocalIndex( aIndex, localIndex, group ); - return group->Item( localIndex )->Name(); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::GetGroupAndLocalIndex() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CGflmFileListModel::GetGroupAndLocalIndex( - const TInt aGlobalIndex, - TInt& aLocalIndex, - MGflmItemGroup*& aGroup ) const - { - // Calculate the group and the requested item's local index - // from a global index - TInt groupCount( iGroups->Count() ); - TInt offset( 0 ); - for( TInt i( 0 ); i < groupCount; i++ ) - { - MGflmItemGroup* currentGroup = iGroups->At( i ); - TInt itemsInGroup( currentGroup->ItemCount() ); - if ( aGlobalIndex < itemsInGroup + offset ) - { - // The global index resides in this group - aGroup = iGroups->At( i ); - aLocalIndex = aGlobalIndex - offset; - return; - } - offset += itemsInGroup; - } - - // Group not found - User::Panic( KGFLMPanicText, EGlobalIndexOutOfBounds ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::Item() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -EXPORT_C CGflmGroupItem* CGflmFileListModel::Item( TInt aIndex ) const - { - if ( iSearchEnabled ) - { - return iFileFinder->Item( aIndex ); - } - // Return the formatted presentation by global index - MGflmItemGroup* group = NULL; - TInt localIndex( 0 ); - GetGroupAndLocalIndex( aIndex, localIndex, group ); - return group->Item( localIndex ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::ResetModel() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmFileListModel::ResetModel() - { - iGroups->ResetAndDestroy(); - iListingCache->ClearCache(); - iDriveResolver->ClearDrives(); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::FindGroupById() -// Used to provide clients with CGflmItemGroupImpl objects downcasted to -// CGflmItemGroup. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -EXPORT_C MGflmItemGroup* CGflmFileListModel::FindGroupById( TInt aId ) - { - TInt groupCount( iGroups->Count() ); - - for( TInt i( 0 ); i < groupCount; i++ ) - { - CGflmItemGroupImpl* group = iGroups->At( i ); - if ( aId == group->Id() ) - { - return group; - } - } - - // Group not found - User::Panic( KGFLMPanicText, EInvalidGroupId ); - - // Execution never reaches this point - // following line keeps the compiler happy - return NULL; - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::CreateGroupL() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -EXPORT_C MGflmItemGroup* CGflmFileListModel::CreateGroupL( TInt aId ) - { - // Scan the list of groups for identical IDs - TInt groupCount( iGroups->Count() ); - for ( TInt i( 0 ); i < groupCount; i++ ) - { - if ( iGroups->At( i )->Id() == aId ) - { - User::Leave( KErrAlreadyExists ); - } - } - - CGflmItemGroupImpl* newGroup = CGflmItemGroupImpl::NewLC( - aId, - iFs, - *iListingCache, - *iItemLocalizer, - *iDriveResolver ); - - iGroups->AppendL( newGroup ); - CleanupStack::Pop( newGroup ); - return newGroup; - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::CreateGroupL() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -EXPORT_C MGflmItemGroup* CGflmFileListModel::CreateGroupL( - TInt aId, TUint aInclusion ) - { - MGflmItemGroup* newGroup = CreateGroupL( aId ); - newGroup->SetInclusion( aInclusion ); - return newGroup; - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::SetCustomFilter() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -EXPORT_C void CGflmFileListModel::SetCustomFilter( MGflmItemFilter* aFilter ) - { - iFilter = aFilter; - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::ResolveMimeTypeL() -// Uses the internal file recognition cache -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -EXPORT_C TPtrC CGflmFileListModel::ResolveMimeTypeL( const TDesC& aFilename ) - { - return iFileRecognizer->RecognizeL( aFilename ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::IsCorrupt() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -EXPORT_C TBool CGflmFileListModel::IsCorrupt() const - { - return iCorrupt; - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::LocalizedName() -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CGflmFileListModel::LocalizedName( const TDesC& aPath ) const - { - return iItemLocalizer->Localize( aPath ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::ClearCache() -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmFileListModel::ClearCache() - { - iListingCache->ClearCache(); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::ClearDriveInfo() -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmFileListModel::ClearDriveInfo() - { - iDriveResolver->ClearDrives(); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::DriveFromPath() -// ----------------------------------------------------------------------------- -// -EXPORT_C CGflmDriveItem* CGflmFileListModel::DriveFromPath( - const TDesC& aPath ) const - { - if ( !iDriveResolver->DriveCount() ) - { - ERROR_LOG( "CGflmFileListModel::DriveFromPath-Forced drive refresh" ) - iDriveResolver->RefreshDrives( iFilter ); - } - return iDriveResolver->DriveFromPath( aPath ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::RunL() -// ----------------------------------------------------------------------------- -// -void CGflmFileListModel::RunL() - { - FUNC_LOG - - NotifyClient( iStatus.Int() ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::RunError -// ----------------------------------------------------------------------------- -// -TInt CGflmFileListModel::RunError( TInt /*aError*/ ) - { - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::DoCancel -// ----------------------------------------------------------------------------- -// -void CGflmFileListModel::DoCancel() - { - FUNC_LOG - - iShutdown = ETrue; - iSemaphore.Signal(); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::DriveFromId -// ----------------------------------------------------------------------------- -// -EXPORT_C CGflmDriveItem* CGflmFileListModel::DriveFromId( - const TInt aDrive ) const - { - if ( !iDriveResolver->DriveCount() ) - { - ERROR_LOG( "CGflmFileListModel::DriveFromId-Forced drive refresh" ) - iDriveResolver->RefreshDrives( iFilter ); - } - return iDriveResolver->DriveFromId( aDrive ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::EnableSearchMode -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmFileListModel::EnableSearchMode( const TBool aEnabled ) - { - iSearchEnabled = aEnabled; - if ( iSearchEnabled ) - { - iSearchSortMethod = EByMatch; // Default for search - } - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::SearchMode -// ----------------------------------------------------------------------------- -// -EXPORT_C TBool CGflmFileListModel::SearchMode() - { - return iSearchEnabled; - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::SetSearchStringL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmFileListModel::SetSearchStringL( const TDesC& aSearchString ) - { - iFileFinder->SetSearchStringL( aSearchString ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::SetSearchFolderL -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmFileListModel::SetSearchFolderL( const TDesC& aSearchFolder ) - { - iFileFinder->SetSearchFolderL( aSearchFolder ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::SetSortMethod -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmFileListModel::SetSortMethod( TGflmSortMethod aSortMethod ) - { - if ( iSearchEnabled ) - { - iSearchSortMethod = aSortMethod; - } - else if ( aSortMethod != EByMatch ) // EByMatch is allowed only for search - { - iSortMethod = aSortMethod; - } - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::SortMethod -// ----------------------------------------------------------------------------- -// -EXPORT_C TGflmSortMethod CGflmFileListModel::SortMethod() const - { - if ( iSearchEnabled ) - { - return iSearchSortMethod; - } - return iSortMethod; - } - -// ----------------------------------------------------------------------------- -// CGflmFileListModel::FlushCache() -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmFileListModel::FlushCache() - { - iFileRecognizer->FlushCache(); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/src/CGflmFileRecognizer.cpp --- a/filemanager/GFLM/src/CGflmFileRecognizer.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,454 +0,0 @@ -/* -* Copyright (c) 2002-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: Recogniser wrapper -* -*/ - - - -// INCLUDE FILES -#include "CGflmFileRecognizer.h" -#include "CGflmDriveResolver.h" -#include "CGflmDriveItem.h" -#include "GflmUtils.h" -#include "GFLMConsts.h" -#include -#include -#include -#include - - -// CONSTANTS -_LIT( KFileExtensionResourceFile, "gflmfileextensionmimetypes.rsc" ); -const TInt KMimeTypeGranularity = 10; -const TUint KPerCentToDrop = 30; -const TUint KHundredPerCent = 100; - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::CGflmFileRecognizer -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CGflmFileRecognizer::CGflmFileRecognizer( - CGflmDriveResolver* aDriveResolver, - RFs& aFs ) : - iCache( _FOFF( CPathTypePair, iLink ) ), - iDriveResolver( aDriveResolver ), - iFs( aFs ) - { - } - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CGflmFileRecognizer::ConstructL( TInt aMemoryConsumption ) - { - User::LeaveIfError( iApaSession.Connect() ); - iMimeTypes = new( ELeave ) CDesCArraySeg( KMimeTypeGranularity ); - iCacheMaxMemoryUsage = aMemoryConsumption; - - // Get resource drive from dll location - TFileName dllFileName; - Dll::FileName( dllFileName ); - TParsePtrC dllParse( dllFileName ); - - TFileName resFileName; - resFileName.Copy( dllParse.Drive() ); - resFileName.Append( KDC_RESOURCE_FILES_DIR ); - GflmUtils::EnsureFinalBackslash( resFileName ); - resFileName.Append( KFileExtensionResourceFile ); - - RResourceFile resFile; - resFile.OpenL( iFs, resFileName ); - CleanupClosePushL( resFile ); - resFile.ConfirmSignatureL(); - - ConstructExtMimePairsL( resFile, R_EXT_MIME_PAIRS, iExtMimePairs ); - ConstructExtMimePairsL( - resFile, R_REMOTE_EXT_MIME_PAIRS, iRemoteExtMimePairs ); - - CleanupStack::PopAndDestroy( &resFile ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::ConstructExtMimePairsL -// -// ----------------------------------------------------------------------------- -// -void CGflmFileRecognizer::ConstructExtMimePairsL( - RResourceFile& aResFile, - TInt aResId, - RPointerArray< CExtMimePair >& aPairs ) - { - TCleanupItem cleanupItem( ResetAndDestroyExtMimePairs, &aPairs ); - CleanupStack::PushL( cleanupItem ); - // read the pairs - HBufC8* resData = aResFile.AllocReadLC( aResId ); - TResourceReader reader; - reader.SetBuffer( resData ); - TInt count( reader.ReadInt16() ); - aPairs.ReserveL( count ); - for ( TInt i( 0 ); i < count; i++ ) - { - TPtrC ext( reader.ReadTPtrC() ); - TPtrC mime( reader.ReadTPtrC() ); - CExtMimePair* pair = new (ELeave) CExtMimePair(); - CleanupStack::PushL( pair ); - pair->iExt = ext.AllocL(); - pair->iMime = mime.AllocL(); - aPairs.AppendL( pair ); - CleanupStack::Pop( pair ); - } - CleanupStack::PopAndDestroy( resData ); - CleanupStack::Pop( &aPairs ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::FindMimeFromExt -// -// ----------------------------------------------------------------------------- -// -TPtrC CGflmFileRecognizer::FindMimeFromExt( - const TDesC& aExt, - RPointerArray< CExtMimePair >& aPairs ) - { - TInt count( aPairs.Count() ); - - for( TInt i( 0 ); i < count; i++) - { - CExtMimePair* pair = aPairs[ i ]; - if( !aExt.CompareF( *pair->iExt ) ) - { - return TPtrC( *pair->iMime ); - } - } - return TPtrC( KNullDesC ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CGflmFileRecognizer* CGflmFileRecognizer::NewL( - RFs& aFs, - TInt aMemoryConsumption, - CGflmDriveResolver* aDriveResolver ) - { - CGflmFileRecognizer* self = - new( ELeave ) CGflmFileRecognizer( aDriveResolver, aFs ); - - CleanupStack::PushL( self ); - self->ConstructL( aMemoryConsumption ); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::~CGflmFileRecognizer -// -// ----------------------------------------------------------------------------- -// -CGflmFileRecognizer::~CGflmFileRecognizer() - { - iApaSession.Close(); - - FlushCache(); - - delete iMimeTypes; - - iExtMimePairs.ResetAndDestroy(); - iExtMimePairs.Close(); - - iRemoteExtMimePairs.ResetAndDestroy(); - iRemoteExtMimePairs.Close(); - } - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::RecognizeL( const TDesC& aFilename ) -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TPtrC CGflmFileRecognizer::RecognizeL( const TDesC& aFilename ) - { - TPtrC mimeType; - TRAPD( err, mimeType.Set( DoRecognizeL( aFilename ) ) ); - if ( err == KErrNoMemory ) - { - FlushCache(); - return DoRecognizeL( aFilename ); - } - User::LeaveIfError( err ); - return mimeType; - } - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::DoRecognizeL( const TDesC& aFilename ) -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TPtrC CGflmFileRecognizer::DoRecognizeL( const TDesC& aFilename ) - { - // Search the cache for a hit - TInt cropPoint( aFilename.LocateReverse( KGFLMDot()[ 0 ] ) ); - TBool isRemoteDrive( EFalse ); - - if ( iDriveResolver && iDriveResolver->IsRemoteDrive( aFilename ) ) - { - isRemoteDrive = ETrue; - } - - if( cropPoint != KErrNotFound ) - { - TPtrC ext( aFilename.Mid( cropPoint ) ); - TPtrC mime( FindMimeFromExt( ext, iExtMimePairs ) ); - if ( mime.Length() ) - { - return mime; - } - - // Use remote drive specific extension mime pairs and skip - // content recognition because it is so slow for remote drives. - // Mime types are resolved from extension by remote storage framework - // anyway. - if ( isRemoteDrive) - { - return FindMimeFromExt( ext, iRemoteExtMimePairs ); - } - } - else if ( isRemoteDrive) - { - // Skip content recognition for remote drives because it is so slow - return TPtrC( KNullDesC ); - } - - TDblQueIter< CPathTypePair > pairIt( iCache ); - pairIt.SetToFirst(); - CPathTypePair* pair = NULL; - while ( ( pair = pairIt++ ) != NULL ) - { - TPtrC ptr( *( pair->iFilename ) ); - if( ptr.Length() == aFilename.Length() && - !aFilename.CompareF( ptr ) ) - { - // Cache hit - // Move item to the first position if not already. - // When clearing cache, oldest items can be dropped easily. - pair->iLink.Deque(); - iCache.AddFirst( *pair ); - - if ( pair->iTypeIndex != KErrNotFound ) - { - return iMimeTypes->MdcaPoint( pair->iTypeIndex ); - } - return TPtrC( KNullDesC ); - } - } - - // Cache miss - TUid uid( KNullUid ); - TDataType datatype; - - TIMESTAMP( "GFLM AppForDocument started: " ) - - // Acquire the mime-type of the file - TInt err( iApaSession.AppForDocument( aFilename, uid, datatype ) ); - - TIMESTAMP( "GFLM AppForDocument ended: " ) - - if ( err != KErrNone ) - { - // If recognition returns error, handle as unrecognized file - ERROR_LOG1( - "CGflmFileRecognizer::DoRecognizeL-AppForDocument=%d", - err ) - return TPtrC( KNullDesC ); - } - - CPathTypePair* newPair = CPathTypePair::NewLC( aFilename ); - TPtrC mimeType( datatype.Des() ); - - INFO_LOG2( "GFLM AppForDocument:file=%S,mime=%S", &aFilename, &mimeType ) - - // Run through the mime-type list to find the correct index - if ( mimeType.Length() ) - { - TBool isMimeFound( EFalse ); - TInt mimeCount( iMimeTypes->MdcaCount() ); - for ( TInt j( 0 ); j < mimeCount; j++ ) - { - if( !mimeType.CompareF( iMimeTypes->MdcaPoint( j ) ) ) - { - newPair->iTypeIndex = j; - isMimeFound = ETrue; - break; - } - } - // Add mime type to list if not already added - if ( !isMimeFound ) - { - iMimeTypes->AppendL( mimeType ); - newPair->iTypeIndex = mimeCount; - } - } - - // Cleanup cache and add new pair - CleanupStack::Pop( newPair ); - CleanupCache(); - iCacheMemoryUsage += newPair->Size(); - iCache.AddFirst( *newPair ); - - if ( newPair->iTypeIndex != KErrNotFound ) - { - return iMimeTypes->MdcaPoint( newPair->iTypeIndex ); - } - return TPtrC( KNullDesC ); - } - - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::ResetAndDestroyExtMimePairs( ) -// -// ----------------------------------------------------------------------------- -// -void CGflmFileRecognizer::ResetAndDestroyExtMimePairs( TAny* aPtr ) - { - RPointerArray< CExtMimePair >* extMimePairs = - static_cast< RPointerArray< CExtMimePair >* >( aPtr ); - extMimePairs->ResetAndDestroy(); - extMimePairs->Close(); - } - - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::FlushCache( ) -// -// ----------------------------------------------------------------------------- -// -void CGflmFileRecognizer::FlushCache() - { - TDblQueIter< CPathTypePair > pairIt( iCache ); - pairIt.SetToFirst(); - CPathTypePair* pair = NULL; - while ( ( pair = pairIt++ ) != NULL ) - { - pair->iLink.Deque(); - delete pair; - } - iCacheMemoryUsage = 0; - } - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::CleanupCache( ) -// -// ----------------------------------------------------------------------------- -// -void CGflmFileRecognizer::CleanupCache( ) - { - if( iCacheMemoryUsage > iCacheMaxMemoryUsage ) - { - TInt dropThreshold = ( TInt ) ( ( ( ( TUint ) iCacheMaxMemoryUsage ) * - KPerCentToDrop ) / KHundredPerCent ); - TInt droppedSize( 0 ); - - TDblQueIter< CPathTypePair > pairIt( iCache ); - pairIt.SetToLast(); - CPathTypePair* pair = NULL; - while ( ( pair = pairIt-- ) != NULL ) - { - droppedSize += pair->Size(); - pair->iLink.Deque(); - delete pair; - if ( droppedSize >= dropThreshold ) - { - break; - } - } - iCacheMemoryUsage -= droppedSize; - } - } - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::CPathTypePair::NewLC() -// -// ----------------------------------------------------------------------------- -// -CGflmFileRecognizer::CPathTypePair* - CGflmFileRecognizer::CPathTypePair::NewLC( const TDesC& aFilename ) - { - CPathTypePair* self = new ( ELeave ) CPathTypePair(); - CleanupStack::PushL( self ); - self->ConstructL( aFilename ); - return self; - } - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::CPathTypePair::ConstructL() -// -// ----------------------------------------------------------------------------- -// -void CGflmFileRecognizer::CPathTypePair::ConstructL( const TDesC& aFilename ) - { - iFilename = aFilename.AllocL(); - } - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::CPathTypePair::CPathTypePair() -// -// ----------------------------------------------------------------------------- -// -CGflmFileRecognizer::CPathTypePair::CPathTypePair() : - iTypeIndex( KErrNotFound ) - { - } - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::CPathTypePair::~CPathTypePair() -// -// ----------------------------------------------------------------------------- -// -CGflmFileRecognizer::CPathTypePair::~CPathTypePair() - { - delete iFilename; - } - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::CPathTypePair::Size() -// -// ----------------------------------------------------------------------------- -// -TInt CGflmFileRecognizer::CPathTypePair::Size() const - { - return ( sizeof( TInt ) + iFilename->Size() + sizeof( TDblQueLink ) ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileRecognizer::CExtMimePair::~CExtMimePair() -// -// ----------------------------------------------------------------------------- -// -CGflmFileRecognizer::CExtMimePair::~CExtMimePair() - { - delete iExt; - delete iMime; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/src/CGflmFileSystemItem.cpp --- a/filemanager/GFLM/src/CGflmFileSystemItem.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,212 +0,0 @@ -/* -* Copyright (c) 2002-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: File system item definitions -* -*/ - - - -// INCLUDE FILES -#include "CGflmFileSystemItem.h" -#include "GflmUtils.h" -#include "GFLMConsts.h" -#include - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGflmFileSystemItem::CGflmFileSystemItem -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CGflmFileSystemItem::CGflmFileSystemItem( - const TEntry& aFSEntry, - const TDesC& aBasePath ) : - iFSEntry( &aFSEntry ), - iBasePath( aBasePath ) - { - SetExt(); - } - -// ----------------------------------------------------------------------------- -// CGflmFileSystemItem::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CGflmFileSystemItem* CGflmFileSystemItem::NewLC( - const TEntry& aFSEntry, - const TDesC& aBasePath ) - { - CGflmFileSystemItem* self = new( ELeave ) CGflmFileSystemItem( - aFSEntry, aBasePath ); - - CleanupStack::PushL( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CGflmFileSystemItem::~CGflmFileSystemItem -// -// ----------------------------------------------------------------------------- -// -CGflmFileSystemItem::~CGflmFileSystemItem() - { - delete iLocalizedName; - } - -// ----------------------------------------------------------------------------- -// CGflmFileSystemItem::Type -// -// ----------------------------------------------------------------------------- -// -CGflmGroupItem::TGflmItemType CGflmFileSystemItem::Type() const - { - if ( iFSEntry->IsDir() ) - { - return EDirectory; - } - return EFile; - } - -// ----------------------------------------------------------------------------- -// CGflmFileSystemItem::Name -// -// ----------------------------------------------------------------------------- -// -TPtrC CGflmFileSystemItem::Name() const - { - if ( iLocalizedName ) - { - return iLocalizedName->Des(); - } - // The entry has no localized name - return TPtrC( iFSEntry->iName ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileSystemItem::Date -// -// ----------------------------------------------------------------------------- -// -TTime CGflmFileSystemItem::Date() const - { - return iFSEntry->iModified; - } - -// ----------------------------------------------------------------------------- -// CGflmFileSystemItem::Size -// -// ----------------------------------------------------------------------------- -// -TInt64 CGflmFileSystemItem::Size() const - { - return static_cast( iFSEntry->iSize ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileSystemItem::Ext -// -// ----------------------------------------------------------------------------- -// -TPtrC CGflmFileSystemItem::Ext() const - { - return iExt; - } - -// ----------------------------------------------------------------------------- -// CGflmFileSystemItem::GetFullPath -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmFileSystemItem::GetFullPath( TDes& aPath ) const - { - GflmUtils::GetFullPath( iBasePath, *iFSEntry, aPath ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileSystemItem::SetLocalizedNameL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmFileSystemItem::SetLocalizedNameL( const TDesC& aName ) - { - HBufC* temp = aName.AllocL(); - delete iLocalizedName; - iLocalizedName = temp; - } - -// ----------------------------------------------------------------------------- -// CGflmFileSystemItem::Entry -// -// ----------------------------------------------------------------------------- -// -EXPORT_C const TEntry& CGflmFileSystemItem::Entry() const - { - return *iFSEntry; - } - -// ----------------------------------------------------------------------------- -// CGflmFileSystemItem::FullPathLC -// -// ----------------------------------------------------------------------------- -// -EXPORT_C HBufC* CGflmFileSystemItem::FullPathLC() const - { - return GflmUtils::FullPathLC( iBasePath, *iFSEntry ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileSystemItem::FullPathL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C HBufC* CGflmFileSystemItem::FullPathL() const - { - return GflmUtils::FullPathL( iBasePath, *iFSEntry ); - } - -// ----------------------------------------------------------------------------- -// CGflmFileSystemItem::SetEntry -// -// ----------------------------------------------------------------------------- -// -void CGflmFileSystemItem::SetEntry( const TEntry& aEntry ) - { - iFSEntry = &aEntry; - SetExt(); - } - -// ----------------------------------------------------------------------------- -// CGflmFileSystemItem::SetExt -// -// ----------------------------------------------------------------------------- -// -void CGflmFileSystemItem::SetExt() - { - TPtrC name( iFSEntry->iName ); - TInt pos( name.LocateReverse( KGFLMDot()[ 0 ] ) ); - if( pos != KErrNotFound ) - { - iExt.Set( name.Mid( pos ) ); - } - else - { - iExt.Set( KNullDesC ); - } - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/src/CGflmGlobalActionItem.cpp --- a/filemanager/GFLM/src/CGflmGlobalActionItem.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* -* Copyright (c) 2002-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: Global action item definitions -* -*/ - - - -// INCLUDE FILES -#include "CGflmGlobalActionItem.h" -#include - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGflmGlobalActionItem::CGflmGlobalActionItem -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CGflmGlobalActionItem::CGflmGlobalActionItem() - { - } - -// ----------------------------------------------------------------------------- -// CGflmGlobalActionItem::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CGflmGlobalActionItem::ConstructL( const TDesC& aCaption ) - { - iCaption = aCaption.AllocL(); - } - -// ----------------------------------------------------------------------------- -// CGflmGlobalActionItem::NewLC -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CGflmGlobalActionItem* CGflmGlobalActionItem::NewLC( - TInt aId, const TDesC& aCaption ) - { - CGflmGlobalActionItem* self = new( ELeave ) CGflmGlobalActionItem; - - CleanupStack::PushL( self ); - self->iId = aId; - self->ConstructL( aCaption ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CGflmGlobalActionItem::~CGflmGlobalActionItem -// -// ----------------------------------------------------------------------------- -// -CGflmGlobalActionItem::~CGflmGlobalActionItem() - { - delete iCaption; - - } - -// ----------------------------------------------------------------------------- -// CGflmGlobalActionItem::Type() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -CGflmGroupItem::TGflmItemType CGflmGlobalActionItem::Type() const - { - return EGlobalActionItem; - } - -// ----------------------------------------------------------------------------- -// CGflmGlobalActionItem::Name() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TPtrC CGflmGlobalActionItem::Name() const - { - return iCaption->Des(); - } - -// ----------------------------------------------------------------------------- -// CGflmGlobalActionItem::Date() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TTime CGflmGlobalActionItem::Date() const - { - // Date of an action item is undefined - // Groups containing action items shouldn't be sorted by date - return TTime( 0 ); - } - -// ----------------------------------------------------------------------------- -// CGflmGlobalActionItem::Size() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt64 CGflmGlobalActionItem::Size() const - { - return 0; - } - -// ----------------------------------------------------------------------------- -// CGflmGlobalActionItem::Ext() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TPtrC CGflmGlobalActionItem::Ext() const - { - return TPtrC( KNullDesC ); - } - -// ----------------------------------------------------------------------------- -// CGflmGlobalActionItem::Id() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CGflmGlobalActionItem::Id() const - { - return iId; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/src/CGflmGroupItem.cpp --- a/filemanager/GFLM/src/CGflmGroupItem.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,343 +0,0 @@ -/* -* Copyright (c) 2002-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: Group item definitions -* -*/ - - - -// INCLUDE FILES -#include "CGflmGroupItem.h" -#include "MGflmItemGroup.h" -#include - - -// CONSTANTS -const TInt KIconIdUndefined = -1; -const TInt KSortCollationLevel = 3; - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGflmGroupItem::CGflmGroupItem -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CGflmGroupItem::CGflmGroupItem() - : iIconId( KIconIdUndefined ) - { - } - -// ----------------------------------------------------------------------------- -// CGflmGroupItem::~CGflmGroupItem() -// ----------------------------------------------------------------------------- -// -CGflmGroupItem::~CGflmGroupItem() - { - } - -// ----------------------------------------------------------------------------- -// CGflmGroupItem::GetIconId() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CGflmGroupItem::GetIconId( TInt& aIconId ) - { - if ( iIconId == KIconIdUndefined ) - { - aIconId = 0; - return KErrNotFound; - } - aIconId = iIconId; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CGflmGroupItem::SetIconId() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmGroupItem::SetIconId( const TInt aIconId ) - { - iIconId = aIconId; - } - -// ----------------------------------------------------------------------------- -// CGflmGroupItem::CanUseCompareF() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TBool CGflmGroupItem::CanUseCompareF() const - { - if ( iStatus & ECanUseCompareF ) - { - return ETrue; - } - if ( iStatus & ECannotUseCompareF ) - { - return EFalse; - } - - TPtrC name( Name() ); - TInt len( name.Length() ); - const TText* ptr = name.Ptr(); - while ( len-- > 0 ) - { - TText ch = *ptr++; - // Do not allow CompareF for non Ascii or special chars - if ( !( ( ch >= 0x000A && ch <= 0x0039 ) || // Ascii basic symbols - ( ch >= 0x0041 && ch <= 0x005A ) || // Ascii capital alpha - ( ch >= 0x0061 && ch <= 0x007A ) ) ) // Ascii small alpha - { - iStatus |= ECannotUseCompareF; - return EFalse; - } - } - iStatus |= ECanUseCompareF; - return ETrue; - } - -// ----------------------------------------------------------------------------- -// CGflmGroupItem::SetGroup() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CGflmGroupItem::SetGroup( MGflmItemGroup* aGroup ) - { - iGroup = aGroup; - } - -// ----------------------------------------------------------------------------- -// CGflmGroupItem::GetSortL() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// - -TLinearOrder< CGflmGroupItem > CGflmGroupItem::GetSortL( - TGflmSortMethod aSortMethod ) - { - switch( aSortMethod ) - { - case EByName: - { - return CompareByName; - } - case EByType: - { - return CompareByType; - } - case EMostRecentFirst: - { - return CompareMostRecentFirst; - } - case ELargestFirst: - { - return CompareLargestFirst; - } - default: - { - User::Leave( KErrNotSupported ); - } - } - return CompareByName; - } - -// ----------------------------------------------------------------------------- -// CGflmGroupItem::CompareByItemType -// Compares two CGflmGroupItem objects by name (ascending) -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt CGflmGroupItem::CompareByItemType( - const CGflmGroupItem& aFirst, const CGflmGroupItem& aSecond ) - { - TGflmItemType first( aFirst.Type() ); - TGflmItemType second( aSecond.Type() ); - if ( first < second ) - { - return -1; - } - else if ( first > second ) - { - return 1; - } - return 0; - } - -// ----------------------------------------------------------------------------- -// CGflmGroupItem::CompareByNameWithoutItemType -// Compares two CGflmGroupItem objects by name (ascending) -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt CGflmGroupItem::CompareByNameWithoutItemType( - const CGflmGroupItem& aFirst, const CGflmGroupItem& aSecond ) - { - // Do not use CompareC by default with collation - // because it is very bad for performance when sorting - // large folders i.e. several 1000s of files with long item names - // e.g. names containing over 40 chars - - // However, some languages are not sorted correctly with CompareF, - // so do cached name check to decide what comparison to use. - - if ( !aFirst.CanUseCompareF() || !aSecond.CanUseCompareF() ) - { - if ( aFirst.iGroup ) - { - const TCollationMethod* collate = - aFirst.iGroup->CollationMethod(); - if ( collate ) - { - return aFirst.Name().CompareC( - aSecond.Name(), - KSortCollationLevel, - collate ); - } - } - } - - return aFirst.Name().CompareF( aSecond.Name() ); - } - -// ----------------------------------------------------------------------------- -// CGflmGroupItem::CompareByName -// Compares two CGflmGroupItem objects by name (ascending) -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt CGflmGroupItem::CompareByName( - const CGflmGroupItem& aFirst, const CGflmGroupItem& aSecond ) - { - TInt ret( CompareByItemType( aFirst, aSecond ) ); - if ( !ret ) - { - return CompareByNameWithoutItemType( aFirst, aSecond ); - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CGflmGroupItem::CompareByType -// Compares two CGflmGroupItem objects by file extension (ascending) -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt CGflmGroupItem::CompareByType( - const CGflmGroupItem& aFirst, const CGflmGroupItem& aSecond ) - { - TInt ret( CompareByItemType( aFirst, aSecond ) ); - if ( ret ) - { - return ret; - } - - // Do not use CompareC by default with collation - // because it is very bad for performance when sorting - // large folders i.e. several 1000s of files with long item names - // e.g. names containing over 40 chars - - // However, some languages are not sorted correctly with CompareF, - // so do cached name check to decide what comparison to use. - - if ( !aFirst.CanUseCompareF() || !aSecond.CanUseCompareF() ) - { - if ( aFirst.iGroup ) - { - const TCollationMethod* collate = - aFirst.iGroup->CollationMethod(); - if ( collate ) - { - ret = aFirst.Ext().CompareC( - aSecond.Ext(), - KSortCollationLevel, - collate ); - if ( !ret ) - { - ret = CompareByName( aFirst, aSecond ); - } - return ret; - } - } - } - - ret = aFirst.Ext().CompareF( aSecond.Ext() ); - if ( !ret ) - { - ret = CompareByNameWithoutItemType( aFirst, aSecond ); - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CGflmGroupItem::CompareMostRecentFirst -// Compares two CGflmGroupItem objects by date (ascending) -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt CGflmGroupItem::CompareMostRecentFirst( - const CGflmGroupItem& aFirst, const CGflmGroupItem& aSecond ) - { - TInt ret( -CompareByItemType( aFirst, aSecond ) ); - if ( ret ) - { - return ret; - } - - TTime first( aFirst.Date() ); - TTime second( aSecond.Date() ); - - if ( first > second ) - { - return -1; - } - else if ( first < second ) - { - return 1; - } - return CompareByNameWithoutItemType( aFirst, aSecond ); - } - -// ----------------------------------------------------------------------------- -// CGflmGroupItem::CompareLargestFirst -// Compares two CGflmGroupItem objects by size (ascending) -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt CGflmGroupItem::CompareLargestFirst( - const CGflmGroupItem& aFirst, const CGflmGroupItem& aSecond ) - { - TInt ret( -CompareByItemType( aFirst, aSecond ) ); - if ( ret ) - { - return ret; - } - - TInt64 first( aFirst.Size() ); - TInt64 second( aSecond.Size() ); - - if ( first > second ) - { - return -1; - } - else if ( first < second ) - { - return 1; - } - return CompareByNameWithoutItemType( aFirst, aSecond ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/src/CGflmItemGroupImpl.cpp --- a/filemanager/GFLM/src/CGflmItemGroupImpl.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,374 +0,0 @@ -/* -* Copyright (c) 2002-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: Concrete implementation of MGflmItemGroup interface -* -*/ - - - -// INCLUDE FILES -#include "CGflmItemGroupImpl.h" -#include "MGflmItemFilter.h" -#include "CGflmItemLocalizer.h" -#include "CGflmDriveResolver.h" -#include "CGflmFileRecognizer.h" -#include "CGflmDirectoryListingCache.h" -#include "CGflmGlobalActionItem.h" -#include "CGflmFileSystemItem.h" -#include "CGflmDriveItem.h" -#include "GFLMConsts.h" -#include "GFLM.hrh" -#include "GflmUtils.h" -#include - - -// ============================ MEMBER FUNCTIONS =============================== - - -// ----------------------------------------------------------------------------- -// CGflmItemGroupImpl::CGflmItemGroupImpl -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CGflmItemGroupImpl::CGflmItemGroupImpl( - const TInt aId, - RFs& aFss, - CGflmDirectoryListingCache& aCache, - CGflmItemLocalizer& aLocalizer, - CGflmDriveResolver& aResolver ) : - iId( aId ), - iFss( aFss ), - iListingCache( aCache ), - iItemLocalizer( aLocalizer ), - iDriveResolver( aResolver ) - { - } - -// ----------------------------------------------------------------------------- -// CGflmItemGroupImpl::~CGflmItemGroupImpl -// -// ----------------------------------------------------------------------------- -// -CGflmItemGroupImpl::~CGflmItemGroupImpl() - { - iVolatileItems.ResetAndDestroy(); - iVolatileItems.Close(); - - iStaticItems.ResetAndDestroy(); - iStaticItems.Close(); - - iItemReferences.Close(); - - delete iDirectory; - } - -// ----------------------------------------------------------------------------- -// CGflmItemGroupImpl::NewLC -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CGflmItemGroupImpl* CGflmItemGroupImpl::NewLC( - const TInt aId, - RFs& aFss, - CGflmDirectoryListingCache& aCache, - CGflmItemLocalizer& aLocalizer, - CGflmDriveResolver& aResolver ) - { - CGflmItemGroupImpl* self = new( ELeave ) CGflmItemGroupImpl( - aId, aFss, aCache, aLocalizer, aResolver ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ----------------------------------------------------------------------------- -// CGflmItemGroupImpl::ContructL -// ----------------------------------------------------------------------------- -// -void CGflmItemGroupImpl::ConstructL() - { - iSortCollationMethod = *Mem::CollationMethodByIndex( 0 ); - iSortCollationMethod.iFlags |= - TCollationMethod::EIgnoreNone | TCollationMethod::EFoldCase; - } - -// ----------------------------------------------------------------------------- -// CGflmItemGroupImpl::RefreshL() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CGflmItemGroupImpl::RefreshL( - MGflmItemFilter* aFilter, - TGflmSortMethod aSortMethod, - TGflmRefreshMode aRefreshMode ) - { - FUNC_LOG - - INFO_LOG2( - "CGflmItemGroupImpl::RefreshL-aRefreshMode=%d, aSortMethod=%d", - aRefreshMode, aSortMethod ) - - if ( aRefreshMode == ERefreshItems ) - { - // Reset reference list - iItemReferences.Reset(); - - // Destroy old filesystem items - iVolatileItems.ResetAndDestroy(); - - // Re-read contents of the assigned directories, filter out unwanted - // items and add rest to the item list - TIMESTAMP( "GFLM reading and filtering directories started: " ) - PopulateReferenceListL( aFilter ); - TIMESTAMP( "GFLM reading and filtering directories ended: " ) - } - - if ( aRefreshMode == ERefreshItems || aRefreshMode == ERefreshSort ) - { - if ( !( iInclusion & EDrives ) ) - { - TIMESTAMP( "GFLM group sorting started: " ) - iItemReferences.Sort( CGflmGroupItem::GetSortL( aSortMethod ) ); - TIMESTAMP( "GFLM group sorting ended: " ) - } - } - } - -// ----------------------------------------------------------------------------- -// CGflmItemGroupImpl::PopulateReferenceListL() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CGflmItemGroupImpl::PopulateReferenceListL( MGflmItemFilter* aFilter ) - { - CGflmGroupItem* item = NULL; - TInt i( 0 ); - - // Add drive items to the reference list - if ( iInclusion & EDrives ) - { - if ( iDirectory ) - { - // Hide drive selection when location inside folder. - return; - } - - TInt count( iDriveResolver.DriveCount() ); - for ( i = 0; i < count; i++ ) - { - // Add directly, items are filtered from drive resolver - CGflmDriveItem* drvItem = iDriveResolver.DriveAt( i ); - iItemReferences.AppendL( drvItem ); - drvItem->SetGroup( this ); - } - } - - // Add pointers to the static items (action items) to the - // reference list - TInt staticCount( iStaticItems.Count() ); - - for ( i = 0; i < staticCount; i++ ) - { - item = iStaticItems[ i ]; - if ( !aFilter || - ( aFilter && aFilter->FilterItemL( item, iId, NULL ) ) ) - { - iItemReferences.AppendL( item ); - item->SetGroup( this ); - } - } - - if ( iInclusion & ( EFiles | EDirectories ) ) - { - if ( iDirectory ) - { - // Check directory name length validity - TPtrC directory( iDirectory->Des() ); - TInt dirLen( directory.Length() ); - if ( !dirLen || dirLen > KMaxFileName ) - { - return; - } - - // Get the drive where items are located - CGflmDriveItem* drvItem = iDriveResolver.DriveFromPath( - directory ); - - const CGflmDirectoryListingCache::CEntryArray* dir = - iListingCache.ListingL( directory ); - TInt entryCount( dir->Count() ); - - // Reserve room for all entries at once to avoid overhead - iVolatileItems.ReserveL( entryCount ); - iItemReferences.ReserveL( iItemReferences.Count() + entryCount ); - - // Create buffer for filenames - HBufC* buffer = HBufC::NewLC( KMaxFileName ); - TPtr filename( buffer->Des() ); - - TIMESTAMP( "GFLM files and folders list genaration started: " ) - - TInt bsLen( KGFLMBackslash().Length() ); - - // For all items in a directory listing - for( i = 0; i < entryCount; i++ ) - { - const TEntry& entry( ( *dir )[ i ] ); - TBool isDir( entry.IsDir() ); - TInt extLen( isDir ? bsLen : 0 ); // Handle final backslash - if ( dirLen + entry.iName.Length() + extLen > KMaxFileName ) - { - continue; // Too long name - } - if ( isDir && !( iInclusion & EDirectories ) ) - { - continue; // No directories allowed - } - if ( !isDir && !( iInclusion & EFiles ) ) - { - continue; // No files allowed - } - - // Create a new filesystem item - CGflmFileSystemItem* fsItem = CGflmFileSystemItem::NewLC( - entry, directory ); - - // Filter out unwanted items - if ( !aFilter || - ( aFilter && aFilter->FilterItemL( fsItem, iId, drvItem ) ) ) - { - // Only directory items can be localized - if ( isDir ) - { - // Get localized name for the item, if it has one - GflmUtils::GetFullPath( directory, entry, filename ); - TPtrC localizedName( - iItemLocalizer.LocalizeFromWorkThread( filename ) ); - if ( localizedName.Length() ) - { - fsItem->SetLocalizedNameL( localizedName ); - } - } - iVolatileItems.AppendL( fsItem ); - CleanupStack::Pop( fsItem ); - iItemReferences.AppendL( fsItem ); - fsItem->SetGroup( this ); - } - else - { - CleanupStack::PopAndDestroy( fsItem ); - } - } - - CleanupStack::PopAndDestroy( buffer ); - - TIMESTAMP( "GFLM files and folders list genaration ended: " ) - - } - } - - } - -// ----------------------------------------------------------------------------- -// CGflmItemGroupImpl::ItemCount() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt CGflmItemGroupImpl::ItemCount() const - { - return iItemReferences.Count(); - } - -// ----------------------------------------------------------------------------- -// CGflmItemGroupImpl::Item() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -CGflmGroupItem* CGflmItemGroupImpl::Item( TInt aIndex ) - { - return iItemReferences[ aIndex ]; - } - -// ----------------------------------------------------------------------------- -// CGflmItemGroupImpl::Id() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt CGflmItemGroupImpl::Id() const - { - return iId; - } - -// ----------------------------------------------------------------------------- -// CGflmItemGroupImpl::SetInclusion() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CGflmItemGroupImpl::SetInclusion( TUint aInclusion ) - { - iInclusion = aInclusion; - } - -// ----------------------------------------------------------------------------- -// CGflmItemGroupImpl::AddSourceL() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CGflmItemGroupImpl::AddSourceL( const TDesC& aDirectory ) - { - HBufC* temp = aDirectory.AllocL(); - delete iDirectory; - iDirectory = temp; - // Reset reference list to cleanup all references to deleted directory - iItemReferences.Reset(); - } - -// ----------------------------------------------------------------------------- -// CGflmItemGroupImpl::ResetSources() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CGflmItemGroupImpl::ResetSources() - { - delete iDirectory; - iDirectory = NULL; - // Reset reference list to cleanup all references to deleted directory - iItemReferences.Reset(); - } - -// ----------------------------------------------------------------------------- -// CGflmItemGroupImpl::AddActionItemL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CGflmItemGroupImpl::AddActionItemL( TInt aId, const TDesC& aCaption ) - { - CGflmGlobalActionItem* actionItem = - CGflmGlobalActionItem::NewLC( aId, aCaption ); - iStaticItems.AppendL( actionItem ); - CleanupStack::Pop( actionItem ); - } - -// ----------------------------------------------------------------------------- -// CGflmItemGroupImpl::CollationMethod -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -const TCollationMethod* CGflmItemGroupImpl::CollationMethod() - { - return &iSortCollationMethod; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/src/CGflmItemLocalizer.cpp --- a/filemanager/GFLM/src/CGflmItemLocalizer.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* Copyright (c) 2002-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: This class is used to provide localized names -* -*/ - - - -// INCLUDE FILES -#include "CGflmItemLocalizer.h" -#include "GflmUtils.h" -#include "GFLM.hrh" -#include - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGflmItemLocalizer::CGflmItemLocalizer -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CGflmItemLocalizer::CGflmItemLocalizer() - { - } - -// ----------------------------------------------------------------------------- -// CGflmItemLocalizer::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CGflmItemLocalizer* CGflmItemLocalizer::NewL() - { - CGflmItemLocalizer* self = new( ELeave ) CGflmItemLocalizer(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CGflmItemLocalizer::ConstructL -// ----------------------------------------------------------------------------- -// -void CGflmItemLocalizer::ConstructL() - { - iLocalizer = CDirectoryLocalizer::NewL(); - } - -// ----------------------------------------------------------------------------- -// CGflmItemLocalizer::~CGflmItemLocalizer -// ----------------------------------------------------------------------------- -// -CGflmItemLocalizer::~CGflmItemLocalizer() - { - delete iLocalizer; - // iWorkThreadLocalizer cannot be freed here because it was - // allocated by another thread - } - -// ----------------------------------------------------------------------------- -// CGflmItemLocalizer::Localize() -// ----------------------------------------------------------------------------- -// -TPtrC CGflmItemLocalizer::Localize( const TDesC& aPath ) const - { - return Localize( *iLocalizer, aPath ); - } - -// ----------------------------------------------------------------------------- -// CGflmItemLocalizer::LocalizeFromWorkThread() -// ----------------------------------------------------------------------------- -// -TPtrC CGflmItemLocalizer::LocalizeFromWorkThread( const TDesC& aPath ) const - { - if ( iWorkThreadLocalizer ) - { - return Localize( *iWorkThreadLocalizer, aPath ); - } - return TPtrC( KNullDesC ); - } - -// ----------------------------------------------------------------------------- -// CGflmItemLocalizer::SetupWorkThreadLocalizerL() -// ----------------------------------------------------------------------------- -// -void CGflmItemLocalizer::SetupWorkThreadLocalizerL() - { - if ( !iWorkThreadLocalizer ) - { - iWorkThreadLocalizer = CDirectoryLocalizer::NewL(); - } - } - -// ----------------------------------------------------------------------------- -// CGflmItemLocalizer::SetupWorkThreadLocalizer() -// ----------------------------------------------------------------------------- -// -void CGflmItemLocalizer::ReleaseWorkThreadLocalizer() - { - delete iWorkThreadLocalizer; - iWorkThreadLocalizer = NULL; - } - -// ----------------------------------------------------------------------------- -// CGflmItemLocalizer::SetupWorkThreadLocalizer() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TPtrC CGflmItemLocalizer::Localize( - CDirectoryLocalizer& aLocalizer, const TDesC& aPath ) const - { - aLocalizer.SetFullPath( aPath ); - if( aLocalizer.IsLocalized() ) - { - // Ensure that localized name is legal. - // Some localizations may have dot in the end that makes it - // invalid for file system point of view. - return GflmUtils::StripFinalDot( aLocalizer.LocalizedName() ); - } - return TPtrC( KNullDesC ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/src/CGflmNavigatorModel.cpp --- a/filemanager/GFLM/src/CGflmNavigatorModel.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,298 +0,0 @@ -/* -* Copyright (c) 2002-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: Navigable file list model -* -*/ - - - -// INCLUDE FILES -#include -#include "CGflmNavigatorModel.h" -#include "CGflmItemGroupImpl.h" -#include "CGflmItemLocalizer.h" -#include "CGflmDriveResolver.h" -#include "GFLM.hrh" -#include "GflmUtils.h" -#include "GFLMConsts.h" - - -// CONSTANTS - -// Granularity of iBackstepStack array -const TInt KBackstepStackGranularity = 3; - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGflmNavigatorModel::CGflmNavigatorModel -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CGflmNavigatorModel::CGflmNavigatorModel( RFs& aFs ) : - CGflmFileListModel( aFs ) - { - } - -// ----------------------------------------------------------------------------- -// CGflmNavigatorModel::ConstructL() -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CGflmNavigatorModel::ConstructL() - { - CGflmFileListModel::ConstructL(); - iBackstepStack = new( ELeave ) CDesCArraySeg( KBackstepStackGranularity ); - } - -// ----------------------------------------------------------------------------- -// CGflmNavigatorModel::NewL() -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -EXPORT_C CGflmNavigatorModel* CGflmNavigatorModel::NewL( RFs& aFs ) - { - CGflmNavigatorModel* self = new( ELeave ) CGflmNavigatorModel( aFs ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CGflmNavigatorModel::~CGflmNavigatorModel() -// ----------------------------------------------------------------------------- -// -CGflmNavigatorModel::~CGflmNavigatorModel() - { - delete iBackstepStack; - } - -// ----------------------------------------------------------------------------- -// CGflmNavigatorModel::GoToDirectoryL() -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmNavigatorModel::GoToDirectoryL( - const TDesC& aPath, TBool aBackstepping ) - { - if ( !aPath.CompareF( CurrentDirectory() ) ) - { - return; // Already in the directory - } - SetBaseDirectoryL( aPath ); - - // Update the backstepping stack after calling SetBaseDirectoryL() - // because it might leave - if ( !aBackstepping ) - { - iBackstepStack->Reset(); - } - iBackstepStack->AppendL( aPath ); - - } - -// ----------------------------------------------------------------------------- -// CGflmNavigatorModel::BackstepL() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmNavigatorModel::BackstepL() - { - if ( iBackstepStack->MdcaCount() ) - { - iBackstepStack->Delete( iBackstepStack->MdcaCount() - 1 ); - if ( iBackstepStack->MdcaCount() ) - { - TPtrC dir( iBackstepStack->MdcaPoint( - iBackstepStack->MdcaCount() - 1 ) ); - SetSourceL( dir ); - if ( !IsValidSource( dir ) ) - { - User::Leave( KErrPathNotFound ); - } - } - else - { - SetSourceL( KNullDesC ); - } - } - else - { - User::Leave( KErrUnderflow ); - } - } - -// ----------------------------------------------------------------------------- -// CGflmNavigatorModel::GoToDirectoryL() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -EXPORT_C void CGflmNavigatorModel::GoToDirectoryL( const TDesC& aBasePath, - const TDesC& aTopPath ) - { - // Use copies because descriptors may come from backstep stack itself - HBufC* basePathBuffer = aBasePath.AllocLC(); - TPtrC basePath( basePathBuffer->Des() ); - HBufC* topPathBuffer = aTopPath.AllocLC(); - TPtrC topPath( topPathBuffer->Des() ); - const TInt KNthMatch = 2; - - // Clear the backstepping stack - iBackstepStack->Reset(); - - // Construct the backstepping stack - - while ( basePath.CompareF( topPath ) ) - { - iBackstepStack->InsertL( 0, topPath ); - - // Find the second backslash starting from the end - TInt cutPoint( GflmUtils::LocateReverseNth( - topPath, KGFLMBackslash()[ 0 ], KNthMatch ) ); - User::LeaveIfError( cutPoint ); - topPath.Set( topPath.Left( cutPoint + 1 ) ); - } - - // Add basepath too - iBackstepStack->InsertL( 0, topPath ); - - SetBaseDirectoryL( *topPathBuffer ); - - CleanupStack::PopAndDestroy( topPathBuffer ); - CleanupStack::PopAndDestroy( basePathBuffer ); - } - -// ----------------------------------------------------------------------------- -// CGflmNavigatorModel::CurrentDirectory() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CGflmNavigatorModel::CurrentDirectory() const - { - TInt stackSize( iBackstepStack->MdcaCount() ); - if ( stackSize <= 0 ) - { - return KNullDesC(); - } - return iBackstepStack->MdcaPoint( stackSize - 1 ); - } - -// ----------------------------------------------------------------------------- -// CGflmNavigatorModel::LocalizedNameOfCurrentDirectory() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC CGflmNavigatorModel::LocalizedNameOfCurrentDirectory() const - { - TInt stackSize( iBackstepStack->MdcaCount() ); - if ( stackSize <= 0 ) - { - return TPtrC( KNullDesC ); - } - TPtrC directory( iBackstepStack->MdcaPoint( stackSize - 1 ) ); - TPtrC localizedName( iItemLocalizer->Localize( directory ) ); - if ( localizedName.Length() ) - { - // Return the localized name - return localizedName; - } - // Directory has no localized name => return the name of the directory - TPtrC ptr( GflmUtils::StripFinalBackslash( directory ) ); - TInt lastBs( ptr.LocateReverse( KGFLMBackslash()[ 0 ] ) ); - if ( lastBs != KErrNotFound ) - { - return ptr.Mid( lastBs + 1 ); - } - return TPtrC( KNullDesC ); - } - -// ----------------------------------------------------------------------------- -// CGflmNavigatorModel::SetBaseDirectoryL() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CGflmNavigatorModel::SetBaseDirectoryL( const TDesC& aDirectory ) - { - if ( IsValidSource( aDirectory ) ) - { - SetSourceL( aDirectory ); - } - else - { - User::Leave( KErrPathNotFound ); - } - } - -// ----------------------------------------------------------------------------- -// CGflmNavigatorModel::NavigationLevel() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CGflmNavigatorModel::NavigationLevel() const - { - return iBackstepStack->Count() - 1; - } - -// ----------------------------------------------------------------------------- -// CGflmNavigatorModel::CurrentDrive() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -EXPORT_C CGflmDriveItem* CGflmNavigatorModel::CurrentDrive() const - { - return DriveFromPath( CurrentDirectory() ); - } - -// ----------------------------------------------------------------------------- -// CGflmNavigatorModel::SetSourceL() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CGflmNavigatorModel::SetSourceL( const TDesC& aSource ) - { - TBool empty( !aSource.Length() ); - TInt groupCount( iGroups->Count() ); - for ( TInt i( 0 ); i < groupCount; i++ ) - { - MGflmItemGroup* group = iGroups->At( i ); - group->ResetSources(); - if ( !empty ) - { - group->AddSourceL( aSource ); - } - } - } - -// ----------------------------------------------------------------------------- -// CGflmNavigatorModel::IsValidSource() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TBool CGflmNavigatorModel::IsValidSource( const TDesC& aSource ) const - { - if ( aSource.Length() && - !iDriveResolver->IsRemoteDrive( aSource ) && - !BaflUtils::PathExists( iFs, aSource ) && - !iDriveResolver->IsRootPath( aSource ) ) - { - return EFalse; - } - return ETrue; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/GFLM/src/GflmUtils.cpp --- a/filemanager/GFLM/src/GflmUtils.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +0,0 @@ -/* -* Copyright (c) 2002-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: Static utility class for GFLM -* -*/ - - - -// INCLUDE FILES -#include "GflmUtils.h" -#include "GFLMConsts.h" -#include -#include -#include -#include - -// CONSTANTS -_LIT( KWildCard, "*" ); -_LIT( KWildCard2, "?" ); - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// GflmUtils::LocateReverseNth() -// ----------------------------------------------------------------------------- -// -TInt GflmUtils::LocateReverseNth( - const TDesC& aDescriptor, - TChar aChar, - const TInt aNth ) - { - TPtrC ptr( aDescriptor ); - TInt ret( KErrArgument ); - for ( TInt i( 0 ); i < aNth; i++ ) - { - ret = ptr.LocateReverse( aChar ); - if ( ret == KErrNotFound ) - { - break; - } - ptr.Set( ptr.Left( ret ) ); - } - return ret; - } - -// ----------------------------------------------------------------------------- -// GflmUtils::EnsureFinalBackslash() -// ----------------------------------------------------------------------------- -// -EXPORT_C void GflmUtils::EnsureFinalBackslash( TDes& aPath ) - { - if ( !HasFinalBackslash( aPath ) ) - { - aPath.Append( KGFLMBackslash ); - } - } - -// ----------------------------------------------------------------------------- -// GflmUtils::StripFinalBackslash() -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC GflmUtils::StripFinalBackslash( const TDesC& aPath ) - { - return StripFinal( aPath, KGFLMBackslash ); - } - -// ----------------------------------------------------------------------------- -// GflmUtils::HasFinalBackslash -// ----------------------------------------------------------------------------- -// -EXPORT_C TBool GflmUtils::HasFinalBackslash( const TDesC& aPath ) - { - TPtrC ptr( aPath.Right( KGFLMBackslash().Length() ) ); - if ( KGFLMBackslash().Compare( ptr ) ) - { - return EFalse; - } - return ETrue; - } - -// ----------------------------------------------------------------------------- -// GflmUtils::GetFullPath -// ----------------------------------------------------------------------------- -// -EXPORT_C void GflmUtils::GetFullPath( - const TDesC& aDir, const TEntry& aEntry, TDes& aFullPath ) - { - aFullPath.Copy( aDir ); - EnsureFinalBackslash( aFullPath ); - aFullPath.Append( aEntry.iName ); - if ( aEntry.IsDir() ) - { - aFullPath.Append( KGFLMBackslash ); - } - } - -// ----------------------------------------------------------------------------- -// GflmUtils::FullPathLC -// ----------------------------------------------------------------------------- -// -EXPORT_C HBufC* GflmUtils::FullPathLC( - const TDesC& aDir, const TEntry& aEntry ) - { - HBufC* fullPath = FullPathL( aDir, aEntry ); - CleanupStack::PushL( fullPath ); - return fullPath; - } - -// ----------------------------------------------------------------------------- -// GflmUtils::FullPathL -// ----------------------------------------------------------------------------- -// -EXPORT_C HBufC* GflmUtils::FullPathL( - const TDesC& aDir, const TEntry& aEntry ) - { - TInt len( aDir.Length() + aEntry.iName.Length() ); - if ( aEntry.IsDir() ) - { - len += KGFLMBackslash().Length(); - } - HBufC* fullPath = HBufC::NewL( len ); - TPtr ptr( fullPath->Des() ); - GetFullPath( aDir, aEntry, ptr ); - return fullPath; - } - -// ----------------------------------------------------------------------------- -// GflmUtils::StripFinalDot -// ----------------------------------------------------------------------------- -// -TPtrC GflmUtils::StripFinalDot( const TDesC& aPath ) - { - return StripFinal( aPath, KGFLMDot ); - } - -// ----------------------------------------------------------------------------- -// GflmUtils::StripFinal -// ----------------------------------------------------------------------------- -// -TPtrC GflmUtils::StripFinal( - const TDesC& aString, const TDesC& aStringToStrip ) - { - TInt len( aStringToStrip.Length() ); - TPtrC ptr( aString.Right( len ) ); - - if( !aStringToStrip.Compare( ptr ) ) - { - return aString.Left( aString.Length() - len ); - } - return TPtrC( aString ); - } - -// ----------------------------------------------------------------------------- -// GflmUtils::HasWildCard -// ----------------------------------------------------------------------------- -// -TBool GflmUtils::HasWildCard( const TDesC& aString ) - { - return ( aString.Find( KWildCard ) != KErrNotFound || - aString.Find( KWildCard2 ) != KErrNotFound ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/data/FileManagerView.rss --- a/filemanager/View/data/FileManagerView.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,740 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource definitions for project FileManagerView -* -*/ - - - -NAME FMGV // From FileManager View - - -// INCLUDES -#include -#include "FileManagerView.hrh" -#include "FileManagerView.rh" -#include "FileManagerEngine.hrh" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// --------------------------------------------------------- -// Standard resource signature -// --------------------------------------------------------- -// -RESOURCE RSS_SIGNATURE { } - - -// RESOURCE DEFINITIONS -RESOURCE ARRAY r_filemanager_icon_array - { - items = - { - FILEMANAGER_ICON - { - iconId = EFileManagerMarkIcon; - mbmFile = avkon_mbm_file_location; - iconBmpId = EMbmAvkonQgn_indi_marked_add; - maskBmpId = EMbmAvkonQgn_indi_marked_add_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnIndiMarkedAdd; - iconType = EFileManagerIconColorIcon; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerFolderIcon; - mbmFile = avkon_mbm_file_location; - iconBmpId = EMbmAvkonQgn_prop_folder_small; - maskBmpId = EMbmAvkonQgn_prop_folder_small_mask; - majorSkinId = EAknsMajorAvkon; - minorSkinId = EAknsMinorQgnPropFolderSmall; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerFolderSubIcon; - mbmFile = avkon_mbm_file_location; - iconBmpId = EMbmAvkonQgn_prop_folder_sub_small; - maskBmpId = EMbmAvkonQgn_prop_folder_sub_small_mask; - majorSkinId = EAknsMajorAvkon; - minorSkinId = EAknsMinorQgnPropFolderSubSmall; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerFolderEmptyIcon; - mbmFile = filemanager_mbm_file_location; - iconBmpId = EMbmFilemanagerQgn_prop_folder_empty; - maskBmpId = EMbmFilemanagerQgn_prop_folder_empty_mask; - majorSkinId = EAknsMajorAvkon; - minorSkinId = EAknsMinorGenericQgnPropFolderEmpty; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerMemoryCardIcon; - mbmFile = filemanager_mbm_file_location; - iconBmpId = EMbmFilemanagerQgn_prop_mmc_memc; - maskBmpId = EMbmFilemanagerQgn_prop_mmc_memc_mask; - majorSkinId = EAknsMajorAvkon; - minorSkinId = EAknsMinorQgnPropMmcMemc; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerPhoneMemoryIcon; - mbmFile = filemanager_mbm_file_location; - iconBmpId = EMbmFilemanagerQgn_prop_phone_memc; - maskBmpId = EMbmFilemanagerQgn_prop_phone_memc_mask; - majorSkinId = EAknsMajorAvkon; - minorSkinId = EAknsMinorQgnPropPhoneMemc; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerImageFileIcon; - mbmFile = commondialogs_mbm_file_location; - iconBmpId = EMbmCommondialogsQgn_prop_fmgr_file_image; - maskBmpId = EMbmCommondialogsQgn_prop_fmgr_file_image_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrFileImage; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerPictureMsgFileIcon; - mbmFile = commondialogs_mbm_file_location; - iconBmpId = EMbmCommondialogsQgn_prop_fmgr_file_gms; - maskBmpId = EMbmCommondialogsQgn_prop_fmgr_file_gms_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrFileGms; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerDycLogoFileIcon; - mbmFile = commondialogs_mbm_file_location; - iconBmpId = EMbmCommondialogsQgn_prop_fmgr_dyc_logos; - maskBmpId = EMbmCommondialogsQgn_prop_fmgr_dyc_logos_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrDycLogos; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerLinkFileIcon; - mbmFile = commondialogs_mbm_file_location; - iconBmpId = EMbmCommondialogsQgn_prop_fmgr_file_link; - maskBmpId = EMbmCommondialogsQgn_prop_fmgr_file_link_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrFileLink; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerVoicerecFileIcon; - mbmFile = commondialogs_mbm_file_location; - iconBmpId = EMbmCommondialogsQgn_prop_fmgr_file_voicerec; - maskBmpId = EMbmCommondialogsQgn_prop_fmgr_file_voicerec_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrFileVoicerec; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerSoundFileIcon; - mbmFile = commondialogs_mbm_file_location; - iconBmpId = EMbmCommondialogsQgn_prop_fmgr_file_sound; - maskBmpId = EMbmCommondialogsQgn_prop_fmgr_file_sound_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrFileSound; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerPlaylistFileIcon; - mbmFile = commondialogs_mbm_file_location; - iconBmpId = EMbmCommondialogsQgn_prop_fmgr_file_playlist; - maskBmpId = EMbmCommondialogsQgn_prop_fmgr_file_playlist_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrFilePlaylist; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerCompoFileIcon; - mbmFile = commondialogs_mbm_file_location; - iconBmpId = EMbmCommondialogsQgn_prop_fmgr_file_compo; - maskBmpId = EMbmCommondialogsQgn_prop_fmgr_file_compo_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrFileCompo; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerNoteFileIcon; - mbmFile = avkon_mbm_file_location; - iconBmpId = EMbmAvkonQgn_prop_nrtyp_note; - maskBmpId = EMbmAvkonQgn_prop_nrtyp_note_mask; - majorSkinId = EAknsMajorAvkon; - minorSkinId = EAknsMinorQgnPropNrtypNote; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerAppFileIcon; - mbmFile = commondialogs_mbm_file_location; - iconBmpId = EMbmCommondialogsQgn_prop_fmgr_file_apps; - maskBmpId = EMbmCommondialogsQgn_prop_fmgr_file_apps_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrFileApps; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerVideoFileIcon; - mbmFile = commondialogs_mbm_file_location; - iconBmpId = EMbmCommondialogsQgn_prop_fmgr_file_video; - maskBmpId = EMbmCommondialogsQgn_prop_fmgr_file_video_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrFileVideo; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerGameFileIcon; - mbmFile = commondialogs_mbm_file_location; - iconBmpId = EMbmCommondialogsQgn_prop_fmgr_file_game; - maskBmpId = EMbmCommondialogsQgn_prop_fmgr_file_game_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorQgnPropFmgrFileGame; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerOtherFileIcon; - mbmFile = commondialogs_mbm_file_location; - iconBmpId = EMbmCommondialogsQgn_prop_fmgr_file_other; - maskBmpId = EMbmCommondialogsQgn_prop_fmgr_file_other_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorQgnPropFmgrFileOther; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerFlashFileIcon; - mbmFile = filemanager_mbm_file_location; - iconBmpId = EMbmFilemanagerQgn_prop_file_swf_small; - maskBmpId = EMbmFilemanagerQgn_prop_file_swf_small_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFileSwfSmall; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerPhoneMemoryMainIcon; - mbmFile = filemanager_mbm_file_location; - iconBmpId = EMbmFilemanagerQgn_prop_fmgr_phone_memc_sub; - maskBmpId = EMbmFilemanagerQgn_prop_fmgr_phone_memc_sub_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrPhoneMemcSub; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerMemoryCardPresentMainIcon; - mbmFile = filemanager_mbm_file_location; - iconBmpId = EMbmFilemanagerQgn_prop_fmgr_mmc_sub; - maskBmpId = EMbmFilemanagerQgn_prop_fmgr_mmc_sub_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrMmcSub; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerMemoryCardNotPresentMainIcon; - mbmFile = filemanager_mbm_file_location; - iconBmpId = EMbmFilemanagerQgn_prop_fmgr_mmc_no_sub; - maskBmpId = EMbmFilemanagerQgn_prop_fmgr_mmc_no_sub_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrMmcNoSub; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerBackupMainIcon; - mbmFile = filemanager_mbm_file_location; - iconBmpId = EMbmFilemanagerQgn_prop_fmgr_backup_sub; - maskBmpId = EMbmFilemanagerQgn_prop_fmgr_backup_sub_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrBackupSub; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerRemoteDriveConnectedIcon; - mbmFile = filemanager_mbm_file_location; - iconBmpId = EMbmFilemanagerQgn_indi_connection_on_add; - maskBmpId = EMbmFilemanagerQgn_indi_connection_on_add_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnIndiConnectionOnAdd; - iconType = EFileManagerIconColorIcon; - }, - FILEMANAGER_ICON - { - iconId = EFileManagerRemoteDriveMainIcon; - mbmFile = filemanager_mbm_file_location; - iconBmpId = EMbmFilemanagerQgn_menu_fmgr_remote_drive; - maskBmpId = EMbmFilemanagerQgn_menu_fmgr_remote_drive_mask; - majorSkinId = EAknsMajorGeneric; - // There is no own skin for qgn_menu_fmgr_remote_drive - minorSkinId = EAknsMinorGenericQgnPropRemoteDriveMemcLarge; - } -//#ifdef RD_MULTIPLE_DRIVE - ,FILEMANAGER_ICON - { - iconId = EFileManagerMassStorageMainIcon; - mbmFile = filemanager_mbm_file_location; - iconBmpId = EMbmFilemanagerQgn_prop_fmgr_ms_sub; - maskBmpId = EMbmFilemanagerQgn_prop_fmgr_ms_sub_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrMsSub; - } -//#endif // RD_MULTIPLE_DRIVE - ,FILEMANAGER_ICON - { - iconId = EFileManagerUsbMemoryMainIcon; - mbmFile = filemanager_mbm_file_location; - iconBmpId = EMbmFilemanagerQgn_prop_usb_memc_sub; // Change these after USB icons available - maskBmpId = EMbmFilemanagerQgn_prop_usb_memc_sub_mask; -// iconBmpId = EMbmFilemanagerQgn_prop_fmgr_ms_sub; -// maskBmpId = EMbmFilemanagerQgn_prop_fmgr_ms_sub_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrUsbMemcSub; -// minorSkinId = EAknsMinorGenericQgnPropFmgrMsSub; - } - }; - } - -RESOURCE DIALOG r_filemanager_file_name_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = EDataLayout; - label = qtn_fldr_item_name_prmpt; - control = EDWIN - { - flags = EEikEdwinNoHorizScrolling | - EEikEdwinResizable | - EEikEdwinNoLineOrParaBreaks; - lines = 1; - maxlength = 256; - }; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_popup_dialog - { - flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - }; - } - }; - } - -RESOURCE LISTBOX r_filemanager_setting_listbox - { - flags = EAknListBoxMultipleSelection; - } - -RESOURCE AVKON_SETTING_PAGE r_filemanager_setting_checkbox_page - { - softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__MARK; - type = EAknSetListBox; - editor_resource_id = r_filemanager_setting_listbox; - menubar = R_AVKON_MENUPANE_EMPTY; - } - -RESOURCE AVKON_SETTING_PAGE r_filemanager_setting_radiobutton_page - { - softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__SELECT; - type = EAknSetListBox; - editor_resource_id = r_filemanager_setting_listbox; - menubar = R_AVKON_MENUPANE_EMPTY; - } - -RESOURCE TIME_EDITOR r_filemanager_time_editor - { - minTime = TIME{ second = 0; minute = 0; hour = 0; }; - maxTime = TIME{ second = 59; minute = 59; hour = 23; }; - flags = EEikTimeWithoutSecondsField; - } - -RESOURCE AVKON_SETTING_PAGE r_filemanager_time_setting_page - { - type = EEikCtTimeEditor; - editor_resource_id = r_filemanager_time_editor; - } - -RESOURCE DIALOG r_filemanager_info_query - { - flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - label = qtn_apps_fmgr_list; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_info_confirm_query_with_ok - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - bmpfile = AVKON_ICON_FILE; - bmpid = EMbmAvkonQgn_note_info; - bmpmask = EMbmAvkonQgn_note_info_mask; - animation = R_QGN_NOTE_INFO_ANIM; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_error_confirm_query_with_ok - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - bmpfile = AVKON_ICON_FILE; - bmpid = EMbmAvkonQgn_note_error; - bmpmask = EMbmAvkonQgn_note_error_mask; - animation = R_QGN_NOTE_ERROR_ANIM; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_confirm_query_with_yes_no - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - bmpfile = AVKON_ICON_FILE; - bmpid = EMbmAvkonQgn_note_query; - bmpmask = EMbmAvkonQgn_note_query_mask; - animation = R_QGN_NOTE_QUERY_ANIM; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_confirm_query_with_ok_cancel - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - bmpfile = AVKON_ICON_FILE; - bmpid = EMbmAvkonQgn_note_query; - bmpmask = EMbmAvkonQgn_note_query_mask; - animation = R_QGN_NOTE_QUERY_ANIM; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_simple_password_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = ECodeLayout; - control = SECRETED - { - num_letters = 8; // Only 8 Unicode chars fit - }; - }; - } - }; - } - -RESOURCE DIALOG r_filemanager_password_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items= - { - DLG_LINE - { - type = EAknCtMultilineQuery; - id = EMultilineFirstLine; - control = AVKON_DATA_QUERY - { - layout = EMultiDataFirstSecEd; - label = qtn_memc_set_password_prompt1; - control = SECRETED - { - num_letters = 8; // Only 8 Unicode chars fit - }; - }; - }, - - DLG_LINE - { - type = EAknCtMultilineQuery; - id = EMultilineSecondLine; - control = AVKON_DATA_QUERY - { - layout = EMultiDataSecondSecEd; - label = qtn_memc_set_password_prompt2; - control = SECRETED - { - num_letters = 8; // Only 8 Unicode chars fit - }; - }; - } - }; - } - -// ----------------------------------------------------------------------------- -// -// r_filemanager_folder_navigation_pane -// folder indicator for navipane -// -// ----------------------------------------------------------------------------- -// -RESOURCE FILEMANAGER_FOLDER_NAVIGATION_PANE r_filemanager_folder_navigation_pane - { - bmpfile = filemanager_mbm_file_location; - foldericonid = EMbmFilemanagerQgn_prop_folder_tab; - foldermaskid = EMbmFilemanagerQgn_prop_folder_tab_mask; - majorSkinId = EAknsMajorAvkon; - minorSkinId = EAknsMinorQgnPropFolderTab; - separator = qtn_memc_main_separator; - endchar = qtn_memc_main_end; - - - folderindicators = - { - FILEMANAGER_FOLDER_NAVIGATION_PANE_DATA - { - id = EFmPhoneMemory; - bmpfile = filemanager_mbm_file_location; - rooticonid = EMbmFilemanagerQgn_prop_memc_phone_tab; - rootmaskid = EMbmFilemanagerQgn_prop_memc_phone_tab_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropMemcPhoneTab; - }, - FILEMANAGER_FOLDER_NAVIGATION_PANE_DATA - { - id = EFmMemoryCard; - bmpfile = filemanager_mbm_file_location; - rooticonid = EMbmFilemanagerQgn_prop_memc_mmc_tab; - rootmaskid = EMbmFilemanagerQgn_prop_memc_mmc_tab_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropMemcMmcTab; - }, - FILEMANAGER_FOLDER_NAVIGATION_PANE_DATA - { - id = EFmRemoteDrive; - bmpfile = filemanager_mbm_file_location; - rooticonid = EMbmFilemanagerQgn_prop_fmgr_remote_drive_tab; - rootmaskid = EMbmFilemanagerQgn_prop_fmgr_remote_drive_tab_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropFmgrRemoteDriveTab; - } -#ifdef RD_MULTIPLE_DRIVE - ,FILEMANAGER_FOLDER_NAVIGATION_PANE_DATA - { - id = EFmMassStorage; - bmpfile = filemanager_mbm_file_location; - rooticonid = EMbmFilemanagerQgn_prop_memc_ms_tab; - rootmaskid = EMbmFilemanagerQgn_prop_memc_ms_tab_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropMemcMsTab; - } -#endif // RD_MULTIPLE_DRIVE - ,FILEMANAGER_FOLDER_NAVIGATION_PANE_DATA - { - id = EFmUsbMemory; - bmpfile = filemanager_mbm_file_location; - rooticonid = EMbmFilemanagerQgn_prop_usb_memc_tab; // Change these after USB icons available - rootmaskid = EMbmFilemanagerQgn_prop_usb_memc_tab_mask; -// rooticonid = EMbmFilemanagerQgn_prop_memc_ms_tab; -// rootmaskid = EMbmFilemanagerQgn_prop_memc_ms_tab_mask; - majorSkinId = EAknsMajorGeneric; - minorSkinId = EAknsMinorGenericQgnPropUsbMemcTab; -// minorSkinId = EAknsMinorGenericQgnPropMemcMsTab; - } - }; - } - -// LOCALIZED STRINGS -// Different titles for info popup -RESOURCE TBUF r_qtn_fmgr_info_heading_file { buf = qtn_fmgr_info_heading_file; } -RESOURCE TBUF r_qtn_fmgr_info_heading_fldr { buf = qtn_fmgr_info_heading_fldr; } -RESOURCE TBUF r_qtn_fmgr_info_heading_link { buf = qtn_fmgr_info_heading_link; } - -// Headings for info popup -RESOURCE TBUF r_qtn_swins_lsh2_apps_name { buf = qtn_swins_lsh2_apps_name; } -RESOURCE TBUF r_qtn_swins_lsh2_apps_type { buf = qtn_swins_lsh2_apps_type; } -RESOURCE TBUF r_qtn_album_datim_date { buf = qtn_album_datim_date; } -RESOURCE TBUF r_qtn_album_datim_time { buf = qtn_album_datim_time; } -RESOURCE TBUF r_qtn_album_litxt_size { buf = qtn_album_litxt_size; } -RESOURCE TBUF r_qtn_fmgr_info_fldr_default { buf = qtn_fmgr_info_fldr_default; } -RESOURCE TBUF r_qtn_fmgr_info_contain_fldr { buf = qtn_fmgr_info_contain_fldr; } -RESOURCE TBUF r_qtn_fmgr_info_contain_file { buf = qtn_fmgr_info_contain_file; } - -// Data strings for info popup -RESOURCE TBUF r_qtn_fmgr_info_def_fldr_text { buf = qtn_fmgr_info_def_fldr_text; } -RESOURCE TBUF r_filemanager_default_folder_name { buf = qtn_fldr_name_default; } -RESOURCE TBUF r_filemanager_default_folder_name_n { buf = qtn_fldr_name_default"(%U)"; } -RESOURCE TBUF r_qtn_fldr_name_already_used { buf = qtn_fldr_name_already_used; } -RESOURCE TBUF r_qtn_wmlbm_name_already_used { buf = qtn_wmlbm_name_already_used; } -RESOURCE TBUF r_qtn_fldr_bad_file_name { buf = qtn_fldr_bad_file_name; } -RESOURCE TBUF r_qtn_fldr_illegal_characters { buf = qtn_fldr_illegal_characters; } -RESOURCE TBUF r_qtn_item_overwrite_query { buf = qtn_fldr_overwrite_query; } - -RESOURCE TBUF r_qtn_drm_mgr_det2_play { buf = qtn_drm_mgr_det2_play; } -RESOURCE TBUF r_qtn_drm_mgr_det2_display { buf = qtn_drm_mgr_det2_display; } -RESOURCE TBUF r_qtn_drm_mgr_det2_execute { buf = qtn_drm_mgr_det2_execute; } -RESOURCE TBUF r_qtn_drm_mgr_det2_print { buf = qtn_drm_mgr_det2_print; } -RESOURCE TBUF r_qtn_drm_mgr_det_full_x { buf = qtn_drm_mgr_det_full_x; } -RESOURCE TBUF r_qtn_drm_mgr_det_unlimited { buf = qtn_drm_mgr_det_unlimited; } -RESOURCE TBUF r_qtn_drm_mgr_det_utl_x { buf = qtn_drm_mgr_det_utl_x; } -RESOURCE TBUF r_qtn_drm_mgr_det_1_count { buf = qtn_drm_mgr_det_1_count; } -RESOURCE TBUF r_qtn_drm_mgr_det_n_counts { buf = qtn_drm_mgr_det_n_counts; } -RESOURCE TBUF r_qtn_drm_mgr_det_uts_x { buf = qtn_drm_mgr_det_uts_x; } -RESOURCE TBUF r_qtn_drm_mgr_det_not_act { buf = qtn_drm_mgr_det_not_act; } -RESOURCE TBUF r_qtn_drm_mgr_det_udl_x { buf = qtn_drm_mgr_det_udl_x; } -RESOURCE TBUF r_qtn_drm_mgr_det_inter { buf = qtn_drm_mgr_det_inter; } -RESOURCE TBUF r_qtn_drm_mgr_det_inter_two { buf = qtn_drm_mgr_det_inter_two; } -RESOURCE TBUF r_qtn_drm_nbr_of_years_one { buf = qtn_drm_nbr_of_years_one; } -RESOURCE TBUF r_qtn_drm_nbr_of_years_one_final { buf = qtn_drm_nbr_of_years_one_final; } -RESOURCE TBUF r_qtn_drm_nbr_of_years_two_four { buf = qtn_drm_nbr_of_years_two_four; } -RESOURCE TBUF r_qtn_drm_nbr_of_years_five_zero { buf = qtn_drm_nbr_of_years_five_zero; } -RESOURCE TBUF r_qtn_drm_nbr_of_months_one { buf = qtn_drm_nbr_of_months_one; } -RESOURCE TBUF r_qtn_drm_nbr_of_months_five_zero { buf = qtn_drm_nbr_of_months_five_zero; } -RESOURCE TBUF r_qtn_drm_nbr_of_months_two_four { buf = qtn_drm_nbr_of_months_two_four; } -RESOURCE TBUF r_qtn_drm_nbr_of_days_one { buf = qtn_drm_nbr_of_days_one; } -RESOURCE TBUF r_qtn_drm_nbr_of_days_one_final { buf = qtn_drm_nbr_of_days_one_final; } -RESOURCE TBUF r_qtn_drm_nbr_of_days_two_four { buf = qtn_drm_nbr_of_days_two_four; } -RESOURCE TBUF r_qtn_drm_nbr_of_days_five_zero { buf = qtn_drm_nbr_of_days_five_zero; } -RESOURCE TBUF r_qtn_drm_nbr_of_hours_one { buf = qtn_drm_nbr_of_hours_one; } -RESOURCE TBUF r_qtn_drm_nbr_of_hours_one_final { buf = qtn_drm_nbr_of_hours_one_final; } -RESOURCE TBUF r_qtn_drm_nbr_of_hours_two_four { buf = qtn_drm_nbr_of_hours_two_four; } -RESOURCE TBUF r_qtn_drm_nbr_of_hours_five_zero { buf = qtn_drm_nbr_of_hours_five_zero; } -RESOURCE TBUF r_qtn_drm_nbr_of_mins_one { buf = qtn_drm_nbr_of_mins_one; } -RESOURCE TBUF r_qtn_drm_nbr_of_mins_one_final { buf = qtn_drm_nbr_of_mins_one_final; } -RESOURCE TBUF r_qtn_drm_nbr_of_mins_two_four { buf = qtn_drm_nbr_of_mins_two_four; } -RESOURCE TBUF r_qtn_drm_nbr_of_mins_five_zero { buf = qtn_drm_nbr_of_mins_five_zero; } -RESOURCE TBUF r_qtn_drm_nbr_of_secs_one { buf = qtn_drm_nbr_of_secs_one; } -RESOURCE TBUF r_qtn_drm_nbr_of_secs_one_final { buf = qtn_drm_nbr_of_secs_one_final; } -RESOURCE TBUF r_qtn_drm_nbr_of_secs_two_four { buf = qtn_drm_nbr_of_secs_two_four; } -RESOURCE TBUF r_qtn_drm_nbr_of_secs_five_zero { buf = qtn_drm_nbr_of_secs_five_zero; } -RESOURCE TBUF r_qtn_drm_mgr_det_rvf_x { buf = qtn_drm_mgr_det_rvf_x; } -RESOURCE TBUF r_qtn_drm_mgr_det_rvt_x { buf = qtn_drm_mgr_det_rvt_x; } -RESOURCE TBUF r_qtn_drm_mgr_det_cs { buf = qtn_drm_mgr_det_cs; } -RESOURCE TBUF r_qtn_drm_mgr_det_allowed { buf = qtn_drm_mgr_det_allowed; } -RESOURCE TBUF r_qtn_drm_mgr_det_forbid { buf = qtn_drm_mgr_det_forbid; } -RESOURCE TBUF r_qtn_drm_mgr_det_stat { buf = qtn_drm_mgr_det_stat; } -RESOURCE TBUF r_qtn_drm_mgr_det_valid { buf = qtn_drm_mgr_det_valid; } -RESOURCE TBUF r_qtn_drm_mgr_det_exp { buf = qtn_drm_mgr_det_exp; } -RESOURCE TBUF r_qtn_drm_mgr_det_accum_time_left { buf = qtn_drm_mgr_det_accum_time_left; } -RESOURCE TBUF r_qtn_fmgr_drm_det_link { buf = qtn_drm_mgr_title_pane; } -RESOURCE TBUF r_qtn_fmgr_drm_det_link_view { buf = qtn_drm_mgr_group_mo_view_det; } -RESOURCE TBUF r_qtn_fm_warning_file_extension { buf = qtn_fm_warning_file_extension; } - -// Memory card details info popup -RESOURCE TBUF r_qtn_fmgr_memcard_info_heading { buf = qtn_fmgr_memcard_info_heading; } -RESOURCE TBUF r_qtn_fmgr_card_info_name { buf = qtn_fmgr_card_info_name; } -RESOURCE TBUF r_qtn_fmgr_card_info_default_name { buf = qtn_fmgr_card_info_default_name; } -RESOURCE TBUF r_qtn_fmgr_card_info_size { buf = qtn_fmgr_card_info_size; } -RESOURCE TBUF r_qtn_fmgr_card_info_used { buf = qtn_fmgr_card_info_used; } -RESOURCE TBUF r_qtn_fmgr_card_info_free { buf = qtn_fmgr_card_info_free; } -RESOURCE TBUF r_qtn_fmgr_card_info_data { buf = qtn_fmgr_card_info_data; } -// Password -RESOURCE TBUF r_qtn_passwords_dont_match_text { buf = qtn_memc_set_password_error; } - -RESOURCE TBUF r_qtn_drm_mgr_det_not_valid_yet { buf = qtn_drm_mgr_det_not_valid_yet; } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/CFileManagerCheckBoxSettingPage.h --- a/filemanager/View/inc/CFileManagerCheckBoxSettingPage.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +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: Checkbox setting page -* -*/ - - - -#ifndef C_FILEMANAGERCHECKBOXSETTINGPAGE_H -#define C_FILEMANAGERCHECKBOXSETTINGPAGE_H - - -// INCLUDES -#include - - -// CLASS DECLARATION -/** - * This class implements checkbox setting page - * - * @lib FileManagerView.lib - * @since S60 3.1 - */ -NONSHARABLE_CLASS(CFileManagerCheckBoxSettingPage) : - public CAknCheckBoxSettingPage - { - -public: - /** - * Constructor. - * @see CAknCheckBoxSettingPage - */ - CFileManagerCheckBoxSettingPage( - const TInt aResourceID, - CSelectionItemList& aItemArray, - const TInt aDominantItemIndex ); - - ~CFileManagerCheckBoxSettingPage(); - -private: // From CAknCheckBoxSettingPage - void UpdateSettingL(); - -private: // New functions - void UpdateSelection(); - -private: // Data - /** - * Pointer to items array - * Not own. - */ - CSelectionItemList& iItemsArray; - - /** - * Index of the dominant item - */ - TInt iDominantItemIndex; - - }; - -#endif // C_FILEMANAGERCHECKBOXSETTINGPAGE_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/CFileManagerFileNameQueryDlg.h --- a/filemanager/View/inc/CFileManagerFileNameQueryDlg.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* Copyright (c) 2002-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: Dialog for asking file name from user -* -*/ - - - -#ifndef CFILEMANAGERFILENAMEQUERYDLG_H -#define CFILEMANAGERFILENAMEQUERYDLG_H - -// INCLUDES -#include // CAknTextQueryDialog - -// FORWARD DECLARATIONS -class CFileManagerEngine; - -// CLASS DECLARATION -/** - * Dialog for querying file names in File Manager - * - * @lib FileManagerView.lib - * @since S60 2.0 - */ -NONSHARABLE_CLASS(CFileManagerFileNameQueryDlg) : public CAknTextQueryDialog - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aOldName Old name of the file, this will be the default name - * @param aNewName User entered new name of the file. - * @param aEngine Reference to File Manager engine. - * @return Newly created query dialog. - */ - static CFileManagerFileNameQueryDlg* NewL( - const TDesC& aOldName, - TDes& aNewName, - CFileManagerEngine& aEngine ); - - /** - * Destructor. - */ - ~CFileManagerFileNameQueryDlg(); - - private: // from CAknTextQueryDialog - /** - * @see CAknTextQueryDialog - */ - TBool OkToExitL( TInt aButtonId ); - - /** - * @see CAknTextQueryDialog - */ - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType ); - - private: - /** - * C++ default constructor. - */ - CFileManagerFileNameQueryDlg( - TDes& aNewName, CFileManagerEngine& aEngine ); - - /** - * Symbian OS 2nd phase constructor. - * @param aOldName Old name of the file, this will be the default name - */ - void ConstructL( const TDesC& aOldName ); - - /** - * Performs exit checking - * @param aButtonId Button identifier - */ - TBool DoOkToExitL( TInt aButtonId ); - - private: // Data - /// Ref: Reference to File Manager engine - CFileManagerEngine& iEngine; - /// Own: Old file name - HBufC* iOldName; - /// For blocking unwanted softkey events - TBool iCallbackDisabled; - }; - -#endif // CFILEMANAGERFILENAMEQUERYDLG_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/CFileManagerFullOmaDrmInfo.h --- a/filemanager/View/inc/CFileManagerFullOmaDrmInfo.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* -* Copyright (c) 2005-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: Gets the item DRM information -* -*/ - - - -#ifndef CFILEMANAGERFULLOMADRMINFO_H -#define CFILEMANAGERFULLOMADRMINFO_H - -// INCLUDES -#include -#include - - -// FORWARD DECLARATIONS -class CCoeEnv; -class DRM::CDrmUiHandling; - -// CLASS DECLARATION -/** - * Collects the drm info of item and puts strings to given array - * - * @lib FileManagerView.lib - * @since S60 2.8 - */ -NONSHARABLE_CLASS(CFileManagerFullOmaDrmInfo) : public CBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aArray Array which is filled with DRM information, - * to be displayed in info popup - * @param aFullPath Full path to item which DRM info is needed - * @param aCoeEnv Control environment - * @return Newly created popup. - */ - static CFileManagerFullOmaDrmInfo* NewL( - CDesCArray& aArray, const TDesC& aFullPath, CCoeEnv& aCoeEnv ); - - /** - * Two-phased constructor. - * @param aArray Array which is filled with DRM information, - * to be displayed in info popup - * @param aFullPath Full path to item which DRM info is needed - * @param aCoeEnv Control environment - * @return Newly created popup. - */ - static CFileManagerFullOmaDrmInfo* NewLC( - CDesCArray& aArray, const TDesC& aFullPath, CCoeEnv& aCoeEnv ); - - /** - * Destructor. - */ - ~CFileManagerFullOmaDrmInfo(); - - public: // New functions -#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - /** - * Two-phased constructor. - * @param aFullPath Full path to item which DRM info is needed - * @param aCoeEnv Control environment - * @param aUiHandling DRM UI Handler - */ - static void ViewDetailsL( const TDesC& aFullPath, DRM::CDrmUiHandling* aUiHandling ); -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - - private: - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( - CDesCArray& aArray, - const TDesC& aFullPath, - CCoeEnv& aCoeEnv ); - - /** - * C++ default constructor. - * @param aProperties Properties of the item that will be shown - */ - CFileManagerFullOmaDrmInfo(); - - }; - -#endif // CFILEMANAGERFULLOMADRMINFO_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/CFileManagerGlobalDlg.h --- a/filemanager/View/inc/CFileManagerGlobalDlg.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,224 +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: Global dialog handling -* -*/ - - -#ifndef C_FILEMANAGERLOBALDLG_H -#define C_FILEMANAGERLOBALDLG_H - - -// INCLUDES -#include -#include "MFileManagerGlobalDlgObserver.h" - - -// FORWARD DECLARATIONS -class CFileManagerGlobalQueryDlg; -class CAknGlobalProgressDialog; -class CAknGlobalNote; - - -// CLASS DECLARATION -/** - * This class handles global dialog wrapping - * - * @lib FileManagerView.lib - * @since S60 3.1 - */ -class CFileManagerGlobalDlg : public CActive, - public MFileManagerGlobalDlgObserver - { - -public: // New functions - // Global dialog types - enum TType - { - ECountdownQuery = 0, - EQuery, - EProgressDialog, - EErrorNote, - EInfoNote, - EQueryWithWarningIcon, - EQueryWithInfoIcon - }; - - /** - * Two-phased constructor. - */ - IMPORT_C static CFileManagerGlobalDlg* NewL(); - - /** - * Destructor - */ - IMPORT_C ~CFileManagerGlobalDlg(); - - /** - * Sets global dialog observer - * - * @since S60 3.1 - * @param aObserver Pointer to observer - */ - IMPORT_C void SetObserver( - MFileManagerGlobalDlgObserver* aObserver ); - - /** - * Cancels global dialog - * - * @since S60 3.1 - */ - IMPORT_C void CancelDialog(); - - /** - * Shows global dialog - * - * @since S60 3.1 - * @param aType Global dialog type - * @param aText Text to display - * @param aSkId Softkeys to display - */ - IMPORT_C void ShowDialogL( - const CFileManagerGlobalDlg::TType aType, - const TDesC& aText, - const TInt aSkId = 0 ); - - /** - * Shows global dialog - * - * @since S60 3.1 - * @param aType Global dialog type - * @param aTextId TextId to display - * @param aSkId Softkeys to display - */ - IMPORT_C void ShowDialogL( - const CFileManagerGlobalDlg::TType aType, - const TInt aTextId, - const TInt aSkId = 0 ); - - /** - * Updates global progress dialog - * - * @since S60 3.1 - * @param aValue Current progress value - * @param aFinalValue Final progress value - */ - IMPORT_C void UpdateProgressDialog( - const TInt aValue, - const TInt aFinalValue = - 1); - - /** - * Finishes global progress dialog - * - * @since S60 3.1 - */ - IMPORT_C void ProcessFinished(); - -private: // From CActive - /** - * @see CActive - */ - void DoCancel(); - - /** - * @see CActive - */ - void RunL(); - -private: // From MFileManagerGlobalDlgObserver - void HandleGlobalDlgResult( - TInt aDlgType, - TInt aDlgResult ); - -private: - /** - * Constructors - */ - CFileManagerGlobalDlg(); - - void ConstructL(); - - /** - * Countdown timer callback - * @param aPtr Pointer to this class instance - */ - static TInt CountdownCB( TAny* aPtr ); - - /** - * Countdown timer callback - */ - void CountdownL(); - - /** - * Starts countdown - * @param aTimeout Timeout value - */ - void StartCountdownL( const TUint aTimeout ); - - /** - * Notifies global dialog observer - * @param aValue Value to notify - */ - void NotifyObserver( const TInt aValue ); - -private: // Data - /** - * Pointer to global query dialog - * Own. - */ - CFileManagerGlobalQueryDlg* iQueryDialog; - - /** - * Pointer to global progress dialog - * Own. - */ - CAknGlobalProgressDialog* iProgressDialog; - - /** - * Pointer to countdown step timer - * Own. - */ - CPeriodic* iCountdown; - - /** - * Steps to countdown - */ - TInt iCountdownSteps; - - /** - * Pointer to global dialog observer - * Not own. - */ - MFileManagerGlobalDlgObserver* iObserver; - - /** - * Global dialog type - */ - TType iType; - - /** - * Global progress dialog final value - */ - TInt iFinalValue; - - /** - * Pointer to countdown text - * Own. - */ - HBufC* iCountdownText; - }; - -#endif // C_FILEMANAGERLOBALDLG_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/CFileManagerGlobalQueryDlg.h --- a/filemanager/View/inc/CFileManagerGlobalQueryDlg.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +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: Global query dialog handling -* -*/ - - - -#ifndef C_FILEMANAGERLOBALQUERYDLG_H -#define C_FILEMANAGERLOBALQUERYDLG_H - - -// INCLUDES -#include - - -// FORWARD DECLARATIONS -class CAknGlobalConfirmationQuery; -class MFileManagerGlobalDlgObserver; - - -// CLASS DECLARATION -/** - * This class handles global query dialog - * - * @lib FileManagerView.lib - * @since S60 3.1 - */ -NONSHARABLE_CLASS(CFileManagerGlobalQueryDlg) : public CActive - { - -public: // New functions - /** - * Two-phased constructor. - */ - static CFileManagerGlobalQueryDlg* NewL(); - - /** - * Destructor - */ - ~CFileManagerGlobalQueryDlg(); - - /** - * Sets global query observer - * - * @since S60 3.1 - * @param aObserver Pointer to observer - */ - void SetObserver( - MFileManagerGlobalDlgObserver* aObserver ); - - /** - * Cancels global query - * - * @since S60 3.1 - */ - void CancelDialog(); - - /** - * Shows global query - * - * @since S60 3.1 - * @param aText Text to display - * @param aSkId Softkeys to display - */ - void ShowDialogL( - const TDesC& aText, - const TInt aSkId = 0 ); - - /** - * Shows global query - * - * @since S60 3.1 - * @param aTextId TextId to display - * @param aSkId Softkeys to display - */ - void ShowDialogL( - const TInt aTextId, - const TInt aSkId = 0 ); - - /** - * Shows global query - * - * @since S60 3.1 - * @param aText Text to display - * @param aSkId Softkeys to display - * @param aBitmapFile Bitmap file to use - * @param aImageId Bitmap id to use - * @param aMaskId Bitmap mask id to use - */ - void ShowDialogL( - const TDesC& aText, - const TInt aSkId, - const TDesC& aBitmapFile, - const TInt aImageId, - const TInt aMaskId ); - -private: // From CActive - /** - * @see CActive - */ - void DoCancel(); - - /** - * @see CActive - */ - void RunL(); - -private: - /** - * Constructors - */ - CFileManagerGlobalQueryDlg(); - - void ConstructL(); - - /** - * Notifies global query observer - * @param aValue Value to notify - */ - void NotifyObserver( const TInt aValue ); - -private: // Data - /** - * Pointer to global query dialog - * Own. - */ - CAknGlobalConfirmationQuery* iQueryDialog; - - /** - * Pointer to global query observer - * Not own. - */ - MFileManagerGlobalDlgObserver* iObserver; - - }; - -#endif // C_FILEMANAGERLOBALQUERYDLG_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/CFileManagerIconArray.h --- a/filemanager/View/inc/CFileManagerIconArray.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: All the files and folders icons are stored here -* -*/ - - - -#ifndef CFILEMANAGERICONARRAY_H -#define CFILEMANAGERICONARRAY_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class CGulIcon; - -// CLASS DECLARATION -/** - * Array of icons. - * Is an array of icons that is read from resource file. - * - * @lib FileManagerView.lib - * @since S60 2.0 - */ -class CFileManagerIconArray : public CArrayPtrFlat< CGulIcon > - { - public: // Constructors and destructor - /** - * Two-phased constructor. - * @return a new icon array. - */ - IMPORT_C static CFileManagerIconArray* NewL(); - - /** - * Destructor. - */ - IMPORT_C ~CFileManagerIconArray(); - - /** - * Updates icons. - */ - IMPORT_C void UpdateIconsL(); - - /** - * Finds array index of the icon - * @param aIconId Icon id - * @return Array index of the icon or KErrNotFound - */ - IMPORT_C TInt FindIcon( TInt aIconId ); - - /** - * Loads icon from icon file - * @param aIconFile Full path of the icon file - * @param aIconId Icon id - * @param aMaskId Mask id - * @param aMajorSkin Major skin id - * @param aMinorSkin Minor skin id - * @param aIsColorIcon True if color icon - * @return Pointer to new icon and the ownership is transferred. - */ - IMPORT_C static CGulIcon* LoadIconL( - const TDesC& aIconFile, - TInt aIconId, - TInt aMaskId, - TInt aMajorSkin, - TInt aMinorSkin, - TBool aIsColorIcon ); - - private: - NONSHARABLE_CLASS(TIconInfo) - { - public: - HBufC* iFile; - TInt iId; - TInt iIconId; - TInt iMaskId; - TInt iMajorSkinId; - TInt iMinorSkinId; - TInt iIconType; - TInt iIndex; - }; - /** - * C++ default constructor. - */ - CFileManagerIconArray(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - void LoadIconL( TIconInfo& aInfo ); - - void LoadMandatoryIconsL(); - - private: // Data - RArray< TIconInfo > iIconInfo; - - }; - -#endif // CFILEMANAGERICONARRAY_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/CFileManagerInfoPopup.h --- a/filemanager/View/inc/CFileManagerInfoPopup.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -/* -* Copyright (c) 2002-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: Popup to show the item information, view info -* -*/ - - -#ifndef CFILEMANAGERINFOPOPUP_H -#define CFILEMANAGERINFOPOPUP_H - -// INCLUDES -#include -#include -#include "CFileManagerPopupBase.h" - -// FORWARD DECLARATIONS -class CFileManagerItemProperties; -class CMSPUtil; -class CFileManagerFeatureManager; -class DRM::CDrmUiHandling; - -// CLASS DECLARATION -/** - * Popup dialog for showing detailed information about item. - * - * @lib FileManagerView.lib - * @since S60 2.0 - */ -NONSHARABLE_CLASS(CFileManagerInfoPopup) : public CFileManagerPopupBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aProperties Properties of the item that will be shown - * @param aFeatureManager Reference to the feature manager - * @return Newly created popup. - */ - static CFileManagerInfoPopup* NewL( - CFileManagerItemProperties& aProperties, - const CFileManagerFeatureManager& aFeatureManager ); - - private: - - /** - * By default Symbian 2nd phase constructor is private. - */ - virtual void ConstructL(); - - private: // From CFileManagerPopupBase - /** - * @see CFileManagerPopupBase - */ - virtual MDesCArray* ConstructDataArrayL(); - -#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - /** - * @see CFileManagerPopupBase - */ - virtual void ActivateLinkL(); -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - - private: // New Functions - /** - * Creates the name entry for data array. - * @return Name entry. - */ - HBufC* NameEntryLC(); - - /** - * Creates the type entry for data array. - * @return Type entry. - */ - HBufC* TypeEntryLC(); - - /** - * Creates the date entry for data array. - * @return Date entry. - */ - HBufC* DateEntryLC(); - - /** - * Creates the time entry for data array. - * @return Time entry. - */ - HBufC* TimeEntryLC(); - - /** - * Creates the size entry for data array. - * @return Size entry. - */ - HBufC* SizeEntryLC(); - - /** - * Creates the default folder entry for data array. - * @return Default folder entry. - */ - HBufC* DefaultFolderEntryLC(); - - - /** - * Creates the string of given resource id and value - * @param resource id of number string - * @param aValue value for string - * @return HBufC* formatted string, caller must delete it - */ - HBufC* ResourceStringValueLC( TInt aResId, TInt aValue ); - - /** - * C++ default constructor. - */ - CFileManagerInfoPopup( - CFileManagerItemProperties& aProperties, - const CFileManagerFeatureManager& aFeatureManager ); - - /** - * Destructor. - */ - ~CFileManagerInfoPopup(); - - private: // Data - /// Ref: Reference to properties data that will be shown in popup. - CFileManagerItemProperties& iProperties; - - // Own: Memory State Popup utilities - CMSPUtil* iUtil; - - // Ref: Reference to the feature manager - const CFileManagerFeatureManager& iFeatureManager; - - // DRM UI Handler - DRM::CDrmUiHandling* iUiHandling; - - }; - -#endif // CFILEMANAGERINFOPOPUP_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/CFileManagerMMCInfoPopup.h --- a/filemanager/View/inc/CFileManagerMMCInfoPopup.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +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: Memory card info popup -* -*/ - - - -#ifndef C_FILEMANAGERMMCINFOPOPUP_H -#define C_FILEMANAGERMMCINFOPOPUP_H - - -// INCLUDES -#include -#include - - -// FORWARD DECLARATIONS -class CAknSingleHeadingPopupMenuStyleListBox; -class CAknPopupList; -class TFileManagerDriveInfo; -class CMSPUtil; - - -// CLASS DECLARATION -/** - * This class displays memory card info - * - * @lib FileManagerView.lib - * @since S60 3.1 - */ -NONSHARABLE_CLASS(CFileManagerMMCInfoPopup) : public CCoeControl - { - -public: // Constructors and destructor - /** - * Two-phased constructor. - * @param aProperties Properties of the item that will be shown - * @return Newly created popup. - */ - static CFileManagerMMCInfoPopup* NewL( - const TFileManagerDriveInfo& aInfo ); - - /** - * Executes the dialog. - * @return ETrue if dialog was dismissed using OK, - * EFalse otherwise. - */ - TBool ExecuteLD(); - -protected: - /** - * Destructor. - */ - ~CFileManagerMMCInfoPopup(); - -private: // New functions - /** - * C++ default constructor. - */ - CFileManagerMMCInfoPopup(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL( const TFileManagerDriveInfo& aInfo ); - - /** - * Constructs data array - * @param aProperties Properties of the item that will be shown - * @return Data array - */ - MDesCArray* ConstructDataArrayL( - const TFileManagerDriveInfo& aInfo ); - - /** - * Creates name entry - * @param aProperties Properties of the item that will be shown - * @return Name entry - */ - HBufC* NameEntryLC( - const TFileManagerDriveInfo& aInfo ); - - /** - * Creates size entry with text and size - * @param aTextId Text to display - * @param aSize Size to display - * @return Size entry - */ - HBufC* SizeEntryLC( TInt aTextId, TInt64 aSize ); - -private: // Data - /** - * Popup list that is the actual dialog that is shown - * Own. - */ - CAknPopupList* iPopupList; - - /** - * Listbox that is given to CAknPopupList constructor - * Own. - */ - CAknSingleHeadingPopupMenuStyleListBox* iListBox; - - /** - * Keeps track if destructor is already called - * Not own. - */ - TBool* iIsDestroyed; - - /** - * Memory State Popup utilities - * Own. - */ - CMSPUtil* iUtil; - - }; - -#endif // C_FILEMANAGERMMCINFOPOPUP_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/CFileManagerPopupBase.h --- a/filemanager/View/inc/CFileManagerPopupBase.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* -* Copyright (c) 2002-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: Base class for file manager popups -* -*/ - - - -#ifndef CFILEMANAGERPOPUPBASE_H -#define CFILEMANAGERPOPUPBASE_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class MDesCArray; -#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM -class CAknMessageQueryDialog; -#else // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM -class CAknDoublePopupMenuStyleListBox; -class CAknPopupList; -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - -// CLASS DECLARATION -/** - * Base class for all popup dialogs in File Manager - * - * @lib FileManagerView.lib - * @since S60 2.0 - */ -NONSHARABLE_CLASS(CFileManagerPopupBase) : public CCoeControl - { - public: // Constructors and destructor - /** - * Executes the dialog. - * @return ETrue if dialog was dismissed using OK, - * EFalse otherwise. - */ - TBool ExecuteLD(); - protected: - /** - * Destructor. - */ - ~CFileManagerPopupBase(); - - protected: // New functions - /** - * Constructs the information that this popup shows. - * @return Array of items that will be shown in popup. - */ - virtual MDesCArray* ConstructDataArrayL() = 0; - - /** - * C++ default constructor. - */ - CFileManagerPopupBase(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - virtual void ConstructL(); - - /** - * Sets the title of popup dialog. - * @param aTitle New title of popup dialog. - */ - void SetTitleL(const TDesC &aTitle); - -#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - /** - * Activates CAknMessageQueryDialog link action. - */ - virtual void ActivateLinkL(); -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - - private: -#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - /** - * Callback to implement CAknMessageQueryDialog link action. - */ - static TInt LinkCallback(TAny* aPtr); -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - - private: // Data -#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - // Own: Dialog title. - HBufC* iTitle; - // Own: Dialog data. - HBufC* iData; -#else // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - // Own: Popup list that is the actual dialog that is shown. - CAknPopupList* iPopupList; - /// Own: Listbox that is given to CAknPopupList constructor. - CAknDoublePopupMenuStyleListBox* iListBox; - /// Ref: Keeps track if destructor is already called. - TBool* iIsDestroyed; -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - }; - -#endif // CFILEMANAGERPOPUPBASE_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/Cfilemanagerfoldernamequerydlg.h --- a/filemanager/View/inc/Cfilemanagerfoldernamequerydlg.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* -* Copyright (c) 2002-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: Dialog for asking folder name from user -* -*/ - - - -#ifndef CFILEMANAGERFOLDERNAMEQUERYDLG_H -#define CFILEMANAGERFOLDERNAMEQUERYDLG_H - -// INCLUDES -#include // CAknTextQueryDialog - -// FORWARD DECLARATIONS -class CFileManagerEngine; - -// CLASS DECLARATION -/** - * Dialog for querying folder names in File Manager - * - * @lib FileManagerView.lib - * @since S60 2.0 - */ -NONSHARABLE_CLASS(CFileManagerFolderNameQueryDlg) : public CAknTextQueryDialog - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aDataText Old folder name, this will be the default - * @param aEngine Reference to File Manager engine. - * @param aNameGeneration ETrue if name generation will be used, - * EFalse otherwise. - * @return Newly created query dialog. - */ - static CFileManagerFolderNameQueryDlg* NewL( - TDes& aDataText, - CFileManagerEngine& aEngine, - TBool aNameGeneration ); - - /** - * Destructor. - */ - ~CFileManagerFolderNameQueryDlg(); - - private: // from CAknTextQueryDialog - /** - * @see CAknTextQueryDialog - */ - TBool OkToExitL( TInt aButtonId ); - - /** - * @see CAknTextQueryDialog - */ - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType ); - - private: - /** - * C++ default constructor. - */ - CFileManagerFolderNameQueryDlg( TDes& aDataText, CFileManagerEngine& aEngine ); - - /** - * Symbian OS 2nd phase constructor. - * @param aNameGeneration ETrue if name generation will be used, - * EFalse otherwise. - */ - void ConstructL( TBool aNameGeneration, TDes& aDataText ); - - /** - * Performs exit checking - * @param aButtonId Button identifier - */ - TBool DoOkToExitL( TInt aButtonId ); - - private: // Data - /// Ref: Reference to File Manager engine. - CFileManagerEngine& iEngine; - /// Own: Old folder name - HBufC* iOldName; - /// For blocking unwanted softkey events - TBool iCallbackDisabled; - }; - -#endif // CFILEMANAGERFOLDERNAMEQUERYDLG_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/Cfilemanagerfoldernavigationpane.h --- a/filemanager/View/inc/Cfilemanagerfoldernavigationpane.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,258 +0,0 @@ -/* -* Copyright (c) 2002-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: Navigation pane for file manager -* -*/ - - - -#ifndef CFILEMANAGERFOLDERNAVIGATIONPANE_H -#define CFILEMANAGERFOLDERNAVIGATIONPANE_H - -// INCLUDES -#include -#include // TAknLayoutRect, TAknLayoutText -#include -#include - -// CONSTANTS -const TInt KFileManagerMaxFolderDepth = 5; // Includes the root - -// FORWARD DECLARATIONS -class CFbsBitmap; -class MFileManagerFolderNaviObserver; - -// CLASS DECLARATION - -/** - * Folder navigation pane for File Manager. - * Custom navigation pane to show folder depth of the - * current folder in navigation pane using folder icons. - * - * @lib FileManagerView.lib - * @since S60 2.0 - */ -class CFileManagerFolderNavigationPane : - public CCoeControl, - public MAknLongTapDetectorCallBack - { - private: - /** - * Folder indicator set. - */ - class TIndicatorSet - { - public: // New functions - /** - * Compares two indicator sets. - * @param aFirst First indicator set to compare. - * @param aSecond The other indicator set to compare. - * @return ETrue if sets are equal, EFalse otherwise. - */ - static TBool Compare( - const TIndicatorSet& aFirst, - const TIndicatorSet& aSecond ); - - public: // Data - /// id - TInt iId; - /// Bitmap file name - TFileName iBmpFile; - /// Icon bitmap id - TInt iIconId; - /// Mask bitmap id - TInt iMaskId; - /// Skin ID - TAknsItemID iAknsItemIdRoot; - - }; - - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aRoot Id of the root indicator - * @param aDepth Depth of the navigation - * @param aReader Resource reader for reading navigation pane from - * resource file. - * @return Newly created navigation pane. - */ - IMPORT_C static CFileManagerFolderNavigationPane* NewL( - const TInt aRoot, - const TInt aDepth, - TResourceReader& aReader ); - - /** - * Destructor. - */ - IMPORT_C ~CFileManagerFolderNavigationPane(); - - - public: // New functions - - /** - * Specifies how many subfolder icons are displayed. - * Depth range is 0..n ( 0 = root, 1 = root+subfolder, etc. ) - * Depth over 4 is displayed just as tree dots at the end of navipane. - * @param aDepth set current depth - */ - IMPORT_C void SetFolderDepth( const TInt aDepth ); - - /** - * Return current folder depth. - * @return aDepth return current depth - */ - IMPORT_C TInt FolderDepth() const; - - /** - * Changes the active root - * @param aRoot Id of the root indicator - */ - IMPORT_C void ChangeRootL( const TInt aRoot ); - - /** - * Handles resource change - * @param aType Change type - */ - IMPORT_C void HandleResourceChangeL( TInt aType ); - - /** - * Sets navigation observer - * @param aObserver Pointer to navigation observer - */ - IMPORT_C void SetObserver( - MFileManagerFolderNaviObserver* aObserver ); - - protected: // Functions From CCoeControl - - /** - * @see CCoeControl - */ - void SizeChanged(); - - /** - * @see CCoeControl - */ - void Draw( const TRect& aRect ) const; - - /** - * @see CCoeControl - */ - void HandlePointerEventL( - const TPointerEvent& aPointerEvent ); - - private: // From MAknLongTapDetectorCallBack - /** - * @see MAknLongTapDetectorCallBack - */ - void HandleLongTapEventL( - const TPoint& aPenEventLocation, - const TPoint& aPenEventScreenLocation ); - - private: - - /** - * C++ default constructor. - * @param aDepth Depth of the navigation - */ - CFileManagerFolderNavigationPane( - const TInt aRoot, const TInt aDepth ); - - /** - * By default Symbian 2nd phase constructor is private. - * @param aRoot Id of the root indicator - * @param aReader Resource reader for reading navigation pane from - * resource file. - */ - void ConstructL( TResourceReader& aReader ); - - private: // New functions - /** - * Notifies CCoeControl to redraw the pane - */ - void ReportChange(); - - /** - * Loads folder bitmaps - */ - void LoadFolderBitmapL(); - - /** - * Checks does position map to drawn navigation level icon - */ - TInt CheckHitFolderLevel( const TPoint& aPos ); - - private: // Data - - // 0 = phone, 1 = MMC - TInt iRoot; - - /// Own: Bitmap for subfolders - CFbsBitmap* iFolderBitmap; - - /// Own: Bitmap mask for subfolders - CFbsBitmap* iFolderMask; - - /// Own: Name of the bitmap file for folder icon and mask - HBufC* iBmpFile; - - /// Id for folder icon bitmap - TInt iFolderIconId; - - /// Id for folder icon mask - TInt iFolderMaskId; - - /// Own: Separator character for folders - HBufC* iSeparator; - - /// Own: The end character append to the indicator after iMaxDepth is reached - HBufC* iEndChar; - - /// Id for folder skin - TAknsItemID iAknsItemIdFolder; - - /// Maximum folder depth displayed in indicator - TInt iMaxDepth; - - /// Own: Bitmap for rootfolder - CFbsBitmap* iRootBitmap; - - /// Own: Bitmap mask for rootfolder - CFbsBitmap* iRootMask; - - /// Rectangles where bitmaps are drawn ( 0 = rootbitmap, 1..max = defaultbitmaps ) - TFixedArray iBitmapLayout; - - /// Rectangles where slashs are drawn ( 0..max = \, max + 1 = ... ) - TFixedArray iTextLayout; - - /// Folder depth - TInt iDepth; - - /// Array to store folder indicators - RArray iIndicatorArray; - - /// Ref: Pointer to navigation observer - MFileManagerFolderNaviObserver* iObserver; - - /// Own: For long tap detecting - CAknLongTapDetector* iLongTapDetector; - - /// For long tap handling - TBool iLongTap; - }; - -#endif // CMGNAVIPANEOLDERINDICATOR_H - -// End of File \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/FileManagerDlgUtils.h --- a/filemanager/View/inc/FileManagerDlgUtils.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,389 +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: Dialog utilities -* -*/ - - - -#ifndef FILEMANAGERVIEWUTILS_H -#define FILEMANAGERVIEWUTILS_H - -// INCLUDES -#include - - -// CONSTANTS -const TInt KIndexNotUsed = -1; - - -// FORWARD DECLARATIONS -class TFileManagerDriveInfo; -class CFileManagerEngine; -class CFileManagerItemProperties; -class CFileManagerFeatureManager; - - -// CLASS DECLARATION -/** - * This class is used for static dialog utilities - * - * @lib FileManagerView.lib - * @since S60 3.1 - */ -class FileManagerDlgUtils - { - -public: - /** - * Shows one of many setting page - * - * @since S60 3.1 - * @param aTitleId Title text id - * @param aTextArray Text array for available settings - * @param aSelectedIndex For storing selected index - * @return ETrue if selection made, otherwise EFalse - */ - IMPORT_C static TBool ShowOOfMSettingQueryL( - const TInt aTitleId, - const MDesCArray* aTextArray, - TInt& aSelectedIndex ); - - /** - * Shows one of many setting page - * - * @since S60 3.1 - * @param aTitleId Title text id - * @param aTextIds Text id array for available settings - * @param aSelectedIndex For storing selected index - * @return ETrue if selection made, otherwise EFalse - */ - IMPORT_C static TBool ShowOOfMSettingQueryL( - const TInt aTitleId, - const TInt aTextIds, - TInt& aSelectedIndex ); - - /** - * Shows weekday selection setting page - * - * @since S60 3.1 - * @param aTitleId Title text id - * @param aDay For storing selected weekday - * @return ETrue if selection made, otherwise EFalse - */ - IMPORT_C static TBool ShowWeekdayQueryL( - const TInt aTitleId, - TDay& aDay ); - - /** - * Shows n of many setting page - * - * @since S60 3.1 - * @param aTitleId Title text id - * @param aTextIds Text id array for available settings - * @param aSelection For storing selected indexes as bitmask - * @param aDominantIndex Dominant index for select all behaviour - * @return ETrue if selection made, otherwise EFalse - */ - IMPORT_C static TBool ShowNOfMSettingQueryL( - const TInt aTitleId, - const TInt aTextIds, - TUint32& aSelection, - const TInt aDominantIndex = KIndexNotUsed ); - - /** - * Shows time setting page - * - * @since S60 3.1 - * @param aTitleId Title text id - * @param aTime Selected time - * @return ETrue if selection made, otherwise EFalse - */ - IMPORT_C static TBool ShowTimeSettingQueryL( - const TInt aTitleId, TTime& aTime ); - - /** - * Shows memory store info popup - * - * @since S60 3.1 - * @param aInfo Memory store info - */ - IMPORT_C static void ShowMemoryStoreInfoPopupL( - const TFileManagerDriveInfo& aInfo ); - - /** - * Shows info query in message query format - * - * @since S60 3.1 - * @param aText Text to display - */ - IMPORT_C static void ShowInfoQueryL( - const TDesC& aText ); - - /** - * Shows info query in message query format - * - * @since S60 3.1 - * @param aTextId TextId to display - * @param aValue Text value to display - */ - IMPORT_C static void ShowInfoQueryL( - const TInt aTextId, - const TDesC& aValue = KNullDesC ); - - /** - * Shows info query in message query format - * - * @since S60 3.1 - * @param aTextId TextId to display - * @param aValue Integer value to display - */ - IMPORT_C static void ShowInfoQueryL( - const TInt aTextId, - const TInt aValue ); - - /** - * Shows error note - * - * @since S60 3.1 - * @param aTextId TextId to display - * @param aValue Text value to display - */ - IMPORT_C static void ShowErrorNoteL( - const TInt aTextId, - const TDesC& aValue = KNullDesC ); - - /** - * Shows confirm note - * - * @since S60 3.1 - * @param aTextId TextId to display - */ - IMPORT_C static void ShowConfirmNoteL( const TInt aTextId ); - - /** - * Shows warning note - * - * @since S60 3.1 - * @param aTextId TextId to display - */ - IMPORT_C static void ShowWarningNoteL( const TInt aTextId ); - - /** - * Shows confirm query with yes no softkey - * - * @since S60 3.1 - * @param aTextId TextId to display - * @param aValue Text value to display - * @return ETrue is Yes selected, otherwise EFalse - */ - IMPORT_C static TBool ShowConfirmQueryWithYesNoL( - const TInt aTextId, - const TDesC& aValue = KNullDesC ); - - /** - * Shows confirm query with yes no softkey - * - * @since S60 3.1 - * @param aText Text to display - * @return ETrue is Yes selected, otherwise EFalse - */ - IMPORT_C static TBool ShowConfirmQueryWithYesNoL( - const TDesC& aText ); - - // Dialog icon types - enum TIcons - { - EInfoIcons = 0, - EErrorIcons - }; - - /** - * Shows confirm query with ok softkey - * - * @since S60 3.1 - * @param aIcons Icons to display - * @param aText Text to display - * @param aValue Text value to display - */ - IMPORT_C static void ShowConfirmQueryWithOkL( - const TIcons aIcons, - const TInt aTextId, - const TDesC& aValue = KNullDesC ); - - /** - * Shows confirm query with ok softkey - * - * @since S60 3.1 - * @param aIcons Icons to display - * @param aText Text to display - * @param aValue Integer value to display - */ - IMPORT_C static void ShowConfirmQueryWithOkL( - const TIcons aIcons, - const TInt aTextId, - const TInt aValue ); - - /** - * Shows confirm query with ok softkey - * - * @since S60 3.1 - * @param aIcons Icons to display - * @param aText Text to display - */ - IMPORT_C static void ShowConfirmQueryWithOkL( - const TIcons aIcons, - const TDesC& aText ); - - /** - * Shows confirm query with ok cancel softkeys - * - * @since S60 3.1 - * @param aTextId TextId to display - * @param aValue Text value to display - * @return ETrue is Cancel selected, otherwise EFalse - */ - IMPORT_C static TBool ShowConfirmQueryWithOkCancelL( - const TInt aTextId, - const TDesC& aValue = KNullDesC ); - - /** - * Shows confirm query with ok cancel softkeys - * - * @since S60 3.1 - * @param aText Text to display - * @return ETrue is Cancel selected, otherwise EFalse - */ - IMPORT_C static TBool ShowConfirmQueryWithOkCancelL( - const TDesC& aText ); - - /** - * Shows info note - * - * @since S60 3.1 - * @param aText Text to display - */ - IMPORT_C static void ShowInfoNoteL( - const TDesC& aText ); - - /** - * Shows info note - * - * @since S60 3.1 - * @param aTextId TextId to display - * @param aValue Text value to display - */ - IMPORT_C static void ShowInfoNoteL( - const TInt aTextId, - const TDesC& aValue = KNullDesC ); - - /** - * Shows info note - * - * @since S60 3.1 - * @param aTextId TextId to display - * @param aValue Integer value to display - */ - IMPORT_C static void ShowInfoNoteL( - const TInt aTextId, - const TInt aValue ); - - /** - * Shows simple password query - * - * @since S60 3.1 - * @param aTitleId Title to display - * @param aPwd For storing given password - * @return ETrue if password is given, otherwise EFalse - */ - IMPORT_C static TBool ShowSimplePasswordQueryL( - const TInt aTitleId, TDes& aPwd ); - - /** - * Shows password query - * - * @since S60 3.1 - * @param aPwd For storing given password - * @return ETrue if password is given correctly, otherwise EFalse - */ - IMPORT_C static TBool ShowPasswordQueryL( TDes& aPwd ); - - /** - * Shows file name query - * - * @since S60 3.2 - * @param aTitleId Title text id - * @param aOldName Old file name - * @param aNewName User given new name - * @param aEngine Reference to the engine - * @return ETrue if name is given, otherwise EFalse - */ - IMPORT_C static TBool ShowFileNameQueryL( - const TInt aTitleId, - const TDesC& aOldName, - TDes& aNewName, - CFileManagerEngine& aEngine ); - - /** - * Shows folder name query - * - * @since S60 3.2 - * @param aTitleId Title text id - * @param aName Old folder name, this will be the default for new - * @param aEngine Reference to the engine - * @param aNameGeneration ETrue if name generation will be used, - * EFalse otherwise - * @return ETrue if name is given, otherwise EFalse - */ - IMPORT_C static TBool ShowFolderNameQueryL( - const TInt aTitleId, - TDes& aName, - CFileManagerEngine& aEngine, - const TBool aNameGeneration = EFalse ); - - /** - * Shows item info popup - * - * @since S60 3.2 - * @param aProperties Item properties - * @param aFeatureManager Reference to the feature manager - */ - IMPORT_C static void ShowItemInfoPopupL( - CFileManagerItemProperties& aProperties, - const CFileManagerFeatureManager& aFeatureManager ); - - /** - * Shows simple password query with drive name - * - * @since S60 3.2 - * @param aText Name to display - * @param aPwd For storing given password - * @return ETrue if password is given, otherwise EFalse - */ - IMPORT_C static TBool ShowSimplePasswordQueryL( - const TDesC& aText, TDes& aPwd ); - - /** - * Shows error note - * - * @since S60 3.2 - * @param aText Text to display - */ - IMPORT_C static void ShowErrorNoteL( const TDesC& aText ); - - }; - -#endif // FILEMANAGERVIEWUTILS_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/FileManagerView.hrh --- a/filemanager/View/inc/FileManagerView.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +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 for project FileManagerView -* -*/ - - -#ifndef FILEMANAGERVIEW_HRH -#define FILEMANAGERVIEW_HRH - - -// The icon types -enum TFileManagerIconType - { - // Standard icon - EFileManagerIconStdIcon = 0, - // Custom color icon - EFileManagerIconColorIcon - }; - -#endif // FILEMANAGERVIEW_HRH diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/FileManagerView.rh --- a/filemanager/View/inc/FileManagerView.rh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2002-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 for project FileManagerEngine -* -*/ - - -#ifndef FILEMANAGERVIEW_RH -#define FILEMANAGERVIEW_RH - -// STRUCTURE DEFINITIONS - -// ----------------------------------------------------------------------------- -// FILEMANAGER_ICON -// ----------------------------------------------------------------------------- -// - -STRUCT FILEMANAGER_ICON - { - BYTE iconId; // unique filemanager icon id - LTEXT mbmFile; // Mbm file name - WORD iconBmpId; // icon bitmap - WORD maskBmpId; // mask bitmap - LONG majorSkinId = EAknsMajorNone; // most significant part of icon skin ID - LONG minorSkinId = EAknsMinorNone; // least significant part of icon skin ID - BYTE iconType = EFileManagerIconStdIcon; // icon type info - } - -// ----------------------------------------------------------------------------- -// MG_FOLDER_INDICATOR -// Array of MG_FOLDER_INDICATOR_DATA. -// ----------------------------------------------------------------------------- -// -STRUCT FILEMANAGER_FOLDER_NAVIGATION_PANE - { - LTEXT bmpfile; - WORD foldericonid = 0; - WORD foldermaskid = 0; - LONG majorSkinId = EAknsMajorNone; // most significant part of icon skin ID - LONG minorSkinId = EAknsMinorNone; // least significant part of icon skin ID - LTEXT separator; - LTEXT endchar; - STRUCT folderindicators []; // FILEMANAGER_FOLDER_NAVIGATION_PANE_DATA - } - -// ----------------------------------------------------------------------------- -// MG_FOLDER_INDICATOR_DATA -// Folder indicator for single drive -// ----------------------------------------------------------------------------- -// -STRUCT FILEMANAGER_FOLDER_NAVIGATION_PANE_DATA - { - WORD id = 0; - LTEXT bmpfile; - WORD rooticonid = 0; - WORD rootmaskid = 0; - LONG majorSkinId = EAknsMajorNone; // most significant part of icon skin ID - LONG minorSkinId = EAknsMinorNone; // least significant part of icon skin ID - } - -#endif // FILEMANAGERVIEW_RH - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/MFileManagerFolderNaviObserver.h --- a/filemanager/View/inc/MFileManagerFolderNaviObserver.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +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: Observer for folder navigation events -* -*/ - - -#ifndef M_FILEMANAGERFOLDERNAVIOBSERVER_H -#define M_FILEMANAGERFOLDERNAVIOBSERVER_H - - -// INCLUDES -#include - - -// CLASS DECLARATION -/** - * This class observes folder navigation notifications - * - * @since S60 3.1 - */ -class MFileManagerFolderNaviObserver - { - -public: - // Navigation event types - enum TNaviEvent - { - ENaviTapDown = 0, - ENaviTapUp, - ENaviLongTap - }; - - /** - * Handles folder navigation notification - * - * @since S60 3.1 - * @param aEvent Navigation event type - * @param aValue Navigation event related value - */ - virtual void HandleFolderNaviEventL( - TNaviEvent aEvent, TInt aValue ) = 0; - - }; - -#endif // M_FILEMANAGERFOLDERNAVIOBSERVER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/inc/MFileManagerGlobalDlgObserver.h --- a/filemanager/View/inc/MFileManagerGlobalDlgObserver.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +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: Global dialog result observer -* -*/ - - -#ifndef M_FILEMANAGERGLOBALDLGOBSERVER_H -#define M_FILEMANAGERGLOBALDLGOBSERVER_H - - -// INCLUDES -#include - - -// CLASS DECLARATION -/** - * This class observes global dialog notifications - * - * @since S60 3.1 - */ -class MFileManagerGlobalDlgObserver - { - -public: - /** - * Handles global dialog result value - * - * @since S60 3.1 - * @param aDialogType Global dialog type - * @param aDialogResult Global dialog result value - */ - virtual void HandleGlobalDlgResult( - TInt aDialogType, - TInt aDialogResult ) = 0; - - }; - -#endif // M_FILEMANAGERGLOBALDLGOBSERVER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/src/CFileManagerCheckBoxSettingPage.cpp --- a/filemanager/View/src/CFileManagerCheckBoxSettingPage.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +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: Checkbox setting page -* -*/ - - - -// INCLUDE FILES -#include -#include "CFileManagerCheckBoxSettingPage.h" - - -// ======== MEMBER FUNCTIONS ======== -// ---------------------------------------------------------------------------- -// CFileManagerCheckBoxSettingPage::CFileManagerCheckBoxSettingPage -// ---------------------------------------------------------------------------- -// -CFileManagerCheckBoxSettingPage::CFileManagerCheckBoxSettingPage( - const TInt aResourceID, - CSelectionItemList& aItemArray, - const TInt aDominantItemIndex ) : - CAknCheckBoxSettingPage( aResourceID, &aItemArray ), - iItemsArray( aItemArray ), - iDominantItemIndex( aDominantItemIndex ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerCheckBoxSettingPage::~CFileManagerCheckBoxSettingPage -// ---------------------------------------------------------------------------- -// -CFileManagerCheckBoxSettingPage::~CFileManagerCheckBoxSettingPage() - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerCheckBoxSettingPage::UpdateSelectionL -// ---------------------------------------------------------------------------- -// -void CFileManagerCheckBoxSettingPage::UpdateSettingL() - { - CAknCheckBoxSettingPage::UpdateSettingL(); - UpdateSelection(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerCheckBoxSettingPage::UpdateSelection -// ---------------------------------------------------------------------------- -// -void CFileManagerCheckBoxSettingPage::UpdateSelection() - { - TInt count( iItemsArray.Count() ); - if ( iDominantItemIndex < 0 || iDominantItemIndex > count ) - { - return; // Dominant item not used - } - - CAknSetStyleListBox* listBox = ListBoxControl(); - CListBoxView* view = listBox->View(); - - TInt selectedItem( listBox->CurrentItemIndex() ); - if ( selectedItem < 0 || selectedItem > count ) - { - return; // Invalid selection - } - - TBool redraw( EFalse ); - - // Deselect all other items if dominant item is selected - if ( iDominantItemIndex == selectedItem && - iItemsArray.At( selectedItem )->SelectionStatus() ) - { - for ( TInt i( 0 ); i < count; ++i ) - { - if ( i != iDominantItemIndex ) - { - iItemsArray.At( i )->SetSelectionStatus( EFalse ); - view->DeselectItem( i ); - } - } - redraw = ETrue; - } - // Deselect dominant item if any other item is selected - else if ( iDominantItemIndex != selectedItem && - iItemsArray.At( iDominantItemIndex )->SelectionStatus() ) - { - for ( TInt i( 0 ); i < count; ++i ) - { - if ( i != iDominantItemIndex && - iItemsArray.At( i )->SelectionStatus() ) - { - iItemsArray.At( iDominantItemIndex )->SetSelectionStatus( - EFalse ); - view->DeselectItem( iDominantItemIndex ); - redraw = ETrue; - break; - } - } - } - - // Hide ok if selection is empty - TBool empty( ETrue ); - for ( TInt i( 0 ); i < count; ++i ) - { - if ( iItemsArray.At( i )->SelectionStatus() ) - { - empty = EFalse; - break; - } - } - CEikButtonGroupContainer* cba = Cba(); - if ( empty ) - { - cba->MakeCommandVisible( EAknSoftkeyOk, EFalse ); - } - else - { - cba->MakeCommandVisible( EAknSoftkeyOk, ETrue ); - } - cba->DrawDeferred(); - - if ( redraw ) - { - listBox->DrawDeferred(); - } - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/src/CFileManagerFileNameQueryDlg.cpp --- a/filemanager/View/src/CFileManagerFileNameQueryDlg.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,251 +0,0 @@ -/* -* Copyright (c) 2002-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: Dialog for asking file name from user -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include "CFileManagerFileNameQueryDlg.h" -#include "CFileManagerCommonDefinitions.h" -#include "CFileManagerItemProperties.h" -#include "FileManagerDlgUtils.h" - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerFileNameQueryDlg::NewL -// -// ----------------------------------------------------------------------------- -// -CFileManagerFileNameQueryDlg* CFileManagerFileNameQueryDlg::NewL( - const TDesC& aOldName, - TDes& aNewName, - CFileManagerEngine& aEngine ) - { - CFileManagerFileNameQueryDlg* self = - new( ELeave ) CFileManagerFileNameQueryDlg( - aNewName, aEngine ); - - CleanupStack::PushL( self ); - self->ConstructL( aOldName ); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileNameQueryDlg::CFileManagerFileNameQueryDlg -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerFileNameQueryDlg::CFileManagerFileNameQueryDlg( - TDes& aNewName, - CFileManagerEngine& aEngine ) : - CAknTextQueryDialog( aNewName ), - iEngine( aEngine ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileNameQueryDlg::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFileNameQueryDlg::ConstructL( const TDesC& aOldName ) - { - TParsePtrC name( aOldName ); - Text().Copy( name.NameAndExt() ); - iOldName = aOldName.AllocL(); - - // Strip any directionality markers to get pure name - TPtr ptr( iOldName->Des() ); - AknTextUtils::StripCharacters( ptr, KFmgrDirectionalChars ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileNameQueryDlg::~CFileManagerFileNameQueryDlg -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerFileNameQueryDlg::~CFileManagerFileNameQueryDlg() - { - delete iOldName; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileNameQueryDlg::DoOkToExitL -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerFileNameQueryDlg::DoOkToExitL( TInt aButtonId ) - { - TBool result( CAknTextQueryDialog::OkToExitL( aButtonId ) ); - - HBufC* userText = Text().AllocLC(); - TPtr ptrUserText( userText->Des() ); - ptrUserText.TrimRight(); - - // Strip any directionality markers to get pure name - AknTextUtils::StripCharacters( ptrUserText, KFmgrDirectionalChars ); - - // Check file name - TBool isValidName( EFalse ); - TParsePtrC oldName( *iOldName ); - if ( oldName.PathPresent() ) - { - isValidName = iEngine.IsValidName( - oldName.DriveAndPath(), *userText, EFalse ); - } - else - { - isValidName = iEngine.IsValidName( KNullDesC, *userText, EFalse ); - } - - if( !isValidName ) - { - if( iEngine.IllegalChars( *userText ) ) - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_FLDR_ILLEGAL_CHARACTERS ); - } - else - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_FLDR_BAD_FILE_NAME ); - } - CAknQueryControl* queryControl = QueryControl(); - if (queryControl) - { - CEikEdwin* edwin = static_cast< CEikEdwin* >( - queryControl->ControlByLayoutOrNull( EDataLayout ) ); - if (edwin) - { - edwin->SetSelectionL( edwin->TextLength(), 0 ); - } - } - CleanupStack::PopAndDestroy( userText ); - return EFalse; - } - - HBufC* userTextFullPath = HBufC::NewLC( KMaxFileName ); - TPtr ptrUserTextFullPath( userTextFullPath->Des() ); - - ptrUserTextFullPath.Append( oldName.DriveAndPath() ); - ptrUserTextFullPath.Append( *userText ); - // if some other entry found with same name - // not ok except if name same as original - if( oldName.NameAndExt().CompareF( *userText ) && - ( iEngine.IsNameFoundL( ptrUserTextFullPath ) || - BaflUtils::FileExists(CCoeEnv::Static()->FsSession(), ptrUserTextFullPath)) ) - { - TBool overWrite( EFalse ); - TUint32 fileType( 0 ); - - TRAPD( err, fileType = iEngine.FileTypeL( ptrUserTextFullPath ) ); - if ( err != KErrNone && err != KErrNotFound && err != KErrAccessDenied ) - { - User::Leave( err ); - } - - if( ( err == KErrNotFound ) || - ( err == KErrAccessDenied ) || - ( fileType & ( CFileManagerItemProperties::EOpen | - CFileManagerItemProperties::EReadOnly | - CFileManagerItemProperties::EFolder ) ) ) - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_FLDR_NAME_ALREADY_USED, Text() ); - } - else - { - overWrite = - FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( - R_QTN_ITEM_OVERWRITE_QUERY, Text() ); - } - - if( !overWrite ) - { - CAknQueryControl* queryControl = QueryControl(); - if (queryControl) - { - CEikEdwin* edwin = static_cast< CEikEdwin* >( - queryControl->ControlByLayoutOrNull( EDataLayout ) ); - if (edwin) - { - edwin->SetSelectionL( edwin->TextLength(), 0 ); - } - } - result = EFalse; - } - } - - TParsePtrC newName( ptrUserText ); - if ( result && oldName.Ext().CompareF( newName.Ext() ) ) - { - FileManagerDlgUtils::ShowWarningNoteL( - R_QTN_FM_WARNING_FILE_EXTENSION ); - } - - CleanupStack::PopAndDestroy( userTextFullPath ); - CleanupStack::PopAndDestroy( userText ); - return result; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileNameQueryDlg::OkToExitL -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerFileNameQueryDlg::OkToExitL( TInt aButtonId ) - { - if ( iCallbackDisabled ) - { - return EFalse; // Block unwanted softkey events - } - TBool ret( EFalse ); - iCallbackDisabled = ETrue; - TRAPD( err, ret = DoOkToExitL( aButtonId ) ); - iCallbackDisabled = EFalse; - User::LeaveIfError( err ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileNameQueryDlg::OfferKeyEventL -// -// ----------------------------------------------------------------------------- -// -TKeyResponse CFileManagerFileNameQueryDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) - { - TKeyResponse response = EKeyWasNotConsumed; - if ( aType == EEventKey && aKeyEvent.iCode == EKeyEnter ) - { - response = EKeyWasConsumed; - } - else - { - response = CAknTextQueryDialog::OfferKeyEventL(aKeyEvent, aType); - } - return response; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/src/CFileManagerFullOmaDrmInfo.cpp --- a/filemanager/View/src/CFileManagerFullOmaDrmInfo.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,997 +0,0 @@ -/* -* Copyright (c) 2005-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: Gets the item DRM information -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include "CFileManagerFullOmaDrmInfo.h" - -// CONSTANTS -_LIT( KSeparator, "\t" ); -#ifndef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM -_LIT( KDateFormat1, "%1" ); -_LIT( KDateFormat2, "%2" ); -_LIT( KDateFormat3, "%3" ); -_LIT( KTimeFormatBefore, " %-B %J:%T" ); -_LIT( KTimeFormatAfter, " %J:%T %+B" ); -_LIT( KEmptyChar, " " ); -const TInt KDateStringLen = 20; - -const TUint KSecondSeparator = 1; -const TUint KThirdSeparator = 2; - - -const TInt KPlayRights = 0; -const TInt KDisplayRights = 1; -const TInt KExecuteRights = 2; -const TInt KPrintRights = 3; -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - - -// ============================ LOCAL FUNCTIONS ================================ - -// ----------------------------------------------------------------------------- -// AppendLabelAndDataToArrayL -// ----------------------------------------------------------------------------- -static void AppendLabelAndDataToArrayL( CDesCArray& aArray, - const TDesC& aLabel, - const TDesC& aData ) - { - HBufC* dataStr = HBufC::NewLC( aLabel.Length() + - KSeparator().Length() + - aData.Length() ); - - TPtr dataPtr( dataStr->Des() ); - dataPtr.Append( aLabel ); - dataPtr.Append( KSeparator ); - dataPtr.Append( aData ); - - AknTextUtils::LanguageSpecificNumberConversion( dataPtr ); - - aArray.AppendL( dataPtr ); - - CleanupStack::PopAndDestroy( dataStr ); - } - -#ifndef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM -// ----------------------------------------------------------------------------- -// ResetAndDestroy -// ----------------------------------------------------------------------------- -static void ResetAndDestroy( TAny* aPtr ) - { - RPointerArray< CDRMHelperRightsConstraints >* array = - static_cast< RPointerArray* >( aPtr ); - array->ResetAndDestroy(); - array->Close(); - } - -// ----------------------------------------------------------------------------- -// IsFutureRights -// ----------------------------------------------------------------------------- -static TBool IsFutureRights( - RPointerArray& aRightsArray ) - { - TBool ret( EFalse ); - const TInt count( aRightsArray.Count() ); - for( TInt i = 0 ; i < count ; ++i ) - { - CDRMRightsConstraints* rights = aRightsArray[i]; - TUint32 expiration( 0 ); - TUint32 constType( 0 ); - TInt topPriorityValue( CDRMRights::EInvalidRights ); - if( rights ) - { - TInt currentPriorityValue( rights->GetConstraintInfo( expiration, constType ) ); - if( currentPriorityValue > topPriorityValue ) - { - // priority is higher than previous rigths - topPriorityValue = currentPriorityValue; - if( CDRMRights::EFutureRights == expiration ) - { - ret = ETrue; - } - else - { - // no future rights - ret = EFalse; - } - } - } - } - return ret; - } - -// ----------------------------------------------------------------------------- -// DateTimeStringLC -// ----------------------------------------------------------------------------- -static HBufC* DateTimeStringLC( const TTime& aTime ) - { - TBuf dateStr; - TBuf timeStr; - TBuf dateStrFormat; - - // Localized date separator form - TLocale local; - dateStrFormat.Append( KDateFormat1 ); - dateStrFormat.Append( local.DateSeparator( KSecondSeparator ) ); - dateStrFormat.Append( KDateFormat2 ); - dateStrFormat.Append( local.DateSeparator( KThirdSeparator ) ); - dateStrFormat.Append( KDateFormat3 ); - aTime.FormatL( dateStr, dateStrFormat ); - - if ( local.AmPmSymbolPosition() == ELocaleBefore ) - { - aTime.FormatL( timeStr, KTimeFormatBefore ); - } - else - { - aTime.FormatL( timeStr, KTimeFormatAfter ); - } - - HBufC* buf = HBufC::NewLC( dateStr.Length() + - KEmptyChar().Length() + - timeStr.Length() ); - TPtr ptrBuffer( buf->Des() ); - ptrBuffer.Append( dateStr ); - ptrBuffer.Append( KEmptyChar ); - ptrBuffer.Append( timeStr ); - - return buf; - } - -// ----------------------------------------------------------------------------- -// DateTimeL -// ----------------------------------------------------------------------------- -static void DateTimeL( CDesCArray& aArray, - const TTime& aTime, - TInt aResourceId, - const TDesC& aType ) - { - HBufC* label = StringLoader::LoadLC( aResourceId, aType ); - HBufC* dateTime = DateTimeStringLC( aTime ); - - AppendLabelAndDataToArrayL( aArray, *label, *dateTime ); - - CleanupStack::PopAndDestroy( dateTime ); - CleanupStack::PopAndDestroy( label ); - } - -// ----------------------------------------------------------------------------- -// FillCounterInfoL -// ----------------------------------------------------------------------------- -static void FillCounterInfoL( CDesCArray& aArray, - CDRMHelperRightsConstraints& aRights, - const TDesC& aType ) - { - TUint32 count( 0 ); - TUint32 timedCount( 0 ); - TUint32 ignore1( 0 ); - TUint32 ignore2( 0 ); - TTimeIntervalSeconds ignore3( 0 ); - TInt err( KErrNone ); - - TRAPD( errCount, aRights.GetCountersL( count, ignore1 ) ); - TRAPD( errTimedCount, aRights.GetTimedCountL( timedCount, ignore2, - ignore3 ) ); - - if ( errCount == KErrNone && errTimedCount == KErrNone ) - { - // Both counts present, use minimum - count = Min( count, timedCount ); - err = KErrNone; - } - else if ( errCount == KErrNone ) - { - // Use count - err = KErrNone; - } - else if ( errTimedCount == KErrNone ) - { - // Use timed count - count = timedCount; - err = KErrNone; - } - else - { - // Neither regular nor timed count constraint - // present, return error - err = KErrNotFound; - } - - if ( err == KErrNone ) - { - // "Times left (%U)" - HBufC* label = - StringLoader::LoadLC( R_QTN_DRM_MGR_DET_UTL_X, aType ); - - HBufC* data = NULL; - - if ( count == 1 ) - { - // "1 count" - data = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_1_COUNT ); - } - else - { - // "%N counts" - data = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_N_COUNTS, count ); - } - - AppendLabelAndDataToArrayL( aArray, *label, *data ); - - CleanupStack::PopAndDestroy( data ); - CleanupStack::PopAndDestroy( label ); - } - } - -// ----------------------------------------------------------------------------- -// SplitTime -// ----------------------------------------------------------------------------- -// -static void SplitTime( const TTimeIntervalSeconds& aInterval, - TInt& aIntYrs, TInt& aIntMon, TInt& aIntDay, - TInt& aIntHrs, TInt& aIntMin, TInt& aIntSec ) - { - const TInt KSecsInMin( 60 ); - const TInt KSecsInHour( KSecsInMin * 60 ); - const TInt KSecsInDay( KSecsInHour * 24 ); - - // includes leap year day - const TInt KLastMonthIndex = 11; - const TInt KMaxDaysInMonths[] = { - 31, 62, 92, 123, 153, 184, - 215, 245, 276, 306, 337, 366 }; - - // calculate full days - TInt temp( aInterval.Int() / KSecsInDay ); - - // calculate full years, calculate without leap year for user to get the - // longest time possible - aIntYrs = temp / ( KMaxDaysInMonths[KLastMonthIndex] - 1 ); - - // calc remainder days - temp = temp % ( KMaxDaysInMonths[KLastMonthIndex] - 1 ); - - aIntMon = 0; - - TInt i( 0 ); - if ( temp >= KMaxDaysInMonths[0] ) - { - for ( i = 0; i < KLastMonthIndex; i++ ) - { - // found correct amount of months - if ( temp >= KMaxDaysInMonths[i] && temp < KMaxDaysInMonths[i+1] ) - { - // i now contains amount of full months (+1 because of table index) - aIntMon = i + 1; - break; - } - } - } - - // calc remainder days = allSecs - secsInFullYears - secsInFullMonts - if( temp >= KMaxDaysInMonths[i] ) - { - aIntDay = temp - KMaxDaysInMonths[i]; - } - else - { - aIntDay = temp; - } - - // calculate remainder secs - temp = aInterval.Int() % KSecsInDay; - - aIntHrs = temp / KSecsInHour; - - // calculate remainder secs - temp = temp % KSecsInHour; - - aIntMin = temp / KSecsInMin; - - // calculate remainder secs - aIntSec = temp % KSecsInMin; - } - -// ----------------------------------------------------------------------------- -// AddSinglePartOfTimeL -// ----------------------------------------------------------------------------- -// -static void AddSinglePartOfTimeL( TInt aNumOfElements, - TInt aResourceIdSingle, - TInt aResourceIdOneFinal, - TInt aResourceIdTwoFour, - TInt aResourceIdFiveZero, - CDesCArrayFlat* aStrings ) - { - const TInt KDigitFive = 5; - const TInt KDigitNine = 9; - const TInt KDigitTen = 10; - const TInt KDigitEleven = 11; - const TInt KDigitFourTeen = 14; - const TInt KDigitHundred = 100; - HBufC* stringHolder = NULL; - TInt finalOneDigit( aNumOfElements % KDigitTen ); - TInt finalTwoDigits( aNumOfElements % KDigitHundred ); - - if ( aNumOfElements == 1 ) - { - stringHolder = StringLoader::LoadLC( aResourceIdSingle ); - } - else if ( finalOneDigit == 1 && finalTwoDigits != KDigitEleven ) - { - stringHolder = StringLoader::LoadLC( aResourceIdOneFinal, - aNumOfElements ); - } - else if ( finalOneDigit == 0 || - ( finalOneDigit >= KDigitFive && finalOneDigit <= KDigitNine ) || - ( finalTwoDigits >= KDigitEleven && finalTwoDigits <= KDigitFourTeen ) ) - { - stringHolder = StringLoader::LoadLC( aResourceIdFiveZero, - aNumOfElements ); - } - else - { - stringHolder = StringLoader::LoadLC( aResourceIdTwoFour, - aNumOfElements ); - } - - if ( aStrings ) - { - aStrings->AppendL( *stringHolder ); - } - - CleanupStack::PopAndDestroy ( stringHolder ); - } - -// ----------------------------------------------------------------------------- -// AddPartsOfTimeLC -// ----------------------------------------------------------------------------- -// -static HBufC* AddPartsOfTimeLC( TInt aIntYrs, TInt aIntMon, TInt aIntDay, - TInt aIntHrs, TInt aIntMin, TInt aIntSec ) - { - // Only the two most meaningful data will be showed - TInt numOfData( 0 ); - const TInt KMaxDataItems = 2; - - CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( KMaxDataItems ); - CleanupStack::PushL( strings ); - - if ( aIntYrs > 0 ) - { - AddSinglePartOfTimeL( aIntYrs, - R_QTN_DRM_NBR_OF_YEARS_ONE, - R_QTN_DRM_NBR_OF_YEARS_ONE_FINAL, - R_QTN_DRM_NBR_OF_YEARS_TWO_FOUR, - R_QTN_DRM_NBR_OF_YEARS_FIVE_ZERO, - strings ); - numOfData++; - } - - if ( aIntMon > 0 ) - { - // Second type not provided because 11 is the maximum - AddSinglePartOfTimeL( aIntMon, - R_QTN_DRM_NBR_OF_MONTHS_ONE, - 0, - R_QTN_DRM_NBR_OF_MONTHS_TWO_FOUR, - R_QTN_DRM_NBR_OF_MONTHS_FIVE_ZERO, - strings ); - numOfData++; - } - - // Only if years or months were missing - if ( aIntDay > 0 && numOfData < KMaxDataItems ) - { - AddSinglePartOfTimeL( aIntDay, - R_QTN_DRM_NBR_OF_DAYS_ONE, - R_QTN_DRM_NBR_OF_DAYS_ONE_FINAL, - R_QTN_DRM_NBR_OF_DAYS_TWO_FOUR, - R_QTN_DRM_NBR_OF_DAYS_FIVE_ZERO, - strings ); - numOfData++; - } - - if ( aIntHrs > 0 && numOfData < KMaxDataItems ) - { - AddSinglePartOfTimeL( aIntHrs, - R_QTN_DRM_NBR_OF_HOURS_ONE, - R_QTN_DRM_NBR_OF_HOURS_ONE_FINAL, - R_QTN_DRM_NBR_OF_HOURS_TWO_FOUR, - R_QTN_DRM_NBR_OF_HOURS_FIVE_ZERO, - strings ); - numOfData++; - } - - if ( aIntMin > 0 && numOfData < KMaxDataItems ) - { - AddSinglePartOfTimeL( aIntMin, - R_QTN_DRM_NBR_OF_MINS_ONE, - R_QTN_DRM_NBR_OF_MINS_ONE_FINAL, - R_QTN_DRM_NBR_OF_MINS_TWO_FOUR, - R_QTN_DRM_NBR_OF_MINS_FIVE_ZERO, - strings ); - numOfData++; - } - - // If interval is 0, then it shows "0 seconds" anyway - if ( ( aIntSec > 0 && numOfData < KMaxDataItems ) || numOfData == 0 ) - { - AddSinglePartOfTimeL( aIntSec, - R_QTN_DRM_NBR_OF_SECS_ONE, - R_QTN_DRM_NBR_OF_SECS_ONE_FINAL, - R_QTN_DRM_NBR_OF_SECS_TWO_FOUR, - R_QTN_DRM_NBR_OF_SECS_FIVE_ZERO, - strings ); - numOfData++; - } - - HBufC* stringHolder = NULL; - if ( numOfData == 1 ) - { - stringHolder = StringLoader::LoadL( R_QTN_DRM_MGR_DET_INTER, - strings->MdcaPoint(0) ); - } - else - { - stringHolder = StringLoader::LoadL( R_QTN_DRM_MGR_DET_INTER_TWO, - *strings ); - } - - CleanupStack::PopAndDestroy( strings ); - - CleanupStack::PushL( stringHolder ); - - return stringHolder; - } - -// ----------------------------------------------------------------------------- -// FillUsageTimeLeftInfoL -// ----------------------------------------------------------------------------- -static void FillUsageTimeLeftInfoL( CDesCArray& aArray, - const TTimeIntervalSeconds& aInterval, - const TDesC& aType, - TBool aIsAccumulatedTime ) - { - TInt years( 0 ); - TInt months( 0 ); - TInt days( 0 ); - TInt hours( 0 ); - TInt minutes( 0 ); - TInt seconds( 0 ); - HBufC* label = NULL; - HBufC* data = NULL; - - if ( aIsAccumulatedTime ) - { - // "Usage time left" - label = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_ACCUM_TIME_LEFT ); - } - else - { - // "Time left (%U)" - label = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_UDL_X, aType ); - } - - SplitTime( aInterval, years, months, days, hours, minutes, seconds ); - data = AddPartsOfTimeLC( years, months, days, hours, minutes, seconds ); - - AppendLabelAndDataToArrayL( aArray, *label, *data ); - - CleanupStack::PopAndDestroy( data ); - CleanupStack::PopAndDestroy( label ); - } - -// ----------------------------------------------------------------------------- -// FillIntervalInfoL -// ----------------------------------------------------------------------------- -static void FillIntervalInfoL( CDesCArray& aArray, - CDRMHelperRightsConstraints& aRights, - const TDesC& aType ) - { - TTimeIntervalSeconds intervalSeconds( 0 ); - - TRAPD( err, aRights.GetIntervalL( intervalSeconds ) ); - - if ( err != KErrNotFound && err != KErrNone ) - { - User::Leave( err ); - } - - if ( err == KErrNone ) - { - TTime intervalStartTime( 0 ); - - TRAP( err, aRights.GetIntervalStartL( intervalStartTime ) ); - - if ( ( err != KErrNotFound ) && ( err != KErrNone ) ) - { - User::Leave( err ); - } - - if ( err == KErrNotFound ) - { - // "Times status (%U)" - HBufC* label = - StringLoader::LoadLC( R_QTN_DRM_MGR_DET_UTS_X, aType ); - - // "Not activated" - HBufC* data = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_NOT_ACT ); - - AppendLabelAndDataToArrayL( aArray, *label, *data ); - - CleanupStack::PopAndDestroy( data ); - CleanupStack::PopAndDestroy( label ); - - // "Time left (%U)" - FillUsageTimeLeftInfoL( aArray, intervalSeconds, aType, EFalse ); - } - else - { - TTime endTime( intervalStartTime ); - endTime += intervalSeconds; - - // "Valid from (%U)" - DateTimeL( aArray, intervalStartTime, - R_QTN_DRM_MGR_DET_RVF_X, aType ); - - // "Valid until (%U)" - DateTimeL( aArray, endTime, R_QTN_DRM_MGR_DET_RVT_X, aType ); - } - } - } - -// ----------------------------------------------------------------------------- -// FillTimeInfoL -// ----------------------------------------------------------------------------- -static void FillTimeInfoL( CDesCArray& aArray, - CDRMHelperRightsConstraints& aRights, - const TDesC& aType ) - { - TTime startTime; - TRAPD( err, aRights.GetStartTimeL( startTime ) ); - if ( err != KErrNotFound && err != KErrNone ) - { - User::Leave( err ); - } - if ( err == KErrNone ) - { - // "Valid from (%U)" - DateTimeL( aArray, startTime, R_QTN_DRM_MGR_DET_RVF_X, aType ); - } - - TTime endTime; - TRAP( err, aRights.GetEndTimeL( endTime ) ); - if ( err != KErrNotFound && err != KErrNone ) - { - User::Leave( err ); - } - if ( err == KErrNone ) - { - // "Valid until (%U)" - DateTimeL( aArray, endTime, R_QTN_DRM_MGR_DET_RVT_X, aType ); - } - } - -// ----------------------------------------------------------------------------- -// FillAccumulatedTimeInfoL -// ----------------------------------------------------------------------------- -static void FillAccumulatedTimeInfoL( CDesCArray& aArray, - CDRMHelperRightsConstraints& aRights, - const TDesC& aType ) - { - TTimeIntervalSeconds accumSeconds( 0 ); - TRAPD( err, aRights.GetAccumulatedTimeL( accumSeconds )); - if ( err != KErrNotFound && err != KErrNone ) - { - User::Leave( err ); - } - if ( err == KErrNone ) - { - // "Usage time left" - FillUsageTimeLeftInfoL( aArray, accumSeconds, aType, ETrue ); - } - } - -// ----------------------------------------------------------------------------- -// FillDrmInfoL -// ----------------------------------------------------------------------------- -static void FillDrmInfoL( CDesCArray& aArray, - CDRMHelperRightsConstraints* aRights, - TInt aResourceId ) - { - // Check if no rights at all - if ( !aRights ) - { - return; - } - - // Rights type is either "Play", "Display", "Execute" or "Print" - HBufC* type = StringLoader::LoadLC( aResourceId ); - - // Check if full rights - if ( aRights->FullRights() ) - { - // "Rights (%U)" - HBufC* label = - StringLoader::LoadLC( R_QTN_DRM_MGR_DET_FULL_X, *type ); - - // "Unlimited" - HBufC* data = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_UNLIMITED ); - - AppendLabelAndDataToArrayL( aArray, *label, *data ); - - CleanupStack::PopAndDestroy( data ); - CleanupStack::PopAndDestroy( label ); - CleanupStack::PopAndDestroy( type ); - return; // full rights -> return - } - - // Get detailed counter constraint information - FillCounterInfoL( aArray, *aRights, *type ); - - // Get detailed interval constraint information (start time + duration) - FillIntervalInfoL( aArray, *aRights, *type ); - - // Get detailed time constraint information (start time + end time) - FillTimeInfoL( aArray, *aRights, *type ); - - // Get detailed accumulated time constraint information (duration) - FillAccumulatedTimeInfoL( aArray, *aRights, *type ); - - CleanupStack::PopAndDestroy( type ); - } - -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerFullOmaDrmInfo -// C++ default constructor. -// ----------------------------------------------------------------------------- -// -CFileManagerFullOmaDrmInfo::CFileManagerFullOmaDrmInfo() - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerFullOmaDrmInfo::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CFileManagerFullOmaDrmInfo* CFileManagerFullOmaDrmInfo::NewL( CDesCArray& aArray, - const TDesC& aFullPath, - CCoeEnv& aCoeEnv ) - { - CFileManagerFullOmaDrmInfo* self = NewLC( aArray, aFullPath, aCoeEnv ); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFullOmaDrmInfo::NewLC -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CFileManagerFullOmaDrmInfo* CFileManagerFullOmaDrmInfo::NewLC( CDesCArray& aArray, - const TDesC& aFullPath, - CCoeEnv& aCoeEnv ) - { - CFileManagerFullOmaDrmInfo* self = new( ELeave ) CFileManagerFullOmaDrmInfo(); - - CleanupStack::PushL( self ); - self->ConstructL( aArray, aFullPath, aCoeEnv ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFullOmaDrmInfo::~CFileManagerFullOmaDrmInfo -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerFullOmaDrmInfo::~CFileManagerFullOmaDrmInfo() - { - } - -#ifndef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - -// ----------------------------------------------------------------------------- -// CImageInfoPopupList::ConstructL -// ----------------------------------------------------------------------------- -// -void CFileManagerFullOmaDrmInfo::ConstructL( CDesCArray& aItemArray, - const TDesC& aFileName, - CCoeEnv& aCoeEnv ) - { - TBool expired ( EFalse ); - TBool sendingAllowed( EFalse ); - RPointerArray tempArr; - TCleanupItem cleanupItem( ResetAndDestroy, &tempArr ); - CleanupStack::PushL( cleanupItem ); - tempArr.AppendL( NULL ); // Play - tempArr.AppendL( NULL ); // Display - tempArr.AppendL( NULL ); // Execute - tempArr.AppendL( NULL ); // Print - - CDRMHelper* drmHelper = CDRMHelper::NewLC( aCoeEnv ); - - TRAPD( err, drmHelper->GetRightsDetailsL( - aFileName, - 0, // Details for everything - expired, - sendingAllowed, - tempArr[KPlayRights], - tempArr[KDisplayRights], - tempArr[KExecuteRights], - tempArr[KPrintRights] ) ); - TBool future( EFalse ); - if( expired || err == CDRMRights::ENoRights ) - { - // Check future rights - RPointerArray fArr; - TCleanupItem cleanupItem( ResetAndDestroy, &fArr ); - CleanupStack::PushL( cleanupItem ); - fArr.AppendL( NULL ); // Play - fArr.AppendL( NULL ); // Display - fArr.AppendL( NULL ); // Execute - fArr.AppendL( NULL ); // Print - - TBool tmp( EFalse ); - TBool tmp2( EFalse ); - TRAP( err, drmHelper->GetRightsDetailsL( aFileName, - 0, - tmp, - tmp2, - fArr[KPlayRights], - fArr[KDisplayRights], - fArr[KExecuteRights], - fArr[KPrintRights] ) ); - - if( err == KErrNone || err == CDRMRights::ENoRights ) - { - future = IsFutureRights( fArr ); - } - CleanupStack::PopAndDestroy( &fArr ); - - ERROR_LOG2( "CFileManagerFullOmaDrmInfo::ConstructL-err:%d,future:%d", - err, future ) - } - CleanupStack::PopAndDestroy( drmHelper ); - - ERROR_LOG3( "CFileManagerFullOmaDrmInfo::ConstructL-err:%d,expired:%d,sendingAllowed:%d", - err, expired, sendingAllowed ) - - // Check if the rights are valid or expired - // Should probably be able to append this information also when the - // rights have expired. - // "Status" - HBufC* label = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_STAT ); - HBufC* data = NULL; - // "Valid" or "Expired" or "Not valid yet" - TInt resId( R_QTN_DRM_MGR_DET_VALID ); - if( future ) - { - resId = R_QTN_DRM_MGR_DET_NOT_VALID_YET; - } - else if ( expired || err == CDRMRights::ENoRights ) - { - resId = R_QTN_DRM_MGR_DET_EXP; - } - data = StringLoader::LoadLC( resId ); - AppendLabelAndDataToArrayL( aItemArray, *label, *data ); - CleanupStack::PopAndDestroy( data ); - CleanupStack::PopAndDestroy( label ); - - // "Play" - FillDrmInfoL( aItemArray, tempArr[KPlayRights], R_QTN_DRM_MGR_DET2_PLAY ); - - // "Display" - FillDrmInfoL( aItemArray, tempArr[KDisplayRights], R_QTN_DRM_MGR_DET2_DISPLAY ); - - // "Execute" - FillDrmInfoL( aItemArray, tempArr[KExecuteRights], R_QTN_DRM_MGR_DET2_EXECUTE ); - - // "Print" - FillDrmInfoL( aItemArray, tempArr[KPrintRights], R_QTN_DRM_MGR_DET2_PRINT ); - - CleanupStack::PopAndDestroy( &tempArr ); - - // Check whether sending is allowed or not - - // "Sending" - label = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_CS ); - data = NULL; - // "Allowed" or "Forbidden" - resId = ( sendingAllowed ? R_QTN_DRM_MGR_DET_ALLOWED - : R_QTN_DRM_MGR_DET_FORBID ); - data = StringLoader::LoadLC( resId ); - AppendLabelAndDataToArrayL( aItemArray, *label, *data ); - CleanupStack::PopAndDestroy( data ); - CleanupStack::PopAndDestroy( label ); - } - -#else // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - -// ----------------------------------------------------------------------------- -// CImageInfoPopupList::ConstructL -// ----------------------------------------------------------------------------- -// -void CFileManagerFullOmaDrmInfo::ConstructL( CDesCArray& aItemArray, - const TDesC& /*aFileName*/, - CCoeEnv& /*aCoeEnv*/ ) - { - /* - TBool expired ( EFalse ); - TBool sendingAllowed( EFalse ); - RPointerArray tempArr; - TCleanupItem cleanupItem( ResetAndDestroy, &tempArr ); - CleanupStack::PushL( cleanupItem ); - tempArr.AppendL( NULL ); // Play - tempArr.AppendL( NULL ); // Display - tempArr.AppendL( NULL ); // Execute - tempArr.AppendL( NULL ); // Print - - CDRMHelper* drmHelper = CDRMHelper::NewLC( aCoeEnv ); - - TRAPD( err, drmHelper->GetRightsDetailsL( - aFileName, - 0, // Details for everything - expired, - sendingAllowed, - tempArr[KPlayRights], - tempArr[KDisplayRights], - tempArr[KExecuteRights], - tempArr[KPrintRights] ) ); - TBool future( EFalse ); - if( expired || err == CDRMRights::ENoRights ) - { - // Check future rights - RPointerArray fArr; - TCleanupItem cleanupItem( ResetAndDestroy, &fArr ); - CleanupStack::PushL( cleanupItem ); - fArr.AppendL( NULL ); // Play - fArr.AppendL( NULL ); // Display - fArr.AppendL( NULL ); // Execute - fArr.AppendL( NULL ); // Print - - TBool tmp( EFalse ); - TBool tmp2( EFalse ); - TRAP( err, drmHelper->GetRightsDetailsL( aFileName, - 0, - tmp, - tmp2, - fArr[KPlayRights], - fArr[KDisplayRights], - fArr[KExecuteRights], - fArr[KPrintRights] ) ); - - if( err == KErrNone || err == CDRMRights::ENoRights ) - { - future = IsFutureRights( fArr ); - } - CleanupStack::PopAndDestroy( &fArr ); - - ERROR_LOG2( "CFileManagerFullOmaDrmInfo::ConstructL-err:%d,future:%d", - err, future ) - } - CleanupStack::PopAndDestroy( drmHelper ); - - ERROR_LOG3( "CFileManagerFullOmaDrmInfo::ConstructL-err:%d,expired:%d,sendingAllowed:%d", - err, expired, sendingAllowed ) - - if ( tempArr[KPlayRights] || - tempArr[KDisplayRights] || - tempArr[KExecuteRights] || - tempArr[KPrintRights] ) - { - */ - // Add link to display rights details - _LIT( KLinkTagStart, "" ); - _LIT( KLinkTagEnd, "" ); - - HBufC* linkTitle = StringLoader::LoadLC( R_QTN_FMGR_DRM_DET_LINK ); - HBufC* linkText = StringLoader::LoadLC( R_QTN_FMGR_DRM_DET_LINK_VIEW ); - HBufC* dataStr = HBufC::NewLC( KLinkTagStart().Length() + - linkText->Length() + - KLinkTagEnd().Length() ); - TPtr dataPtr( dataStr->Des() ); - dataPtr.Append( KLinkTagStart ); - dataPtr.Append( *linkText ); - dataPtr.Append( KLinkTagEnd ); - AppendLabelAndDataToArrayL( aItemArray, *linkTitle, *dataStr ); - CleanupStack::PopAndDestroy( dataStr ); - CleanupStack::PopAndDestroy( linkText ); - CleanupStack::PopAndDestroy( linkTitle ); - /* - } - else - { - // Add forward-lock details - // "Status" - HBufC* label = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_STAT ); - HBufC* data = NULL; - // "Valid" or "Expired" or "Not valid yet" - TInt resId( R_QTN_DRM_MGR_DET_VALID ); - if( future ) - { - resId = R_QTN_DRM_MGR_DET_NOT_VALID_YET; - } - else if ( expired || err == CDRMRights::ENoRights ) - { - resId = R_QTN_DRM_MGR_DET_EXP; - } - data = StringLoader::LoadLC( resId ); - AppendLabelAndDataToArrayL( aItemArray, *label, *data ); - CleanupStack::PopAndDestroy( data ); - CleanupStack::PopAndDestroy( label ); - - // "Sending" - label = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_CS ); - data = NULL; - // "Allowed" or "Forbidden" - resId = ( sendingAllowed ? R_QTN_DRM_MGR_DET_ALLOWED - : R_QTN_DRM_MGR_DET_FORBID ); - data = StringLoader::LoadLC( resId ); - AppendLabelAndDataToArrayL( aItemArray, *label, *data ); - CleanupStack::PopAndDestroy( data ); - CleanupStack::PopAndDestroy( label ); - } - - CleanupStack::PopAndDestroy( &tempArr ); - */ - } - -// ----------------------------------------------------------------------------- -// CImageInfoPopupList::ViewDetailsL -// ----------------------------------------------------------------------------- -// -void CFileManagerFullOmaDrmInfo::ViewDetailsL( - const TDesC& aFileName, - DRM::CDrmUiHandling* aUiHandling ) - { - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL( fs ); - - RFile64 drmFile; - User::LeaveIfError( drmFile.Open( - fs, aFileName, EFileRead | EFileShareReadersOrWriters ) ); - - CleanupClosePushL( drmFile ); - - TRAPD( err, aUiHandling->ShowDetailsViewL( drmFile ) ); - - CleanupStack::PopAndDestroy( &drmFile ); - CleanupStack::PopAndDestroy( &fs ); - - } - -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - -// End of file diff -r 95243422089a -r 491b3ed49290 filemanager/View/src/CFileManagerGlobalDlgFull.cpp --- a/filemanager/View/src/CFileManagerGlobalDlgFull.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,391 +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: Global dialog handling -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include "CFileManagerGlobalDlg.h" -#include "CFileManagerGlobalQueryDlg.h" - - -// CONSTANTS -const TUint KCountdownTimeout = 1000000; // 1s -const TInt KCountdownSteps = 30; -const TInt KCountdownShowSKStep = 3; - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::CFileManagerGlobalDlg -// --------------------------------------------------------------------------- -// -CFileManagerGlobalDlg::CFileManagerGlobalDlg() : - CActive( EPriorityUserInput ) - { - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::NewL -// --------------------------------------------------------------------------- -// -EXPORT_C CFileManagerGlobalDlg* CFileManagerGlobalDlg::NewL() - { - CFileManagerGlobalDlg* self = - new( ELeave ) CFileManagerGlobalDlg(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::ConstructL -// --------------------------------------------------------------------------- -// -void CFileManagerGlobalDlg::ConstructL() - { - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::~CFileManagerGlobalDlg -// --------------------------------------------------------------------------- -// -EXPORT_C CFileManagerGlobalDlg::~CFileManagerGlobalDlg() - { - Cancel(); - delete iQueryDialog; - delete iProgressDialog; - delete iCountdown; - delete iCountdownText; - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::CancelDialog -// --------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerGlobalDlg::CancelDialog() - { - delete iCountdown; - iCountdown = NULL; - - if ( iQueryDialog ) - { - iQueryDialog->CancelDialog(); - delete iQueryDialog; - iQueryDialog = NULL; - } - - if ( iProgressDialog ) - { - iProgressDialog->CancelProgressDialog(); - delete iProgressDialog; - iProgressDialog = NULL; - } - - Cancel(); - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::ShowDialogL -// --------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerGlobalDlg::ShowDialogL( - const CFileManagerGlobalDlg::TType aType, - const TDesC& aText, - const TInt aSkId ) - { - CancelDialog(); - - iType = aType; - - switch ( aType ) - { - case ECountdownQuery: - { - iCountdownText = aText.AllocL(); - iQueryDialog = CFileManagerGlobalQueryDlg::NewL(); - iQueryDialog->ShowDialogL( - *iCountdownText, - R_AVKON_SOFTKEYS_EMPTY ); - iCountdownSteps = 0; - StartCountdownL( KCountdownTimeout ); - break; - } - case EQuery: - { - iQueryDialog = CFileManagerGlobalQueryDlg::NewL(); - iQueryDialog->SetObserver( this ); - iQueryDialog->ShowDialogL( - aText, - aSkId ); - break; - } - case EQueryWithWarningIcon: - { - iQueryDialog = CFileManagerGlobalQueryDlg::NewL(); - iQueryDialog->SetObserver( this ); - iQueryDialog->ShowDialogL( - aText, - aSkId, - KAvkonBitmapFile, - EMbmAvkonQgn_note_warning, - EMbmAvkonQgn_note_warning_mask ); - break; - } - case EQueryWithInfoIcon: - { - iQueryDialog = CFileManagerGlobalQueryDlg::NewL(); - iQueryDialog->SetObserver( this ); - iQueryDialog->ShowDialogL( - aText, - aSkId, - KAvkonBitmapFile, - EMbmAvkonQgn_note_info, - EMbmAvkonQgn_note_info_mask ); - break; - } - case EProgressDialog: - { - iProgressDialog = CAknGlobalProgressDialog::NewL(); - if ( aSkId ) - { - iProgressDialog->ShowProgressDialogL( - iStatus, aText, aSkId ); - } - else - { - iProgressDialog->ShowProgressDialogL( - iStatus, aText ); - } - SetActive(); - iFinalValue = 0; - break; - } - case EErrorNote: - { - CAknGlobalNote* note = CAknGlobalNote::NewLC(); - note->SetTone( EAvkonSIDNoSound ); // no tone - note->ShowNoteL( EAknGlobalErrorNote, aText ); - CleanupStack::PopAndDestroy( note ); - break; - } - case EInfoNote: - { - CAknGlobalNote* note = CAknGlobalNote::NewLC(); - note->SetTone( EAvkonSIDNoSound ); // no tone - note->ShowNoteL( EAknGlobalInformationNote, aText ); - CleanupStack::PopAndDestroy( note ); - break; - } - default: - { - break; - } - } - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::ShowDialogL -// --------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerGlobalDlg::ShowDialogL( - const CFileManagerGlobalDlg::TType aType, - const TInt aTextId, - const TInt aSkId ) - { - HBufC* text = StringLoader::LoadLC( aTextId ); - ShowDialogL( aType, *text, aSkId ); - CleanupStack::PopAndDestroy( text ); - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::DoCancel -// --------------------------------------------------------------------------- -// -void CFileManagerGlobalDlg::DoCancel() - { - if ( iQueryDialog ) - { - iQueryDialog->CancelDialog(); - } - if ( iProgressDialog ) - { - iProgressDialog->CancelProgressDialog(); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::RunL -// --------------------------------------------------------------------------- -// -void CFileManagerGlobalDlg::RunL() - { - CancelDialog(); - NotifyObserver( iStatus.Int() ); - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::SetObserver -// --------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerGlobalDlg::SetObserver( - MFileManagerGlobalDlgObserver* aObserver ) - { - // This instance is not allowed to set by client - if ( aObserver != this ) - { - iObserver = aObserver; - } - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::StartCountdownL -// --------------------------------------------------------------------------- -// -void CFileManagerGlobalDlg::StartCountdownL( const TUint aTimeout ) - { - delete iCountdown; - iCountdown = NULL; - iCountdown = CPeriodic::NewL( CActive::EPriorityStandard ); - iCountdown->Start( aTimeout, aTimeout, TCallBack( CountdownCB, this ) ); - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::CountdownCB -// --------------------------------------------------------------------------- -// -TInt CFileManagerGlobalDlg::CountdownCB( TAny* aPtr ) - { - CFileManagerGlobalDlg* self = - static_cast< CFileManagerGlobalDlg* >( aPtr ); - - TRAP_IGNORE( self->CountdownL() ); - - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::CountdownL -// --------------------------------------------------------------------------- -// -void CFileManagerGlobalDlg::CountdownL() - { - if( iCountdownSteps < KCountdownSteps ) - { - // Countdown in progress - ++iCountdownSteps; - if ( iCountdownSteps == KCountdownShowSKStep ) - { - iProgressDialog = CAknGlobalProgressDialog::NewL(); - iProgressDialog->SetImageL( - KAvkonBitmapFile, - EMbmAvkonQgn_note_query, - EMbmAvkonQgn_note_query_mask ); - iProgressDialog->ShowProgressDialogL( - iStatus, - *iCountdownText, - R_AVKON_SOFTKEYS_YES_NO ); - SetActive(); - - if ( iQueryDialog ) - { - iQueryDialog->CancelDialog(); - delete iQueryDialog; - iQueryDialog = NULL; - } - } - - if ( iProgressDialog && - iCountdownSteps >= KCountdownShowSKStep ) - { - iProgressDialog->UpdateProgressDialog( - iCountdownSteps, KCountdownSteps ); - } - } - else - { - // Countdown expired - CancelDialog(); - NotifyObserver( EAknSoftkeyYes ); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::UpdateProgressDialog -// --------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerGlobalDlg::UpdateProgressDialog( - const TInt aValue, - const TInt aFinalValue ) - { - if ( iProgressDialog ) - { - if ( aFinalValue >= 0 ) - { - iFinalValue = aFinalValue; - } - iProgressDialog->UpdateProgressDialog( aValue, iFinalValue ); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::ProcessFinished -// --------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerGlobalDlg::ProcessFinished() - { - if ( iProgressDialog ) - { - iProgressDialog->ProcessFinished(); - delete iProgressDialog; - iProgressDialog = NULL; - } - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::NotifyObserver -// --------------------------------------------------------------------------- -// -void CFileManagerGlobalDlg::NotifyObserver( const TInt aValue ) - { - if ( iObserver ) - { - iObserver->HandleGlobalDlgResult( iType, aValue ); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerGlobalDlg::HandleGlobalDlgResult -// --------------------------------------------------------------------------- -// -void CFileManagerGlobalDlg::HandleGlobalDlgResult( - TInt /*aDlgType*/, - TInt aDlgResult ) - { - NotifyObserver( aDlgResult ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/src/CFileManagerGlobalQueryDlg.cpp --- a/filemanager/View/src/CFileManagerGlobalQueryDlg.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,188 +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: Global query dialog handling -* -*/ - - - -// INCLUDE FILES -#include -#include -#include "CFileManagerGlobalQueryDlg.h" -#include "CFileManagerGlobalDlg.h" -#include "MFileManagerGlobalDlgObserver.h" - - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// CFileManagerGlobalQueryDlg::CFileManagerGlobalQueryDlg -// ---------------------------------------------------------------------------- -// -CFileManagerGlobalQueryDlg::CFileManagerGlobalQueryDlg() : - CActive( EPriorityUserInput ) - { - } - -// ---------------------------------------------------------------------------- -// CFileManagerGlobalQueryDlg::NewL -// ---------------------------------------------------------------------------- -// -CFileManagerGlobalQueryDlg* CFileManagerGlobalQueryDlg::NewL() - { - CFileManagerGlobalQueryDlg* self = - new( ELeave ) CFileManagerGlobalQueryDlg(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------------------------- -// CFileManagerGlobalQueryDlg::ConstructL -// ---------------------------------------------------------------------------- -// -void CFileManagerGlobalQueryDlg::ConstructL() - { - CActiveScheduler::Add( this ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerGlobalQueryDlg::~CFileManagerGlobalQueryDlg -// ---------------------------------------------------------------------------- -// -CFileManagerGlobalQueryDlg::~CFileManagerGlobalQueryDlg() - { - Cancel(); - delete iQueryDialog; - } - -// ---------------------------------------------------------------------------- -// CFileManagerGlobalQueryDlg::CancelDialog -// ---------------------------------------------------------------------------- -// -void CFileManagerGlobalQueryDlg::CancelDialog() - { - if ( iQueryDialog ) - { - iQueryDialog->CancelConfirmationQuery(); - delete iQueryDialog; - iQueryDialog = NULL; - } - Cancel(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerGlobalQueryDlg::ShowDialogL -// ---------------------------------------------------------------------------- -// -void CFileManagerGlobalQueryDlg::ShowDialogL( - const TDesC& aText, - const TInt aSkId ) - { - CancelDialog(); - - iQueryDialog = CAknGlobalConfirmationQuery::NewL(); - iQueryDialog->ShowConfirmationQueryL( - iStatus, aText, aSkId ); - SetActive(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerGlobalQueryDlg::ShowDialogL -// ---------------------------------------------------------------------------- -// -void CFileManagerGlobalQueryDlg::ShowDialogL( - const TDesC& aText, - const TInt aSkId, - const TDesC& aBitmapFile, - const TInt aImageId, - const TInt aMaskId ) - { - CancelDialog(); - - iQueryDialog = CAknGlobalConfirmationQuery::NewL(); - iQueryDialog->ShowConfirmationQueryL( - iStatus, - aText, - aSkId, - 0, - aBitmapFile, - aImageId, - aMaskId - ); - SetActive(); - } - -// ---------------------------------------------------------------------------- -// CFileManagerGlobalQueryDlg::ShowDialogL -// ---------------------------------------------------------------------------- -// -void CFileManagerGlobalQueryDlg::ShowDialogL( - const TInt aTextId, - const TInt aSkId ) - { - HBufC* text = StringLoader::LoadLC( aTextId ); - ShowDialogL( *text, aSkId ); - CleanupStack::PopAndDestroy( text ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerGlobalQueryDlg::DoCancel -// ---------------------------------------------------------------------------- -// -void CFileManagerGlobalQueryDlg::DoCancel() - { - if ( iQueryDialog ) - { - iQueryDialog->CancelConfirmationQuery(); - } - } - -// ---------------------------------------------------------------------------- -// CFileManagerGlobalQueryDlg::RunL -// ---------------------------------------------------------------------------- -// -void CFileManagerGlobalQueryDlg::RunL() - { - CancelDialog(); - NotifyObserver( iStatus.Int() ); - } - -// ---------------------------------------------------------------------------- -// CFileManagerGlobalQueryDlg::SetObserver -// ---------------------------------------------------------------------------- -// -void CFileManagerGlobalQueryDlg::SetObserver( - MFileManagerGlobalDlgObserver* aObserver ) - { - iObserver = aObserver; - } - -// ---------------------------------------------------------------------------- -// CFileManagerGlobalQueryDlg::NotifyObserver -// ---------------------------------------------------------------------------- -// -void CFileManagerGlobalQueryDlg::NotifyObserver( const TInt aValue ) - { - if ( iObserver ) - { - iObserver->HandleGlobalDlgResult( - CFileManagerGlobalDlg::EQuery, - aValue ); - } - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/src/CFileManagerIconArray.cpp --- a/filemanager/View/src/CFileManagerIconArray.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,273 +0,0 @@ -/* -* Copyright (c) 2002-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: All the files and folders icons are stored here -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include "CFileManagerIconArray.h" -#include "FileManagerView.hrh" - - - -// CONSTANTS -const TInt KGranularity = 1; - -// needed because _LIT macro does not expand parameter, which is also macro -#define _CREATE_LIT( a, b ) _LIT( a, b ) - -_CREATE_LIT( KFileManagerMifFile, filemanager_mbm_file_location ); - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerIconArray::CFileManagerIconArray -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerIconArray::CFileManagerIconArray() : - CArrayPtrFlat( KGranularity ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerIconArray::NewL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerIconArray* CFileManagerIconArray::NewL() - { - CFileManagerIconArray* self = new (ELeave) CFileManagerIconArray(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIconArray::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerIconArray::ConstructL() - { - TResourceReader reader; - CCoeEnv::Static()->CreateResourceReaderLC( - reader, R_FILEMANAGER_ICON_ARRAY ); - - TInt count( reader.ReadInt16() ); - iIconInfo.ReserveL( count ); - SetReserveL( count ); - - // Get File Manager mif drive from exe location - TFileName exeFileName( RProcess().FileName() ); - - // Load icon info now and actual icon data later when needed to decrease - // construction time - for( TInt i( 0 ); i < count; i++ ) - { - TIconInfo info; - - info.iId = reader.ReadInt8(); - info.iFile = reader.ReadHBufCL(); - info.iIconId = reader.ReadInt16(); - - TPtr ptr( info.iFile->Des() ); - if ( !ptr.CompareF( KFileManagerMifFile ) ) - { - // Set correct File Manager mif drive - ptr[ 0 ] = exeFileName[ 0 ]; - } - - info.iMaskId = reader.ReadInt16(); - info.iMajorSkinId = reader.ReadInt32(); - info.iMinorSkinId = reader.ReadInt32(); - info.iIconType = reader.ReadInt8(); - info.iIndex = KErrNotFound; - - CleanupStack::PushL( info.iFile ); - iIconInfo.AppendL( info ); - CleanupStack::Pop( info.iFile ); - } - - CleanupStack::PopAndDestroy(); // reader - - LoadMandatoryIconsL(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerIconArray::~CFileManagerIconArray -// Destructor -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerIconArray::~CFileManagerIconArray() - { - TInt count( iIconInfo.Count() ); - for( TInt i( 0 ); i < count; i++ ) - { - TIconInfo& info = iIconInfo[ i ]; - delete info.iFile; - info.iFile = NULL; - } - iIconInfo.Close(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerIconArray::UpdateIconsL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerIconArray::UpdateIconsL() - { - // Remove icon data and set info to load icon data again when needed - ResetAndDestroy(); - - TInt count( iIconInfo.Count() ); - SetReserveL( count ); - - for( TInt i( 0 ); i < count; i++ ) - { - TIconInfo& info = iIconInfo[ i ]; - info.iIndex = KErrNotFound; - } - - LoadMandatoryIconsL(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerIconArray::FindIcon -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerIconArray::FindIcon( TInt aIconId ) - { - TInt count( iIconInfo.Count() ); - for( TInt i( 0 ); i < count; i++ ) - { - TIconInfo& info = iIconInfo[ i ]; - if ( info.iId == aIconId ) - { - if ( info.iIndex == KErrNotFound ) - { - TRAPD( err, LoadIconL( info ) ); - if ( err != KErrNone ) - { - return err; - } - } - return info.iIndex; - } - } - return KErrNotFound; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIconArray::LoadIconL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerIconArray::LoadIconL( TIconInfo& aInfo ) - { - CGulIcon* icon = LoadIconL( - *aInfo.iFile, - aInfo.iIconId, - aInfo.iMaskId, - aInfo.iMajorSkinId, - aInfo.iMinorSkinId, - aInfo.iIconType == EFileManagerIconColorIcon ); - CleanupStack::PushL( icon ); - TInt index( Count() ); - AppendL( icon ); - CleanupStack::Pop( icon ); - aInfo.iIndex = index; - } - -// ----------------------------------------------------------------------------- -// CFileManagerIconArray::LoadMandatoryIconsL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerIconArray::LoadMandatoryIconsL() - { - // At least these icons must be loaded on startup. - // Other icons can be loaded first time when needed. - - // Make sure that selection icon is always loaded to first index. - // Required by list control. - User::LeaveIfError( FindIcon( EFileManagerMarkIcon ) ); - - } - -// ----------------------------------------------------------------------------- -// CFileManagerIconArray::LoadIconL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C CGulIcon* CFileManagerIconArray::LoadIconL( - const TDesC& aIconFile, - TInt aIconId, - TInt aMaskId, - TInt aMajorSkin, - TInt aMinorSkin, - TBool aIsColorIcon ) - { - TAknsItemID aknsItemId; - aknsItemId.Set( aMajorSkin, aMinorSkin ); - MAknsSkinInstance* aknsSkin = AknsUtils::SkinInstance(); - CGulIcon* ret = NULL; - if ( aIsColorIcon ) - { - TRgb defaultColour( KRgbBlack ); - CFbsBitmap* bmap = NULL; - CFbsBitmap* mask = NULL; - AknsUtils::GetCachedColor( - aknsSkin, - defaultColour, - KAknsIIDQsnIconColors, - EAknsCIQsnIconColorsCG13 ); - AknsUtils::CreateColorIconLC( - aknsSkin, - aknsItemId, - KAknsIIDQsnIconColors, - EAknsCIQsnIconColorsCG13, - bmap, - mask, - aIconFile, - aIconId, - aMaskId, - defaultColour ); - ret = CGulIcon::NewL( bmap, mask ); - ret->SetBitmapsOwnedExternally( EFalse ); - CleanupStack::Pop( 2 ); // icon owns the bitmaps now - } - else - { - ret = AknsUtils::CreateGulIconL( - aknsSkin, aknsItemId, aIconFile, aIconId, aMaskId ); - ret->SetBitmapsOwnedExternally( EFalse ); - } - return ret; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/src/CFileManagerInfoPopup.cpp --- a/filemanager/View/src/CFileManagerInfoPopup.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,443 +0,0 @@ -/* -* Copyright (c) 2002-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: Popup to show the item information, view info -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include "CFileManagerInfoPopup.h" -#include "CFileManagerFullOmaDrmInfo.h" - -// CONSTANTS -_LIT( KDateFormat1, "%1" ); -_LIT( KDateFormat2, "%2" ); -_LIT( KDateFormat3, "%3" ); -_LIT( KTimeFormatBefore, "%-B" ); -_LIT( KTimeFormatAfter, "%+B" ); -_LIT( KTimeFormatHour, "%J" ); -_LIT( KTimeFormatMinutes, "%T" ); -_LIT( KTimeFormatSpace, " "); - -_LIT( KNumberFormat, "%d" ); -_LIT( KSeparator, "\t" ); -const TUint KDefaultItemCount = 3; -const TUint KMaxInfoPopupWidth = 16; // From AVKON LAF document -const TUint KSecondSeparator = 1; -const TUint KThirdSeparator = 2; -const TInt KNumBufLen = 24; -_LIT( KNumBufFormatString, "%d" ); -_LIT( KNumBufSpaceString, " " ); - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerInfoPopup::CFileManagerInfoPopup -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerInfoPopup::CFileManagerInfoPopup( - CFileManagerItemProperties& aProperties, - const CFileManagerFeatureManager& aFeatureManager ) : - iProperties( aProperties ), - iFeatureManager( aFeatureManager ), - iUiHandling( NULL ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerInfoPopup::ConstructDataArrayL -// -// ----------------------------------------------------------------------------- -// -MDesCArray* CFileManagerInfoPopup::ConstructDataArrayL() - { - // Get unit utility instance - CMemStatePopup::GetUtilL( iUtil ); - - CDesCArray* array = new( ELeave ) CDesCArrayFlat( KDefaultItemCount ); - CleanupStack::PushL( array ); - - HBufC* title = NULL; - TUint32 itemType( iProperties.TypeL() ); - if( itemType & CFileManagerItemProperties::EFolder ) - { - title = StringLoader::LoadLC( R_QTN_FMGR_INFO_HEADING_FLDR ); - } - else if( itemType & CFileManagerItemProperties::ELink ) - { - title = StringLoader::LoadLC( R_QTN_FMGR_INFO_HEADING_LINK ); - } - else - { - title = StringLoader::LoadLC( R_QTN_FMGR_INFO_HEADING_FILE ); - } - SetTitleL( *title ); - CleanupStack::PopAndDestroy( title ); - - if ( ( itemType & CFileManagerItemProperties::EDrmProtected ) && - iFeatureManager.IsDrmFullSupported() ) - { - CFileManagerFullOmaDrmInfo* drmInfo = - CFileManagerFullOmaDrmInfo::NewLC( *array, iProperties.FullPath(), *iCoeEnv ); - CleanupStack::PopAndDestroy( drmInfo ); - } - - // Name of the file/folder - HBufC* nameEntry = NameEntryLC(); - array->AppendL( *nameEntry ); - CleanupStack::PopAndDestroy( nameEntry ); - - if( itemType & CFileManagerItemProperties::EFile ) - { - // Type of the file - HBufC* type = TypeEntryLC(); - array->AppendL( *type ); - CleanupStack::PopAndDestroy( type ); - } - - // Modification date - HBufC* date = DateEntryLC(); - array->AppendL( *date ); - CleanupStack::PopAndDestroy( date ); - - // Modification time - HBufC* time = TimeEntryLC(); - array->AppendL( *time ); - CleanupStack::PopAndDestroy( time ); - - // Size of file/folder - HBufC* size = SizeEntryLC(); - array->AppendL( *size ); - CleanupStack::PopAndDestroy( size ); - - TUint32 defaultFolderMask = CFileManagerItemProperties::EFolder | - CFileManagerItemProperties::EDefault; - if( ( itemType & defaultFolderMask ) == defaultFolderMask ) - { - HBufC* str = DefaultFolderEntryLC(); - array->AppendL( *str ); - CleanupStack::PopAndDestroy( str ); - } - - if( itemType & CFileManagerItemProperties::EFolder ) - { - HBufC* folders = ResourceStringValueLC( - R_QTN_FMGR_INFO_CONTAIN_FLDR, - iProperties.FoldersContainedL() ); - array->AppendL( *folders ); - CleanupStack::PopAndDestroy( folders ); - - HBufC* files = ResourceStringValueLC( - R_QTN_FMGR_INFO_CONTAIN_FILE, - iProperties.FilesContainedL() ); - array->AppendL( *files ); - CleanupStack::PopAndDestroy( files ); - } - - CleanupStack::Pop( array ); - return array; - } - -// ----------------------------------------------------------------------------- -// CFileManagerInfoPopup::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CFileManagerInfoPopup* CFileManagerInfoPopup::NewL( - CFileManagerItemProperties& aProperties, - const CFileManagerFeatureManager& aFeatureManager ) - { - CFileManagerInfoPopup* self = new( ELeave ) CFileManagerInfoPopup( - aProperties, aFeatureManager ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerInfoPopup::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CFileManagerInfoPopup::ConstructL() - { - iUiHandling = DRM::CDrmUiHandling::NewL(); - - CFileManagerPopupBase::ConstructL(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerInfoPopup::~CFileManagerInfoPopup -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerInfoPopup::~CFileManagerInfoPopup() - { - delete iUtil; - - delete iUiHandling; - } - -// ----------------------------------------------------------------------------- -// CFileManagerInfoPopup::NameEntryLC -// -// ----------------------------------------------------------------------------- -// -HBufC* CFileManagerInfoPopup::NameEntryLC() - { - HBufC* name = StringLoader::LoadLC( R_QTN_SWINS_LSH2_APPS_NAME ); - HBufC* dataStr = HBufC::NewLC( - name->Length() + 1 + iProperties.LocalizedName().Length() ); - TPtr dataPtr( dataStr->Des() ); - dataPtr.Append( *name ); - dataPtr.Append( KSeparator ); - HBufC* itemNameBuf = NULL; - if ( iProperties.TypeL() & CFileManagerItemProperties::EFolder ) - { - const TPtrC ptr( iProperties.LocalizedName() ); - itemNameBuf = ptr.AllocLC(); - } - else - { - const TPtrC ptr( iProperties.Name() ); - itemNameBuf = ptr.AllocLC(); - } - // Remove all possible tabs in the name so listbox won't get broken - TPtr itemNamePtr = itemNameBuf->Des(); - AknTextUtils::StripCharacters( itemNamePtr, KSeparator ); - dataPtr.Append( itemNamePtr ); - CleanupStack::PopAndDestroy( itemNameBuf ); - CleanupStack::Pop( dataStr ); - CleanupStack::PopAndDestroy( name ); - CleanupStack::PushL( dataStr ); - - return dataStr; - } - -// ----------------------------------------------------------------------------- -// CFileManagerInfoPopup::TypeEntryLC -// -// ----------------------------------------------------------------------------- -// -HBufC* CFileManagerInfoPopup::TypeEntryLC() - { - HBufC* type = StringLoader::LoadLC( R_QTN_SWINS_LSH2_APPS_TYPE ); - HBufC* dataStr = HBufC::NewL( type->Length() + 1 + iProperties.Ext().Length() ); - TPtr dataPtr( dataStr->Des() ); - dataPtr.Append( *type ); - dataPtr.Append( KSeparator ); - const TPtrC ptr( iProperties.Ext() ); - HBufC* extBuf = ptr.AllocLC(); - // Remove all possible tabs in the name so listbox won't get broken - TPtr extPtr = extBuf->Des(); - AknTextUtils::StripCharacters( extPtr, KSeparator ); - dataPtr.Append( extPtr ); - CleanupStack::PopAndDestroy( extBuf ); - CleanupStack::PopAndDestroy( type ); - CleanupStack::PushL( dataStr ); - - return dataStr; - } - -// ----------------------------------------------------------------------------- -// CFileManagerInfoPopup::DateEntryLC -// -// ----------------------------------------------------------------------------- -// -HBufC* CFileManagerInfoPopup::DateEntryLC() - { - HBufC* date = StringLoader::LoadLC( R_QTN_ALBUM_DATIM_DATE ); - TBuf dateStr; - TBuf dateStrFormat; - // Localized date separator form - TLocale local; - TTime localTime; - User::LeaveIfError( iProperties.ModifiedLocalDate( localTime ) ); - dateStrFormat.Append( KDateFormat1 ); - dateStrFormat.Append( local.DateSeparator( KSecondSeparator ) ); - dateStrFormat.Append( KDateFormat2 ); - dateStrFormat.Append( local.DateSeparator( KThirdSeparator ) ); - dateStrFormat.Append( KDateFormat3 ); - localTime.FormatL( dateStr, dateStrFormat ); - HBufC* dataStr = HBufC::NewL( date->Length() + 1 + dateStr.Length() ); - TPtr dataPtr( dataStr->Des() ); - dataPtr.Append( *date ); - dataPtr.Append( KSeparator ); - dataPtr.Append( dateStr ); - - CleanupStack::PopAndDestroy( date ); - CleanupStack::PushL( dataStr ); - - AknTextUtils::LanguageSpecificNumberConversion( dataPtr ); - - return dataStr; - } - -// ----------------------------------------------------------------------------- -// CFileManagerInfoPopup::TimeEntryLC -// -// ----------------------------------------------------------------------------- -// -HBufC* CFileManagerInfoPopup::TimeEntryLC() - { - HBufC* time = StringLoader::LoadLC( R_QTN_ALBUM_DATIM_TIME ); - TBuf timeStr; - TBuf timeStrFormat; - TLocale local; - TTime localTime; - User::LeaveIfError( iProperties.ModifiedLocalDate( localTime ) ); - - if( local.AmPmSymbolPosition() == ELocaleBefore ) - { - timeStrFormat.Append( KTimeFormatBefore ); - timeStrFormat.Append( KTimeFormatSpace ); - timeStrFormat.Append( KTimeFormatHour ); - timeStrFormat.Append( local.TimeSeparator( KSecondSeparator ) ); - timeStrFormat.Append( KTimeFormatMinutes ); - - localTime.FormatL( timeStr, timeStrFormat ); - } - else - { - timeStrFormat.Append( KTimeFormatHour ); - timeStrFormat.Append( local.TimeSeparator( KSecondSeparator ) ); - timeStrFormat.Append( KTimeFormatMinutes ); - timeStrFormat.Append( KTimeFormatSpace ); - timeStrFormat.Append( KTimeFormatAfter ); - - localTime.FormatL( timeStr, timeStrFormat ); - } - - HBufC* dataStr = HBufC::NewL( time->Length() + 1 + timeStr.Length() ); - TPtr dataPtr( dataStr->Des() ); - dataPtr.Append( *time ); - dataPtr.Append( KSeparator ); - dataPtr.Append( timeStr ); - - CleanupStack::PopAndDestroy( time ); - CleanupStack::PushL( dataStr ); - - AknTextUtils::LanguageSpecificNumberConversion( dataPtr ); - - return dataStr; - } - -// ----------------------------------------------------------------------------- -// CFileManagerInfoPopup::SizeEntryLC -// -// ----------------------------------------------------------------------------- -// -HBufC* CFileManagerInfoPopup::SizeEntryLC() - { - TInt64 sizeInBytes( iProperties.SizeL() ); - TPtrC unit( iUtil->SolveUnitAndSize( sizeInBytes ) ); - TBuf< KNumBufLen > numBuf; - numBuf.Format( KNumBufFormatString, I64INT( sizeInBytes ) ); - - HBufC* header = StringLoader::LoadLC( R_QTN_ALBUM_LITXT_SIZE ); - HBufC* dataStr = HBufC::NewL( - header->Length() + 1 + - numBuf.Length() + - KNumBufSpaceString().Length() + - unit.Length() ); - TPtr dataPtr( dataStr->Des() ); - - dataPtr.Append( *header ); - dataPtr.Append( KSeparator ); - dataPtr.Append( numBuf ); - dataPtr.Append( KNumBufSpaceString ); - dataPtr.Append( unit ); - - CleanupStack::PopAndDestroy( header ); - CleanupStack::PushL( dataStr ); - - AknTextUtils::LanguageSpecificNumberConversion( dataPtr ); - return dataStr; - } - -// ----------------------------------------------------------------------------- -// CFileManagerInfoPopup::DefaultFolderEntryLC -// -// ----------------------------------------------------------------------------- -// -HBufC* CFileManagerInfoPopup::DefaultFolderEntryLC() - { - HBufC* header = StringLoader::LoadLC( R_QTN_FMGR_INFO_FLDR_DEFAULT ); - HBufC* data = StringLoader::LoadLC( R_QTN_FMGR_INFO_DEF_FLDR_TEXT ); - HBufC* dataStr = HBufC::NewL( header->Length() + 1 + data->Length() ); - TPtr dataPtr( dataStr->Des() ); - dataPtr.Append( *header ); - dataPtr.Append( KSeparator ); - dataPtr.Append( *data ); - - CleanupStack::PopAndDestroy( data ); - CleanupStack::PopAndDestroy( header ); - CleanupStack::PushL( dataStr ); - - return dataStr; - } - -// ----------------------------------------------------------------------------- -// CFileManagerInfoPopup::ResourceStringValueLC -// -// ----------------------------------------------------------------------------- -// -HBufC* CFileManagerInfoPopup::ResourceStringValueLC( TInt aResId, TInt aValue ) - { - HBufC* string = StringLoader::LoadLC( aResId ); - TBuf infoStr; - infoStr.Format( KNumberFormat, aValue ); - HBufC* dataStr = HBufC::NewL( string->Length() + 1 + infoStr.Length() ); - TPtr dataPtr( dataStr->Des() ); - dataPtr.Append( *string ); - dataPtr.Append( KSeparator ); - dataPtr.Append( infoStr ); - - CleanupStack::PopAndDestroy( string ); - CleanupStack::PushL( dataStr ); - - AknTextUtils::LanguageSpecificNumberConversion( dataPtr ); - - return dataStr; - } - -#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM -// ----------------------------------------------------------------------------- -// CFileManagerInfoPopup::ActivateLinkL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerInfoPopup::ActivateLinkL() - { - CFileManagerFullOmaDrmInfo::ViewDetailsL( - iProperties.FullPath(), - iUiHandling ); - } -#endif //RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/src/CFileManagerMMCInfoPopup.cpp --- a/filemanager/View/src/CFileManagerMMCInfoPopup.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Memory card info popup -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include "CFileManagerMMCInfoPopup.h" -#include "TFileManagerDriveInfo.h" - - -// CONSTANTS -_LIT( KSeparator, "\t" ); -const TUint KDefaultItemCount = 4; - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CFileManagerMMCInfoPopup::CFileManagerMMCInfoPopup -// --------------------------------------------------------------------------- -// -CFileManagerMMCInfoPopup::CFileManagerMMCInfoPopup() - { - } - -// --------------------------------------------------------------------------- -// CFileManagerMMCInfoPopup::ConstructL -// --------------------------------------------------------------------------- -// -void CFileManagerMMCInfoPopup::ConstructL( - const TFileManagerDriveInfo& aInfo ) - { - // Get unit utility instance - CMemStatePopup::GetUtilL( iUtil ); - - iListBox = new ( ELeave ) CAknSingleHeadingPopupMenuStyleListBox; - iPopupList = CAknPopupList::NewL( - iListBox, - R_AVKON_SOFTKEYS_OK_EMPTY, - AknPopupLayouts::EMenuGraphicHeadingWindow ); - - HBufC* title = StringLoader::LoadLC( R_QTN_FMGR_MEMCARD_INFO_HEADING ); - iPopupList->SetTitleL( *title ); - CleanupStack::PopAndDestroy( title ); - - iListBox->ConstructL( iPopupList, EAknListBoxViewerFlags ); - - MDesCArray* array = ConstructDataArrayL( aInfo ); - iListBox->Model()->SetItemTextArray( array ); - - iListBox->CreateScrollBarFrameL( ETrue ); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - iListBox->SetMopParent( this ); - } - -// --------------------------------------------------------------------------- -// CFileManagerMMCInfoPopup::~CFileManagerMMCInfoPopup -// --------------------------------------------------------------------------- -// -CFileManagerMMCInfoPopup::~CFileManagerMMCInfoPopup() - { - if( iIsDestroyed ) - { - *iIsDestroyed = ETrue; - } - delete iListBox; - delete iUtil; - } - -// --------------------------------------------------------------------------- -// CFileManagerMMCInfoPopup::NewL -// --------------------------------------------------------------------------- -// -CFileManagerMMCInfoPopup* CFileManagerMMCInfoPopup::NewL( - const TFileManagerDriveInfo& aInfo ) - { - CFileManagerMMCInfoPopup* self = - new( ELeave ) CFileManagerMMCInfoPopup(); - - CleanupStack::PushL( self ); - self->ConstructL( aInfo ); - CleanupStack::Pop( self ); - - return self; - } - -// --------------------------------------------------------------------------- -// CFileManagerMMCInfoPopup::ExecuteLD -// --------------------------------------------------------------------------- -// -TBool CFileManagerMMCInfoPopup::ExecuteLD() - { - CFileManagerMMCInfoPopup* self = this; - CleanupStack::PushL( self ); - - TBool thisDestroyed( EFalse ); - iIsDestroyed = &thisDestroyed; - - TBool ret( EFalse ); - TRAPD( err, ( ret = iPopupList->ExecuteLD() )); - - // just in case check is this base object still on, - // before using member variable - if( !thisDestroyed ) - { - iPopupList = NULL; - } - - if( thisDestroyed ) - { - CleanupStack::Pop( self ); - } - else - { - CleanupStack::PopAndDestroy( self ); - } - - User::LeaveIfError( err ); - return ret; - } - -// --------------------------------------------------------------------------- -// CFileManagerMMCInfoPopup::ConstructDataArrayL -// --------------------------------------------------------------------------- -// -MDesCArray* CFileManagerMMCInfoPopup::ConstructDataArrayL( - const TFileManagerDriveInfo& aInfo ) - { - CDesCArray* array = new( ELeave ) CDesCArrayFlat( KDefaultItemCount ); - CleanupStack::PushL( array ); - - // Name - HBufC* entry = NameEntryLC( aInfo ); - array->AppendL( *entry ); - CleanupStack::PopAndDestroy( entry ); - - // Capacity - entry = SizeEntryLC( R_QTN_FMGR_CARD_INFO_SIZE, aInfo.iCapacity ); - array->AppendL( *entry ); - CleanupStack::PopAndDestroy( entry ); - - // Used - entry = SizeEntryLC( R_QTN_FMGR_CARD_INFO_USED, - aInfo.iCapacity - aInfo.iSpaceFree ); - array->AppendL( *entry ); - CleanupStack::PopAndDestroy( entry ); - - // Free - entry = SizeEntryLC( R_QTN_FMGR_CARD_INFO_FREE, aInfo.iSpaceFree ); - array->AppendL( *entry ); - CleanupStack::PopAndDestroy( entry ); - - CleanupStack::Pop( array ); - return array; - } - -// --------------------------------------------------------------------------- -// CFileManagerMMCInfoPopup::NameEntryLC -// --------------------------------------------------------------------------- -// -HBufC* CFileManagerMMCInfoPopup::NameEntryLC( - const TFileManagerDriveInfo& aInfo ) - { - HBufC* title = StringLoader::LoadLC( R_QTN_FMGR_CARD_INFO_NAME ); - HBufC* name = NULL; - if ( aInfo.iName.Length() ) - { - name = aInfo.iName.AllocLC(); - } - else - { - name = StringLoader::LoadLC( R_QTN_FMGR_CARD_INFO_DEFAULT_NAME ); - } - HBufC* dataStr = HBufC::NewL( title->Length() + name->Length() + 1 ); - TPtr dataPtr( dataStr->Des() ); - - dataPtr.Append( *title ); - dataPtr.Append( KSeparator ); - dataPtr.Append( *name ); - - CleanupStack::PopAndDestroy( name ); - CleanupStack::PopAndDestroy( title ); - CleanupStack::PushL( dataStr ); - return dataStr; - } - -// --------------------------------------------------------------------------- -// CFileManagerMMCInfoPopup::SizeEntryLC -// --------------------------------------------------------------------------- -// -HBufC* CFileManagerMMCInfoPopup::SizeEntryLC( - TInt aTextId, TInt64 aSize ) - { - TPtrC unit( iUtil->SolveUnitAndSize( aSize ) ); - HBufC* title = StringLoader::LoadLC( aTextId ); - HBufC* sizeAndUnit = StringLoader::LoadLC( - R_QTN_FMGR_CARD_INFO_DATA, unit, I64INT( aSize ) ); - HBufC* dataStr = HBufC::NewL( - title->Length() + sizeAndUnit->Length() + 1 ); - TPtr dataPtr( dataStr->Des() ); - - dataPtr.Append( *title ); - dataPtr.Append( KSeparator ); - dataPtr.Append( *sizeAndUnit ); - - CleanupStack::PopAndDestroy( sizeAndUnit ); - CleanupStack::PopAndDestroy( title ); - CleanupStack::PushL( dataStr ); - return dataStr; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/src/CFileManagerPopupBase.cpp --- a/filemanager/View/src/CFileManagerPopupBase.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,236 +0,0 @@ -/* -* Copyright (c) 2002-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: Base class for file manager popups -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include "CFileManagerPopupBase.h" -#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - #include -#else // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - #include - #include -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - -#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM -_LIT( KFmgrLineFeedWithClosingBoldTag, "\n" ); -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerPopupBase::CFileManagerPopupBase -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerPopupBase::CFileManagerPopupBase() - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerPopupBase::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CFileManagerPopupBase::ConstructL() - { -#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - - const TInt KLineFeedSpace = 2; - const TInt KReservedForBoldTags = 600; - TInt i( 0 ); - TInt len( 0 ); - MDesCArray* array = ConstructDataArrayL(); - - // Reformat array to a single buffer for CAknMessageQueryDialog. - for ( i = 0; i < array->MdcaCount(); i++ ) - { - len += array->MdcaPoint( i ).Length() + KLineFeedSpace; - len += KReservedForBoldTags; //Reserve some space for putting bold tags - } - iData = HBufC::New( len ); - if ( !iData ) - { - delete array; - User::LeaveNoMemory(); - } - TPtr ptr = iData->Des(); - for ( i = 0; i < array->MdcaCount(); i++ ) - { - if ( i > 0 ) - { - ptr.Append( KFmgrLineFeed ); - ptr.Append( KFmgrLineFeed ); - } - ptr.Append( KOpeningBoldTag ); // insert openning bold tag - ptr.Append( array->MdcaPoint( i ) ); - TInt tmpPos = ptr.Find( KFmgrTab ); - ptr.Replace(tmpPos, 1, KFmgrLineFeedWithClosingBoldTag); - } -// AknTextUtils::ReplaceCharacters( ptr, KFmgrTab, KFmgrLineFeed()[0] ); - delete array; - -#else // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - - iListBox = new(ELeave) CAknDoublePopupMenuStyleListBox; - iPopupList = CAknPopupList::NewL( iListBox, - R_AVKON_SOFTKEYS_OK_EMPTY, - AknPopupLayouts::EMenuDoubleWindow ); - iListBox->ConstructL( iPopupList, EAknListBoxViewerFlags ); - - MDesCArray* array = ConstructDataArrayL(); - iListBox->Model()->SetItemTextArray( array ); - - iListBox->CreateScrollBarFrameL( ETrue ); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, - CEikScrollBarFrame::EAuto ); - iListBox->SetMopParent( this ); - -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - } - -// ----------------------------------------------------------------------------- -// CFileManagerPopupBase::~CFileManagerPopupBase -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerPopupBase::~CFileManagerPopupBase() - { -#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - - delete iTitle; - delete iData; - -#else // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - - if( iIsDestroyed ) - { - *iIsDestroyed = ETrue; - } - delete iListBox; - -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - } - -// ----------------------------------------------------------------------------- -// CFileManagerPopupBase::ExecuteLD -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerPopupBase::ExecuteLD() - { -#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - - CleanupStack::PushL( this ); - CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *iData ); - dlg->PrepareLC( R_FILEMANAGER_POPUP_DIALOG ); - dlg->QueryHeading()->SetTextL( *iTitle ); - dlg->SetMopParent( this ); - TCallBack cb( CFileManagerPopupBase::LinkCallback, this ); - dlg->SetLink( cb ); - TBool ret( dlg->RunLD() ); - CleanupStack::PopAndDestroy( this ); - return ret; - -#else // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - - CFileManagerPopupBase* self = this; - CleanupStack::PushL( self ); - - TBool thisDestroyed( EFalse ); - iIsDestroyed = &thisDestroyed; - - TBool ret( EFalse ); - TRAPD( err, ( ret = iPopupList->ExecuteLD() )); - - // just in case check is this base object still on, - // before using member variable - if( !thisDestroyed ) - { - iPopupList = NULL; - } - - if( thisDestroyed ) - { - CleanupStack::Pop( self ); - } - else - { - CleanupStack::PopAndDestroy( self ); - } - - User::LeaveIfError( err ); - - return ret; - -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - } - -// ----------------------------------------------------------------------------- -// CFileManagerPopupBase::SetTitleL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerPopupBase::SetTitleL(const TDesC &aTitle) - { -#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - - if (iTitle) - { - delete iTitle; - iTitle = NULL; - } - iTitle = aTitle.AllocL(); - -#else // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - - iPopupList->SetTitleL( aTitle ); - -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - } - -#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM -// ----------------------------------------------------------------------------- -// CFileManagerPopupBase::ActivateLinkL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerPopupBase::ActivateLinkL() - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerPopupBase::LinkCallback -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerPopupBase::LinkCallback(TAny* aPtr) - { - CFileManagerPopupBase* ptr = static_cast( aPtr ); - TRAPD( err, ptr->ActivateLinkL() ); - ERROR_LOG1( "CFileManagerPopupBase::LinkCallback()-err:%d", err ) - return err; - } -#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/src/Cfilemanagerfoldernamequerydlg.cpp --- a/filemanager/View/src/Cfilemanagerfoldernamequerydlg.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,274 +0,0 @@ -/* -* Copyright (c) 2002-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: Dialog for asking folder name from user -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include "Cfilemanagerfoldernamequerydlg.h" -#include "CFileManagerCommonDefinitions.h" -#include "FileManagerDlgUtils.h" -#include "CFileManagerItemProperties.h" - - -// CONSTANTS -// If number is 10 or more 2 digits are needed to display it -const TInt KTwoDigitNeeded = 10; -_LIT( KFormatStringTwoDigit, "%02d" ); -_LIT( KFormatString, "%d" ); -const TInt KFormatBufLen = 16; - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNameQueryDlg::NewL -// -// ----------------------------------------------------------------------------- -// -CFileManagerFolderNameQueryDlg* CFileManagerFolderNameQueryDlg::NewL( - TDes& aDataText, - CFileManagerEngine& aEngine, - TBool aNameGeneration ) - { - CFileManagerFolderNameQueryDlg* self = - new( ELeave ) CFileManagerFolderNameQueryDlg( aDataText, aEngine ); - - CleanupStack::PushL( self ); - self->ConstructL( aNameGeneration, aDataText ); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNameQueryDlg::CFileManagerFolderNameQueryDlg -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CFileManagerFolderNameQueryDlg::CFileManagerFolderNameQueryDlg( - TDes& aDataText, - CFileManagerEngine& aEngine ) : - CAknTextQueryDialog( aDataText ), - iEngine( aEngine ) - { - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNameQueryDlg::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFolderNameQueryDlg::ConstructL( TBool aNameGeneration, - TDes& aDataText ) - { - if( aNameGeneration ) - { - TInt i( 1 ); - HBufC* folderName = - StringLoader::LoadLC( R_FILEMANAGER_DEFAULT_FOLDER_NAME ); - TBuf< KFormatBufLen > numBuf; - - while( iEngine.IsNameFoundL( *folderName ) ) - { - CleanupStack::PopAndDestroy( folderName ); - numBuf.Zero(); - if( i < KTwoDigitNeeded ) - { - numBuf.Format( KFormatStringTwoDigit, i ); - } - else - { - numBuf.Format( KFormatString, i ); - } - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( - numBuf ); - folderName = StringLoader::LoadLC( - R_FILEMANAGER_DEFAULT_FOLDER_NAME_N, numBuf ); - ++i; - } - Text().Copy( *folderName ); - CleanupStack::PopAndDestroy( folderName ); - } - else - { - iOldName = aDataText.AllocL(); - TParsePtrC parse( - CFileManagerUtils::StripFinalBackslash( *iOldName ) ); - if ( parse.PathPresent() ) - { - Text().Copy( parse.NameAndExt() ); - } - else - { - Text().Copy( *iOldName ); - } - - // Strip any directionality markers to get pure name - TPtr ptr( iOldName->Des() ); - AknTextUtils::StripCharacters( ptr, KFmgrDirectionalChars ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNameQueryDlg::~CFileManagerFolderNameQueryDlg -// Destructor -// ----------------------------------------------------------------------------- -// -CFileManagerFolderNameQueryDlg::~CFileManagerFolderNameQueryDlg() - { - delete iOldName; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNameQueryDlg::DoOkToExitL -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerFolderNameQueryDlg::DoOkToExitL( TInt aButtonId ) - { - TBool result( CAknTextQueryDialog::OkToExitL( aButtonId ) ); - - HBufC* userText = Text().AllocLC(); - TPtr ptrUserText( userText->Des() ); - - // Strip any directionality markers to get pure name - AknTextUtils::StripCharacters( ptrUserText, KFmgrDirectionalChars ); - - // Remove white spaces from end, file server also ignores those - ptrUserText.TrimRight(); - - // Check folder name - TBool isValidName( EFalse ); - TPtrC empty( KNullDesC ); - TParsePtrC oldName( CFileManagerUtils::StripFinalBackslash( - iOldName ? *iOldName : empty ) ); - if ( oldName.PathPresent() ) - { - isValidName = iEngine.IsValidName( - oldName.DriveAndPath(), *userText, ETrue ); - } - else - { - isValidName = iEngine.IsValidName( KNullDesC, *userText, ETrue ); - } - - if( !isValidName ) - { - if( iEngine.IllegalChars( *userText ) ) - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_FLDR_ILLEGAL_CHARACTERS ); - } - else - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_FLDR_BAD_FILE_NAME ); - } - CAknQueryControl* queryControl = QueryControl(); - if ( queryControl ) - { - CEikEdwin* edwin = static_cast< CEikEdwin* >( queryControl-> - ControlByLayoutOrNull( EDataLayout ) ); - if ( edwin ) - { - edwin->SetSelectionL( edwin->TextLength(), 0 ); - } - } - CleanupStack::PopAndDestroy( userText ); - return EFalse; - } - - HBufC* userTextFullPath = HBufC::NewLC( KMaxFileName ); - TPtr ptrUserTextFullPath( userTextFullPath->Des() ); - if ( oldName.PathPresent() ) - { - ptrUserTextFullPath.Append( oldName.DriveAndPath() ); - } - - ptrUserTextFullPath.Append( *userText ); - - // if entry with same name - not ok except if name same as original - if( iEngine.IsNameFoundL( ptrUserTextFullPath ) && - ( !iOldName || ( iOldName && - iOldName->Des().CompareF( ptrUserTextFullPath ) ) ) ) - { - FileManagerDlgUtils::ShowInfoNoteL( - R_QTN_WMLBM_NAME_ALREADY_USED ); - - CAknQueryControl* queryControl = QueryControl(); - if ( queryControl ) - { - CEikEdwin* edwin = static_cast< CEikEdwin* > - ( queryControl->ControlByLayoutOrNull( EDataLayout ) ); - if ( edwin ) - { - edwin->SetSelectionL( edwin->TextLength(), 0 ); - } - } - result = EFalse; - } - CleanupStack::PopAndDestroy( userTextFullPath ); - CleanupStack::PopAndDestroy( userText ); - return result; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFileNameQueryDlg::OkToExitL -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerFolderNameQueryDlg::OkToExitL( TInt aButtonId ) - { - if ( iCallbackDisabled ) - { - return EFalse; // Block unwanted softkey events - } - TBool ret( EFalse ); - iCallbackDisabled = ETrue; - TRAPD( err, ret = DoOkToExitL( aButtonId ) ); - iCallbackDisabled = EFalse; - User::LeaveIfError( err ); - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNameQueryDlg::OfferKeyEventL -// -// ----------------------------------------------------------------------------- -// -TKeyResponse CFileManagerFolderNameQueryDlg::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) - { - TKeyResponse response = EKeyWasNotConsumed; - if ( aType == EEventKey && aKeyEvent.iCode == EKeyEnter ) - { - response = EKeyWasConsumed; - } - else - { - response = CAknTextQueryDialog::OfferKeyEventL(aKeyEvent, aType); - } - return response; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/src/Cfilemanagerfoldernavigationpane.cpp --- a/filemanager/View/src/Cfilemanagerfoldernavigationpane.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,622 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Navigation pane for file manager -* -*/ - - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Cfilemanagerfoldernavigationpane.h" -#include "MFileManagerFolderNaviObserver.h" -#ifdef RD_TACTILE_FEEDBACK -#include -#endif //RD_TACTILE_FEEDBACK - -// CONSTANTS -const TUint KFmgrRoot = 0; -const TUint KFmgrFirstLevel = 1; - -// needed because _LIT macro does not expand parameter, which is also macro -#define _CREATE_LIT( a, b ) _LIT( a, b ) - -_CREATE_LIT( KFileManagerMifFile, filemanager_mbm_file_location ); - - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::TIndicatorSet::Compare -// -// ----------------------------------------------------------------------------- -// -TBool CFileManagerFolderNavigationPane::TIndicatorSet::Compare( - const TIndicatorSet& aFirst, - const TIndicatorSet& aSecond ) - { - return ( aFirst.iId == aSecond.iId ); - } - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::~CFileManagerFolderNavigationPane -// -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerFolderNavigationPane::~CFileManagerFolderNavigationPane() - { - delete iLongTapDetector; - iIndicatorArray.Reset(); - delete iFolderBitmap; - delete iFolderMask; - delete iRootBitmap; - delete iRootMask; - delete iSeparator; - delete iBmpFile; - delete iEndChar; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::CFileManagerFolderNavigationPane -// -// ----------------------------------------------------------------------------- -// -CFileManagerFolderNavigationPane::CFileManagerFolderNavigationPane( - const TInt aRoot, - const TInt aDepth ) : - iRoot( aRoot ), - iMaxDepth( KFileManagerMaxFolderDepth - 1 ), // Exclude the root - iIndicatorArray( 1 ) - { - // ensure that iDepth will be positive - if ( aDepth < 0 ) - { - iDepth = 0; - } - else - { - iDepth = aDepth; - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::ConstructL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFolderNavigationPane::ConstructL( TResourceReader& aReader ) - { - // Get File Manager mif drive from exe location - TFileName exeFileName( RProcess().FileName() ); - - iBmpFile = aReader.ReadHBufCL(); - - TPtr ptr( iBmpFile->Des() ); - if ( !ptr.CompareF( KFileManagerMifFile ) ) - { - // Set correct File Manager mif drive - ptr[ 0 ] = exeFileName[ 0 ]; - } - - iFolderIconId = aReader.ReadInt16(); - iFolderMaskId = aReader.ReadInt16(); - const TInt majorSkinId = static_cast< TInt >( aReader.ReadInt32() ); - const TInt minorSkinId = static_cast< TInt >( aReader.ReadInt32() ); - iSeparator = aReader.ReadHBufCL(); - iEndChar = aReader.ReadHBufCL(); - - iAknsItemIdFolder.Set( majorSkinId, minorSkinId ); - - TInt count( aReader.ReadInt16() ); - - for ( TInt i( 0 ); i < count ; i++ ) - { - TIndicatorSet set; - set.iId = aReader.ReadInt16() ; - - HBufC* tmp = aReader.ReadHBufCL(); - TPtr ptr( tmp->Des() ); - if ( !ptr.CompareF( KFileManagerMifFile ) ) - { - // Set correct File Manager mif drive - ptr[ 0 ] = exeFileName[ 0 ]; - } - set.iBmpFile = *tmp; - delete tmp; - - set.iIconId = aReader.ReadInt16(); - set.iMaskId = aReader.ReadInt16(); - const TInt majorSkinIdRoot = static_cast< TInt >( aReader.ReadInt32() ); - const TInt minorSkinIdRoot = static_cast< TInt >( aReader.ReadInt32() ); - set.iAknsItemIdRoot.Set( majorSkinIdRoot, minorSkinIdRoot ); - - iIndicatorArray.AppendL( set ); - } - - - LoadFolderBitmapL(); - - // Set the default root bitmap - ChangeRootL( iRoot ); - - iLongTapDetector = CAknLongTapDetector::NewL( this ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::NewL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C CFileManagerFolderNavigationPane* - CFileManagerFolderNavigationPane::NewL( const TInt aRoot, - const TInt aDepth, - TResourceReader& aReader ) - { - CFileManagerFolderNavigationPane* self = - new( ELeave ) CFileManagerFolderNavigationPane( aRoot, aDepth ); - CleanupStack::PushL( self ); - self->ConstructL( aReader ); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::SetFolderDepth -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerFolderNavigationPane::SetFolderDepth( const TInt aDepth ) - { - if ( aDepth < 0 ) - { - iDepth = 0; - } - else - { - iDepth = aDepth; - } - - // ReportChange() is used to notify CoeControl to redraw pane. - ReportChange(); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::FolderDepth -// -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CFileManagerFolderNavigationPane::FolderDepth() const - { - return iDepth; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::SizeChanged -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFolderNavigationPane::SizeChanged() - { - - TSize size( TSize::EUninitialized ); - AknLayoutUtils::LayoutMetricsSize( AknLayoutUtils::ENaviPane, size ); - TRect parentRect( size ); - // Get pane icon and text layouts - TAknWindowLineLayout paneIconLayout( - AknLayoutScalable_Avkon::navi_icon_text_pane_g1().LayoutLine() ); - TAknTextLineLayout paneTextLayout( - AknLayoutScalable_Avkon::navi_icon_text_pane_t1().LayoutLine() ); - TAknLayoutRect layoutRect; - TAknLayoutText layoutText; - layoutRect.LayoutRect( parentRect, paneIconLayout ); - layoutText.LayoutText( parentRect, paneTextLayout ); - // Setup pane items - TRect itemsRect( layoutRect.Rect() ); - const CFont* font( layoutText.Font() ); // Not owned - TInt bsWidth( font->MeasureText( *iSeparator ) ); - TInt dotsWidth( font->MeasureText( *iEndChar ) ); - TInt textWidth( KFileManagerMaxFolderDepth * bsWidth + dotsWidth ); - TInt iconWidth( ( itemsRect.Width() - textWidth ) - / KFileManagerMaxFolderDepth ); - TInt i( 0 ); - - if ( AknLayoutUtils::LayoutMirrored() ) - { - TInt offs( itemsRect.Width() ); - for ( i = 0 ; i < KFileManagerMaxFolderDepth; i++ ) - { - // Root and Folder Icons - offs -= iconWidth; - iBitmapLayout[ i ].LayoutRect( - parentRect, - paneIconLayout.iC, - paneIconLayout.il + offs, - paneIconLayout.it, - paneIconLayout.ir, - paneIconLayout.ib, - iconWidth, - paneIconLayout.iH - ); - // Backslashes - offs -= bsWidth; - iTextLayout[ i ].LayoutText( - parentRect, - paneTextLayout.iFont, - paneTextLayout.iC, - paneTextLayout.il + offs, - paneTextLayout.ir, - paneTextLayout.iB, - paneTextLayout.iW, - paneTextLayout.iJ - ); - } - // Dots - offs -= dotsWidth; - iTextLayout[ i ].LayoutText( - parentRect, - paneTextLayout.iFont, - paneTextLayout.iC, - paneTextLayout.il + offs, - paneTextLayout.ir, - paneTextLayout.iB, - paneTextLayout.iW, - paneTextLayout.iJ - ); - } - else - { - TInt offs( 0 ); - for ( i = 0 ; i < KFileManagerMaxFolderDepth; i++ ) - { - // Root and Folder Icons - iBitmapLayout[ i ].LayoutRect( - parentRect, - paneIconLayout.iC, - paneIconLayout.il + offs, - paneIconLayout.it, - paneIconLayout.ir, - paneIconLayout.ib, - iconWidth, - paneIconLayout.iH - ); - offs += iconWidth; - // Backslashes - iTextLayout[ i ].LayoutText( - parentRect, - paneTextLayout.iFont, - paneTextLayout.iC, - paneTextLayout.il + offs, - paneTextLayout.ir, - paneTextLayout.iB, - paneTextLayout.iW, - paneTextLayout.iJ - ); - offs += bsWidth; - } - // Dots - iTextLayout[ i ].LayoutText( - parentRect, - paneTextLayout.iFont, - paneTextLayout.iC, - paneTextLayout.il + offs, - paneTextLayout.ir, - paneTextLayout.iB, - paneTextLayout.iW, - paneTextLayout.iJ - ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::Draw -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFolderNavigationPane::Draw( const TRect& /*aRect*/ ) const - { - - CWindowGc& gc = SystemGc(); - - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - - CFbsBitmap* bmp = NULL; - TRgb color( KRgbWhite ); // Default never used - bmp = AknsUtils::GetCachedBitmap( skin, KAknsIIDQsnComponentColorBmpCG2 ); - AknsUtils::GetCachedColor( skin, color, - KAknsIIDQsnComponentColors, EAknsCIQsnComponentColorsCG2 ); - - AknIconUtils::SetSize( iRootMask, iBitmapLayout[ KFmgrRoot ].Rect().Size() ); - if ( bmp ) - { - iBitmapLayout[ KFmgrRoot ].DrawImage( gc, bmp, iRootMask ); - } - else - { - AknIconUtils::SetSize( iRootBitmap, iBitmapLayout[ KFmgrRoot ].Rect().Size() ); - iBitmapLayout[ KFmgrRoot ].DrawImage( gc, iRootBitmap, iRootMask ); - } - - if ( !bmp ) - { - AknIconUtils::SetSize( iFolderBitmap, iBitmapLayout[ KFmgrFirstLevel ].Rect().Size() ); - bmp = iFolderBitmap; - } - - - // draw folder bitmaps depending on current folderdepth - TInt count( iDepth > iMaxDepth ? iMaxDepth : iDepth ); - AknIconUtils::SetSize( iFolderMask, iBitmapLayout[ KFmgrFirstLevel ].Rect().Size() ); - for( TInt i( KFmgrFirstLevel ); i <= count; i++ ) - { - iBitmapLayout[ i ].DrawImage( gc, bmp, iFolderMask ); - } - - // draw backslashes between folderbitmaps depending on current folderdepth - TInt tc( iDepth > ( iMaxDepth + 1 ) ? ( iMaxDepth + 1 ) : iDepth ); - for( TInt j( 0 ); j < tc; j++ ) - { - const CFont* font = iTextLayout[j].Font(); // Not owned - gc.UseFont( font ); - gc.SetPenColor( color ); - gc.DrawText( *iSeparator, iTextLayout[j].TextRect(), - font->AscentInPixels(), CGraphicsContext::ELeft, 0 ); - } - - // draw "..." at the end if necessary - if ( iDepth > iMaxDepth ) - { - const CFont* font = iTextLayout[iMaxDepth+1].Font(); // Not owned - gc.UseFont( font ); - gc.SetPenColor( color ); - gc.DrawText( *iEndChar, iTextLayout[iMaxDepth+1].TextRect(), - font->AscentInPixels(), CGraphicsContext::ELeft, 0 ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::HandleResourceChangeL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerFolderNavigationPane::HandleResourceChangeL( TInt aType ) - { - // Skin has propably changed so load bitmaps again - if( aType == KAknsMessageSkinChange ) - { - LoadFolderBitmapL(); - - // Delete old to make sure that bitmaps are reloaded - delete iRootBitmap; - iRootBitmap = NULL; - delete iRootMask; - iRootMask = NULL; - - ChangeRootL( iRoot ); - } - } - - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::ReportChange -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFolderNavigationPane::ReportChange() - { - // Leave is trapped because it's not critical to functionality. - // If leave occurs, navipane just may not be redrawn at that very moment. - TRAP_IGNORE( ReportEventL( MCoeControlObserver::EEventStateChanged ) ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::ChangeRootL -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerFolderNavigationPane::ChangeRootL( const TInt aRoot ) - { - // Do not reload icon if correct one is already in use - if ( iRoot == aRoot && iRootBitmap && iRootMask ) - { - return; - } - - TIndicatorSet set; - set.iId = aRoot; - - TInt index( iIndicatorArray.Find( set, TIndicatorSet::Compare ) ); - - if ( index >= 0 ) - { - set = iIndicatorArray[ index ]; - - delete iRootBitmap; - iRootBitmap = NULL; - delete iRootMask; - iRootMask = NULL; - - AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), - set.iAknsItemIdRoot, - KAknsIIDQsnIconColors, - EAknsCIQsnIconColorsCG7, - iRootBitmap, - iRootMask, - set.iBmpFile, - set.iIconId, - set.iMaskId, - KRgbBlack ); - iRoot = aRoot; - ReportChange(); - } - - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::LoadFolderBitmapL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFolderNavigationPane::LoadFolderBitmapL() - { - - delete iFolderBitmap; - iFolderBitmap = NULL; - delete iFolderMask; - iFolderMask = NULL; - - AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(), - iAknsItemIdFolder, - KAknsIIDQsnIconColors, - EAknsCIQsnIconColorsCG7, - iFolderBitmap, - iFolderMask, - *iBmpFile, - iFolderIconId, - iFolderMaskId, - KRgbBlack ); - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::SetObserver -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CFileManagerFolderNavigationPane::SetObserver( - MFileManagerFolderNaviObserver* aObserver ) - { - iObserver = aObserver; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::CheckHitFolderLevel -// -// ----------------------------------------------------------------------------- -// -TInt CFileManagerFolderNavigationPane::CheckHitFolderLevel( - const TPoint& aPos ) - { - TInt ret( KErrNotFound ); - TInt count( iDepth + 1 ); - count = Min( KFileManagerMaxFolderDepth, count ); - for ( TInt i( 0 ); i < count; ++i ) - { - const TRect& bmpRect( iBitmapLayout[ i ].Rect() ); - if ( bmpRect.Contains( aPos ) ) - { - ret = i; - break; - } - } - return ret; - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::HandlePointerEventL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFolderNavigationPane::HandlePointerEventL( - const TPointerEvent& aPointerEvent ) - { - if ( !AknLayoutUtils::PenEnabled() ) - { - return; - } - - TInt level( KErrNotFound ); - - switch ( aPointerEvent.iType ) - { - case TPointerEvent::EButton1Down: - { - level = CheckHitFolderLevel( aPointerEvent.iPosition ); - if ( iObserver ) - { -#ifdef RD_TACTILE_FEEDBACK - if (KErrNotFound != level) - { - MTouchFeedback* feedback = MTouchFeedback::Instance(); - if ( feedback ) - { - feedback->InstantFeedback( this, ETouchFeedbackBasic ); - } - } -#endif //RD_TACTILE_FEEDBACK - - iObserver->HandleFolderNaviEventL( - MFileManagerFolderNaviObserver::ENaviTapDown, - level ); - } - iLongTap = EFalse; - break; - } - case TPointerEvent::EButton1Up: - { - level = CheckHitFolderLevel( aPointerEvent.iPosition ); - if ( !iLongTap ) - { - if ( iObserver ) - { - iObserver->HandleFolderNaviEventL( - MFileManagerFolderNaviObserver::ENaviTapUp, - level ); - } - } - else - { - iLongTap = EFalse; - } - break; - } - default: - { - break; - } - } - - if ( iLongTapDetector && level != KErrNotFound ) - { - iLongTapDetector->PointerEventL( aPointerEvent ); - } - } - -// ----------------------------------------------------------------------------- -// CFileManagerFolderNavigationPane::HandleLongTapEventL -// -// ----------------------------------------------------------------------------- -// -void CFileManagerFolderNavigationPane::HandleLongTapEventL( - const TPoint& aPenEventLocation, - const TPoint& /*aPenEventScreenLocation*/ ) - { - if ( iObserver ) - { - TInt level( CheckHitFolderLevel( aPenEventLocation ) ); - iObserver->HandleFolderNaviEventL( - MFileManagerFolderNaviObserver::ENaviLongTap, - level ); - } - iLongTap = ETrue; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/View/src/FileManagerDlgUtils.cpp --- a/filemanager/View/src/FileManagerDlgUtils.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,669 +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: Dialog utilities -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "FileManagerDlgUtils.h" -#include "CFileManagerMMCInfoPopup.h" -#include "CFileManagerCheckBoxSettingPage.h" -#include "CFileManagerFileNameQueryDlg.h" -#include "Cfilemanagerfoldernamequerydlg.h" -#include "CFileManagerInfoPopup.h" - - -// ======== MEMBER FUNCTIONS ======== - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowOOfMSettingQueryL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool FileManagerDlgUtils::ShowOOfMSettingQueryL( - const TInt aTitleId, - const MDesCArray* aTextArray, - TInt& aSelectedIndex ) - { - TInt index( aSelectedIndex ); - TBool ret( EFalse ); - HBufC* title = StringLoader::LoadLC( aTitleId ); - CAknRadioButtonSettingPage* dlg = - new ( ELeave )CAknRadioButtonSettingPage( - R_FILEMANAGER_SETTING_RADIOBUTTON_PAGE, index, aTextArray ); - CleanupStack::PushL( dlg ); - dlg->SetSettingTextL( *title ); - CleanupStack::Pop( dlg ); - if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) - { - // Get new selected item and inform change - if ( index != aSelectedIndex ) - { - aSelectedIndex = index; - ret = ETrue; - } - } - CleanupStack::PopAndDestroy( title ); - return ret; - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowOOfMSettingQueryL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool FileManagerDlgUtils::ShowOOfMSettingQueryL( - const TInt aTitleId, - const TInt aTextIds, - TInt& aSelectedIndex ) - { - CDesCArray* texts = CCoeEnv::Static()->ReadDesCArrayResourceL( aTextIds ); - CleanupStack::PushL( texts ); - TBool ret( ShowOOfMSettingQueryL( aTitleId, texts, aSelectedIndex ) ); - CleanupStack::PopAndDestroy( texts ); - return ret; - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowWeekdayQueryL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool FileManagerDlgUtils::ShowWeekdayQueryL( - const TInt aTitleId, - TDay& aDay ) - { - const TInt KDaysPerWeek = 7; - TLocale locale; - TDay startingDay( locale.StartOfWeek() ); - CDesCArray* texts = new ( ELeave ) CDesCArrayFlat( KDaysPerWeek ); - CleanupStack::PushL( texts ); - TInt j( startingDay % KDaysPerWeek ); - TDayName dayName; - for ( TInt i( 0 ); i < KDaysPerWeek; i++ ) - { - dayName.Set( static_cast< TDay >( j ) ); - texts->AppendL( dayName ); - j = ( j + 1 ) % KDaysPerWeek; - } - TInt index( 0 ); - if ( aDay >= startingDay ) - { - index = aDay - startingDay; - } - else - { - index = KDaysPerWeek - startingDay + aDay; - } - TBool ret( ShowOOfMSettingQueryL( aTitleId, texts, index ) ); - if ( ret ) - { - aDay = static_cast< TDay >( ( startingDay + index ) % KDaysPerWeek ); - } - CleanupStack::PopAndDestroy( texts ); - return ret; - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowNOfMSettingQueryL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool FileManagerDlgUtils::ShowNOfMSettingQueryL( - const TInt aTitleId, - const TInt aTextIds, - TUint32& aSelection, - const TInt aDominantIndex ) - { - TBool ret( EFalse ); - - // Get title and text array - HBufC* title = StringLoader::LoadLC( aTitleId ); - CDesCArray* texts = CCoeEnv::Static()->ReadDesCArrayResourceL( aTextIds ); - CleanupStack::PushL( texts ); - - // Create selection array - TInt count( texts->MdcaCount() ); - CSelectionItemList* items = - new ( ELeave ) CSelectionItemList( count ); - CleanupStack::PushL( items ); - for ( TInt i( 0 ); i < count; i++ ) - { - TBool check( EFalse ); - if ( aSelection & ( 1 << i ) ) - { - check = ETrue; - } - TPtrC ptr( texts->MdcaPoint( i ) ); - CSelectableItem* selectionItem = new ( ELeave ) CSelectableItem( - ptr, check ); - CleanupStack::PushL( selectionItem ); - selectionItem->ConstructL(); - items->AppendL( selectionItem ); - CleanupStack::Pop( selectionItem ); - } - - // Create multiselection list - CFileManagerCheckBoxSettingPage* dlg = - new ( ELeave ) CFileManagerCheckBoxSettingPage( - R_FILEMANAGER_SETTING_CHECKBOX_PAGE, *items, aDominantIndex ); - CleanupStack::PushL( dlg ); - dlg->SetSettingTextL( *title ); - CleanupStack::Pop( dlg ); - if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) - { - // Get new selection and inform changes - TUint32 selection( 0 ); - for ( TInt i( 0 ); i < count; i++ ) - { - if ( items->At( i )->SelectionStatus() ) - { - selection |= 1 << i; - } - } - if ( selection != aSelection ) - { - aSelection = selection; - ret = ETrue; - } - } - items->ResetAndDestroy(); - CleanupStack::PopAndDestroy( items ); - CleanupStack::PopAndDestroy( texts ); - CleanupStack::PopAndDestroy( title ); - return ret; - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowTimeSettingQueryL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool FileManagerDlgUtils::ShowTimeSettingQueryL( - const TInt aTitleId, TTime& aTime ) - { - TTime time( aTime ); - TBool ret( EFalse ); - HBufC* title = StringLoader::LoadLC( aTitleId ); - CAknTimeSettingPage* dlg = - new (ELeave) CAknTimeSettingPage( - R_FILEMANAGER_TIME_SETTING_PAGE, - time); - CleanupStack::PushL( dlg ); - dlg->SetSettingTextL( *title ); - CleanupStack::Pop( dlg ); - if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) ) - { - // Get new time and inform change - if ( time != aTime ) - { - aTime = time; - ret = ETrue; - } - } - CleanupStack::PopAndDestroy( title ); - return ret; - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowInfoQueryL -// ---------------------------------------------------------------------------- -// -EXPORT_C void FileManagerDlgUtils::ShowInfoQueryL( - const TDesC& aText ) - { - CAknMessageQueryDialog* dlg = - CAknMessageQueryDialog::NewL( const_cast< TDesC& >( aText ) ); - dlg->ExecuteLD( R_FILEMANAGER_INFO_QUERY ); - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowInfoQueryL -// ---------------------------------------------------------------------------- -// -EXPORT_C void FileManagerDlgUtils::ShowInfoQueryL( - const TInt aTextId, const TDesC& aValue ) - { - HBufC* text = NULL; - if ( aValue.Length() ) - { - text = StringLoader::LoadLC( aTextId, aValue ); - } - else - { - text = StringLoader::LoadLC( aTextId ); - } - ShowInfoQueryL( *text ); - CleanupStack::PopAndDestroy( text ); - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowInfoQueryL -// ---------------------------------------------------------------------------- -// -EXPORT_C void FileManagerDlgUtils::ShowInfoQueryL( - const TInt aTextId, const TInt aValue ) - { - HBufC* text = StringLoader::LoadLC( aTextId, aValue ); - ShowInfoQueryL( *text ); - CleanupStack::PopAndDestroy( text ); - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowErrorNoteL -// ---------------------------------------------------------------------------- -// -EXPORT_C void FileManagerDlgUtils::ShowErrorNoteL( - const TInt aTextId, const TDesC& aValue ) - { - HBufC* text = NULL; - if ( aValue.Length() ) - { - text = StringLoader::LoadLC( aTextId, aValue ); - } - else - { - text = StringLoader::LoadLC( aTextId ); - } - ShowErrorNoteL( *text ); - CleanupStack::PopAndDestroy( text ); - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowConfirmNoteL -// ---------------------------------------------------------------------------- -// -EXPORT_C void FileManagerDlgUtils::ShowConfirmNoteL( - const TInt aTextId ) - { - HBufC* text = StringLoader::LoadLC( aTextId ); - CAknConfirmationNote* confirmNote = - new( ELeave ) CAknConfirmationNote( ETrue ); - confirmNote->ExecuteLD( *text ); - CleanupStack::PopAndDestroy( text ); - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowWarningNoteL -// ---------------------------------------------------------------------------- -// -EXPORT_C void FileManagerDlgUtils::ShowWarningNoteL( - const TInt aTextId ) - { - HBufC* text = StringLoader::LoadLC( aTextId ); - CAknWarningNote* warningNote = - new( ELeave ) CAknWarningNote( ETrue ); - warningNote->ExecuteLD( *text ); - CleanupStack::PopAndDestroy( text ); - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowConfirmQueryWithYesNoL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( - const TInt aTextId, const TDesC& aValue ) - { - HBufC* text = NULL; - if ( aValue.Length() ) - { - text = StringLoader::LoadLC( aTextId, aValue ); - } - else - { - text = StringLoader::LoadLC( aTextId ); - } - - TBool ret( ShowConfirmQueryWithYesNoL( *text ) ); - CleanupStack::PopAndDestroy( text ); - return ret; - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowConfirmQueryWithYesNoL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( - const TDesC& aText ) - { - TBool ret( EFalse ); - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - if ( dlg->ExecuteLD( R_FILEMANAGER_CONFIRM_QUERY_WITH_YES_NO, aText ) ) - { - ret = ETrue; - } - return ret; - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowConfirmQueryWithOkL -// ---------------------------------------------------------------------------- -// -EXPORT_C void FileManagerDlgUtils::ShowConfirmQueryWithOkL( - const TIcons aIcons, - const TInt aTextId, - const TDesC& aValue ) - { - HBufC* text = NULL; - if ( aValue.Length() ) - { - text = StringLoader::LoadLC( aTextId, aValue ); - } - else - { - text = StringLoader::LoadLC( aTextId ); - } - ShowConfirmQueryWithOkL( aIcons, *text ); - CleanupStack::PopAndDestroy( text ); - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowConfirmQueryWithOkL -// ---------------------------------------------------------------------------- -// -EXPORT_C void FileManagerDlgUtils::ShowConfirmQueryWithOkL( - const TIcons aIcons, - const TInt aTextId, - const TInt aValue ) - { - HBufC* text = StringLoader::LoadLC( aTextId, aValue ); - ShowConfirmQueryWithOkL( aIcons, *text ); - CleanupStack::PopAndDestroy( text ); - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowConfirmQueryWithOkL -// ---------------------------------------------------------------------------- -// -EXPORT_C void FileManagerDlgUtils::ShowConfirmQueryWithOkL( - const TIcons aIcons, - const TDesC& aText ) - { - TInt resId( 0 ); - switch ( aIcons ) - { - case EInfoIcons: - { - resId = R_FILEMANAGER_INFO_CONFIRM_QUERY_WITH_OK; - break; - } - case EErrorIcons: - { - resId = R_FILEMANAGER_ERROR_CONFIRM_QUERY_WITH_OK; - break; - } - default: - { - break; - } - } - if ( resId ) - { - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - dlg->ExecuteLD( resId, aText ); - } - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowConfirmQueryWithOkCancelL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool FileManagerDlgUtils::ShowConfirmQueryWithOkCancelL( - const TDesC& aText ) - { - TBool ret( EFalse ); - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - if ( dlg->ExecuteLD( - R_FILEMANAGER_CONFIRM_QUERY_WITH_OK_CANCEL, aText ) ) - { - ret = ETrue; - } - return ret; - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowConfirmQueryWithOkCancelL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool FileManagerDlgUtils::ShowConfirmQueryWithOkCancelL( - const TInt aTextId, - const TDesC& aValue ) - { - HBufC* text = NULL; - if ( aValue.Length() ) - { - text = StringLoader::LoadLC( aTextId, aValue ); - } - else - { - text = StringLoader::LoadLC( aTextId ); - } - TBool ret( ShowConfirmQueryWithOkCancelL( *text ) ); - CleanupStack::PopAndDestroy( text ); - return ret; - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowInfoNoteL -// ---------------------------------------------------------------------------- -// -EXPORT_C void FileManagerDlgUtils::ShowInfoNoteL( - const TDesC& aText ) - { - CAknInformationNote* dlg = new(ELeave) CAknInformationNote( ETrue ); - dlg->ExecuteLD( aText ); - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowInfoNoteL -// ---------------------------------------------------------------------------- -// -EXPORT_C void FileManagerDlgUtils::ShowInfoNoteL( - const TInt aTextId, const TDesC& aValue ) - { - HBufC* text = NULL; - if( aValue.Length() ) - { - text = StringLoader::LoadLC( aTextId, aValue ); - } - else - { - text = StringLoader::LoadLC( aTextId ); - } - ShowInfoNoteL( *text ); - CleanupStack::PopAndDestroy( text ); - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowInfoNoteL -// ---------------------------------------------------------------------------- -// -EXPORT_C void FileManagerDlgUtils::ShowInfoNoteL( - const TInt aTextId, const TInt aValue ) - { - HBufC* text = StringLoader::LoadLC( aTextId, aValue ); - ShowInfoNoteL( *text ); - CleanupStack::PopAndDestroy( text ); - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowSimplePasswordQueryL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool FileManagerDlgUtils::ShowSimplePasswordQueryL( - const TInt aTitleId, - TDes& aPwd ) - { - TBool ret( EFalse ); - HBufC* title = StringLoader::LoadLC( aTitleId ); - ret = ShowSimplePasswordQueryL( *title, aPwd ); - CleanupStack::PopAndDestroy( title ); - return ret; - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowPasswordQueryL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool FileManagerDlgUtils::ShowPasswordQueryL( - TDes& aPwd ) - { - HBufC* confirm = HBufC::NewLC( aPwd.MaxLength() ); - TPtr ptrConfirm( confirm->Des() ); - TBool ret( EFalse ); - // Execute dialog again and again until cancelled or passwords match - TBool isDone( EFalse ); - while( !isDone ) - { - aPwd.FillZ( aPwd.MaxLength() ); - aPwd.Zero(); - ptrConfirm.FillZ( ptrConfirm.MaxLength() ); - ptrConfirm.Zero(); - - CAknMultiLineDataQueryDialog* dlg = - CAknMultiLineDataQueryDialog::NewL( - aPwd, ptrConfirm ); - if ( dlg->ExecuteLD( R_FILEMANAGER_PASSWORD_QUERY ) ) - { - // Check if the words match - if ( aPwd.Compare( ptrConfirm ) ) - { - FileManagerDlgUtils::ShowErrorNoteL( - R_QTN_PASSWORDS_DONT_MATCH_TEXT ); - } - else - { - ret = ETrue; - isDone = ETrue; - } - } - else - { - isDone = ETrue; - } - } - CleanupStack::PopAndDestroy( confirm ); - return ret; - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowMemoryStoreInfoPopupL -// ---------------------------------------------------------------------------- -// -EXPORT_C void FileManagerDlgUtils::ShowMemoryStoreInfoPopupL( - const TFileManagerDriveInfo& aInfo - ) - { - CFileManagerMMCInfoPopup* popup = CFileManagerMMCInfoPopup::NewL( - aInfo ); - popup->ExecuteLD(); - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowFileNameQueryL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool FileManagerDlgUtils::ShowFileNameQueryL( - const TInt aTitleId, - const TDesC& aOldName, - TDes& aNewName, - CFileManagerEngine& aEngine ) - { - TBool ret( EFalse ); - HBufC* title = StringLoader::LoadLC( aTitleId ); - CFileManagerFileNameQueryDlg* dlg = - CFileManagerFileNameQueryDlg::NewL( - aOldName, aNewName, aEngine ); - if ( dlg->ExecuteLD( R_FILEMANAGER_FILE_NAME_QUERY, *title ) ) - { - ret = ETrue; - } - CleanupStack::PopAndDestroy( title ); - return ret; - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowFolderNameQueryL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool FileManagerDlgUtils::ShowFolderNameQueryL( - const TInt aTitleId, - TDes& aName, - CFileManagerEngine& aEngine, - const TBool aNameGeneration ) - { - TBool ret( EFalse ); - HBufC* title = StringLoader::LoadLC( aTitleId ); - CFileManagerFolderNameQueryDlg* dlg = - CFileManagerFolderNameQueryDlg::NewL( - aName, aEngine, aNameGeneration ); - if ( dlg->ExecuteLD( R_FILEMANAGER_FILE_NAME_QUERY, *title ) ) - { - ret = ETrue; - } - CleanupStack::PopAndDestroy( title ); - return ret; - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowItemInfoPopupL( -// ---------------------------------------------------------------------------- -// -EXPORT_C void FileManagerDlgUtils::ShowItemInfoPopupL( - CFileManagerItemProperties& aProperties, - const CFileManagerFeatureManager& aFeatureManager ) - { - CFileManagerInfoPopup* popup = NULL; - TRAPD ( err, popup = CFileManagerInfoPopup::NewL( - aProperties, aFeatureManager ) ); - if ( err == KErrNone ) - { - popup->ExecuteLD(); - } - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowSimplePasswordQueryL -// ---------------------------------------------------------------------------- -// -EXPORT_C TBool FileManagerDlgUtils::ShowSimplePasswordQueryL( - const TDesC& aText, TDes& aPwd ) - { - TBool ret( EFalse ); - CAknTextQueryDialog* dlg = - CAknTextQueryDialog::NewL( aPwd, CAknQueryDialog::ENoTone ); - if ( dlg->ExecuteLD( R_FILEMANAGER_SIMPLE_PASSWORD_QUERY, aText ) ) - { - ret = ETrue; - } - return ret; - } - -// ---------------------------------------------------------------------------- -// FileManagerDlgUtils::ShowErrorNoteL -// ---------------------------------------------------------------------------- -// -EXPORT_C void FileManagerDlgUtils::ShowErrorNoteL( const TDesC& aText ) - { - CAknErrorNote* dlg = new( ELeave ) CAknErrorNote( ETrue ); - dlg->ExecuteLD( aText ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/aiwprovider/data/200110F8.rss --- a/filemanager/aiwprovider/data/200110F8.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Registry info resource file for filemanageraiwprovider -* -*/ - - -// INCLUDE FILES -#include -#include - - -// --------------------------------------------------------- -// filemanageraiwprovider_registry_info -// Registry info resource. -// --------------------------------------------------------- -// -RESOURCE REGISTRY_INFO filemanageraiwprovider_registry_info - { - resource_format_version = RESOURCE_FORMAT_VERSION_2; - dll_uid = 0x200110F8; - interfaces = - { - INTERFACE_INFO - { - interface_uid = KAiwClassBase; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x200110F9; - version_no = 1; - display_name = "filemanageraiwprovider"; - default_data = "*"; - opaque_data = KAiwCmdEditStr; - } - }; - } - }; - } diff -r 95243422089a -r 491b3ed49290 filemanager/aiwprovider/inc/filemanageraiwprovider.h --- a/filemanager/aiwprovider/inc/filemanageraiwprovider.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This class offers AIW services -* -*/ - - - -#ifndef C_FILEMANAGERAIWPROVIDER_H -#define C_FILEMANAGERAIWPROVIDER_H - -// INCLUDE FILES -#include -#include -#include - - -// CLASS DECLARATION -/** -* This class offers AIW services -* -* @since 5.0 -*/ -NONSHARABLE_CLASS( CFileManagerAiwProvider ) : - public CAiwServiceIfBase, - public MAknServerAppExitObserver - { -public: - - /** - * Two-phased constructor. - */ - static CFileManagerAiwProvider* NewL(); - - /** - * Destructor. - */ - ~CFileManagerAiwProvider(); - -public: // From CAiwServiceIfBase - - void InitialiseL( - MAiwNotifyCallback& aFrameworkCallback, - const RCriteriaArray& aInterest ); - - void HandleServiceCmdL( - const TInt& aCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& aOutParamList, - TUint aCmdOptions = 0, - const MAiwNotifyCallback* aCallback = NULL ); - -public: // From MAknServerAppExitObserver - void HandleServerAppExit( TInt aReason ); - -private: // New methods - void CmdEditL( - const CAiwGenericParamList& aInParamList, - const MAiwNotifyCallback* aCallback ); - - void NotifyL( TInt aEvent ); - - TUid GetAppUidL(); - - TUid GetAppUid(); - - void LaunchEmbeddedL( - const CAiwGenericParamList& aInParamList, - const MAiwNotifyCallback* aCallback ); - - TBool IsStandaloneLaunch( - const CAiwGenericParamList& aInParamList ); - - void LaunchStandaloneL( - const CAiwGenericParamList& aInParamList ); - - TBool IsFolderToOpenPathGiven( - const CAiwGenericParamList& aInParamList ); - -private: - /** - * C++ default constructor. - */ - CFileManagerAiwProvider(); - -private: // Data - /** - * For launching embedded file manager - * Own. - */ - CAknLaunchAppService* iService; - - /** - * For client notifications - * Not own. - */ - const MAiwNotifyCallback* iCallback; - - /** - * For storing the current input params - * Own. - */ - CAiwGenericParamList* iInParamList; - - /** - * Id of the current command - */ - TInt iCmd; - - /** - * The uid of File Manager application to be started for this service - */ - TUid iAppUid; - - }; - -#endif // C_FILEMANAGERAIWPROVIDER_H diff -r 95243422089a -r 491b3ed49290 filemanager/aiwprovider/src/filemanageraiwprovider.cpp --- a/filemanager/aiwprovider/src/filemanageraiwprovider.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,443 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This class offers AIW services -* -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include "FileManagerDebug.h" -#include "FileManagerPrivateCRKeys.h" -#include "filemanageraiwprovider.h" -#include "FileManagerUID.h" - -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( 0x200110F9, CFileManagerAiwProvider::NewL ) - }; -const TUid KUidDefaultFileManager = { KFileManagerUID3 }; -const TInt KMaxSortMethodStr = 20; -_LIT( KRootMatch, "?:\\" ); - - -// ======== LOCAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// FindStandaloneAppL -// --------------------------------------------------------------------------- -// -static TBool FindStandaloneAppL( - RWsSession& aWs, const TUid& aUid, TInt& aWgId ) - { - FUNC_LOG; - - aWgId = 0; // Used window group id is always greater than zero - RArray< RWsSession::TWindowGroupChainInfo > windowChain; - User::LeaveIfError( aWs.WindowGroupList( &windowChain ) ); - CleanupClosePushL( windowChain ); - TInt count( windowChain.Count() ); - for( TInt i( 0 ); i < count; ++i ) - { - const RWsSession::TWindowGroupChainInfo& entry( windowChain[ i ] ); - CApaWindowGroupName* app = CApaWindowGroupName::NewLC( - aWs, entry.iId ); - TUid appUid( app->AppUid() ); - CleanupStack::PopAndDestroy( app ); - // Match the app's UID and the embedded status. - // The app is standalone when there is no parent window group. - if ( appUid == aUid && entry.iParentId <= 0 ) - { - // Standalone application found - aWgId = entry.iId; - break; - } - } - CleanupStack::PopAndDestroy( &windowChain ); - return aWgId > 0; - } - -// --------------------------------------------------------------------------- -// IsValidFolderToOpenPath -// --------------------------------------------------------------------------- -// -static TBool IsValidFolderToOpenPath( const TDesC& aFullPath ) - { - FUNC_LOG; - - TInt len( aFullPath.Length() ); - if ( !len ) - { - return ETrue; // Allow empty to open main view - } - // Check that at least root folder exists - if ( aFullPath.Left( KRootMatch().Length() ).MatchF( - KRootMatch ) == KErrNotFound ) - { - return EFalse; - } - return ETrue; - } - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CFileManagerAiwProvider::CFileManagerAiwProvider -// --------------------------------------------------------------------------- -// -CFileManagerAiwProvider::CFileManagerAiwProvider() - { - FUNC_LOG; - } - -// --------------------------------------------------------------------------- -// CFileManagerAiwProvider::NewL -// --------------------------------------------------------------------------- -// -CFileManagerAiwProvider* CFileManagerAiwProvider::NewL() - { - FUNC_LOG; - - return new ( ELeave ) CFileManagerAiwProvider(); - } - -// --------------------------------------------------------------------------- -// CFileManagerAiwProvider::~CFileManagerAiwProvider -// --------------------------------------------------------------------------- -// -CFileManagerAiwProvider::~CFileManagerAiwProvider() - { - FUNC_LOG; - - delete iService; - delete iInParamList; - } - -// --------------------------------------------------------------------------- -// CFileManagerAiwProvider::InitialiseL -// --------------------------------------------------------------------------- -// -void CFileManagerAiwProvider::InitialiseL( - MAiwNotifyCallback& /*aFrameworkCallback*/, - const RCriteriaArray& /*aInterest*/ ) - { - FUNC_LOG; - } - -// --------------------------------------------------------------------------- -// CFileManagerAiwProvider::HandleServiceCmdL -// --------------------------------------------------------------------------- -// -void CFileManagerAiwProvider::HandleServiceCmdL( - const TInt& aCmdId, - const CAiwGenericParamList& aInParamList, - CAiwGenericParamList& /*aOutParamList*/, - TUint /*aCmdOptions*/, - const MAiwNotifyCallback* aCallback ) - { - FUNC_LOG; - - INFO_LOG2( - "CFileManagerAiwProvider::HandleServiceCmdL-aCmdId=%d,aCallback=0x%x", - aCmdId, aCallback ); - - TInt err( KErrNone ); - switch ( aCmdId ) - { - case KAiwCmdEdit: - { - TRAP( err, CmdEditL( aInParamList, aCallback ) ); - break; - } - default: - { - ERROR_LOG1( - "CFileManagerAiwProvider::HandleServiceCmdL-InvalidCmd=%d", - aCmdId ); - break; - } - } - LOG_IF_ERROR2( - err, - "CFileManagerAiwProvider::HandleServiceCmdL-aCmdId=%d-err=%d", - aCmdId, err ); - User::LeaveIfError( err ); - } - -// --------------------------------------------------------------------------- -// CFileManagerAiwProvider::HandleServerAppExit -// --------------------------------------------------------------------------- -// -void CFileManagerAiwProvider::HandleServerAppExit( TInt /*aReason*/ ) - { - FUNC_LOG; - - TRAP_IGNORE( NotifyL( KAiwEventCompleted ) ); - iCallback = NULL; // No notifications are needed after app exit - } - -// --------------------------------------------------------------------------- -// CFileManagerAiwProvider::CmdEditL -// --------------------------------------------------------------------------- -// -void CFileManagerAiwProvider::CmdEditL( - const CAiwGenericParamList& aInParamList, - const MAiwNotifyCallback* aCallback ) - { - FUNC_LOG; - - iCmd = KAiwCmdEdit; - if ( IsFolderToOpenPathGiven( aInParamList ) ) - { - if ( IsStandaloneLaunch( aInParamList ) ) - { - LaunchStandaloneL( aInParamList ); - } - else - { - LaunchEmbeddedL( aInParamList, aCallback ); - } - } - } - -// --------------------------------------------------------------------------- -// CFileManagerAiwProvider::NotifyL -// --------------------------------------------------------------------------- -// -void CFileManagerAiwProvider::NotifyL( TInt aEvent ) - { - FUNC_LOG; - - if ( iCallback && iInParamList ) - { - CAiwGenericParamList* eventParamList = CAiwGenericParamList::NewL(); - CleanupStack::PushL( eventParamList ); - // Must cast this because of AIW design error - const_cast< MAiwNotifyCallback* >( iCallback )->HandleNotifyL( - iCmd, aEvent, *eventParamList, *iInParamList ); - CleanupStack::PopAndDestroy( eventParamList ); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerAiwProvider::GetAppUidL -// --------------------------------------------------------------------------- -// -TUid CFileManagerAiwProvider::GetAppUidL() - { - FUNC_LOG; - - CRepository* cenRep = CRepository::NewLC( KCRUidFileManagerSettings ); - TInt uid( 0 ); - User::LeaveIfError( cenRep->Get( KFileManagerAppUidForAiwService, uid ) ); - CleanupStack::PopAndDestroy( cenRep ); - return TUid::Uid( uid ); - } - -// --------------------------------------------------------------------------- -// CFileManagerAiwProvider::GetAppUid -// --------------------------------------------------------------------------- -// -TUid CFileManagerAiwProvider::GetAppUid() - { - FUNC_LOG; - - if ( !iAppUid.iUid ) - { - // Read the application to start from CenRep - TRAPD( err, iAppUid = GetAppUidL() ); - if ( err != KErrNone || !iAppUid.iUid ) - { - // Use the default application - iAppUid = KUidDefaultFileManager; - } - ERROR_LOG1( - "CFileManagerAiwProvider::GetAppUid-Uid=0x%x", iAppUid.iUid ); - } - return iAppUid; - } - -// --------------------------------------------------------------------------- -// CFileManagerAiwProvider::LaunchEmbeddedL -// --------------------------------------------------------------------------- -// -void CFileManagerAiwProvider::LaunchEmbeddedL( - const CAiwGenericParamList& aInParamList, - const MAiwNotifyCallback* aCallback ) - { - FUNC_LOG; - - delete iService; - iService = NULL; - delete iInParamList; - iInParamList = NULL; - iCallback = NULL; - - // Copy the input params for the launcher and then do the launch - iInParamList = CAiwGenericParamList::NewL(); - TInt count( aInParamList.Count() ); - for( TInt i( 0 ); i < count; ++i ) - { - iInParamList->AppendL( aInParamList[ i ] ); - } - iService = CAknLaunchAppService::NewL( GetAppUid(), this, iInParamList ); - iCallback = aCallback; - } - -// --------------------------------------------------------------------------- -// CFileManagerAiwProvider::IsStandaloneLaunch -// --------------------------------------------------------------------------- -// -TBool CFileManagerAiwProvider::IsStandaloneLaunch( - const CAiwGenericParamList& aInParamList ) - { - FUNC_LOG; - - TBool ret( EFalse ); - TInt i( 0 ); - // Get sort method first - const TAiwGenericParam* param = aInParamList.FindFirst( - i, EGenericParamDir, EVariantTypeTInt32 ); - if ( i != KErrNotFound && param ) - { - // Then, check if standalone is requested - param = aInParamList.FindNext( i, EGenericParamDir, EVariantTypeTInt32 ); - if ( i != KErrNotFound && param ) - { - ret = param->Value().AsTInt32(); - } - } - return ret; - } - -// --------------------------------------------------------------------------- -// CFileManagerAiwProvider::LaunchStandaloneL -// --------------------------------------------------------------------------- -// -void CFileManagerAiwProvider::LaunchStandaloneL( - const CAiwGenericParamList& aInParamList ) - { - FUNC_LOG; - - TPtrC folderToOpen( KNullDesC ); - TInt sortMethod( KErrNotFound ); - TInt i( 0 ); - // Get folder path - const TAiwGenericParam* param = aInParamList.FindFirst( - i, EGenericParamDir, EVariantTypeDesC ); - if ( i != KErrNotFound && param ) - { - folderToOpen.Set( param->Value().AsDes() ); - } - // Get sort method - param = aInParamList.FindFirst( i, EGenericParamDir, EVariantTypeTInt32 ); - if ( i != KErrNotFound && param ) - { - sortMethod = param->Value().AsTInt32(); - } - - RWsSession wsSession; - User::LeaveIfError( wsSession.Connect() ); - CleanupClosePushL( wsSession ); - TInt wgId( 0 ); - TUid appUid( GetAppUid() ); - if ( FindStandaloneAppL( wsSession, appUid, wgId ) ) - { - // Bring the existing standalone app to foreground - TApaTask apaTask( wsSession ); - apaTask.SetWgId( wgId ); - apaTask.BringToForeground(); - } - else - { - // Start new standalone app - TApaAppInfo appInfo; - RApaLsSession apaLsSession; - User::LeaveIfError( apaLsSession.Connect() ); - CleanupClosePushL( apaLsSession ); - User::LeaveIfError( apaLsSession.GetAppInfo( appInfo, appUid ) ); - CApaCommandLine* apaCmdLine = CApaCommandLine::NewLC(); - apaCmdLine->SetExecutableNameL( appInfo.iFullName ); - apaCmdLine->SetCommandL( EApaCommandOpen ); - apaCmdLine->SetDocumentNameL( folderToOpen ); - if ( sortMethod != KErrNotFound ) - { - TBuf8< KMaxSortMethodStr > sortMethodStr; - sortMethodStr.AppendNum( sortMethod ); - apaCmdLine->SetTailEndL( sortMethodStr ); - } - TThreadId dummy; - User::LeaveIfError( apaLsSession.StartApp( *apaCmdLine, dummy ) ); - CleanupStack::PopAndDestroy( apaCmdLine ); - CleanupStack::PopAndDestroy( &apaLsSession ); - } - CleanupStack::PopAndDestroy( &wsSession ); - } - -// --------------------------------------------------------------------------- -// CFileManagerAiwProvider::IsFolderToOpenPathGiven -// --------------------------------------------------------------------------- -// -TBool CFileManagerAiwProvider::IsFolderToOpenPathGiven( - const CAiwGenericParamList& aInParamList ) - { - FUNC_LOG; - - TBool ret( EFalse ); - TPtrC folderToOpen( KNullDesC ); - TInt i( 0 ); - // Ensure first that no files are defined, because only folder service - // is offered by this provider - const TAiwGenericParam* param = aInParamList.FindFirst( - i, EGenericParamFile, EVariantTypeAny ); - if ( i == KErrNotFound ) - { - // Get folder path and check it - i = 0; - param = aInParamList.FindFirst( - i, EGenericParamDir, EVariantTypeDesC ); - if ( i != KErrNotFound && param ) - { - folderToOpen.Set( param->Value().AsDes() ); - ret = IsValidFolderToOpenPath( folderToOpen ); - } - } - if ( !ret ) - { - ERROR_LOG2( - "CFileManagerAiwProvider::IsFolderToOpenPathGiven-ret=%d,given=%S", - ret, &folderToOpen ); - } - return ret; - } - -// ======== GLOBAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// ImplementationGroupProxy. -// --------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) - { - FUNC_LOG; - - aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); - return ImplementationTable; - } diff -r 95243422089a -r 491b3ed49290 filemanager/bkupchecker/data/10205078.rss --- a/filemanager/bkupchecker/data/10205078.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +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: Registry info resource file for filemanagerbkupchecker -* -*/ - - -#include - -// --------------------------------------------------------- -// -// filemanagerbkupchecker_registry_info -// Registry info resource. -// -// --------------------------------------------------------- -// -RESOURCE REGISTRY_INFO filemanagerbkupchecker_registry_info - { - resource_format_version = RESOURCE_FORMAT_VERSION_2; - dll_uid = 0x10205078; - interfaces = - { - INTERFACE_INFO - { - interface_uid = 0x1020d466; // Const for all rule based recognizers - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x1020508A; - version_no = 1; - display_name = "filemanagerbkupchecker"; - default_data = ""; - opaque_data = ""; - } - }; - } - }; - } diff -r 95243422089a -r 491b3ed49290 filemanager/bkupchecker/data/filemanagerbkupchecker.rss --- a/filemanager/bkupchecker/data/filemanagerbkupchecker.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +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 file for filemanagerbkupchecker plugin -* -*/ - - -#include -#include -#include "filemanagerbkupchecker.rh" - -NAME BKCH - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF { buf="bkupchecker"; } - -RESOURCE LBUF r_qtn_fmgr_backup_applaunch_prevented - { - txt = qtn_fmgr_backup_applaunch_prevented; - } - -RESOURCE LBUF r_qtn_fmgr_restore_applaunch_prevented - { - txt = qtn_fmgr_restore_applaunch_prevented; - } - -/** -* The resources for UIDs. -* This struct lists UIDs allowed to launch -* during backup or restore -* -*/ -RESOURCE ALLOWEDUID alloweduids - { - uid= - { - 0x101F4CD2, // Application Shell Menu - 0x100058B3, // Phone application - 0x101F84EB, // File Manager - 0x101F8681 // Video Telephone Application - }; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupchecker/inc/filemanagerbkupchecker.h --- a/filemanager/bkupchecker/inc/filemanagerbkupchecker.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +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: Declaration of CFileManagerBkupChecker class -* -*/ - - -#ifndef C_FILEMANAGERBKUPCHECKER_H -#define C_FILEMANAGERBKUPCHECKER_H - -#include -#include - -class CResourceFile; - -using namespace conn; - -/** -* Plugin for application launch check -* -* This class implements rule based application check Plug-in API. -* Application launch is restricted during backup and restore. -* -* @since S60 3.2 -*/ -NONSHARABLE_CLASS( CFileManagerBkupChecker ) : public CAppLaunchChecker - { - -public: - - /** - * Two-phased constructor. - */ - static CFileManagerBkupChecker* NewL(); - - /** - * Destructor - */ - ~CFileManagerBkupChecker(); - - /** - * From CApplaunchChecker - * Two-phased constructor. - * - * @since S60 3.2 - * @param aAppToLaunch Uid of application to launch - * @param TApaTaskList List of applications running in device - * @return Launch code for apparc - */ - TAppLaunchCode virtual OkayToLaunchL(const TUid aAppToLaunch, TApaTaskList& aTaskList); - -private: - - CFileManagerBkupChecker(); - - void ConstructL(); - - TBool ValidateBUROngoing(); - - static TInt ThreadFunction( TAny* ptr ); - - void ThreadFunctionL(); - -private: // data - - /** - * Array of allowed uids to run. - */ - RArray iUids; - - /** - * Notes shown during backup or restore. - * Own - */ - HBufC* iBackupNote; - HBufC* iRestoreNote; - - /** - * Ongoing backup or restore. - */ - TBool iIsBackup; - }; - -#endif // C_FILEMANAGERBKUPCHECKER_H diff -r 95243422089a -r 491b3ed49290 filemanager/bkupchecker/inc/filemanagerbkupchecker.rh --- a/filemanager/bkupchecker/inc/filemanagerbkupchecker.rh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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 for project filemanagerbkupchecker -* -*/ - - -// --------------------------------------------------------- -// ALLOWEDUIDS -// -// This struct lists UIDs allowed to lauch -// during backup or restore -// --------------------------------------------------------- -// -STRUCT ALLOWEDUID - { - LONG uid[]; - } -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupchecker/src/filemanagerbkupchecker.cpp --- a/filemanager/bkupchecker/src/filemanagerbkupchecker.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,460 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Rule based application launch during backup and restore. -* -*/ - - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "FileManagerDebug.h" -#include "filemanagerprivatepskeys.h" -#include "FileManagerUID.h" -#include "filemanagerbkupchecker.h" - -// CONSTANTS -_LIT(KMsengRscFilePath,"filemanagerbkupchecker.rsc"); -_LIT(KThreadName,"BkupCheckerThread"); - -#ifdef __SKIP_PS_IN_TEST_ -// Controlling of KUidBackupRestoreKey only possible with SID 0x10202D56 -// That is why we have to variate running of test code using testVariable -extern TInt testVariable; -#endif - -// Define the interface UIDs. -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( 0x1020508A, CFileManagerBkupChecker::NewL ) - }; - - -// ======== LOCAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// ProcessExists -// --------------------------------------------------------------------------- -// -static TBool ProcessExists( const TSecureId& aSecureId ) - { - _LIT( KFindPattern, "*" ); - TFindProcess finder(KFindPattern); - TFullName processName; - while( finder.Next( processName ) == KErrNone ) - { - RProcess process; - if ( process.Open( processName ) == KErrNone ) - { - TSecureId processId( process.SecureId() ); - process.Close(); - if( processId == aSecureId ) - { - return ETrue; - } - } - } - return EFalse; - } - -// --------------------------------------------------------------------------- -// GetFileManagerBurStatus -// --------------------------------------------------------------------------- -// -static TInt GetFileManagerBurStatus() - { - TInt status( EFileManagerBkupStatusUnset ); - TInt err( RProperty::Get( - KPSUidFileManagerStatus, KFileManagerBkupStatus, status ) ); - if ( err != KErrNone ) - { - status = EFileManagerBkupStatusUnset; - } - else if( status == EFileManagerBkupStatusBackup || - status == EFileManagerBkupStatusRestore ) - { - const TSecureId KFileManagerUid(KFileManagerUID3); - // Check file manager process just if bur state detected - if( !ProcessExists( KFileManagerUid ) ) - { - status = EFileManagerBkupStatusUnset; - } - } - - INFO_LOG2( "GetFileManagerBurStatus, status %d, err %d", status, err ) - - return status; - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// ImplementationGroupProxy. -// -// ----------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) - { - aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); - return ImplementationTable; - } - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CFileManagerBkupChecker::CFileManagerBkupChecker -// -// --------------------------------------------------------------------------- -// -CFileManagerBkupChecker::CFileManagerBkupChecker() - { - } - -// --------------------------------------------------------------------------- -// CFileManagerBkupChecker::NewL -// -// --------------------------------------------------------------------------- -// -CFileManagerBkupChecker* CFileManagerBkupChecker::NewL() - { - CFileManagerBkupChecker* self = new (ELeave) CFileManagerBkupChecker(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CFileManagerBkupChecker::ConstructL -// -// --------------------------------------------------------------------------- -// -void CFileManagerBkupChecker::ConstructL() - { - FUNC_LOG - RFs fsSession; - - // Connect to File Server - User::LeaveIfError(fsSession.Connect()); - CleanupClosePushL(fsSession); - - // Get resource drive from dll location - TFileName dllFileName; - Dll::FileName( dllFileName ); - TParsePtrC dllParse( dllFileName ); - TFileName fileName; -#ifdef __SKIP_PS_IN_TEST_ - _LIT(KDriveZ,"Z:"); - fileName.Copy( KDriveZ ); -#else - // Drive is parsed normally from dll-location in order to support - // installing/patching of component. - fileName.Copy( dllParse.Drive() ); -#endif - fileName.Append( KDC_RESOURCE_FILES_DIR ); - fileName.Append( KMsengRscFilePath ); - BaflUtils::NearestLanguageFile( fsSession, fileName ); - // - TEntry entry; - User::LeaveIfError( fsSession.Entry( fileName, entry ) ); - // if file does not exist, leaves with KErrNotFound - - CResourceFile *resFile; - resFile = CResourceFile::NewLC( fsSession, fileName, 0, entry.iSize ); - - resFile->ConfirmSignatureL(); - - ///////////////////////////////////////////////////////// - //Initialize white-list of applications from resource file - - RResourceReader theReader; - theReader.OpenLC( resFile, ALLOWEDUIDS ); - - //the first WORD contains the number of elements in the resource - TInt numberOfUIDs = theReader.ReadInt16L(); - - for( TInt i = 0; i < numberOfUIDs; i++) - { - TUint32 uid = theReader.ReadInt32L(); - iUids.Append(uid); - INFO_LOG1( "CFileManagerBkupChecker::ConstructL, Application 0x%x added in white-list", iUids[i] ) - } - CleanupStack::PopAndDestroy( &theReader ); - - //Initialize information note texts from resource file - theReader.OpenLC( resFile, R_QTN_FMGR_BACKUP_APPLAUNCH_PREVENTED ); - iBackupNote = theReader.ReadHBufCL(); - CleanupStack::PopAndDestroy( &theReader ); - - theReader.OpenLC( resFile, R_QTN_FMGR_RESTORE_APPLAUNCH_PREVENTED ); - iRestoreNote = theReader.ReadHBufCL(); - CleanupStack::PopAndDestroy( &theReader ); - - CleanupStack::PopAndDestroy( resFile ); - CleanupStack::PopAndDestroy( &fsSession ); - } - - -// --------------------------------------------------------------------------- -// CFileManagerBkupChecker::~CFileManagerBkupChecker -// -// --------------------------------------------------------------------------- -// -CFileManagerBkupChecker::~CFileManagerBkupChecker() - { - delete iBackupNote; - delete iRestoreNote; - iUids.Close(); - } - -// --------------------------------------------------------------------------- -// CFileManagerBkupChecker::OkayToLaunchL -// -// --------------------------------------------------------------------------- -// -CAppLaunchChecker::TAppLaunchCode CFileManagerBkupChecker::OkayToLaunchL(const TUid aAppToLaunch, - TApaTaskList& /* aTaskList */) - { - FUNC_LOG - CAppLaunchChecker::TAppLaunchCode launch = CAppLaunchChecker::EAppLaunchIndifferent; - - TInt burState( 0 ); - TInt burErr = RProperty::Get( KUidSystemCategory, KUidBackupRestoreKey, burState ); - - if(burErr == KErrNone) - { - INFO_LOG2 - ( - "CFileManagerBkupChecker::OkayToLaunchL, Application 0x%x, KUidBackupRestoreKey status %d", - aAppToLaunch.iUid, burState - ) - - TBURPartType burType = static_cast< TBURPartType >( burState & KBURPartTypeMask ); - TInt fmBurStatus( GetFileManagerBurStatus() ); - - // We can't rely on just p&s value. Additional check is carried out in ValidateBUROngoing. -#ifdef __SKIP_PS_IN_TEST_ - // Run additional validation check in test mode just to cover all use cases - ValidateBUROngoing(); -#else - if( fmBurStatus == EFileManagerBkupStatusBackup || - fmBurStatus == EFileManagerBkupStatusRestore || - ( ( burType == EBURBackupPartial || burType == EBURBackupFull || - burType == EBURRestorePartial || burType == EBURRestoreFull ) && - ValidateBUROngoing() ) ) -#endif - { - launch = CAppLaunchChecker::EAppLaunchDecline; - - TInt count( iUids.Count() ); - - for( TInt i = 0; i < count; i++ ) - { - if(iUids[i] == aAppToLaunch.iUid) - { - INFO_LOG1 - ( - "CFileManagerBkupChecker::OkayToLaunchL, Application 0x%x in white-list", - iUids[i] - ) - launch = CAppLaunchChecker::EAppLaunchIndifferent; - break; - } - } - - if( launch == CAppLaunchChecker::EAppLaunchDecline ) - { - INFO_LOG1 - ( - "CFileManagerBkupChecker::OkayToLaunchL, Application 0x%x launch prevented", - aAppToLaunch.iUid - ) - - iIsBackup = ( fmBurStatus == EFileManagerBkupStatusBackup || - burType == EBURBackupPartial || - burType == EBURBackupFull ); - - RThread thread; - - TInt err = thread.Create( - KThreadName, ThreadFunction, KDefaultStackSize, NULL, this ); - - INFO_LOG1("CFileManagerBkupChecker::OkayToLaunchL, thread err %d", err) - - if ( err == KErrNone ) - { - TRequestStatus status; - - thread.Rendezvous( status ); - thread.Resume(); - - // Wait until thread has copy of note text. - User::WaitForRequest( status ); - - INFO_LOG1("CFileManagerBkupChecker::OkayToLaunchL, thread exit %d", status.Int()) - } - - thread.Close(); - } - } - } - - return launch; - } - -// --------------------------------------------------------------------------- -// CFileManagerBkupChecker::ValidateBUROngoing -// -// --------------------------------------------------------------------------- -// -TBool CFileManagerBkupChecker::ValidateBUROngoing() - { - TBool err(EFalse); - _LIT( KFindPattern, "*" ); - const TSecureId KSBEUid(0x10202D56); - const TSecureId KFileManagerUid(KFileManagerUID3); - const TSecureId KPCConnectivityUid(0x101F99F6); - TBool serverRunning(EFalse); - TBool client1Running(EFalse); - TBool client2Running(EFalse); - - // If SBE panics, File Manager and PC-connectivity server are supposed to - // re-establish connection to server and set BUR-mode back to normal. - // If SBE client panics, server is supposed to set BUR-mode back to normal. - // However, it might be reasonable to validate also that BUR client is - // up and running. E.g. if both server and client panic in sequence, BUR - // state might stay as backup or restore and we never let application run. - // We have to search by UID, because process can have localized name - TFindProcess finder( KFindPattern ); - TFullName processName; - - while( finder.Next( processName ) == KErrNone ) - { - RProcess process; - const TInt r = process.Open( processName ); - if ( r == KErrNone ) - { - const TSecureId processId = process.SecureId(); - process.Close(); - - if( processId == KSBEUid ) - { - serverRunning = ETrue; - } - else if( processId == KFileManagerUid ) - { - client1Running = ETrue; - } - else if( processId == KPCConnectivityUid ) - { - client2Running = ETrue; - } - } - } - - INFO_LOG2("CFileManagerBkupChecker::ValidateBUROngoing, %x status %d", - KSBEUid.iId, serverRunning); - INFO_LOG2("CFileManagerBkupChecker::ValidateBUROngoing, %x status %d", - KFileManagerUid.iId, client1Running); - INFO_LOG2("CFileManagerBkupChecker::ValidateBUROngoing, %x status %d", - KPCConnectivityUid.iId, client2Running); - - if( serverRunning && (client1Running || client2Running) ) - { - err = ETrue; - } - - return err; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBkupChecker::ThreadFunction() -// -// ---------------------------------------------------------------------------- -TInt CFileManagerBkupChecker::ThreadFunction( TAny* ptr ) - { - FUNC_LOG - - CFileManagerBkupChecker* self = - static_cast< CFileManagerBkupChecker* >( ptr ); - - CTrapCleanup* cleanupStack = CTrapCleanup::New(); - if ( !cleanupStack ) - { - return KErrNoMemory; - } - - TRAPD( err, self->ThreadFunctionL() ); - - INFO_LOG1("CFileManagerBkupChecker::ThreadFunction, ThreadFunctionL err %d", err) - - delete cleanupStack; - - return err; - } - -// ---------------------------------------------------------------------------- -// CFileManagerBkupChecker::ThreadFunctionL() -// -// ---------------------------------------------------------------------------- -void CFileManagerBkupChecker::ThreadFunctionL( ) - { - FUNC_LOG - - HBufC* note = NULL; - -#ifdef __SKIP_PS_IN_TEST_ - if(!testVariable) - { - note = iBackupNote->AllocLC(); - } - else - { - note = iRestoreNote->AllocLC(); - } -#else - if( iIsBackup ) - { - note = iBackupNote->AllocLC(); - } - else - { - note = iRestoreNote->AllocLC(); - } -#endif - - // Once we have locally allocated note string, we can signal main thread. - RThread::Rendezvous( KErrNone ); - - RAknUiServer aknSrv; - TInt err( aknSrv.Connect() ); - INFO_LOG1("CFileManagerBkupChecker::ThreadFunctionL, connect err %d", err) - User::LeaveIfError( err ); - CleanupClosePushL( aknSrv ); - - aknSrv.ShowGlobalNoteL( *note, EAknGlobalInformationNote ); - - CleanupStack::PopAndDestroy( &aknSrv ); - CleanupStack::PopAndDestroy( note ); - } - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/BKupEngine.rh --- a/filemanager/bkupengine/inc/BKupEngine.rh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* -* Copyright (c) 2002-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: -* This file contains declarations for resources. -* The file can be included only in resource file. -* -* -*/ - - -// INCLUDES -#include - -// STRUCTURE DEFINITIONS - -// --------------------------------------------------------- -// BACKUPITEM -// Defines a file or folder to be backed up -// Note! Remember to use a trailing backslash! -// --------------------------------------------------------- -// -STRUCT BACKUPITEM - { - LTEXT item_path; - WORD item_flags; - } - - - -// --------------------------------------------------------- -// MMC_SECURE_BACKUP_DRIVE_LIST -// -// Defines an array of drive numbers, starting at 0 -// (EDriveA), to a maximum of 25 (EDriveZ) -// which are included in a backup/restore to/from MMC -// operation -// -// See TMMCDriveNumber and TBkupDriveCategory (BkupEngine.hrh) -// See TMMCScBkupOwnerDataType in TMMCScBkupOwnerDataType.hrh -// --------------------------------------------------------- -// -STRUCT MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE - { - BYTE drive; // See TMMCDriveNumber and TBkupDriveCategory (BkupEngine.hrh) - BYTE type; // See TMMCScBkupOwnerDataType (TMMCScBkupOwnerDataType.h) - } - - - -// --------------------------------------------------------- -// MMC_SECURE_BACKUP_DRIVES_AND_OPERATIONS -// -// Defines an array of drive numbers and operations. -// The drive starts at 0 (EDriveA), to a maximum of 25 (EDriveZ) -// which are included in a backup/restore to/from MMC -// operation. Each drive should include a number of associated -// operations. For example, for drive C:\ we wish to carry -// out all SBE backup/restore ops. For MMC we wish to only -// back up & restore package data (Required to ensure that -// hashes for MMC-based binaries are recreated on C:\ after -// the internal drive is formatted & a restore is performed). -// -// --------------------------------------------------------- -// -STRUCT MMC_SECURE_BACKUP_DRIVES_AND_OPERATIONS - { - LEN BYTE STRUCT drivesAndOperations[]; // SEE MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE - } - -// --------------------------------------------------------- -// BACKUPCATEGORY -// Defines a category, name for archive and uids, -// from which backup category consists of -// --------------------------------------------------------- -// -STRUCT BACKUPCATEGORY - { - LONG category; - LTEXT archive_name; - LONG special_flags; - LONG exclude_special_flags; - LONG uids[]; - LONG exclude_uids[]; - } - - -// --------------------------------------------------------- -// BACKUPCATEGORY -// Defines a category, name for archive and uids, -// from which backup category consists of -// --------------------------------------------------------- -// -STRUCT BACKUPCATEGORYARRAY - { - STRUCT backupcategory[]; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/BkupEngine.hrh --- a/filemanager/bkupengine/inc/BkupEngine.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* Copyright (c) 2004-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: -* FileManager / FileManagerBkupEngine constants. -* -*/ - - - -#ifndef __BAENGINE_HRH__ -#define __BAENGINE_HRH__ - -// Partial backup categories bitmask values -enum MAEngineBackupCategories - { - EBUCatSettings = 0x1, - EBUCatMessages = 0x2, - EBUCatContacts = 0x4, - EBUCatCalendar = 0x8, - EBUCatBookmarks = 0x10, - EBUCatUserFiles = 0x20, - EBUCatAllInOne = 0x8000000, - EBUCatAllSeparately = 0x7FFFFFF - // Set as 0xFFFFFFF (EBUCatAllInOne+EBUCatAllSeparately) if archive containing - // data from all data owners needs to be created. - }; - -// Bitmask values for special ruling of which category data owner belongs to -#define EBUCatSpecNone 0x0 -#define EBUCatSpecSystem 0x1 -#define EBUCatSpecJava 0x2 -#define EBUCatSpecPublic 0x4 -#define EBUCatSpecAll 0x8 - -#ifndef RD_MULTIPLE_DRIVE - -// Drive list enumeration - see TDriveNumber -// (these must match F32's TDriveNumber exactly) -enum TMMCDriveNumber - { - EMMCDriveNumberA = 0, - EMMCDriveNumberB, - EMMCDriveNumberC, - EMMCDriveNumberD, - EMMCDriveNumberE, - EMMCDriveNumberF, - EMMCDriveNumberG, - EMMCDriveNumberH, - EMMCDriveNumberI, - EMMCDriveNumberJ, - EMMCDriveNumberK, - EMMCDriveNumberL, - EMMCDriveNumberM, - EMMCDriveNumberN, - EMMCDriveNumberO, - EMMCDriveNumberP, - EMMCDriveNumberQ, - EMMCDriveNumberR, - EMMCDriveNumberS, - EMMCDriveNumberT, - EMMCDriveNumberU, - EMMCDriveNumberV, - EMMCDriveNumberW, - EMMCDriveNumberX, - EMMCDriveNumberY, - EMMCDriveNumberZ - }; - -#else // RD_MULTIPLE_DRIVE - -// Defines drive caterories for multiple drives to setup backup sources and restore targets -#define EBkupDeviceMemories 0x1 -#define EBkupInternalMassStorages 0x2 -#define EBkupExternalMassStorages 0x4 - -#endif // RD_MULTIPLE_DRIVE - -#endif // __BAENGINE_HRH__ - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupArchive.h --- a/filemanager/bkupengine/inc/CMMCScBkupArchive.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of CMMCScBkupArchive -* -* -*/ - -#ifndef __CMMCSCBKUPARCHIVE_H__ -#define __CMMCSCBKUPARCHIVE_H__ - -// System includes -#include -#include - -// Classes referenced -class MMMCScBkupDriver; -class CMMCScBkupArchiveHeader; -class CMMCScBkupArchiveFooter; -class MMMCScBkupProgressObserver; -class CMMCScBkupArchiveDataManager; -class MMMCScBkupArchiveDataInterface; - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupArchive) : public CBase - { - public: - - /** - * Static constructor - */ - static CMMCScBkupArchive* NewL( RFs& aFsSession, MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupDriver& aDriver, TBitFlags aCategory ); - - /** - * C++ destructor - */ - ~CMMCScBkupArchive(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupArchive( RFs& aFsSession, MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupDriver& aDriver, TBitFlags aCategory ); - - /** - * - */ - void ConstructL(); - - public: // API - - /** - * - */ - void OpenForReadingL(const TDesC& aName); - - /** - * - */ - void OpenForWritingL(const TDesC& aName); - - /** - * - */ - void RestoreOldArchive(); - - /** - * - */ - void DeleteOldArchive(); - - /** - * - */ - void Close( TInt aError ); - - /** - * - */ - CMMCScBkupArchiveHeader& Header() const; - - /** - * - */ - CMMCScBkupArchiveFooter& Footer() const; - - /** - * - */ - MMMCScBkupArchiveDataInterface& ADI() const; - - /** - * - */ - static TBool ValidArchiveForRestoreL( RFs& aFsSession, const TDesC& aFileName ); - - /** - * - */ - TBitFlags Category() const { return iCategory; } - - private: // Internal enumerations - - /** - * - */ - enum TMode - { - EModeUninitialised = 0, - // - EModeReading, - EModeWriting - }; - - private: // Internal methods - - /** - * - */ - TInt PrepareToOverwrite( const TDesC& aFile ); - - /** - * - */ - void SetMode(TMode aMode); - - /** - * - */ - void PrepareObjectsL(); - - /** - * - */ - inline TMode Mode() const { return iMode; } - - private: // Member data - - // - RFs& iFsSession; - // - RFile64 iArchiveFile; - // - MMMCScBkupProgressObserver& iProgressManager; - // - MMMCScBkupDriver& iDriver; - // - TMode iMode; - // - CMMCScBkupArchiveDataManager* iDataManager; - // - CMMCScBkupArchiveHeader* iHeader; - // - CMMCScBkupArchiveFooter* iFooter; - // - HBufC* iArchiveFileName; - // - HBufC* iOldArchiveFileName; - // - TBitFlags iCategory; - }; - - - - -#endif // __CMMCSCBKUPARCHIVE_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupArchiveDataManager.h --- a/filemanager/bkupengine/inc/CMMCScBkupArchiveDataManager.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,223 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration of CMMCScBkupArchiveDataManager -* -* -*/ - -#ifndef __CMMCSCBKUPARCHIVEDATAMANAGER_H__ -#define __CMMCSCBKUPARCHIVEDATAMANAGER_H__ - -// System includes -#include -#include - -// User includes -#include "CMMCScBkupBufferManagers.h" -#include "MMMCScBkupArchiveDataInterface.h" -#include "TMMCScBkupArchiveVector.h" -#include "RMMCScBkupArchiveStreams.h" -#include "MMCScBkupOperations.h" -#include "MMCScBkupConfig.h" - -// Classes referenced -class CEZCompressor; -class CEZDecompressor; -class RMMCScBkupArchiveBuf; -class MMMCScBkupProgressObserver; - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupArchiveDataManager) : public CActive, public MMMCScBkupArchiveDataInterface - { - public: - - /** - * Static constructor - */ - static CMMCScBkupArchiveDataManager* NewL( RFs& aFsSession, RFile64& aFile, MMMCScBkupProgressObserver& aProgressManager ); - - /** - * C++ destructor - */ - ~CMMCScBkupArchiveDataManager(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupArchiveDataManager( RFs& aFsSession, RFile64& aFile, MMMCScBkupProgressObserver& aProgressManager ); - - /** - * - */ - void ConstructL(); - - public: // API - - /** - * Leaves on error, returns offset - */ - TInt CurrentOffsetL() const; - - /** - * Returns error or offset - */ - TInt CurrentOffset() const; - - private: // For RMMCScBkupArchiveBuf only - - /** - * - */ - void SetCurrentVector(const TMMCScBkupArchiveVector& aInfo); - - - private: // From MMMCScBkupArchiveDataInterface - RFs& ADIFsSession() const; - RFile64& ADIRawArchiveFile() const; - // - const TMMCScBkupArchiveVector& ADICurrentArchiveVectorInfo() const; - const TMMCScBkupArchiveVector& ADIOverallArchiveVectorInfo() const; - // - RWriteStream& ADIWriteStreamUncompressedLC( TInt aPos ); - RReadStream& ADIReadStreamUncompressedLC( TInt aPos ); - // - const TMMCScBkupArchiveVector& ADIWriteL( const TDesC8& aData ); - const TMMCScBkupArchiveVector& ADIReadL( TDes8& aSink, const TMMCScBkupArchiveVector& aInfo ); - // - void ADIWriteFileL( const TDesC& aSourceFileName, TRequestStatus& aObserver ); - void ADIReadFileL( const TDesC& aDestinationFileName, const TMMCScBkupArchiveVector& aInfo, TRequestStatus& aStatus ); - // - void ADIWriteCompressedL( const TDesC8& aData, TRequestStatus& aObserver ); - void ADIReadDecompressedL( TDes8& aSink, const TMMCScBkupArchiveVector& aInfo, TRequestStatus& aStatus ) ; - // - void ADIAsynchronousCancel(); - void ADIResetResources(TMMCScBkupOperationType aType); -#ifdef RD_FILE_MANAGER_BACKUP - void ADIActivateCrcCalculation(TBool aType) { iCrcCalcActivated = aType; } - TUint32 ADIArchiveCrc() { return iCrc; } -#endif - - - private: // Internal enumerations - - /** - * - */ - enum TOperation - { - EOperationIdle = 0, - EOperationCompressing, - EOperationDecompressing - }; - - private: // Internal methods - - /** - * - */ - void EnsureCompressorExistsL(MEZBufferManager& aBufferManager); - - /** - * - */ - void EnsureDecompressorExistsL(MEZBufferManager& aBufferManager); - - /** - * - */ - void SetObserver(TRequestStatus& aStatus); - - /** - * - */ - void CompleteSelf(TInt aCompletionCode = KErrNone); - - /** - * - */ - void CompleteObserver(TInt aCompletionCode = KErrNone); - - /** - * - */ - void SetOperation(TOperation aOperation); - -#ifdef RD_FILE_MANAGER_BACKUP - /** - * - */ - void CalculateCrc( const TAny* aPtr,TInt aLength ); -#endif - - - private: // From CActive - void RunL(); - void DoCancel(); - TInt RunError(TInt aError); - - private: // Member data - - // Owned externally: - // - RFs& iFsSession; - // - RFile64& iFile; - // - MMMCScBkupProgressObserver& iProgressManager; - // - TRequestStatus* iObserverStatus; - - // Owned by this object - // - TOperation iOperation; - // - CMMCScBkupBufferManagerBase* iBufferManager; - // - CEZCompressor* iCompressor; - // - CEZDecompressor* iDecompressor; - // - TMMCScBkupArchiveVector iCurrentVectorInfo; - // - TMMCScBkupArchiveVector iOverallArchiveVectorInfo; - // - RMMCScBkupArchiveWriteStream iWriteStream; - // - RMMCScBkupArchiveReadStream iReadStream; -#ifdef RD_FILE_MANAGER_BACKUP - // - TBool iCrcCalcActivated; - // - TUint32 iCrc; -#if defined(__MMCSCBKUPLOGGING_ENABLED__) - TUint32 iTotalTickCount; -#endif -#endif // RD_FILE_MANAGER_BACKUP - - friend class RMMCScBkupArchiveBuf; - }; - - - - -#endif // __CMMCSCBKUPARCHIVEDATAMANAGER_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupArchiveFooter.h --- a/filemanager/bkupengine/inc/CMMCScBkupArchiveFooter.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration of CMMCScBkupArchiveFooter -* -* -*/ - -#ifndef __CMMCSCBKUPARCHIVEFOOTER_H__ -#define __CMMCSCBKUPARCHIVEFOOTER_H__ - -// System includes -#include - -// User includes -#include "CMMCScBkupIndexBase.h" -#include "RMMCScBkupPointerArray.h" -#include "TMMCScBkupDriveAndSize.h" - -// Classes referenced -class MMMCScBkupDriver; -class MMMCScBkupArchiveDataInterface; -class CMMCScBkupIndexRegistrationData; - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupArchiveFooter) : public CBase - { - public: - - /** - * Static constructor - */ - static CMMCScBkupArchiveFooter* NewL( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ); - - /** - * C++ destructor - */ - ~CMMCScBkupArchiveFooter(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupArchiveFooter( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ); - - /** - * - */ - void ConstructL(); - - public: // API - - /** - * - */ - CMMCScBkupIndexBase& IndexByType( TMMCScBkupOwnerDataType aType ); - - /** - * - */ - CMMCScBkupIndexBase* IndexByTypeOrNull( TMMCScBkupOwnerDataType aType ); - - public: // Store/Restore - - /** - * - */ - void StoreL(); - - /** - * - */ - void RestoreL( TInt aCalculatedFooterOffsetWithinArchive ); - - private: // Internal enumerations - enum - { - EStreamFormatVersion1 = 1 - }; - - private: // Member data - - // - MMMCScBkupArchiveDataInterface& iDataInterface; - // - MMMCScBkupDriver& iDriver; - // - RMMCScBkupPointerArray< CMMCScBkupIndexBase > iIndicies; - }; - - - - -#endif // __CMMCSCBKUPARCHIVEFOOTER_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupArchiveHeader.h --- a/filemanager/bkupengine/inc/CMMCScBkupArchiveHeader.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration of CMMCScBkupArchiveHeader -* -* -*/ - -#ifndef __CMMCSCBKUPARCHIVEHEADER_H__ -#define __CMMCSCBKUPARCHIVEHEADER_H__ - -// System includes -#include -#include - -// User includes -#include "MMCScBkupArchiveFlags.h" - -// Classes referenced -class MMMCScBkupDriver; -class MMMCScBkupArchiveDataInterface; - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupArchiveHeader) : public CBase - { - public: - - /** - * Static constructor - */ - static CMMCScBkupArchiveHeader* NewL( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ); - - /** - * C++ destructor - */ - ~CMMCScBkupArchiveHeader(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupArchiveHeader( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ); - - /** - * - */ - void ConstructL(); - - public: // API - - /** - * - */ - void StoreL(TBitFlags aCategory); - - /** - * - */ - void RestoreL(); - - public: // For Archive Utils - - /** - * - */ - inline void SetCheckedUid( const TCheckedUid& aCheckedUid ) { iCheckedUid = aCheckedUid; } - - /** - * - */ - inline const TCheckedUid& CheckedUid() const { return iCheckedUid; } - - /** - * - */ - inline void SetVersion( const TVersion& aVersion ) { iVersion = aVersion; } - - /** - * - */ - inline const TVersion& Version() const { return iVersion; } - - /** - * - */ - inline void SetFooterLength( TInt aLength ) { iFooterLength = aLength; } - - /** - * - */ - inline TInt FooterLength() const { return iFooterLength; } - - /** - * - */ - void SetPhoneModelIdentifierL( const TDesC8& aModel ); - - /** - * - */ - inline const TDesC8& PhoneModelIdentifier() const { return *iPhoneModelIdentifier; } - - /** - * - */ - inline void SetArchiveFlags( TUint32 aFlagsValue ) { iArchiveFlags.SetValue( aFlagsValue ); } - - /** - * - */ - inline const TBitFlags32& ArchiveFlags() const { return iArchiveFlags; } - - private: // Member data - - // - MMMCScBkupArchiveDataInterface& iDataInterface; - // - MMMCScBkupDriver& iDriver; - // - TCheckedUid iCheckedUid; - // - TVersion iVersion; - // - TInt iFooterLength; - // - HBufC8* iPhoneModelIdentifier; - // - TBitFlags32 iArchiveFlags; - - }; - - - - -#endif // __CMMCSCBKUPARCHIVEHEADER_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupArchiveInfo.h --- a/filemanager/bkupengine/inc/CMMCScBkupArchiveInfo.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,172 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration of CMMCScBkupArchiveInfo -* -* -*/ - -#ifndef __CMMCSCBKUPARCHIVEINFO_H__ -#define __CMMCSCBKUPARCHIVEINFO_H__ - -// System includes -#include -#include -#include - -#include "CMMCScBkupFileInfo.h" - -/** -* Class for encapsulating category specific information -* -* @since 3.2 -*/ -NONSHARABLE_CLASS(CMMCScBkupArchiveInfo) : public CBase - { - public: - - /** - * Static constructor - */ - static CMMCScBkupArchiveInfo* NewL( TResourceReader& aReader ); - - /** - * Static constructor - */ - static CMMCScBkupArchiveInfo* NewL( const TEntry& aEntry ); - - /** - * Static constructor - */ - static CMMCScBkupArchiveInfo* NewLC( const TEntry& aEntry ); - - /** - * C++ destructor - */ - ~CMMCScBkupArchiveInfo(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupArchiveInfo(); - - /** - * C++ default constructor - */ - //CMMCScBkupArchiveInfo( const TEntry& aEntry ); - - /** - * - */ - void ConstructL( const TEntry& aEntry ); - - public: // API - Setters - - /** - * - */ - void SetTargetDrive( TDriveUnit aDrive ) { iTargetDrive = aDrive; } - - /** - * - */ - void SetCategory(TBitFlags aCategories) { iCategory = aCategories; } - - /** - * - */ - void SetSpecialFlags(TBitFlags aFlags) { iSpecialFlags = aFlags; } - - /** - * - */ - void SetExcludedSpecialFlags(TBitFlags aFlags) { iExcludedSpecialFlags = aFlags; } - - /** - * - */ - void SetSIDs( RArray& aSIDs ); - - /** - * - */ - void SetExcludedSIDs( RArray& aExcludedSIDs ); - - public: // API - Getters - - /** - * - */ - IMPORT_C TBitFlags Category() const; - - /** - * - */ - IMPORT_C const TDesC& FileName() const; - - /** - * - */ - IMPORT_C const TTime& DateTime() const; - - /** - * - */ - IMPORT_C TDriveNumber Drive() const; - - /** - * - */ - TBitFlags SpecialFlags() const { return iSpecialFlags; } - - /** - * - */ - TBitFlags ExcludedSpecialFlags() const { return iExcludedSpecialFlags; } - - /** - * - */ - const RArray& SIDs( TBitFlags aCategory ) const; - - /** - * - */ - const RArray& ExcludedSIDs( TBitFlags aCategory ) const; - - private: // Member data - - // - TDriveUnit iTargetDrive; - // - TBitFlags iCategory; - // - TBitFlags iSpecialFlags; - // - TBitFlags iExcludedSpecialFlags; - // - CMMCScBkupFileInfo* iFileInfo; - // - RArray iSecureIds; - // - RArray iExcludedSecureIds; - }; - - - - -#endif // __CMMCSCBKUPARCHIVEINFO_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupBufferManagers.h --- a/filemanager/bkupengine/inc/CMMCScBkupBufferManagers.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,428 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration of CMMCScBkupBufferManagerBase -* -* -*/ - -#ifndef __CMMCSCBKUPBUFFERMANAGERS_H__ -#define __CMMCSCBKUPBUFFERMANAGERS_H__ - -// User includes -#include -#include -#include -#include - -// User includes -#include "TMMCScBkupArchiveVector.h" - -// Classes referenced -class MMMCScBkupArchiveDataInterface; -class CMMCScBkupDataStrategy; -class MMMCScBkupProgressObserver; - -// Constants -const TInt KScBkupDefaultBufferSize = 0x4000; - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupBufferManagerBase) : public CBase, public MEZBufferManager - { - public: // Enumerations - - /** - * - */ - enum TType - { - ETypeDescriptorToArchive = 0, - ETypeFileToArchive, - ETypeArchiveToDescriptor, - ETypeArchiveToFile - }; - - public: // Construct / destruct - - /** - * - */ - static CMMCScBkupBufferManagerBase* NewByTypeL( TType aType, MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI, TAny* aParam1 = NULL, TAny* aParam2 = NULL ); - - /** - * - */ - ~CMMCScBkupBufferManagerBase(); - - protected: // Internal construct - - /** - * - */ - CMMCScBkupBufferManagerBase( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI, TType aType ); - - /** - * - */ - virtual void ConstructL( TInt aBufferSize = KScBkupDefaultBufferSize ); - - public: // Framework API - - /** - * - */ - inline TType Type() const { return iType; } - - /** - * - */ - inline const TMMCScBkupArchiveVector& Info() const { return iInfo; } - - /** - * - */ - inline TMMCScBkupArchiveVector& Info() { return iInfo; } - - /** - * - */ - virtual void InitializeL( TAny* aParam1 = NULL, TAny* aParam2 = NULL ) = 0; - - protected: // Internal methods - - /** - * - */ - inline TPtr8& WriteBuffer() { return iBufferPointer; } - - /** - * - */ - inline const TDesC8& DataView() const { return *iBuffer; } - - /** - * - */ - inline MMMCScBkupProgressObserver& ProgressManager() const { return iProgressManager; } - - /** - * - */ - inline MMMCScBkupArchiveDataInterface& ADI() const { return iADI; } - - /** - * - */ - void WriteToArchiveAndUpdateStatsL( const TDesC8& aData ); - - private: - - /** - * - */ - TType iType; - - /** - * - */ - HBufC8* iBuffer; - - /** - * - */ - TPtr8 iBufferPointer; - - /** - * - */ - MMMCScBkupProgressObserver& iProgressManager; - - /** - * - */ - MMMCScBkupArchiveDataInterface& iADI; - - /** - * - */ - TMMCScBkupArchiveVector iInfo; - }; - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupBufferManagerDescriptorToArchive) : public CMMCScBkupBufferManagerBase - { - private: - - /** - * - */ - CMMCScBkupBufferManagerDescriptorToArchive( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); - - /** - * - */ - static CMMCScBkupBufferManagerDescriptorToArchive* NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); - - public: // From CMMCScBkupBufferManagerBase - void InitializeL(TAny* aParam1, TAny* aParam2); - - private: // From MEZBufferManager - void InitializeL( CEZZStream& aZStream ); - void NeedInputL( CEZZStream& aZStream ); - void NeedOutputL( CEZZStream& aZStream ); - void FinalizeL( CEZZStream& aZStream ); - - private: // Data members - - /** - * - */ - TPtrC8 iSource; - - friend class CMMCScBkupBufferManagerBase; - }; - - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupBufferManagerFileToArchive) : public CMMCScBkupBufferManagerBase - { - public: - - /** - * - */ - ~CMMCScBkupBufferManagerFileToArchive(); - - private: - - /** - * - */ - CMMCScBkupBufferManagerFileToArchive( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); - - /** - * - */ - void ConstructL(const TDesC& aFileName); - - /** - * - */ - static CMMCScBkupBufferManagerFileToArchive* NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); - - public: // From CMMCScBkupBufferManagerBase - void InitializeL(TAny* aParam1, TAny* aParam2); - - private: // From MEZBufferManager - void InitializeL( CEZZStream& aZStream ); - void NeedInputL( CEZZStream& aZStream ); - void NeedOutputL( CEZZStream& aZStream ); - void FinalizeL( CEZZStream& aZStream ); - - private: // Data members - - /** - * - */ - CMMCScBkupDataStrategy* iReadStrategy; - - /** - * - */ - HBufC8* iOutput; - - /** - * - */ - TPtr8 iOutputPointer; - - /** - * Useful for debugging - */ - TPtrC iFileName; - - friend class CMMCScBkupBufferManagerBase; - }; - - - - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupBufferManagerArchiveToDescriptor) : public CMMCScBkupBufferManagerBase - { - public: - - /** - * - */ - ~CMMCScBkupBufferManagerArchiveToDescriptor(); - - private: - - /** - * - */ - CMMCScBkupBufferManagerArchiveToDescriptor( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); - - /** - * - */ - static CMMCScBkupBufferManagerArchiveToDescriptor* NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); - - public: // From CMMCScBkupBufferManagerBase - void InitializeL(TAny* aParam1, TAny* aParam2); - - private: // From MEZBufferManager - void InitializeL( CEZZStream& aZStream ); - void NeedInputL( CEZZStream& aZStream ); - void NeedOutputL( CEZZStream& aZStream ); - void FinalizeL( CEZZStream& aZStream ); - - private: // Internal methods - - /** - * - */ - void TryToReadMoreSourceDataL(); - - private: // Data members - - /** - * - */ - TPtr8 iOutputPointer; - - friend class CMMCScBkupBufferManagerBase; - }; - - - - - - - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupBufferManagerArchiveToFile) : public CMMCScBkupBufferManagerBase - { - public: - - /** - * - */ - ~CMMCScBkupBufferManagerArchiveToFile(); - - private: - - /** - * - */ - CMMCScBkupBufferManagerArchiveToFile( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); - - /** - * - */ - void ConstructL(const TDesC& aFileName); - - /** - * - */ - static CMMCScBkupBufferManagerArchiveToFile* NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); - - public: // From CMMCScBkupBufferManagerBase - void InitializeL(TAny* aParam1, TAny* aParam2); - - private: // From MEZBufferManager - void InitializeL( CEZZStream& aZStream ); - void NeedInputL( CEZZStream& aZStream ); - void NeedOutputL( CEZZStream& aZStream ); - void FinalizeL( CEZZStream& aZStream ); - - private: // Internal methods - - /** - * - */ - void TryToReadMoreSourceDataL(); - - private: // Data members - - /** - * - */ - CMMCScBkupDataStrategy* iWriteStrategy; - - /** - * - */ - HBufC8* iOutput; - - /** - * - */ - TPtr8 iOutputPointer; - - /** - * Needed, since we restore to temporary file - * and then delete and rename temp file if - * extraction succeeds. - */ - TPtrC iFileName; - - friend class CMMCScBkupBufferManagerBase; - }; - - - - - - - - - - - - - - - -#endif // __CMMCSCBKUPBUFFERMANAGERS_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupDataOwnerCollection.h --- a/filemanager/bkupengine/inc/CMMCScBkupDataOwnerCollection.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,219 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of CMMCScBkupDataOwnerCollection -* -* -*/ - -#ifndef __CMMCSCBKUPDATAOWNERCOLLECTION_H__ -#define __CMMCSCBKUPDATAOWNERCOLLECTION_H__ - -// System includes -#include -#include -#include -#include - -// User includes -#include "RMMCScBkupPointerArray.h" - -// Namespaces -using namespace conn; - -// Classes referenced -class MMMCScBkupDriver; -class CMMCScBkupDriveSizer; -class CMMCScBkupDataOwnerInfo; - -#ifndef RD_FILE_MANAGER_BACKUP -// Type definitions -typedef RPointerArray RDataOwnerInfoArray; -#endif - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupDataOwnerCollection) : public CBase - { - public: - - /** - * Static constructor - */ - static CMMCScBkupDataOwnerCollection* NewL( MMMCScBkupDriver& aDriver, TBitFlags aCategory ); - - /** - * C++ destructor - */ - ~CMMCScBkupDataOwnerCollection(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupDataOwnerCollection( MMMCScBkupDriver& aDriver, TBitFlags aCategory ); - - /** - * - */ - void ConstructL(); - - public: // API - - /** - * - */ -#ifdef RD_FILE_MANAGER_BACKUP - TBool AssignL( const CMMCScBkupDataOwnerInfo& dataOwnersInfo ); -#else - void AssignL( RDataOwnerInfoArray& aArray ); -#endif - - /** - * - */ - void AppendL( CMMCScBkupDataOwnerInfo* aNewEntry ); - - /** - * - */ - TInt Count() const; - - /** - * - */ - CMMCScBkupDataOwnerInfo& Owner( TInt aIndex ); - - /** - * - */ - const CMMCScBkupDataOwnerInfo& Owner( TInt aIndex ) const; - - /** - * - */ - CMMCScBkupDataOwnerInfo& OwnerL( TSecureId aSID ); - - /** - * - */ - const CMMCScBkupDataOwnerInfo& OwnerL( TSecureId aSID ) const; - - /** - * - */ - CMMCScBkupDataOwnerInfo& OwnerL( TUid aPackageId ); - - /** - * - */ - const CMMCScBkupDataOwnerInfo& OwnerL( TUid aPackageId ) const; - - /** - * - */ - CMMCScBkupDataOwnerInfo& OwnerL( const TDesC& aHash ); - - /** - * - */ - const CMMCScBkupDataOwnerInfo& OwnerL( const TDesC& aHash ) const; - - /** - * - */ - void Remove( TInt aIndex ); - - /** - * - */ - void Reset(); - - /** - * The amount of space required spanning all drives. - * This is used as the total progress amount during - * restore operations. - */ - TInt64 TotalOperationalSizeL() const; - - /** - * Whether one or more data owners require a reboot - * after restore has completed. - */ - TBool RebootRequired() const; - - /** - * - */ - TInt64 DiskSpaceRequiredForRestore( TDriveNumber aDrive ) const; - - /** - * - */ - void CalculateDiskSpaceRequiredForRestoreL(); - - /** - * - */ - TBitFlags Category() const { return iCategory; } - - public: - - /** - * Internalize 'iRestoreSizer' from stream - */ - void InternalizeL( RReadStream& aStream ); - - /** - * Externalize 'iRestoreSizer' to stream - */ - void ExternalizeL( RWriteStream& aStream ) const; - - private: - -#ifdef RD_FILE_MANAGER_BACKUP - /** - * - */ - TBool BelongsToL(const CMMCScBkupDataOwnerInfo& aInfo, TBitFlags aFlags, TBitFlags aExcludedFlags, - const RArray aSecureIds, const RArray aExcludedSecureIds) const; -#endif - - private: // Internal enumerations - enum - { - EStreamFormatVersion1 = 1 - }; - - private: // Member data - - // - MMMCScBkupDriver& iDriver; - // Array of data owners - RMMCScBkupPointerArray iOwners; - // - CMMCScBkupDriveSizer* iRestoreSizer; - // - TBitFlags iCategory; - }; - - - - -#endif // __CMMCSCBKUPDATAOWNERCOLLECTION_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupDataOwnerInfo.h --- a/filemanager/bkupengine/inc/CMMCScBkupDataOwnerInfo.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,253 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of CMMCScBkupDataOwnerInfo -* -* -*/ - -#ifndef __CMMCSCBKUPDATAOWNERINFO_H__ -#define __CMMCSCBKUPDATAOWNERINFO_H__ - -// System includes -#include -#include -#include - -// User includes -#include "TMMCScBkupOwnerDataType.h" - -// Classes referenced -class TMMCScBkupDriveAndSize; -class CMMCScBkupDataTypeSizer; -class MMMCScBkupArchiveDataInterface; - -// Namespaces -using namespace conn; - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupDataOwnerInfo) : public CBase - { - public: - - /** - * Static constructor - */ - static CMMCScBkupDataOwnerInfo* NewLC( CDataOwnerInfo* aOwner ); - - /** - * Static constructor - */ - static CMMCScBkupDataOwnerInfo* NewLC( RReadStream& aStream ); - - /** - * Static constructor - */ - static CMMCScBkupDataOwnerInfo* New( TSecureId aSecureId ); - - /** - * C++ destructor - */ - ~CMMCScBkupDataOwnerInfo(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupDataOwnerInfo( CDataOwnerInfo* aOwner = NULL ); - - /** - * - */ - void ConstructL(); - - public: // API - - /** - * - */ - CDataOwnerInfo& Owner(); - - /** - * - */ - const CDataOwnerInfo& Owner() const; - - /** - * - */ - TDataOwnerStatus Status() const; - - /** - * - */ - void SetStatus( TDataOwnerStatus aStatus ); - - /** - * - */ - void AddToOperationalSizeL( TMMCScBkupOwnerDataType aType, TDriveNumber aDrive, TInt64 aSize ); - - /** - * - */ - void SetOperationalSizeL( TMMCScBkupOwnerDataType aType, TDriveNumber aDrive, TInt64 aSize ); - - /** - * - */ - void ResetOperationalSize( TMMCScBkupOwnerDataType aType ); - - /** - * - */ - TInt64 OperationalSize( TMMCScBkupOwnerDataType aType ) const; - - /** - * - */ - TInt64 OperationalSize( TMMCScBkupOwnerDataType aType, TDriveNumber aDrive ) const; - - /** - * - */ - TInt64 OperationalSize( TDriveNumber aDrive ) const; - - /** - * - */ - void OperationalSizesL( RArray& aSizes ) const; - - /** - * - */ - inline TSecureId SecureId() const { return iSecureId; } - - /** - * - */ - TInt NumberOfOperationsRequiredL() const; - - /** - * - */ - void SetCompletionStatus( TMMCScBkupOwnerDataType aType, TBool aCompleted ); - - /** - * - */ - TBool CompletionStatus( TMMCScBkupOwnerDataType aType ) const; - - /** - * - */ - TInt ActiveDataRetryCount() const; - - /** - * - */ - void SetActiveDataRetryCount( TInt aCount ); - - /** - * - */ - inline TInt Version() const { return iVersion; } - - public: // Store/Restore - - /** - * - */ - void InternalizeL( RReadStream& aStream ); - - /** - * - */ - void ExternalizeL( RWriteStream& aStream ) const; - - public: // Comparison support - - /** - * - */ - static TBool CompareDataOwnerBySIDL( const CMMCScBkupDataOwnerInfo& aLeft, const CMMCScBkupDataOwnerInfo& aRight ); - - /** - * - */ - TBool HasJavaDataL() const; - - /** - * - */ - TBool HasActiveDataL() const; - - /** - * - */ - TBool HasPassiveDataL() const; - - /** - * - */ - TBool HasPublicDataL() const; - - /** - * - */ - TBool HasSystemDataL() const; - - private: // Internal enumerations - enum - { - EStreamFormatVersion1 = 1, - EStreamFormatVersion2, - EStreamFormatVersionLatest - }; - - public: // Public enumerations - enum - { - EStreamFormatVersionFirst = EStreamFormatVersion1 - }; - - private: // Member data - - // Underlying data owner - owned by this object - CDataOwnerInfo* iDataOwner; - // Associated secure id of the data owner (if it has one) - TSecureId iSecureId; - // Ready status of the data owner - TDataOwnerStatus iStatus; - // Size of data that the owner has to backup/restore - CMMCScBkupDataTypeSizer* iOperationalSize; - // The completion status of each individual element - TFixedArray iCompletionStatus; - // For active data, we record how many times the SID has returned "not ready" - TInt iActiveDataRetryCount; - // Version information - TInt iVersion; - }; - - - - -#endif // __CMMCSCBKUPDATAOWNERINFO_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupDataStrategies.h --- a/filemanager/bkupengine/inc/CMMCScBkupDataStrategies.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,224 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration of CMMCScBkupDataStrategy -* -* -*/ - -#ifndef __CMMCSCBKUPDATASTRATEGIES_H__ -#define __CMMCSCBKUPDATASTRATEGIES_H__ - -// User includes -#include - -// Constants -const TBool KMMCScBkupUseTempFile = EFalse; - - -/** -* -* -* @since 3.0 -*/ -class CMMCScBkupDataStrategy : public CBase - { - public: - - /** - * Factory method - */ - static CMMCScBkupDataStrategy* ReadStrategyLC( const TDesC& aName, RFs& aFsSession ); - - /** - * Factory method - */ - static CMMCScBkupDataStrategy* ReadStrategyLC( const TDesC& aName, RFs& aFsSession, TInt aStartOffset, TInt aLengthToRead ); - - /** - * Factory method - */ - static CMMCScBkupDataStrategy* WriteStrategyLC( const TDesC& aName, RFs& aFsSession, TBool aUseTempFile ); - - public: // Framework API - - /** - * Read data from the source - * - * @return TInt The amount of data read, or 0 if the end of file has been reached - */ - virtual TInt Read(TDes8& aSink) = 0; - - /** - * Write data to the source - * - * @return TInt KErrNone if success, KErrNotSupported if the strategy doesn't support writing - * or any of the other System-Wide error codes upon failure. - */ - virtual TInt Write(const TDesC8& aSource); - - /** - * Perform any final actions - * - * @return TInt an error code. - */ - virtual TInt Finalize(); - - protected: - - /** - * C++ Constructor - */ - CMMCScBkupDataStrategy(); - - private: // Internal methods - - /** - * Sets the offset and length - */ - void SetOffsetAndLength(TInt aStartOffset, TInt aLengthToRead); - - protected: // Internal - inline TInt Offset() const { return iOffset; } - inline TInt LengthToRead() const { return iLengthToRead; } - inline void SetOffset(TInt64 aOffset) { iOffset = aOffset; } - - private: // Data members - - // - TInt iOffset; - // - TInt iLengthToRead; - }; - - - - - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupDataFileStrategy) : public CMMCScBkupDataStrategy - { - public: - - /** - * Static constructor - */ - static CMMCScBkupDataFileStrategy* NewForReadingL( const TDesC& aName, RFs& aFsSession ); - - /** - * Static constructor - */ - static CMMCScBkupDataFileStrategy* NewForWritingL( const TDesC& aName, RFs& aFsSession, TBool aUseTempFile ); - - /** - * C++ Destructor - */ - ~CMMCScBkupDataFileStrategy(); - - private: - - /** - * C++ Constructor - */ - CMMCScBkupDataFileStrategy( RFs& aFsSession, TBool aUseTempFile = EFalse ); - - /** - * Second phase construction - */ - void ConstructL( const TDesC& aName, TUint aMode ); - - public: // From CMMCScBkupDataStrategy - TInt Read(TDes8& aSink); - TInt Write(const TDesC8& aSource); - TInt Finalize(); - - private: // Internal functions - - /** - * - */ - static TInt PrepareToOverwriteFile( RFs& aFsSession, const TDesC& aFileName ); - - private: // Data members - - RFs& iFsSession; - // - RFile64 iFile; - // - TBool iUseTempFile; - // - HBufC* iFileName; - // - TFileName iTempFileName; - }; - - - - - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupDataFileSectionReadStrategy) : public CMMCScBkupDataStrategy - { - public: - - /** - * Static constructor - */ - static CMMCScBkupDataFileSectionReadStrategy* NewL(const TDesC& aName, RFs& aFsSession); - - /** - * C++ Destructor - */ - ~CMMCScBkupDataFileSectionReadStrategy(); - - private: - - /** - * C++ Constructor - */ - CMMCScBkupDataFileSectionReadStrategy(RFs& aFsSession); - - /** - * - */ - void ConstructL(const TDesC& aName); - - public: // From CMMCScBkupDataStrategy - TInt Read(TDes8& aSink); - - private: // Data members - - // - RFs& iFsSession; - // - HBufC* iFileName; - }; - - - - -#endif // __CMMCSCBKUPDATASTRATEGIES_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupDriveAndOperationTypeManager.h --- a/filemanager/bkupengine/inc/CMMCScBkupDriveAndOperationTypeManager.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration of CMMCScBkupDriveAndOperationTypeManager -* -* -*/ - -#ifndef __CMMCSCBKUPDRIVEANDOPERATIONTYPEMANAGER_H__ -#define __CMMCSCBKUPDRIVEANDOPERATIONTYPEMANAGER_H__ - -// System includes -#include -#include -#include - -// User includes -#include "TMMCScBkupOwnerDataType.h" - -// Namespaces -using namespace conn; - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(TMMCScBkupDriveAndOperationType) - { - public: - inline TMMCScBkupDriveAndOperationType() - : iDrive( EDriveC ), iType( EMMCScBkupOwnerDataTypeAny ) { } - - inline TMMCScBkupDriveAndOperationType( TDriveNumber aDrive, TMMCScBkupOwnerDataType aType ) - : iDrive( aDrive ), iType( aType ) { } - - public: // Common attributes - - /** - * - */ - inline TDriveNumber Drive() const { return iDrive; } - - /** - * - */ - inline void SetDrive( TDriveNumber aDrive ) { iDrive = aDrive; } - - /** - * - */ - inline TMMCScBkupOwnerDataType DataType() const { return iType; } - - /** - * - */ - inline void SetDataType( TMMCScBkupOwnerDataType aType ) { iType = aType; } - - private: // Data members - - // - TDriveNumber iDrive; - // - TMMCScBkupOwnerDataType iType; - }; - - - - - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupDriveAndOperationTypeManager) : public CBase - { - public: - - /** - * - */ - IMPORT_C static CMMCScBkupDriveAndOperationTypeManager* NewL( TResourceReader& aReader ); - - /** - * - */ - IMPORT_C ~CMMCScBkupDriveAndOperationTypeManager(); - - private: - - /** - * - */ - CMMCScBkupDriveAndOperationTypeManager(); - - /** - * - */ - void ConstructL( TResourceReader& aReader ); - - - public: // API - - /** - * - */ - TInt Count() const; - - /** - * - */ - const TMMCScBkupDriveAndOperationType& At( TInt aIndex ) const; - - /** - * - */ - inline const TDriveList& DriveList() const { return iCalculatedDriveList; } - - /** - * - */ - TBool IsDataTypeAllowedToAccessDrive( TDriveNumber aDrive, TMMCScBkupOwnerDataType aDataType ) const; - - private: // Internal methods - - - private: // Data members - - // - RArray< TMMCScBkupDriveAndOperationType > iEntries; - // - TDriveList iCalculatedDriveList; - - }; - -#endif // __CMMCSCBKUPDRIVEANDOPERATIONTYPEMANAGER_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupDriveDataSizeManager.h --- a/filemanager/bkupengine/inc/CMMCScBkupDriveDataSizeManager.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,247 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of CMMCScBkupDriveSizer -* -* -*/ - -#ifndef __CMMCSCBKUPDRIVEDATASIZEMANAGER_H__ -#define __CMMCSCBKUPDRIVEDATASIZEMANAGER_H__ - -// System includes -#include -#include - -// User includes -#include "TMMCScBkupDriveAndSize.h" -#include "RMMCScBkupPointerArray.h" -#include "TMMCScBkupOwnerDataType.h" - - -/** -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupDriveSizer) : public CBase - { - public: - - /** - * - */ - static CMMCScBkupDriveSizer* NewLC( TMMCScBkupOwnerDataType aType ); - - /** - * - */ - static CMMCScBkupDriveSizer* NewLC( RReadStream& aStream ); - - /** - * C++ destructor - */ - ~CMMCScBkupDriveSizer(); - - private: - - /** - * C++ constructor - */ - CMMCScBkupDriveSizer( TMMCScBkupOwnerDataType aType ); - - /** - * - */ - void ConstructL(); - - public: // API - - /** - * - */ - inline TMMCScBkupOwnerDataType DataType() const { return iDataType; } - - /** - * - */ - void AddToSizeL( TInt64 aAmount, TDriveNumber aDrive ); - - /** - * - */ - void Reset(); - - /** - * - */ - void Reset( TDriveNumber aDrive ); - - /** - * - */ - TInt64 Size() const; - - /** - * - */ - TInt64 Size( TDriveNumber aDrive ) const; - - public: - - /** - * Internalize object from stream - */ - void InternalizeL( RReadStream& aStream ); - - /** - * Externalize object to stream - */ - void ExternalizeL( RWriteStream& aStream ) const; - - private: // Internal methods - - /** - * - */ - TMMCScBkupDriveAndSize* EntryByDrive( TDriveNumber aDrive ); - - private: // Internal enumerations - enum - { - EStreamFormatVersion1 = 1 - }; - - private: // Data members - - // - RArray iEntries; - // - TMMCScBkupOwnerDataType iDataType; - }; - - - - - - -/** -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupDataTypeSizer) : public CBase - { - public: - - /** - * - */ - static CMMCScBkupDataTypeSizer* NewL(); - - /** - * - */ - static CMMCScBkupDataTypeSizer* NewLC( RReadStream& aStream ); - - /** - * C++ destructor - */ - ~CMMCScBkupDataTypeSizer(); - - private: - - /** - * C++ constructor - */ - CMMCScBkupDataTypeSizer(); - - /** - * - */ - void ConstructL(); - - public: // API - - /** - * - */ - void AddToSizeL( TMMCScBkupOwnerDataType aDataType, TInt64 aAmount, TDriveNumber aDrive ); - - /** - * - */ - void Reset( TMMCScBkupOwnerDataType aDataType ); - - /** - * - */ - void Reset( TMMCScBkupOwnerDataType aDataType, TDriveNumber aDrive ); - - /** - * - */ - TInt64 Size( TMMCScBkupOwnerDataType aDataType ) const; - - /** - * - */ - TInt64 Size( TMMCScBkupOwnerDataType aDataType, TDriveNumber aDrive ) const; - - /** - * - */ - void GetSizesL( RArray& aSizes ) const; - - /** - * - */ - TInt64 CombinedSize( TDriveNumber aDrive ) const; - - public: - - /** - * Internalize object from stream - */ - void InternalizeL( RReadStream& aStream ); - - /** - * Externalize object to stream - */ - void ExternalizeL( RWriteStream& aStream ) const; - - private: // Internal methods - - /** - * - */ - CMMCScBkupDriveSizer* SizerByDataType( TMMCScBkupOwnerDataType aDataType ); - - private: // Internal enumerations - enum - { - EStreamFormatVersion1 = 1 - }; - - private: // Data members - - // - RMMCScBkupPointerArray iSizers; - }; - - - - - - -#endif // __CMMCSCBKUPDRIVEDATASIZEMANAGER_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupDriveSpecificRequest.h --- a/filemanager/bkupengine/inc/CMMCScBkupDriveSpecificRequest.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration of CMMCScBkupDriveSpecificRequest -* -* -*/ - -#ifndef __CMMCSCBKUPDRIVESPECIFICREQUEST_H__ -#define __CMMCSCBKUPDRIVESPECIFICREQUEST_H__ - -// System includes -#include -#include - -// User includes -#include "TMMCScBkupOwnerDataType.h" - -// Classes referenced -class CMMCScBkupDriveAndOperationTypeManager; - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupDriveSpecificRequest) : public CActive - { - protected: - - /** - * C++ default constructor - */ - CMMCScBkupDriveSpecificRequest( const CMMCScBkupDriveAndOperationTypeManager& aDriveAndOperations, TMMCScBkupOwnerDataType aDataType, CActive::TPriority aPriority = CActive::EPriorityIdle ); - - /** - * Second phase constructor - */ - void ConstructL( ); - - public: - - /** - * C++ destructor - */ - ~CMMCScBkupDriveSpecificRequest(); - - protected: // API - - /** - * - */ - virtual void RequestL( TRequestStatus& aObserver ); - - protected: // Internal methods - - /** - * - */ - TBool NextValidDrive(TDriveNumber& aDrive); - - /** - * - */ - TBool NextValidDrive(TDriveNumber& aDrive, const TDriveList& aCrossCheckList); - - /** - * Return the current drive - */ - TDriveNumber CurrentDrive() const; - - /** - * - */ - void CompleteObserverRequest(TInt aCompletionCode); - - /** - * - */ - void CompleteSelf(TInt aCompletionCode = KErrNone); - - /** - * - */ - inline const CMMCScBkupDriveAndOperationTypeManager& DriveAndOperations() const { return iDriveAndOperations; } - - private: // From CActive - - /** - * Default behaviour is to do nothing - */ - void DoCancel(); - - /** - * Complete's observer with the error code - */ - TInt RunError(TInt aError); - - private: // Member data - - // - const CMMCScBkupDriveAndOperationTypeManager& iDriveAndOperations; - // - TMMCScBkupOwnerDataType iDataType; - // - TInt iCurrentDrive; - // - TRequestStatus* iObserver; - }; - - - - - - - - -#endif // __CMMCSCBKUPARCHIVE_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupEngine.h --- a/filemanager/bkupengine/inc/CMMCScBkupEngine.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Scans for names of the files according to array. -* -*/ - -#ifndef __CMMCSCBKUPENGINE_H__ -#define __CMMCSCBKUPENGINE_H__ - -// User includes -#include "MMCScBkupOperations.h" - -// Classes referenced -class RFs; -class CMMCScBkupEngineImpl; -class CMMCScBkupOpParamsBase; -class MMMCScBkupEngineObserver; -class CMMCScBkupArchiveInfo; - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupEngine) : public CBase - { - public: - - /** - * Two-phased constructor. - */ - IMPORT_C static CMMCScBkupEngine* NewL( RFs& aFsSession ); - - /** - * Destructor - */ - IMPORT_C ~CMMCScBkupEngine(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupEngine(); - - /** - * Second phase constructor - */ - void ConstructL( RFs& aFsSession ); - - - public: // API - - /** - * NB. aParams are IMMEDIATELY owned by the engine. Do not pass them in - * left on the cleanup stack. - */ - IMPORT_C void StartOperationL(TMMCScBkupOperationType aOperation, MMMCScBkupEngineObserver& aObserver, CMMCScBkupOpParamsBase* aParams ); - - /** - * - */ - IMPORT_C void CancelOperation(); - - /** - * - */ - IMPORT_C TBool ValidArchiveForRestore( const TDesC& aFileName ); - - /** - * - */ - IMPORT_C TInt64 TotalOperationSizeL() const; - - /** - * - */ - IMPORT_C TBool RebootRequired() const; - - /** - * - */ - IMPORT_C void ListArchivesL( - RPointerArray< CMMCScBkupArchiveInfo >& aArchives, - CMMCScBkupOpParamsBase* aParams, - const TUint32 aDriveAttMatch, - const TInt aDriveMatch = KErrNotFound ) const; - - private: // Member data - - // Real engine - CMMCScBkupEngineImpl* iEngine; - }; - - - - -#endif // __CMMCSCBKUPENGINE_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupEngineImpl.h --- a/filemanager/bkupengine/inc/CMMCScBkupEngineImpl.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,278 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Scans for names of the files according to array. -* -*/ - -#ifndef __CMMCSCBKUPENGINEIMPL_H__ -#define __CMMCSCBKUPENGINEIMPL_H__ - -// System includes -#include - -// User includes -#include "MMCScBkupConfig.h" -#include "MMMCScBkupDriver.h" -#include "MMCScBkupStateIds.h" -#include "MMCScBkupOperations.h" -#include "MMMCScBkupEngineObserver.h" -#include "MMMCScBkupProgressObserver.h" - -// Namespaces -using namespace conn; - -// Classes referenced -class RFs; -class CMMCScBkupState; -class CMMCScBkupArchive; -class CMMCScBkupStateFactory; -class CMMCScBkupOpParamsBase; -class MMMCScBkupEngineObserver; -class CMMCScBkupFileListCollection; -class CMMCScBkupDataOwnerCollection; -class MMMCScBkupArchiveDataInterface; -class CMMCScBkupArchiveInfo; - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupEngineImpl) : public CActive, public MMMCScBkupDriver, public MMMCScBkupProgressObserver - { - public: - - /** - * Two-phased constructor. - */ - static CMMCScBkupEngineImpl* NewL( RFs& aFsSession ); - - /** - * Destructor - */ - ~CMMCScBkupEngineImpl(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupEngineImpl( RFs& aFsSession ); - - /** - * Second phase constructor - */ - void ConstructL( ); - - - public: // API - - /** - * - */ - void StartOperationL(TMMCScBkupOperationType aOperation, MMMCScBkupEngineObserver& aObserver, CMMCScBkupOpParamsBase* aParams ); - - /** - * - */ - void CleanupL( TInt aError = KErrNone ); - - /** - * - */ - TBool ValidArchiveForRestoreL( const TDesC& aFileName ); - - /** - * - */ - TInt64 TotalOperationSizeL() const; - - /** - * - */ - TBool RebootRequired() const; - - /** - * - */ - void ListArchivesL( - RPointerArray< CMMCScBkupArchiveInfo >& aArchives, - CMMCScBkupOpParamsBase* aParams, - const TUint32 aDriveAttMatch, - const TInt aDriveMatch ); - - private: // From MMMCScBkupDriver - void DrvHandleStateExecutionCompleteL( const CMMCScBkupState& aState ); - void DrvHandleStateExecutionCompleteL( const CMMCScBkupState& aState, TMMCScBkupStateId aNextState ); - void DrvHandleStateExecutionErrorL( const CMMCScBkupState& aState, TInt aError ); - - private: // From MMMCScBkupDriver - MMMCScBkupArchiveDataInterface& DrvADI() const; - CMMCScBkupArchive& DrvArchive() const; - CSBEClient& DrvSecureBackupClient() const; - TMMCScBkupOperationType DrvOperation() const; - CMMCScBkupOpParamsBase& DrvParamsBase() const; - CMMCScBkupDataOwnerCollection& DrvDataOwners() const; - RPointerArray& DrvDataOwnersAll(); - CMMCScBkupFileListCollection& DrvFileList() const; - TBool DrvLastCategory() const; - void DrvStoreTotalProgress(TInt64 aProgress); - TInt64 DrvTotalProgress() const; - MMMCScBkupProgressObserver& DrvProgressHandler() const; - - private: // From MMMCScBkupProgressObserver - void MMCScBkupHandleProgress( TInt aAmountCompleted ); - void MMCScBkupHandleProgressDomainUnderstood( TInt aTotalProgressAmount ); - TInt MMCScBkupHandleFreeSpace( TInt aPercentualFree ); - void MMCScBkupStartBackuping( TBool aProceed ); - - private: // From CActive - void RunL(); - void DoCancel(); - TInt RunError(TInt aError); - - private: // Internal - - /** - * - */ - void CompleteOwnRequest(TInt aCompletionCode = KErrNone, TBool aSetActive = ETrue); - - /** - * - */ - void NotifyObserver(MMMCScBkupEngineObserver::TEvent aEvent, TInt aAssociatedData = KErrNone); - - /** - * - */ - void PrepareForBackupL(TBool aPartial); - - /** - * - */ - void PrepareForRestoreL(TBool aPartial); - - /** - * - */ - void SetParameters(CMMCScBkupOpParamsBase* aParameters); - - /** - * - */ - void CreateFactoryL(TMMCScBkupOperationType aOperation); - - /** - * - */ - TBool CurrentStateAvailable() const; - - /** - * - */ - TMMCScBkupStateId CurrentStateId() const; - - /** - * - */ - CMMCScBkupState& CurrentState(); - - /** - * - */ - const CMMCScBkupState& CurrentState() const; - - /** - * - */ - void PrepareNextStateL( TMMCScBkupStateId aCurrentStateId ); - - /** - * - */ - void DestroyCurrentState(); - - /** - * - */ - void ExecuteStateL(); - - /** - * - */ - void PrepareObjectsL(); - - /** - * Reset and Destroy the RPointArray of Archives - * - */ - static void ResetAndDestroyArchives( TAny* aPtr ); - -#ifdef DEBUGGING_DATA_TRANSFER - - /** - * - */ - void CleanBackupFilesL(); - - /** - * - */ - void ClearRestoreFilesL(); -#endif - - private: // Member data - - // Referenced objects - // file server session - RFs& iFsSession; - // backup engine observer - MMMCScBkupEngineObserver* iObserver; - - // Owned objects - // - TInt64 iCumulativeProgress; - // Secure backup engine client - CSBEClient* iSBEClient; - // Archive array - RMMCScBkupPointerArray iArchives; - // Current operation - TMMCScBkupOperationType iOperationType; - // Operational parameters - CMMCScBkupOpParamsBase* iParameters; - // - CMMCScBkupState* iCurrentState; - // Current factory - CMMCScBkupStateFactory* iFactory; - // - RPointerArray iDataOwners; - // - RPointerArray iFileLists; - // - TInt iCurrentArchive; - // - TInt64 iTotalProgress; - // - TBool iActiveDataProcessingOngoing; - }; - - - - -#endif // __CMMCSCBKUPENGINEIMPL_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupFileInfo.h --- a/filemanager/bkupengine/inc/CMMCScBkupFileInfo.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,156 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupFileInfo -* -* -*/ - -#ifndef __CMMCSCBKUPFILEINFO_H__ -#define __CMMCSCBKUPFILEINFO_H__ - -// System includes -#include -#include - - -/** -* Represents a public file within an archive. Each public file -* has an associated data owner. This is encapsulated by the SID -* of the owning process. -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupFileInfo) : public CBase - { - public: - - /** - * Static constructor - */ - static CMMCScBkupFileInfo* NewL( const TEntry& aEntry, TSecureId aAssociatedSID ); - - /** - * Static constructor - */ - static CMMCScBkupFileInfo* NewLC( const TEntry& aEntry, TSecureId aAssociatedSID ); - - /** - * Static constructor - */ - static CMMCScBkupFileInfo* NewLC( RReadStream& aStream ); - - /** - * C++ destructor - */ - ~CMMCScBkupFileInfo(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupFileInfo(); - - /** - * C++ default constructor - */ - CMMCScBkupFileInfo( const TEntry& aEntry, TSecureId aAssociatedSID ); - - /** - * - */ - void ConstructL( const TEntry& aEntry ); - - public: // API - Getters - - /** - * - */ - inline const TDesC& FileName() const { return *iFileName; } - - /** - * - */ - inline TInt Size() const { return iSize; } - - /** - * - */ - inline const TTime& DateTime() const { return iDateTime; } - - /** - * - */ - inline TUint Attributes() const { return iAttributes; } - - /** - * - */ - inline TSecureId SecureId() const { return iSecureId; } - - /** - * - */ - TDriveNumber Drive() const; - - public: // Store/Restore - - /** - * - */ - void InternalizeL(RReadStream& aStream); - - /** - * - */ - void ExternalizeL(RWriteStream& aStream) const; - - private: // Internal enumerations - enum - { - EStreamFormatVersion1 = 1 - }; - - public: // Comparison support - - /** - * - */ - static TInt OrderByFileName(const CMMCScBkupFileInfo& aLeft, const CMMCScBkupFileInfo& aRight); - - /** - * - */ - static TBool CompareByFileName(const CMMCScBkupFileInfo& aLeft, const CMMCScBkupFileInfo& aRight); - - private: // Member data - - // File name - HBufC* iFileName; - // - TInt iSize; - // - TTime iDateTime; - // - TUint iAttributes; - // - TSecureId iSecureId; - }; - - - - -#endif // __CMMCSCBKUPFILEINFO_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupFileListCollection.h --- a/filemanager/bkupengine/inc/CMMCScBkupFileListCollection.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration for CMMCScBkupFileListCollection -* -* -*/ - -#ifndef __CMMCSCBKUPFILELISTCOLLECTION_H__ -#define __CMMCSCBKUPFILELISTCOLLECTION_H__ - -// System includes -#include - -// User includes -#include "RMMCScBkupPointerArray.h" -#include "CMMCScBkupFileInfo.h" -#include - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupFileListCollection) : public CBase - { - public: - - /** - * Static constructor - */ - static CMMCScBkupFileListCollection* NewL( TBitFlags aCategory, RFs& aFsSession ); - - /** - * C++ destructor - */ - ~CMMCScBkupFileListCollection(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupFileListCollection( TBitFlags aCategory, RFs& aFsSession ); - - /** - * - */ - void ConstructL(); - - public: // API - - /** - * - */ - void AppendL( const RArray& aArray, RArray< const CMMCScBkupFileInfo* >& aAddedItems, TSecureId aAssociatedSID ); - - /** - * - */ - void AppendL( CMMCScBkupFileInfo* aFileInfo ); - - /** - * - */ - TInt Count() const; - - /** - * - */ - const CMMCScBkupFileInfo& Entry(TInt aIndex) const; - - /** - * - */ - void Remove( TInt aIndex ); - - /** - * - */ - void Reset(); - - /** - * - */ - TBitFlags Category() const { return iCategory; } - - private: // Member data - - // Array of data owners - RMMCScBkupPointerArray iEntries; - // - TBitFlags iCategory; - // - RFs& iFsSession; - }; - - - - -#endif // __CMMCSCBKUPFILELISTCOLLECTION_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupIndexActiveData.h --- a/filemanager/bkupengine/inc/CMMCScBkupIndexActiveData.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupIndexActiveData -* -* -*/ - -#ifndef __CMMCSCBKUPINDEXACTIVEDATA_H__ -#define __CMMCSCBKUPINDEXACTIVEDATA_H__ - -// User includes -#include "CMMCScBkupIndexWithIdentifier.h" - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupIndexActiveData) : public CMMCScBkupIndexWithIdentifier< TSecureId > - { - public: - - /** - * Static constructor - */ - static CMMCScBkupIndexActiveData* NewLC(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupIndexActiveData(); - - }; - - - - -#endif // __CMMCSCBKUPINDEXACTIVEDATA_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupIndexBase.h --- a/filemanager/bkupengine/inc/CMMCScBkupIndexBase.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupIndexBase -* -* -*/ - -#ifndef __CMMCSCBKUPINDEXBASE_H__ -#define __CMMCSCBKUPINDEXBASE_H__ - -// System includes -#include - -// User includes -#include "MMMCScBkupDriver.h" -#include "TMMCScBkupOwnerDataType.h" -#include "RMMCScBkupPointerArray.h" -#include "TMMCScBkupArchiveVector.h" - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupIndexBase) : public CBase - { - public: - - /** - * C++ destructor - */ - ~CMMCScBkupIndexBase(); - - protected: - - /** - * C++ default constructor - */ - CMMCScBkupIndexBase(TMMCScBkupOwnerDataType aType); - - /** - * - */ - virtual void ConstructL(); - - public: // API - - /** - * - */ - inline TMMCScBkupOwnerDataType Type() const { return iType; } - - /** - * - */ - inline const TMMCScBkupArchiveVector& Vector() const { return iVector; } - - /** - * - */ - inline void SetVector( const TMMCScBkupArchiveVector& aVector ) { iVector = aVector; } - - public: // Store/Restore - - /** - * - */ - virtual void StoreL(MMMCScBkupDriver& aDriver) = 0; - - /** - * - */ - virtual void RestoreL(MMMCScBkupDriver& aDriver) = 0; - - private: // Member data - - // - TMMCScBkupOwnerDataType iType; - // - TMMCScBkupArchiveVector iVector; - }; - - - - -#endif // __CMMCSCBKUPINDEXBASE_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupIndexDataOwners.h --- a/filemanager/bkupengine/inc/CMMCScBkupIndexDataOwners.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupIndexDataOwners -* -* -*/ - -#ifndef __CMMCSCBKUPINDEXDATAOWNERS_H__ -#define __CMMCSCBKUPINDEXDATAOWNERS_H__ - -// System includes -#include - -// User includes -#include "CMMCScBkupIndexBase.h" - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupIndexDataOwners) : public CMMCScBkupIndexBase - { - public: - - /** - * Static constructor - */ - static CMMCScBkupIndexDataOwners* NewLC(); - - /** - * C++ destructor - */ - ~CMMCScBkupIndexDataOwners(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupIndexDataOwners(); - - public: // API - - /** - * - */ - void AddIndexRecordL( const TMMCScBkupArchiveVector& aInfo ); - - /** - * - */ - inline TInt Count() const - { return iEntries.Count(); } - - /** - * - */ - inline const TMMCScBkupArchiveVector& At( TInt aIndex ) const - { return iEntries[ aIndex ]; } - - public: // From CMMCScBkupIndexBase - - /** - * - */ - void StoreL(MMMCScBkupDriver& aDriver); - - /** - * - */ - void RestoreL(MMMCScBkupDriver& aDriver); - - private: // Internal enumerations - enum - { - EStreamFormatVersion1 = 1 - }; - - private: // Member data - - // - RArray iEntries; - - }; - - - - -#endif // __CMMCSCBKUPINDEXDATAOWNERS_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupIndexJavaData.h --- a/filemanager/bkupengine/inc/CMMCScBkupIndexJavaData.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,222 +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: Declaration for CMMCScBkupIndexJavaDataEntry and -* CMMCScBkupIndexJavaData -* -* -*/ - -#ifndef __CMMCSCBKUPINDEXJAVADATA_H__ -#define __CMMCSCBKUPINDEXJAVADATA_H__ - -// User includes -#include "CMMCScBkupIndexWithIdentifier.h" - - - -/** -* -* @since 3.0 -*/ -NONSHARABLE_CLASS( CMMCScBkupIndexJavaDataEntry ) : public CBase - { - public: - - /** - * - */ - static CMMCScBkupIndexJavaDataEntry* NewLC(); - - /** - * - */ - static CMMCScBkupIndexJavaDataEntry* NewLC( RReadStream& aStream ); - - /** - * C++ destructor - */ - ~CMMCScBkupIndexJavaDataEntry(); - - private: - - /** - * - */ - CMMCScBkupIndexJavaDataEntry(); - - /** - * - */ - void ConstructL(); - - public: // API - - /** - * - */ - inline const TDesC& Hash() const { return *iHash; } - - /** - * - */ - void SetHashL( const TDesC& aHash ); - - /** - * - */ - inline TDriveNumber Drive() const { return iDrive; } - - /** - * - */ - inline void SetDrive( TDriveNumber aDrive ) { iDrive = aDrive; } - - /** - * - */ - inline const TMMCScBkupArchiveVector& MidletInfo() const { return iMidletInfo; } - - /** - * - */ - inline void SetMidletInfo( const TMMCScBkupArchiveVector& aInfo ) { iMidletInfo = aInfo; } - - /** - * - */ - inline const TMMCScBkupArchiveVector& MidletDataInfo() const { return iMidletDataInfo; } - - /** - * - */ - inline void SetMidletDataInfo( const TMMCScBkupArchiveVector& aInfo ) { iMidletDataInfo = aInfo; } - - /** - * - */ - inline TBool HasMidletDataInfo() const { return iMidletDataInfo.Length() > 0 && iMidletDataInfo.Offset() > 0; } - - public: // Store & restore - - /** - * - */ - void InternalizeL( RReadStream& aStream ); - - /** - * - */ - void ExternalizeL( RWriteStream& aStream ) const; - - private: // Internal enumerations - enum - { - EStreamFormatVersion1 = 1 - }; - - private: // Data members - // - HBufC* iHash; - // - TDriveNumber iDrive; - // - TMMCScBkupArchiveVector iMidletInfo; - // - TMMCScBkupArchiveVector iMidletDataInfo; - }; - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupIndexJavaData) : public CMMCScBkupIndexBase - { - public: - - /** - * Static constructor - */ - static CMMCScBkupIndexJavaData* NewLC(); - - /** - * C++ destructor - */ - ~CMMCScBkupIndexJavaData(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupIndexJavaData(); - - public: // API - - /** - * - */ - void AddIndexRecordL( const TMMCScBkupArchiveVector& aInfo, const TDesC& aHash, TDriveNumber aDrive, TJavaTransferType aType ); - - /** - * - */ - inline TInt Count() const { return iEntries.Count(); } - - /** - * - */ - const CMMCScBkupIndexJavaDataEntry& At( TInt aIndex ) const; - - public: // From CMMCScBkupIndexBase - - /** - * - */ - void StoreL( MMMCScBkupDriver& aDriver ); - - /** - * - */ - void RestoreL( MMMCScBkupDriver& aDriver ); - - private: // Internal classes - - /** - * - */ - CMMCScBkupIndexJavaDataEntry* EntryByHash( const TDesC& aHash, TDriveNumber aDrive ) const; - - private: // Internal enumerations - enum - { - EStreamFormatVersion1 = 1 - }; - - private: // Member data - - // - RMMCScBkupPointerArray< CMMCScBkupIndexJavaDataEntry > iEntries; - - }; - - - - - -#endif // __CMMCSCBKUPINDEXJAVADATA_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupIndexPassiveData.h --- a/filemanager/bkupengine/inc/CMMCScBkupIndexPassiveData.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupIndexPassiveData -* -* -*/ - -#ifndef __CMMCSCBKUPINDEXPASSIVEDATA_H__ -#define __CMMCSCBKUPINDEXPASSIVEDATA_H__ - -// System includes -#include - -// User includes -#include "CMMCScBkupIndexWithIdentifier.h" - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupIndexPassiveData) : public CMMCScBkupIndexWithIdentifier< TSecureId > - { - public: - - /** - * Static constructor - */ - static CMMCScBkupIndexPassiveData* NewLC(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupIndexPassiveData(); - - }; - - - - -#endif // __CMMCScBkupIndexPassiveData_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupIndexPublicDataFiles.h --- a/filemanager/bkupengine/inc/CMMCScBkupIndexPublicDataFiles.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupIndexPublicDataFiles -* -* -*/ - -#ifndef __CMMCSCBKUPINDEXPUBLICDATAFILES_H__ -#define __CMMCSCBKUPINDEXPUBLICDATAFILES_H__ - -// System includes -#include - -// User includes -#include "CMMCScBkupIndexBase.h" - -// Classes referenced -class CMMCScBkupFileInfo; - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupIndexPublicDataFiles) : public CMMCScBkupIndexBase - { - public: - - /** - * Static constructor - */ - static CMMCScBkupIndexPublicDataFiles* NewLC(); - - /** - * C++ destructor - */ - ~CMMCScBkupIndexPublicDataFiles(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupIndexPublicDataFiles(); - - public: // API - - /** - * - */ - void AddIndexRecordL( const TMMCScBkupArchiveVector& aInfo, const CMMCScBkupFileInfo& aFile ); - - /** - * - */ - inline TInt Count() const { return iEntries.Count(); } - - /** - * - */ - const CMMCScBkupFileInfo& At( TInt aIndex, TMMCScBkupArchiveVector& aInfo ) const; - - public: // From CMMCScBkupIndexBase - - /** - * - */ - void StoreL( MMMCScBkupDriver& aDriver ); - - /** - * - */ - void RestoreL( MMMCScBkupDriver& aDriver ); - - private: // Internal classes - - /** - * - * @since 3.0 - */ - class TMMCScBkupPublicFileEntry - { - public: - inline TMMCScBkupPublicFileEntry() { } - inline TMMCScBkupPublicFileEntry(const TMMCScBkupArchiveVector& aInfo, const CMMCScBkupFileInfo& aFile) - : iInfo(aInfo), iFile(&aFile) - { - } - - public: // Data members - TMMCScBkupArchiveVector iInfo; - const CMMCScBkupFileInfo* iFile; - }; - - private: // Member data - - // - RArray iEntries; - - }; - - -#endif // __CMMCSCBKUPINDEXPUBLICDATAFILES_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupIndexSystemData.h --- a/filemanager/bkupengine/inc/CMMCScBkupIndexSystemData.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupIndexSystemData -* -* -*/ - -#ifndef __CMMCSCBKUPINDEXSYSTEMDATA_H__ -#define __CMMCSCBKUPINDEXSYSTEMDATA_H__ - -// System includes -#include - -// User includes -#include "CMMCScBkupIndexWithIdentifier.h" - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupIndexSystemData) : public CMMCScBkupIndexWithIdentifier< TInt32 > - { - public: - - /** - * Static constructor - */ - static CMMCScBkupIndexSystemData* NewLC(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupIndexSystemData(); - - }; - - - - - -#endif // __CMMCSCBKUPINDEXSYSTEMDATA_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupIndexWithIdentifier.h --- a/filemanager/bkupengine/inc/CMMCScBkupIndexWithIdentifier.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,329 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupIndexWithIdentifier -* -* -*/ - -#ifndef __CMMCSCBKUPINDEXWITHIDENTIFIER_H__ -#define __CMMCSCBKUPINDEXWITHIDENTIFIER_H__ - -// User includes -#include "CMMCScBkupIndexBase.h" -#include "TMMCScBkupOwnerDataType.h" -#include "TMMCScBkupArchiveVector.h" -#include "MMMCScBkupArchiveDataInterface.h" - - - -/** -* -* -* @since 3.0 -*/ -template < class TIdentifier > -class CMMCScBkupIndexEntry : public CBase - { - public: - inline static CMMCScBkupIndexEntry* NewLC( const TIdentifier& aIdentifier ) - { - CMMCScBkupIndexEntry* self = new(ELeave) CMMCScBkupIndexEntry( aIdentifier ); - CleanupStack::PushL( self ); - return self; - } - - inline static CMMCScBkupIndexEntry* NewLC( RReadStream& aStream ) - { - CMMCScBkupIndexEntry* self = new(ELeave) CMMCScBkupIndexEntry(); - CleanupStack::PushL( self ); - aStream >> *self; - return self; - } - - inline ~CMMCScBkupIndexEntry() - { - iAssociatedData.Close(); - } - - private: - - inline CMMCScBkupIndexEntry() - { - } - - inline CMMCScBkupIndexEntry( const TIdentifier& aIdentifier ) - : iIdentifier( aIdentifier ) - { - } - - private: // Internal enumerations - enum - { - EStreamFormatVersion1 = 1 - }; - - public:// Store & Restore - - inline void InternalizeL( RReadStream& aStream ) - { - aStream.ReadInt32L(); // EStreamFormatVersion1 - aStream.ReadInt32L(); // spare1 - aStream.ReadInt32L(); // spare2 - aStream.ReadInt32L(); // spare3 - // - iIdentifier = aStream.ReadInt32L(); - // - const TInt count = aStream.ReadInt32L(); - for(TInt i=0; i> entry; - // - iAssociatedData.AppendL( entry ); - } - } - - inline void ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt32L( EStreamFormatVersion1 ); - aStream.WriteInt32L( 0 ); // spare1 - aStream.WriteInt32L( 0 ); // spare2 - aStream.WriteInt32L( 0 ); // spare3 - // - aStream.WriteInt32L( iIdentifier ); - // - const TInt count = iAssociatedData.Count(); - aStream.WriteInt32L(count); - // - for(TInt i=0; i& Entries() const - { return iAssociatedData; } - - private: - - /** - * - */ - TIdentifier iIdentifier; - - /** - * - */ - RArray iAssociatedData; - }; - - - - - - -/** -* -* -* @since 3.0 -*/ -template < class TIdentifier > -class CMMCScBkupIndexWithIdentifier : public CMMCScBkupIndexBase - { - - public: - - /** - * C++ destructor - */ - inline ~CMMCScBkupIndexWithIdentifier() - { - iEntries.Close(); - } - - protected: - - /** - * C++ default constructor - */ - inline CMMCScBkupIndexWithIdentifier( TMMCScBkupOwnerDataType aType ) - : CMMCScBkupIndexBase( aType ) - { - } - - private: // Internal enumerations - enum - { - EStreamFormatVersion1 = 1 - }; - - public: // API - - /** - * - */ - inline void AddIndexRecordL( const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive, const TIdentifier& aIdentifier ) - { - // Locate the parent - CMMCScBkupIndexEntry< TIdentifier >& entry = EntryByIdentifierL( aIdentifier ); - - // Create new sub-entry - TMMCScBkupArchiveDriveAndVector subItem; - subItem.iDrive = aDrive; - subItem.iVector = aInfo; - - // Add it to our index - entry.AddEntryL( subItem ); - } - - /** - * - */ - inline TInt Count() const - { return iEntries.Count(); } - - /** - * - */ - inline const CMMCScBkupIndexEntry< TIdentifier >& At( TInt aIndex ) const - { return *iEntries[ aIndex ]; } - - /** - * - */ - inline void StoreL(MMMCScBkupDriver& aDriver) - { - MMMCScBkupArchiveDataInterface& archiveDataInterface = aDriver.DrvADI(); - RWriteStream stream( archiveDataInterface.ADIWriteStreamUncompressedLC() ); - // - stream.WriteInt32L( EStreamFormatVersion1 ); - stream.WriteInt32L( 0 ); // spare1 - stream.WriteInt32L( 0 ); // spare2 - stream.WriteInt32L( 0 ); // spare3 - - const TInt count = iEntries.Count(); - stream.WriteInt32L( count ); - // - for(TInt i=0; i & entry = *iEntries[ i ]; - stream << entry; - } - // - stream.CommitL(); - CleanupStack::PopAndDestroy(); // stream - - // Update our base class info with the offset to the index - SetVector( archiveDataInterface.ADICurrentArchiveVectorInfo() ); - } - - /** - * - */ - inline void RestoreL(MMMCScBkupDriver& aDriver) - { - MMMCScBkupArchiveDataInterface& archiveDataInterface = aDriver.DrvADI(); - RReadStream stream( archiveDataInterface.ADIReadStreamUncompressedLC( Vector().Offset() ) ); - // - stream.ReadInt32L(); // EStreamFormatVersion1 - stream.ReadInt32L(); // spare1 - stream.ReadInt32L(); // spare2 - stream.ReadInt32L(); // spare3 - // - const TInt count = stream.ReadInt32L(); - for(TInt i=0; i* entry = CMMCScBkupIndexEntry< TIdentifier >::NewLC( stream ); - iEntries.AppendL( entry ); - CleanupStack::Pop( entry ); - } - // - CleanupStack::PopAndDestroy(); // stream - // - if ( archiveDataInterface.ADICurrentArchiveVectorInfo().Length() > Vector().Length() ) - { - // We've read too much! - User::Leave( KErrCorrupt ); - } - } - - private: // Internal methods - - /** - * - */ - inline CMMCScBkupIndexEntry< TIdentifier >* EntryByIdentifier( const TIdentifier& aIdentifier ) - { - CMMCScBkupIndexEntry< TIdentifier >* ret = NULL; - // - const TInt count = iEntries.Count(); - for( TInt i=count-1; i>=0; i-- ) - { - CMMCScBkupIndexEntry< TIdentifier >* entry = iEntries[ i ]; - if ( entry->Identifier() == aIdentifier ) - { - ret = entry; - break; - } - } - // - return ret; - } - - /** - * - */ - inline CMMCScBkupIndexEntry< TIdentifier >& EntryByIdentifierL( const TIdentifier& aIdentifier ) - { - CMMCScBkupIndexEntry< TIdentifier >* ret = EntryByIdentifier( aIdentifier ); - if ( !ret ) - { - // Need to make a new entry - ret = CMMCScBkupIndexEntry< TIdentifier >::NewLC( aIdentifier ); - iEntries.AppendL( ret ); - CleanupStack::Pop( ret ); - } - // - return *ret; - } - - private: // Member Data - - // - RMMCScBkupPointerArray< CMMCScBkupIndexEntry< TIdentifier > > iEntries; - }; - - - - - - -#endif // __CMMCSCBKUPINDEXWITHIDENTIFIER_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupOperationParameters.h --- a/filemanager/bkupengine/inc/CMMCScBkupOperationParameters.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,240 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupOpParamsBase -* -* -*/ - -#ifndef __CMMCSCBKUPOPERATIONPARAMETERS_H__ -#define __CMMCSCBKUPOPERATIONPARAMETERS_H__ - -// System includes -#include -#include -#include -#include - -// User includes -#include "MMCScBkupOperations.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "RMMCScBkupPointerArray.h" - -// Namespaces -using namespace conn; - -// Classes referenced -class CMMCScBkupDriveAndOperationTypeManager; -class CMMCScBkupArchiveInfo; - -_LIT( KBackUpFolder, "\\Backup\\" ); -_LIT( KBackUpFiles, "*.arc" ); - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupOpParamsBase) : public CBase - { - public: - - /** - * - */ - IMPORT_C ~CMMCScBkupOpParamsBase(); - - protected: - - /** - * - */ - CMMCScBkupOpParamsBase( ); - - /** - * - */ - void ConstructL( TResourceReader& aDriveReader, TBitFlags aCategories ); - - public: // Common mandatory framework methods - - /** - * - */ - virtual TMMCScBkupOperationType AssociatedOpType() const = 0; - - /** - * - */ - virtual TBURPartType PartType() const = 0; - - /** - * - */ - virtual TBackupIncType IncrementType() const = 0; - - /** - * - */ - virtual TTransferDataType PassiveTransferType() const = 0; - - /** - * - */ - virtual TTransferDataType ActiveTransferType() const = 0; - - /** - * - */ - virtual TPackageDataType PackageTransferType() const = 0; - - public: // Common attributes - - /** - * - */ - IMPORT_C const CMMCScBkupDriveAndOperationTypeManager& DriveAndOperations() const; - - /** - * - */ - IMPORT_C void SetArchiveInfosL(RPointerArray& aInfos); - - /** - * - */ - RMMCScBkupPointerArray& ArchiveInfos(); - - /** - * - */ - const CMMCScBkupArchiveInfo& ArchiveInfo(TBitFlags aCategory) const; - - /** - * - */ - const TDesC& FileName(TInt aIndex) const; - - /** - * - */ - TBitFlags Categories() { return iCategories; } - - private: // Data members - - // - CMMCScBkupDriveAndOperationTypeManager* iDriveAndOperations; - // - RMMCScBkupPointerArray< CMMCScBkupArchiveInfo > iArchiveInfos; - // - TBitFlags iCategories; - }; - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupOpParamsBackupFull) : public CMMCScBkupOpParamsBase - { - public: - - /** - * - */ - IMPORT_C static CMMCScBkupOpParamsBackupFull* NewL( TResourceReader& aDriveReader, TResourceReader& aCategoryReader, - TDriveNumber aDrive, TBitFlags aCategories ); - - /** - * - */ - IMPORT_C ~CMMCScBkupOpParamsBackupFull(); - - private: - - /** - * - */ - CMMCScBkupOpParamsBackupFull( TDriveNumber aDrive ); - - /** - * - */ - void ConstructL( TResourceReader& aDriveReader, TResourceReader& aCategoryReader, TBitFlags aCategories ); - - /** - * - */ - void ReadFromResourceL( TResourceReader& aReader ); - - public: // From CMMCScBkupOpParamsBase - IMPORT_C TMMCScBkupOperationType AssociatedOpType() const; - IMPORT_C TBURPartType PartType() const; - IMPORT_C TBackupIncType IncrementType() const; - IMPORT_C TTransferDataType PassiveTransferType() const; - IMPORT_C TTransferDataType ActiveTransferType() const; - IMPORT_C TPackageDataType PackageTransferType() const; - - private: // Data members - - // - TDriveNumber iDrive; - }; - - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupOpParamsRestoreFull) : public CMMCScBkupOpParamsBase - { - public: - - /** - * - */ - IMPORT_C static CMMCScBkupOpParamsRestoreFull* NewL( TResourceReader& aDriveReader, TBitFlags aCategories ); - - /** - * - */ - IMPORT_C ~CMMCScBkupOpParamsRestoreFull(); - - private: - - /** - * - */ - CMMCScBkupOpParamsRestoreFull(); - - public: // From CMMCScBkupOpParamsBase - IMPORT_C TMMCScBkupOperationType AssociatedOpType() const; - IMPORT_C TBURPartType PartType() const; - IMPORT_C TBackupIncType IncrementType() const; - IMPORT_C TTransferDataType PassiveTransferType() const; - IMPORT_C TTransferDataType ActiveTransferType() const; - IMPORT_C TPackageDataType PackageTransferType() const; - }; - - - - - -#endif // __CMMCSCBKUPOPERATIONPARAMETERS_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupState.h --- a/filemanager/bkupengine/inc/CMMCScBkupState.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,183 +0,0 @@ -/* -* Copyright (c) 2002 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: Declaration for CMMCScBkupState -* -* -*/ - -#ifndef __CMMCSCBKUPSTATE_H__ -#define __CMMCSCBKUPSTATE_H__ - -// System includes -#include - -// User includes -#include "MMMCScBkupDriver.h" -#include "MMCScBkupStateIds.h" -#include "RMMCScBkupPointerArray.h" -#include "MMMCScBkupArchiveDataInterface.h" - -// Namespaces -using namespace conn; - -// Classes referenced -class CMMCScBkupState; - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupState) : public CActive - { - public: - - /** - * Enumeration specifying how state is supposed to be handled - */ - enum TStateExecution - { - EStateOnce = 0, - EStatePerCategory, - EStatePerCategoryCommon - }; - - /** - * Destructor - */ - ~CMMCScBkupState(); - - protected: - - /** - * C++ default constructor - */ - CMMCScBkupState( MMMCScBkupDriver& aDriver, TInt aPriority = CActive::EPriorityIdle ); - - public: - - /** - * Return the unique RTTI id of this state - */ - virtual TMMCScBkupStateId StateId() const = 0; - - /** - * Return the next state that should be executed - * after this state has finished. This allows - * for dynamic changes in the state machine - */ - virtual TMMCScBkupStateId NextStateId() const = 0; - - /** - * Return false if no need for category specific actions, otherwise true - */ - virtual TStateExecution CategorySpecific() const { return EStateOnce; } - - /** - * Perform the action associated with this - * state - */ - void ExecuteL(TRequestStatus& aObserver); - - protected: // Virtual framework - - /** - * Perform the initial action associated with this - * state - */ - virtual void PerformStateInitL() = 0; - - /** - * Perform some asynchronous operation - */ - virtual void PerformAsynchronousStateStepL(); - - /** - * Perform some asynchronous cancellation - */ - virtual void PerformAsynchronousCancellation(); - - /** - * Called just before observer's request is completed - * in the case of an error-free operation. Not called - * when errors occur during state processing. - */ - virtual void PerformLastRightsL(); - - /** - * Called from RunError - */ - virtual TBool PerformAsynchronousErrorCleanup(TInt aError); - - private: // Virtual framework - - /** - * Default behaviour is to panic if called - */ - void RunL(); - - /** - * - */ - void DoCancel(); - - /** - * Default behaviour is to return KErrNone - */ - TInt RunError(TInt aError); - - protected: // Internal API - - /** - * - */ - inline MMMCScBkupDriver& Driver() const { return iDriver; } - - /** - * - */ - inline MMMCScBkupArchiveDataInterface& ADI() const { return iDriver.DrvADI(); } - - /** - * - */ - void CompleteSelf(TInt aCompletionCode = KErrNone); - - /** - * - */ - void SetObserver(TRequestStatus& aStatus); - - private: // Internal API - - /** - * - */ - void CompleteObserver(TInt aCompletionCode); - - private: // Member data - - // Driver - MMMCScBkupDriver& iDriver; - // Observer - TRequestStatus* iObserver; - }; - - - - - -#endif // __CMMCSCBKUPSTATE_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpActiveData.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpActiveData.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpActiveData -* -* -*/ - -#ifndef __CMMCSCBKUPSTATEARCHIVEOPACTIVEDATA_H__ -#define __CMMCSCBKUPSTATEARCHIVEOPACTIVEDATA_H__ - -// System includes -#include - -// User includes -#include "CMMCScBkupStateOpAware.h" -#include "TMMCScBkupArchiveVector.h" -#include "CMMCScBkupTransferWriteRequest.h" -#include "CMMCScBkupTransferReadRequest.h" - -// Namespaces -using namespace conn; - -// Classes referenced -class CMMCScBkupDataOwnerInfo; - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpActiveData) : public CMMCScBkupStateOpAware, public MMMCScBkupIndexHandler - { - public: - - /** - * Static constructor - */ - static CMMCScBkupStateArchiveOpActiveData* NewL( MMMCScBkupDriver& aDriver ); - - /** - * C++ destructor - */ - ~CMMCScBkupStateArchiveOpActiveData( ); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateArchiveOpActiveData( MMMCScBkupDriver& aDriver ); - - public: // From CMMCScBkupState - TMMCScBkupStateId StateId() const; - - public: // From CMMCScBkupStateOpAware - TMMCScBkupStateId NextStateBackupId( TBool aPartial ) const; - TMMCScBkupStateId NextStateRestoreId( TBool aPartial ) const; - - private: // From CMMCScBkupStateOpAware - void PerformStateInitBackupL( TBool aPartial ); - void PerformStateInitRestoreL( TBool aPartial ); - void PerformAsynchronousStateStepBackupL( TBool aPartial ); - void PerformAsynchronousStateStepRestoreL( TBool aPartial ); - void PerformLastRightsBackupL( TBool aPartial ); - TBool PerformAsynchronousErrorCleanupBackup( TBool aPartial, TInt aError ); - TBool PerformAsynchronousErrorCleanupRestore( TBool aPartial, TInt aError ); - - private: // From CMMCScBkupState - void PerformAsynchronousCancellation(); - - private: // From MMMCScBkupIndexHandler - void AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ); - - private: // Internal members - - /** - * - */ - inline TBool AllDataOwnersHandled() const { return !iAtLeastOneDataOwnerIsNotYetReady; } - - /** - * - */ - void CheckNeedToStartRetryTimerL(); - - private: // Member data - - // - TInt iIndexValueCurrent; - // - TBool iAtLeastOneDataOwnerIsNotYetReady; - // - RTimer iTimer; - // - CMMCScBkupWriteDataTransferRequest< TTransferDataType >* iBackupTransferObject; - // - CMMCScBkupReadDataTransferRequest< TTransferDataType >* iRestoreTransferObject; - }; - - - - - - - - -#endif // __CMMCSCBKUPSTATEARCHIVEOPACTIVEDATA_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpArchiveFooter.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpArchiveFooter.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpArchiveFooter -* -* -*/ - -#ifndef __CMMCSCBKUPSTATEARCHIVEOPARCHIVEFOOTER_H__ -#define __CMMCSCBKUPSTATEARCHIVEOPARCHIVEFOOTER_H__ - -// User includes -#include "CMMCScBkupState.h" - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpArchiveFooter) : public CMMCScBkupState - { - public: - - /** - * Static constructor - */ - static CMMCScBkupStateArchiveOpArchiveFooter* NewL( MMMCScBkupDriver& aDriver ); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateArchiveOpArchiveFooter( MMMCScBkupDriver& aDriver ); - - public: // From CMMCScBkupState - TMMCScBkupStateId StateId() const; - TMMCScBkupStateId NextStateId() const; - TStateExecution CategorySpecific() const { return EStatePerCategory; } - - private: // From CMMCScBkupState - void PerformStateInitL(); - void PerformAsynchronousStateStepL(); - }; - - -#endif // __CMMCSCBKUPSTATEARCHIVEOPARCHIVEFOOTER_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpArchiveHeader.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpArchiveHeader.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpArchiveHeader -* -* -*/ - -#ifndef __CMMCSCBKUPSTATEARCHIVEOPARCHIVEHEADER_H__ -#define __CMMCSCBKUPSTATEARCHIVEOPARCHIVEHEADER_H__ - -// User includes -#include "CMMCScBkupState.h" - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpArchiveHeader) : public CMMCScBkupState - { - public: - - /** - * Static constructor - */ - static CMMCScBkupStateArchiveOpArchiveHeader* NewL( MMMCScBkupDriver& aDriver ); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateArchiveOpArchiveHeader( MMMCScBkupDriver& aDriver ); - - public: // From CMMCScBkupState - TMMCScBkupStateId StateId() const; - TMMCScBkupStateId NextStateId() const; - TStateExecution CategorySpecific() const { return EStatePerCategory; } - - private: // From CMMCScBkupState - void PerformStateInitL(); - void PerformAsynchronousStateStepL(); - }; - - -#endif // __CMMCSCBKUPSTATEARCHIVEOPARCHIVEHEADER_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpDataOwners.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpDataOwners.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpDataOwners -* -* -*/ - -#ifndef __CMMCSCBKUPSTATEARCHIVEOPDATAOWNERS_H__ -#define __CMMCSCBKUPSTATEARCHIVEOPDATAOWNERS_H__ - -// User includes -#include "CMMCScBkupStateOpAware.h" - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpDataOwners) : public CMMCScBkupStateOpAware - { - public: - - /** - * Static constructor - */ - static CMMCScBkupStateArchiveOpDataOwners* NewL( MMMCScBkupDriver& aDriver ); - - /** - * C++ destructor - */ - ~CMMCScBkupStateArchiveOpDataOwners(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateArchiveOpDataOwners( MMMCScBkupDriver& aDriver ); - - public: // From CMMCScBkupState - TMMCScBkupStateId StateId() const; - - public: // From CMMCScBkupStateOpAware - TMMCScBkupStateId NextStateBackupId( TBool aPartial ) const; - TMMCScBkupStateId NextStateRestoreId( TBool aPartial ) const; - - private: // From CMMCScBkupStateOpAware - - private: // From CMMCScBkupState - void PerformStateInitBackupL( TBool aPartial ); - void PerformStateInitRestoreL( TBool aPartial ); - // - void PerformAsynchronousStateStepBackupL( TBool aPartial ); - void PerformAsynchronousStateStepRestoreL( TBool aPartial ); - // - void PerformLastRightsBackupL( TBool aPartial ); - void PerformLastRightsRestoreL( TBool aPartial ); - // - TBool PerformAsynchronousErrorCleanupRestore( TBool aPartial, TInt aError ); - - private: // Member data - - // - TInt iIndexValueCurrent; - }; - - -#endif // __CMMCSCBKUPSTATEARCHIVEOPDATAOWNERS_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpJavaData.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpJavaData.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpJavaData -* -* -*/ - -#ifndef __CMMCSCBKUPSTATEARCHIVEOPJAVADATA_H__ -#define __CMMCSCBKUPSTATEARCHIVEOPJAVADATA_H__ - -// System includes -#include - -// User includes -#include "CMMCScBkupStateOpAware.h" -#include "TMMCScBkupArchiveVector.h" -#include "CMMCScBkupTransferWriteRequest.h" -#include "CMMCScBkupTransferReadRequest.h" - -// Namespaces -using namespace conn; - -// Classes referenced -class CMMCScBkupDataOwnerInfo; - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpJavaData) : public CMMCScBkupStateOpAware, public MMMCScBkupIndexHandler - { - public: - - /** - * Static constructor - */ - static CMMCScBkupStateArchiveOpJavaData* NewL( MMMCScBkupDriver& aDriver ); - - /** - * C++ destructor - */ - ~CMMCScBkupStateArchiveOpJavaData( ); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateArchiveOpJavaData( MMMCScBkupDriver& aDriver ); - - public: // From CMMCScBkupState - TMMCScBkupStateId StateId() const; - - public: // From CMMCScBkupStateOpAware - TMMCScBkupStateId NextStateBackupId( TBool aPartial ) const; - TMMCScBkupStateId NextStateRestoreId( TBool aPartial ) const; - - private: // From CMMCScBkupStateOpAware - void PerformStateInitBackupL( TBool aPartial ); - void PerformStateInitRestoreL( TBool aPartial ); - void PerformAsynchronousStateStepBackupL( TBool aPartial ); - void PerformAsynchronousStateStepRestoreL( TBool aPartial ); - void PerformLastRightsBackupL( TBool aPartial ); - void PerformLastRightsRestoreL( TBool aPartial ); - TBool PerformAsynchronousErrorCleanupBackup( TBool aPartial, TInt aError ); - TBool PerformAsynchronousErrorCleanupRestore( TBool aPartial, TInt aError ); - - private: // From CMMCScBkupState - void PerformAsynchronousCancellation(); - - private: // From MMMCScBkupIndexHandler - void AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ); - - private: // Internal enumerations - enum TJavaState - { - EJavaStateIdle = 0, - EJavaStateMidlet, - EJavaStateMidletData - }; - - private: // Internal methods - void BackupMidletL(); - void BackupMidletDataL(); - void RestoreMidletL(); - void RestoreMidletDataL(); - - private: // Member data - - // - TInt iIndexValueCurrent; - // - TJavaState iCurrentJavaState; - // - RArray iRestoreEntries; - // - CMMCScBkupWriteDataTransferRequest< TJavaTransferType >* iBackupTransferObjectMidlet; - CMMCScBkupWriteDataTransferRequest< TJavaTransferType >* iBackupTransferObjectMidletData; - CMMCScBkupReadDataTransferRequest< TJavaTransferType >* iRestoreTransferObjectMidlet; - CMMCScBkupReadDataTransferRequest< TJavaTransferType >* iRestoreTransferObjectMidletData; - }; - - - - - -#endif // __CMMCSCBKUPSTATEARCHIVEOPJAVADATA_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpPassiveData.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpPassiveData.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpPassiveData -* -* -*/ - -#ifndef __CMMCSCBKUPSTATEARCHIVEOPPASSIVEDATA_H__ -#define __CMMCSCBKUPSTATEARCHIVEOPPASSIVEDATA_H__ - -// System includes -#include - -// User includes -#include "CMMCScBkupStateOpAware.h" -#include "TMMCScBkupArchiveVector.h" -#include "CMMCScBkupTransferWriteRequest.h" -#include "CMMCScBkupTransferReadRequest.h" - -// Namespaces -using namespace conn; - -// Classes referenced -class CMMCScBkupDataOwnerInfo; - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpPassiveData) : public CMMCScBkupStateOpAware, public MMMCScBkupIndexHandler - { - public: - - /** - * Static constructor - */ - static CMMCScBkupStateArchiveOpPassiveData* NewL( MMMCScBkupDriver& aDriver ); - - /** - * C++ destructor - */ - ~CMMCScBkupStateArchiveOpPassiveData( ); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateArchiveOpPassiveData( MMMCScBkupDriver& aDriver ); - - public: // From CMMCScBkupState - TMMCScBkupStateId StateId() const; - - public: // From CMMCScBkupStateOpAware - TMMCScBkupStateId NextStateBackupId( TBool aPartial ) const; - TMMCScBkupStateId NextStateRestoreId( TBool aPartial ) const; - - private: // From CMMCScBkupStateOpAware - void PerformStateInitBackupL( TBool aPartial ); - void PerformStateInitRestoreL( TBool aPartial ); - void PerformAsynchronousStateStepBackupL( TBool aPartial ); - void PerformAsynchronousStateStepRestoreL( TBool aPartial ); - void PerformLastRightsBackupL( TBool aPartial ); - TBool PerformAsynchronousErrorCleanupBackup( TBool aPartial, TInt aError ); - TBool PerformAsynchronousErrorCleanupRestore( TBool aPartial, TInt aError ); - - private: // From CMMCScBkupState - void PerformAsynchronousCancellation(); - - private: // From MMMCScBkupIndexHandler - void AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ); - - private: // Member data - - // - TInt iIndexValueCurrent; - // - CMMCScBkupWriteDataTransferRequest< TTransferDataType >* iBackupTransferObject; - // - CMMCScBkupReadDataTransferRequest< TTransferDataType >* iRestoreTransferObject; - }; - - - - -#endif // __CMMCSCBKUPSTATEARCHIVEOPPASSIVEDATA_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpPublicDataFiles.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpPublicDataFiles.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpPublicDataFiles -* -* -*/ - -#ifndef __CMMCSCBKUPSTATEARCHIVEOPPUBLICDATAFILES_H__ -#define __CMMCSCBKUPSTATEARCHIVEOPPUBLICDATAFILES_H__ - -// System includes -#include - -// User includes -#include "CMMCScBkupStateOpAware.h" - -// Namespaces -using namespace conn; - -// Classes referenced -class CMMCScBkupDataOwnerInfo; - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpPublicDataFiles) : public CMMCScBkupStateOpAware - { - public: - - /** - * Static constructor - */ - static CMMCScBkupStateArchiveOpPublicDataFiles* NewL( MMMCScBkupDriver& aDriver ); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateArchiveOpPublicDataFiles( MMMCScBkupDriver& aDriver ); - - public: // From CMMCScBkupState - TMMCScBkupStateId StateId() const; - - public: // From CMMCScBkupStateOpAware - TMMCScBkupStateId NextStateBackupId( TBool aPartial ) const; - TMMCScBkupStateId NextStateRestoreId( TBool aPartial ) const; - - private: // From CMMCScBkupStateOpAware - void PerformStateInitBackupL( TBool aPartial ); - void PerformStateInitRestoreL( TBool aPartial ); - void PerformAsynchronousStateStepBackupL( TBool aPartial ); - void PerformAsynchronousStateStepRestoreL( TBool aPartial ); - void PerformLastRightsBackupL( TBool aPartial ); - void PerformLastRightsRestoreL( TBool aPartial ); - TBool PerformAsynchronousErrorCleanupBackup( TBool aPartial, TInt aError ); - TBool PerformAsynchronousErrorCleanupRestore( TBool aPartial, TInt aError ); - void PerformAsynchronousCancellation(); - - private: // Internal enumerations - - /** - * - */ - enum TState - { - EStateCommonIdle = 0, - EStateCommonKickOff, - EStateCommonProcessingFile, - EStateBackupAddIndexRecord, - EStateRestoreResetAttributes - }; - - private: // Internal methods - - /** - * - */ - void CompressingAndWritingFileL(); - - /** - * - */ - void DecompressingAndWritingFileL(); - - /** - * - */ - void AddIndexRecordL(); - - /** - * - */ - void RestoreFileAttributesL(); - - /** - * - */ - inline void SetState(TState aState) { iState = aState; } - - /** - * - */ - inline TState State() const { return iState; } - - private: // Member data - - // - TInt iIndexValueCurrent; - // - TState iState; - }; - - -#endif // __CMMCSCBKUPSTATEARCHIVEOPPUBLICDATAFILES_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpSystemData.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpSystemData.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpSystemData -* -* -*/ - -#ifndef __CMMCSCBKUPSTATEARCHIVEOPSYSTEMDATA_H__ -#define __CMMCSCBKUPSTATEARCHIVEOPSYSTEMDATA_H__ - -// System includes -#include - -// User includes -#include "CMMCScBkupStateOpAware.h" -#include "TMMCScBkupArchiveVector.h" -#include "CMMCScBkupTransferWriteRequest.h" -#include "CMMCScBkupTransferReadRequest.h" - -// Namespaces -using namespace conn; - -// Classes referenced -class CMMCScBkupDataOwnerInfo; - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpSystemData) : public CMMCScBkupStateOpAware, public MMMCScBkupIndexHandler - { - public: - - /** - * Static constructor - */ - static CMMCScBkupStateArchiveOpSystemData* NewL( MMMCScBkupDriver& aDriver ); - - /** - * C++ destructor - */ - ~CMMCScBkupStateArchiveOpSystemData( ); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateArchiveOpSystemData( MMMCScBkupDriver& aDriver ); - - public: // From CMMCScBkupState - TMMCScBkupStateId StateId() const; - - public: // From CMMCScBkupStateOpAware - TMMCScBkupStateId NextStateBackupId( TBool aPartial ) const; - TMMCScBkupStateId NextStateRestoreId( TBool aPartial ) const; - - private: // From CMMCScBkupStateOpAware - void PerformStateInitBackupL( TBool aPartial ); - void PerformStateInitRestoreL( TBool aPartial ); - void PerformAsynchronousStateStepBackupL( TBool aPartial ); - void PerformAsynchronousStateStepRestoreL( TBool aPartial ); - void PerformLastRightsBackupL( TBool aPartial ); - void PerformLastRightsRestoreL( TBool aPartial ); - TBool PerformAsynchronousErrorCleanupBackup( TBool aPartial, TInt aError ); - TBool PerformAsynchronousErrorCleanupRestore( TBool aPartial, TInt aError ); - - private: // From CMMCScBkupState - void PerformAsynchronousCancellation(); - - private: // From MMMCScBkupIndexHandler - void AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ); - - private: // Member data - - // - TInt iIndexValueCurrent; - // Associated secure id of the data owner (if it has one) - TSecureId iSecureId; - // - CMMCScBkupWriteDataTransferRequest< TPackageDataType >* iBackupTransferObject; - CMMCScBkupReadDataTransferRequest< TPackageDataType >* iRestoreTransferObject; - }; - - - - - -#endif // __CMMCSCBKUPSTATEARCHIVEOPSYSTEMDATA_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateFactory.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateFactory.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateFactory -* -* -*/ - -#ifndef __CMMCSCBKUPSTATEFACTORY_H__ -#define __CMMCSCBKUPSTATEFACTORY_H__ - -// User includes -#include "MMCScBkupStateIds.h" -#include "MMCScBkupOperations.h" - -// Classes referenced -class CMMCScBkupState; -class MMMCScBkupDriver; - -// Type definitions -typedef RPointerArray RMMCScBkupStateArray; - - - -/** -* -* -* @since 3.0 -*/ -class CMMCScBkupStateFactory : public CBase - { - public: - /** - * - */ - static CMMCScBkupStateFactory* FactoryByOperationTypeLC( TMMCScBkupOperationType aOperationType ); - - protected: - - /** - * - */ - CMMCScBkupStateFactory(); - - public: // From CMMCScBkupStateFactory - - /** - * - */ - virtual CMMCScBkupState* GetStateLC(TMMCScBkupStateId aCurrentState, MMMCScBkupDriver& aDriver) = 0; - }; - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateFactoryBackup) : public CMMCScBkupStateFactory - { - public: - static CMMCScBkupStateFactoryBackup* NewL(); - - private: - CMMCScBkupStateFactoryBackup(); - - public: // From CMMCScBkupStateFactory - CMMCScBkupState* GetStateLC(TMMCScBkupStateId aRequiredType, MMMCScBkupDriver& aDriver); - }; - - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateFactoryRestore) : public CMMCScBkupStateFactory - { - public: - static CMMCScBkupStateFactoryRestore* NewL(); - - private: - CMMCScBkupStateFactoryRestore(); - - public: // From CMMCScBkupStateFactory - CMMCScBkupState* GetStateLC(TMMCScBkupStateId aRequiredType, MMMCScBkupDriver& aDriver); - }; - - - - -#endif // __CMMCSCBKUPSTATEFACTORY_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateGetDataOwnerStatuses.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateGetDataOwnerStatuses.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateGetDataOwnerStatuses -* -* -*/ - -#ifndef __CMMCSCBKUPSTATEGETDATAOWNERSTATUSES_H__ -#define __CMMCSCBKUPSTATEGETDATAOWNERSTATUSES_H__ - -// User includes -#include "CMMCScBkupState.h" - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateGetDataOwnerStatuses) : public CMMCScBkupState - { - public: - - /** - * Static constructor - */ - static CMMCScBkupStateGetDataOwnerStatuses* NewL( MMMCScBkupDriver& aDriver ); - - /** - * C++ destructor - */ - ~CMMCScBkupStateGetDataOwnerStatuses( ); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateGetDataOwnerStatuses( MMMCScBkupDriver& aDriver ); - - public: // From CMMCScBkupState - TMMCScBkupStateId StateId() const; - TMMCScBkupStateId NextStateId() const; - TStateExecution CategorySpecific() const { return EStatePerCategory; } - - private: // From CMMCScBkupState - void PerformStateInitL(); - void PerformAsynchronousStateStepL(); - - private: // Internal state enumeration - - /** - * - */ - enum TState - { - EPrearingQuery = 0, - EGettingStatus, - EProcessingResults - }; - - private: // Internal methods - inline TState State() const { return iState; } - inline void SetState(TState aState) { iState = aState; } - // - void PrepareQueryL(); - void ProcessStatusResultsL(); - - private: // Member data - - // - RSIDStatusArray iStatusArray; - // - TState iState; - }; - - - - -#endif // __CMMCSCBKUPSTATEGETDATAOWNERSTATUSES_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateGetDataOwners.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateGetDataOwners.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateGetDataOwners -* -* -*/ - -#ifndef __CMMCSCBKUPSTATEGETDATAOWNERS_H__ -#define __CMMCSCBKUPSTATEGETDATAOWNERS_H__ - -// User includes -#include "CMMCScBkupState.h" - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateGetDataOwners) : public CMMCScBkupState - { - public: - - /** - * Static constructor - */ - static CMMCScBkupStateGetDataOwners* NewL( MMMCScBkupDriver& aDriver ); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateGetDataOwners( MMMCScBkupDriver& aDriver ); - - public: // From CMMCScBkupState - TMMCScBkupStateId StateId() const; - TMMCScBkupStateId NextStateId() const; - - private: // From CMMCScBkupState - void PerformStateInitL(); - void PerformAsynchronousStateStepL(); - }; - - - - -#endif // __CMMCSCBKUPSTATEGETDATAOWNERS_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateNotifyAllSnapshotsSupplied.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateNotifyAllSnapshotsSupplied.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateNotifyAllSnapshotsSupplied -* -* -*/ - -#ifndef __CMMCSCBKUPSTATENOTIFYALLSNAPSHOTSSUPPLIED_H__ -#define __CMMCSCBKUPSTATENOTIFYALLSNAPSHOTSSUPPLIED_H__ - -// User includes -#include "MMCScBkupOperations.h" -#include "CMMCScBkupState.h" - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateNotifyAllSnapshotsSupplied) : public CMMCScBkupState - { - public: - - /** - * Static constructor - */ - static CMMCScBkupStateNotifyAllSnapshotsSupplied* NewL( MMMCScBkupDriver& aDriver ); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateNotifyAllSnapshotsSupplied( MMMCScBkupDriver& aDriver ); - - public: // From CMMCScBkupState - TMMCScBkupStateId StateId() const; - TMMCScBkupStateId NextStateId() const; - - private: // From CMMCScBkupState - void PerformStateInitL(); - }; - - - - -#endif // __CMMCSCBKUPSTATENOTIFYALLSNAPSHOTSSUPPLIED_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateOpAware.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateOpAware.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateOpAware -* -* -*/ - -#ifndef __CMMCSCBKUPSTATEOPAWARE_H__ -#define __CMMCSCBKUPSTATEOPAWARE_H__ - -// User includes -#include "CMMCScBkupState.h" -#include "MMCScBkupOperations.h" - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateOpAware) : public CMMCScBkupState - { - protected: - - /** - * C++ default constructor - */ - CMMCScBkupStateOpAware( MMMCScBkupDriver& aDriver, TInt aPriority = CActive::EPriorityIdle ); - - public: // From CMMCScBkupState - - /** - * - */ - TMMCScBkupStateId NextStateId() const; - - /** - * - */ - TStateExecution CategorySpecific() const { return EStatePerCategory; } - - protected: // New Framework - - /** - * - */ - virtual TMMCScBkupStateId NextStateBackupId( TBool aPartial ) const = 0; - - /** - * - */ - virtual TMMCScBkupStateId NextStateRestoreId( TBool aPartial ) const = 0; - - protected: // New Framework - - /** - * - */ - virtual void PerformStateInitBackupL( TBool aPartial ) = 0; - - /** - * - */ - virtual void PerformStateInitRestoreL( TBool aPartial ) = 0; - - /** - * - */ - virtual void PerformAsynchronousStateStepBackupL( TBool aPartial ); - - /** - * - */ - virtual void PerformAsynchronousStateStepRestoreL( TBool aPartial ); - - /** - * - */ - virtual void PerformAsynchronousCancellationBackup( TBool aPartial ); - - /** - * - */ - virtual void PerformAsynchronousCancellationRestore( TBool aPartial ); - - /** - * - */ - virtual void PerformLastRightsBackupL( TBool aPartial ); - - /** - * - */ - virtual void PerformLastRightsRestoreL( TBool aPartial ); - - /** - * - */ - virtual TBool PerformAsynchronousErrorCleanupBackup( TBool aPartial, TInt aError ); - - /** - * - */ - virtual TBool PerformAsynchronousErrorCleanupRestore( TBool aPartial, TInt aError ); - - protected: // From CMMCScBkupState - void PerformStateInitL(); - void PerformAsynchronousStateStepL(); - void PerformAsynchronousCancellation(); - void PerformLastRightsL(); - TBool PerformAsynchronousErrorCleanup( TInt aError ); - }; - - - - - -#endif // __CMMCSCBKUPSTATEOPAWARE_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateRequestListOfPublicFiles.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateRequestListOfPublicFiles.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateRequestListOfPublicFiles -* -* -*/ - -#ifndef __CMMCSCBKUPSTATEREQUESTLISTOFPUBLICFILES_H__ -#define __CMMCSCBKUPSTATEREQUESTLISTOFPUBLICFILES_H__ - -// User includes -#include "CMMCScBkupState.h" -#include "CMMCScBkupDriveSpecificRequest.h" - -// Namespaces -using namespace conn; - -// Classes referenced -class CMMCScBkupDataOwnerInfo; -class CMMCScBkupStateRequestSpecificPublicFileInfo; - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateRequestListOfPublicFiles) : public CMMCScBkupState - { - public: - - /** - * Static constructor - */ - static CMMCScBkupStateRequestListOfPublicFiles* NewL( MMMCScBkupDriver& aDriver ); - - /** - * C++ destructor - */ - ~CMMCScBkupStateRequestListOfPublicFiles( ); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateRequestListOfPublicFiles( MMMCScBkupDriver& aDriver ); - - /** - * Second phase constructor - */ - void ConstructL( ); - - public: // From CMMCScBkupState - TMMCScBkupStateId StateId() const; - TMMCScBkupStateId NextStateId() const; - TStateExecution CategorySpecific() const { return EStatePerCategory; } - - private: // From CMMCScBkupState - void PerformStateInitL(); - void PerformAsynchronousStateStepL(); - TBool PerformAsynchronousErrorCleanup(TInt aError); - void PerformAsynchronousCancellation(); - void PerformLastRightsL(); - - private: // Data members - - // - TInt iCurrentDataOwnerIndex; - // - CMMCScBkupStateRequestSpecificPublicFileInfo* iRequestObject; - }; - - - - - - - -/** -* -* -* @since 3.0 -*/ -class CMMCScBkupStateRequestSpecificPublicFileInfo : public CMMCScBkupDriveSpecificRequest - { - public: - - /** - * - */ - static CMMCScBkupStateRequestSpecificPublicFileInfo* NewL( MMMCScBkupDriver& aDriver ); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateRequestSpecificPublicFileInfo( MMMCScBkupDriver& aDriver ); - - public: // API - - /** - * - */ - void RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver ); - - private: // From CActive - void RunL(); - void DoCancel(); - - private: // Internal methods - inline MMMCScBkupDriver& Driver() { return iDriver; } - - private: // Member data - - // - MMMCScBkupDriver& iDriver; - // - CMMCScBkupDataOwnerInfo* iOwner; - }; - - - - - - - -#endif // __CMMCSCBKUPSTATEREQUESTLISTOFPUBLICFILES_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateRequestSizeOfBackupData.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateRequestSizeOfBackupData.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateRequestSizeOfBackupData -* -* -*/ - -#ifndef __CMMCSCBKUPSTATEREQUESTSIZEOFBACKUPDATA_H__ -#define __CMMCSCBKUPSTATEREQUESTSIZEOFBACKUPDATA_H__ - -// User includes -#include "MMCScBkupOperations.h" -#include "CMMCScBkupState.h" -#include "CMMCScBkupDriveSpecificRequest.h" - -// Classes referenced -class CMMCScBkupDataOwnerInfo; -class CMMCScBkupStateRequestSizeOfDataOwner; - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateRequestSizeOfBackupData) : public CMMCScBkupState - { - public: - - /** - * Static constructor - */ - static CMMCScBkupStateRequestSizeOfBackupData* NewL( MMMCScBkupDriver& aDriver ); - - /** - * C++ destructor - */ - ~CMMCScBkupStateRequestSizeOfBackupData( ); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateRequestSizeOfBackupData( MMMCScBkupDriver& aDriver ); - - /** - * Second phase constructor - */ - void ConstructL( ); - - public: // From CMMCScBkupState - TMMCScBkupStateId StateId() const; - TMMCScBkupStateId NextStateId() const; - TStateExecution CategorySpecific() const { return EStatePerCategory; } - - private: // From CMMCScBkupState - void PerformStateInitL(); - void PerformAsynchronousStateStepL(); - TBool PerformAsynchronousErrorCleanup( TInt aError ); - void PerformAsynchronousCancellation(); - - private: // Data members - - // - TInt iCurrentDataOwnerIndex; - // - CMMCScBkupStateRequestSizeOfDataOwner* iRequestObject; - }; - - - - - - - -/** -* NB. This class only sizes active, passive, system and java data. Public -* data is sized elsewhere. -* -* @since 3.0 -*/ -class CMMCScBkupStateRequestSizeOfDataOwner : public CMMCScBkupDriveSpecificRequest - { - public: - - /** - * - */ - static CMMCScBkupStateRequestSizeOfDataOwner* NewL( MMMCScBkupDriver& aDriver ); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateRequestSizeOfDataOwner( MMMCScBkupDriver& aDriver ); - - public: // API - - /** - * - */ - void RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver ); - - private: // From CActive - void RunL(); - void DoCancel(); - - private: // Internal methods - inline MMMCScBkupDriver& Driver() { return iDriver; } - // - TUint GetActiveAndPassiveDataSizesL( const CDataOwnerInfo& aOwner, CSBGenericDataType& aIdentifier, TDriveNumber aDrive ); - TUint GetSIDSpecificSizeL( TSecureId aSecureID, TDriveNumber aDrive, TTransferDataType aDataType ); - TUint GetSystemDataSizesL( const CDataOwnerInfo& aOwner, CSBGenericDataType& aIdentifier, TDriveNumber aDrive ); - TUint GetJavaDataSizesL( const CDataOwnerInfo& aOwner, CSBGenericDataType& aIdentifier, TDriveNumber aDrive ); - TUint GetJavaSpecificSizeL( const TDesC& aHash, TDriveNumber aDrive, TJavaTransferType aDataType ); - - private: // Member data - - // - MMMCScBkupDriver& iDriver; - // - CMMCScBkupDataOwnerInfo* iOwner; - }; - - - - - -#endif // __CMMCSCBKUPSTATEREQUESTSIZEOFBACKUPDATA_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateSetPhoneMode.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateSetPhoneMode.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupStateSetPhoneMode -* -* -*/ - -#ifndef __CMMCSCBKUPSTATESETPHONEMODE_H__ -#define __CMMCSCBKUPSTATESETPHONEMODE_H__ - -// User includes -#include "MMCScBkupOperations.h" -#include "CMMCScBkupState.h" - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateSetPhoneMode) : public CMMCScBkupState - { - public: - - /** - * Static constructor - */ - static CMMCScBkupStateSetPhoneMode* NewL( MMMCScBkupDriver& aDriver ); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateSetPhoneMode( MMMCScBkupDriver& aDriver ); - - public: // From CMMCScBkupState - TMMCScBkupStateId StateId() const; - TMMCScBkupStateId NextStateId() const; - - private: // From CMMCScBkupState - void PerformStateInitL(); - void PerformAsynchronousStateStepL(); - }; - - - - -#endif // __CMMCSCBKUPSTATESETPHONEMODE_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupStateValidateDiskSpace.h --- a/filemanager/bkupengine/inc/CMMCScBkupStateValidateDiskSpace.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration for CMMCScBkupStateValidateDiskSpace -* -* -*/ - -#ifndef __CMMCSCBKUPSTATEVALIDATEDISKSPACE_H__ -#define __CMMCSCBKUPSTATEVALIDATEDISKSPACE_H__ - -// User includes -#include "CMMCScBkupState.h" - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupStateValidateDiskSpace) : public CMMCScBkupState - { - public: - - /** - * Static constructor - */ - static CMMCScBkupStateValidateDiskSpace* NewL( MMMCScBkupDriver& aDriver ); - - /** - * Destructor - */ - ~CMMCScBkupStateValidateDiskSpace(); - - private: - - /** - * C++ default constructor - */ - CMMCScBkupStateValidateDiskSpace( MMMCScBkupDriver& aDriver ); - - // Second phase - void ConstructL( ); - - public: // From CMMCScBkupState - TMMCScBkupStateId StateId() const; - TMMCScBkupStateId NextStateId() const; - TStateExecution CategorySpecific() const { return EStatePerCategoryCommon; } - - private: // From CMMCScBkupState - void PerformStateInitL(); - void PerformAsynchronousStateStepL(); - - private: // Internal methods - - /** - * - */ - void ValidateFreeSpaceBeforeBackupL(); - void ValidateFreeSpaceBeforeRestoreL(); - - private: // Member data - - // - TInt64 iCumulatedSize; - // - RArray iDriveSizes; - // - RArray iDriveMaxFileSizes; - }; - - -#endif // __CMMCSCBKUPSTATEVALIDATEDISKSPACE_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupTransferReadRequest.h --- a/filemanager/bkupengine/inc/CMMCScBkupTransferReadRequest.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,223 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupReadDataTransferRequestBase -* -* -*/ - -#ifndef __CMMCSCBKUPTRANSFERREADREQUEST_H__ -#define __CMMCSCBKUPTRANSFERREADREQUEST_H__ - -// User includes -#include "MMCScBkupConfig.h" -#include "MMCScBkupSBEUtils.h" -#include "TMMCScBkupOwnerDataType.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "CMMCScBkupTransferRequest.h" -#include "CMMCScBkupIndexWithIdentifier.h" - -// Classes referenced -class MMMCScBkupDriver; -class CMMCScBkupArchiveFooter; - -// Constants -const TInt KMMCScBkupDefaultChunkReadSize = 4096; // 4k read chunks - -// CMMCScBkupIndexEntry - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupReadDataTransferRequestBase) : public CMMCScBkupTransferRequestBase - { - public: - - /** - * C++ destructor - */ - ~CMMCScBkupReadDataTransferRequestBase(); - - protected: - - /** - * C++ default constructor - */ - CMMCScBkupReadDataTransferRequestBase( MMMCScBkupDriver& aDriver, - TMMCScBkupOwnerDataType aElementType, - TInt aChunkSize = KMMCScBkupDefaultChunkReadSize, - TInt aPriority = CActive::EPriorityIdle ); - - public: // API - - /** - * - */ - void RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver, const RArray& aEntries ); - - protected: // New Framework API - - /** - * - */ - virtual CSBGenericTransferType* PrepareTransferTypeL( const CSBGenericDataType& aGeneric, - TDriveNumber aDrive, TInt aVersion ) const = 0; - - private: // From CMMCScBkupTransferRequest - TBool ProcessChunkOfDataL(); - void PrepareDataTransferL(); - - private: // Internal methods - - /** - * - */ - void ReadChunkL( TDes8& aSink, TInt aLength ); - - /** - * - */ - TBool DoProcessChunkOfDataL(); - - /** - * - */ - TBool PrepareForNextEntry(); - - /** - * - */ - TDriveNumber CurrentDrive() const; - - /** - * - */ - const TMMCScBkupArchiveVector& CurrentReadInfo() const; - - /** - * - */ - const TMMCScBkupArchiveDriveAndVector& CurrentEntry() const; - - /** - * - */ - inline TInt CurrentOffset() const { return iCurrentOffset; } - - private: // From CActive - TInt RunError( TInt aError ); - - private: // Debugging support - - /** - * - */ -#ifdef DEBUGGING_DATA_TRANSFER - void DumpTransferDataL( RFs& aFsSession, const TDesC8& aData ) const; -#endif - - private: // Member data - - // Owned externally - // - const RArray* iEntries; - - // Owned by this object - - // Pointer to the SBE's shared chunk. It *must* be a reference - // because otherwise the SBE loses track of what we actually write - // to the chunk! - TPtr8* iTransferChunkPointer; - // - const TInt iReadChunkSize; - // - TInt iCurrentIndex; - // - TBool iFinishedSupplyingData; - // - CSBGenericTransferType* iTransferType; - // - TInt iCurrentOffset; - // - HBufC8* iTemporaryTransferSink; - }; - - - - - - - - - -/** -* -* -* @since 3.0 -*/ -template -class CMMCScBkupReadDataTransferRequest : public CMMCScBkupReadDataTransferRequestBase - { - public: // Construction - - /** - * - */ - inline static CMMCScBkupReadDataTransferRequest* NewL( MMMCScBkupDriver& aDriver, - TMMCScBkupOwnerDataType aElementType, - Type aTransferEnumType, - TInt aChunkSize = KMMCScBkupDefaultChunkReadSize, - TInt aPriority = CActive::EPriorityIdle ) - { - CMMCScBkupReadDataTransferRequest* self = new(ELeave) CMMCScBkupReadDataTransferRequest( aDriver, aElementType, aTransferEnumType, aChunkSize, aPriority ); - return self; - } - - private: // Internal construction - - /** - * C++ default constructor - */ - inline CMMCScBkupReadDataTransferRequest( MMMCScBkupDriver& aDriver, - TMMCScBkupOwnerDataType aElementType, - Type aTransferEnumType, - TInt aChunkSize = KMMCScBkupDefaultChunkReadSize, - TInt aPriority = CActive::EPriorityIdle ) - : CMMCScBkupReadDataTransferRequestBase( aDriver, aElementType, aChunkSize, aPriority), - iTransferEnumType( aTransferEnumType ) - { - } - - private: // From CMMCScBkupTransferRequest - inline CSBGenericTransferType* PrepareTransferTypeL( const CSBGenericDataType& aGeneric, - TDriveNumber aDrive, TInt aVersion ) const - { - CSBGenericTransferType* transferType = MMCScBkupSBEUtils::TransferTypeLC( aGeneric, aDrive, - iTransferEnumType, aVersion ); - CleanupStack::Pop( transferType ); - return transferType; - } - - private: // Member data - - // - Type iTransferEnumType; - }; - - - -#endif // __CMMCSCBKUPTRANSFERREADREQUEST_H__ - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupTransferRequest.h --- a/filemanager/bkupengine/inc/CMMCScBkupTransferRequest.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,225 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupTransferRequestBase -* -* -*/ - -#ifndef __CMMCSCBKUPTRANSFERREQUEST_H__ -#define __CMMCSCBKUPTRANSFERREQUEST_H__ - -// System includes -#include -#include - -// User includes -#include "TMMCScBkupDriveFilter.h" -#include "TMMCScBkupOwnerDataType.h" -#include "TMMCScBkupArchiveVector.h" - -// Namespaces -using namespace conn; - -// Classes referenced -class CMMCScBkupDataOwnerInfo; -class MMMCScBkupDriver; -class TMMCScBkupArchiveVector; - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupTransferRequestBase) : public CActive - { - public: - - /** - * C++ destructor - */ - ~CMMCScBkupTransferRequestBase(); - - protected: - - /** - * C++ default constructor - */ - CMMCScBkupTransferRequestBase( MMMCScBkupDriver& aDriver, TMMCScBkupOwnerDataType aElementType, TBool aUpdateOperationalSizes = ETrue, TInt aPriority = CActive::EPriorityIdle ); - - public: // API - - /** - * - */ - virtual void RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver ); - - protected: // From CActive - void RunL(); - void DoCancel(); - TInt RunError( TInt aError ); - - protected: // State relation - - /** - * - */ - enum TState - { - EIdle = 0, - EFinished, - // - ETransferData, - EProcessData - }; - - /** - * - */ - inline TState State() const { return iState; } - - /** - * - */ - inline void SetState( TState aState ) { iState = aState; } - - protected: // Internal framework API - - /** - * - */ - virtual TBool ProcessChunkOfDataL() = 0; - - /** - * - */ - virtual void PrepareDataTransferL() = 0; - - /** - * - */ - virtual TDriveNumber CurrentDrive() const = 0; - - /** - * - */ - virtual void SingleDriveTransferCompleteL(); - - /** - * - */ - virtual void TransferCompleteL(); - - protected: // Internal methods - - /** - * - */ - void CompleteSelf( TInt aCompletionCode = KErrNone ); - - /** - * - */ - inline MMMCScBkupDriver& Driver() { return iDriver; } - - /** - * - */ - inline CMMCScBkupDataOwnerInfo& DataOwner() { return *iDataOwner; } - - /** - * - */ - inline const CMMCScBkupDataOwnerInfo& DataOwner() const { return *iDataOwner; } - - /** - * - */ - inline TMMCScBkupArchiveVector& Info() { return iCurrentInfo; } - - /** - * - */ - inline const TMMCScBkupArchiveVector& Info() const { return iCurrentInfo; } - - /** - * - */ - inline TMMCScBkupOwnerDataType ElementType() const { return iElementType; } - - /** - * - */ - inline void DataTransferred( TInt aAmount ) { iDataTransferred += aAmount; } - - /** - * - */ - inline TInt AmountOfDataTransferred() const { return iDataTransferred; } - - /** - * - */ - inline void ResetDataTransferCounter() { iDataTransferred = 0; } - - private: // Internal methods - - /** - * - */ - void SetObserver( TRequestStatus& aObserver ); - - /** - * - */ - void CompleteObserverRequest( TInt aCompletionCode ); - - private: // Internal state methods - - /** - * - */ - void ProcessDataChunkL(); - - private: // Member data - - // Owned externally - // - MMMCScBkupDriver& iDriver; - // - CMMCScBkupDataOwnerInfo* iDataOwner; - // - TRequestStatus* iObserver; - - // Owned by this class - // - TInt iDataTransferred; - // - TState iState; - // - TMMCScBkupArchiveVector iCurrentInfo; - // - const TMMCScBkupOwnerDataType iElementType; - // - const TBool iUpdateOperationalSizes; - }; - - - - - - -#endif // __CMMCSCBKUPTRANSFERREQUEST_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/CMMCScBkupTransferWriteRequest.h --- a/filemanager/bkupengine/inc/CMMCScBkupTransferWriteRequest.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,235 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for CMMCScBkupWriteDataTransferRequestBase -* -* -*/ - -#ifndef __CMMCSCBKUPTRANSFERWRITEREQUEST_H__ -#define __CMMCSCBKUPTRANSFERWRITEREQUEST_H__ - -// User includes -#include "MMCScBkupConfig.h" -#include "MMCScBkupSBEUtils.h" -#include "TMMCScBkupOwnerDataType.h" -#include "CMMCScBkupTransferRequest.h" -#include "CMMCScBkupDataOwnerInfo.h" - -// Classes referenced -class CMMCScBkupArchiveFooter; -class CMMCScBkupDriveAndOperationTypeManager; - -/** -* -* -* @since 3.0 -*/ -class MMMCScBkupIndexHandler - { - public: - - /** - * - */ - virtual void AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ) = 0; - }; - - - - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(CMMCScBkupWriteDataTransferRequestBase) : public CMMCScBkupTransferRequestBase - { - public: - - /** - * C++ destructor - */ - ~CMMCScBkupWriteDataTransferRequestBase(); - - public: // API - - /** - * - */ - void RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver, const CMMCScBkupDriveAndOperationTypeManager& aDriveAndOperations ); - - protected: - - /** - * C++ default constructor - */ - CMMCScBkupWriteDataTransferRequestBase( MMMCScBkupDriver& aDriver, - MMMCScBkupIndexHandler& aIndexHandler, - TMMCScBkupOwnerDataType aElementType, - TSBDerivedType aExpectedTransferType, - TInt aPriority = CActive::EPriorityIdle ); - - protected: // New Framework API - - /** - * - */ - virtual CSBGenericTransferType* PrepareTransferTypeL( const CSBGenericDataType& aGeneric, - TDriveNumber aDrive, TInt aVersion ) const = 0; - - protected: // From CMMCScBkupTransferRequestBase - - /** - * - */ - TBool ProcessChunkOfDataL(); - - /** - * - */ - void PrepareDataTransferL(); - - /** - * - */ - TDriveNumber CurrentDrive() const; - - private: // Internal methods - - /** - * - */ - inline void SetCurrentDrive( TDriveNumber aDrive ) { iCurrentDrive = aDrive; } - - /** - * - */ - void ValidateTransferInfoL( CSBGenericTransferType* aInfo ); - - /** - * - */ - void RequestDataTransferL(); - - private: // From CActive - TInt RunError( TInt aError ); - - private: - - /** - * - */ -#ifdef DEBUGGING_DATA_TRANSFER - void DumpTransferDataL( RFs& aFsSession, const TDesC8& aData ) const; -#endif - - - private: // Member data - - // Owned by this class - // - TMMCScBkupDriveFilter iDriveFilter; - // - MMMCScBkupIndexHandler& iIndexHandler; - // - const TSBDerivedType iExpectedTransferType; - // - const CMMCScBkupDriveAndOperationTypeManager* iDriveAndOperations; - // - RWriteStream iStream; - // - TBool iStreamIsOpen; - // - CSBGenericTransferType* iTransferType; - // - TBool iAdditionalTransferRequired; - // - TDriveNumber iCurrentDrive; - }; - - - - - - - - - - - -/** -* -* -* @since 3.0 -*/ -template -class CMMCScBkupWriteDataTransferRequest : public CMMCScBkupWriteDataTransferRequestBase - { - public: // Construction - - /** - * Static constructor - */ - inline static CMMCScBkupWriteDataTransferRequest* NewL( MMMCScBkupDriver& aDriver, - MMMCScBkupIndexHandler& aIndexHandler, - TMMCScBkupOwnerDataType aElementType, - TSBDerivedType aExpectedTransferType, - Type aTransferEnumType, - TInt aPriority = CActive::EPriorityIdle ) - { - CMMCScBkupWriteDataTransferRequest* self = new(ELeave) CMMCScBkupWriteDataTransferRequest( aDriver, aIndexHandler, aElementType, aExpectedTransferType, aTransferEnumType, aPriority ); - return self; - } - - private: // Internal construction - - /** - * C++ default constructor - */ - inline CMMCScBkupWriteDataTransferRequest( MMMCScBkupDriver& aDriver, - MMMCScBkupIndexHandler& aIndexHandler, - TMMCScBkupOwnerDataType aElementType, - TSBDerivedType aExpectedTransferType, - Type aTransferEnumType, - TInt aPriority ) - : CMMCScBkupWriteDataTransferRequestBase( aDriver, aIndexHandler, aElementType, aExpectedTransferType, aPriority ), - iTransferEnumType( aTransferEnumType ) - { - } - - private: // From CMMCScBkupTransferRequest - inline CSBGenericTransferType* PrepareTransferTypeL( const CSBGenericDataType& aGeneric, - TDriveNumber aDrive, TInt aVersion ) const - { - CSBGenericTransferType* transferType = MMCScBkupSBEUtils::TransferTypeLC( aGeneric, aDrive, - iTransferEnumType, aVersion ); - CleanupStack::Pop( transferType ); - return transferType; - } - - private: // Member data - - // - Type iTransferEnumType; - }; - - - - - -#endif // __CMMCSCBKUPTRANSFERWRITEREQUEST_H__ - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/MMCScBkupArchiveFlags.h --- a/filemanager/bkupengine/inc/MMCScBkupArchiveFlags.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for TMMCScBkupArchiveFlags -* -* -*/ - -#ifndef __MMCSCBKUPARCHIVEFLAGS_H__ -#define __MMCSCBKUPARCHIVEFLAGS_H__ - -enum TMMCScBkupArchiveFlags - { - EMMCScBkupArchiveFlagsDefault = 0x000, - EMMCScBkupArchiveFlagsContentValid = 0x001 - }; - - -#endif // __MMCSCBKUPARCHIVEFLAGS_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/MMCScBkupArchiveUtils.h --- a/filemanager/bkupengine/inc/MMCScBkupArchiveUtils.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for MMCScBkupArchiveUtils -* -* -*/ - -#ifndef __MMCSCBKUPARCHIVEUTILS_H__ -#define __MMCSCBKUPARCHIVEUTILS_H__ - -// System includes -#include -#include -#include - -// User includes -#include "TMMCScBkupArchiveVector.h" - -// Classes referenced -class CMMCScBkupArchiveHeader; -class MMMCScBkupArchiveDataInterface; - -// Constants -const TInt KMMCScBkupArchiveFileFormatFirstRestorableMajorVersion = 1; -const TInt KMMCScArchiveUidsByteCount = sizeof( TCheckedUid ); -const TInt KMMCScArchiveVersionByteCount = sizeof( TInt8 ) + sizeof( TInt8 ) + sizeof( TInt16 ); -const TInt KMMCScArchiveFooterLengthByteCount = sizeof( TUint32 ); -const TInt KMMCScArchiveFlagsByteCount = sizeof( TUint32 ); -const TInt KMMCScArchiveCrcByteCount = sizeof( TUint32 ); -const TInt KMMCScArchiveCategoryByteCount = sizeof( TUint32 ); -const TInt KMMCScSpareByteCount = 5 * sizeof(TInt32); -const TInt KMMCScArchivePhoneModelStringLength = sizeof(TUint8); - -/** -* -* -* @since 3.0 -*/ -class MMCScBkupArchiveUtils - { - public: // API - - /** - * - */ - static void ArchiveUidType( TUidType& aType ); - - /** - * - */ - static void ArchiveCheckedUid( TCheckedUid& aCheckedUids ); - - /** - * - */ - static HBufC8* PhoneModelFromArchiveLC( MMMCScBkupArchiveDataInterface& aADI ); - - /** - * - */ - static void ReadPhoneValidityInformationL( RFs& aFsSession, const TDesC& aFileName, HBufC8*& aPhoneModelData, TBitFlags& aArchiveFlags, TVersion& aArchiveVersion ); - - /** - * - */ - static TVersion ArchiveRunTimeFileFormatVersion(); - - /** - * - */ - static const TMMCScBkupArchiveVector& WriteHeaderL( MMMCScBkupArchiveDataInterface& aADI, TBitFlags aCategory ); - - /** - * - */ - static const TMMCScBkupArchiveVector& ReadHeaderL( MMMCScBkupArchiveDataInterface& aADI, CMMCScBkupArchiveHeader& aHeader ); - - /** - * - */ - static void SetArchiveContentAsValidL( RFile64& aArchive ); - - /** - * - */ - static void SetFooterLengthL( RFile64& aArchive, TInt aLength ); - - /** - * - */ - static TBitFlags ReadBkUpCategoryInformationL( RFs& aFsSession, const TDesC& aFileName ); - -#ifdef RD_FILE_MANAGER_BACKUP - /** - * - */ - static void SetArchiveCrcsL( RFile64& aArchive, TUint32 aCrc ); - - /** - * - */ - static TBool ValidateArchiveCrcsL( RFs& aFsSession, const TDesC& aFileName ); -#endif - - private: // Offsets - enum - { - EArchiveOffsetUids = 0, - EArchiveOffsetFileFormatVersion = EArchiveOffsetUids + KMMCScArchiveUidsByteCount, - EArchiveOffsetFooterLength = EArchiveOffsetFileFormatVersion + KMMCScArchiveVersionByteCount, - EArchiveOffsetArchiveFlags = EArchiveOffsetFooterLength + KMMCScArchiveFooterLengthByteCount, - EArchiveOffsetArchivePayloadCRC = EArchiveOffsetArchiveFlags + KMMCScArchiveFlagsByteCount, - EArchiveOffsetArchiveCategory = EArchiveOffsetArchivePayloadCRC + KMMCScArchiveCrcByteCount, - EArchiveOffsetArchiveHeaderCRC = EArchiveOffsetArchiveCategory + KMMCScArchiveCategoryByteCount, - EArchiveOffsetPadding = EArchiveOffsetArchiveHeaderCRC + KMMCScArchiveCrcByteCount, - EArchiveOffsetPhoneModelStringLength = EArchiveOffsetPadding + KMMCScSpareByteCount, - EArchiveOffsetPhoneModelString = EArchiveOffsetPhoneModelStringLength + KMMCScArchivePhoneModelStringLength - }; - - private: // Internal methods - - /** - * - */ - static TInt OffsetOfModelInformation(); - - /** - * - */ - static HBufC8* PhoneModelFromArchiveLC( RReadStream& aStream ); - - /** - * - */ - static TUint32 DefaultArchiveFlags(); - - /** - * - */ - static TBitFlags ReadArchiveFlagsL( RFile64& aFile ); - - /** - * - */ - static void ReadArchiveVersionL( RFile64& aFile, TVersion& aVersion ); - -#ifdef RD_FILE_MANAGER_BACKUP - /** - * - */ - static void SetArchiveCrcL( RFile64& aArchive, TUint32 aCrc, TUint aOffset ); - - /** - * - */ - static void CalculateCrcFromArchive( TUint32& aCrc, RFile64& aArchive, TUint32 aOffset, TUint32 aLength ); -#endif - }; - - - - -#endif // __MMCSCBKUPARCHIVEUTILS_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/MMCScBkupConfig.h --- a/filemanager/bkupengine/inc/MMCScBkupConfig.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +0,0 @@ -/* -* Copyright (c) 2005 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: Macros for scheduled backup configuration -* -* -*/ - -#ifndef __MMCSCBKUPCONFIG_H__ -#define __MMCSCBKUPCONFIG_H__ - -// System includes -#include -#include - - -/** -* -* -* @since 3.0 -*/ -const TDriveNumber KMMCScBkupTempFileDrive = EDriveC; - - -/** -* -* Folder for temporary files, which will be cleaned by Starter if temporary files not deleted. -* Currently in 3.0/3.1 folder from C and E drives is cleaned. -* -* @since 3.0 -*/ -_LIT(KMMCScBkupTempDir, ":\\System\\Temp\\"); - - -/** -* -* -* @since 3.0 -*/ -_LIT(KMMCScBkupMediaGalleryThumbnailFolder, "*\\_PAlbTN\\*"); //Photo Album Thumbnail folder -_LIT(KMMCScBkupVideoCenterFolderPath, "C:\\Data\\videocenter\\"); //video center folder -_LIT(KMMCScBkupVideoCenterFolder, "*\\videocenter\\*"); //video center folder -/** -* -* Allows the data that is received from the SBE or sent to the SBE to be dumped to individual -* files for comparison and inspection purposes. -* -* @since 3.0 -*/ -//#define DEBUGGING_DATA_TRANSFER - -/** -* -* Controls the various directories and files that are generated when debugging -* data transfer -* -* @since 3.0 -*/ -#ifdef DEBUGGING_DATA_TRANSFER - _LIT(KMMCScBkupDataTransferDebuggingAllFiles, "*.*"); - _LIT(KMMCScBkupDataTransferDebuggingFileName, "MMCBackupDataTransfer_0x%08x_(%c).dat"); - // - _LIT(KMMCScBkupDataTransferDebuggingPathRoot, "MMCDataDump\\"); - _LIT(KMMCScBkupDataTransferDebuggingPathDataJava, "JavData\\"); - _LIT(KMMCScBkupDataTransferDebuggingPathDataSystem, "SysData\\"); - _LIT(KMMCScBkupDataTransferDebuggingPathDataPassive, "PasData\\"); - _LIT(KMMCScBkupDataTransferDebuggingPathDataActive, "ActData\\"); - // - _LIT(KMMCScBkupDataTransferDebuggingPathDataBackup, "Backup\\"); - _LIT(KMMCScBkupDataTransferDebuggingPathDataRestore, "Restore\\"); -#endif - -/** -* -* Always makes the SBE logging directory - ensures logs are available -* -* @since 3.0 -*/ -//#define MAKE_SBE_LOGGING_DIRECTORY - -/** -* -* Always makes the MMC Engine logging directory -* -* @since 3.0 -*/ -//#define MAKE_MMCSCBKUP_LOGGING_DIRECTORY - -/** -* -* Controls whether logging is to file or to RDebug -* -* @since 3.0 -*/ -#ifdef _DEBUG -# define __MMCSCBKUPLOGGING_ENABLED__ -#if defined(__MMCSCBKUPLOGGING_ENABLED__) -//# define __MMCSCBKUP_DATA_LOGGING_ENABLED__ -#endif -//# define __MMCSCBKUPLOGGING_MODE_FILE__ -# define __MMCSCBKUPLOGGING_MODE_RDEBUG__ -#endif - - -/** -* Use these to disable backup for the various data types. -* -* E.g: -* -* __DEBUG_TESTING_SKIP_BACKUP_REG_DATA return -* -* ... will ensure that registration data is not backed up (for any DO). -* -* @since 3.0 -*/ -#define __DEBUG_TESTING_SKIP_BACKUP_REG_DATA -#define __DEBUG_TESTING_SKIP_BACKUP_ACT_DATA -#define __DEBUG_TESTING_SKIP_BACKUP_PAS_DATA -#define __DEBUG_TESTING_SKIP_BACKUP_SYS_DATA -#define __DEBUG_TESTING_SKIP_BACKUP_JAV_DATA -#define __DEBUG_TESTING_SKIP_BACKUP_PUB_DATA - -/** -* Use these to disable restore for the various data types -* -* E.g: -* -* __DEBUG_TESTING_SKIP_RESTORE_REG_DATA return -* -* ... will ensure that registration data is not restored (for any DO). -* -* @since 3.0 -*/ -#define __DEBUG_TESTING_SKIP_RESTORE_REG_DATA -#define __DEBUG_TESTING_SKIP_RESTORE_ACT_DATA -#define __DEBUG_TESTING_SKIP_RESTORE_PAS_DATA -#define __DEBUG_TESTING_SKIP_RESTORE_SYS_DATA -#define __DEBUG_TESTING_SKIP_RESTORE_JAV_DATA -#define __DEBUG_TESTING_SKIP_RESTORE_PUB_DATA - - -#endif // __MMCSCBKUPCONFIG_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/MMCScBkupDllUids.h --- a/filemanager/bkupengine/inc/MMCScBkupDllUids.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Contains the UIDs for FileManager / FileManagerBkupEngine -* -*/ - -#ifndef __MMCSCBKUPDLLUIDS_H__ -#define __MMCSCBKUPDLLUIDS_H__ - -// Module UIDs -#define KEPOCDLLUID2 0x1000008d // Symbian defined -#define KMMCAppEngUID3 0x101F4667 - -#endif // __MMCSCBKUPDLLUIDS_H__ - -// End Of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/MMCScBkupLogger.h --- a/filemanager/bkupengine/inc/MMCScBkupLogger.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* Copyright (c) 2005 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: -* Macro definition file for logging. -* -* -*/ - -#ifndef __MMCSCBKUPLOGGER_H__ -#define __MMCSCBKUPLOGGER_H__ - -// System includes -#include - -// User includes -#include "MMCScBkupConfig.h" -#include "TMMCScBkupOwnerDataType.h" - -class MMCScBkupLogger - { - public: - static void LogRaw( const TDesC& aData ); - static void Log( TRefByValue aFmt, ... ); - static void LogFile( TRefByValue aFmt, ... ); - static const TDesC& DataType( TMMCScBkupOwnerDataType aType ); - static const TDesC& FriendlyNameForSID( TSecureId aSID ); - }; - - -// Logging Macros -#if defined(__MMCSCBKUPLOGGING_ENABLED__) - - _LIT( KMMCScBkupLoggingFullPath, "C:\\Logs\\MMCScBkup\\" ); - - #define __LOG(aFmt) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes); } - #define __LOG1(aFmt, A) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A); } - #define __LOG2(aFmt, A, B) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A, B); } - #define __LOG3(aFmt, A, B, C) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A, B, C); } - #define __LOG4(aFmt, A, B, C, D) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A, B, C, D); } - #define __LOG5(aFmt, A, B, C, D, E) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A, B, C, D, E); } - #define __LOG6(aFmt, A, B, C, D, E, F) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A, B, C, D, E, F); } - #define __LOG7(aFmt, A, B, C, D, E, F, G) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A, B, C, D, E, F, G); } - #define __LOG8(aFmt, A, B, C, D, E, F, G, H) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A, B, C, D, E, F, G, H); } - - // Path for backup log containing possible errors encountered during backup - // or restore. This is needed because all errors won't interrupt operation. - _LIT( KMMCScBkupLoggingFullPathAndName, "C:\\Private\\101F84EB\\BURLog\\bur.txt" ); - - #define __LOGFILE(aFmt) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::LogFile(tempLogDes); } - #define __LOGFILE1(aFmt, A) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::LogFile(tempLogDes, A); } - #define __LOGFILE2(aFmt, A, B) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::LogFile(tempLogDes, A, B); } - #define __LOGFILE3(aFmt, A, B, C) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::LogFile(tempLogDes, A, B, C); } - -#else - - #define __LOG(aFmt) - #define __LOG1(aFmt, A) - #define __LOG2(aFmt, A, B) - #define __LOG3(aFmt, A, B, C) - #define __LOG4(aFmt, A, B, C, D) - #define __LOG5(aFmt, A, B, C, D, E) - #define __LOG6(aFmt, A, B, C, D, E, F) - #define __LOG7(aFmt, A, B, C, D, E, F, G) - #define __LOG8(aFmt, A, B, C, D, E, F, G, H) - - #define __LOGFILE(aFmt) - #define __LOGFILE1(aFmt, A) - #define __LOGFILE2(aFmt, A, B) - #define __LOGFILE3(aFmt, A, B, C) - -#endif - -#endif // __MMCSCBKUPLOGGER_H__ diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/MMCScBkupOperations.h --- a/filemanager/bkupengine/inc/MMCScBkupOperations.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for TMMCScBkupOperationType -* -* -*/ - -#ifndef __MMCSCBKUPOPERATIONS_H__ -#define __MMCSCBKUPOPERATIONS_H__ - -// System includes -#include - - -/** -* -* -* @since 3.0 -*/ -enum TMMCScBkupOperationType - { - EMMCScBkupOperationTypeIdle = 0, - EMMCScBkupOperationTypeFullBackup, - EMMCScBkupOperationTypeFullRestore, - EMMCScBkupOperationTypePartialBackup, - EMMCScBkupOperationTypePartialRestore - }; - - - - -#endif // __MMCSCBKUPOPERATIONS_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/MMCScBkupPhoneModelUtils.h --- a/filemanager/bkupengine/inc/MMCScBkupPhoneModelUtils.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for MMCScBkupPhoneModelUtils -* -* -*/ - -#ifndef __MMCSCBKUPPHONEMODELUTILS_H__ -#define __MMCSCBKUPPHONEMODELUTILS_H__ - -// System includes -#include -#include - -/** -* -* -* @since 3.0 -*/ -class MMCScBkupPhoneModelUtils - { - public: - - /** - * - */ - static HBufC8* CurrentPhoneModelLC(); - - /** - * - */ - static TInt MaximumPhoneModelIdentifierLength(); - - /** - * - */ - static TBool ArchiveRestorePermissableL( const TDesC8& aPhoneModelData, TBitFlags aArchiveFlags, const TVersion& aArchiveVersion ); - }; - - - - -#endif // __MMCScBkupPhoneModelUtils_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/MMCScBkupSBEUtils.h --- a/filemanager/bkupengine/inc/MMCScBkupSBEUtils.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for MMCScBkupSBEUtils -* -* -*/ - -#ifndef __MMCSCBKUPSBEUTILS_H__ -#define __MMCSCBKUPSBEUTILS_H__ - -// System includes -#include -#include -#include - -// Namespaces -using namespace conn; - - -/** -* -* -* @since 3.0 -*/ -class MMCScBkupSBEUtils - { - public: - - /** - * - */ - static TSecureId SecureIdFromGenericL(const CSBGenericDataType& aGeneric); - - /** - * - */ - static TUid PackageIdFromGenericL(const CSBGenericDataType& aGeneric); - - /** - * - */ - static HBufC* JavaHashFromGenericLC(const CSBGenericDataType& aGeneric); - - /** - * - */ - static CSBGenericDataType* CopyLC(const CSBGenericDataType& aToBeCopied); - - /** - * - */ - static CSBGenericTransferType* TransferTypeLC(const CSBGenericDataType& aDT, TDriveNumber aDrive, - TTransferDataType aTransferType, TInt aVersion); - - /** - * - */ - static CSBGenericTransferType* TransferTypeLC(const CSBGenericDataType& aDT, TDriveNumber aDrive, - TPackageDataType aDataType, TInt aVersion); - - /** - * - */ - static CSBGenericTransferType* TransferTypeLC(const CSBGenericDataType& aDT, TDriveNumber aDrive, - TJavaTransferType aDataType, TInt aVersion); - - /** - * - */ - static TBool PhoneIsInBackupOrRestoreModeL(); - - /** - * - */ - static void EndBackupOrRestoreL( CSBEClient& aSBEClient ); - - /** - * - */ - static TBool HasSystemDataL( const CDataOwnerInfo& aDataOwner ); - - /** - * - */ - static TBool HasJavaDataL( const CDataOwnerInfo& aDataOwner ); - - /** - * - */ - static TBool HasPassiveDataL( const CDataOwnerInfo& aDataOwner ); - - /** - * - */ - static TBool HasActiveDataL( const CDataOwnerInfo& aDataOwner ); - - /** - * - */ - static TBool HasPublicDataL( const CDataOwnerInfo& aDataOwner ); - }; - - - - -#endif // __MMCSCBKUPSBEUTILS_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/MMCScBkupStateIds.h --- a/filemanager/bkupengine/inc/MMCScBkupStateIds.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,247 +0,0 @@ -/* -* Copyright (c) 2005 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: Constants for scheduled backup state IDs -* -* -*/ - -#ifndef __MMCSCBKUPSTATEIDS_H__ -#define __MMCSCBKUPSTATEIDS_H__ - -// System includes -#include - -// Type definitions -typedef TUid TMMCScBkupStateId; - -// Constants - - -/** -* Archive Header -* =========================== -* -* BACKUP: Step 1 - first archive write operation: store archive header -* RESTORE: Step 1 - first archive read operation: restore archive header -*/ -const TInt32 KMMCScBkupStateIdValueArchiveOpArchiveHeader = 0x0BAC001; -const TMMCScBkupStateId KMMCScBkupStateArchiveOpArchiveHeader = { KMMCScBkupStateIdValueArchiveOpArchiveHeader }; - -/** -* Obtain List of Data Owners -* ========================== -* -* BACKUP: Step 2 - Get list of data owners from SBE -*/ -const TInt32 KMMCScBkupStateIdValueGetDataOwners = 0x0BAC0002; -const TMMCScBkupStateId KMMCScBkupStateIdGetDataOwners = { KMMCScBkupStateIdValueGetDataOwners }; - -/** -* Set Smartphone into Backup Mode -* =============================== -* -* BACKUP: Step 3 -* RESTORE: -*/ -const TInt32 KMMCScBkupStateIdValueSetPhoneMode = 0x0BAC0003; -const TMMCScBkupStateId KMMCScBkupStateIdSetPhoneMode = { KMMCScBkupStateIdValueSetPhoneMode }; - -/** -* Supply Data Snapshots (Not Currently Supported) -* =============================================== -* -* BACKUP: Step 4 -*/ -const TInt32 KMMCScBkupStateIdValueSupplyDataSnapshots = 0x0BAC0004; // Not supported -const TMMCScBkupStateId KMMCScBkupStateIdSupplyDataSnapshots = { KMMCScBkupStateIdValueSupplyDataSnapshots }; - -/** -* Inform the Device that All Snapshots Have Been Supplied -* ======================================================= -* -* BACKUP: Step 5 -*/ -const TInt32 KMMCScBkupStateIdValueNotifyAllSnapshotsSupplied = 0x0BAC0005; -const TMMCScBkupStateId KMMCScBkupStateIdNotifyAllSnapshotsSupplied = { KMMCScBkupStateIdValueNotifyAllSnapshotsSupplied }; - -/** -* Request Size of Backup Data -* =========================== -* -* BACKUP: Step 6 -*/ -const TInt32 KMMCScBkupStateIdValueRequestSizeOfBackupData = 0x0BAC0006; -const TMMCScBkupStateId KMMCScBkupStateIdRequestSizeOfBackupData = { KMMCScBkupStateIdValueRequestSizeOfBackupData }; - -/** -* Archive Operation: data owners -* ============================== -* -* BACKUP: Step 7 - second archive write operation: store data owners -*/ -const TInt32 KMMCScBkupStateIdValueArchiveOpDataOwners = 0x0BAC0007; -const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpDataOwners = { KMMCScBkupStateIdValueArchiveOpDataOwners }; - -/** -* Request List of Public Files -* ============================ -* -* BACKUP: Step 8 -*/ -const TInt32 KMMCScBkupStateIdValueRequestListOfPublicFiles = 0x0BAC0008; -const TMMCScBkupStateId KMMCScBkupStateIdRequestListOfPublicFiles = { KMMCScBkupStateIdValueRequestListOfPublicFiles }; - -/** -* Calculate disk space required for backup or restore -* ============================ -* -* BACKUP: Step 8 -*/ -const TInt32 KMMCScBkupStateIdValueValidateDiskSpace = 0x0BAC0009; -const TMMCScBkupStateId KMMCScBkupStateIdValidateDiskSpace = { KMMCScBkupStateIdValueValidateDiskSpace }; - - -/** -* Archive Operation: public data files -* ==================================== -* -* BACKUP: Step 10 - forth archive write operation: store public data files -*/ -const TInt32 KMMCScBkupStateIdValueArchiveOpPublicDataFiles = 0x0BAC000A; -const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpPublicDataFiles = { KMMCScBkupStateIdValueArchiveOpPublicDataFiles }; - -/** -* Request System Data -* =================== -* -* BACKUP: Step 11 - fifth archive write operation: store system data -*/ -const TInt32 KMMCScBkupStateIdValueArchiveOpSystemData = 0x0BAC000B; -const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpSystemData = { KMMCScBkupStateIdValueArchiveOpSystemData }; - -/** -* Request Java Data -* =================== -* -* BACKUP: Step 12 - sixth archive write operation: store system data -*/ -const TInt32 KMMCScBkupStateIdValueArchiveOpJavaData = 0x0BAC000C; -const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpJavaData = { KMMCScBkupStateIdValueArchiveOpJavaData }; - -/** -* Request Request State of Active Data Owners -* =========================================== -* -* BACKUP: Step 13 -*/ -const TInt32 KMMCScBkupStateIdValueGetDataOwnerStatuses = 0x0BAC000D; -const TMMCScBkupStateId KMMCScBkupStateIdGetDataOwnerStatuses = { KMMCScBkupStateIdValueGetDataOwnerStatuses }; - -/** -* Request Active Private Data -* =========================== -* -* BACKUP: Step 14 - seventh archive write operation: store active data -*/ -const TInt32 KMMCScBkupStateIdValueArchiveOpActiveData = 0x0BAC000E; -const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpActiveData = { KMMCScBkupStateIdValueArchiveOpActiveData }; - -/** -* Request Passive Private Data -* =========================== -* -* BACKUP: Step 15 - eighth archive write operation: store passive data -*/ -const TInt32 KMMCScBkupStateIdValueArchiveOpPassiveData = 0x0BAC000F; -const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpPassiveData = { KMMCScBkupStateIdValueArchiveOpPassiveData }; - -/** -* Archive Footer -* =========================== -* -* BACKUP: Step 16 - nineth archive write operation: store footer -*/ -const TInt32 KMMCScBkupStateIdValueArchiveOpArchiveFooter = 0x0BAC0010; -const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpArchiveFooter = { KMMCScBkupStateIdValueArchiveOpArchiveFooter }; - -/** -* Archive Header -* =========================== -* -* COMMON: Special step to indicate no more steps required -*/ -const TInt32 KMMCScBkupStateIdValueOperationComplete = 0x0BAC0011; -const TMMCScBkupStateId KMMCScBkupStateIdOperationComplete = { KMMCScBkupStateIdValueOperationComplete }; - - - -/** -* Archive Operation: read data owners -* =================================== -* -* RESTORE: Step 2 - read from archive, inform to secure backup engine -*/ -const TInt32 KMMCScBkupStateIdValueArchiveOpReadDataOwners = 0x0BAC0012; -const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpReadDataOwners = { KMMCScBkupStateIdValueArchiveOpReadDataOwners }; - - - - -/** -* BACKUP STATE FLOW -* ================= -* -* 1) KMMCScBkupStateIdArchiveOpArchiveHeader -* 2) KMMCScBkupStateIdGetDataOwners -* 3) KMMCScBkupStateIdSetPhoneMode -* 4) KMMCScBkupStateIdNotifyAllSnapshotsSupplied -* 5) KMMCScBkupStateIdRequestSizeOfBackupData -* 6) KMMCScBkupStateIdRequestListOfPublicFiles -* 7) KMMCScBkupStateIdValidateDiskSpace -* 8) KMMCScBkupStateIdArchiveOpPublicDataFiles -* 9) KMMCScBkupStateIdArchiveOpSystemData -* 10) KMMCScBkupStateIdArchiveOpJavaData -* 11) KMMCScBkupStateIdGetDataOwnerStatuses -* 12) KMMCScBkupStateIdArchiveOpActiveData -* 13) KMMCScBkupStateIdArchiveOpPassiveData -* 14) KMMCScBkupStateIdArchiveOpDataOwners -* 15) KMMCScBkupStateIdArchiveOpArchiveFooter -* 16) KMMCScBkupStateIdOperationComplete -* -*/ - - - -/** -* RESTORE STATE FLOW -* ================= -* -* 1) KMMCScBkupStateIdArchiveOpArchiveHeader -* 2) KMMCScBkupStateIdArchiveOpArchiveFooter -* 3) KMMCScBkupStateIdArchiveOpDataOwners -* 4) KMMCScBkupStateIdValidateDiskSpace -* 5) KMMCScBkupStateIdSetPhoneMode -* 6) KMMCScBkupStateIdArchiveOpSystemData -* 7) KMMCScBkupStateIdArchiveOpJavaData -* 8) KMMCScBkupStateIdArchiveOpPassiveData -* 9) KMMCScBkupStateIdGetDataOwnerStatuses -* 10) KMMCScBkupStateIdArchiveOpActiveData -* 11) KMMCScBkupStateIdArchiveOpPublicDataFiles -* 12) KMMCScBkupStateIdOperationComplete -* -*/ - -#endif // __MMCSCBKUPSTATEIDS_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/MMMCScBkupArchiveDataInterface.h --- a/filemanager/bkupengine/inc/MMMCScBkupArchiveDataInterface.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/* -* Copyright (c) 2002 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: Declaration for MMMCScBkupArchiveDataInterface -* -* -*/ - -#ifndef __MMMCSCBKUPARCHIVEDATAINTERFACE_H__ -#define __MMMCSCBKUPARCHIVEDATAINTERFACE_H__ - -// System includes -#include -#include - -// User includes -#include "TMMCScBkupArchiveVector.h" -#include "MMCScBkupOperations.h" - -// Constants -const TInt KMMCScBkupArchiveWriteStreamCurrentPos = -1; -const TInt KMMCScBkupArchiveReadStreamCurrentPos = -1; - -/** -* -* -* @since 3.0 -*/ -class MMMCScBkupArchiveDataInterface - { - public: // From MMMCScBkupArchiveDataInterface - - /** - * - */ - virtual RFs& ADIFsSession() const = 0; - - /** - * - */ - virtual RFile64& ADIRawArchiveFile() const = 0; - - /** - * - */ - virtual const TMMCScBkupArchiveVector& ADICurrentArchiveVectorInfo() const = 0; - - /** - * - */ - virtual const TMMCScBkupArchiveVector& ADIOverallArchiveVectorInfo() const = 0; - - /** - * - */ - virtual RWriteStream& ADIWriteStreamUncompressedLC( TInt aPos = KMMCScBkupArchiveWriteStreamCurrentPos ) = 0; - - /** - * - */ - virtual RReadStream& ADIReadStreamUncompressedLC( TInt aPos = KMMCScBkupArchiveReadStreamCurrentPos ) = 0; - - /** - * - */ - virtual const TMMCScBkupArchiveVector& ADIWriteL( const TDesC8& aData ) = 0; - - /** - * - */ - virtual const TMMCScBkupArchiveVector& ADIReadL( TDes8& aSink, const TMMCScBkupArchiveVector& aInfo ) = 0; - - /** - * - */ - virtual void ADIWriteFileL( const TDesC& aSourceFileName, TRequestStatus& aStatus ) = 0; - - /** - * - */ - virtual void ADIReadFileL( const TDesC& aDestinationFileName, const TMMCScBkupArchiveVector& aInfo, TRequestStatus& aStatus ) = 0; - - /** - * - */ - virtual void ADIWriteCompressedL( const TDesC8& aData, TRequestStatus& aStatus ) = 0; - - /** - * - */ - virtual void ADIReadDecompressedL( TDes8& aSink, const TMMCScBkupArchiveVector& aInfo, TRequestStatus& aStatus ) = 0; - - /** - * - */ - virtual void ADIAsynchronousCancel() = 0; - - /** - * - */ - virtual void ADIResetResources(TMMCScBkupOperationType aType) = 0; - -#ifdef RD_FILE_MANAGER_BACKUP - /** - * - */ - virtual void ADIActivateCrcCalculation(TBool aType) = 0; - - /** - * - */ - virtual TUint32 ADIArchiveCrc() = 0; -#endif - }; - - - - -#endif // __MMMCSCBKUPARCHIVEDATAINTERFACE_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/MMMCScBkupDriver.h --- a/filemanager/bkupengine/inc/MMMCScBkupDriver.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration for MMMCScBkupDriver -* -* -*/ - -#ifndef __MMMCSCBKUPDRIVER_H__ -#define __MMMCSCBKUPDRIVER_H__ - -// System includes -#include - -// User includes -#include "MMCScBkupStateIds.h" -#include "MMCScBkupOperations.h" -#include "CMMCScBkupOperationParameters.h" - -// Classes referenced -class CMMCScBkupState; -class CMMCScBkupArchive; -class MMMCScBkupProgressObserver; -class CMMCScBkupDataOwnerCollection; -class CMMCScBkupFileListCollection; -class MMMCScBkupArchiveDataInterface; - -// Namespaces -using namespace conn; - - -/** -* -* -* @since 3.0 -*/ -class MMMCScBkupDriver - { - public: // From MMMCScBkupDriver - - /** - * - */ - virtual MMMCScBkupArchiveDataInterface& DrvADI() const = 0; - - /** - * - */ - virtual CMMCScBkupArchive& DrvArchive() const = 0; - - /** - * - */ - virtual CSBEClient& DrvSecureBackupClient() const = 0; - - /** - * - */ - virtual TMMCScBkupOperationType DrvOperation() const = 0; - - /** - * - */ - virtual CMMCScBkupOpParamsBase& DrvParamsBase() const = 0; - - /** - * - */ - virtual CMMCScBkupDataOwnerCollection& DrvDataOwners() const = 0; - - /** - * - */ - virtual RPointerArray& DrvDataOwnersAll() = 0; - - /** - * - */ - virtual CMMCScBkupFileListCollection& DrvFileList() const = 0; - - /** - * - */ - virtual TBool DrvLastCategory() const = 0; - - /** - * - */ - virtual void DrvStoreTotalProgress(TInt64 aProgress) = 0; - - /** - * - */ - virtual TInt64 DrvTotalProgress() const = 0; - - /** - * - */ - virtual MMMCScBkupProgressObserver& DrvProgressHandler() const = 0; - }; - - - - -#endif // __MMMCSCBKUPDRIVER_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/MMMCScBkupEngineObserver.h --- a/filemanager/bkupengine/inc/MMMCScBkupEngineObserver.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* Copyright (c) 2002 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: Declaration for MMMCScBkupEngineObserver -* -* -*/ - -#ifndef __MMMCSCBKUPENGINEOBSERVER_H__ -#define __MMMCSCBKUPENGINEOBSERVER_H__ - -/** -* -* -* @since 3.0 -*/ -class MMMCScBkupEngineObserver - { - public: - - /** - * - */ - enum TEvent - { - // COMMON - ECommonEventFirst = 0, - ECommonOperationStarting = ECommonEventFirst, - ECommonSizeOfTaskUnderstood, - ECommonOperationPrepareEnded, - ECommonOperationEnded, - ECommonOperationError, - ECommonProgress, - ECommonEventLast, - - // BACKUP - EBackupEventFirst = 100, - EBackupAnalysingData, - EBackupEventLast, - - // RESTORE - ERestoreEventFirst = 200, - ERestoreEventLast - }; - - public: // From MMMCScBkupEngineObserver - - /** - * - */ - virtual TInt HandleBkupEngineEventL(TEvent aEvent, TInt aAssociatedData) = 0; - - }; - - -#endif // __MMMCSCBKUPENGINEOBSERVER_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/MMMCScBkupProgressObserver.h --- a/filemanager/bkupengine/inc/MMMCScBkupProgressObserver.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration for MMMCScBkupProgressObserver -* -* -*/ - -#ifndef __MMMCSCBKUPPROGRESSOBSERVER_H__ -#define __MMMCSCBKUPPROGRESSOBSERVER_H__ - -// System includes -#include - -// User includes - - -/** -* -* -* @since 3.0 -*/ -class MMMCScBkupProgressObserver - { - public: // From MMMCScBkupProgressObserver - - /** - * - */ - virtual void MMCScBkupHandleProgress( TInt aAmountCompleted ) = 0; - - - /** - * - */ - virtual void MMCScBkupHandleProgressDomainUnderstood( TInt aTotalProgressAmount ) = 0; - - - /** - * - */ - virtual TInt MMCScBkupHandleFreeSpace( TInt aPercent ) = 0; - - - /** - * - */ - virtual void MMCScBkupStartBackuping( TBool aProceed ) = 0; - }; - - - - -#endif // __MMMCSCBKUPPROGRESSOBSERVER_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/RMMCScBkupArchiveStreams.h --- a/filemanager/bkupengine/inc/RMMCScBkupArchiveStreams.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for RMMCScBkupArchiveReadStream -* -* -*/ - -#ifndef __RMMCSCBKUPARCHIVESTREAMS_H__ -#define __RMMCSCBKUPARCHIVESTREAMS_H__ - -// System includes -#include -#include - -// User includes -#include "TMMCScBkupArchiveVector.h" - -// Classes referenced -class CMMCScBkupArchiveDataManager; - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(RMMCScBkupArchiveBuf) : public RFileBuf - { - public: - - /** - * - */ - RMMCScBkupArchiveBuf(); - - public: // API - - /** - * - */ - void AttachL(CMMCScBkupArchiveDataManager& aADM, RFile64& aFile, TInt aPos, TBool aForWrite ); - - /** - * - */ - IMPORT_C void Close(); - - /** - * - */ - TBool IsOpen() const; - - private: // From MStreamBuf - - /** - * - */ - void DoRelease(); - - /** - * - */ - void DoSynchL(); - -#ifdef RD_FILE_MANAGER_BACKUP - /** - * - */ - void DoWriteL(const TAny* aPtr,TInt aLength); -#endif - - private: - - /** - * - */ - void UpdateInfoL(); - - private: // Member data - - // - TBool iWriteMode; - // - CMMCScBkupArchiveDataManager* iADM; - // - TMMCScBkupArchiveVector iInfo; - - }; - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(RMMCScBkupArchiveReadStream) : public RReadStream - { - public: // Constructors - - /** - * - */ - inline RMMCScBkupArchiveReadStream() { } - - public: // API - - /** - * - */ - void OpenLC(CMMCScBkupArchiveDataManager& aADM, RFile64& aArchiveFile, TInt aPos=0); - - /** - * - */ - TBool IsOpen() const; - - private: // Member data - - // - RMMCScBkupArchiveBuf iSource; - }; - - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(RMMCScBkupArchiveWriteStream) : public RWriteStream - { - public: // Constructors - - /** - * - */ - inline RMMCScBkupArchiveWriteStream() - {} - - public: // API - - /** - * - */ - void OpenLC(CMMCScBkupArchiveDataManager& aADM, RFile64& aArchiveFile, TInt aPos=0); - - /** - * - */ - TBool IsOpen() const; - - private: // Member data - - // - RMMCScBkupArchiveBuf iSink; - }; - - - -#endif // __RMMCSCBKUPARCHIVESTREAMS_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/RMMCScBkupPointerArray.h --- a/filemanager/bkupengine/inc/RMMCScBkupPointerArray.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for RMMCScBkupPointerArray -* -* -*/ - -#ifndef __RMMCSCBKUPPOINTERARRAY_H__ -#define __RMMCSCBKUPPOINTERARRAY_H__ - -// User includes -#include - - -/** -* -* -* @since 3.0 -*/ -template -class RMMCScBkupPointerArray : public RPointerArray - { -public: - inline RMMCScBkupPointerArray(); - inline explicit RMMCScBkupPointerArray(TInt aGranularity); - inline void Close(); - }; - - - - - -// Inline methods - -template -inline RMMCScBkupPointerArray::RMMCScBkupPointerArray() - : RPointerArray() - {} - -template -inline RMMCScBkupPointerArray::RMMCScBkupPointerArray(TInt aGranularity) - : RPointerArray( aGranularity ) - {} - -template -inline void RMMCScBkupPointerArray::Close() - { - RPointerArray::ResetAndDestroy(); - RPointerArray::Close(); - } - - - - - - -#endif // __RMMCSCBKUPPOINTERARRAY_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/RMMCScBkupProgressSizer.h --- a/filemanager/bkupengine/inc/RMMCScBkupProgressSizer.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration for RMMCScBkupProgressSizer -* -* -*/ - -#ifndef __RMMCSCBKUPPROGRESSSIZER_H__ -#define __RMMCSCBKUPPROGRESSSIZER_H__ - -// System includes -#include - -// User includes -#include "TMMCScBkupDriveFilter.h" -#include "TMMCScBkupOwnerDataType.h" - -// Classes referenced -class CMMCScBkupDataOwnerInfo; -class MMMCScBkupProgressObserver; -class CMMCScBkupDriveAndOperationTypeManager; - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(RMMCScBkupProgressSizer) - { - public: - - /** - * C++ default constructor - */ - RMMCScBkupProgressSizer( const CMMCScBkupDriveAndOperationTypeManager& aDriveAndOperationTypes ); - - public: // BACKUP SIZING API - - /** - * - */ - TInt64 BackupTotalProgressValueL( const CMMCScBkupDataOwnerInfo& aDataOwner ); - - /** - * - */ - void BackupReportFixedProgressForOpL( MMMCScBkupProgressObserver& aProgressManager, TMMCScBkupOwnerDataType aType ); - - public: // RESTORE SIZING API - - /** - * - */ - TInt64 RestoreCombinedDataSizeL( const CMMCScBkupDataOwnerInfo& aOwner ); - - private: // Internal methods - - /** - * - */ - TInt NumberOfDriveOpsRequiredL( const CMMCScBkupDataOwnerInfo& aOwner, TMMCScBkupOwnerDataType aType ); - - /** - * - */ - TInt64 AmountOfPublicDataToBeRestoredL( const CMMCScBkupDataOwnerInfo& aOwner ); - - private: // Member data - - // - const CMMCScBkupDriveAndOperationTypeManager& iDriveAndOperationTypes; - // - TMMCScBkupDriveFilter iDriveFilter; - - }; - - - - -#endif // __RMMCSCBKUPPROGRESSSIZER_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/TMMCScBkupArchiveVector.h --- a/filemanager/bkupengine/inc/TMMCScBkupArchiveVector.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for TMMCScBkupArchiveVector -* -* -*/ - -#ifndef __TMMCSCBKUPARCHIVEVECTOR_H__ -#define __TMMCSCBKUPARCHIVEVECTOR_H__ - -// System includes -#include -#include - - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(TMMCScBkupArchiveVector) - { - public: - - /** - * C++ default constructor - */ - inline TMMCScBkupArchiveVector() - { Reset(); } - - /** - * C++ default constructor - */ - inline TMMCScBkupArchiveVector( TInt aOffset, TInt aLength ) - : iOffset( aOffset ), iLength( aLength ) - {} - - /** - * C++ copy constructor - */ - inline TMMCScBkupArchiveVector( const TMMCScBkupArchiveVector& aVector ) - : iOffset( aVector.Offset() ), iLength( aVector.Length() ) - {} - - public: - - /** - * - */ - inline TInt Offset() const { return iOffset; } - - /** - * - */ - inline void SetOffset( TInt aOffset ) { iOffset = aOffset; } - - /** - * - */ - inline TInt Length() const { return iLength; } - - /** - * - */ - inline void SetLength( TInt aLength ) { iLength = aLength; } - - /** - * - */ - inline TInt EndOffset() const { return (iOffset + iLength); } - - /** - * - */ - inline void AdjustByDelta( TInt aOffsetDelta ) { iOffset += aOffsetDelta; } - - /** - * - */ - static TInt ExternalizedSize(); - - public: - - /** - * - */ - inline void Reset() { iLength = iOffset = 0; } - - /** - * - */ - void ExternalizeL( RWriteStream& aStream ) const; - - /** - * - */ - void InternalizeL( RReadStream& aStream ); - - private: // Internal enumerations - enum - { - EStreamFormatVersion1 = 1 - }; - - private: // Member data - - /** - * - */ - TInt iOffset; - - /** - * - */ - TInt iLength; - }; - - - -/** -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(TMMCScBkupArchiveDriveAndVector) - { - public: - - /** - * C++ default constructor - */ - inline TMMCScBkupArchiveDriveAndVector() : iDrive( EDriveC ) { } - - /** - * C++ default constructor - */ - inline TMMCScBkupArchiveDriveAndVector( TDriveNumber aDrive, const TMMCScBkupArchiveVector& aVector ) : iDrive( aDrive), iVector( aVector ) { } - - public: - - /** - * Internalize object from stream - */ - void InternalizeL( RReadStream& aStream ); - - /** - * Externalize object to stream - */ - void ExternalizeL( RWriteStream& aStream ) const; - - private: // Internal enumerations - enum - { - EStreamFormatVersion1 = 1 - }; - - public: // Data members - TDriveNumber iDrive; - TMMCScBkupArchiveVector iVector; - }; - - - - -#endif // __TMMCSCBKUPARCHIVEVECTOR_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/TMMCScBkupDriveAndSize.h --- a/filemanager/bkupengine/inc/TMMCScBkupDriveAndSize.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration for TMMCScBkupDriveAndSize -* -* -*/ - -#ifndef __TMMCSCBKUPDRIVEANDSIZE_H__ -#define __TMMCSCBKUPDRIVEANDSIZE_H__ - -// System includes -#include -#include - - - -/** -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(TMMCScBkupDriveAndSize) - { - public: - - /** - * C++ default constructor - */ - inline TMMCScBkupDriveAndSize() : iDrive( EDriveC ), iSize( 0 ) { } - - /** - * C++ default constructor - */ - inline TMMCScBkupDriveAndSize( TDriveNumber aDrive, TInt aSize ) : iDrive( aDrive), iSize( aSize ) { } - - public: - - /** - * Internalize object from stream - */ - void InternalizeL( RReadStream& aStream ); - - /** - * Externalize object to stream - */ - void ExternalizeL( RWriteStream& aStream ) const; - - public: // API - - /** - * - */ - inline TInt64 Size() const { return iSize; } - - /** - * - */ - inline TDriveNumber Drive() const { return iDrive; } - - /** - * - */ - inline void SetSize( TInt64 aSize ) { iSize = aSize; } - - /** - * - */ - inline void AddToSize( TInt64 aAmount ) { iSize += aAmount; } - - /** - * - */ - inline void SetDrive( TDriveNumber aDrive ) { iDrive = aDrive; } - - private: // Internal enumerations - enum - { - EStreamFormatVersion1 = 1 - //EStreamFormatVersion2 = 2 // If 64-bit handling will be supported in the future. - // That will mean in practice a break in archive file format. - // Change are also needed in TMMCScBkupArchiveVector class - // to support larger than 2 GB files and data in it. - }; - - private: // Data members - TDriveNumber iDrive; - TInt64 iSize; - }; - - - - - -#endif // __TMMCSCBKUPDRIVEANDSIZE_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/TMMCScBkupDriveFilter.h --- a/filemanager/bkupengine/inc/TMMCScBkupDriveFilter.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for TMMCScBkupDriveFilter -* -* -*/ - -#ifndef __TMMCSCBKUPDRIVEFILTER_H__ -#define __TMMCSCBKUPDRIVEFILTER_H__ - -// System includes -#include -#include - -/** -* -* -* @since 3.0 -*/ -NONSHARABLE_CLASS(TMMCScBkupDriveFilter) - { - public: - - /** - * C++ default constructor - */ - inline TMMCScBkupDriveFilter() - { Reset(); } - - /** - * C++ default constructor - */ - inline TMMCScBkupDriveFilter( const TDriveList& aPrimaryList ) - : iPrimaryDriveList( aPrimaryList ), iHaveSecondaryList( EFalse ) - { Reset(); } - - public: // API - - /** - * - */ - void Reset(); - - /** - * - */ - void SetPrimaryDriveFilter( const TDriveList& aDriveList ); - - /** - * - */ - void SetSecondaryDriveFilter( const TDriveList& aDriveList ); - - /** - * - */ - TBool NextValidDrive(TDriveNumber& aDrive); - - /** - * - */ - TDriveNumber CurrentDrive() const; - - private: // Internal methods - - /** - * - */ - TBool FindValidDrive( const TDriveList& aList, TDriveNumber& aDrive, TBool aOneAttemptOnly = EFalse ); - - private: // Member data - - /** - * - */ - TInt iCurrentDrive; - - /** - * - */ - TDriveList iPrimaryDriveList; - - /** - * - */ - TDriveList iSecondaryDriveList; - - /** - * - */ - TBool iHaveSecondaryList; - }; - - - - -#endif // __TMMCSCBKUPDRIVEFILTER_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/inc/TMMCScBkupOwnerDataType.h --- a/filemanager/bkupengine/inc/TMMCScBkupOwnerDataType.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2005 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: Declaration for TMMCScBkupOwnerDataType -* -* -*/ - -#ifndef __TMMCSCBKUPOWNERDATATYPE_H__ -#define __TMMCSCBKUPOWNERDATATYPE_H__ - -// NB. This file is included inside an HRH file, so do not include -// C++ constructs. - -/** -* DO NOT CHANGE THE ORDER OF THIS ENUMERATION -* -* @since 3.0 -*/ -enum TMMCScBkupOwnerDataType - { - // Relates to all data owners - EMMCScBkupOwnerDataTypeDataOwner = 0, - - // Relates to java data for a particular owner - EMMCScBkupOwnerDataTypeJavaData, - - // Relates to public data for a particular owner - EMMCScBkupOwnerDataTypePublicData, - - // Relates to system data for a particular owner - EMMCScBkupOwnerDataTypeSystemData, - - // Relates to active data for a particular owner - EMMCScBkupOwnerDataTypeActiveData, - - // Relates to passive data for a particular owner - EMMCScBkupOwnerDataTypePassiveData, - - // Always leave this last, don't assign it - // a value. Don't use it either! - EMMCScBkupOwnerDataTypeCount, - - // A generic 'any data type' value. Used by the drive-specific-request & - // data sizer. Not a real SBE data type, hence it appears after - // the last marker. - EMMCScBkupOwnerDataTypeAny - }; - - - -#endif // __TMMCSCBKUPOWNERDATATYPE_H__ - -//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupArchive.cpp --- a/filemanager/bkupengine/src/CMMCScBkupArchive.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,364 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CMMCScBkupArchive Implementation -* -* -*/ - -#include "CMMCScBkupArchive.h" - -// System includes -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "MMCScBkupArchiveUtils.h" -#include "CMMCScBkupArchiveHeader.h" -#include "CMMCScBkupArchiveFooter.h" -#include "MMCScBkupPhoneModelUtils.h" -#include "CMMCScBkupArchiveDataManager.h" - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupArchive::CMMCScBkupArchive() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupArchive::CMMCScBkupArchive( RFs& aFsSession, MMMCScBkupProgressObserver& aProgressManager, - MMMCScBkupDriver& aDriver, TBitFlags aCategory ) -: iFsSession( aFsSession ), iProgressManager( aProgressManager ), iDriver( aDriver ), iCategory( aCategory ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchive::~CMMCScBkupArchive() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupArchive::~CMMCScBkupArchive() - { - Close( KErrNone ); - DeleteOldArchive(); - // Must do these last, as we may need to use the file name in order - // to delete any partially created or old archives. - delete iArchiveFileName; - iArchiveFileName = NULL; - - delete iOldArchiveFileName; - iOldArchiveFileName = NULL; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchive::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupArchive* CMMCScBkupArchive::NewL( RFs& aFsSession, MMMCScBkupProgressObserver& aProgressManager, - MMMCScBkupDriver& aDriver, TBitFlags aCategory ) - { - __LOG("CMMCScBkupArchive::NewL() - START"); - CMMCScBkupArchive* self = new(ELeave) CMMCScBkupArchive( aFsSession, aProgressManager, aDriver, aCategory ); - __LOG("CMMCScBkupArchive::NewL() - END"); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchive::OpenForReadingL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchive::OpenForReadingL( const TDesC& aName ) - { - __LOG1("CMMCScBkupArchive::OpenForReadingL() - START - aName: %S", &aName); - - Close( KErrNone ); - iArchiveFileName = aName.AllocL(); - // - const TInt error = iArchiveFile.Open(iFsSession, *iArchiveFileName, EFileShareReadersOnly | EFileStream | EFileRead); - __LOG1("CMMCScBkupArchive::OpenForReadingL() - open error: %d", error); - User::LeaveIfError(error); - // - PrepareObjectsL(); - SetMode(EModeReading); - __LOG1("CMMCScBkupArchive::OpenForReadingL() - END - file handle: 0x%08x", iArchiveFile.SubSessionHandle()); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchive::OpenForWritingL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchive::OpenForWritingL( const TDesC& aName ) - { - __LOG1("CMMCScBkupArchive::OpenForWritingL() - START - aName: %S", &aName); - - Close( KErrNone ); - iArchiveFileName = aName.AllocL(); - - // Name old archive as .old until disk space validation is carried out. - _LIT( KOldSuffix, "old" ); - const TChar dot('.'); - iOldArchiveFileName = HBufC::NewL(aName.Length() + KOldSuffix().Length() + 1); - TPtr temp( iOldArchiveFileName->Des() ); - temp.Copy( aName ); - const TInt location = temp.LocateReverseF( dot ) + 1; - TInt length = temp.Length() - location; - - if( location != KErrNotFound && length <= KOldSuffix().Length() ) - { - temp.Delete( location, length ); - temp.Append( KOldSuffix().Ptr(), length ); - } - else - { - temp.Append( dot ); - temp.Append( KOldSuffix().Ptr(), length ); - } - - // Ensure archive directory and attributes permit writing of file - TInt error = PrepareToOverwrite(aName); - __LOG1("CMMCScBkupArchive::OpenForWritingL() - prepare to over-write error: %d", error); - User::LeaveIfError(error); - - // Open file for writing - error = iArchiveFile.Replace(iFsSession, *iArchiveFileName, EFileShareExclusive | EFileStream | EFileWrite); - __LOG1("CMMCScBkupArchive::OpenForWritingL() - replace error: %d", error); - User::LeaveIfError(error); - // - PrepareObjectsL(); - SetMode(EModeWriting); - __LOG1("CMMCScBkupArchive::OpenForWritingL() - END - file handle: 0x%08x", iArchiveFile.SubSessionHandle()); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchive::RestoreOldArchive() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchive::RestoreOldArchive() - { - Close( KErrCancel ); - TInt err = iFsSession.Rename( *iOldArchiveFileName, *iArchiveFileName ); - - __LOG2("CMMCScBkupArchive::RestoreOldArchive() - %S restore error: %d", iArchiveFileName, err); - } - -// --------------------------------------------------------------------------- -// CMMCScBkupArchive::DeleteOldArchive() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchive::DeleteOldArchive() - { - if( iOldArchiveFileName != NULL ) - { - TInt err = iFsSession.Delete( *iOldArchiveFileName ); - - __LOG2("CMMCScBkupArchive::DeleteOldArchive() - %S delete error: %d", iOldArchiveFileName, err); - } - } - -// --------------------------------------------------------------------------- -// CMMCScBkupArchive::Close() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchive::Close( TInt aError ) - { - __LOG1("CMMCScBkupArchive::Close() - aError: %d", aError); - - delete iHeader; - iHeader = NULL; - delete iFooter; - iFooter = NULL; - delete iDataManager; - iDataManager = NULL; - // - if ( aError != KErrNone && Mode() == EModeWriting ) - { - // Delete the archive if there was an error with the backup operation - __LOG1("CMMCScBkupArchive::Close() - ERROR CREATING BACKUP - aError: %d => archive will be deleted", aError); - - // Ignore error when attempting delete - iArchiveFile.Close(); - (void) iFsSession.Delete( *iArchiveFileName ); - } - - // Close archive. It might have already been closed in an error situation - // but that's okay - it doesn't cause any problems to close it twice. - iArchiveFile.Close(); - - // Ignore error if setting read-only attribute fails, because it is not fatal - iFsSession.SetAtt( *iArchiveFileName, KEntryAttReadOnly, !KEntryAttReadOnly ); - - // Reset mode back to default, ready for next operation - iMode = EModeUninitialised; - - __LOG("CMMCScBkupArchive::Close() - END"); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchive::Header() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupArchiveHeader& CMMCScBkupArchive::Header() const - { - return *iHeader; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchive::Footer() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupArchiveFooter& CMMCScBkupArchive::Footer() const - { - return *iFooter; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchive::ADI() -// -// -// --------------------------------------------------------------------------- -MMMCScBkupArchiveDataInterface& CMMCScBkupArchive::ADI() const - { - return *iDataManager; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchive::PrepareToOverwrite() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupArchive::PrepareToOverwrite( const TDesC& aFile ) - { - __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - START - aFile: %S", &aFile); - TInt err = KErrNone; - - // Try deleting file with temporary name (one we have created earlier, - // but which has potentially remained for some reason). - err = iFsSession.Delete( *iOldArchiveFileName ); - __LOG2("CMMCScBkupArchive::PrepareToOverwrite() - delete %S result: %d", iOldArchiveFileName, err); - // Rename the file for possible later "restoration". - err = iFsSession.Rename( aFile, *iOldArchiveFileName ); - __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - rename existing file: %d", err); - // Reset file flags in order to make sure file can be deleted - err = iFsSession.SetAtt( *iOldArchiveFileName, KEntryAttNormal, !KEntryAttNormal ); - __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - setFileAttNormal: %d", err); - - // Create the full path, if not exists - err = iFsSession.MkDirAll( aFile ); - __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - mkDirAll: %d", err); - - if (err == KErrAlreadyExists || err == KErrNone ) - { - // Set folder hidden, ignore error - err = iFsSession.SetAtt( BaflUtils::DriveAndPathFromFullName( aFile ), KEntryAttHidden, !KEntryAttHidden ); - __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - setFolderHidden: %d", err); - - // Reset file flags in order to make sure file can be deleted - err = iFsSession.SetAtt( aFile, KEntryAttNormal, !KEntryAttNormal ); - __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - setFileAttNormal: %d", err); - - } - // - if ( err == KErrNotFound ) - { - // These errors are ignored - __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - mapped %d to KErrNone -> everything is okay", err); - err = KErrNone; - } - // - __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - END - err: %d", err); - return err; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchive::ValidArchiveForRestoreL() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupArchive::ValidArchiveForRestoreL( RFs& aFsSession, const TDesC& aFileName ) - { - HBufC8* modelInfo = NULL; - TBitFlags archiveFlags( 0 ); - - TVersion archiveVersion; - - // Read the header from the specified archive - MMCScBkupArchiveUtils::ReadPhoneValidityInformationL( aFsSession, aFileName, modelInfo, archiveFlags, archiveVersion ); - CleanupStack::PushL( modelInfo ); - - // Check whether its okay to restore the archive. - const TBool validArchiveForRestore = MMCScBkupPhoneModelUtils::ArchiveRestorePermissableL( *modelInfo, archiveFlags, archiveVersion ); - CleanupStack::PopAndDestroy(modelInfo); - // - return validArchiveForRestore; - } - - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchive::SetMode() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchive::SetMode(TMode aMode) - { - iMode = aMode; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchive::PrepareObjectsL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchive::PrepareObjectsL() - { - __LOG("CMMCScBkupArchive::PrepareObjectsL() - START"); - - __LOG("CMMCScBkupArchive::PrepareObjectsL() - creating data manager..."); - iDataManager = CMMCScBkupArchiveDataManager::NewL( iFsSession, iArchiveFile, iProgressManager ); - - __LOG("CMMCScBkupArchive::PrepareObjectsL() - creating header..."); - iHeader = CMMCScBkupArchiveHeader::NewL( *iDataManager, iDriver ); - - __LOG("CMMCScBkupArchive::PrepareObjectsL() - creating footer..."); - iFooter = CMMCScBkupArchiveFooter::NewL( *iDataManager, iDriver ); - - __LOG("CMMCScBkupArchive::PrepareObjectsL() - END"); - } - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupArchiveDataManager.cpp --- a/filemanager/bkupengine/src/CMMCScBkupArchiveDataManager.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,647 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupArchiveDataManager Implementation -* -* -*/ - -#include "CMMCScBkupArchiveDataManager.h" - -// System includes -#include -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "RMMCScBkupArchiveStreams.h" -#include "MMCScBkupOperations.h" - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::CMMCScBkupArchiveDataManager() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupArchiveDataManager::CMMCScBkupArchiveDataManager( RFs& aFsSession, RFile64& aFile, MMMCScBkupProgressObserver& aProgressManager ) -: CActive( CActive::EPriorityIdle ), iFsSession( aFsSession ), iFile( aFile ), iProgressManager( aProgressManager ) - { - __LOG1("CMMCScBkupArchiveDataManager::CMMCScBkupArchiveDataManager() - START - aFile: 0x%08x", aFile.SubSessionHandle() ); - CActiveScheduler::Add(this); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::~CMMCScBkupArchiveDataManager() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupArchiveDataManager::~CMMCScBkupArchiveDataManager() - { - Cancel(); - // - iWriteStream.Close(); - // - delete iCompressor; - delete iDecompressor; - delete iBufferManager; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::ConstructL() - { - TInt64 size = 0; - User::LeaveIfError( iFile.Size( size ) ); - // - iOverallArchiveVectorInfo.SetOffset( 0 ); - iOverallArchiveVectorInfo.SetLength( size ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupArchiveDataManager* CMMCScBkupArchiveDataManager::NewL( RFs& aFsSession, RFile64& aFile, MMMCScBkupProgressObserver& aProgressManager ) - { - CMMCScBkupArchiveDataManager* self = new(ELeave) CMMCScBkupArchiveDataManager( aFsSession, aFile, aProgressManager ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::CurrentOffsetL() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupArchiveDataManager::CurrentOffsetL() const - { - TInt offset = CurrentOffset(); - User::LeaveIfError(offset); - return offset; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::CurrentOffset() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupArchiveDataManager::CurrentOffset() const - { - TInt64 offsetOrError = 0; - TInt error = iFile.Seek( ESeekCurrent, offsetOrError ); - // - if (error != KErrNone) - { - offsetOrError = error; - } - // - return offsetOrError; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::SetCurrentVector() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::SetCurrentVector( const TMMCScBkupArchiveVector& aVector ) - { - iCurrentVectorInfo = aVector; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::ADIFsSession() -// -// -// --------------------------------------------------------------------------- -RFs& CMMCScBkupArchiveDataManager::ADIFsSession() const - { - return iFsSession; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::ADIRawArchiveFile() -// -// -// --------------------------------------------------------------------------- -RFile64& CMMCScBkupArchiveDataManager::ADIRawArchiveFile() const - { - return iFile; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::ADICurrentArchiveVectorInfo() -// -// -// --------------------------------------------------------------------------- -const TMMCScBkupArchiveVector& CMMCScBkupArchiveDataManager::ADICurrentArchiveVectorInfo() const - { - return iCurrentVectorInfo; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::ADIOverallArchiveVectorInfo() -// -// -// --------------------------------------------------------------------------- -const TMMCScBkupArchiveVector& CMMCScBkupArchiveDataManager::ADIOverallArchiveVectorInfo() const - { - return iOverallArchiveVectorInfo; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::ADIWriteStreamUncompressedLC() -// -// -// --------------------------------------------------------------------------- -RWriteStream& CMMCScBkupArchiveDataManager::ADIWriteStreamUncompressedLC( TInt aPos ) - { - __LOG1("CMMCScBkupArchiveDataManager::ADIWriteStreamUncompressedLC() - START - aPos: %d", aPos ); - // - __ASSERT_ALWAYS( !iWriteStream.IsOpen(), User::Invariant() ); - TInt offset = aPos; - if (offset == KMMCScBkupArchiveWriteStreamCurrentPos) - { - offset = CurrentOffsetL(); - __LOG1("CMMCScBkupArchiveDataManager::ADIWriteStreamUncompressedLC() - current offset is: %d", offset ); - } - // - iWriteStream.OpenLC(*this, iFile, offset); - - __LOG("CMMCScBkupArchiveDataManager::ADIWriteStreamUncompressedLC() - END - stream opened and pushed"); - - iCurrentVectorInfo.Reset(); - return iWriteStream; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::ADIReadStreamUncompressedLC() -// -// -// --------------------------------------------------------------------------- -RReadStream& CMMCScBkupArchiveDataManager::ADIReadStreamUncompressedLC( TInt aPos ) - { - __ASSERT_ALWAYS( !iReadStream.IsOpen(), User::Invariant() ); - TInt offset = aPos; - if (offset == KMMCScBkupArchiveReadStreamCurrentPos) - { - offset = CurrentOffsetL(); - } - // - iReadStream.OpenLC(*this, iFile, offset); - iCurrentVectorInfo.Reset(); - return iReadStream; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::ADIWriteL() -// -// -// --------------------------------------------------------------------------- -const TMMCScBkupArchiveVector& CMMCScBkupArchiveDataManager::ADIWriteL( const TDesC8& aData ) - { - const TInt offset = CurrentOffsetL(); - const TInt error = iFile.Write( aData ); - User::LeaveIfError(error); - -#ifdef RD_FILE_MANAGER_BACKUP - CalculateCrc(aData.Ptr(), aData.Length()); -#endif - // - iCurrentVectorInfo.SetOffset( offset ); - iCurrentVectorInfo.SetLength( aData.Length() ); - // - return iCurrentVectorInfo; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::ADIReadL() -// -// -// --------------------------------------------------------------------------- -const TMMCScBkupArchiveVector& CMMCScBkupArchiveDataManager::ADIReadL( TDes8& aSink, const TMMCScBkupArchiveVector& aInfo ) - { - TMMCScBkupArchiveVector readInfo(aInfo); - - // Read straight into aSink. - const TInt maxLength = aSink.MaxLength(); - if (aInfo.Length() > maxLength) - { - readInfo.SetLength( maxLength ); - } - - aSink.Zero(); - const TInt error = iFile.Read( static_cast(readInfo.Offset()), aSink, readInfo.Length() ); - User::LeaveIfError( error ); - // - iCurrentVectorInfo.SetOffset( readInfo.Offset() ); - iCurrentVectorInfo.SetLength( aSink.Length() ); - // - return iCurrentVectorInfo; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::ADIWriteFileL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::ADIWriteFileL( const TDesC& aSourceFileName, TRequestStatus& aStatus ) - { - __LOG1("CMMCScBkupArchiveDataManager::ADIWriteFileL() - START - file: %S", &aSourceFileName); - - if (!iBufferManager || iBufferManager->Type() != CMMCScBkupBufferManagerBase::ETypeFileToArchive) - { - CMMCScBkupBufferManagerBase* bm = - CMMCScBkupBufferManagerBase::NewByTypeL( - CMMCScBkupBufferManagerBase::ETypeFileToArchive, - iProgressManager, - *this, - (TAny*) &aSourceFileName); - // - delete iBufferManager; - iBufferManager = bm; - } - else - { - iBufferManager->InitializeL( (TAny*) &aSourceFileName ); - } - - // Setup our observer & op - SetOperation(EOperationCompressing); - SetObserver(aStatus); - - // Compressing aData to the archive file - EnsureCompressorExistsL(*iBufferManager); - - // Do the compression asynchronously - CompleteSelf(); - - __LOG("CMMCScBkupArchiveDataManager::ADIWriteFileL() - END"); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::ADIReadFileL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::ADIReadFileL( const TDesC& aDestinationFileName, const TMMCScBkupArchiveVector& aInfo, TRequestStatus& aStatus ) - { - __LOG3("CMMCScBkupArchiveDataManager::ADIReadFileL() - START - file: %S, offset: %8d, length: %8d", &aDestinationFileName, aInfo.Offset(), aInfo.Length()); - - if (!iBufferManager || iBufferManager->Type() != CMMCScBkupBufferManagerBase::ETypeArchiveToFile) - { - CMMCScBkupBufferManagerBase* bm = - CMMCScBkupBufferManagerBase::NewByTypeL( - CMMCScBkupBufferManagerBase::ETypeArchiveToFile, - iProgressManager, - *this, - (TAny*) &aDestinationFileName, - (TAny*) &aInfo ); - // - delete iBufferManager; - iBufferManager = bm; - } - else - { - iBufferManager->InitializeL( (TAny*) &aDestinationFileName, (TAny*) &aInfo ); - } - - // Setup our observer & op - SetOperation(EOperationDecompressing); - SetObserver(aStatus); - - // Compressing aData to the archive file - EnsureDecompressorExistsL(*iBufferManager); - - // Do the compression asynchronously - CompleteSelf(); - - __LOG("CMMCScBkupArchiveDataManager::ADIReadFileL() - END"); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::ADIWriteCompressedL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::ADIWriteCompressedL( const TDesC8& aData, TRequestStatus& aStatus ) - { - if (!iBufferManager || iBufferManager->Type() != CMMCScBkupBufferManagerBase::ETypeDescriptorToArchive) - { - CMMCScBkupBufferManagerBase* bm = - CMMCScBkupBufferManagerBase::NewByTypeL( - CMMCScBkupBufferManagerBase::ETypeDescriptorToArchive, - iProgressManager, - *this, - (TAny*) &aData ); - // - delete iBufferManager; - iBufferManager = bm; - } - else - { - iBufferManager->InitializeL( (TAny*) &aData ); - } - - // Setup our observer & op - SetOperation(EOperationCompressing); - SetObserver(aStatus); - - // Compressing aData to the archive file - EnsureCompressorExistsL(*iBufferManager); - - // Do the compression asynchronously - CompleteSelf(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::ADIReadDecompressedL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::ADIReadDecompressedL( TDes8& aSink, const TMMCScBkupArchiveVector& aInfo, TRequestStatus& aStatus ) - { - if (!iBufferManager || iBufferManager->Type() != CMMCScBkupBufferManagerBase::ETypeArchiveToDescriptor) - { - CMMCScBkupBufferManagerBase* bm = - CMMCScBkupBufferManagerBase::NewByTypeL( - CMMCScBkupBufferManagerBase::ETypeArchiveToDescriptor, - iProgressManager, - *this, - (TAny*) &aSink, - (TAny*) &aInfo ); - // - delete iBufferManager; - iBufferManager = bm; - } - else - { - iBufferManager->InitializeL( (TAny*) &aSink, (TAny*) &aInfo ); - } - - // Setup our observer & op - SetOperation(EOperationDecompressing); - SetObserver(aStatus); - - // Compressing aData to the archive file - EnsureDecompressorExistsL(*iBufferManager); - - // Do the compression asynchronously - CompleteSelf(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::ADIAsynchronousCancel() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::ADIAsynchronousCancel() - { - Cancel(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::ADIResetResources() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::ADIResetResources(TMMCScBkupOperationType /* aType */) - { - __LOG("CMMCScBkupArchiveDataManager::ADIResetResources()"); - - delete iCompressor; - iCompressor = NULL; - delete iDecompressor; - iDecompressor = NULL; - delete iBufferManager; - iBufferManager = NULL; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::EnsureCompressorExistsL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::EnsureCompressorExistsL( MEZBufferManager& aBufferManager ) - { - delete iDecompressor; - iDecompressor = NULL; - // - if (iCompressor == NULL) - { - iCompressor = CEZCompressor::NewL( aBufferManager ); - } - else - { - iCompressor->ResetL(aBufferManager); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::EnsureDecompressorExistsL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::EnsureDecompressorExistsL( MEZBufferManager& aBufferManager ) - { - delete iCompressor; - iCompressor = NULL; - // - if (iDecompressor == NULL) - { - iDecompressor = CEZDecompressor::NewL( aBufferManager ); - } - else - { - iDecompressor->ResetL(aBufferManager); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::SetObserver() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::SetObserver( TRequestStatus& aStatus ) - { - __ASSERT_DEBUG(iObserverStatus == NULL, User::Invariant()); - iObserverStatus = &aStatus; - *iObserverStatus = KRequestPending; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::CompleteSelf() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::CompleteSelf( TInt aCompletionCode ) - { - SetActive(); - TRequestStatus* status = &iStatus; - User::RequestComplete(status, aCompletionCode); - } - - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::CompleteObserver(() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::CompleteObserver( TInt aCompletionCode ) - { - __ASSERT_ALWAYS(iObserverStatus != NULL, User::Invariant()); - User::RequestComplete(iObserverStatus, aCompletionCode); - - // Implicitly, we must be finished - SetOperation(EOperationIdle); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::SetOperation() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::SetOperation( TOperation aOperation ) - { - iOperation = aOperation; - } - - -#ifdef RD_FILE_MANAGER_BACKUP -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::CalculateCrc() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::CalculateCrc( const TAny* aPtr,TInt aLength ) - { - if(iCrcCalcActivated) - { -#if defined(__MMCSCBKUPLOGGING_ENABLED__) - TUint32 startTime = User::NTickCount(); -#endif - Mem::Crc32(iCrc, aPtr, aLength); -#if defined(__MMCSCBKUPLOGGING_ENABLED__) - iTotalTickCount += (User::NTickCount() - startTime); - //__LOG5("CMMCScBkupArchiveDataManager::CalculateCrc() - crc %u, addr 0x%08x, len %d, offset %d, ticks in ms %u", - // iCrc, aPtr, aLength, CurrentOffset(), iTotalTickCount); -#endif - } - } -#endif - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::RunL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::RunL() - { - User::LeaveIfError(iStatus.Int()); - TBool moreToDo = EFalse; - // - switch(iOperation) - { - case EOperationIdle: - ASSERT( EFalse ); - break; - case EOperationCompressing: - __LOG("CMMCScBkupArchiveDataManager::RunL() - START - EOperationCompressing"); - moreToDo = iCompressor->DeflateL(); - break; - case EOperationDecompressing: - __LOG("CMMCScBkupArchiveDataManager::RunL() - START - EOperationDecompressing"); - moreToDo = iDecompressor->InflateL(); - break; - } - // - if (moreToDo) - { - CompleteSelf(); - } - else - { - // Update current offset & length info based upon buffer manager indications - const TMMCScBkupArchiveVector& finalInfo = iBufferManager->Info(); - iCurrentVectorInfo = finalInfo; - - // Ensure we set the state back to idle, ready for next operation... - iOperation = EOperationIdle; - - __LOG2("CMMCScBkupArchiveDataManager::RunL() - operation complete - offset: %8d, length: %8d", iCurrentVectorInfo.Offset(), iCurrentVectorInfo.Length()); - CompleteObserver(); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::DoCancel() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveDataManager::DoCancel() - { - __ASSERT_DEBUG(iOperation != EOperationIdle, User::Invariant()); - // - CompleteObserver(KErrCancel); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveDataManager::RunError() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupArchiveDataManager::RunError( TInt aError ) - { - __LOG1("CMMCScBkupArchiveDataManager::RunError() - START - aError: %d", aError); - CompleteObserver(aError); - // - return KErrNone; - } - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupArchiveFooter.cpp --- a/filemanager/bkupengine/src/CMMCScBkupArchiveFooter.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,342 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupArchiveFooter Implementation -* -* -*/ - -#include "CMMCScBkupArchiveFooter.h" - -// User includes -#include "CMMCScBkupIndexPublicDataFiles.h" -#include "CMMCScBkupIndexDataOwners.h" -#include "CMMCScBkupIndexJavaData.h" -#include "CMMCScBkupIndexSystemData.h" -#include "CMMCScBkupIndexActiveData.h" -#include "CMMCScBkupIndexJavaData.h" -#include "CMMCScBkupIndexPassiveData.h" -#include "MMMCScBkupArchiveDataInterface.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "MMCScBkupArchiveUtils.h" -#include "CMMCScBkupDataOwnerCollection.h" - -/** - - UNDERSTANDING ARCHIVE FOOTER - ============================ - - // Indicies are: - // - // EMMCScBkupOwnerDataTypeDataOwner - // EMMCScBkupOwnerDataTypeJavaData - // EMMCScBkupOwnerDataTypePublicData - // EMMCScBkupOwnerDataTypeSystemData - // EMMCScBkupOwnerDataTypeActiveData - // EMMCScBkupOwnerDataTypePassiveData - // - // 6 (index objects) * - // ( 1 byte for object type + TMMCScBkupArchiveVector::ExternalizedSize() ) - // - - // THIS IS THE SIZE OF AN INDIVIDUAL "INDEX RECORD POINTER" - const TInt indexDataSize = 1 // index type - + TMMCScBkupArchiveVector::ExternalizedSize() // vector - + 4 // spare1 - + 4 // spare2 - ; - - // THIS IS THE TOTAL SIZE OF ALL "INDEX RECORD POINTERS" - const TInt sizeOfAllIndicies = - 4 // stream format version - + 4 // spare1 - + 4 // spare2 - + 4 // spare3 - + 4 // spare4 - + 4 // index object count - + ( EMMCScBkupOwnerDataTypeCount * indexDataSize); - - // WE ALSO WRITE THE AMOUNT OF DISK SPACE REQUIRED FOR EACH DRIVE - // IN ORDER TO RESTORE THE ARCHIVE - - (not included here) -*/ - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveFooter::CMMCScBkupArchiveFooter() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupArchiveFooter::CMMCScBkupArchiveFooter( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ) -: iDataInterface( aDataInterface ), iDriver( aDriver ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveFooter::~CMMCScBkupArchiveFooter() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupArchiveFooter::~CMMCScBkupArchiveFooter() - { - iIndicies.Close(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveFooter::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveFooter::ConstructL() - { - CMMCScBkupIndexBase* index = NULL; - // - index = CMMCScBkupIndexDataOwners::NewLC(); - iIndicies.AppendL(index); - CleanupStack::Pop(index); - // - index = CMMCScBkupIndexPublicDataFiles::NewLC(); - iIndicies.AppendL(index); - CleanupStack::Pop(index); - // - index = CMMCScBkupIndexSystemData::NewLC(); - iIndicies.AppendL(index); - CleanupStack::Pop(index); - // - index = CMMCScBkupIndexJavaData::NewLC(); - iIndicies.AppendL(index); - CleanupStack::Pop(index); - // - index = CMMCScBkupIndexActiveData::NewLC(); - iIndicies.AppendL(index); - CleanupStack::Pop(index); - // - index = CMMCScBkupIndexPassiveData::NewLC(); - iIndicies.AppendL(index); - CleanupStack::Pop(index); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveFooter::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupArchiveFooter* CMMCScBkupArchiveFooter::NewL( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ) - { - CMMCScBkupArchiveFooter* self = new(ELeave) CMMCScBkupArchiveFooter( aDataInterface, aDriver ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveFooter::IndexByType() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupIndexBase& CMMCScBkupArchiveFooter::IndexByType( TMMCScBkupOwnerDataType aType ) - { - CMMCScBkupIndexBase* ret = IndexByTypeOrNull( aType ); - __ASSERT_ALWAYS(ret != NULL, User::Invariant()); - return *ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveFooter::IndexByTypeOrNull() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupIndexBase* CMMCScBkupArchiveFooter::IndexByTypeOrNull( TMMCScBkupOwnerDataType aType ) - { - CMMCScBkupIndexBase* ret = NULL; - // - const TInt count = iIndicies.Count(); - for(TInt i=0; iType() == aType) - { - ret = entry; - break; - } - } - // - return ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveFooter::StoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveFooter::StoreL() - { - RWriteStream stream( iDataInterface.ADIWriteStreamUncompressedLC() ); - // - const TInt count = iIndicies.Count(); - __ASSERT_DEBUG( count == EMMCScBkupOwnerDataTypeCount, User::Invariant()); - - // NEW: write index version - stream.WriteInt32L( EStreamFormatVersion1 ); - - // NEW: spare1, spare2, spare3, spare4 - stream.WriteInt32L( 0 ); - stream.WriteInt32L( 0 ); - stream.WriteInt32L( 0 ); - stream.WriteInt32L( 0 ); - - // NEW: write the number of indicies... - stream.WriteInt32L( count ); - - // ...then write each index in turn... - for(TInt i=0; i inMemoryIndexCount ) - { - // Something wrong with file format version info? - User::Leave( KErrCorrupt ); - } - - // Read index offsets - for(TInt i=0; i( stream.ReadInt8L() ); - // - if ( type < 0 || type >= EMMCScBkupOwnerDataTypeCount ) - { - User::Leave( KErrCorrupt ); - } - else - { - // Always read the vector info (in order to keep the stream - // position inline with the externalised representation) - TMMCScBkupArchiveVector vector; - stream >> vector; - - // NEW: Then read spare bytes for each index record - stream.ReadInt32L(); // per-index spare1 - stream.ReadInt32L(); // per-index spare2 - - // But only prepare the index if we have a similar type.. - CMMCScBkupIndexBase* index = IndexByTypeOrNull( type ); - // - if ( index ) - { - index->SetVector( vector ); - } - - } - } - - // NEW: read the amount of disk space required for each drive as - // part of the footer information - CMMCScBkupDataOwnerCollection& dataOwners = iDriver.DrvDataOwners(); - stream >> dataOwners; - - // - CleanupStack::PopAndDestroy(); // stream - } - - - - - - - - - - - - - - - - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupArchiveHeader.cpp --- a/filemanager/bkupengine/src/CMMCScBkupArchiveHeader.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupArchiveHeader Implementation -* -* -*/ - -#include "CMMCScBkupArchiveHeader.h" - -// User includes -#include "MMCScBkupArchiveUtils.h" - -/** - * NB. See MMCScBkupArchiveUtils.cpp for archive header file format. - */ - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveHeader::CMMCScBkupArchiveHeader() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupArchiveHeader::CMMCScBkupArchiveHeader( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ) -: iDataInterface( aDataInterface ), iDriver( aDriver ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveHeader::~CMMCScBkupArchiveHeader() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupArchiveHeader::~CMMCScBkupArchiveHeader() - { - delete iPhoneModelIdentifier; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveHeader::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveHeader::ConstructL() - { - iPhoneModelIdentifier = KNullDesC8().AllocL(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveHeader::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupArchiveHeader* CMMCScBkupArchiveHeader::NewL( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ) - { - CMMCScBkupArchiveHeader* self = new(ELeave) CMMCScBkupArchiveHeader( aDataInterface, aDriver ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveHeader::StoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveHeader::StoreL(TBitFlags aCategory) - { - MMCScBkupArchiveUtils::WriteHeaderL( iDataInterface, aCategory ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveHeader::RestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveHeader::RestoreL() - { - MMCScBkupArchiveUtils::ReadHeaderL( iDataInterface, *this ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveHeader::SetPhoneModelIdentifierL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveHeader::SetPhoneModelIdentifierL( const TDesC8& aModel ) - { - HBufC8* model = aModel.AllocL(); - delete iPhoneModelIdentifier; - iPhoneModelIdentifier = model; - } diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupArchiveInfo.cpp --- a/filemanager/bkupengine/src/CMMCScBkupArchiveInfo.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupArchiveInfo Implementation -* -* -*/ - -#include "CMMCScBkupArchiveInfo.h" - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveInfo::CMMCScBkupArchiveInfo() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupArchiveInfo::CMMCScBkupArchiveInfo() - { - } - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveInfo::~CMMCScBkupArchiveInfo() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupArchiveInfo::~CMMCScBkupArchiveInfo() - { - delete iFileInfo; - iSecureIds.Close(); - iExcludedSecureIds.Close(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveInfo::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveInfo::ConstructL( const TEntry& aEntry ) - { - iFileInfo = CMMCScBkupFileInfo::NewL( aEntry, 0 ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveInfo::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupArchiveInfo* CMMCScBkupArchiveInfo::NewL( const TEntry& aEntry ) - { - CMMCScBkupArchiveInfo* self = NewLC( aEntry ); - CleanupStack::Pop(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveInfo::NewLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupArchiveInfo* CMMCScBkupArchiveInfo::NewLC( const TEntry& aEntry ) - { - CMMCScBkupArchiveInfo* self = new(ELeave) CMMCScBkupArchiveInfo( ); - CleanupStack::PushL(self); - self->ConstructL(aEntry); - return self; - } - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveInfo::SetSIDs() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveInfo::SetSIDs( RArray& aSIDs ) - { - TInt count = aSIDs.Count(); - - for(TInt i = 0; i < count; i++ ) - { - iSecureIds.Append(aSIDs[i]); - } - } - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveInfo::SetExcludedSIDs() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupArchiveInfo::SetExcludedSIDs( RArray& aExcludedSIDs ) - { - TInt count = aExcludedSIDs.Count(); - - for(TInt i = 0; i < count; i++ ) - { - iExcludedSecureIds.Append(aExcludedSIDs[i]); - } - } - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveInfo::SIDs() -// -// -// --------------------------------------------------------------------------- -const RArray& CMMCScBkupArchiveInfo::SIDs( TBitFlags aCategory ) const - { - __ASSERT_ALWAYS(aCategory == iCategory, User::Invariant()); - - return iSecureIds; - } - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveInfo::ExcludeSIDs() -// -// -// --------------------------------------------------------------------------- -const RArray& CMMCScBkupArchiveInfo::ExcludedSIDs( TBitFlags aCategory ) const - { - __ASSERT_ALWAYS(aCategory == iCategory, User::Invariant()); - - return iExcludedSecureIds; - } - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveInfo::Category() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TBitFlags CMMCScBkupArchiveInfo::Category() const - { - return iCategory; - } - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveInfo::FileName() -// -// -// --------------------------------------------------------------------------- -EXPORT_C const TDesC& CMMCScBkupArchiveInfo::FileName() const - { - return iFileInfo->FileName(); - } - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveInfo::DateTime() -// -// -// --------------------------------------------------------------------------- -EXPORT_C const TTime& CMMCScBkupArchiveInfo::DateTime() const - { - return iFileInfo->DateTime(); - } - -// --------------------------------------------------------------------------- -// CMMCScBkupArchiveInfo::Drive() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TDriveNumber CMMCScBkupArchiveInfo::Drive() const - { - return iFileInfo->Drive(); - } diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupBufferManagers.cpp --- a/filemanager/bkupengine/src/CMMCScBkupBufferManagers.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,837 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupBufferManagerBase implementation -* -* -*/ - -#include "CMMCScBkupBufferManagers.h" - -// System includes -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupDataStrategies.h" -#include "MMMCScBkupArchiveDataInterface.h" -#include "MMMCScBkupProgressObserver.h" - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerBase::CMMCScBkupBufferManagerBase() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupBufferManagerBase::CMMCScBkupBufferManagerBase(MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI, TType aType ) -: iType( aType ), iBufferPointer( NULL, 0, 0 ), iProgressManager( aProgressManager ), iADI( aADI ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerBase::~CMMCScBkupBufferManagerBase() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupBufferManagerBase::~CMMCScBkupBufferManagerBase() - { - delete iBuffer; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerBase::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerBase::ConstructL(TInt aBufferSize) - { - HBufC8* buffer = HBufC8::NewL(aBufferSize); - delete iBuffer; - iBuffer = buffer; - iBufferPointer.Set(iBuffer->Des()); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerBase::NewByTypeL() -// -// Factory -// --------------------------------------------------------------------------- -CMMCScBkupBufferManagerBase* CMMCScBkupBufferManagerBase::NewByTypeL(TType aType, MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI, TAny* aParam1, TAny* aParam2) - { - CMMCScBkupBufferManagerBase* ret = NULL; - // - switch(aType) - { - case ETypeDescriptorToArchive: - ret = CMMCScBkupBufferManagerDescriptorToArchive::NewL( aProgressManager, aADI ); - break; - case ETypeFileToArchive: - ret = CMMCScBkupBufferManagerFileToArchive::NewL( aProgressManager, aADI ); - break; - case ETypeArchiveToDescriptor: - ret = CMMCScBkupBufferManagerArchiveToDescriptor::NewL( aProgressManager, aADI ); - break; - case ETypeArchiveToFile: - ret = CMMCScBkupBufferManagerArchiveToFile::NewL( aProgressManager, aADI ); - break; - default: - User::Leave(KErrNotSupported); - break; - } - // - CleanupStack::PushL(ret); - ret->InitializeL(aParam1, aParam2); - CleanupStack::Pop(ret); - // - return ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerBase::WriteToArchiveAndUpdateStatsL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerBase::WriteToArchiveAndUpdateStatsL( const TDesC8& aData ) - { - // Write the data we currently have to file. This reset - const TMMCScBkupArchiveVector& writtenInfo = ADI().ADIWriteL( aData ); - - // Update our stats. We combined what we've already written with - // the amount of data we just wrote. - if ( Info().Offset() == 0 ) - { - // Possibly never updated the offset before... - Info().SetOffset( writtenInfo.Offset() ); - } - // - const TInt existingLength = Info().Length(); - Info().SetLength( existingLength + writtenInfo.Length() ); - } - - - - - - - - - - - - - - - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerDescriptorToArchive::CMMCScBkupBufferManagerDescriptorToArchive() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupBufferManagerDescriptorToArchive::CMMCScBkupBufferManagerDescriptorToArchive( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) -: CMMCScBkupBufferManagerBase( aProgressManager, aADI, ETypeDescriptorToArchive ), iSource( KNullDesC8 ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerDescriptorToArchive::CMMCScBkupBufferManagerDescriptorToArchive() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupBufferManagerDescriptorToArchive* CMMCScBkupBufferManagerDescriptorToArchive::NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) - { - CMMCScBkupBufferManagerDescriptorToArchive* self = new(ELeave) CMMCScBkupBufferManagerDescriptorToArchive( aProgressManager, aADI ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerDescriptorToArchive::InitializeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerDescriptorToArchive::InitializeL(TAny* aParam1, TAny* /*aParam2*/) - { - const TDesC8* pData = reinterpret_cast(aParam1); - iSource.Set(*pData); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerDescriptorToArchive::InitializeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerDescriptorToArchive::InitializeL( CEZZStream& aZStream ) - { - // We use the source object as the input buffer. Therefore the - // dynamic buffer is used as an intermediate storage depot for compressed - // data before it is flushed to disk - aZStream.SetInput( iSource ); - aZStream.SetOutput( WriteBuffer() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerDescriptorToArchive::NeedInputL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerDescriptorToArchive::NeedInputL(CEZZStream& /*aZStream*/) - { - // Nothing to do here - we have provided all our input in one go - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerDescriptorToArchive::NeedOutputL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerDescriptorToArchive::NeedOutputL( CEZZStream& aZStream ) - { - const TPtrC8 output(aZStream.OutputDescriptor()); - WriteToArchiveAndUpdateStatsL( output ); - - // Reset ready for more writing - WriteBuffer().Zero(); - aZStream.SetOutput( WriteBuffer() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerDescriptorToArchive::FinalizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerDescriptorToArchive::FinalizeL( CEZZStream& aZStream ) - { - // Write any remaining data... - const TPtrC8 output(aZStream.OutputDescriptor()); - WriteToArchiveAndUpdateStatsL( output ); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerFileToArchive::CMMCScBkupBufferManagerFileToArchive() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupBufferManagerFileToArchive::CMMCScBkupBufferManagerFileToArchive( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) -: CMMCScBkupBufferManagerBase( aProgressManager, aADI, ETypeDescriptorToArchive ), iOutputPointer( NULL, 0, 0 ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerFileToArchive::~CMMCScBkupBufferManagerFileToArchive() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupBufferManagerFileToArchive::~CMMCScBkupBufferManagerFileToArchive() - { - delete iReadStrategy; - delete iOutput; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerFileToArchive::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerFileToArchive::ConstructL( const TDesC& aFileName ) - { - CMMCScBkupBufferManagerBase::ConstructL(); - // - CMMCScBkupDataStrategy* strategy = CMMCScBkupDataStrategy::ReadStrategyLC(aFileName, ADI().ADIFsSession()); - delete iReadStrategy; - iReadStrategy = strategy; - CleanupStack::Pop(strategy); - // - HBufC8* output = HBufC8::NewL(KScBkupDefaultBufferSize); - delete iOutput; - iOutput = output; - iOutputPointer.Set(iOutput->Des()); - // - iFileName.Set(aFileName); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerFileToArchive::CMMCScBkupBufferManagerFileToArchive() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupBufferManagerFileToArchive* CMMCScBkupBufferManagerFileToArchive::NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) - { - CMMCScBkupBufferManagerFileToArchive* self = new(ELeave) CMMCScBkupBufferManagerFileToArchive( aProgressManager, aADI ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerFileToArchive::InitializeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerFileToArchive::InitializeL(TAny* aParam1, TAny* /*aParam2*/) - { - const TDesC* pFileName = reinterpret_cast(aParam1); - const TPtrC fileName(*pFileName); - ConstructL(fileName); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerFileToArchive::InitializeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerFileToArchive::InitializeL( CEZZStream& aZStream ) - { - // Seed input buffer - TPtr8 pWriteBuffer( WriteBuffer() ); - iReadStrategy->Read( pWriteBuffer ); - aZStream.SetInput( pWriteBuffer ); - - // Progress during a backup is calculated based upon the amount of the - // source file that has been read. - ProgressManager().MMCScBkupHandleProgress( pWriteBuffer.Length() ); - - // Make ready for output - aZStream.SetOutput( iOutputPointer ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerFileToArchive::NeedInputL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerFileToArchive::NeedInputL( CEZZStream& aZStream ) - { - // Read some data from the file - TPtr8 pWriteBuffer( WriteBuffer() ); - iReadStrategy->Read( pWriteBuffer ); - - // Progress during a backup is calculated based upon the amount of the - // source file that has been read. - ProgressManager().MMCScBkupHandleProgress( pWriteBuffer.Length() ); - - aZStream.SetInput( pWriteBuffer ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerFileToArchive::NeedOutputL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerFileToArchive::NeedOutputL( CEZZStream& aZStream ) - { - const TPtrC8 output(aZStream.OutputDescriptor()); - WriteToArchiveAndUpdateStatsL( output ); - - // Reset ready for more writing - iOutputPointer.Zero(); - aZStream.SetOutput( iOutputPointer ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerFileToArchive::FinalizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerFileToArchive::FinalizeL( CEZZStream& aZStream ) - { - const TPtrC8 output(aZStream.OutputDescriptor()); - -#if defined(__MMCSCBKUPLOGGING_ENABLED__) - const TInt compressedSize = output.Size() + Info().Length(); - TEntry entry; - const TInt error = ADI().ADIFsSession().Entry(iFileName, entry); - if (error == KErrNone) - { - const TReal ratio = (TReal) entry.iSize / (TReal) compressedSize; - __LOG4("CMMCScBkupBufferManagerFileToArchive::FinalizeL() - compressing %S - original: %d, compressed: %d, ratio: %f", &iFileName, entry.iSize, compressedSize, ratio); - if (compressedSize > entry.iSize) - { - // We've made this file bigger - __LOG3("CMMCScBkupBufferManagerFileToArchive::FinalizeL() - compressing %S had negative effect - originalSize: %d vs compressed: %d", &iFileName, entry.iSize, compressedSize); - } - } -#endif - - WriteToArchiveAndUpdateStatsL( output ); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToDescriptor::CMMCScBkupBufferManagerArchiveToDescriptor() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupBufferManagerArchiveToDescriptor::CMMCScBkupBufferManagerArchiveToDescriptor( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) -: CMMCScBkupBufferManagerBase( aProgressManager, aADI, ETypeArchiveToDescriptor ), iOutputPointer( NULL, 0, 0 ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToDescriptor::~CMMCScBkupBufferManagerArchiveToDescriptor() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupBufferManagerArchiveToDescriptor::~CMMCScBkupBufferManagerArchiveToDescriptor() - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToDescriptor::CMMCScBkupBufferManagerArchiveToDescriptor() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupBufferManagerArchiveToDescriptor* CMMCScBkupBufferManagerArchiveToDescriptor::NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) - { - CMMCScBkupBufferManagerArchiveToDescriptor* self = new(ELeave) CMMCScBkupBufferManagerArchiveToDescriptor( aProgressManager, aADI ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToDescriptor::InitializeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerArchiveToDescriptor::InitializeL( TAny* aParam1, TAny* aParam2 ) - { - // Setup sink - TDes8* pDataSink = (TDes8*) aParam1; - iOutputPointer.Set( const_cast( pDataSink->Ptr() ), pDataSink->Length(), pDataSink->MaxLength() ); - - // Setup max read info - const TMMCScBkupArchiveVector* readInfo = (const TMMCScBkupArchiveVector*) aParam2; - Info() = *readInfo; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToDescriptor::InitializeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerArchiveToDescriptor::InitializeL( CEZZStream& aZStream ) - { - // Try to read some data - TryToReadMoreSourceDataL(); - - // We use the source object as the input buffer. Therefore the - // dynamic buffer is used as an intermediate storage depot for compressed - // data before it is flushed to disk - aZStream.SetInput( DataView() ); - aZStream.SetOutput( iOutputPointer ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToDescriptor::NeedInputL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerArchiveToDescriptor::NeedInputL(CEZZStream& aZStream) - { - // Try to read some more data - TryToReadMoreSourceDataL(); - aZStream.SetInput( DataView() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToDescriptor::NeedOutputL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerArchiveToDescriptor::NeedOutputL( CEZZStream& /*aZStream*/ ) - { - // Nothing to do here, we've got no more space if the sink is full - ASSERT( EFalse ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToDescriptor::FinalizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerArchiveToDescriptor::FinalizeL( CEZZStream& /*aZStream*/ ) - { - // Nothing to do here, we've writing straight to the client's descriptor - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToDescriptor::TryToReadMoreSourceDataL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerArchiveToDescriptor::TryToReadMoreSourceDataL() - { - if ( Info().Length() > 0 ) - { - // Try to read some source data, but don't read beyond the limits - const TMMCScBkupArchiveVector& readInfoResult = ADI().ADIReadL( WriteBuffer(), Info() ); - - // Update remaining read info so that we know where from and how much data - // to read next time around - const TInt newStartingOffset = readInfoResult.Offset() + readInfoResult.Length(); - const TInt remainingToBeRead = Info().Length() - readInfoResult.Length(); - // - Info().SetOffset( newStartingOffset ); - Info().SetLength( remainingToBeRead ); - // - __LOG1("CMMCScBkupBufferManagerArchiveToDescriptor::TryToReadMoreSourceDataL() - read: %d bytes from archive", readInfoResult.Length()); - // - ProgressManager().MMCScBkupHandleProgress( readInfoResult.Length() ); - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToFile::CMMCScBkupBufferManagerArchiveToFile() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupBufferManagerArchiveToFile::CMMCScBkupBufferManagerArchiveToFile( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) -: CMMCScBkupBufferManagerBase( aProgressManager, aADI, ETypeArchiveToFile ), iOutputPointer( NULL, 0, 0 ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToFile::~CMMCScBkupBufferManagerArchiveToFile() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupBufferManagerArchiveToFile::~CMMCScBkupBufferManagerArchiveToFile() - { - delete iWriteStrategy; - delete iOutput; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToFile::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerArchiveToFile::ConstructL( const TDesC& aFileName ) - { - CMMCScBkupBufferManagerBase::ConstructL(); - - // Create a write strategy that ultimately writes to a temp file in our - // private data cage. When the file has been successfully extracted, - // we then replace the original. -> see FinalizeL() - CMMCScBkupDataStrategy* strategy = CMMCScBkupDataStrategy::WriteStrategyLC( aFileName, ADI().ADIFsSession(), KMMCScBkupUseTempFile ); - delete iWriteStrategy; - iWriteStrategy = strategy; - CleanupStack::Pop( strategy ); - // - HBufC8* output = HBufC8::NewL(KScBkupDefaultBufferSize); - delete iOutput; - iOutput = output; - iOutputPointer.Set(iOutput->Des()); - // - iFileName.Set(aFileName); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToFile::CMMCScBkupBufferManagerArchiveToFile() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupBufferManagerArchiveToFile* CMMCScBkupBufferManagerArchiveToFile::NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) - { - CMMCScBkupBufferManagerArchiveToFile* self = new(ELeave) CMMCScBkupBufferManagerArchiveToFile( aProgressManager, aADI ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToFile::InitializeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerArchiveToFile::InitializeL(TAny* aParam1, TAny* aParam2) - { - // Param 1 is the destination file name - const TDesC* pFileName = reinterpret_cast(aParam1); - const TPtrC fileName(*pFileName); - ConstructL(fileName); - - // Param 2 defines where we should read archive data from (and how much we should read) - const TMMCScBkupArchiveVector* readInfo = (const TMMCScBkupArchiveVector*) aParam2; - Info() = *readInfo; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToFile::InitializeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerArchiveToFile::InitializeL( CEZZStream& aZStream ) - { - // Try to read some data - TryToReadMoreSourceDataL(); - - // Input comes from the base class buffer. Its effectively the - // data from the archive. - aZStream.SetInput( WriteBuffer() ); - - // Output goes to our secondary buffer - we'll eventually - // write this to the destination file. - aZStream.SetOutput( iOutputPointer ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToFile::NeedInputL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerArchiveToFile::NeedInputL( CEZZStream& aZStream ) - { - // Try to read some more data - TryToReadMoreSourceDataL(); - aZStream.SetInput( DataView() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToFile::NeedOutputL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerArchiveToFile::NeedOutputL( CEZZStream& aZStream ) - { - // Flush output to oure write strategy - const TPtrC8 output(aZStream.OutputDescriptor()); - const TInt error = iWriteStrategy->Write( output ); - User::LeaveIfError( error ); - - // Reset ready for more writing - iOutputPointer.Zero(); - aZStream.SetOutput( iOutputPointer ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToFile::FinalizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerArchiveToFile::FinalizeL( CEZZStream& aZStream ) - { - const TPtrC8 output(aZStream.OutputDescriptor()); - TInt error = iWriteStrategy->Write( output ); - User::LeaveIfError( error ); - - // No errors writing to temp file, try to finalise write strategy - - // essentially this replaces the original file. - error = iWriteStrategy->Finalize(); - User::LeaveIfError( error ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupBufferManagerArchiveToFile::TryToReadMoreSourceDataL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupBufferManagerArchiveToFile::TryToReadMoreSourceDataL() - { - if ( Info().Length() > 0 ) - { - // Try to read some source data, but don't read beyond the limits - const TMMCScBkupArchiveVector& readInfoResult = ADI().ADIReadL( WriteBuffer(), Info() ); - - // Update remaining read info so that we know where from and how much data - // to read next time around - const TInt newStartingOffset = readInfoResult.Offset() + readInfoResult.Length(); - const TInt remainingToBeRead = Info().Length() - readInfoResult.Length(); - // - Info().SetOffset( newStartingOffset ); - Info().SetLength( remainingToBeRead ); - // - __LOG2("CMMCScBkupBufferManagerArchiveToFile::TryToReadMoreSourceDataL() - read: %d bytes from archive when reconstructing: %S", readInfoResult.Length(), &iFileName ); - // - ProgressManager().MMCScBkupHandleProgress( readInfoResult.Length() ); - } - } - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupDataOwnerCollection.cpp --- a/filemanager/bkupengine/src/CMMCScBkupDataOwnerCollection.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,567 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CMMCScBkupDataOwnerCollection implementation -* -* -*/ - -#include "CMMCScBkupDataOwnerCollection.h" - -// User includes -#include "MMCScBkupLogger.h" -#include "TMMCScBkupDriveAndSize.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "MMCScBkupSBEUtils.h" -#include "MMMCScBkupDriver.h" -#include "CMMCScBkupDriveDataSizeManager.h" -#include "RMMCScBkupProgressSizer.h" -#ifdef RD_FILE_MANAGER_BACKUP -#include "CMMCScBkupArchiveInfo.h" -#include "BkupEngine.hrh" -#endif - -// Constants -const TInt KMMCScBkupDataOwnerGranularity = 20; - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::CMMCScBkupDataOwnerCollection() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupDataOwnerCollection::CMMCScBkupDataOwnerCollection( MMMCScBkupDriver& aDriver, TBitFlags aCategory ) -: iDriver( aDriver ), iOwners(KMMCScBkupDataOwnerGranularity), iCategory( aCategory ) - { - } - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::~CMMCScBkupDataOwnerCollection() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupDataOwnerCollection::~CMMCScBkupDataOwnerCollection() - { - Reset(); - iOwners.Close(); - delete iRestoreSizer; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerCollection::ConstructL() - { - // The restore sizer data type is not relevant. It holds - // the combined disk space requirements for all drives - // for all data types. - iRestoreSizer = CMMCScBkupDriveSizer::NewLC( EMMCScBkupOwnerDataTypeAny ); - CleanupStack::Pop( iRestoreSizer ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupDataOwnerCollection* CMMCScBkupDataOwnerCollection::NewL( MMMCScBkupDriver& aDriver, TBitFlags aCategory ) - { - CMMCScBkupDataOwnerCollection* self = new(ELeave) CMMCScBkupDataOwnerCollection( aDriver, aCategory ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::AssignL() -// -// -// --------------------------------------------------------------------------- -#ifdef RD_FILE_MANAGER_BACKUP -TBool CMMCScBkupDataOwnerCollection::AssignL( const CMMCScBkupDataOwnerInfo& dataOwnerInfo ) - { - const CMMCScBkupArchiveInfo& archive = iDriver.DrvParamsBase().ArchiveInfo( Category() ); - const RArray& secureIds = archive.SIDs( Category() ); - const RArray& excludedSecureIds = archive.ExcludedSIDs( Category() ); - TBitFlags flags = archive.SpecialFlags(); - TBitFlags excludedFlags = archive.ExcludedSpecialFlags(); - - // Check whether data owner belongs to this category - if( BelongsToL( dataOwnerInfo, flags, excludedFlags, secureIds, excludedSecureIds) ) - { - iOwners.AppendL(&dataOwnerInfo); - return ETrue; - } - - return EFalse; - } -#else -void CMMCScBkupDataOwnerCollection::AssignL( RDataOwnerInfoArray& aArray ) - { - const TInt count = aArray.Count(); - // - for(TInt i=count-1; i>=0; i--) - { - // Ownership is immediately transferred to the backup owner info object - // so we should remove it from the array prior to passing into NewLC - conn::CDataOwnerInfo* sbDataOwner = aArray[i]; - aArray.Remove(i); // Ensures it won't be deleted twice - // - CMMCScBkupDataOwnerInfo* info = CMMCScBkupDataOwnerInfo::NewLC( sbDataOwner ); - iOwners.AppendL(info); - CleanupStack::Pop(info); - } - } -#endif - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::AppendL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerCollection::AppendL( CMMCScBkupDataOwnerInfo* aNewEntry ) - { - iOwners.AppendL( aNewEntry ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::Count() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupDataOwnerCollection::Count() const - { - return iOwners.Count(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::Owner() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::Owner(TInt aIndex) - { - CMMCScBkupDataOwnerInfo* info = iOwners[aIndex]; - return *info; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::Owner() -// -// -// --------------------------------------------------------------------------- -const CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::Owner(TInt aIndex) const - { - const CMMCScBkupDataOwnerInfo* info = iOwners[aIndex]; - return *info; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::OwnerL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::OwnerL( TSecureId aSID ) - { - TInt index = KErrNotFound; - CMMCScBkupDataOwnerInfo* ret = CMMCScBkupDataOwnerInfo::New( aSID ); - if (ret) - { - TIdentityRelation relation(CMMCScBkupDataOwnerInfo::CompareDataOwnerBySIDL); - index = iOwners.Find( ret, relation ); - delete ret; - ret = NULL; - } - // - if (index >= 0) - { - ret = iOwners[index]; - } - else - { - User::Leave(KErrNotFound); - } - // - return *ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::OwnerL() -// -// -// --------------------------------------------------------------------------- -const CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::OwnerL( TSecureId aSID ) const - { - CMMCScBkupDataOwnerCollection& self = *const_cast(this); - CMMCScBkupDataOwnerInfo& ret = self.OwnerL( aSID ); - return ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::OwnerL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::OwnerL( TUid aPackageId ) - { - CMMCScBkupDataOwnerInfo* ret = NULL; - const TInt count = iOwners.Count(); - // - for(TInt i=0; iOwner().Identifier() ); - if ( packageId == aPackageId ) - { - ret = entry; - } - } - // - if ( !ret ) - { - User::Leave(KErrNotFound); - } - // - return *ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::OwnerL() -// -// -// --------------------------------------------------------------------------- -const CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::OwnerL( TUid aPackageId ) const - { - CMMCScBkupDataOwnerCollection& self = *const_cast(this); - CMMCScBkupDataOwnerInfo& ret = self.OwnerL( aPackageId ); - return ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::OwnerL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::OwnerL( const TDesC& aHash ) - { - CMMCScBkupDataOwnerInfo* ret = NULL; - const TInt count = iOwners.Count(); - // - for(TInt i=0; iOwner().Identifier().DerivedTypeL(); - if ( type == EJavaDerivedType || type == EJavaTransferDerivedType ) - { - // Get hash - HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( entry->Owner().Identifier() ); - const TBool foundMatch = ( *hash == aHash ); - CleanupStack::PopAndDestroy( hash ); - - if ( foundMatch ) - { - ret = entry; - break; - } - } - } - // - if ( !ret ) - { - User::Leave(KErrNotFound); - } - // - return *ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::OwnerL() -// -// -// --------------------------------------------------------------------------- -const CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::OwnerL( const TDesC& aHash ) const - { - CMMCScBkupDataOwnerCollection& self = *const_cast(this); - CMMCScBkupDataOwnerInfo& ret = self.OwnerL( aHash ); - return ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::Remove() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerCollection::Remove( TInt aIndex ) - { - CMMCScBkupDataOwnerInfo* info = iOwners[aIndex]; - delete info; - iOwners.Remove(aIndex); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::Reset() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerCollection::Reset() - { - iOwners.ResetAndDestroy(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::TotalOperationalSizeL() -// -// -// --------------------------------------------------------------------------- -TInt64 CMMCScBkupDataOwnerCollection::TotalOperationalSizeL() const - { - RMMCScBkupProgressSizer sizer( iDriver.DrvParamsBase().DriveAndOperations() ); - TInt64 size = 0; - // - const TInt count = Count(); - for(TInt i=0; i=0; i--) - { - // We check the SBE's common settings (for each Data Owner) to identify - // if a reboot is required. So long as one data owner requires a - // reboot, then we must reset the machine.. hence we break - // out of the loop immediately. - const CMMCScBkupDataOwnerInfo& info = *iOwners[i]; - const CDataOwnerInfo& sbeDataOwnerInfo = info.Owner(); - // - if ( sbeDataOwnerInfo.CommonSettings() & ERequiresReboot ) - { - rebootRequired = ETrue; - break; - } - } - // - return rebootRequired; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::DiskSpaceRequiredForRestore() -// -// -// --------------------------------------------------------------------------- -TInt64 CMMCScBkupDataOwnerCollection::DiskSpaceRequiredForRestore( TDriveNumber aDrive ) const - { - return iRestoreSizer->Size( aDrive ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::CalculateDiskSpaceRequiredForRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerCollection::CalculateDiskSpaceRequiredForRestoreL() - { - iRestoreSizer->Reset(); - // - RArray driveSizes; - CleanupClosePushL( driveSizes ); - // - const TInt count = iOwners.Count(); - for(TInt i=count-1; i>=0; i--) - { - const CMMCScBkupDataOwnerInfo& owner = *iOwners[i]; - __LOG(" "); - __LOG1("CMMCScBkupDataOwnerCollection::CalculateDiskSpaceRequiredForRestoreL() - owner: 0x%08x...", owner.SecureId().iId); - // - owner.OperationalSizesL( driveSizes ); - // - const TInt driveSizesCount = driveSizes.Count(); - for( TInt j=0; jAddToSizeL( entry.Size(), entry.Drive() ); - } - } - // - CleanupStack::PopAndDestroy( &driveSizes ); - -#ifdef __MMCSCBKUPLOGGING_ENABLED__ - __LOG(" "); - __LOG(" "); - __LOG(" "); - __LOG(" "); - __LOG("CMMCScBkupDataOwnerCollection::CalculateDiskSpaceRequiredForRestoreL() - SUMMARY:"); - __LOG(" "); - - for( TInt d = EDriveA; d<=EDriveZ; d++ ) - { - // Get the size of each data type for this drive. - const TDriveNumber drive = static_cast< TDriveNumber >( d ); - const TInt64 size = DiskSpaceRequiredForRestore( drive ); - - if ( size > 0 ) - { - __LOG2("CMMCScBkupDataOwnerCollection::CalculateDiskSpaceRequiredForRestoreL() - %8Ld bytes required for drive: %c:", size, drive + 'A' ); - } - } -#endif - } - -#ifdef RD_FILE_MANAGER_BACKUP -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::BelongsToL() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupDataOwnerCollection::BelongsToL(const CMMCScBkupDataOwnerInfo& aInfo, - TBitFlags aFlags, TBitFlags aExcludedFlags, - const RArray aSecureIds, const RArray aExcludedSecureIds) const - { - // First of all check if data owner has system or java data. If it has and these - // types have been declared as excluded data types, then skip owner in this catecory. - // Public data is more common to data owners together with other data types meaning it - // cannot be a reason to invalidate data owner. System's user data folder (e.g. C:\Data) files - // are being skipped later on in public data backup phase if category is not EBUCatUserFiles - // It would be possible to just skip excluded types per data owner, but it - // might make data owner unstable after restore - - if( ((aExcludedFlags.Value() & EBUCatSpecSystem) && aInfo.HasSystemDataL()) || - ((aExcludedFlags.Value() & EBUCatSpecJava) && aInfo.HasJavaDataL()) || - ((aExcludedFlags.Value() & EBUCatSpecPublic) && aInfo.HasPublicDataL()) ) - { - return EFalse; - } - - // Then check whether all specified and SID not in list of excluded owners - if( (aFlags.Value() & EBUCatSpecAll) ) - { - TBool excluded = EFalse; - - for(TInt i = 0; i < aExcludedSecureIds.Count(); i++) - { - if(aInfo.SecureId().iId == aExcludedSecureIds[i].iId) - { - excluded = ETrue; - break; - } - } - - return !excluded; - } - - // Then check whether special rules apply - if( ((aFlags.Value() & EBUCatSpecSystem) && aInfo.HasSystemDataL()) || - ((aFlags.Value() & EBUCatSpecJava) && aInfo.HasJavaDataL()) || - ((aFlags.Value() & EBUCatSpecPublic) && aInfo.HasPublicDataL()) ) - { - return ETrue; - } - - // Finally check whether SID matches - for(TInt i = 0; i < aSecureIds.Count(); i++) - { - if(aInfo.SecureId().iId == aSecureIds[i].iId) - { - return ETrue; - } - } - - return EFalse; - } -#endif - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::InternalizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerCollection::InternalizeL( RReadStream& aStream ) - { - aStream.ReadInt32L(); // EStreamFormatVersion1 - aStream.ReadInt32L(); // spare1 - aStream.ReadInt32L(); // spare2 - aStream.ReadInt32L(); // spare3 - - CMMCScBkupDriveSizer* restoreSizer = CMMCScBkupDriveSizer::NewLC( aStream ); - delete iRestoreSizer; - iRestoreSizer = restoreSizer; - CleanupStack::Pop( restoreSizer ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerCollection::ExternalizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerCollection::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt32L( EStreamFormatVersion1 ); - aStream.WriteInt32L( 0 ); // spare1 - aStream.WriteInt32L( 0 ); // spare2 - aStream.WriteInt32L( 0 ); // spare3 - - aStream << *iRestoreSizer; - } - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupDataOwnerInfo.cpp --- a/filemanager/bkupengine/src/CMMCScBkupDataOwnerInfo.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,560 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupDataOwnerInfo implementation -* -* -*/ - -#include "CMMCScBkupDataOwnerInfo.h" - -// System includes -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "MMCScBkupSBEUtils.h" -#include "MMMCScBkupArchiveDataInterface.h" -#include "CMMCScBkupDriveDataSizeManager.h" - -// Constants -_LIT_SECURE_ID(KMMCScBkupUninitialisedSecureId, 0); - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::CMMCScBkupDataOwnerInfo() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupDataOwnerInfo::CMMCScBkupDataOwnerInfo( CDataOwnerInfo* aOwner ) -: iDataOwner(aOwner), iVersion(EStreamFormatVersionLatest-1) - { - SetStatus(EUnset); - // - iSecureId = KMMCScBkupUninitialisedSecureId; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::~CMMCScBkupDataOwnerInfo() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupDataOwnerInfo::~CMMCScBkupDataOwnerInfo() - { - delete iDataOwner; - delete iOperationalSize; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerInfo::ConstructL() - { - if ( iOperationalSize == NULL ) - { - iOperationalSize = CMMCScBkupDataTypeSizer::NewL(); - } - - // Try and extract the SID if its a package or a SID type - const TSBDerivedType type = iDataOwner->Identifier().DerivedTypeL(); - // - if (type == ESIDDerivedType || type == EPackageDerivedType) - { - iSecureId = MMCScBkupSBEUtils::SecureIdFromGenericL(iDataOwner->Identifier()); - if( iSecureId.iId == KNullUid.iUid && iVersion > EStreamFormatVersion1 ) - { - iSecureId = MMCScBkupSBEUtils::PackageIdFromGenericL(iDataOwner->Identifier()); - } - } - - // The following code sets the completion status to ETrue - // for any irrelevant items associated with a data owner. I.e. if - // a data owner doesn't support active backup, then it sets the completion - // of active backup to ETrue. This makes writing the logic inside the - // active/passive/system backup items a little easier (active in particular) - const TBool hasJavaData = HasJavaDataL(); - const TBool hasActiveData = HasActiveDataL(); - const TBool hasPassiveData = HasPassiveDataL(); - const TBool hasPublicData = HasPublicDataL(); - const TBool hasSystemData = HasSystemDataL(); - - // Update completion statuses (i.e. "what work must be done") - SetCompletionStatus( EMMCScBkupOwnerDataTypeJavaData, !hasJavaData ); - SetCompletionStatus( EMMCScBkupOwnerDataTypeActiveData, !hasActiveData ); - SetCompletionStatus( EMMCScBkupOwnerDataTypePassiveData, !hasPassiveData ); - SetCompletionStatus( EMMCScBkupOwnerDataTypePublicData, !hasPublicData ); - SetCompletionStatus( EMMCScBkupOwnerDataTypeSystemData, !hasSystemData ); - - // Be aware that CMMCScBkupStateRequestSizeOfDataOwner::GetJavaDataSizesL() can - // manipulate the passive data completion status depending on whether the midlet - // has associated data files. - - // If we're logging, then we write out some useful debugging info that shows - // which operations must be performed for each D.O. -#ifdef __MMCSCBKUPLOGGING_ENABLED__ - TBuf<256> drivePrint; - const TDriveList& driveList = iDataOwner->DriveList(); - - for(TInt i=0; iIdentifier() ); - __LOG7("CMMCScBkupDataOwnerInfo::ConstructL() - PubD: %d, ActD: %d, PasD: %d, JavD: %d, SysD: %d, drives: %S, hash: %S", hasPublicData, hasActiveData, hasPassiveData, hasJavaData, hasSystemData, &drivePrint, hash); - CleanupStack::PopAndDestroy( hash ); - } - else - { - __LOG8("CMMCScBkupDataOwnerInfo::ConstructL() - PubD: %d, ActD: %d, PasD: %d, JavD: %d, SysD: %d, drives: %S, SID : 0x%08x %S", hasPublicData, hasActiveData, hasPassiveData, hasJavaData, hasSystemData, &drivePrint, iSecureId.iId, &MMCScBkupLogger::FriendlyNameForSID( iSecureId )); - } -#endif - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::New() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupDataOwnerInfo* CMMCScBkupDataOwnerInfo::New( TSecureId aSecureId ) - { - CMMCScBkupDataOwnerInfo* self = new CMMCScBkupDataOwnerInfo( NULL ); - if (self) - { - self->iSecureId = aSecureId; - } - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::NewLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupDataOwnerInfo* CMMCScBkupDataOwnerInfo::NewLC( CDataOwnerInfo* aOwner ) - { - CleanupStack::PushL(aOwner); - CMMCScBkupDataOwnerInfo* self = new(ELeave) CMMCScBkupDataOwnerInfo( aOwner ); - CleanupStack::Pop(aOwner); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::NewLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupDataOwnerInfo* CMMCScBkupDataOwnerInfo::NewLC( RReadStream& aStream ) - { - CMMCScBkupDataOwnerInfo* self = new(ELeave) CMMCScBkupDataOwnerInfo(); - CleanupStack::PushL(self); - aStream >> *self; - self->ConstructL(); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::Owner() -// -// -// --------------------------------------------------------------------------- -CDataOwnerInfo& CMMCScBkupDataOwnerInfo::Owner() - { - return *iDataOwner; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::Owner() -// -// -// --------------------------------------------------------------------------- -const CDataOwnerInfo& CMMCScBkupDataOwnerInfo::Owner() const - { - return *iDataOwner; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::Status() -// -// -// --------------------------------------------------------------------------- -TDataOwnerStatus CMMCScBkupDataOwnerInfo::Status() const - { - return iStatus; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::SetStatus() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerInfo::SetStatus(TDataOwnerStatus aStatus) - { - iStatus = aStatus; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::AddToOperationalSizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerInfo::AddToOperationalSizeL( TMMCScBkupOwnerDataType aType, TDriveNumber aDrive, TInt64 aSize ) - { - iOperationalSize->AddToSizeL( aType, aSize, aDrive ); - -#if defined(__MMCSCBKUPLOGGING_ENABLED__) - const TInt64 newSize = iOperationalSize->Size( aType, aDrive ); - __LOG5("CMMCScBkupDataOwnerInfo::AddToOperationalSizeL() - [0x%08x] - aSize: %8Ld, newSize: %8Ld, aDrive: %c:, aType: %S", iSecureId.iId, aSize, newSize, aDrive + 'A', &MMCScBkupLogger::DataType( aType ) ); -#endif - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::SetOperationalSizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerInfo::SetOperationalSizeL( TMMCScBkupOwnerDataType aType, TDriveNumber aDrive, TInt64 aSize ) - { - iOperationalSize->Reset( aType, aDrive ); - iOperationalSize->AddToSizeL( aType, aSize, aDrive ); - - __LOG4("CMMCScBkupDataOwnerInfo::SetOperationalSizeL() - [0x%08x] - aSize: %8Ld, aDrive: %c:, aType: %S", iSecureId.iId, aSize, aDrive + 'A', &MMCScBkupLogger::DataType( aType ) ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::ResetOperationalSize() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerInfo::ResetOperationalSize( TMMCScBkupOwnerDataType aType ) - { - iOperationalSize->Reset( aType ); - __LOG2("CMMCScBkupDataOwnerInfo::ResetOperationalSize() - [0x%08x] - aType: %S", iSecureId.iId, &MMCScBkupLogger::DataType( aType ) ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::OperationalSize() -// -// -// --------------------------------------------------------------------------- -TInt64 CMMCScBkupDataOwnerInfo::OperationalSize( TMMCScBkupOwnerDataType aType, TDriveNumber aDrive ) const - { - const TInt64 size = iOperationalSize->Size( aType, aDrive ); - - __LOG4("CMMCScBkupDataOwnerInfo::OperationalSize() - [0x%08x] - size: %8Ld, aDrive: %c:, aType: %S", iSecureId.iId, size, aDrive + 'A', &MMCScBkupLogger::DataType( aType ) ); - - return size; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::OperationalSize() -// -// -// --------------------------------------------------------------------------- -TInt64 CMMCScBkupDataOwnerInfo::OperationalSize( TMMCScBkupOwnerDataType aType ) const - { - const TInt64 size = iOperationalSize->Size( aType ); - - //__LOG3("CMMCScBkupDataOwnerInfo::OperationalSize() - [0x%08x] - size: %8Ld, aType: %S", iSecureId.iId, size, &MMCScBkupLogger::DataType( aType ) ); - - return size; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::OperationalSize() -// -// -// --------------------------------------------------------------------------- -TInt64 CMMCScBkupDataOwnerInfo::OperationalSize( TDriveNumber aDrive ) const - { - const TInt64 size = iOperationalSize->CombinedSize( aDrive ); - - //__LOG3("CMMCScBkupDataOwnerInfo::OperationalSize() - [0x%08x] - size: %8Ld, aDrive: %c:", iSecureId.iId, size, aDrive + 'A' ); - - return size; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::OperationalSizesL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerInfo::OperationalSizesL( RArray& aSizes ) const - { - iOperationalSize->GetSizesL( aSizes ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::SetCompletionStatus() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerInfo::SetCompletionStatus( TMMCScBkupOwnerDataType aType, TBool aCompleted ) - { - iCompletionStatus[aType] = aCompleted; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::CompletionStatus() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupDataOwnerInfo::CompletionStatus( TMMCScBkupOwnerDataType aType ) const - { - return iCompletionStatus[aType]; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::ActiveDataRetryCount() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupDataOwnerInfo::ActiveDataRetryCount() const - { - return iActiveDataRetryCount; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::SetActiveDataRetryCount() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerInfo::SetActiveDataRetryCount(TInt aCount) - { - iActiveDataRetryCount = aCount; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::InternalizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerInfo::InternalizeL(RReadStream& aStream) - { - iVersion = aStream.ReadInt32L(); // EStreamFormatVersionX - aStream.ReadInt32L(); // spare1 - aStream.ReadInt32L(); // spare2 - aStream.ReadInt32L(); // spare3 - - // Secure ID - iSecureId = aStream.ReadInt32L(); - - // Data sizes - CMMCScBkupDataTypeSizer* operationalSize = CMMCScBkupDataTypeSizer::NewLC( aStream ); - delete iOperationalSize; - iOperationalSize = operationalSize; - CleanupStack::Pop( operationalSize ); - - // Read data owner buffer length - TCardinality dataOwnerLength; - aStream >> dataOwnerLength; - - // Internalize the data owner (as raw descriptor) - HBufC8* dataOwnerBuffer = HBufC8::NewLC( dataOwnerLength ); - TPtr8 pDataOwnerBuffer( dataOwnerBuffer->Des() ); - aStream.ReadL( pDataOwnerBuffer, dataOwnerLength ); - // - CDataOwnerInfo* dataOwner = CDataOwnerInfo::NewL( *dataOwnerBuffer ); - delete iDataOwner; - iDataOwner = dataOwner; - CleanupStack::PopAndDestroy( dataOwnerBuffer ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::ExternalizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataOwnerInfo::ExternalizeL(RWriteStream& aStream) const - { - aStream.WriteInt32L( EStreamFormatVersion2 ); - aStream.WriteInt32L( 0 ); // spare1 - aStream.WriteInt32L( 0 ); // spare2 - aStream.WriteInt32L( 0 ); // spare3 - - // Always write secure id - aStream.WriteInt32L( iSecureId ); - - // ... and always write the data sizes - aStream << *iOperationalSize; - - // Externalize the data owner to an HBufC8 - HBufC8* dataOwnerBuffer = iDataOwner->ExternaliseL(); - CleanupStack::PushL( dataOwnerBuffer ); - - // Write leading byte count - helps us when it comes to internalising - const TCardinality dataOwnerLength( dataOwnerBuffer->Length() ); - aStream << dataOwnerLength; - - // Now write the data owner buffer - not using chevrons just in case it - // does funny unicode compression stuff... - aStream.WriteL( *dataOwnerBuffer ); - - CleanupStack::PopAndDestroy(dataOwnerBuffer); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::CompareDataOwnerBySIDL() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupDataOwnerInfo::CompareDataOwnerBySIDL(const CMMCScBkupDataOwnerInfo& aLeft, const CMMCScBkupDataOwnerInfo& aRight) - { - TBool same = EFalse; - - // If we have an owner object, then we first compare the derived types. - // If not, we just directly compare the SIDs - if ( aLeft.iDataOwner && aRight.iDataOwner ) - { - const TSBDerivedType leftType = aLeft.Owner().Identifier().DerivedTypeL(); - const TSBDerivedType rightType = aRight.Owner().Identifier().DerivedTypeL(); - // - same = ((leftType == rightType) || - (leftType == ESIDDerivedType && rightType == EPackageDerivedType) || - (leftType == EPackageDerivedType && rightType == ESIDDerivedType) - ); - } - else if ( aRight.iDataOwner ) - { - // Check that it is not Java data owner in question. Java DOs all have - // secure id 0x0, but it could also be the case for certain package - // data owners (see for KDummyId in SBE implementation). - if( !MMCScBkupSBEUtils::HasJavaDataL( aRight.Owner() ) ) - { - // ..set to ETrue to trip next if-statement - same = ETrue; - } - } - - // Now compare the SID's themselves - if ( same ) - { - same = (aLeft.SecureId() == aRight.SecureId()); - } - // - return same; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::HasJavaDataL() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupDataOwnerInfo::HasJavaDataL() const - { - const TBool hasJavaData = MMCScBkupSBEUtils::HasJavaDataL( *iDataOwner ); - const TInt64 opSize = OperationalSize( EMMCScBkupOwnerDataTypeJavaData ); - // - return hasJavaData || (opSize > 0 ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::HasActiveDataL() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupDataOwnerInfo::HasActiveDataL() const - { - const TBool hasActiveData = MMCScBkupSBEUtils::HasActiveDataL( *iDataOwner ); - const TInt64 opSize = OperationalSize( EMMCScBkupOwnerDataTypeActiveData ); - // - return hasActiveData || (opSize > 0 ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::HasPassiveDataL() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupDataOwnerInfo::HasPassiveDataL() const - { - const TBool hasPassiveData = MMCScBkupSBEUtils::HasPassiveDataL( *iDataOwner ); - const TInt64 opSize = OperationalSize( EMMCScBkupOwnerDataTypePassiveData ); - // - return hasPassiveData || (opSize > 0 ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::HasPublicDataL() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupDataOwnerInfo::HasPublicDataL() const - { - const TBool hasPublicData = MMCScBkupSBEUtils::HasPublicDataL( *iDataOwner ); - const TInt64 opSize = OperationalSize( EMMCScBkupOwnerDataTypePublicData ); - // - return hasPublicData || (opSize > 0 ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataOwnerInfo::HasSystemDataL() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupDataOwnerInfo::HasSystemDataL() const - { - const TBool hasSystemData = MMCScBkupSBEUtils::HasSystemDataL( *iDataOwner ); - const TInt64 opSize = OperationalSize( EMMCScBkupOwnerDataTypeSystemData ); - // - return hasSystemData || (opSize > 0 ); - } - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupDataStrategies.cpp --- a/filemanager/bkupengine/src/CMMCScBkupDataStrategies.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,542 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupDataStrategy implementation -* -* -*/ - -#include "CMMCScBkupDataStrategies.h" - -// User includes -#include "MMCScBkupConfig.h" -#include "MMCScBkupLogger.h" - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupDataStrategy::CMMCScBkupDataStrategy() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupDataStrategy::CMMCScBkupDataStrategy() - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataStrategy::ReadStrategyLC() -// -// Factory function -// --------------------------------------------------------------------------- -CMMCScBkupDataStrategy* CMMCScBkupDataStrategy::ReadStrategyLC(const TDesC& aName, RFs& aFsSession) - { - // Fetch the size - TEntry entry; - const TInt error = aFsSession.Entry(aName, entry); - User::LeaveIfError(error); - - // Construct - return CMMCScBkupDataStrategy::ReadStrategyLC(aName, aFsSession, 0, entry.iSize); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataStrategy::ReadStrategyLC() -// -// Factory function -// --------------------------------------------------------------------------- -CMMCScBkupDataStrategy* CMMCScBkupDataStrategy::ReadStrategyLC(const TDesC& aName, RFs& aFsSession, TInt aOffset, TInt aLength) - { - CMMCScBkupDataStrategy* ret = NULL; - - // First, try a normal read strategy - TRAPD(err, ret = CMMCScBkupDataFileStrategy::NewForReadingL(aName, aFsSession)); - if (err != KErrNone) - { - // Try the file section read strategy - don't trap this - if it fails - // then this file cannot be read... - ret = CMMCScBkupDataFileSectionReadStrategy::NewL(aName, aFsSession); - } - // - if (ret) - { - ret->SetOffsetAndLength(aOffset, aLength); - } - // - CleanupStack::PushL( ret ); - return ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataStrategy::WriteStrategyLC() -// -// Factory function -// --------------------------------------------------------------------------- -CMMCScBkupDataStrategy* CMMCScBkupDataStrategy::WriteStrategyLC( const TDesC& aName, RFs& aFsSession, TBool aUseTempFile ) - { - CMMCScBkupDataStrategy* ret = CMMCScBkupDataFileStrategy::NewForWritingL( aName, aFsSession, aUseTempFile ); - CleanupStack::PushL(ret); - return ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataStrategy::Write() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupDataStrategy::Write(const TDesC8& /*aSource*/) - { - return KErrNotSupported; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataStrategy::Finalize() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupDataStrategy::Finalize() - { - return KErrNone; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataStrategy::SetOffsetAndLength() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataStrategy::SetOffsetAndLength(TInt aStartOffset, TInt aLengthToRead) - { - iOffset = aStartOffset; - iLengthToRead = aLengthToRead; - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupDataFileStrategy::CMMCScBkupDataFileStrategy() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupDataFileStrategy::CMMCScBkupDataFileStrategy( RFs& aFsSession, TBool aUseTempFile ) -: iFsSession( aFsSession ), iUseTempFile( aUseTempFile ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataFileStrategy::~CMMCScBkupDataFileStrategy() -// -// C++ destructor. -// --------------------------------------------------------------------------- -CMMCScBkupDataFileStrategy::~CMMCScBkupDataFileStrategy() - { - iFile.Close(); - delete iFileName; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataFileStrategy::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataFileStrategy::ConstructL( const TDesC& aName, TUint aMode ) - { - iFileName = aName.AllocL(); - - // The previous version of this engine would attempt to use the old - // backup & restore API to close this file. - // - // With the new Symbian Secure Backup Architecture, data owners are expected - // to release file locks on public files as soon as they receive - // notification that a backup is beginning. - TInt error = KErrNone; - // - if ( iUseTempFile ) - { - // Ensure path for temporary files exists on same drive where file will eventually - // be stored. This is important, because we estimate available size on target drive - // and so also temporary file size affects whether restore can be carried out. - HBufC* tempPath = HBufC::NewLC( KMaxFileName ); - TPtr pTempPath( tempPath->Des() ); - pTempPath.Zero(); - if(aName.Length()) - { - pTempPath.Append( aName[0] ); - } - else - { - const TDriveUnit driveUnit( KMMCScBkupTempFileDrive ); - const TDriveName drive( driveUnit.Name() ); - pTempPath.Append( drive ); - } - pTempPath.Append( KMMCScBkupTempDir ); - - error = iFsSession.MkDirAll( pTempPath ); - if ( ! (error == KErrNone || error == KErrAlreadyExists) ) - { - User::LeaveIfError( error ); - } - - // Make a temporary file - error = iFile.Temp( iFsSession, pTempPath, iTempFileName, aMode ); - __LOG2("CMMCScBkupDataFileStrategy::ConstructL() - Created temporary file: %S, error code: %d", &iTempFileName, error); - - // Clean up - CleanupStack::PopAndDestroy( tempPath ); - } - else - { - if( aMode & EFileWrite ) - { - error = PrepareToOverwriteFile( iFsSession, *iFileName ); - - if ( error == KErrNone ) - { - error = iFile.Create( iFsSession, *iFileName, aMode ); - __LOG2("CMMCScBkupDataFileStrategy::ConstructL() - Created file %S, error code: %d", iFileName, error); - } - } - else - { - error = iFile.Open( iFsSession, aName, aMode ); - } - } - // - User::LeaveIfError(error); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataFileStrategy::NewForReadingL() -// -// Factory function -// --------------------------------------------------------------------------- -CMMCScBkupDataFileStrategy* CMMCScBkupDataFileStrategy::NewForReadingL( const TDesC& aName, RFs& aFsSession ) - { - const TUint mode = EFileRead | EFileShareReadersOnly | EFileStream; - // - CMMCScBkupDataFileStrategy* self = new(ELeave) CMMCScBkupDataFileStrategy( aFsSession ); - CleanupStack::PushL(self); - self->ConstructL( aName, mode ); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataFileStrategy::NewForWritingL() -// -// Factory function -// --------------------------------------------------------------------------- -CMMCScBkupDataFileStrategy* CMMCScBkupDataFileStrategy::NewForWritingL( const TDesC& aName, RFs& aFsSession, TBool aUseTempFile ) - { - const TUint mode = EFileWrite | EFileStream; - // - CMMCScBkupDataFileStrategy* self = new(ELeave) CMMCScBkupDataFileStrategy( aFsSession, aUseTempFile ); - CleanupStack::PushL(self); - self->ConstructL( aName, mode ); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataFileStrategy::Read() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupDataFileStrategy::Read(TDes8& aSink) - { - TInt error = KErrNone; - // - aSink.Zero(); - TInt amountToRead = (LengthToRead() - Offset()); - if (amountToRead > aSink.MaxLength()) - { - amountToRead = aSink.MaxLength(); - } - // - if (amountToRead > 0) - { - // Do the read - error = iFile.Read( static_cast(Offset()), aSink, amountToRead ); - if (error == KErrNone) - { - SetOffset( Offset() + aSink.Length() ); - } - } - // - return error; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataFileStrategy::Write() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupDataFileStrategy::Write(const TDesC8& aSource) - { - // Offset writing not supported (no requirement) - const TInt error = iFile.Write( aSource ); - return error; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataFileStrategy::Finalize() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupDataFileStrategy::Finalize() - { - TInt error = KErrNone; - // - if ( iUseTempFile ) - { - // Prepare for over-write - error = PrepareToOverwriteFile( iFsSession, *iFileName ); - // - if ( error == KErrNone ) - { - // Finally, do the rename - error = iFile.Rename( *iFileName ); - __LOG2("CMMCScBkupDataFileStrategy::Finalize() - Renamed temporary file as: %S, error code: %d", iFileName, error); - } - } - - // Whatever the situation, we close the file now - iFile.Close(); - return error; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataFileStrategy::PrepareToOverwriteFile() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupDataFileStrategy::PrepareToOverwriteFile( RFs& aFsSession, const TDesC& aFileName ) - { - TInt err = KErrNone; - - // Create the full path, if not exists - err = aFsSession.MkDirAll( aFileName ); - - if( err == KErrAlreadyExists || !err ) - { - // Reset file flags - err = aFsSession.SetAtt( aFileName, KEntryAttNormal, !KEntryAttNormal ); - } - - if( !err ) - { - // Delete the file - err = aFsSession.Delete( aFileName ); - } - - if( err == KErrNotFound ) - { - // These errors are ignored - err = KErrNone; - } - - return err; - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupDataFileSectionReadStrategy::CMMCScBkupDataFileSectionReadStrategy() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupDataFileSectionReadStrategy::CMMCScBkupDataFileSectionReadStrategy(RFs& aFsSession) -: iFsSession(aFsSession) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataFileSectionReadStrategy::~CMMCScBkupDataFileSectionReadStrategy() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupDataFileSectionReadStrategy::~CMMCScBkupDataFileSectionReadStrategy() - { - delete iFileName; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataFileSectionReadStrategy::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataFileSectionReadStrategy::ConstructL(const TDesC& aName) - { - iFileName = aName.AllocL(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataFileSectionReadStrategy::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupDataFileSectionReadStrategy* CMMCScBkupDataFileSectionReadStrategy::NewL(const TDesC& aName, RFs& aFsSession) - { - CMMCScBkupDataFileSectionReadStrategy* self = new(ELeave) CMMCScBkupDataFileSectionReadStrategy(aFsSession); - CleanupStack::PushL(self); - self->ConstructL(aName); - CleanupStack::Pop(self); - return self; - } - - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataFileSectionReadStrategy::Read() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupDataFileSectionReadStrategy::Read(TDes8& aSink) - { - TInt error = KErrNone; - // - aSink.Zero(); - TInt amountToRead = (LengthToRead() - Offset()); - if (amountToRead > aSink.MaxLength()) - { - amountToRead = aSink.MaxLength(); - } - // - if (amountToRead > 0) - { - // Do the read - error = iFsSession.ReadFileSection( *iFileName, Offset(), aSink, amountToRead ); - if (error == KErrNone) - { - SetOffset( Offset() + aSink.Length() ); - } - } - return error; - } - - - - - - - - - - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupDriveAndOperationTypeManager.cpp --- a/filemanager/bkupengine/src/CMMCScBkupDriveAndOperationTypeManager.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,216 +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: CMMCScBkupDriveAndOperationTypeManager implementation -* -* -*/ - -#include "CMMCScBkupDriveAndOperationTypeManager.h" - -// User includes -#include "MMCScBkupLogger.h" -#ifdef RD_MULTIPLE_DRIVE -#include "BkupEngine.hrh" -#include -#include -#endif // RD_MULTIPLE_DRIVE - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveAndOperationTypeManager::CMMCScBkupDriveAndOperationTypeManager() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupDriveAndOperationTypeManager::CMMCScBkupDriveAndOperationTypeManager() - { - iCalculatedDriveList.SetMax(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveAndOperationTypeManager::CMMCScBkupDriveAndOperationTypeManager() -// -// C++ destructor. -// --------------------------------------------------------------------------- -EXPORT_C CMMCScBkupDriveAndOperationTypeManager::~CMMCScBkupDriveAndOperationTypeManager() - { - iEntries.Close(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveAndOperationTypeManager::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDriveAndOperationTypeManager::ConstructL( TResourceReader& aReader ) - { -#ifdef RD_MULTIPLE_DRIVE - RFs& fs( CCoeEnv::Static()->FsSession() ); - - // Get all user visible drives - TInt numDrives( 0 ); - TDriveList drvList; - User::LeaveIfError( DriveInfo::GetUserVisibleDrives( - fs, drvList, numDrives ) ); - TInt drvListLen( drvList.Length() ); - TMMCScBkupDriveAndOperationType op; - TInt count( aReader.ReadInt8() ); - - // Get default system drive - TInt sysDrive( 0 ); - User::LeaveIfError( DriveInfo::GetDefaultDrive( - DriveInfo::EDefaultSystem, sysDrive ) ); - - for( TInt i( 0 ); i < count; ++i ) - { - TUint drvCategories( aReader.ReadUint8() ); - TMMCScBkupOwnerDataType dataType( - static_cast< TMMCScBkupOwnerDataType >( aReader.ReadUint8() ) ); - - if ( drvCategories & EBkupDeviceMemories ) - { - // Default system drive is always backed up when - // device memories are defined - op.SetDrive( static_cast< TDriveNumber >( sysDrive ) ); - op.SetDataType( dataType ); - iEntries.AppendL( op ); - iCalculatedDriveList[ op.Drive() ] = ETrue; - } - - for ( TInt j( 0 ); j < drvListLen; ++j ) - { - if ( sysDrive != j && drvList[ j ] ) - { - // Check for other drives - TBool append( EFalse ); - TUint drvStatus( 0 ); - User::LeaveIfError( DriveInfo::GetDriveStatus( - fs, j, drvStatus ) ); - if ( ( drvCategories & EBkupDeviceMemories ) && - ( drvStatus & DriveInfo::EDriveInternal ) && - !( drvStatus & DriveInfo::EDriveExternallyMountable ) && - !( drvStatus & DriveInfo::EDriveReadOnly ) ) - { - append = ETrue; // Allow additional device memory - } - else if ( ( drvCategories & EBkupInternalMassStorages ) && - ( drvStatus & DriveInfo::EDriveInternal ) && - ( drvStatus & DriveInfo::EDriveExternallyMountable ) ) - { - append = ETrue; // Allow internal mass storage - } - else if ( ( drvCategories & EBkupExternalMassStorages ) && - ( drvStatus & DriveInfo::EDriveRemovable ) ) - { - append = ETrue; // Allow external mass storage - } - if ( append ) - { - op.SetDrive( static_cast< TDriveNumber >( j ) ); - op.SetDataType( dataType ); - iEntries.AppendL( op ); - iCalculatedDriveList[ op.Drive() ] = ETrue; - } - } - } - } -#else // RD_MULTIPLE_DRIVE - TMMCScBkupDriveAndOperationType op; - const TInt count = aReader.ReadInt8(); - // - for( TInt i=0; i( aReader.ReadInt8() ) ); - op.SetDataType( static_cast< TMMCScBkupOwnerDataType >( aReader.ReadInt8() ) ); - // - iEntries.AppendL( op ); - // - iCalculatedDriveList[ op.Drive() ] = ETrue; - } -#endif // RD_MULTIPLE_DRIVE - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveAndOperationTypeManager::NewL() -// -// -// --------------------------------------------------------------------------- -EXPORT_C CMMCScBkupDriveAndOperationTypeManager* CMMCScBkupDriveAndOperationTypeManager::NewL( TResourceReader& aReader ) - { - CMMCScBkupDriveAndOperationTypeManager* self = new(ELeave) CMMCScBkupDriveAndOperationTypeManager(); - CleanupStack::PushL( self ); - self->ConstructL( aReader ); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveAndOperationTypeManager::Count() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupDriveAndOperationTypeManager::Count() const - { - return iEntries.Count(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveAndOperationTypeManager::At() -// -// -// --------------------------------------------------------------------------- -const TMMCScBkupDriveAndOperationType& CMMCScBkupDriveAndOperationTypeManager::At( TInt aIndex ) const - { - return iEntries[ aIndex ]; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveAndOperationTypeManager::IsDataTypeAllowedToAccessDrive() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupDriveAndOperationTypeManager::IsDataTypeAllowedToAccessDrive( TDriveNumber aDrive, TMMCScBkupOwnerDataType aDataType ) const - { -// __LOG2("CMMCScBkupDriveAndOperationTypeManager::IsDataTypeAllowedToAccessDrive() - START - aDrive: %c, aDataType: %S", aDrive + 'A', &MMCScBkupLogger::DataType( aDataType )); - - TBool allowed = EFalse; - // - const TInt count = iEntries.Count(); - // - for( TInt i=0; iConstructL(); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSizer::NewLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupDriveSizer* CMMCScBkupDriveSizer::NewLC( RReadStream& aStream ) - { - CMMCScBkupDriveSizer* self = new(ELeave) CMMCScBkupDriveSizer( EMMCScBkupOwnerDataTypeAny ); - CleanupStack::PushL(self); - aStream >> *self; - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSizer::AddToSizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDriveSizer::AddToSizeL( TInt64 aAmount, TDriveNumber aDrive ) - { - TMMCScBkupDriveAndSize* entry = EntryByDrive( aDrive ); - // - if ( entry == NULL ) - { - if ( aAmount > 0 ) - { - TMMCScBkupDriveAndSize newEntry( aDrive, aAmount ); - iEntries.AppendL( newEntry ); - } - } - else - { - entry->AddToSize( aAmount ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSizer::Reset() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDriveSizer::Reset() - { - const TInt count = iEntries.Count(); - for( TInt i=0; iSetSize( 0 ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSizer::Size() -// -// -// --------------------------------------------------------------------------- -TInt64 CMMCScBkupDriveSizer::Size() const - { - TInt64 size = 0; - // - const TInt count = iEntries.Count(); - for( TInt i=0; i( this )->EntryByDrive( aDrive ); - // - if ( entry != NULL ) - { - size = entry->Size(); - } - // - return size; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSizer::InternalizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDriveSizer::InternalizeL(RReadStream& aStream) - { - aStream.ReadInt32L(); // EStreamFormatVersion1 - aStream.ReadInt32L(); // spare1 - aStream.ReadInt32L(); // spare2 - // - iDataType = static_cast< TMMCScBkupOwnerDataType >( aStream.ReadInt8L() ); - const TInt count = aStream.ReadInt8L(); - for( TInt i=0; i> entry; - iEntries.AppendL( entry ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSizer::ExternalizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDriveSizer::ExternalizeL(RWriteStream& aStream) const - { - aStream.WriteInt32L( EStreamFormatVersion1 ); - aStream.WriteInt32L( 0 ); // spare1 - aStream.WriteInt32L( 0 ); // spare2 - // - aStream.WriteInt8L( iDataType ); - - // Work out how many non-zero entries we need to write. - TInt i = 0; - const TInt count = iEntries.Count(); - TInt numberOfExternalisedEntries = 0; - // - for( i=0; i 0 ) - { - ++numberOfExternalisedEntries; - } - } - - // Now really write the entries... - aStream.WriteInt8L( numberOfExternalisedEntries ); - if ( numberOfExternalisedEntries > 0 ) - { - for( i=0; i 0 ) - { - aStream << entry; - } - } - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSizer::EntryByDrive() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupDriveAndSize* CMMCScBkupDriveSizer::EntryByDrive( TDriveNumber aDrive ) - { - TMMCScBkupDriveAndSize* ret = NULL; - // - const TInt count = iEntries.Count(); - for( TInt i=0; iConstructL(); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataTypeSizer::NewLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupDataTypeSizer* CMMCScBkupDataTypeSizer::NewLC( RReadStream& aStream ) - { - CMMCScBkupDataTypeSizer* self = new(ELeave) CMMCScBkupDataTypeSizer(); - CleanupStack::PushL(self); - aStream >> *self; - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataTypeSizer::AddToSizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataTypeSizer::AddToSizeL( TMMCScBkupOwnerDataType aDataType, TInt64 aAmount, TDriveNumber aDrive ) - { - CMMCScBkupDriveSizer* sizer = SizerByDataType( aDataType ); - ASSERT( sizer != NULL ); - sizer->AddToSizeL( aAmount, aDrive ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataTypeSizer::Reset() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataTypeSizer::Reset( TMMCScBkupOwnerDataType aDataType ) - { - CMMCScBkupDriveSizer* sizer = SizerByDataType( aDataType ); - ASSERT( sizer != NULL ); - sizer->Reset(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataTypeSizer::Reset() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataTypeSizer::Reset( TMMCScBkupOwnerDataType aDataType, TDriveNumber aDrive ) - { - CMMCScBkupDriveSizer* sizer = SizerByDataType( aDataType ); - ASSERT( sizer != NULL ); - sizer->Reset( aDrive ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataTypeSizer::Size() -// -// -// --------------------------------------------------------------------------- -TInt64 CMMCScBkupDataTypeSizer::Size( TMMCScBkupOwnerDataType aDataType ) const - { - CMMCScBkupDriveSizer* sizer = const_cast< CMMCScBkupDataTypeSizer* >( this )->SizerByDataType( aDataType ); - ASSERT( sizer != NULL ); - const TInt64 size = sizer->Size(); - return size; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataTypeSizer::Size() -// -// -// --------------------------------------------------------------------------- -TInt64 CMMCScBkupDataTypeSizer::Size( TMMCScBkupOwnerDataType aDataType, TDriveNumber aDrive ) const - { - CMMCScBkupDriveSizer* sizer = const_cast< CMMCScBkupDataTypeSizer* >( this )->SizerByDataType( aDataType ); - ASSERT( sizer != NULL ); - const TInt64 size = sizer->Size( aDrive ); - return size; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataTypeSizer::GetSizesL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataTypeSizer::GetSizesL( RArray& aSizes ) const - { - CleanupClosePushL( aSizes ); - aSizes.Reset(); - // - for( TInt d = EDriveA; d<=EDriveZ; d++ ) - { - // Get the size of each data type for this drive. - const TDriveNumber drive = static_cast< TDriveNumber >( d ); - TMMCScBkupDriveAndSize driveAndSize( drive, 0 ); - - const TInt count = iSizers.Count(); - for( TInt i=0; iSize( drive ); - // - driveAndSize.AddToSize( sizeOfDataForDrive ); - } - - // Add the entry if the size is more than 0 - if ( driveAndSize.Size() > 0 ) - { - aSizes.AppendL( driveAndSize ); - } - } - CleanupStack::Pop( &aSizes ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataTypeSizer::CombinedSize() -// -// -// --------------------------------------------------------------------------- -TInt64 CMMCScBkupDataTypeSizer::CombinedSize( TDriveNumber aDrive ) const - { - TInt64 size = 0; - // - const TInt count = iSizers.Count(); - for( TInt i=0; iSize( aDrive ); - } - // - return size; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDataTypeSizer::InternalizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDataTypeSizer::InternalizeL(RReadStream& aStream) - { - aStream.ReadInt32L(); // EStreamFormatVersion1 - aStream.ReadInt32L(); // spare1 - aStream.ReadInt32L(); // spare2 - // - const TInt count = aStream.ReadInt8L(); - for( TInt i=0; iDataType() == aDataType ) - { - ret = sizer; - break; - } - } - // - return ret; - } - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupDriveSpecificRequest.cpp --- a/filemanager/bkupengine/src/CMMCScBkupDriveSpecificRequest.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupDriveSpecificRequest implementation -* -* -*/ - -#include "CMMCScBkupDriveSpecificRequest.h" - -// User includes -#include "CMMCScBkupDriveAndOperationTypeManager.h" - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSpecificRequest::CMMCScBkupDriveSpecificRequest() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupDriveSpecificRequest::CMMCScBkupDriveSpecificRequest( const CMMCScBkupDriveAndOperationTypeManager& aDriveAndOperations, TMMCScBkupOwnerDataType aDataType, CActive::TPriority aPriority ) -: CActive(aPriority), iDriveAndOperations(aDriveAndOperations), iDataType( aDataType ) - { - CActiveScheduler::Add(this); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSpecificRequest::~CMMCScBkupDriveSpecificRequest() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupDriveSpecificRequest::~CMMCScBkupDriveSpecificRequest( ) - { - Cancel(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSpecificRequest::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDriveSpecificRequest::ConstructL( ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSpecificRequest::RequestL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDriveSpecificRequest::RequestL( TRequestStatus& aObserver ) - { - // Set to -1 so that when RunL is called, the next drive will be calculated - // as 0 == EDriveA - iCurrentDrive = -1; - iObserver = &aObserver; - *iObserver = KRequestPending; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSpecificRequest::NextValidDrive() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupDriveSpecificRequest::NextValidDrive(TDriveNumber& aDrive) - { - // If we've already reached Z then there isn't any sense in continuing - // as all drives have been processed. - TBool driveAvailable = EFalse; - - // Keep checking drives until we go past Z - while( ++iCurrentDrive <= EDriveZ ) - { - if ( iDriveAndOperations.DriveList()[ iCurrentDrive ] != 0 ) - { - const TDriveNumber drive = static_cast< TDriveNumber >( iCurrentDrive ); - - // Drive is allowable according to master list. - // But is this data type allowed to access that drive? - if ( iDataType == EMMCScBkupOwnerDataTypeAny ) - { - // Found an available drive - data type filtering is not in play... - aDrive = drive; - driveAvailable = ETrue; - break; - } - else if ( iDriveAndOperations.IsDataTypeAllowedToAccessDrive( drive, iDataType ) ) - { - // Found an available drive - this data type is allowed to access that drive... - aDrive = drive; - driveAvailable = ETrue; - break; - } - } - } - // - return driveAvailable; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSpecificRequest::NextValidDrive() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupDriveSpecificRequest::NextValidDrive(TDriveNumber& aDrive, const TDriveList& aCrossCheckList) - { - TDriveNumber drive; - TBool driveAvailable = NextValidDrive(drive); - - while(driveAvailable) - { - // Check if aCrossCheckList also supports the same drive - if (aCrossCheckList[drive] != 0) - { - aDrive = drive; - break; - } - else - { - // Try another drive from our master list - driveAvailable = NextValidDrive(drive); - } - } - // - return driveAvailable; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSpecificRequest::CurrentDrive() -// -// -// --------------------------------------------------------------------------- -TDriveNumber CMMCScBkupDriveSpecificRequest::CurrentDrive() const - { - return static_cast(iCurrentDrive); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSpecificRequest::DoCancel() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDriveSpecificRequest::DoCancel() - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSpecificRequest::RunError() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupDriveSpecificRequest::RunError(TInt aError) - { -#ifdef MMCSCBKUP_USE_BREAKPOINTS - __BREAKPOINT(); -#endif - // - CompleteObserverRequest(aError); - return KErrNone; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSpecificRequest::CompleteObserverRequest() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDriveSpecificRequest::CompleteObserverRequest(TInt aCompletionCode) - { - __ASSERT_ALWAYS(iObserver != NULL, User::Invariant()); - User::RequestComplete(iObserver, aCompletionCode); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupDriveSpecificRequest::CompleteSelf() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupDriveSpecificRequest::CompleteSelf(TInt aCompletionCode) - { - SetActive(); - TRequestStatus* status = &iStatus; - User::RequestComplete(status, aCompletionCode); - } - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupEngine.cpp --- a/filemanager/bkupengine/src/CMMCScBkupEngine.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CMMCScBkupEngine implementation -* -* -*/ - -#include "CMMCScBkupEngine.h" - -// User includes -#include "CMMCScBkupEngineImpl.h" - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupEngine::CMMCScBkupEngine() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupEngine::CMMCScBkupEngine() - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngine::~CMMCScBkupEngine() -// -// Destructor. -// --------------------------------------------------------------------------- -EXPORT_C CMMCScBkupEngine::~CMMCScBkupEngine() - { - delete iEngine; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngine::ConstructL() -// -// Second phase constructor -// --------------------------------------------------------------------------- -void CMMCScBkupEngine::ConstructL( RFs& aFsSession ) - { - iEngine = CMMCScBkupEngineImpl::NewL( aFsSession ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngine::NewL() -// -// Static constructor -// --------------------------------------------------------------------------- -EXPORT_C CMMCScBkupEngine* CMMCScBkupEngine::NewL( RFs& aFsSession ) - { - CMMCScBkupEngine* self = new(ELeave) CMMCScBkupEngine(); - CleanupStack::PushL( self ); - self->ConstructL( aFsSession ); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngine::StartOperationL() -// -// -// --------------------------------------------------------------------------- -EXPORT_C void CMMCScBkupEngine::StartOperationL(TMMCScBkupOperationType aOperation, MMMCScBkupEngineObserver& aObserver, CMMCScBkupOpParamsBase* aParams) - { - TRAPD(err, iEngine->StartOperationL( aOperation, aObserver, aParams )); - - if(err != KErrNone) - { - TRAP_IGNORE( aObserver.HandleBkupEngineEventL( MMMCScBkupEngineObserver::ECommonOperationError, err) ); - TRAP_IGNORE( aObserver.HandleBkupEngineEventL( MMMCScBkupEngineObserver::ECommonOperationEnded, err) ); - // Call cleanup externally, because engine cannot be yet in active state and resources remain unfreed - iEngine->CleanupL(KErrCancel); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngine::CancelOperation() -// -// -// --------------------------------------------------------------------------- -EXPORT_C void CMMCScBkupEngine::CancelOperation() - { - iEngine->Cancel(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngine::ValidArchiveForRestore() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TBool CMMCScBkupEngine::ValidArchiveForRestore( const TDesC& aFileName ) - { - TBool archiveOkay = EFalse; - // - TRAPD(err, archiveOkay = iEngine->ValidArchiveForRestoreL( aFileName ) ); - if ( err != KErrNone ) - { - archiveOkay = EFalse; - } - // - return archiveOkay; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngine::TotalOperationSizeL() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TInt64 CMMCScBkupEngine::TotalOperationSizeL() const - { - return iEngine->TotalOperationSizeL(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngine::RebootRequired() -// -// NOTE: This method is not used in S60 3.x - Sysap handles the reboot -// --------------------------------------------------------------------------- -EXPORT_C TBool CMMCScBkupEngine::RebootRequired() const - { - return iEngine->RebootRequired(); - } - -// --------------------------------------------------------------------------- -// CMMCScBkupEngine::ListArchivesL() -// -// Provide a list of archives available on all drives -// --------------------------------------------------------------------------- -EXPORT_C void CMMCScBkupEngine::ListArchivesL( - RPointerArray< CMMCScBkupArchiveInfo >& aArchives, - CMMCScBkupOpParamsBase* aParams, - const TUint32 aDriveAttMatch, - const TInt aDriveMatch ) const - { - return iEngine->ListArchivesL( - aArchives, aParams, aDriveAttMatch, aDriveMatch ); - } diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupEngineImpl.cpp --- a/filemanager/bkupengine/src/CMMCScBkupEngineImpl.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1204 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CMMCScBkupEngineImpl implementation -* -* -*/ - -#include "CMMCScBkupEngineImpl.h" - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupState.h" -#include "MMCScBkupSBEUtils.h" -#include "CMMCScBkupArchive.h" -#include "MMCScBkupOperations.h" -#include "MMCScBkupArchiveUtils.h" -#include "CMMCScBkupStateFactory.h" -#include "MMCScBkupPhoneModelUtils.h" -#include "MMMCScBkupEngineObserver.h" -#include "CMMCScBkupFileListCollection.h" -#include "CMMCScBkupDataOwnerCollection.h" -#include "CMMCScBkupOperationParameters.h" -#include "CMMCScBkupArchiveInfo.h" -#include "BkupEngine.hrh" -#include - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::CMMCScBkupEngineImpl() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupEngineImpl::CMMCScBkupEngineImpl( RFs& aFsSession ) -: CActive( CActive::EPriorityIdle ), - iFsSession(aFsSession), - iCurrentArchive(0), - iTotalProgress(0), - iActiveDataProcessingOngoing(EFalse) - { - CActiveScheduler::Add(this); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::~CMMCScBkupEngineImpl() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupEngineImpl::~CMMCScBkupEngineImpl() - { - Cancel(); - // - TRAP_IGNORE(CleanupL()); - - iArchives.Close(); - iDataOwners.Close(); - iFileLists.Close(); - delete iSBEClient; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::ConstructL() -// -// Second phase constructor -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::ConstructL() - { - __LOG("CMMCScBkupEngineImpl::ConstructL() - START"); - -#ifdef MAKE_SBE_LOGGING_DIRECTORY - _LIT( KSBELoggingDir, "C:\\Logs\\connect\\" ); - iFsSession.MkDirAll( KSBELoggingDir ); -#endif -#ifdef MAKE_MMCSCBKUP_LOGGING_DIRECTORY - iFsSession.MkDirAll( KMMCScBkupLoggingFullPath ); -#endif - - __LOG("CMMCScBkupEngineImpl::ConstructL() - END"); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::NewL() -// -// Static constructor -// --------------------------------------------------------------------------- -CMMCScBkupEngineImpl* CMMCScBkupEngineImpl::NewL( RFs& aFsSession ) - { - CMMCScBkupEngineImpl* self = new(ELeave) CMMCScBkupEngineImpl( aFsSession ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::StartOperationL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::StartOperationL(TMMCScBkupOperationType aOperation, MMMCScBkupEngineObserver& aObserver, CMMCScBkupOpParamsBase* aParams) - { - __ASSERT_DEBUG(DrvOperation() == EMMCScBkupOperationTypeIdle, User::Invariant()); // - - // Setup our observer - we will report progress via this interface - iObserver = &aObserver; - - // Take ownership of the parameters immediately - SetParameters(aParams); - - if(!iSBEClient) - { - __LOG("CMMCScBkupEngineImpl::ConstructL() - creating SBE client..."); - iSBEClient = CSBEClient::NewL(); - } - -#if defined(__MMCSCBKUPLOGGING_ENABLED__) - // Create a logging directory for logging purposes and empty contents - // in order to have the log only from last backup or restore operation - CFileMan* fileMan = CFileMan::NewL( iFsSession ); - CleanupStack::PushL( fileMan ); - TParse* path = new(ELeave) TParse(); - - CleanupStack::PushL(path); - path->Set(KMMCScBkupLoggingFullPathAndName, NULL, NULL); - fileMan->Delete( path->Path(), CFileMan::ERecurse ); // Ignore error - iFsSession.MkDirAll( path->Path() ); - - CleanupStack::PopAndDestroy(2, fileMan ); -#endif - - // Prepare supporting objects - PrepareObjectsL(); - - // Work out what to do... - CreateFactoryL( aOperation ); - // - switch(aOperation) - { - case EMMCScBkupOperationTypeIdle: - __ASSERT_ALWAYS(EFalse, User::Invariant()); - break; - case EMMCScBkupOperationTypeFullBackup: - case EMMCScBkupOperationTypePartialBackup: - PrepareForBackupL( DrvOperation() == EMMCScBkupOperationTypePartialBackup ); - break; - case EMMCScBkupOperationTypeFullRestore: - case EMMCScBkupOperationTypePartialRestore: - PrepareForRestoreL( DrvOperation() == EMMCScBkupOperationTypePartialRestore ); - break; - } - - // Do this last, after everything that can leave has been executed - iOperationType = aOperation; - - // Notify the observer we're starting up - NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationStarting); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::ValidArchiveForRestoreL() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupEngineImpl::ValidArchiveForRestoreL( const TDesC& aFileName ) - { - const TBool valid = CMMCScBkupArchive::ValidArchiveForRestoreL( iFsSession, aFileName ); - return valid; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::TotalOperationSizeL() -// -// -// --------------------------------------------------------------------------- -TInt64 CMMCScBkupEngineImpl::TotalOperationSizeL() const - { - const TInt64 size = iDataOwners[iCurrentArchive]->TotalOperationalSizeL(); - return size; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::RebootRequired() -// -// NOTE: This method is not used in S60 3.x - Sysap handles the reboot -// --------------------------------------------------------------------------- -TBool CMMCScBkupEngineImpl::RebootRequired() const - { - // Criteria for a reboot are: - // - // 1) One or more data owners indicate that a reboot is necessary - // via their backup_registration.xml files. - // - // 2) The current operation is some form of restore (partial or full). - - const TMMCScBkupOperationType currentOp = DrvOperation(); - __LOG1("CMMCScBkupEngineImpl::RebootRequired() - operation type is: %d", currentOp); - - TBool singleDataOwnerNeedsReboot = EFalse; - - for(TInt i = 0; i < iDataOwners.Count(); i++) - { - singleDataOwnerNeedsReboot |= iDataOwners[i]->RebootRequired(); - } - - __LOG1("CMMCScBkupEngineImpl::RebootRequired() - D.O requires reboot?: %d", singleDataOwnerNeedsReboot); - - const TBool rebootRequired = singleDataOwnerNeedsReboot && - ( currentOp == EMMCScBkupOperationTypeFullRestore || - currentOp == EMMCScBkupOperationTypePartialRestore ); - __LOG1("CMMCScBkupEngineImpl::RebootRequired() - final rebootRequired value: %d", rebootRequired); - - // We return the value to the caller - the UI will display appropriate - // UI dialogs and reset the machine as appropriate. - return rebootRequired; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::DrvADI() -// -// -// --------------------------------------------------------------------------- -MMMCScBkupArchiveDataInterface& CMMCScBkupEngineImpl::DrvADI() const - { - return iArchives[iCurrentArchive]->ADI(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::DrvArchive() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupArchive& CMMCScBkupEngineImpl::DrvArchive() const - { - __ASSERT_ALWAYS(iCurrentArchive < iArchives.Count(), User::Invariant()); - - return *iArchives[iCurrentArchive]; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::DrvSecureBackupClient() -// -// -// --------------------------------------------------------------------------- -CSBEClient& CMMCScBkupEngineImpl::DrvSecureBackupClient() const - { - return *iSBEClient; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::DrvOperation() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupOperationType CMMCScBkupEngineImpl::DrvOperation() const - { - return iOperationType; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::DrvParamsBase() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupOpParamsBase& CMMCScBkupEngineImpl::DrvParamsBase() const - { - return *iParameters; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::DrvDataOwners() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupDataOwnerCollection& CMMCScBkupEngineImpl::DrvDataOwners() const - { - __ASSERT_ALWAYS(iCurrentArchive < iDataOwners.Count(), User::Invariant()); - - return *iDataOwners[iCurrentArchive]; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::DrvDataOwnersAll() -// -// -// --------------------------------------------------------------------------- -RPointerArray& CMMCScBkupEngineImpl::DrvDataOwnersAll() - { - return iDataOwners; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::DrvFileList() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupFileListCollection& CMMCScBkupEngineImpl::DrvFileList() const - { - __ASSERT_ALWAYS(iCurrentArchive < iFileLists.Count(), User::Invariant()); - - return *iFileLists[iCurrentArchive]; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::DrvLastCategory() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupEngineImpl::DrvLastCategory() const - { - return ( (iCurrentArchive + 1) == iArchives.Count() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::DrvStoreTotalProgress() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::DrvStoreTotalProgress(TInt64 aProgress) - { - iTotalProgress += aProgress; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::DrvTotalProgress() -// -// -// --------------------------------------------------------------------------- -TInt64 CMMCScBkupEngineImpl::DrvTotalProgress() const - { - return iTotalProgress; - } - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::DrvProgressHandler() -// -// -// --------------------------------------------------------------------------- -MMMCScBkupProgressObserver& CMMCScBkupEngineImpl::DrvProgressHandler() const - { - CMMCScBkupEngineImpl* self = const_cast< CMMCScBkupEngineImpl* > (this); - return *self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::MMCScBkupHandleProgress() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::MMCScBkupHandleProgress( TInt aAmountCompleted ) - { - __ASSERT_ALWAYS( aAmountCompleted >= 0, User::Invariant() ); - if (aAmountCompleted > 0) - { - __LOG1("CMMCScBkupEngineImpl::MMCScBkupHandleProgress() - amount: %d", aAmountCompleted); - iCumulativeProgress += aAmountCompleted; - - // Notify the observer that we've calculated the operational size - NotifyObserver( MMMCScBkupEngineObserver::ECommonProgress, iCumulativeProgress ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::MMCScBkupHandleProgressDomainUnderstood() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::MMCScBkupHandleProgressDomainUnderstood( TInt aTotalProgressAmount ) - { - __LOG1("CMMCScBkupEngineImpl::MMCScBkupHandleProgressDomainUnderstood() - ##### TOTAL PROGRESS AMOUNT IS: %d", aTotalProgressAmount); - - // Notify the observer that we've calculated the operational size - NotifyObserver( MMMCScBkupEngineObserver::ECommonSizeOfTaskUnderstood, aTotalProgressAmount ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::MMCScBkupHandleFreeSpace() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupEngineImpl::MMCScBkupHandleFreeSpace( TInt aPercentualFree ) - { - TInt error(KErrNone); - - TRAP_IGNORE( error = iObserver->HandleBkupEngineEventL( MMMCScBkupEngineObserver::EBackupAnalysingData, aPercentualFree ) ); - - return error; - } - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::MMCScBkupStartBackuping() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::MMCScBkupStartBackuping( TBool aProceed ) - { - __LOG1("CMMCScBkupEngineImpl::MMCScBkupStartBackuping() - Disk space validation done, proceed %d", aProceed); - - if( !aProceed ) - { - // If there is no space to carry out backup, "restore" existing backup file, - // so that it can still be restored. - for(TInt i = 0; i < iArchives.Count(); i++) - { - iArchives[i]->RestoreOldArchive( ); - } - } - else - { - // Clean up existing backup files. - for(TInt i = 0; i < iArchives.Count(); i++) - { - iArchives[i]->DeleteOldArchive( ); - } - } - } - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::RunL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::RunL() - { - __LOG(" "); - __LOG(" "); - if ( !CurrentStateAvailable() ) - { - __LOG2("CMMCScBkupEngineImpl::RunL() - START - iStatus: %d, iCurrentArchive %d", - iStatus.Int(), iCurrentArchive); - } - else - { - __LOG3("CMMCScBkupEngineImpl::RunL() - START - iStatus: %d, state: 0x%08x, iCurrentArchive %d", - iStatus.Int(), CurrentState().StateId().iUid, iCurrentArchive); - } - - User::LeaveIfError(iStatus.Int()); - - // Get the state that just finished - its always the head item - const TBool stateStepAvailable = CurrentStateAvailable(); - __ASSERT_ALWAYS(stateStepAvailable, User::Invariant()); - CMMCScBkupState& currentState = CurrentState(); - - // Store completed state id as we're about to delete the object - // so it won't be available afterwards... - const TMMCScBkupStateId completedState = currentState.StateId(); - - // Identify which state should run next. In effect each state - // defines the overall state machine. This is required since - // some states need to dynamically change which state is executed - // next. A good example is the archive op for active data - when - // one or more active data clients are not ready, then the next - // state should be to requery their readyness. After their - // readyness has been ascertained, then any DO's that have now - // become ready should be archived. This process continues - // until all Active Data owners have provided all their data. - TMMCScBkupStateId nextState; - - __LOG3("CMMCScBkupEngineImpl::RunL() - iActiveDataProcessingOngoing %d, completedState 0x%08x, nextState 0x%08x", - iActiveDataProcessingOngoing, completedState.iUid, currentState.NextStateId().iUid); - - // Identify should we run current state again, i.e. run that state - // for next category. If state does not require processing of same - // state several times, then move on to next state. - if( currentState.CategorySpecific() != CMMCScBkupState::EStateOnce ) - { - // For simplicity let's collect active data for each category in row. - // This means checking data owner status before proceeding to next category. - if( iActiveDataProcessingOngoing ) - { - iActiveDataProcessingOngoing = EFalse; - nextState = currentState.NextStateId(); - } - else - { - if( completedState == KMMCScBkupStateIdArchiveOpActiveData ) - { - if( currentState.NextStateId() == KMMCScBkupStateIdGetDataOwnerStatuses ) - { - // There is still some active data to be processed - iActiveDataProcessingOngoing = ETrue; - nextState = KMMCScBkupStateIdGetDataOwnerStatuses; - } - } - - if( !iActiveDataProcessingOngoing ) - { - if( ++iCurrentArchive < iArchives.Count() ) - { - nextState = completedState; - } - else - { - iCurrentArchive = 0; - nextState = currentState.NextStateId(); - } - } - } - } - else - { - iCurrentArchive = 0; - nextState = currentState.NextStateId(); - } - - if(nextState == completedState && currentState.CategorySpecific() == CMMCScBkupState::EStatePerCategoryCommon) - { - __LOG2("CMMCScBkupEngineImpl::RunL() - object not recreated for state: 0x%08x, iCurrentArchive %d", - nextState.iUid, iCurrentArchive); - } - else - { - // Remove the completed state (destroys 'currentState') - DestroyCurrentState(); - // Identify the next state. Causes RunL to be called when the state - // has finished executing - __LOG2("CMMCScBkupEngineImpl::RunL() - preparing state: 0x%08x, iCurrentArchive %d", - nextState.iUid, iCurrentArchive); - - PrepareNextStateL( nextState ); - } - - if (CurrentStateAvailable()) - { -#if defined(__MMCSCBKUPLOGGING_ENABLED__) - CMMCScBkupState& newState = CurrentState(); - if( newState.CategorySpecific() != CMMCScBkupState::EStateOnce ) - { - __LOG2("CMMCScBkupEngineImpl::RunL() - executing category specific state: 0x%08x for category 0x%x", - nextState.iUid, iArchives[iCurrentArchive]->Category().iFlags); - } - else - { - __LOG1("CMMCScBkupEngineImpl::RunL() - executing non category specific state: 0x%08x", nextState.iUid); - } -#endif - ExecuteStateL(); - } - else - { - if ( iSBEClient ) - { - MMCScBkupSBEUtils::EndBackupOrRestoreL( *iSBEClient ); - } - // Signal we are about to finish, so that bkupchecker can be notified. - NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationPrepareEnded); - // We've finished - CleanupL(); - NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationEnded); - // Remove observer - iObserver = NULL; - } - - __LOG3("CMMCScBkupEngineImpl::RunL() - END - nextState: 0x%08x, isActive: %d, iStatus: %d", nextState.iUid, IsActive(), iStatus.Int()); - __LOG(" "); - __LOG(" "); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::DoCancel() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::DoCancel() - { - __LOG("CMMCScBkupEngineImpl::DoCancel() - START"); - - if (CurrentStateAvailable()) - { - __LOG1("CMMCScBkupEngineImpl::DoCancel() - current state is: 0x%08x", CurrentState().StateId().iUid); - - // Our request should be completed by the state - CurrentState().Cancel(); - } - - // Signal we are about to finish, so that bkupchecker can be notified. - NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationPrepareEnded); - // Cleanup - TRAP_IGNORE( CleanupL( KErrCancel ) ); - - // Ensure observer is informed - NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationError, KErrCancel); - NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationEnded, KErrCancel); - // Remove observer - iObserver = NULL; - - __LOG("CMMCScBkupEngineImpl::DoCancel() - END"); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::RunError() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupEngineImpl::RunError(TInt aError) - { - __LOG1("CMMCScBkupEngineImpl::RunError() - START - aError: %d", aError); - - // Inform observer of error - NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationError, aError); - // Signal we are about to finish, so that bkupchecker can be notified. - NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationPrepareEnded); - // Cleanup - TRAP_IGNORE( CleanupL( aError ) ); - - // Finalize observer - NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationEnded, aError); - // Remove observer - iObserver = NULL; - - // Return KErrNone to stop the scheduler from panicking our thread - - __LOG("CMMCScBkupEngineImpl::RunError() - END"); - return KErrNone; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::CompleteOwnRequest() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::CompleteOwnRequest(TInt aCompletionCode, TBool aSetActive) - { - if (aSetActive) - { - SetActive(); - } - // - TRequestStatus* status = &iStatus; - User::RequestComplete(status, aCompletionCode); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::NotifyObserver() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::NotifyObserver( MMMCScBkupEngineObserver::TEvent aEvent, TInt aAssociatedData ) - { - if ( iObserver ) - { - TRAP_IGNORE( iObserver->HandleBkupEngineEventL( aEvent, aAssociatedData ) ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::PrepareForBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::PrepareForBackupL( TBool aPartial ) - { -#ifdef DEBUGGING_DATA_TRANSFER - CleanBackupFilesL(); -#endif - - // Open the archives for writing - for(TInt i = 0; i < iArchives.Count(); i++) - { - const TPtrC pArchiveName( DrvParamsBase().FileName(i) ); - iArchives[i]->OpenForWritingL( pArchiveName ); - } - - // Initialise our state model - if ( !aPartial ) - { - // Starting a FULL BACKUP - PrepareNextStateL( KMMCScBkupStateArchiveOpArchiveHeader ); - ExecuteStateL(); - } - else - { - User::Leave( KErrNotSupported ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::PrepareForRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::PrepareForRestoreL( TBool aPartial ) - { -#ifdef DEBUGGING_DATA_TRANSFER - ClearRestoreFilesL(); -#endif - - // Open the archives for reading - for(TInt i = 0; i < iArchives.Count(); i++) - { - const TPtrC pArchiveName( DrvParamsBase().FileName(i) ); - iArchives[i]->OpenForReadingL( pArchiveName ); - -#ifdef RD_FILE_MANAGER_BACKUP - // Validate archive content is not altered -#if defined(__MMCSCBKUPLOGGING_ENABLED__) - TUint32 startTime = User::NTickCount(); -#endif - TInt validArchiveForRestore = MMCScBkupArchiveUtils::ValidateArchiveCrcsL( iFsSession, pArchiveName ); -#if defined(__MMCSCBKUPLOGGING_ENABLED__) - __LOG2("CMMCScBkupEngineImpl::PrepareForRestoreL - crcs validation result %d, ticks in ms %u", - validArchiveForRestore, User::NTickCount() - startTime); -#endif - if(validArchiveForRestore == EFalse) - { - User::Leave(KErrCorrupt); - } -#endif - } - - // Initialise our state model - if ( !aPartial ) - { - // Starting a FULL RESTORE - PrepareNextStateL( KMMCScBkupStateArchiveOpArchiveHeader ); - ExecuteStateL(); - } - else - { - User::Leave( KErrNotSupported ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::SetParameters() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::SetParameters(CMMCScBkupOpParamsBase* aParameters) - { - __ASSERT_ALWAYS(aParameters != NULL, User::Invariant()); - // - delete iParameters; - iParameters = aParameters; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::CreateFactoryL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::CreateFactoryL(TMMCScBkupOperationType aOperation) - { - __ASSERT_DEBUG(iFactory == NULL, User::Invariant()); - // - CMMCScBkupStateFactory* factory = CMMCScBkupStateFactory::FactoryByOperationTypeLC(aOperation); - delete iFactory; - iFactory = factory; - CleanupStack::Pop( factory ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::CurrentStateAvailable() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupEngineImpl::CurrentStateAvailable() const - { - return (iCurrentState != NULL); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::CurrentStateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupEngineImpl::CurrentStateId() const - { - __ASSERT_ALWAYS(CurrentStateAvailable(), User::Invariant()); - return CurrentState().StateId(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::CurrentState() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupState& CMMCScBkupEngineImpl::CurrentState() - { - return *iCurrentState; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::CurrentState() -// -// -// --------------------------------------------------------------------------- -const CMMCScBkupState& CMMCScBkupEngineImpl::CurrentState() const - { - return *iCurrentState; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::PrepareNextStateL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::PrepareNextStateL( TMMCScBkupStateId aNextState ) - { - if ( aNextState != KMMCScBkupStateIdOperationComplete ) - { - CMMCScBkupState* nextState = iFactory->GetStateLC( aNextState, *this ); - delete iCurrentState; - iCurrentState = nextState; - CleanupStack::Pop( nextState ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::DestroyCurrentState() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::DestroyCurrentState() - { - delete iCurrentState; - iCurrentState = NULL; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::ExecuteStateL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::ExecuteStateL() - { - const TBool stateStepAvailable = CurrentStateAvailable(); - __ASSERT_ALWAYS(stateStepAvailable, User::Invariant()); - // - CMMCScBkupState& currentState = CurrentState(); - // - currentState.ExecuteL(iStatus); - SetActive(); - - // RunL will now be called when the state has completed execution - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::CleanupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::CleanupL( TInt aError ) - { - __LOG1("CMMCScBkupEngineImpl::CleanupL() - START - aError: %d", aError); - - // If SBE died, then recreate - if ( aError == KErrServerTerminated ) - { - __LOG("CMMCScBkupEngineImpl::CleanupL() - assuming SBE panicked - re-creating SBE session..."); - CSBEClient* newSBEClient = CSBEClient::NewL(); - delete iSBEClient; - iSBEClient = newSBEClient; - } - - - __LOG("CMMCScBkupEngineImpl::CleanupL() - destroying current state..."); - DestroyCurrentState(); - - const TBool backupOrRestoreUnderway = MMCScBkupSBEUtils::PhoneIsInBackupOrRestoreModeL(); - __LOG1("CMMCScBkupEngineImpl::CleanupL() - backupOrRestoreUnderway: %d", backupOrRestoreUnderway); - if ( backupOrRestoreUnderway && iSBEClient ) - { - // Must end backup or restore - __LOG("CMMCScBkupEngineImpl::CleanupL() - ending backup or restore..."); - MMCScBkupSBEUtils::EndBackupOrRestoreL( *iSBEClient ); - } - - // Ensure the archive is closed - if ( iArchives.Count() ) - { - __LOG("CMMCScBkupEngineImpl::CleanupL() - closing archives..."); - for(TInt i = 0; i < iArchives.Count(); i++) - { - iArchives[i]->Close( aError ); - } - - __LOG("CMMCScBkupEngineImpl::CleanupL() - reseting archive array..."); - iArchives.ResetAndDestroy(); - } - - // Destroy old parameters - __LOG("CMMCScBkupEngineImpl::CleanupL() - destroying parameters..."); - delete iParameters; - iParameters = NULL; - - // Set back to idle - __LOG("CMMCScBkupEngineImpl::CleanupL() - setting operation status to idle..."); - iOperationType = EMMCScBkupOperationTypeIdle; - - // Dispose of our collections - __LOG("CMMCScBkupEngineImpl::CleanupL() - destroying data owners and file lists..."); - iDataOwners.ResetAndDestroy(); - iFileLists.ResetAndDestroy(); - - // Dispose of state factory - __LOG("CMMCScBkupEngineImpl::CleanupL() - destroying factory..."); - delete iFactory; - iFactory = NULL; - - // Reset progress - iCumulativeProgress = 0; - - // Reduce memory consumption by deleting SBE client. Session will be closed - // and SBE frees reserved (e.g. 128 kB...) memory pool. - if(iSBEClient) - { - __LOG("CMMCScBkupEngineImpl::CleanupL() - deleting SBE client..."); - delete iSBEClient; - iSBEClient = NULL; - } - - __LOG("CMMCScBkupEngineImpl::CleanupL() - END"); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::PrepareObjectsL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::PrepareObjectsL() - { - __LOG("CMMCScBkupEngineImpl::PrepareObjectsL() - creating objects..."); - - iTotalProgress = 0; - iCurrentArchive = 0; - - const RMMCScBkupPointerArray& archives = DrvParamsBase().ArchiveInfos(); - TInt count = archives.Count(); - - if(count == 0) - { - __LOG("CMMCScBkupEngineImpl::PrepareObjectsL() - nothing to be done, leaving..."); - User::Leave(KErrCancel); - } - - for(TInt i = 0; i < count; i++) - { - CMMCScBkupArchive* archive; - archive = CMMCScBkupArchive::NewL( iFsSession, DrvProgressHandler(), *this, archives[i]->Category() ); - CleanupStack::PushL( archive ); - iArchives.AppendL( archive ); - CleanupStack::Pop( archive ); - - CMMCScBkupDataOwnerCollection* dataOwners; - dataOwners = CMMCScBkupDataOwnerCollection::NewL( *this, archives[i]->Category() ); - CleanupStack::PushL( dataOwners ); - iDataOwners.AppendL( dataOwners ); - CleanupStack::Pop( dataOwners ); - - CMMCScBkupFileListCollection* fileList; - fileList = CMMCScBkupFileListCollection::NewL( archives[i]->Category(), iFsSession ); - CleanupStack::PushL( fileList ); - iFileLists.AppendL( fileList ); - CleanupStack::Pop( fileList ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::ResetAndDestroyArchives -// --------------------------------------------------------------------------- -// -void CMMCScBkupEngineImpl::ResetAndDestroyArchives( TAny* aPtr ) - { - RPointerArray< CMMCScBkupArchiveInfo >* archive = - static_cast< RPointerArray< CMMCScBkupArchiveInfo >* >( aPtr ); - archive->ResetAndDestroy(); - archive->Close(); - } - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::ListArchivesL() -// -// Provide a list of valid (both content and category do match) archives -// available on all drives' backup folder -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::ListArchivesL( - RPointerArray< CMMCScBkupArchiveInfo >& aArchives, - CMMCScBkupOpParamsBase* aParams, - const TUint32 aDriveAttMatch, - const TInt aDriveMatch ) - { - __LOG("CMMCScBkupEngineImpl::ListArchivesL() - START"); - - TCleanupItem cleanupItem( ResetAndDestroyArchives, &aArchives ); - CleanupStack::PushL( cleanupItem ); - - for(TInt i = 0; i < KMaxDrives; i++) - { - // Check is drive number allowed - if ( aDriveMatch != KErrNotFound && aDriveMatch != i ) - { - continue; - } - // Check are drive attributes allowed - TBool supported( EFalse ); - TDriveInfo driveInfo; - if ( iFsSession.Drive( driveInfo, i ) == KErrNone ) - { - if ( driveInfo.iDriveAtt & aDriveAttMatch ) - { - supported = ETrue; - } - } - if ( !supported ) - { - continue; - } - - const TDriveUnit driveUnit(i); - const TDriveName driveName(driveUnit.Name()); - CDir* pFiles = NULL; - TFileName path; - path.Append(driveName); - path.Append(KBackUpFolder()); - path.Append(KBackUpFiles()); - - // Scan for all archives - iFsSession.GetDir(path, KEntryAttMatchMask, ESortNone, pFiles); - CleanupStack::PushL(pFiles); - - if(pFiles) - { - TInt count = pFiles->Count(); - for (TInt x = 0; x < count; x++) - { - const TEntry& entryPtr = (*pFiles)[x]; - TEntry entry(entryPtr); - TFileName pathAndFile; - pathAndFile.Append(driveName); - pathAndFile.Append(KBackUpFolder()); - pathAndFile.Append(entry.iName); - - entry.iName = pathAndFile; - - // Read category information from archive - TBitFlags category; - TRAPD(err, category = MMCScBkupArchiveUtils::ReadBkUpCategoryInformationL( iFsSession, pathAndFile )); - - if(err == KErrNone) - { - // Append archive in list when valid - if((category.Value() & aParams->Categories().Value()) && ValidArchiveForRestoreL( pathAndFile )) - { - __LOG2("CMMCScBkupEngineImpl::ListArchivesL() - adding archive %S of category 0x%x", - &pathAndFile, category.Value()); - CMMCScBkupArchiveInfo* archiveInfo = CMMCScBkupArchiveInfo::NewLC( entry ); - // Set category in archive info - can be used for filtering - archiveInfo->SetCategory( category ); - // Move ownership to array - aArchives.AppendL(archiveInfo); - CleanupStack::Pop(archiveInfo); - } - else - { - __LOG3("CMMCScBkupEngineImpl::ListArchivesL() - archive %S of category 0x%x (vs. 0x%x) not included", - &pathAndFile, category.Value(), aParams->Categories().Value()); - } - } - } - } - - CleanupStack::PopAndDestroy(pFiles); - } - CleanupStack::Pop( &aArchives ); - __LOG("CMMCScBkupEngineImpl::ListArchivesL() - END"); - } - - -#ifdef DEBUGGING_DATA_TRANSFER -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::CleanBackupFilesL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::CleanBackupFilesL() - { - CFileMan* fileMan = CFileMan::NewL( iFsSession ); - CleanupStack::PushL( fileMan ); - - // Make directory, ignore error, ugly, functionise later on... - _LIT(KMMCScBkupFormatDes, "%S%S%S%S"); - TFileName cleanPath; - const TDesC& path = PathInfo::MemoryCardRootPath(); - - // - cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataJava, &KMMCScBkupDataTransferDebuggingPathDataBackup); - fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error - iFsSession.MkDirAll( cleanPath ); - cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataSystem, &KMMCScBkupDataTransferDebuggingPathDataBackup); - fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error - iFsSession.MkDirAll( cleanPath ); - cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataPassive, &KMMCScBkupDataTransferDebuggingPathDataBackup); - fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error - iFsSession.MkDirAll( cleanPath ); - cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataActive, &KMMCScBkupDataTransferDebuggingPathDataBackup); - fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error - iFsSession.MkDirAll( cleanPath ); - // - CleanupStack::PopAndDestroy( fileMan ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupEngineImpl::ClearRestoreFilesL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupEngineImpl::ClearRestoreFilesL() - { - CFileMan* fileMan = CFileMan::NewL( iFsSession ); - CleanupStack::PushL( fileMan ); - - // Make directory, ignore error, ugly, functionise later on... - _LIT(KMMCScBkupFormatDes, "%S%S%S%S"); - TFileName cleanPath; - const TDesC& path = PathInfo::MemoryCardRootPath(); - - // - cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataJava, &KMMCScBkupDataTransferDebuggingPathDataRestore); - fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error - iFsSession.MkDirAll( cleanPath ); - cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataSystem, &KMMCScBkupDataTransferDebuggingPathDataRestore); - fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error - iFsSession.MkDirAll( cleanPath ); - cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataPassive, &KMMCScBkupDataTransferDebuggingPathDataRestore); - fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error - iFsSession.MkDirAll( cleanPath ); - cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataActive, &KMMCScBkupDataTransferDebuggingPathDataRestore); - fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error - iFsSession.MkDirAll( cleanPath ); - // - CleanupStack::PopAndDestroy( fileMan ); - } - -#endif - - - - - - - - - - - - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupFileInfo.cpp --- a/filemanager/bkupengine/src/CMMCScBkupFileInfo.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,205 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupFileInfo implementation -* -* -*/ - -#include "CMMCScBkupFileInfo.h" - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupFileInfo::CMMCScBkupFileInfo() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupFileInfo::CMMCScBkupFileInfo() - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileInfo::CMMCScBkupFileInfo() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupFileInfo::CMMCScBkupFileInfo( const TEntry& aEntry, TSecureId aAssociatedSID ) -: iSecureId(aAssociatedSID) - { - iSize = aEntry.iSize; - iDateTime = aEntry.iModified; - iAttributes = aEntry.iAtt; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileInfo::~CMMCScBkupFileInfo() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupFileInfo::~CMMCScBkupFileInfo() - { - delete iFileName; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileInfo::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupFileInfo::ConstructL( const TEntry& aEntry ) - { - iFileName = aEntry.iName.AllocL(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileInfo::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupFileInfo* CMMCScBkupFileInfo::NewL( const TEntry& aEntry, TSecureId aAssociatedSID ) - { - CMMCScBkupFileInfo* self = NewLC( aEntry, aAssociatedSID ); - CleanupStack::Pop(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileInfo::NewLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupFileInfo* CMMCScBkupFileInfo::NewLC( const TEntry& aEntry, TSecureId aAssociatedSID ) - { - CMMCScBkupFileInfo* self = new(ELeave) CMMCScBkupFileInfo( aEntry, aAssociatedSID ); - CleanupStack::PushL(self); - self->ConstructL(aEntry); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileInfo::NewLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupFileInfo* CMMCScBkupFileInfo::NewLC( RReadStream& aStream ) - { - CMMCScBkupFileInfo* self = new(ELeave) CMMCScBkupFileInfo(); - CleanupStack::PushL(self); - aStream >> *self; - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileInfo::Drive() -// -// -// --------------------------------------------------------------------------- -TDriveNumber CMMCScBkupFileInfo::Drive() const - { - const TDriveUnit driveUnit( FileName() ); - const TDriveNumber drive = static_cast< TDriveNumber > ( driveUnit.operator TInt() ); - // - return drive; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileInfo::InternalizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupFileInfo::InternalizeL(RReadStream& aStream) - { - aStream.ReadInt32L(); // EStreamFormatVersion1 - aStream.ReadInt32L(); // spare1 - aStream.ReadInt32L(); // spare2 - aStream.ReadInt32L(); // spare3 - // - HBufC* fileName = HBufC::NewL(aStream, KMaxFileName); - delete iFileName; - iFileName = fileName; - // - TInt64 intermediateDateTime; - aStream >> intermediateDateTime; - iDateTime = TTime(intermediateDateTime); - // - TUid intermediateSID; - aStream >> intermediateSID; - iSecureId = intermediateSID; - // - iSize = aStream.ReadInt32L(); - iAttributes = aStream.ReadUint32L(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileInfo::ExternalizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupFileInfo::ExternalizeL(RWriteStream& aStream) const - { - aStream.WriteInt32L( EStreamFormatVersion1 ); - aStream.WriteInt32L( 0 ); // spare1 - aStream.WriteInt32L( 0 ); // spare2 - aStream.WriteInt32L( 0 ); // spare3 - // - aStream << *iFileName; - aStream << iDateTime.Int64(); - aStream << iSecureId.operator TUid(); - aStream.WriteInt32L(iSize); - aStream.WriteUint32L(iAttributes); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileInfo::OrderByFileName() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupFileInfo::OrderByFileName(const CMMCScBkupFileInfo& aLeft, const CMMCScBkupFileInfo& aRight) - { - const TPtrC pLeft(aLeft.FileName()); - const TPtrC pRight(aRight.FileName()); - // - const TInt ret = pLeft.Compare(pRight); - // - return ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileInfo::CompareByFileName() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupFileInfo::CompareByFileName(const CMMCScBkupFileInfo& aLeft, const CMMCScBkupFileInfo& aRight) - { - const TPtrC pLeft(aLeft.FileName()); - const TPtrC pRight(aRight.FileName()); - // - const TBool same = (pLeft.Compare(pRight) == 0); - return same; - } - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupFileListCollection.cpp --- a/filemanager/bkupengine/src/CMMCScBkupFileListCollection.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CMMCScBkupFileListCollection implementation -* -* -*/ - -#include "CMMCScBkupFileListCollection.h" - -#include -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupDataOwnerInfo.h" -#ifdef RD_FILE_MANAGER_BACKUP -#include -#include "BkupEngine.hrh" -#include "pathconfiguration.hrh" -#endif - -// Constants -const TInt KMMCScBkupDataOwnerGranularity = 50; - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::CMMCScBkupFileListCollection() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupFileListCollection::CMMCScBkupFileListCollection( TBitFlags aCategory, - RFs& aFsSession ) - :iEntries(KMMCScBkupDataOwnerGranularity), - iCategory( aCategory ), - iFsSession( aFsSession ) - { - } - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::~CMMCScBkupFileListCollection() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupFileListCollection::~CMMCScBkupFileListCollection() - { - Reset(); - iEntries.Close(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupFileListCollection::ConstructL() - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupFileListCollection* CMMCScBkupFileListCollection::NewL( TBitFlags aCategory, - RFs& aFsSession ) - { - CMMCScBkupFileListCollection* self = new(ELeave) CMMCScBkupFileListCollection( aCategory, aFsSession ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::AppendL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupFileListCollection::AppendL( const RArray& aArray, RArray< const CMMCScBkupFileInfo* >& aAddedItems, TSecureId aAssociatedSID ) - { - const TInt count = aArray.Count(); - - __LOG2("CMMCScBkupFileListCollection::AppendL() - Number of files %d to check for category %x", count, Category().Value() ); - - for(TInt i=0; i comparer( CMMCScBkupFileInfo::OrderByFileName ); - const TInt indexIfFound = iEntries.FindInOrder( fileInfo, comparer ); - if (indexIfFound < 0) - { - // Item wasn't found - insert it in sorted order - AppendL( fileInfo ); - CleanupStack::Pop( fileInfo ); - - __LOG1("CMMCScBkupFileListCollection::AppendL() - Adding file %S", &fileInfo->FileName() ); - - // Add a copy to our return array. - aAddedItems.AppendL( fileInfo ); - } - else - { - // Duplicate, discard - __LOG1("CMMCScBkupFileListCollection::AppendL() - Duplicate file %S", &fileInfo->FileName() ); - CleanupStack::PopAndDestroy( fileInfo ); - } - } - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::AppendL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupFileListCollection::AppendL( CMMCScBkupFileInfo* aFileInfo ) - { - TLinearOrder comparer( CMMCScBkupFileInfo::OrderByFileName ); - iEntries.InsertInOrderL( aFileInfo, comparer ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::Count() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupFileListCollection::Count() const - { - return iEntries.Count(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::Entry() -// -// -// --------------------------------------------------------------------------- -const CMMCScBkupFileInfo& CMMCScBkupFileListCollection::Entry(TInt aIndex) const - { - const CMMCScBkupFileInfo& entry = *iEntries[aIndex]; - return entry; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::Remove() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupFileListCollection::Remove( TInt aIndex ) - { - CMMCScBkupFileInfo* entry = iEntries[aIndex]; - delete entry; - iEntries.Remove(aIndex); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupFileListCollection::Reset() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupFileListCollection::Reset() - { - iEntries.ResetAndDestroy(); - } - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupIndexActiveData.cpp --- a/filemanager/bkupengine/src/CMMCScBkupIndexActiveData.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupIndexActiveData implementation -* -* -*/ - -#include "CMMCScBkupIndexActiveData.h" - -// User includes -#include "MMMCScBkupArchiveDataInterface.h" - - - /** - * Active Data - * =========== - * - * This is the format of the data written by the - * CMMCScBkupStateArchiveOpActiveData object - * - * E.g.: - * - * ACTIVE DATA for DO 0 - * { - * AD for DO 0, 1st drive - * AD for DO 0, 2nd drive - * AD for DO 0, 'n'th drive - * }, - * ACTIVE DATA for DO 1 - * { - * AD for DO 0, 1st drive - (AD is only on - * AD for DO 0, 2nd drive two drives) - * }, - * ACTIVE DATA for DO n - * { - * AD for DO 0, 1st drive - (AD is only on one drive) - * } - * - * Active Data Index - * ================= - * - * This is the format of the data written by this object. - * The format allows the possibility of a future partial - * restore (hopefully). - * - * - * 4 bytes = count of active data entries - * - * FOR EACH DATA OWNER - * { - * 4 bytes = secure id associated with a active data owner - * 4 bytes = the number of different active data packages - * for this particular active data owner (one for each - * drive that was backed up) - * ENTRY - * { - * 1 byte = Associated TDriveNumber of the active data - * 8 bytes = offset and length of raw data - * } - * } - * - * - **/ - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexActiveData::CMMCScBkupIndexActiveData() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupIndexActiveData::CMMCScBkupIndexActiveData() -: CMMCScBkupIndexWithIdentifier< TSecureId >( EMMCScBkupOwnerDataTypeActiveData ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexActiveData::NewLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupIndexActiveData* CMMCScBkupIndexActiveData::NewLC() - { - CMMCScBkupIndexActiveData* self = new(ELeave) CMMCScBkupIndexActiveData(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupIndexBase.cpp --- a/filemanager/bkupengine/src/CMMCScBkupIndexBase.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupIndexBase implementation -* -* -*/ - -#include "CMMCScBkupIndexBase.h" - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexBase::CMMCScBkupIndexBase() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupIndexBase::CMMCScBkupIndexBase( TMMCScBkupOwnerDataType aType ) -: iType(aType) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexBase::~CMMCScBkupIndexBase() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupIndexBase::~CMMCScBkupIndexBase() - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexBase::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupIndexBase::ConstructL() - { - } - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupIndexDataOwners.cpp --- a/filemanager/bkupengine/src/CMMCScBkupIndexDataOwners.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,210 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupIndexDataOwners implementation -* -* -*/ - -#include "CMMCScBkupIndexDataOwners.h" - -// User includes -#include "MMMCScBkupArchiveDataInterface.h" - -// Constants -const TInt KMMCScBkupDataOwnerIndexGranularity = 50; - - - /** - * Registration Data - * ================= - * - * This is the format of the data written by the - * CMMCScBkupStateGetDataOwners object - * - * - * REG DATA for DO 0 - * { - * RD for DO 0, 1st drive - * RD for DO 0, 2nd drive - * RD for DO 0, 'n'th drive - * }, - * REG DATA for DO 1 - * { - * RD for DO 0, 1st drive - * RD for DO 0, 2nd drive - * RD for DO 0, 'n'th drive - * }, - * REG DATA for DO n - * { - * RD for DO 0, 1st drive - * RD for DO 0, 2nd drive - * RD for DO 0, 'n'th drive - * } - * - * Registration Data Index - * ======================= - * - * This is the format of the data written by this method. - * The format allows the possibility of a future partial - * restore (hopefully). - * - * - * 4 bytes = count of data owners - * - * FOR EACH DATA OWNER - * { - * 4 bytes = secure id of data owner's process - * 4 bytes = the number of different registration data files - * for this particular data owner (one for each drive that - * was backed up) - * ENTRY - * { - * 1 byte = Associated TDriveNumber of the registration data - * n bytes = raw drive data - * } - * } - * - * - **/ - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexDataOwners::CMMCScBkupIndexDataOwners() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupIndexDataOwners::CMMCScBkupIndexDataOwners() -: CMMCScBkupIndexBase( EMMCScBkupOwnerDataTypeDataOwner ), iEntries( KMMCScBkupDataOwnerIndexGranularity ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexDataOwners::~CMMCScBkupIndexDataOwners() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupIndexDataOwners::~CMMCScBkupIndexDataOwners() - { - iEntries.Close(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexDataOwners::NewLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupIndexDataOwners* CMMCScBkupIndexDataOwners::NewLC() - { - CMMCScBkupIndexDataOwners* self = new(ELeave) CMMCScBkupIndexDataOwners(); - CleanupStack::PushL(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexDataOwners::AddIndexRecordL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupIndexDataOwners::AddIndexRecordL( const TMMCScBkupArchiveVector& aInfo ) - { - iEntries.AppendL( aInfo ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexDataOwners::StoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupIndexDataOwners::StoreL(MMMCScBkupDriver& aDriver) - { - MMMCScBkupArchiveDataInterface& archiveDataInterface = aDriver.DrvADI(); - RWriteStream& stream = archiveDataInterface.ADIWriteStreamUncompressedLC(); - // - stream.WriteInt32L( EStreamFormatVersion1 ); - stream.WriteInt32L( 0 ); // spare1 - stream.WriteInt32L( 0 ); // spare2 - stream.WriteInt32L( 0 ); // spare3 - // - const TInt count = iEntries.Count(); - stream.WriteInt32L(count); - // - for(TInt i=0; i> entry; - // - stream.ReadInt32L(); // spare1 - stream.ReadInt32L(); // spare2 - // - iEntries.AppendL( entry ); - } - // - CleanupStack::PopAndDestroy(); // stream - // - const TMMCScBkupArchiveVector& readInfo = archiveDataInterface.ADICurrentArchiveVectorInfo(); - if ( readInfo.Length() > Vector().Length() ) - { - // We've read too much! - User::Leave( KErrCorrupt ); - } - } - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupIndexJavaData.cpp --- a/filemanager/bkupengine/src/CMMCScBkupIndexJavaData.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,402 +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: CMMCScBkupIndexJavaDataEntry implementation -* -* -*/ - -#include "CMMCScBkupIndexJavaData.h" - -// User includes -#include "MMMCScBkupArchiveDataInterface.h" -#include "MMCScBkupLogger.h" - - - /** - * Registration Data - * ================= - * - * - * REG DATA for DO 0 - * { - * RD for DO 0, 1st drive - * RD for DO 0, 2nd drive - * RD for DO 0, 'n'th drive - * }, - * REG DATA for DO 1 - * { - * RD for DO 0, 1st drive - * RD for DO 0, 2nd drive - * RD for DO 0, 'n'th drive - * }, - * REG DATA for DO n - * { - * RD for DO 0, 1st drive - * RD for DO 0, 2nd drive - * RD for DO 0, 'n'th drive - * } - * - * Registration Data Index - * ======================= - * - * This is the format of the data written by this object. - * The format allows the possibility of a future partial - * restore (hopefully). - * - * - * 4 bytes = count of registration data entries - * - * FOR EACH DATA OWNER - * { - * 4 bytes = secure id of data owner's process - * 4 bytes = the number of different registration data files - * for this particular data owner (one for each drive that - * was backed up) - * ENTRY - * { - * 1 byte = Associated TDriveNumber of the registration data - * 8 bytes = offset & length of actual registration data - * } - * } - * - **/ - - - - - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexJavaDataEntry::CMMCScBkupIndexJavaDataEntry() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupIndexJavaDataEntry::CMMCScBkupIndexJavaDataEntry() - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexJavaDataEntry::CMMCScBkupIndexJavaDataEntry() -// -// C++ destructor. -// --------------------------------------------------------------------------- -CMMCScBkupIndexJavaDataEntry::~CMMCScBkupIndexJavaDataEntry() - { - delete iHash; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexJavaDataEntry::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupIndexJavaDataEntry::ConstructL() - { - iHash = KNullDesC().AllocL(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexJavaDataEntry::NewLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupIndexJavaDataEntry* CMMCScBkupIndexJavaDataEntry::NewLC() - { - CMMCScBkupIndexJavaDataEntry* self = new(ELeave) CMMCScBkupIndexJavaDataEntry(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexJavaDataEntry::NewLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupIndexJavaDataEntry* CMMCScBkupIndexJavaDataEntry::NewLC( RReadStream& aStream ) - { - CMMCScBkupIndexJavaDataEntry* self = new(ELeave) CMMCScBkupIndexJavaDataEntry(); - CleanupStack::PushL( self ); - aStream >> *self; - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexJavaDataEntry::SetHashL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupIndexJavaDataEntry::SetHashL( const TDesC& aHash ) - { - HBufC* hash = aHash.AllocL(); - delete iHash; - iHash = hash; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexJavaDataEntry::InternalizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupIndexJavaDataEntry::InternalizeL( RReadStream& aStream ) - { - aStream.ReadInt32L(); // EStreamFormatVersion1 - aStream.ReadInt32L(); // spare1 - aStream.ReadInt32L(); // spare2 - aStream.ReadInt32L(); // spare3 - // - HBufC* hash = HBufC::NewL( aStream, KMaxTInt ); - delete iHash; - iHash = hash; - // - aStream >> iMidletInfo; - aStream >> iMidletDataInfo; - iDrive = static_cast< TDriveNumber>( aStream.ReadInt8L() ); - // - __LOG6("CMMCScBkupIndexJavaDataEntry::InternalizeL() - hash: %S, iDrive: %c:, MIDLET[offset: %8d, length: %8d], MIDLETDATA[offset: %8d, length: %8d]", iHash, iDrive + 'A', iMidletInfo.Offset(), iMidletInfo.Length(), iMidletDataInfo.Offset(), iMidletDataInfo.Length() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexJavaDataEntry::ExternalizeL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupIndexJavaDataEntry::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt32L( EStreamFormatVersion1 ); - aStream.WriteInt32L( 0 ); // spare1 - aStream.WriteInt32L( 0 ); // spare2 - aStream.WriteInt32L( 0 ); // spare3 - // - aStream << Hash(); - aStream << iMidletInfo; - aStream << iMidletDataInfo; - aStream.WriteInt8L( iDrive ); - // - __LOG6("CMMCScBkupIndexJavaDataEntry::ExternalizeL() - hash: %S, iDrive: %c:, MIDLET[offset: %8d, length: %8d], MIDLETDATA[offset: %8d, length: %8d]", iHash, iDrive + 'A', iMidletInfo.Offset(), iMidletInfo.Length(), iMidletDataInfo.Offset(), iMidletDataInfo.Length() ); - } - - - - - - - - - - - - - - - - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexJavaData::CMMCScBkupIndexJavaData() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupIndexJavaData::CMMCScBkupIndexJavaData() -: CMMCScBkupIndexBase( EMMCScBkupOwnerDataTypeJavaData ) - { - } - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexJavaData::~CMMCScBkupIndexJavaData() -// -// C++ destructor. -// --------------------------------------------------------------------------- -CMMCScBkupIndexJavaData::~CMMCScBkupIndexJavaData() - { - iEntries.Close(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexJavaData::NewLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupIndexJavaData* CMMCScBkupIndexJavaData::NewLC() - { - CMMCScBkupIndexJavaData* self = new(ELeave) CMMCScBkupIndexJavaData(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexJavaData::AddIndexRecordL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupIndexJavaData::AddIndexRecordL( const TMMCScBkupArchiveVector& aInfo, const TDesC& aHash, TDriveNumber aDrive, TJavaTransferType aType ) - { - // Check if we already have an entry for this item... - CMMCScBkupIndexJavaDataEntry* entry = EntryByHash( aHash, aDrive ); - - if ( !entry ) - { - __LOG1("CMMCScBkupIndexJavaData::AddIndexRecordL() - making new entry for hash: %S", &aHash); - // - entry = CMMCScBkupIndexJavaDataEntry::NewLC(); - // - entry->SetHashL( aHash ); - entry->SetDrive( aDrive ); - iEntries.AppendL( entry ); - // - CleanupStack::Pop( entry ); - } - else - { - __LOG1("CMMCScBkupIndexJavaData::AddIndexRecordL() - found existing entry for hash: %S", &aHash); - } - - if ( aType == EJavaMIDlet ) - { - entry->SetMidletInfo( aInfo ); - } - else if ( aType == EJavaMIDletData ) - { - entry->SetMidletDataInfo( aInfo ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexJavaData::At() -// -// -// --------------------------------------------------------------------------- -const CMMCScBkupIndexJavaDataEntry& CMMCScBkupIndexJavaData::At( TInt aIndex ) const - { - const CMMCScBkupIndexJavaDataEntry* entry = iEntries[ aIndex ]; - return *entry; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexJavaData::StoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupIndexJavaData::StoreL(MMMCScBkupDriver& aDriver) - { - MMMCScBkupArchiveDataInterface& archiveDataInterface = aDriver.DrvADI(); - RWriteStream stream(archiveDataInterface.ADIWriteStreamUncompressedLC()); - // - stream.WriteInt32L( EStreamFormatVersion1 ); - stream.WriteInt32L( 0 ); // spare1 - stream.WriteInt32L( 0 ); // spare2 - stream.WriteInt32L( 0 ); // spare3 - // - const TInt count = iEntries.Count(); - stream.WriteInt32L(count); - // - for(TInt i=0; i Vector().Length() ) - { - // We've read too much! - User::Leave( KErrCorrupt ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexJavaData::EntryByHash() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupIndexJavaDataEntry* CMMCScBkupIndexJavaData::EntryByHash( const TDesC& aHash, TDriveNumber aDrive ) const - { - CMMCScBkupIndexJavaDataEntry* ret = NULL; - const TInt count = iEntries.Count(); - // - for(TInt i=0; iHash() == aHash && entry->Drive() == aDrive ) - { - ret = entry; - break; - } - } - // - return ret; - } - - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupIndexPassiveData.cpp --- a/filemanager/bkupengine/src/CMMCScBkupIndexPassiveData.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupIndexPassiveData implementation -* -* -*/ - -#include "CMMCScBkupIndexPassiveData.h" - -// User includes -#include "MMMCScBkupArchiveDataInterface.h" - - - /** - * Passive Data - * =========== - * - * - * - * Passive Data Index - * ================= - * - * This is the format of the data written by this object. - * The format allows the possibility of a future partial - * restore (hopefully). - * - * - * 4 bytes = count of passive data entries - * - * FOR EACH DATA OWNER - * { - * 4 bytes = secure id associated with a passive data owner - * 4 bytes = the number of different data entries for this - * particular passive data owner (one for each - * drive that was backed up) - * ENTRY - * { - * 1 byte = Associated TDriveNumber of the system data - * 8 bytes = offset and size to passive data - * } - * } - * - * - **/ - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexPassiveData::CMMCScBkupIndexPassiveData() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupIndexPassiveData::CMMCScBkupIndexPassiveData() -: CMMCScBkupIndexWithIdentifier< TSecureId >( EMMCScBkupOwnerDataTypePassiveData ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexPassiveData::NewLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupIndexPassiveData* CMMCScBkupIndexPassiveData::NewLC() - { - CMMCScBkupIndexPassiveData* self = new(ELeave) CMMCScBkupIndexPassiveData(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupIndexPublicDataFiles.cpp --- a/filemanager/bkupengine/src/CMMCScBkupIndexPublicDataFiles.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupIndexPublicDataFiles implementation -* -* -*/ - -#include "CMMCScBkupIndexPublicDataFiles.h" - -// User includes -#include "MMMCScBkupArchiveDataInterface.h" -#include "CMMCScBkupFileInfo.h" -#include "CMMCScBkupFileListCollection.h" - - - /** - * Public File Data - * ================ - * - * This is the format of the data written by the - * CMMCScBkupStateArchiveOpPublicDataFiles object - * - * PUB FILE DATA for file 0 - * PUB FILE DATA for file 1 - * PUB FILE DATA for file n - * - * Public File Data Index - * ====================== - * - * This is the format of the data written by this object. - * The format allows the possibility of a future partial - * restore (hopefully). - * - * 4 bytes = count of data owners - * - * FOR EACH PUBLIC FILE - * { - * externalised CMMCScBkupFileInfo object - * externalised TMMCScBkupArchiveVector (offset & compressed size) object - * } - * - **/ - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexPublicDataFiles::CMMCScBkupIndexPublicDataFiles() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupIndexPublicDataFiles::CMMCScBkupIndexPublicDataFiles() -: CMMCScBkupIndexBase( EMMCScBkupOwnerDataTypePublicData ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexPublicDataFiles::~CMMCScBkupIndexPublicDataFiles() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupIndexPublicDataFiles::~CMMCScBkupIndexPublicDataFiles() - { - iEntries.Close(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexPublicDataFiles::NewLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupIndexPublicDataFiles* CMMCScBkupIndexPublicDataFiles::NewLC() - { - CMMCScBkupIndexPublicDataFiles* self = new(ELeave) CMMCScBkupIndexPublicDataFiles(); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexPublicDataFiles::AddIndexRecordL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupIndexPublicDataFiles::AddIndexRecordL( const TMMCScBkupArchiveVector& aInfo, const CMMCScBkupFileInfo& aFile ) - { - // Create new entry - TMMCScBkupPublicFileEntry entry( aInfo, aFile ); - - // Add it to our index - iEntries.AppendL( entry ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexPublicDataFiles::At() -// -// -// --------------------------------------------------------------------------- -const CMMCScBkupFileInfo& CMMCScBkupIndexPublicDataFiles::At( TInt aIndex, TMMCScBkupArchiveVector& aInfo ) const - { - const TMMCScBkupPublicFileEntry& entry = iEntries[ aIndex ]; - aInfo = entry.iInfo; - return *entry.iFile; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexPublicDataFiles::StoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupIndexPublicDataFiles::StoreL(MMMCScBkupDriver& aDriver) - { - MMMCScBkupArchiveDataInterface& archiveDataInterface = aDriver.DrvADI(); - RWriteStream stream(archiveDataInterface.ADIWriteStreamUncompressedLC()); - // - const TInt count = iEntries.Count(); - stream.WriteInt32L(count); - // - for(TInt i=0; i> entry.iInfo; - - // And finally add a new record to our index, so client's can - // retrieve the info. - iEntries.AppendL( entry ); - } - // - CleanupStack::PopAndDestroy(); // stream - // - const TMMCScBkupArchiveVector& readInfo = archiveDataInterface.ADICurrentArchiveVectorInfo(); - if ( readInfo.Length() > Vector().Length() ) - { - // We've read too much! - User::Leave( KErrCorrupt ); - } - } - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupIndexSystemData.cpp --- a/filemanager/bkupengine/src/CMMCScBkupIndexSystemData.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupIndexSystemData implementation -* -* -*/ - -#include "CMMCScBkupIndexSystemData.h" - -// User includes -#include "MMMCScBkupArchiveDataInterface.h" - - - /** - * System Data - * =========== - * - * This is the format of the data written by the - * CMMCScBkupStateArchiveOpSystemData object - * - * - * SYSTEM DATA for DO 0 - * { - * SD for DO 0, 1st drive - * SD for DO 0, 2nd drive - * SD for DO 0, 'n'th drive - * }, - * SYSTEM DATA for DO 1 - * { - * SD for DO 0, 1st drive - (System data is only on - * SD for DO 0, 2nd drive two drives) - * }, - * SYSTEM DATA for DO n - * { - * SD for DO 0, 1st drive - (System Data is only on one drive) - * } - * - * System Data Index - * ================= - * - * This is the format of the data written by this object. - * The format allows the possibility of a future partial - * restore (hopefully). - * - * - * 4 bytes = count of system data entries - * - * FOR EACH DATA OWNER - * { - * 4 bytes = package id associated with a system data owner - * 4 bytes = the number of different system data packages - * for this particular system data owner (one for each - * drive that was backed up) - * ENTRY - * { - * 1 byte = Associated TDriveNumber of the system data - * 8 bytes = offset & length of actual registration data - * } - * } - * - * - **/ - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexSystemData::CMMCScBkupIndexSystemData() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupIndexSystemData::CMMCScBkupIndexSystemData() -: CMMCScBkupIndexWithIdentifier< TInt32 >( EMMCScBkupOwnerDataTypeSystemData ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupIndexSystemData::NewLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupIndexSystemData* CMMCScBkupIndexSystemData::NewLC() - { - CMMCScBkupIndexSystemData* self = new(ELeave) CMMCScBkupIndexSystemData(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupIndexWithIdentifier.cpp --- a/filemanager/bkupengine/src/CMMCScBkupIndexWithIdentifier.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupIndexWithIdentifier implementation -* -* -*/ - -#include "CMMCScBkupIndexWithIdentifier.h" - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupOperationParameters.cpp --- a/filemanager/bkupengine/src/CMMCScBkupOperationParameters.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,490 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupOpParamsBase implementation -* -* -*/ - -#include "CMMCScBkupOperationParameters.h" - -// System includes -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupDriveAndOperationTypeManager.h" -#include "CMMCScBkupArchiveInfo.h" -#include "BkupEngine.hrh" - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBase::CMMCScBkupOpParamsBase() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupOpParamsBase::CMMCScBkupOpParamsBase() - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBase::~CMMCScBkupOpParamsBase() -// -// C++ destructor. -// --------------------------------------------------------------------------- -EXPORT_C CMMCScBkupOpParamsBase::~CMMCScBkupOpParamsBase() - { - delete iDriveAndOperations; - iArchiveInfos.ResetAndDestroy(); - iArchiveInfos.Close(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBase::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupOpParamsBase::ConstructL( TResourceReader& aDriveReader, TBitFlags aCategories ) - { - iCategories = aCategories; - iDriveAndOperations = CMMCScBkupDriveAndOperationTypeManager::NewL( aDriveReader ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBase::DriveAndOperations() -// -// -// --------------------------------------------------------------------------- -EXPORT_C const CMMCScBkupDriveAndOperationTypeManager& CMMCScBkupOpParamsBase::DriveAndOperations() const - { - return *iDriveAndOperations; - } - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBase::SetArchiveInfosL() -// -// -// --------------------------------------------------------------------------- -EXPORT_C void CMMCScBkupOpParamsBase::SetArchiveInfosL(RPointerArray& aInfos) - { - iArchiveInfos.ResetAndDestroy(); - - for(TInt i = 0; i < aInfos.Count(); i++) - { - iArchiveInfos.AppendL(aInfos[i]); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBase::ArchiveInfos() -// -// -// --------------------------------------------------------------------------- -RMMCScBkupPointerArray& CMMCScBkupOpParamsBase::ArchiveInfos() - { - return iArchiveInfos; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBase::ArchiveInfo() -// -// -// --------------------------------------------------------------------------- -const CMMCScBkupArchiveInfo& CMMCScBkupOpParamsBase::ArchiveInfo(TBitFlags aCategory) const - { - CMMCScBkupArchiveInfo* archiveInfo = NULL; - - for(TInt i = 0; i < iArchiveInfos.Count(); i++) - { - archiveInfo = iArchiveInfos[i]; - if(archiveInfo->Category() == aCategory) - { - break; - } - } - - return *archiveInfo; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBase::FileName() -// -// -// --------------------------------------------------------------------------- -const TDesC& CMMCScBkupOpParamsBase::FileName(TInt aIndex) const - { - const TDesC* ret = &KNullDesC; - const CMMCScBkupArchiveInfo& archiveInfo = *iArchiveInfos[aIndex]; - - if( archiveInfo.FileName().Length() ) - { - ret = &archiveInfo.FileName(); - } - - return *ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBackupFull::ReadFromResourceL() -// -// Read categories with associated data from resource -// --------------------------------------------------------------------------- -void CMMCScBkupOpParamsBackupFull::ReadFromResourceL( TResourceReader& aReader ) - { - TInt count( aReader.ReadInt16() ); - - for ( TInt i( 0 ); i < count; i++ ) - { - // Read category - TBitFlags category = static_cast< TBitFlags >(aReader.ReadUint32()); - - // Read archive name - const TDriveUnit driveUnit(iDrive); - const TDriveName driveName(driveUnit.Name()); - TFileName name; - TPtrC archiveName( aReader.ReadTPtrC() ); - - name.Append(driveName); - name.Append(KBackUpFolder()); - name.Append(archiveName); - - // Read special flags - TBitFlags flags = static_cast< TBitFlags >(aReader.ReadUint32()); - TBitFlags excludedFlags = static_cast< TBitFlags >(aReader.ReadUint32()); - - // Read SIDs belonging to category - TInt16 subCount = aReader.ReadInt16(); - RArray sids; - CleanupClosePushL( sids ); - - for(TInt j = 0; j < subCount; j++) - { - sids.AppendL(static_cast(aReader.ReadUint32())); - } - - // Read excluded SIDs for category - subCount = aReader.ReadInt16(); - RArray excludeSids; - CleanupClosePushL( excludeSids ); - - for(TInt j = 0; j < subCount; j++) - { - excludeSids.AppendL(static_cast(aReader.ReadUint32())); - } - - TEntry entry; - entry.iName = name; - CMMCScBkupArchiveInfo* archiveInfo = CMMCScBkupArchiveInfo::NewLC( entry ); - archiveInfo->SetCategory( category ); - archiveInfo->SetSpecialFlags( flags ); - archiveInfo->SetExcludedSpecialFlags( excludedFlags ); - archiveInfo->SetSIDs( sids ); - archiveInfo->SetExcludedSIDs( excludeSids ); - - // If the category is specified, then add it in list of categories to be archived -#ifdef RD_FILE_MANAGER_BACKUP - if( Categories().Value() & category.Value() ) -#else - if( category.Value() == EBUCatAllInOne ) -#endif - { - __LOG1("CMMCScBkupOpParamsBase::ReadFromResourceL() - adding category 0x%x", category.Value()); - RMMCScBkupPointerArray& archives = ArchiveInfos(); - archives.AppendL( archiveInfo ); - CleanupStack::Pop( archiveInfo ); - } - else - { - __LOG1("CMMCScBkupOpParamsBase::ReadFromResourceL() - category 0x%x not included", category.Value()); - CleanupStack::PopAndDestroy( archiveInfo ); - } - - CleanupStack::PopAndDestroy( &excludeSids ); - CleanupStack::PopAndDestroy( &sids ); - } - } - - - - - - - - - - - - - - - - - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBackupFull::CMMCScBkupOpParamsBackupFull() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupOpParamsBackupFull::CMMCScBkupOpParamsBackupFull( TDriveNumber aDrive ) - : iDrive( aDrive ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBackupFull::~CMMCScBkupOpParamsBackupFull() -// -// C++ destructor. -// --------------------------------------------------------------------------- -EXPORT_C CMMCScBkupOpParamsBackupFull::~CMMCScBkupOpParamsBackupFull() - { - } - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBackupFull::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupOpParamsBackupFull::ConstructL( TResourceReader& aDriveReader, TResourceReader& aCategoryReader, - TBitFlags aCategories ) - { - CMMCScBkupOpParamsBase::ConstructL( aDriveReader, aCategories ); - ReadFromResourceL( aCategoryReader ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBackupFull::NewL() -// -// -// --------------------------------------------------------------------------- -EXPORT_C CMMCScBkupOpParamsBackupFull* CMMCScBkupOpParamsBackupFull::NewL( TResourceReader& aDriveReader, TResourceReader& aCategoryReader, - TDriveNumber aDrive, TBitFlags aCategories ) - { - CMMCScBkupOpParamsBackupFull* self = new(ELeave) CMMCScBkupOpParamsBackupFull( aDrive ); - CleanupStack::PushL( self ); - self->ConstructL( aDriveReader, aCategoryReader, aCategories ); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBackupFull::AssociatedOpType() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TMMCScBkupOperationType CMMCScBkupOpParamsBackupFull::AssociatedOpType() const - { - return EMMCScBkupOperationTypeFullBackup; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBackupFull::PartType() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TBURPartType CMMCScBkupOpParamsBackupFull::PartType() const - { - return EBURBackupFull; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBackupFull::IncrementType() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TBackupIncType CMMCScBkupOpParamsBackupFull::IncrementType() const - { - return EBackupBase; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBackupFull::PassiveTransferType() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TTransferDataType CMMCScBkupOpParamsBackupFull::PassiveTransferType() const - { - return EPassiveBaseData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBackupFull::ActiveTransferType() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TTransferDataType CMMCScBkupOpParamsBackupFull::ActiveTransferType() const - { - return EActiveBaseData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsBackupFull::PackageTransferType() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TPackageDataType CMMCScBkupOpParamsBackupFull::PackageTransferType() const - { - return ESystemData; - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsRestoreFull::CMMCScBkupOpParamsRestoreFull() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupOpParamsRestoreFull::CMMCScBkupOpParamsRestoreFull() - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsRestoreFull::~CMMCScBkupOpParamsRestoreFull() -// -// C++ destructor. -// --------------------------------------------------------------------------- -EXPORT_C CMMCScBkupOpParamsRestoreFull::~CMMCScBkupOpParamsRestoreFull() - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsRestoreFull::NewL() -// -// -// --------------------------------------------------------------------------- -EXPORT_C CMMCScBkupOpParamsRestoreFull* CMMCScBkupOpParamsRestoreFull::NewL( TResourceReader& aDriveReader, TBitFlags aCategories ) - { - CMMCScBkupOpParamsRestoreFull* self = new(ELeave) CMMCScBkupOpParamsRestoreFull( ); - CleanupStack::PushL( self ); - self->ConstructL( aDriveReader, aCategories ); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsRestoreFull::AssociatedOpType() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TMMCScBkupOperationType CMMCScBkupOpParamsRestoreFull::AssociatedOpType() const - { - return EMMCScBkupOperationTypeFullRestore; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsRestoreFull::PartType() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TBURPartType CMMCScBkupOpParamsRestoreFull::PartType() const - { - return EBURRestoreFull; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsRestoreFull::IncrementType() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TBackupIncType CMMCScBkupOpParamsRestoreFull::IncrementType() const - { - return EBackupBase; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsRestoreFull::PassiveTransferType() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TTransferDataType CMMCScBkupOpParamsRestoreFull::PassiveTransferType() const - { - return EPassiveBaseData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsRestoreFull::ActiveTransferType() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TTransferDataType CMMCScBkupOpParamsRestoreFull::ActiveTransferType() const - { - return EActiveBaseData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupOpParamsRestoreFull::PackageTransferType() -// -// -// --------------------------------------------------------------------------- -EXPORT_C TPackageDataType CMMCScBkupOpParamsRestoreFull::PackageTransferType() const - { - return ESystemData; - } - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupState.cpp --- a/filemanager/bkupengine/src/CMMCScBkupState.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,243 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupState implementation -* -* -*/ - -#include "CMMCScBkupState.h" - -// User includes -#include "MMCScBkupLogger.h" - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupState::CMMCScBkupState() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupState::CMMCScBkupState( MMMCScBkupDriver& aDriver, TInt aPriority ) -: CActive( aPriority ), iDriver( aDriver ) - { - CActiveScheduler::Add(this); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupState::~CMMCScBkupState() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupState::~CMMCScBkupState() - { - Cancel(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupState::RunL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupState::RunL() - { - User::LeaveIfError(iStatus.Int()); - // - PerformAsynchronousStateStepL(); - // - if (!IsActive()) - { - // If we've processed all the asynchronous steps, then - // perform the last rights on the state. - // - // If this causes a leave, then we cascade the failure - // to the observer - i.e. the error is treated as fatal. - TRAPD(err, PerformLastRightsL() ); - CompleteObserver( err ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupState::DoCancel() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupState::DoCancel() - { - __LOG3("CMMCScBkupState::DoCancel() - START - state: 0x%08x, IsActive: %d, status: %d", StateId().iUid, IsActive(), iStatus.Int() ); - PerformAsynchronousCancellation(); - CompleteObserver( KErrCancel ); - __LOG3("CMMCScBkupState::DoCancel() - END - state: 0x%08x, IsActive: %d, status: %d", StateId().iUid, IsActive(), iStatus.Int() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupState::RunError() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupState::RunError(TInt aError) - { -#ifdef MMCSCBKUP_USE_BREAKPOINTS - __BREAKPOINT(); -#endif - // - if ( aError == KErrNoMemory || aError == KErrDiskFull || aError == KErrNotReady || aError == KErrServerTerminated || aError == KErrWrite ) - { - __LOGFILE2("CMMCScBkupState::RunError() - **** - FATAL ERROR - state: 0x%08x, aError: %d - Notifying Observer (Engine)", StateId().iUid, aError ); - CompleteObserver( aError ); - } - else - { - __LOGFILE2("CMMCScBkupState::RunError() - **** - ATTEMPT TO HANDLE ERROR - state: 0x%08x, aError: %d...", StateId().iUid, aError ); - - const TBool errorHandled = PerformAsynchronousErrorCleanup( aError ); - - __LOGFILE1("CMMCScBkupState::RunError() - **** - handle error result: %d", errorHandled ); - - // If the cleanup callback didn't set us active again, then - // assume the object didn't perform any recovery. Therefore - // inform our observer about the error and give up. - if (!errorHandled || !IsActive()) - { - CompleteObserver( aError ); - } - } - // - return KErrNone; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupState::ExecuteL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupState::ExecuteL(TRequestStatus& aObserver) - { - SetObserver(aObserver); - TRAPD(error, PerformStateInitL()); - - // If the object is active, then it is making use of asynchronous - // functionality, in which case we do nothing. - // - // If the object is not active or the call to PerformStateActionL left, - // then we complete the observer with the result of the trap - if (error != KErrNone || IsActive() == EFalse) - { - if (error == KErrNone) - { - PerformLastRightsL(); - } - // - CompleteObserver(error); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupState::PerformAsynchronousStateStepL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupState::PerformAsynchronousStateStepL() - { - // Derived classes should override this if they implement - // asynchronous behaviour - User::Invariant(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupState::PerformAsynchronousCancellation() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupState::PerformAsynchronousCancellation() - { - // Derived classes are expected to implement this if they have - // resources to free. For calls to CompleteSelf(), no action is needed. - __LOG3("CMMCScBkupState::PerformAsynchronousCancellation() - ERROR - cancellation not implemented for state: 0x%08x, IsActive: %d, status: %d", StateId().iUid, IsActive(), iStatus.Int() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupState::PerformLastRightsL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupState::PerformLastRightsL() - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupState::PerformAsynchronousErrorCleanup() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupState::PerformAsynchronousErrorCleanup( TInt aError ) - { - (void) aError; - __LOGFILE2("CMMCScBkupState::PerformAsynchronousErrorCleanup() - error: %d, state id: 0x%08x", aError, StateId().iUid ); - return EFalse; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupState::CompleteSelf() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupState::CompleteSelf( TInt aCompletionCode ) - { - SetActive(); - TRequestStatus* status = &iStatus; - User::RequestComplete( status, aCompletionCode ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupState::CompleteObserver() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupState::CompleteObserver( TInt aCompletionCode ) - { - __ASSERT_ALWAYS(iObserver != NULL, User::Invariant()); - User::RequestComplete( iObserver, aCompletionCode ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupState::SetObserver() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupState::SetObserver(TRequestStatus& aStatus) - { - __ASSERT_ALWAYS(iObserver == NULL, User::Invariant()); - aStatus = KRequestPending; - iObserver = &aStatus; - } - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpActiveData.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpActiveData.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,467 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupStateArchiveOpActiveData implementation -* -* -*/ - -#include "CMMCScBkupStateArchiveOpActiveData.h" - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupDataOwnerCollection.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "MMCScBkupSBEUtils.h" -#include "CMMCScBkupArchive.h" -#include "CMMCScBkupArchiveFooter.h" -#include "CMMCScBkupIndexWithIdentifier.h" -#include "MMMCScBkupArchiveDataInterface.h" - -// Constants -const TInt KMMCScBkupActiveDataOwnerDelayBeforeRetry = 2 * 1000000; // 2 seconds -const TInt KMMCScBkupNumberOfAttemptsToAllowADOToBecomeReady = 4; // corresponds to 8 seconds of waiting - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::CMMCScBkupStateArchiveOpActiveData() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpActiveData::CMMCScBkupStateArchiveOpActiveData( MMMCScBkupDriver& aDriver ) -: CMMCScBkupStateOpAware( aDriver ), iIndexValueCurrent( -1 ) - { - __LOG1("CMMCScBkupStateArchiveOpActiveData::CMMCScBkupStateArchiveOpActiveData() - 0x%08x", StateId().iUid ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::~CMMCScBkupStateArchiveOpActiveData() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpActiveData::~CMMCScBkupStateArchiveOpActiveData() - { - Cancel(); - // - iTimer.Close(); - // - delete iBackupTransferObject; - delete iRestoreTransferObject; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpActiveData* CMMCScBkupStateArchiveOpActiveData::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateArchiveOpActiveData* self = new(ELeave) CMMCScBkupStateArchiveOpActiveData( aDriver ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::StateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpActiveData::StateId() const - { - return KMMCScBkupStateIdArchiveOpActiveData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::NextStateBackupId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpActiveData::NextStateBackupId( TBool /*aPartial*/ ) const - { - // If we still have unprocessed active data owners remaining, then - // we must - // - // a) check their status again - to see if they are ready, then - // b) process them once again via this method - // - // The 'get data owner statuses' object will trigger us again - // when it has performed an update of all statuses - - // By default, we want to move onto the passive data... - TMMCScBkupStateId nextState = KMMCScBkupStateIdArchiveOpPassiveData; - if (AllDataOwnersHandled() == EFalse) - { - // ... but we've still got at least one data owner who's not yet - // finished preparing their data... so we have to retry - nextState = KMMCScBkupStateIdGetDataOwnerStatuses; - } - // - return nextState; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::NextStateRestoreId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpActiveData::NextStateRestoreId( TBool /*aPartial*/ ) const - { - // If we still have unprocessed active data owners remaining, then - // we must - // - // a) check their status again - to see if they are ready, then - // b) process them once again via this method - // - // The 'get data owner statuses' object will trigger us again - // when it has performed an update of all statuses - - // By default, we want to move onto the passive data... - TMMCScBkupStateId nextState = KMMCScBkupStateIdArchiveOpPublicDataFiles; - if (AllDataOwnersHandled() == EFalse) - { - // ... but we've still got at least one data owner who's not yet - // finished preparing their data... so we have to retry - nextState = KMMCScBkupStateIdGetDataOwnerStatuses; - } - // - return nextState; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::PerformStateInitBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpActiveData::PerformStateInitBackupL( TBool /*aPartial*/ ) - { - __DEBUG_TESTING_SKIP_BACKUP_ACT_DATA; - __LOG("CMMCScBkupStateArchiveOpActiveData::PerformStateInitBackupL() - START"); - - iBackupTransferObject = CMMCScBkupWriteDataTransferRequest< TTransferDataType >::NewL( - Driver(), - *this, - EMMCScBkupOwnerDataTypeActiveData, - ESIDTransferDerivedType, - Driver().DrvParamsBase().ActiveTransferType() - ); - CompleteSelf(); - __LOG("CMMCScBkupStateArchiveOpActiveData::PerformStateInitBackupL() - END"); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::PerformStateInitRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpActiveData::PerformStateInitRestoreL( TBool /*aPartial*/ ) - { - __DEBUG_TESTING_SKIP_RESTORE_ACT_DATA; - __LOG("CMMCScBkupStateArchiveOpActiveData::PerformStateInitRestoreL() - START"); - - iRestoreTransferObject = CMMCScBkupReadDataTransferRequest< TTransferDataType >::NewL( - Driver(), - EMMCScBkupOwnerDataTypeActiveData, - Driver().DrvParamsBase().ActiveTransferType() - ); - - CompleteSelf(); - __LOG("CMMCScBkupStateArchiveOpActiveData::PerformStateInitRestoreL() - END"); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL( TBool /*aPartial*/ ) - { - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - const TInt count = dataOwners.Count(); - __LOG2("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - START - iIndexValueCurrent: %d/%d", iIndexValueCurrent, count); - // - while ( ++iIndexValueCurrent < count ) - { - CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner(iIndexValueCurrent); - - // Has this data owner been processed? - // Is the data owner even ready? - const TBool activeDataAlreadyProcessed = owner.CompletionStatus( EMMCScBkupOwnerDataTypeActiveData ); - const TBool dataOwnerIsReady = ( owner.Status() == EDataOwnerReady || - owner.Status() == EDataOwnerReadyNoImpl ); - const TBool dataHasRealActiveData = ( owner.Status() == EDataOwnerReady ); - // - __LOG5("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - DO: 0x%08x has status: %d, alreadyProcessed: %d, isReady: %d, dataHasRealActiveData: %d", owner.SecureId().iId, owner.Status(), activeDataAlreadyProcessed, dataOwnerIsReady, dataHasRealActiveData); - // - if (!activeDataAlreadyProcessed) - { - __LOG("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - active data hasnt already been processed..."); - - if (dataOwnerIsReady) - { - __LOG("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - data owner is ready..."); - - if ( dataHasRealActiveData ) - { - __LOG("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - data owner has real active data..."); - - // Try and obtain the active data for this client - __ASSERT_ALWAYS(iBackupTransferObject->IsActive() == EFalse, User::Invariant()); - // - iBackupTransferObject->RequestL( owner, - iStatus, - Driver().DrvParamsBase().DriveAndOperations() ); - SetActive(); - break; // while loop - } - else - { - // The data owner is a hybrid - we shouldn't request data for a data owner that - // doesn't provide an active data interface callback implementation. - __LOG("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - DO is a hybrid - set completion status to ETrue"); - owner.SetCompletionStatus( EMMCScBkupOwnerDataTypeActiveData, ETrue ); - } - } - else - { - // Retry a number of times, but eventually we'll give up - const TInt attemptsSoFar = owner.ActiveDataRetryCount(); - owner.SetActiveDataRetryCount( attemptsSoFar + 1 ); - - if ( attemptsSoFar >= KMMCScBkupNumberOfAttemptsToAllowADOToBecomeReady ) - { - // Give up, this DO is taking too long - owner.SetCompletionStatus( EMMCScBkupOwnerDataTypeActiveData, ETrue ); - __LOG1("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - ADO with SID: 0x%08x has taken too long to prepare, skipping", owner.SecureId().iId); - } - else - { - // DO is not yet ready, we're going to have to check its - // status again in a while... - __LOG1("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - attemptsSoFar %d", attemptsSoFar); - iAtLeastOneDataOwnerIsNotYetReady = ETrue; - } - } - } - } - // - CheckNeedToStartRetryTimerL(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepRestoreL( TBool /*aPartial*/ ) - { - CMMCScBkupIndexBase& indexBase = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeActiveData ); - CMMCScBkupIndexWithIdentifier< TSecureId >& index = static_cast< CMMCScBkupIndexWithIdentifier< TSecureId >& >( indexBase ); - const TInt count = index.Count(); - // - // - while ( ++iIndexValueCurrent < count ) - { - // Get the associated data owner - const CMMCScBkupIndexEntry& entry = index.At( iIndexValueCurrent ); - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - CMMCScBkupDataOwnerInfo& owner = dataOwners.OwnerL( entry.Identifier() ); - - // Has this data owner been processed? - // Is the data owner even ready? - const TBool activeDataAlreadyProcessed = owner.CompletionStatus(EMMCScBkupOwnerDataTypeActiveData); - const TBool dataOwnerIsReady = ( owner.Status() == EDataOwnerReady || - owner.Status() == EDataOwnerReadyNoImpl ); - // - if (!activeDataAlreadyProcessed) - { - if (dataOwnerIsReady) - { - __ASSERT_ALWAYS(iRestoreTransferObject->IsActive() == EFalse, User::Invariant()); - // - const RArray& subEntries = entry.Entries(); - iRestoreTransferObject->RequestL( owner, - iStatus, - subEntries ); - __LOG1("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepRestoreL() - trying to restore ACTIVE DATA for SID: 0x%08x", owner.SecureId().iId ); - // - SetActive(); - break; // while loop - } - else - { - // Retry a number of times, but eventually we'll give up - const TInt attemptsSoFar = owner.ActiveDataRetryCount(); - owner.SetActiveDataRetryCount( attemptsSoFar + 1 ); - - if ( attemptsSoFar >= KMMCScBkupNumberOfAttemptsToAllowADOToBecomeReady ) - { - // Give up, this DO is taking too long - owner.SetCompletionStatus( EMMCScBkupOwnerDataTypeActiveData, ETrue ); - __LOG1("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepRestoreL() - ADO with SID: 0x%08x has taken too long to prepare, skipping", owner.SecureId().iId); - } - else - { - // DO is not yet ready, we're going to have to check its - // status again in a while... - iAtLeastOneDataOwnerIsNotYetReady = ETrue; - } - } - } - } - // - CheckNeedToStartRetryTimerL(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousErrorCleanupBackup() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousErrorCleanupBackup( TBool /*aPartial*/, TInt aError ) - { - (void) aError; - __LOG1("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousErrorCleanupBackup() - **** - error: %d", aError ); - - // Reset state and move to next item. Treat the current (badly behaving) item - // as completed/processed. - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - if ( iIndexValueCurrent < dataOwners.Count() ) - { - CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); - owner.SetCompletionStatus( EMMCScBkupOwnerDataTypeActiveData, ETrue ); - - __LOGFILE2("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousErrorCleanupBackup() - **** - error: %d, SID: 0x%08x - ACTIVE data skipped for DO", aError, owner.SecureId().iId ); - } - - CompleteSelf(); - return ETrue; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousErrorCleanupRestore() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousErrorCleanupRestore( TBool /*aPartial*/, TInt aError ) - { - (void) aError; - __LOGFILE1("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousErrorCleanupRestore() - **** - error: %d", aError ); - - CompleteSelf(); - return ETrue; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousCancellation() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousCancellation() - { - if (iTimer.Handle() != KNullHandle ) - { - iTimer.Cancel(); - } - if (iBackupTransferObject) - { - iBackupTransferObject->Cancel(); - } - if (iRestoreTransferObject) - { - iRestoreTransferObject->Cancel(); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::PerformLastRightsBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpActiveData::PerformLastRightsBackupL( TBool /*aPartial*/ ) - { - __LOG1("CMMCScBkupStateArchiveOpActiveData::PerformLastRightsBackupL() - iAtLeastOneDataOwnerIsNotYetReady %d", iAtLeastOneDataOwnerIsNotYetReady ); - - if ( AllDataOwnersHandled() ) - { - // Only write the index if we've handled all the active data owners - CMMCScBkupIndexBase& index = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeActiveData ); - index.StoreL(Driver()); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::AddIndexRecordL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpActiveData::AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ) - { - CMMCScBkupIndexBase& indexBase = aFooter.IndexByType( EMMCScBkupOwnerDataTypeActiveData ); - CMMCScBkupIndexWithIdentifier< TSecureId>& index = static_cast< CMMCScBkupIndexWithIdentifier< TSecureId>& >( indexBase ); - // - index.AddIndexRecordL( aInfo, aDrive, aDataOwner.SecureId() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpActiveData::CheckNeedToStartRetryTimerL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpActiveData::CheckNeedToStartRetryTimerL() - { - // We need to delay until the remaining active data owners are ready - const TBool processingDataHandler = IsActive(); - if ( !processingDataHandler && !AllDataOwnersHandled() && iTimer.Handle() == KNullHandle ) - { - // Implicitly, we have at least one DO that's not yet ready, and - // we have processed as many of the ready DO's as is possible on this - // cycle. Let's wait a few seconds to give the DO's a time to finish - // preparing and then try again. See NextStateId() for how this works. - User::LeaveIfError( iTimer.CreateLocal() ); - - __LOG("CMMCScBkupStateArchiveOpActiveData::CheckNeedToStartRetryTimerL() - SetActive"); - SetActive(); - const TTimeIntervalMicroSeconds32 delay(KMMCScBkupActiveDataOwnerDelayBeforeRetry); - iTimer.After( iStatus, delay ); - } - } - - - - - - - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpArchiveFooter.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpArchiveFooter.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,174 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupStateArchiveOpArchiveFooter implementation -* -* -*/ - -#include "CMMCScBkupStateArchiveOpArchiveFooter.h" - -// System includes -#include -#include -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupArchive.h" -#include "CMMCScBkupArchiveFooter.h" -#include "CMMCScBkupArchiveHeader.h" - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpArchiveFooter::CMMCScBkupStateArchiveOpArchiveFooter() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpArchiveFooter::CMMCScBkupStateArchiveOpArchiveFooter( MMMCScBkupDriver& aDriver ) -: CMMCScBkupState( aDriver ) - { - __LOG1("CMMCScBkupStateArchiveOpArchiveFooter::CMMCScBkupStateArchiveOpArchiveFooter() - 0x%08x", StateId().iUid ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpArchiveFooter::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpArchiveFooter* CMMCScBkupStateArchiveOpArchiveFooter::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateArchiveOpArchiveFooter* self = new(ELeave) CMMCScBkupStateArchiveOpArchiveFooter( aDriver ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpArchiveFooter::StateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpArchiveFooter::StateId() const - { - return KMMCScBkupStateIdArchiveOpArchiveFooter; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpArchiveFooter::NextStateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpArchiveFooter::NextStateId() const - { - TMMCScBkupStateId nextState = KMMCScBkupStateIdOperationComplete; - // - const TMMCScBkupOperationType type = Driver().DrvOperation(); - switch(type) - { - case EMMCScBkupOperationTypeFullBackup: - nextState = KMMCScBkupStateIdOperationComplete; - break; - case EMMCScBkupOperationTypeFullRestore: - nextState = KMMCScBkupStateIdArchiveOpDataOwners; - break; - default: - ASSERT( EFalse ); - break; - } - // - return nextState; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpArchiveFooter::PerformStateInitL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpArchiveFooter::PerformStateInitL() - { - CompleteSelf(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() - { - CMMCScBkupArchive& archive = Driver().DrvArchive(); - CMMCScBkupArchiveFooter& footer = archive.Footer(); - CMMCScBkupArchiveHeader& header = archive.Header(); - // - const TMMCScBkupOperationType type = Driver().DrvOperation(); - switch(type) - { - case EMMCScBkupOperationTypeFullBackup: - __LOG("CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() - EMMCScBkupOperationTypeFullBackup - storing footer..." ); - footer.StoreL(); - break; - case EMMCScBkupOperationTypeFullRestore: - { - __LOG("CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() - EMMCScBkupOperationTypeFullRestore - restoring footer..." ); - - const TMMCScBkupArchiveVector& archiveVector = Driver().DrvADI().ADIOverallArchiveVectorInfo(); - __LOG1("CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() - overall archive length: %d", archiveVector.Length() ); - - const TInt footerLengthFromHeader = header.FooterLength(); - __LOG1("CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() - footer length (read from header): %d", footerLengthFromHeader ); - - const TInt footerStartingOffset = archiveVector.Length() - footerLengthFromHeader; - __LOG1("CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() - footer starting offset: %d", footerStartingOffset ); - - footer.RestoreL( footerStartingOffset ); - - __LOG("CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() - restoring all indicies"); - - // Restore all indicies - CMMCScBkupIndexBase& indexDataOwner = footer.IndexByType(EMMCScBkupOwnerDataTypeDataOwner); - indexDataOwner.RestoreL( Driver() ); - - CMMCScBkupIndexBase& indexSystem = footer.IndexByType( EMMCScBkupOwnerDataTypeSystemData ); - indexSystem.RestoreL( Driver() ); - - CMMCScBkupIndexBase& indexJava = footer.IndexByType( EMMCScBkupOwnerDataTypeJavaData ); - indexJava.RestoreL( Driver() ); - - CMMCScBkupIndexBase& indexPassive = footer.IndexByType( EMMCScBkupOwnerDataTypePassiveData ); - indexPassive.RestoreL( Driver() ); - - CMMCScBkupIndexBase& indexActive = footer.IndexByType( EMMCScBkupOwnerDataTypeActiveData ); - indexActive.RestoreL( Driver() ); - - CMMCScBkupIndexBase& indexPublic = footer.IndexByType( EMMCScBkupOwnerDataTypePublicData ); - indexPublic.RestoreL( Driver() ); - - __LOG("CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() - all indicies restored"); - - break; - } - default: - User::Leave(KErrNotSupported); - break; - } - } - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpArchiveHeader.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpArchiveHeader.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupStateArchiveOpArchiveHeader implementation -* -* -*/ - -#include "CMMCScBkupStateArchiveOpArchiveHeader.h" - -// System includes -#include -#include -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupArchive.h" -#include "CMMCScBkupArchiveHeader.h" - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpArchiveHeader::CMMCScBkupStateArchiveOpArchiveHeader() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpArchiveHeader::CMMCScBkupStateArchiveOpArchiveHeader( MMMCScBkupDriver& aDriver ) -: CMMCScBkupState( aDriver ) - { - __LOG1("CMMCScBkupStateArchiveOpArchiveHeader::CMMCScBkupStateArchiveOpArchiveHeader() - 0x%08x", StateId().iUid ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpArchiveHeader::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpArchiveHeader* CMMCScBkupStateArchiveOpArchiveHeader::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateArchiveOpArchiveHeader* self = new(ELeave) CMMCScBkupStateArchiveOpArchiveHeader( aDriver ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpArchiveHeader::StateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpArchiveHeader::StateId() const - { - return KMMCScBkupStateArchiveOpArchiveHeader; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpArchiveHeader::NextStateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpArchiveHeader::NextStateId() const - { - TMMCScBkupStateId nextState = KMMCScBkupStateIdGetDataOwners; - // - const TMMCScBkupOperationType type = Driver().DrvOperation(); - switch(type) - { - case EMMCScBkupOperationTypeFullBackup: - nextState = KMMCScBkupStateIdGetDataOwners; - break; - case EMMCScBkupOperationTypeFullRestore: - nextState = KMMCScBkupStateIdArchiveOpArchiveFooter; - break; - default: - ASSERT( EFalse ); - break; - } - // - return nextState; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpArchiveHeader::PerformStateInitL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpArchiveHeader::PerformStateInitL() - { - CompleteSelf(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpArchiveHeader::PerformAsynchronousStateStepL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpArchiveHeader::PerformAsynchronousStateStepL() - { - CMMCScBkupArchive& archive = Driver().DrvArchive(); - CMMCScBkupArchiveHeader& header = archive.Header(); - // - const TMMCScBkupOperationType type = Driver().DrvOperation(); - switch(type) - { - case EMMCScBkupOperationTypeFullBackup: - header.StoreL(archive.Category()); -#ifdef RD_FILE_MANAGER_BACKUP - // Activate crc-calculation for payload data. Header crc'd separately - Driver().DrvADI().ADIActivateCrcCalculation(ETrue); -#endif - break; - case EMMCScBkupOperationTypeFullRestore: - header.RestoreL(); - break; - default: - User::Leave(KErrNotSupported); - break; - } - } - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpDataOwners.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpDataOwners.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,272 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CMMCScBkupStateArchiveOpDataOwners implementation -* -* -*/ - -#include "CMMCScBkupStateArchiveOpDataOwners.h" - -// System includes -#include -#include -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupArchive.h" -#include "RMMCScBkupProgressSizer.h" -#include "CMMCScBkupArchiveFooter.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "CMMCScBkupIndexDataOwners.h" -#include "MMMCScBkupProgressObserver.h" -#include "CMMCScBkupDataOwnerCollection.h" -#include "MMMCScBkupArchiveDataInterface.h" - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpDataOwners::CMMCScBkupStateArchiveOpDataOwners() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpDataOwners::CMMCScBkupStateArchiveOpDataOwners( MMMCScBkupDriver& aDriver ) -: CMMCScBkupStateOpAware( aDriver ), iIndexValueCurrent( -1 ) - { - __LOG1("CMMCScBkupStateArchiveOpDataOwners::CMMCScBkupStateArchiveOpDataOwners() - 0x%08x", StateId().iUid ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpDataOwners::~CMMCScBkupStateArchiveOpDataOwners() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpDataOwners::~CMMCScBkupStateArchiveOpDataOwners() - { - Cancel(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpDataOwners::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpDataOwners* CMMCScBkupStateArchiveOpDataOwners::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateArchiveOpDataOwners* self = new(ELeave) CMMCScBkupStateArchiveOpDataOwners( aDriver ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpDataOwners::StateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpDataOwners::StateId() const - { - return KMMCScBkupStateIdArchiveOpDataOwners; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpDataOwners::NextStateBackupId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpDataOwners::NextStateBackupId( TBool /*aPartial*/ ) const - { - return KMMCScBkupStateIdArchiveOpArchiveFooter; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpDataOwners::NextStateRestoreId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpDataOwners::NextStateRestoreId( TBool /*aPartial*/ ) const - { - return KMMCScBkupStateIdValidateDiskSpace; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpDataOwners::PerformStateInitBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpDataOwners::PerformStateInitBackupL( TBool /*aPartial*/ ) - { - // Work is carried out inside asynchronous step - CompleteSelf(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpDataOwners::PerformStateInitRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpDataOwners::PerformStateInitRestoreL( TBool /*aPartial*/ ) - { - // Restore each data owner asynchronously - CompleteSelf(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousStateStepBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousStateStepBackupL( TBool /*aPartial*/ ) - { - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - CMMCScBkupArchiveFooter& footer = Driver().DrvArchive().Footer(); - CMMCScBkupIndexBase& indexBase = footer.IndexByType(EMMCScBkupOwnerDataTypeDataOwner); - CMMCScBkupIndexDataOwners& index = static_cast< CMMCScBkupIndexDataOwners& >( indexBase ); - const TInt count = dataOwners.Count(); - // - if ( ++iIndexValueCurrent < count ) - { - CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); - - // Externalise - MMMCScBkupArchiveDataInterface& archiveDataInterface = ADI(); - RWriteStream stream( archiveDataInterface.ADIWriteStreamUncompressedLC() ); - stream << owner; - stream.CommitL(); - CleanupStack::PopAndDestroy(); // stream - - - // Save the offset of the data owner - const TMMCScBkupArchiveVector& info = archiveDataInterface.ADICurrentArchiveVectorInfo(); - index.AddIndexRecordL( info ); - - // Now move on to the next data owner - CompleteSelf(); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousStateStepRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousStateStepRestoreL( TBool /*aPartial*/ ) - { - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - CMMCScBkupArchiveFooter& footer = Driver().DrvArchive().Footer(); - CMMCScBkupIndexBase& indexBase = footer.IndexByType( EMMCScBkupOwnerDataTypeDataOwner ); - CMMCScBkupIndexDataOwners& index = static_cast< CMMCScBkupIndexDataOwners& >( indexBase ); - const TInt count = index.Count(); - __LOG1( "CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousStateStepRestoreL() - %d data owner index records...", count ); - // - if ( ++iIndexValueCurrent < count ) - { - const TMMCScBkupArchiveVector& entry = index.At( iIndexValueCurrent ); - __LOG3( "CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousStateStepRestoreL() - entry[%03d] at offset: 0x%08x, length: %4d", iIndexValueCurrent, entry.Offset(), entry.Length() ); - - MMMCScBkupArchiveDataInterface& archiveDataInterface = ADI(); - RReadStream stream( archiveDataInterface.ADIReadStreamUncompressedLC( entry.Offset() ) ); - - // Internalize a new entry and add it to the data owner collection - CMMCScBkupDataOwnerInfo* dataOwner = CMMCScBkupDataOwnerInfo::NewLC( stream ); - dataOwners.AppendL( dataOwner ); - CleanupStack::Pop( dataOwner ); - - // Tidy up & check that we didn't read too much - oops - const TMMCScBkupArchiveVector& readInfo = archiveDataInterface.ADICurrentArchiveVectorInfo(); - if ( readInfo.Length() > entry.Length() ) - { - __LOG( "CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousStateStepRestoreL() - ERROR - Read too much data! -> leave with KErrCorrupt" ); - User::Leave( KErrCorrupt ); - } - CleanupStack::PopAndDestroy(); // stream - - // Continue to next entry - CompleteSelf(); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpDataOwners::PerformLastRightsBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpDataOwners::PerformLastRightsBackupL( TBool /*aPartial*/ ) - { - CMMCScBkupIndexBase& index = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeDataOwner ); - index.StoreL( Driver() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpDataOwners::PerformLastRightsRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpDataOwners::PerformLastRightsRestoreL( TBool /*aPartial*/ ) - { - // Calculate restore byte size (for all drives) - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - const TInt64 totalDataRestoreSize = dataOwners.TotalOperationalSizeL(); - - // Inform progress manager - if(Driver().DrvLastCategory()) - { - __LOG2("CMMCScBkupStateArchiveOpDataOwners::PerformLastRightsRestoreL() - report progress understood (%Ld + %Ld)", - totalDataRestoreSize, Driver().DrvTotalProgress()); - Driver().DrvProgressHandler().MMCScBkupHandleProgressDomainUnderstood( totalDataRestoreSize + Driver().DrvTotalProgress()); - } - else - { - __LOG2("CMMCScBkupStateArchiveOpDataOwners::PerformLastRightsRestoreL() - adding progress amount %Ld to existing %Ld)", - totalDataRestoreSize, Driver().DrvTotalProgress()); - Driver().DrvStoreTotalProgress( totalDataRestoreSize ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousErrorCleanupRestore() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousErrorCleanupRestore( TBool /*aPartial*/, TInt aError ) - { - (void) aError; - __LOGFILE1("CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousErrorCleanupRestore() - **** - error: %d", aError ); - - // Just try to skip the data owner. - CompleteSelf(); - return ETrue; - } - - - - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpJavaData.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpJavaData.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,548 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupStateArchiveOpJavaData implementation -* -* -*/ - -#include "CMMCScBkupStateArchiveOpJavaData.h" - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupDataOwnerCollection.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "MMCScBkupSBEUtils.h" -#include "CMMCScBkupArchive.h" -#include "CMMCScBkupArchiveFooter.h" -#include "CMMCScBkupIndexJavaData.h" -#include "MMMCScBkupArchiveDataInterface.h" - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::CMMCScBkupStateArchiveOpJavaData() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpJavaData::CMMCScBkupStateArchiveOpJavaData( MMMCScBkupDriver& aDriver ) -: CMMCScBkupStateOpAware( aDriver ), iIndexValueCurrent( -1 ) - { - __LOG1("CMMCScBkupStateArchiveOpJavaData::CMMCScBkupStateArchiveOpJavaData() - 0x%08x", StateId().iUid ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::~CMMCScBkupStateArchiveOpJavaData() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpJavaData::~CMMCScBkupStateArchiveOpJavaData() - { - Cancel(); - // - delete iBackupTransferObjectMidlet; - delete iBackupTransferObjectMidletData; - delete iRestoreTransferObjectMidlet; - delete iRestoreTransferObjectMidletData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpJavaData* CMMCScBkupStateArchiveOpJavaData::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateArchiveOpJavaData* self = new(ELeave) CMMCScBkupStateArchiveOpJavaData( aDriver ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::StateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpJavaData::StateId() const - { - return KMMCScBkupStateIdArchiveOpJavaData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::NextStateBackupId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpJavaData::NextStateBackupId( TBool /*aPartial*/ ) const - { - return KMMCScBkupStateIdGetDataOwnerStatuses; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::NextStateRestoreId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpJavaData::NextStateRestoreId( TBool /*aPartial*/ ) const - { - return KMMCScBkupStateIdArchiveOpPassiveData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::PerformStateInitBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpJavaData::PerformStateInitBackupL( TBool /*aPartial*/ ) - { - __LOG("CMMCScBkupStateArchiveOpJavaData::PerformStateInitBackupL() - START" ); - __DEBUG_TESTING_SKIP_BACKUP_JAV_DATA; - - iBackupTransferObjectMidlet = CMMCScBkupWriteDataTransferRequest< TJavaTransferType >::NewL( - Driver(), - *this, - EMMCScBkupOwnerDataTypeJavaData, - EJavaTransferDerivedType, - EJavaMIDlet - ); - - iBackupTransferObjectMidletData = CMMCScBkupWriteDataTransferRequest< TJavaTransferType >::NewL( - Driver(), - *this, - EMMCScBkupOwnerDataTypePassiveData, - EJavaTransferDerivedType, - EJavaMIDletData - ); - - CompleteSelf(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL( TBool /*aPartial*/ ) - { - __LOG("CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL() - START" ); - __DEBUG_TESTING_SKIP_RESTORE_JAV_DATA; - - - iRestoreTransferObjectMidlet = CMMCScBkupReadDataTransferRequest< TJavaTransferType >::NewL( - Driver(), - EMMCScBkupOwnerDataTypeJavaData, - EJavaMIDlet - ); - - iRestoreTransferObjectMidletData = CMMCScBkupReadDataTransferRequest< TJavaTransferType >::NewL( - Driver(), - EMMCScBkupOwnerDataTypePassiveData, - EJavaMIDletData - ); - - CompleteSelf(); - __LOG("CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL() - END" ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL( TBool /*aPartial*/ ) - { - __LOG1("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() - START - iCurrentJavaState: %d", iCurrentJavaState ); - - switch( iCurrentJavaState ) - { - case EJavaStateIdle: - __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() - EJavaStateIdle"); - BackupMidletL(); - break; - case EJavaStateMidlet: - __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() - EJavaStateMidlet"); - BackupMidletDataL(); - break; - case EJavaStateMidletData: - __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() - EJavaStateMidletData"); - iCurrentJavaState = EJavaStateIdle; - CompleteSelf(); - break; - default: - break; - } - - __LOG2("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() - END - iCurrentJavaState: %d, IsActive: %d", iCurrentJavaState, IsActive() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL( TBool /*aPartial*/ ) - { - __LOG1("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() - START - iCurrentJavaState: %d", iCurrentJavaState ); - - switch( iCurrentJavaState ) - { - case EJavaStateIdle: - __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() - EJavaStateIdle"); - RestoreMidletL(); - break; - case EJavaStateMidlet: - __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() - EJavaStateMidlet"); - RestoreMidletDataL(); - break; - case EJavaStateMidletData: - __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() - EJavaStateMidletData"); - iCurrentJavaState = EJavaStateIdle; - CompleteSelf(); - break; - default: - break; - } - - __LOG2("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() - END - iCurrentJavaState: %d, IsActive: %d", iCurrentJavaState, IsActive() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup( TBool /*aPartial*/, TInt aError ) - { - (void) aError; - __LOG1("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup() - error: %d", aError ); - - // Reset state and move to next item. Treat the current (badly behaving) item - // as completed/processed. - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - if ( iIndexValueCurrent < dataOwners.Count() ) - { - CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); - owner.SetCompletionStatus( EMMCScBkupOwnerDataTypeJavaData, ETrue ); - iCurrentJavaState = EJavaStateIdle; - - __LOGFILE2("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup() - **** - error: %d, SID: 0x%08x - JAVA data skipped for DO", aError, owner.SecureId().iId ); - } - - CompleteSelf(); - return ETrue; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupRestore() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupRestore( TBool /*aPartial*/, TInt aError ) - { - (void) aError; - __LOGFILE1("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupRestore() - **** - error: %d", aError ); - - iCurrentJavaState = EJavaStateIdle; - CompleteSelf(); - return ETrue; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousCancellation() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousCancellation() - { - if (iBackupTransferObjectMidlet) - { - iBackupTransferObjectMidlet->Cancel(); - } - if (iBackupTransferObjectMidletData) - { - iBackupTransferObjectMidletData->Cancel(); - } - if (iRestoreTransferObjectMidlet) - { - iRestoreTransferObjectMidlet->Cancel(); - } - if (iRestoreTransferObjectMidletData) - { - iRestoreTransferObjectMidletData->Cancel(); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::PerformLastRightsBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpJavaData::PerformLastRightsBackupL( TBool /*aPartial*/ ) - { - CMMCScBkupIndexBase& index = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeJavaData ); - index.StoreL( Driver() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::PerformLastRightsRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpJavaData::PerformLastRightsRestoreL( TBool /*aPartial*/ ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::AddIndexRecordL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpJavaData::AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ) - { - CMMCScBkupIndexBase& indexBase = aFooter.IndexByType( EMMCScBkupOwnerDataTypeJavaData ); - CMMCScBkupIndexJavaData& index = static_cast< CMMCScBkupIndexJavaData& >( indexBase ); - // - TJavaTransferType type = EJavaMIDlet; - HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( aDataOwner.Owner().Identifier() ); - // - if ( iCurrentJavaState == EJavaStateMidlet ) - { - __LOG4("CMMCScBkupStateArchiveOpJavaData::AddIndexRecordL() - hash: %S, aDrive: %c:, offset: %8d, length: %8d, type: EJavaMIDlet", hash, aDrive + 'A', aInfo.Offset(), aInfo.Length() ); - type = EJavaMIDlet; - } - else if ( iCurrentJavaState == EJavaStateMidletData ) - { - __LOG4("CMMCScBkupStateArchiveOpJavaData::AddIndexRecordL() - hash: %S, aDrive: %c:, offset: %8d, length: %8d, type: EJavaMIDletData", hash, aDrive + 'A', aInfo.Offset(), aInfo.Length() ); - type = EJavaMIDletData; - } - // - index.AddIndexRecordL( aInfo, *hash, aDrive, type ); - CleanupStack::PopAndDestroy( hash ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::BackupMidletL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpJavaData::BackupMidletL() - { - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - const TInt count = dataOwners.Count(); - // - while ( ++iIndexValueCurrent < count ) - { - CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); - // - if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypeJavaData ) == EFalse ) - { -#ifdef __MMCSCBKUPLOGGING_ENABLED__ - HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( owner.Owner().Identifier() ); - __LOG1("CMMCScBkupStateArchiveOpJavaData::BackupMidletL() - trying to get midlet for hash: %S", hash ); - CleanupStack::PopAndDestroy( hash ); -#endif - - iBackupTransferObjectMidlet->RequestL( owner, - iStatus, - Driver().DrvParamsBase().DriveAndOperations() ); - SetActive(); - iCurrentJavaState = EJavaStateMidlet; - - break; // while loop - } - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::BackupMidletDataL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpJavaData::BackupMidletDataL() - { - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); - - // We only need to request the midlet's passive data if it has a non-zero - // size. - if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypePassiveData ) == EFalse ) - { - if ( owner.OperationalSize( EMMCScBkupOwnerDataTypePassiveData ) > 0 ) - { -#ifdef __MMCSCBKUPLOGGING_ENABLED__ - HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( owner.Owner().Identifier() ); - __LOG1("CMMCScBkupStateArchiveOpJavaData::BackupMidletDataL() - trying to get midlet data for hash: %S", hash ); - CleanupStack::PopAndDestroy( hash ); -#endif - - iBackupTransferObjectMidletData->RequestL( owner, - iStatus, - Driver().DrvParamsBase().DriveAndOperations() ); - SetActive(); - } - else - { - CompleteSelf(); - } - } - else - { - CompleteSelf(); - } - - iCurrentJavaState = EJavaStateMidletData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() - { - CMMCScBkupIndexBase& indexBase = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeJavaData ); - CMMCScBkupIndexJavaData& index = static_cast< CMMCScBkupIndexJavaData& >( indexBase ); - - const TInt count = index.Count(); - __LOG1("CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() - START - %d data owners...", count ); - // - if ( ++iIndexValueCurrent < count ) - { - __LOG2("CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() - getting java data index record [%03d/%03d]", iIndexValueCurrent, count); - const CMMCScBkupIndexJavaDataEntry& entry = index.At( iIndexValueCurrent ); - - // Get the associated data owner - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - - __LOG1("CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() - trying to get data owner info for hash: %S", &entry.Hash() ); - CMMCScBkupDataOwnerInfo& owner = dataOwners.OwnerL( entry.Hash() ); - - if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypeJavaData ) == EFalse ) - { - // Request all the java data (on all supported drives) for this - // particular data owner - __LOG3("CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() - trying to restore JAVA MIDLET for hash: %S [offset: %8d, length: %8d]", &entry.Hash(), entry.MidletInfo().Offset(), entry.MidletInfo().Length() ); - - // Build restore entry list (will only contain one entry - the - // reader API forces an array interface on us, so let's do ou best - // to please it...) - const TMMCScBkupArchiveDriveAndVector driveAndVector( entry.Drive(), entry.MidletInfo() ); - iRestoreEntries.Reset(); - iRestoreEntries.AppendL( driveAndVector ); - - // Start the asynchronous restore op... - iRestoreTransferObjectMidlet->RequestL( owner, - iStatus, - iRestoreEntries ); - SetActive(); - } - else - { - CompleteSelf(); - } - - iCurrentJavaState = EJavaStateMidlet; - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - { - CMMCScBkupIndexBase& indexBase = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeJavaData ); - CMMCScBkupIndexJavaData& index = static_cast< CMMCScBkupIndexJavaData& >( indexBase ); - - const TInt count = index.Count(); - __LOG1("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - START - %d data owners...", count ); - // - if ( iIndexValueCurrent < count ) - { - __LOG2("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - getting java data index record [%03d/%03d]", iIndexValueCurrent, count); - const CMMCScBkupIndexJavaDataEntry& entry = index.At( iIndexValueCurrent ); - - if ( entry.HasMidletDataInfo() ) - { - // Get the associated data owner - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - - __LOG1("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - trying to get data owner info for hash: %S", &entry.Hash() ); - CMMCScBkupDataOwnerInfo& owner = dataOwners.OwnerL( entry.Hash() ); - - if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypePassiveData ) == EFalse ) - { - // Request all the java data (on all supported drives) for this - // particular data owner - __LOG3("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - trying to restore JAVA MIDLET DATA for hash: %S [offset: %8d, length: %8d]", &entry.Hash(), entry.MidletDataInfo().Offset(), entry.MidletDataInfo().Length() ); - - // Build restore entry list (will only contain one entry - the - // reader API forces an array interface on us, so let's do ou best - // to please it...) - const TMMCScBkupArchiveDriveAndVector driveAndVector( entry.Drive(), entry.MidletDataInfo() ); - iRestoreEntries.Reset(); - iRestoreEntries.AppendL( driveAndVector ); - - // Start the asynchronous restore op... - iRestoreTransferObjectMidletData->RequestL( owner, - iStatus, - iRestoreEntries ); - SetActive(); - } - else - { - CompleteSelf(); - } - } - else - { - CompleteSelf(); - } - } - else - { - CompleteSelf(); - } - - iCurrentJavaState = EJavaStateMidletData; - } - - - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpPassiveData.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpPassiveData.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,309 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupStateArchiveOpPassiveData implementation -* -* -*/ - -#include "CMMCScBkupStateArchiveOpPassiveData.h" - -// User includes -#include "MMCScBkupLogger.h" -#include "MMCScBkupSBEUtils.h" -#include "CMMCScBkupArchive.h" -#include "CMMCScBkupArchiveFooter.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "CMMCScBkupDataOwnerCollection.h" -#include "CMMCScBkupIndexWithIdentifier.h" -#include "MMMCScBkupArchiveDataInterface.h" - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPassiveData::CMMCScBkupStateArchiveOpPassiveData() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpPassiveData::CMMCScBkupStateArchiveOpPassiveData( MMMCScBkupDriver& aDriver ) -: CMMCScBkupStateOpAware( aDriver ), iIndexValueCurrent( -1 ) - { - __LOG1("CMMCScBkupStateArchiveOpPassiveData::CMMCScBkupStateArchiveOpPassiveData() - 0x%08x", StateId().iUid ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPassiveData::~CMMCScBkupStateArchiveOpPassiveData() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpPassiveData::~CMMCScBkupStateArchiveOpPassiveData() - { - Cancel(); - // - delete iBackupTransferObject; - delete iRestoreTransferObject; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPassiveData::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpPassiveData* CMMCScBkupStateArchiveOpPassiveData::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateArchiveOpPassiveData* self = new(ELeave) CMMCScBkupStateArchiveOpPassiveData( aDriver ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPassiveData::StateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpPassiveData::StateId() const - { - return KMMCScBkupStateIdArchiveOpPassiveData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPassiveData::NextStateBackupId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpPassiveData::NextStateBackupId( TBool /*aPartial*/ ) const - { - return KMMCScBkupStateIdArchiveOpDataOwners; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPassiveData::NextStateRestoreId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpPassiveData::NextStateRestoreId( TBool /*aPartial*/ ) const - { - return KMMCScBkupStateIdGetDataOwnerStatuses; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPassiveData::PerformStateInitBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPassiveData::PerformStateInitBackupL( TBool /*aPartial*/ ) - { - __DEBUG_TESTING_SKIP_BACKUP_PAS_DATA; - - iBackupTransferObject = CMMCScBkupWriteDataTransferRequest::NewL( - Driver(), - *this, - EMMCScBkupOwnerDataTypePassiveData, - ESIDTransferDerivedType, - Driver().DrvParamsBase().PassiveTransferType() - ); - CompleteSelf(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPassiveData::PerformStateInitRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPassiveData::PerformStateInitRestoreL( TBool /*aPartial*/ ) - { - __DEBUG_TESTING_SKIP_RESTORE_PAS_DATA; - - iRestoreTransferObject = CMMCScBkupReadDataTransferRequest< TTransferDataType >::NewL( - Driver(), - EMMCScBkupOwnerDataTypePassiveData, - Driver().DrvParamsBase().PassiveTransferType() - ); - - CompleteSelf(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousStateStepBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousStateStepBackupL( TBool /*aPartial*/ ) - { - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - const TInt count = dataOwners.Count(); - // - while ( ++iIndexValueCurrent < count ) - { - CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); - // - if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypePassiveData ) == EFalse ) - { - __LOG1("CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousStateStepBackupL() - trying to backup DO 0x%08x", owner.SecureId().iId ); - - // Request all the passive data (on all supported drives) for this - // particular data owner - __ASSERT_ALWAYS( iBackupTransferObject->IsActive() == EFalse, User::Invariant() ); - // - iBackupTransferObject->RequestL( owner, - iStatus, - Driver().DrvParamsBase().DriveAndOperations() ); - SetActive(); - break; // while loop - } - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousStateStepRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousStateStepRestoreL( TBool /*aPartial*/ ) - { - CMMCScBkupIndexBase& indexBase = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypePassiveData ); - CMMCScBkupIndexWithIdentifier< TSecureId>& index = static_cast< CMMCScBkupIndexWithIdentifier& >( indexBase ); - const TInt count = index.Count(); - // - if ( ++iIndexValueCurrent < count ) - { - const CMMCScBkupIndexEntry& entry = index.At( iIndexValueCurrent ); - const RArray& subEntries = entry.Entries(); - - // Get the associated data owner - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - CMMCScBkupDataOwnerInfo& owner = dataOwners.OwnerL( entry.Identifier() ); - - if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypePassiveData ) == EFalse ) - { - __LOG1("CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousStateStepRestoreL() - trying to restore DO 0x%08x", owner.SecureId().iId ); - - - // Request all the registration data (on all supported drives) for this - // particular data owner - __ASSERT_ALWAYS( iRestoreTransferObject->IsActive() == EFalse, User::Invariant() ); - // - __LOG1("CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousStateStepRestoreL() - trying to restore PASSIVE DATA for SID: 0x%08x", owner.SecureId().iId ); - // - iRestoreTransferObject->RequestL( owner, - iStatus, - subEntries ); - SetActive(); - } - else - { - CompleteSelf(); - } - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousErrorCleanupBackup() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousErrorCleanupBackup( TBool /*aPartial*/, TInt aError ) - { - (void) aError; - __LOG1("CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousErrorCleanupBackup() - **** - error: %d", aError ); - - // Reset state and move to next item. Treat the current (badly behaving) item - // as completed/processed. - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - if ( iIndexValueCurrent < dataOwners.Count() ) - { - CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); - owner.SetCompletionStatus( EMMCScBkupOwnerDataTypePassiveData, ETrue ); - - __LOGFILE1("CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousErrorCleanupBackup() - **** - PASSIVE data skipped for SID: 0x%08x", owner.SecureId().iId ); - } - - CompleteSelf(); - return ETrue; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousErrorCleanupRestore() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousErrorCleanupRestore( TBool /*aPartial*/, TInt aError ) - { - (void) aError; - __LOGFILE1("CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousErrorCleanupRestore() - **** - error: %d", aError ); - - CompleteSelf(); - return ETrue; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousCancellation() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousCancellation() - { - if (iBackupTransferObject) - { - iBackupTransferObject->Cancel(); - } - if (iRestoreTransferObject) - { - iRestoreTransferObject->Cancel(); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPassiveData::PerformLastRightsBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPassiveData::PerformLastRightsBackupL( TBool /*aPartial*/ ) - { - CMMCScBkupIndexBase& index = Driver().DrvArchive().Footer().IndexByType(EMMCScBkupOwnerDataTypePassiveData); - index.StoreL(Driver()); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPassiveData::AddIndexRecordL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPassiveData::AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ) - { - CMMCScBkupIndexBase& indexBase = aFooter.IndexByType( EMMCScBkupOwnerDataTypePassiveData ); - CMMCScBkupIndexWithIdentifier< TSecureId>& index = static_cast< CMMCScBkupIndexWithIdentifier< TSecureId>& >( indexBase ); - // - index.AddIndexRecordL( aInfo, aDrive, aDataOwner.SecureId() ); - __LOG3("CMMCScBkupStateArchiveOpPassiveData::AddIndexRecordL() - offset: %6d, length: %6d, secureId: 0x%08x", aInfo.Offset(), aInfo.Length(), aDataOwner.SecureId().iId ); - } - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpPublicDataFiles.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpPublicDataFiles.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,443 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupStateArchiveOpPublicDataFiles implementation -* -* -*/ - -#include "CMMCScBkupStateArchiveOpPublicDataFiles.h" - -// System includes -#include -#include -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "MMCScBkupConfig.h" -#include "CMMCScBkupArchive.h" -#include "CMMCScBkupArchiveFooter.h" -#include "CMMCScBkupIndexPublicDataFiles.h" -#include "MMMCScBkupArchiveDataInterface.h" -#include "CMMCScBkupFileInfo.h" -#include "CMMCScBkupFileListCollection.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "CMMCScBkupDataOwnerCollection.h" -#include "MMCScBkupOperations.h" - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::CMMCScBkupStateArchiveOpPublicDataFiles() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpPublicDataFiles::CMMCScBkupStateArchiveOpPublicDataFiles( MMMCScBkupDriver& aDriver ) -: CMMCScBkupStateOpAware( aDriver ), iIndexValueCurrent( -1 ) - { - __LOG1("CMMCScBkupStateArchiveOpPublicDataFiles::CMMCScBkupStateArchiveOpPublicDataFiles() - 0x%08x", StateId().iUid ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpPublicDataFiles* CMMCScBkupStateArchiveOpPublicDataFiles::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateArchiveOpPublicDataFiles* self = new(ELeave) CMMCScBkupStateArchiveOpPublicDataFiles( aDriver ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::StateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpPublicDataFiles::StateId() const - { - return KMMCScBkupStateIdArchiveOpPublicDataFiles; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::NextStateBackupId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpPublicDataFiles::NextStateBackupId( TBool /*aPartial*/ ) const - { - return KMMCScBkupStateIdArchiveOpSystemData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::NextStateRestoreId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpPublicDataFiles::NextStateRestoreId( TBool /*aPartial*/ ) const - { - return KMMCScBkupStateIdOperationComplete; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::PerformStateInitBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPublicDataFiles::PerformStateInitBackupL( TBool /*aPartial*/ ) - { - __DEBUG_TESTING_SKIP_BACKUP_PUB_DATA; - - CompleteSelf(); - SetState( EStateCommonKickOff ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::PerformStateInitRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPublicDataFiles::PerformStateInitRestoreL( TBool /*aPartial*/ ) - { - __DEBUG_TESTING_SKIP_RESTORE_PUB_DATA; - - CompleteSelf(); - SetState( EStateCommonKickOff ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousStateStepBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousStateStepBackupL( TBool /*aPartial*/ ) - { - const TState justFinishedExecutingState = State(); - // - switch( justFinishedExecutingState ) - { - case EStateCommonKickOff: - CompressingAndWritingFileL(); - break; - case EStateCommonProcessingFile: - AddIndexRecordL(); - break; - case EStateBackupAddIndexRecord: - SetState( EStateCommonKickOff ); - CompleteSelf(); - break; - default: - ASSERT( EFalse ); - break; - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousStateStepRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousStateStepRestoreL( TBool /*aPartial*/ ) - { - const TState justFinishedExecutingState = State(); - // - switch( justFinishedExecutingState ) - { - case EStateCommonKickOff: - DecompressingAndWritingFileL(); - break; - case EStateCommonProcessingFile: - RestoreFileAttributesL(); - break; - case EStateRestoreResetAttributes: - SetState( EStateCommonKickOff ); - CompleteSelf(); - break; - default: - ASSERT( EFalse ); - break; - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupBackup() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupBackup( TBool /*aPartial*/, TInt aError ) - { - (void) aError; - __LOG1("CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupBackup() - **** - error: %d", aError ); - TBool continueProcessing = ETrue; - - // Reset state and move to next item. Treat the current (badly behaving) item - // as completed/processed. - const CMMCScBkupFileListCollection& fileList = Driver().DrvFileList(); - if ( iIndexValueCurrent < fileList.Count() ) - { - const CMMCScBkupFileInfo& fileInfo = fileList.Entry(iIndexValueCurrent); - (void) fileInfo; - - __LOGFILE2("CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupBackup() - **** - error: %d, file: %S - public data skipped", aError, &fileInfo.FileName()); - - // Ensures that asynchronous state step is called again.. - CompleteSelf(); - SetState( EStateCommonKickOff ); - } - - return continueProcessing; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupRestore() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupRestore( TBool /*aPartial*/, TInt aError ) - { - (void) aError; - __LOG1("CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupRestore() - **** - error: %d", aError ); - TBool continueProcessing = ETrue; - - CMMCScBkupArchiveFooter& footer = Driver().DrvArchive().Footer(); - CMMCScBkupIndexPublicDataFiles& index = static_cast( footer.IndexByType( EMMCScBkupOwnerDataTypePublicData ) ); - const TInt count = index.Count(); - // - if ( iIndexValueCurrent < count ) - { - // Get the entry to restore - TMMCScBkupArchiveVector entryInfo; - const CMMCScBkupFileInfo& fileInfo = index.At( iIndexValueCurrent, entryInfo ); - (void) fileInfo; - - __LOGFILE2("CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupRestore() - **** - error: %d, file: %S - public data skipped", aError, &fileInfo.FileName()); - - // Try to restore the next public file - //SetState( EStateCommonKickOff ); - SetState( EStateCommonProcessingFile ); - CompleteSelf(); - } - - return continueProcessing; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousCancellation() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousCancellation() - { - switch( State() ) - { - case EStateCommonProcessingFile: - // Asynchronous request issued to ADI. - Driver().DrvADI().ADIAsynchronousCancel(); - break; - - case EStateCommonKickOff: - case EStateBackupAddIndexRecord: - case EStateRestoreResetAttributes: - // Other states complete this objects own request status => no action - // needed. - break; - - default: - case EStateCommonIdle: - ASSERT( EFalse ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::PerformLastRightsBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPublicDataFiles::PerformLastRightsBackupL( TBool /*aPartial*/ ) - { - CMMCScBkupIndexBase& index = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypePublicData ); - index.StoreL( Driver() ); - - Driver().DrvADI().ADIResetResources(EMMCScBkupOperationTypeFullBackup); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::PerformLastRightsRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPublicDataFiles::PerformLastRightsRestoreL( TBool /*aPartial*/ ) - { - Driver().DrvADI().ADIResetResources(EMMCScBkupOperationTypeFullRestore); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::CompressingAndWritingFileL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPublicDataFiles::CompressingAndWritingFileL() - { - const CMMCScBkupFileListCollection& fileList = Driver().DrvFileList(); - const TInt count = fileList.Count(); - // - if ( ++iIndexValueCurrent < count ) - { - const CMMCScBkupFileInfo& fileInfo = fileList.Entry(iIndexValueCurrent); - - __LOG1("CMMCScBkupStateArchiveOpPublicDataFiles::CompressingAndWritingFileL() - BACKUP - compressing file: %S", &fileInfo.FileName()); - - // Compress the file & externalise it to the archive - Driver().DrvADI().ADIWriteFileL( fileInfo.FileName(), iStatus ); - - // Indicate the state we are in - SetActive(); - SetState( EStateCommonProcessingFile ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::DecompressingAndWritingFileL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPublicDataFiles::DecompressingAndWritingFileL() - { - CMMCScBkupArchiveFooter& footer = Driver().DrvArchive().Footer(); - CMMCScBkupIndexPublicDataFiles& index = static_cast( footer.IndexByType( EMMCScBkupOwnerDataTypePublicData ) ); - const TInt count = index.Count(); - // - if ( ++iIndexValueCurrent < count ) - { - // Get the entry to restore - TMMCScBkupArchiveVector entryInfo; - const CMMCScBkupFileInfo& fileInfo = index.At( iIndexValueCurrent, entryInfo ); - - __LOG3("CMMCScBkupStateArchiveOpPublicDataFiles::DecompressingAndWritingFileL() - RESTORE - decompressing file: %S, offset: %8d, length: %8d", &fileInfo.FileName(), entryInfo.Offset(), entryInfo.Length()); - - // Restore it! - Driver().DrvADI().ADIReadFileL( fileInfo.FileName(), entryInfo, iStatus ); - - // Indicate the state we are in - SetActive(); - SetState( EStateCommonProcessingFile ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::AddIndexRecordL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPublicDataFiles::AddIndexRecordL() - { - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - CMMCScBkupArchiveFooter& footer = Driver().DrvArchive().Footer(); - CMMCScBkupIndexPublicDataFiles& index = static_cast(footer.IndexByType(EMMCScBkupOwnerDataTypePublicData)); - const CMMCScBkupFileListCollection& fileList = Driver().DrvFileList(); - const CMMCScBkupFileInfo& fileInfo = fileList.Entry(iIndexValueCurrent); - - // Save the offset of the data owner - const TMMCScBkupArchiveVector& info = Driver().DrvADI().ADICurrentArchiveVectorInfo(); - index.AddIndexRecordL( info, fileInfo ); - - // And update the file info so that we can know how much compressed - // data must be read during restore. This allows us to report accurate - // progress info. See CMMCScBkupStateRequestListOfPublicFiles::PerformLastRightsL() - // for the point when the public data size is zeroed. - - // First, find the associated data owner. - CMMCScBkupDataOwnerInfo& owner = dataOwners.OwnerL( fileInfo.SecureId() ); - - __LOG3("CMMCScBkupStateArchiveOpPublicDataFiles::AddIndexRecordL() - offset: %6d, length: %6d, file: %S", info.Offset(), info.Length(), &fileInfo.FileName()); - - // Indicate the state we are in - SetState( EStateBackupAddIndexRecord ); - CompleteSelf(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpPublicDataFiles::RestoreFileAttributesL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpPublicDataFiles::RestoreFileAttributesL() - { - RFs& fsSession = Driver().DrvADI().ADIFsSession(); - CMMCScBkupArchiveFooter& footer = Driver().DrvArchive().Footer(); - CMMCScBkupIndexPublicDataFiles& index = static_cast( footer.IndexByType( EMMCScBkupOwnerDataTypePublicData ) ); - - // Get the entry who's attributes need restoring - TMMCScBkupArchiveVector entryInfo; - const CMMCScBkupFileInfo& fileInfo = index.At( iIndexValueCurrent, entryInfo ); - - // If file is in Photo Album Thumbnail folder - // or file in videocenter folder and its subfolders - if ( fileInfo.FileName().MatchF( KMMCScBkupMediaGalleryThumbnailFolder ) != KErrNotFound ) - { - // Get folder path length - const TChar backslash('\\'); - const TInt pathlength = fileInfo.FileName().LocateReverseF( backslash ) + 1; - - // Set hidden attribute for Thumbnail folder. - // If folder does not exist, create it - fsSession.SetAtt( fileInfo.FileName().Left( pathlength ), KEntryAttHidden, KEntryAttNormal ); - } - - if ( fileInfo.FileName().MatchF( KMMCScBkupVideoCenterFolder ) != KErrNotFound) - { - // Get folder path length - const TChar backslash('\\'); - const TInt pathlength = fileInfo.FileName().LocateReverseF( backslash ) + 1; - - // Set hidden attribute for the video center's sub folder. - // If foler does not exist, create it - fsSession.SetAtt( fileInfo.FileName().Left( pathlength ), KEntryAttHidden, KEntryAttNormal ); - - //Manually set the videocenter main folder to be hidden - fsSession.SetAtt( KMMCScBkupVideoCenterFolderPath, KEntryAttHidden, KEntryAttNormal ); - } - // Set the original attributes, clear the others - const TInt error = fsSession.SetEntry( fileInfo.FileName(), - fileInfo.DateTime(), - fileInfo.Attributes(), - !fileInfo.Attributes() ); - - (void) error; - - - // Indicate the state we are in - SetState( EStateRestoreResetAttributes ); - CompleteSelf(); - } - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpSystemData.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpSystemData.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,367 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupStateArchiveOpSystemData implementation -* -* -*/ - -#include "CMMCScBkupStateArchiveOpSystemData.h" - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupDataOwnerCollection.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "MMCScBkupSBEUtils.h" -#include "CMMCScBkupArchive.h" -#include "CMMCScBkupArchiveFooter.h" -#include "CMMCScBkupIndexWithIdentifier.h" -#include "MMMCScBkupArchiveDataInterface.h" - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::CMMCScBkupStateArchiveOpSystemData() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpSystemData::CMMCScBkupStateArchiveOpSystemData( MMMCScBkupDriver& aDriver ) -: CMMCScBkupStateOpAware( aDriver ), iIndexValueCurrent( -1 ) - { - __LOG1("CMMCScBkupStateArchiveOpSystemData::CMMCScBkupStateArchiveOpSystemData() - 0x%08x", StateId().iUid ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::~CMMCScBkupStateArchiveOpSystemData() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpSystemData::~CMMCScBkupStateArchiveOpSystemData() - { - Cancel(); - // - delete iBackupTransferObject; - delete iRestoreTransferObject; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateArchiveOpSystemData* CMMCScBkupStateArchiveOpSystemData::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateArchiveOpSystemData* self = new(ELeave) CMMCScBkupStateArchiveOpSystemData( aDriver ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::StateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpSystemData::StateId() const - { - return KMMCScBkupStateIdArchiveOpSystemData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::NextStateBackupId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpSystemData::NextStateBackupId( TBool /*aPartial*/ ) const - { - return KMMCScBkupStateIdArchiveOpJavaData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::NextStateRestoreId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateArchiveOpSystemData::NextStateRestoreId( TBool /*aPartial*/ ) const - { - return KMMCScBkupStateIdArchiveOpJavaData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::PerformStateInitBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpSystemData::PerformStateInitBackupL( TBool /*aPartial*/ ) - { - __DEBUG_TESTING_SKIP_BACKUP_SYS_DATA; - - iBackupTransferObject = CMMCScBkupWriteDataTransferRequest< TPackageDataType >::NewL( - Driver(), - *this, - EMMCScBkupOwnerDataTypeSystemData, - EPackageTransferDerivedType, - ESystemData - ); - CompleteSelf(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::PerformStateInitRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpSystemData::PerformStateInitRestoreL( TBool /*aPartial*/ ) - { - __LOG("CMMCScBkupStateArchiveOpSystemData::PerformStateInitRestoreL() - START" ); - __DEBUG_TESTING_SKIP_RESTORE_SYS_DATA; - - iRestoreTransferObject = CMMCScBkupReadDataTransferRequest< TPackageDataType >::NewL( - Driver(), - EMMCScBkupOwnerDataTypeSystemData, - ESystemData - ); - - CompleteSelf(); - __LOG("CMMCScBkupStateArchiveOpSystemData::PerformStateInitRestoreL() - END" ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepBackupL( TBool /*aPartial*/ ) - { - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - const TInt count = dataOwners.Count(); - // - while ( ++iIndexValueCurrent < count ) - { - CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); - // - if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypeSystemData ) == EFalse ) - { - // Request all the system data (on all supported drives) for this - // particular data owner - __ASSERT_ALWAYS( iBackupTransferObject->IsActive() == EFalse, User::Invariant() ); - iBackupTransferObject->RequestL( owner, - iStatus, - Driver().DrvParamsBase().DriveAndOperations() ); - SetActive(); - break; // while loop - } - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepRestoreL( TBool /*aPartial*/ ) - { - CMMCScBkupIndexBase& indexBase = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeSystemData ); - CMMCScBkupIndexWithIdentifier< TInt32 >& index = static_cast< CMMCScBkupIndexWithIdentifier< TInt32 >& >( indexBase ); - const TInt count = index.Count(); - __LOG1("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepRestoreL() - START - %d data owners...", count ); - // - if ( ++iIndexValueCurrent < count ) - { - __LOG2("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepRestoreL() - getting system data index record [%03d/%03d]", iIndexValueCurrent + 1, count); - const CMMCScBkupIndexEntry< TInt32 >& entry = index.At( iIndexValueCurrent ); - iSecureId = entry.Identifier(); - - __LOG("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepRestoreL() - getting sub-entries for index record..."); - const RArray< TMMCScBkupArchiveDriveAndVector >& subEntries = entry.Entries(); - __LOG1("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepRestoreL() - got %d sub-entries for index record", subEntries.Count()); -#ifdef __MMCSCBKUPLOGGING_ENABLED__ - for(TInt i=0; iIsActive() == EFalse, User::Invariant() ); - - // Request all the system data (on all supported drives) for this - // particular data owner - iRestoreTransferObject->RequestL( owner, - iStatus, - subEntries ); - SetActive(); - } - else - { - CompleteSelf(); - } - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupBackup() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupBackup( TBool /*aPartial*/, TInt aError ) - { - (void) aError; - __LOG1("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupBackup() - error: %d", aError ); - - // Reset state and move to next item. Treat the current (badly behaving) item - // as completed/processed. - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - if ( iIndexValueCurrent < dataOwners.Count() ) - { - CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); - owner.SetCompletionStatus( EMMCScBkupOwnerDataTypeSystemData, ETrue ); - - __LOGFILE2("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupBackup() - **** - error: %d, SID: 0x%08x - system data skipped for DO", aError, owner.SecureId().iId ); - } - - CompleteSelf(); - return ETrue; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupRestore() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupRestore( TBool /*aPartial*/, TInt aError ) - { - (void) aError; - __LOGFILE1("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupRestore() - **** - error: %d", aError ); - - // If system data restore phase returns "not supported", let's treat it as - // such an error, that other data types for this data owner are not - // allowed to restore either. - - if( aError == KErrNotSupported || aError == KErrAlreadyExists ) - { - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - CMMCScBkupDataOwnerInfo* owner = NULL; - TRAPD( err, owner = &dataOwners.OwnerL( iSecureId ) ); - if( err == KErrNone && owner ) - { - owner->SetCompletionStatus( EMMCScBkupOwnerDataTypeJavaData, ETrue ); - owner->SetCompletionStatus( EMMCScBkupOwnerDataTypePublicData, ETrue ); - owner->SetCompletionStatus( EMMCScBkupOwnerDataTypeSystemData, ETrue ); - owner->SetCompletionStatus( EMMCScBkupOwnerDataTypeActiveData, ETrue ); - owner->SetCompletionStatus( EMMCScBkupOwnerDataTypePassiveData, ETrue ); - - __LOGFILE2("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupRestore() - **** - error: %d, SID: 0x%08x - all data types skipped for DO", aError, owner->SecureId().iId ); - } - } - - CompleteSelf(); - return ETrue; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousCancellation() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousCancellation() - { - if (iBackupTransferObject) - { - iBackupTransferObject->Cancel(); - } - if (iRestoreTransferObject) - { - iRestoreTransferObject->Cancel(); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::PerformLastRightsBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpSystemData::PerformLastRightsBackupL( TBool /*aPartial*/ ) - { - CMMCScBkupIndexBase& index = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeSystemData ); - index.StoreL( Driver() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::PerformLastRightsRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpSystemData::PerformLastRightsRestoreL( TBool /*aPartial*/ ) - { - Driver().DrvSecureBackupClient().AllSystemFilesRestored(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateArchiveOpSystemData::AddIndexRecordL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateArchiveOpSystemData::AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ) - { - CMMCScBkupIndexBase& indexBase = aFooter.IndexByType( EMMCScBkupOwnerDataTypeSystemData ); - CMMCScBkupIndexWithIdentifier< TInt32 >& index = static_cast< CMMCScBkupIndexWithIdentifier< TInt32 >& >( indexBase ); - index.AddIndexRecordL( aInfo, aDrive, aDataOwner.SecureId().iId ); - } - - - - - - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateFactory.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateFactory.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,332 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupStateFactory implementation -* -* -*/ - -#include "CMMCScBkupStateFactory.h" - -// System includes -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupStateGetDataOwners.h" -#include "CMMCScBkupStateSetPhoneMode.h" -#include "CMMCScBkupStateRequestSizeOfBackupData.h" -#include "CMMCScBkupStateRequestListOfPublicFiles.h" -#include "CMMCScBkupStateGetDataOwnerStatuses.h" -#include "CMMCScBkupStateNotifyAllSnapshotsSupplied.h" -// -#include "CMMCScBkupStateArchiveOpSystemData.h" -#include "CMMCScBkupStateArchiveOpDataOwners.h" -#include "CMMCScBkupStateArchiveOpPublicDataFiles.h" -#include "CMMCScBkupStateArchiveOpActiveData.h" -#include "CMMCScBkupStateArchiveOpJavaData.h" -#include "CMMCScBkupStateArchiveOpPassiveData.h" -#include "CMMCScBkupStateArchiveOpArchiveHeader.h" -#include "CMMCScBkupStateArchiveOpArchiveFooter.h" -#include "CMMCScBkupStateValidateDiskSpace.h" - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateFactory::CMMCScBkupStateFactory() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateFactory::CMMCScBkupStateFactory() - { - } - -// --------------------------------------------------------------------------- -// CMMCScBkupStateFactory::FactoryByOperationTypeLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateFactory* CMMCScBkupStateFactory::FactoryByOperationTypeLC( TMMCScBkupOperationType aOperationType ) - { - CMMCScBkupStateFactory* factory = NULL; - // - switch(aOperationType) - { - case EMMCScBkupOperationTypeFullBackup: - factory = CMMCScBkupStateFactoryBackup::NewL(); - break; - case EMMCScBkupOperationTypeFullRestore: - factory = CMMCScBkupStateFactoryRestore::NewL(); - break; - case EMMCScBkupOperationTypePartialBackup: - case EMMCScBkupOperationTypePartialRestore: - default: - __ASSERT_ALWAYS(EFalse, User::Invariant()); - break; - } - // - CleanupStack::PushL(factory); - return factory; - } - - - - - - - - - - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateFactoryBackup::CMMCScBkupStateFactoryBackup() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateFactoryBackup::CMMCScBkupStateFactoryBackup() - { - } - -// --------------------------------------------------------------------------- -// CMMCScBkupStateFactoryBackup::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateFactoryBackup* CMMCScBkupStateFactoryBackup::NewL() - { - CMMCScBkupStateFactoryBackup* self = new(ELeave) CMMCScBkupStateFactoryBackup(); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateFactoryBackup::GetStateLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupState* CMMCScBkupStateFactoryBackup::GetStateLC( TMMCScBkupStateId aRequiredType, MMMCScBkupDriver& aDriver ) - { - CMMCScBkupState* state = NULL; - // - switch(aRequiredType.iUid) - { - case KMMCScBkupStateIdValueArchiveOpArchiveHeader: - state = CMMCScBkupStateArchiveOpArchiveHeader::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueGetDataOwners: - state = CMMCScBkupStateGetDataOwners::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueSetPhoneMode: - state = CMMCScBkupStateSetPhoneMode::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueNotifyAllSnapshotsSupplied: - state = CMMCScBkupStateNotifyAllSnapshotsSupplied::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueRequestSizeOfBackupData: - state = CMMCScBkupStateRequestSizeOfBackupData::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueArchiveOpDataOwners: - state = CMMCScBkupStateArchiveOpDataOwners::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueRequestListOfPublicFiles: - state = CMMCScBkupStateRequestListOfPublicFiles::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueArchiveOpPublicDataFiles: - state = CMMCScBkupStateArchiveOpPublicDataFiles::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueArchiveOpSystemData: - state = CMMCScBkupStateArchiveOpSystemData::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueArchiveOpJavaData: - state = CMMCScBkupStateArchiveOpJavaData::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueGetDataOwnerStatuses: - state = CMMCScBkupStateGetDataOwnerStatuses::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueArchiveOpActiveData: - state = CMMCScBkupStateArchiveOpActiveData::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueArchiveOpPassiveData: - state = CMMCScBkupStateArchiveOpPassiveData::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueArchiveOpArchiveFooter: - state = CMMCScBkupStateArchiveOpArchiveFooter::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueValidateDiskSpace: - state = CMMCScBkupStateValidateDiskSpace::NewL( aDriver ); - break; - default: - case KMMCScBkupStateIdValueSupplyDataSnapshots: - ASSERT( EFalse ); - User::Leave(KErrNotSupported); - break; - } - // - CleanupStack::PushL(state); - return state; - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateFactoryRestore::CMMCScBkupStateFactoryRestore() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateFactoryRestore::CMMCScBkupStateFactoryRestore() - { - } - -// --------------------------------------------------------------------------- -// CMMCScBkupStateFactoryRestore::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateFactoryRestore* CMMCScBkupStateFactoryRestore::NewL() - { - CMMCScBkupStateFactoryRestore* self = new(ELeave) CMMCScBkupStateFactoryRestore(); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateFactoryRestore::GetStateLC() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupState* CMMCScBkupStateFactoryRestore::GetStateLC( TMMCScBkupStateId aRequiredType, MMMCScBkupDriver& aDriver ) - { - CMMCScBkupState* state = NULL; - // - switch(aRequiredType.iUid) - { - case KMMCScBkupStateIdValueArchiveOpArchiveHeader: - state = CMMCScBkupStateArchiveOpArchiveHeader::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueArchiveOpArchiveFooter: - state = CMMCScBkupStateArchiveOpArchiveFooter::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueArchiveOpDataOwners: - state = CMMCScBkupStateArchiveOpDataOwners::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueSetPhoneMode: - state = CMMCScBkupStateSetPhoneMode::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueArchiveOpSystemData: - state = CMMCScBkupStateArchiveOpSystemData::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueNotifyAllSnapshotsSupplied: - state = CMMCScBkupStateNotifyAllSnapshotsSupplied::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueArchiveOpJavaData: - state = CMMCScBkupStateArchiveOpJavaData::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueArchiveOpPassiveData: - state = CMMCScBkupStateArchiveOpPassiveData::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueGetDataOwnerStatuses: - state = CMMCScBkupStateGetDataOwnerStatuses::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueArchiveOpActiveData: - state = CMMCScBkupStateArchiveOpActiveData::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueArchiveOpPublicDataFiles: - state = CMMCScBkupStateArchiveOpPublicDataFiles::NewL( aDriver ); - break; - case KMMCScBkupStateIdValueValidateDiskSpace: - state = CMMCScBkupStateValidateDiskSpace::NewL( aDriver ); - break; - default: - ASSERT( EFalse ); - User::Leave(KErrNotSupported); - break; - } - // - CleanupStack::PushL(state); - return state; - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateGetDataOwnerStatuses.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateGetDataOwnerStatuses.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,194 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupStateGetDataOwnerStatuses implementation -* -* -*/ - -#include "CMMCScBkupStateGetDataOwnerStatuses.h" - -// System includes -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "CMMCScBkupDataOwnerCollection.h" - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateGetDataOwnerStatuses::CMMCScBkupStateGetDataOwnerStatuses() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateGetDataOwnerStatuses::CMMCScBkupStateGetDataOwnerStatuses( MMMCScBkupDriver& aDriver ) -: CMMCScBkupState( aDriver ) - { - __LOG1("CMMCScBkupStateGetDataOwnerStatuses::CMMCScBkupStateGetDataOwnerStatuses() - 0x%08x", StateId().iUid ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateGetDataOwnerStatuses::~CMMCScBkupStateGetDataOwnerStatuses() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateGetDataOwnerStatuses::~CMMCScBkupStateGetDataOwnerStatuses() - { - Cancel(); - // - iStatusArray.Close(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateGetDataOwnerStatuses::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateGetDataOwnerStatuses* CMMCScBkupStateGetDataOwnerStatuses::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateGetDataOwnerStatuses* self = new(ELeave) CMMCScBkupStateGetDataOwnerStatuses( aDriver ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateGetDataOwnerStatuses::StateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateGetDataOwnerStatuses::StateId() const - { - return KMMCScBkupStateIdGetDataOwnerStatuses; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateGetDataOwnerStatuses::NextStateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateGetDataOwnerStatuses::NextStateId() const - { - return KMMCScBkupStateIdArchiveOpActiveData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateGetDataOwnerStatuses::PerformStateInitL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateGetDataOwnerStatuses::PerformStateInitL() - { - SetState( EPrearingQuery ); - CompleteSelf(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateGetDataOwnerStatuses::PerformAsynchronousStateStepL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateGetDataOwnerStatuses::PerformAsynchronousStateStepL() - { - switch( State() ) - { - case EPrearingQuery: - PrepareQueryL(); - break; - case EGettingStatus: - Driver().DrvSecureBackupClient().SIDStatusL( iStatusArray ); - SetState( EProcessingResults ); - CompleteSelf(); - break; - case EProcessingResults: - ProcessStatusResultsL(); - break; - default: - ASSERT( EFalse ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateGetDataOwnerStatuses::PrepareQueryL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateGetDataOwnerStatuses::PrepareQueryL() - { - const TDataOwnerStatus KMMCScBkupDefaultOwnerStatus = EUnset; - const TInt KMMCScBkupDefaultOwnerStatusError = 0; - - // Build an array of all of the active data owners that we require - // the statuses for. - CMMCScBkupDataOwnerCollection& ownerCollection = Driver().DrvDataOwners(); - const TInt count = ownerCollection.Count(); - for(TInt i=0; iSetStatus( ownerStatus.iStatus ); - } - } - } - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateGetDataOwners.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateGetDataOwners.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,206 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupStateGetDataOwners implementation -* -* -*/ - -#include "CMMCScBkupStateGetDataOwners.h" - -#include -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupDataOwnerCollection.h" -#include "MMCScBkupSBEUtils.h" - -// Constants -const TInt KMMCScBkupDataOwnerGranularity = 20; - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateGetDataOwners::CMMCScBkupStateGetDataOwners() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateGetDataOwners::CMMCScBkupStateGetDataOwners( MMMCScBkupDriver& aDriver ) -: CMMCScBkupState( aDriver ) - { - __LOG1("CMMCScBkupStateGetDataOwners::CMMCScBkupStateGetDataOwners() - 0x%08x", StateId().iUid ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateGetDataOwners::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateGetDataOwners* CMMCScBkupStateGetDataOwners::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateGetDataOwners* self = new(ELeave) CMMCScBkupStateGetDataOwners( aDriver ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateGetDataOwners::StateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateGetDataOwners::StateId() const - { - return KMMCScBkupStateIdGetDataOwners; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateGetDataOwners::NextStateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateGetDataOwners::NextStateId() const - { - // This is the same for backup & restore - return KMMCScBkupStateIdSetPhoneMode; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateGetDataOwners::PerformStateInitL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateGetDataOwners::PerformStateInitL() - { - // Query asynchronously - CompleteSelf(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() - { - RMMCScBkupPointerArray dataOwners(KMMCScBkupDataOwnerGranularity); - CleanupClosePushL( dataOwners ); - - // Get data owner listing from secure backup engine - Driver().DrvSecureBackupClient().ListOfDataOwnersL(dataOwners); - - // Inform driver of result -#ifdef RD_FILE_MANAGER_BACKUP - RPointerArray& dataOwnerLists = Driver().DrvDataOwnersAll(); - TInt count = dataOwners.Count(); - - // Construct an info array to get introduced for every category - for(TInt i = count-1; i >= 0; i--) - { - // Ownership is immediately transferred to the backup owner info object - // so we should remove it from the array prior to passing into NewLC - conn::CDataOwnerInfo* sbDataOwner = dataOwners[i]; - - dataOwners.Remove( i ); // Ensures it won't be deleted twice - - const TSBDerivedType type = sbDataOwner->Identifier().DerivedTypeL(); - if ( type == EJavaDerivedType || type == EJavaTransferDerivedType ) - { - HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( sbDataOwner->Identifier() ); - __LOG1("CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() - Assigning java owner with hash %S for categories", - hash ); - CleanupStack::PopAndDestroy( hash ); - } - else - { - __LOG1("CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() - Assigning data owner 0x%08x for categories", - MMCScBkupSBEUtils::SecureIdFromGenericL( sbDataOwner->Identifier() ).iId ); - } - - // We have to create copy of original data owner for each category, so we have to externalize it - RPointerArray sbDataOwnerCopies(dataOwnerLists.Count()); - CleanupClosePushL( sbDataOwnerCopies ); - HBufC8* dataOwner = sbDataOwner->ExternaliseL(); - CleanupStack::PushL( dataOwner ); - // Delete original data owner instance - delete sbDataOwner; - - // Create copies for each category (even if they do not eventually end up to those lists) - for(TInt j = 0; j < dataOwnerLists.Count(); j++) - { - conn::CDataOwnerInfo* sbDataOwnerCopy = conn::CDataOwnerInfo::NewL(*dataOwner); - CleanupStack::PushL( sbDataOwnerCopy ); - sbDataOwnerCopies.AppendL(sbDataOwnerCopy); - CleanupStack::Pop( sbDataOwnerCopy ); - } - CleanupStack::PopAndDestroy( dataOwner ); - - // Loop through all lists and assign copied data owners there - for(TInt j = 0; j < dataOwnerLists.Count(); j++) - { - // Again we have to create instances for each category, - // because each has to have own copy of data owner - CMMCScBkupDataOwnerInfo* info = CMMCScBkupDataOwnerInfo::NewLC( sbDataOwnerCopies[j] ); - - if(dataOwnerLists[j]->AssignL( *info )) - { - CleanupStack::Pop( info ); - } - else - { - CleanupStack::PopAndDestroy( info ); - } - } - - CleanupStack::PopAndDestroy( &sbDataOwnerCopies ); - } - -#if defined(__MMCSCBKUPLOGGING_ENABLED__) - __LOG("CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() - Data owners per categories:"); - - for(TInt i = 0; i < dataOwnerLists.Count(); i++) - { - __LOG2("CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() - Category 0x%x contains %d data owners", - dataOwnerLists[i]->Category().iFlags, dataOwnerLists[i]->Count() ); - - for(TInt j = 0; j < dataOwnerLists[i]->Count(); j++) - { - CMMCScBkupDataOwnerInfo* entry = &dataOwnerLists[i]->Owner(j); - - const TSBDerivedType type = entry->Owner().Identifier().DerivedTypeL(); - if ( type == EJavaDerivedType || type == EJavaTransferDerivedType ) - { - HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( entry->Owner().Identifier() ); - __LOG1("CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() - java data owner with hash %S", - hash ); - CleanupStack::PopAndDestroy( hash ); - } - else - { - __LOG1("CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() - data owner 0x%08x", - MMCScBkupSBEUtils::SecureIdFromGenericL( entry->Owner().Identifier() ).iId ); - } - } - } -#endif - -#else // RD_FILE_MANAGER_BACKUP - Driver().DrvDataOwners().AssignL( dataOwners ); -#endif // RD_FILE_MANAGER_BACKUP - - CleanupStack::PopAndDestroy( &dataOwners ); - } diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateNotifyAllSnapshotsSupplied.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateNotifyAllSnapshotsSupplied.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupStateNotifyAllSnapshotsSupplied implementation -* -* -*/ - -#include "CMMCScBkupStateNotifyAllSnapshotsSupplied.h" - -// System includes -#include - -// User includes -#include "MMCScBkupLogger.h" - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateNotifyAllSnapshotsSupplied::CMMCScBkupStateNotifyAllSnapshotsSupplied() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateNotifyAllSnapshotsSupplied::CMMCScBkupStateNotifyAllSnapshotsSupplied( MMMCScBkupDriver& aDriver ) -: CMMCScBkupState( aDriver ) - { - __LOG1("CMMCScBkupStateNotifyAllSnapshotsSupplied::CMMCScBkupStateNotifyAllSnapshotsSupplied() - 0x%08x", StateId().iUid ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateNotifyAllSnapshotsSupplied::NewL() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateNotifyAllSnapshotsSupplied* CMMCScBkupStateNotifyAllSnapshotsSupplied::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateNotifyAllSnapshotsSupplied* self = new(ELeave) CMMCScBkupStateNotifyAllSnapshotsSupplied( aDriver); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateNotifyAllSnapshotsSupplied::StateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateNotifyAllSnapshotsSupplied::StateId() const - { - return KMMCScBkupStateIdNotifyAllSnapshotsSupplied; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateNotifyAllSnapshotsSupplied::NextStateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateNotifyAllSnapshotsSupplied::NextStateId() const - { - TMMCScBkupStateId nextState = KMMCScBkupStateIdRequestSizeOfBackupData; - // - const TMMCScBkupOperationType type = Driver().DrvOperation(); - switch(type) - { - case EMMCScBkupOperationTypeFullBackup: - nextState = KMMCScBkupStateIdRequestSizeOfBackupData; - break; - case EMMCScBkupOperationTypeFullRestore: - nextState = KMMCScBkupStateIdArchiveOpSystemData; - break; - default: - ASSERT( EFalse ); - break; - } - // - return nextState; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateNotifyAllSnapshotsSupplied::PerformStateInitL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateNotifyAllSnapshotsSupplied::PerformStateInitL() - { - Driver().DrvSecureBackupClient().AllSnapshotsSuppliedL(); - } - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateOpAware.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateOpAware.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,275 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupStateOpAware implementation -* -* -*/ - -#include "CMMCScBkupStateOpAware.h" - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateOpAware::CMMCScBkupStateOpAware() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateOpAware::CMMCScBkupStateOpAware( MMMCScBkupDriver& aDriver, TInt aPriority ) -: CMMCScBkupState( aDriver, aPriority ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateOpAware::NextStateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateOpAware::NextStateId() const - { - TMMCScBkupStateId state = KMMCScBkupStateIdOperationComplete; - // - const TMMCScBkupOperationType type = Driver().DrvOperation(); - switch(type) - { - case EMMCScBkupOperationTypeFullBackup: - case EMMCScBkupOperationTypePartialBackup: - state = NextStateBackupId( type == EMMCScBkupOperationTypePartialBackup ); - break; - case EMMCScBkupOperationTypeFullRestore: - case EMMCScBkupOperationTypePartialRestore: - state = NextStateRestoreId( type == EMMCScBkupOperationTypePartialRestore ); - break; - default: - ASSERT( EFalse ); - break; - } - // - return state; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateOpAware::PerformAsynchronousStateStepBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateOpAware::PerformAsynchronousStateStepBackupL( TBool /*aPartial*/ ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateOpAware::PerformAsynchronousStateStepRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateOpAware::PerformAsynchronousStateStepRestoreL( TBool /*aPartial*/ ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateOpAware::PerformAsynchronousCancellationBackup() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateOpAware::PerformAsynchronousCancellationBackup( TBool /*aPartial*/ ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateOpAware::PerformAsynchronousCancellationRestore() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateOpAware::PerformAsynchronousCancellationRestore( TBool /*aPartial*/ ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateOpAware::PerformLastRightsBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateOpAware::PerformLastRightsBackupL( TBool /*aPartial*/ ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateOpAware::PerformLastRightsRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateOpAware::PerformLastRightsRestoreL( TBool /*aPartial*/ ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateOpAware::PerformAsynchronousErrorCleanupBackup() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateOpAware::PerformAsynchronousErrorCleanupBackup( TBool /*aPartial*/, TInt /*aError*/ ) - { - return EFalse; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateOpAware::PerformAsynchronousErrorCleanupRestore() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateOpAware::PerformAsynchronousErrorCleanupRestore( TBool /*aPartial*/, TInt /*aError*/ ) - { - return EFalse; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateOpAware::PerformStateInitL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateOpAware::PerformStateInitL() - { - const TMMCScBkupOperationType type = Driver().DrvOperation(); - switch(type) - { - case EMMCScBkupOperationTypeFullBackup: - case EMMCScBkupOperationTypePartialBackup: - PerformStateInitBackupL( type == EMMCScBkupOperationTypePartialBackup ); - break; - case EMMCScBkupOperationTypeFullRestore: - case EMMCScBkupOperationTypePartialRestore: - PerformStateInitRestoreL( type == EMMCScBkupOperationTypePartialRestore ); - break; - default: - ASSERT( EFalse ); - break; - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateOpAware::PerformAsynchronousStateStepL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateOpAware::PerformAsynchronousStateStepL() - { - const TMMCScBkupOperationType type = Driver().DrvOperation(); - switch(type) - { - case EMMCScBkupOperationTypeFullBackup: - case EMMCScBkupOperationTypePartialBackup: - PerformAsynchronousStateStepBackupL( type == EMMCScBkupOperationTypePartialBackup ); - break; - case EMMCScBkupOperationTypeFullRestore: - case EMMCScBkupOperationTypePartialRestore: - PerformAsynchronousStateStepRestoreL( type == EMMCScBkupOperationTypePartialRestore ); - break; - default: - ASSERT( EFalse ); - break; - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateOpAware::PerformAsynchronousCancellation() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateOpAware::PerformAsynchronousCancellation() - { - const TMMCScBkupOperationType type = Driver().DrvOperation(); - switch(type) - { - case EMMCScBkupOperationTypeFullBackup: - case EMMCScBkupOperationTypePartialBackup: - PerformAsynchronousCancellationBackup( type == EMMCScBkupOperationTypePartialBackup ); - break; - case EMMCScBkupOperationTypeFullRestore: - case EMMCScBkupOperationTypePartialRestore: - PerformAsynchronousCancellationRestore( type == EMMCScBkupOperationTypePartialRestore ); - break; - default: - ASSERT( EFalse ); - break; - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateOpAware::PerformLastRightsL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateOpAware::PerformLastRightsL() - { - const TMMCScBkupOperationType type = Driver().DrvOperation(); - switch(type) - { - case EMMCScBkupOperationTypeFullBackup: - case EMMCScBkupOperationTypePartialBackup: - PerformLastRightsBackupL( type == EMMCScBkupOperationTypePartialBackup ); - break; - case EMMCScBkupOperationTypeFullRestore: - case EMMCScBkupOperationTypePartialRestore: - PerformLastRightsRestoreL( type == EMMCScBkupOperationTypePartialRestore ); - break; - default: - ASSERT( EFalse ); - break; - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateOpAware::PerformAsynchronousErrorCleanup() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateOpAware::PerformAsynchronousErrorCleanup( TInt aError ) - { - TBool handled = EFalse; - // - const TMMCScBkupOperationType type = Driver().DrvOperation(); - switch(type) - { - case EMMCScBkupOperationTypeFullBackup: - case EMMCScBkupOperationTypePartialBackup: - handled = PerformAsynchronousErrorCleanupBackup( type == EMMCScBkupOperationTypePartialBackup, aError ); - break; - case EMMCScBkupOperationTypeFullRestore: - case EMMCScBkupOperationTypePartialRestore: - handled = PerformAsynchronousErrorCleanupRestore( type == EMMCScBkupOperationTypePartialRestore, aError ); - break; - default: - ASSERT( EFalse ); - break; - } - // - return handled; - } - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateRequestListOfPublicFiles.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateRequestListOfPublicFiles.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,447 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupStateRequestListOfPublicFiles implementation -* -* -*/ - -#include "CMMCScBkupStateRequestListOfPublicFiles.h" - -// System includes -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "MMCScBkupSBEUtils.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "RMMCScBkupProgressSizer.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "MMMCScBkupProgressObserver.h" -#include "CMMCScBkupFileListCollection.h" -#include "CMMCScBkupDataOwnerCollection.h" - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestListOfPublicFiles::CMMCScBkupStateRequestListOfPublicFiles() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateRequestListOfPublicFiles::CMMCScBkupStateRequestListOfPublicFiles( MMMCScBkupDriver& aDriver ) -: CMMCScBkupState( aDriver ) - { - __LOG1("CMMCScBkupStateRequestListOfPublicFiles::CMMCScBkupStateRequestListOfPublicFiles() - 0x%08x", StateId().iUid ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestListOfPublicFiles::~CMMCScBkupStateRequestListOfPublicFiles() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateRequestListOfPublicFiles::~CMMCScBkupStateRequestListOfPublicFiles() - { - Cancel(); - // - delete iRequestObject; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestListOfPublicFiles::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateRequestListOfPublicFiles::ConstructL() - { - iRequestObject = CMMCScBkupStateRequestSpecificPublicFileInfo::NewL(Driver()); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestListOfPublicFiles::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateRequestListOfPublicFiles* CMMCScBkupStateRequestListOfPublicFiles::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateRequestListOfPublicFiles* self = new(ELeave) CMMCScBkupStateRequestListOfPublicFiles( aDriver ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestListOfPublicFiles::StateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateRequestListOfPublicFiles::StateId() const - { - return KMMCScBkupStateIdRequestListOfPublicFiles; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestListOfPublicFiles::NextStateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateRequestListOfPublicFiles::NextStateId() const - { - return KMMCScBkupStateIdValidateDiskSpace; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestListOfPublicFiles::PerformStateInitL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateRequestListOfPublicFiles::PerformStateInitL() - { - // Set to -1 so that the first time RunL is called, we start with - // the data owner at index 0. - iCurrentDataOwnerIndex = -1; - CompleteSelf(KErrNone); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousStateStepL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousStateStepL() - { - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - if (++iCurrentDataOwnerIndex < dataOwners.Count()) - { - CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner(iCurrentDataOwnerIndex); - - const TBool hasPublicFiles = (owner.Owner().PassiveSettings() & EHasPublicFiles); - if (hasPublicFiles) - { - // Request all the public files (on all supported drives) for this - // particular data owner - __ASSERT_ALWAYS(iRequestObject->IsActive() == EFalse, User::Invariant()); - // - iRequestObject->RequestL(owner, iStatus); - SetActive(); - } - else - { - // Try next data owner - CompleteSelf(); - } - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousErrorCleanup() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousErrorCleanup(TInt aError) - { - (void) aError; - __LOG1("CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousErrorCleanup() - **** - error: %d", aError ); - - // Cancel requester. Its probably already inactive, but just in case... - PerformAsynchronousCancellation(); - - // Reset state and move to next item. Treat the current (badly behaving) item - // as completed/processed. - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - if ( iCurrentDataOwnerIndex < dataOwners.Count() ) - { - CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iCurrentDataOwnerIndex ); - (void) owner; - __LOGFILE2("CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousErrorCleanup() - **** - error: %d, SID: 0x%08x - PUBLIC data skipped for DO", aError, owner.SecureId().iId ); - - // Ensures that asynchronous state step is called again.. - CompleteSelf(); - } - - return ETrue; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousCancellation() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousCancellation() - { - if ( iRequestObject ) - { - iRequestObject->Cancel(); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestListOfPublicFiles::PerformLastRightsL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateRequestListOfPublicFiles::PerformLastRightsL() - { - // Now we can calculate the progress - TInt64 totalProgressAmount = 0; - - // Calculate the total progress required for the entire backup operation - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - const TInt count = dataOwners.Count(); - // - RMMCScBkupProgressSizer sizer( Driver().DrvParamsBase().DriveAndOperations() ); - for(TInt i=0; i KMaxTInt ) - { - __LOG1("CMMCScBkupStateRequestListOfPublicFiles::PerformLastRightsL() - leaving with KErrNotSupported due amount of data (%Ld)", - Driver().DrvTotalProgress()); - Driver().DrvProgressHandler().MMCScBkupStartBackuping( EFalse ); - User::Leave( KErrNotSupported ); - } - else - { - Driver().DrvProgressHandler().MMCScBkupHandleProgressDomainUnderstood( Driver().DrvTotalProgress() ); - } - } - else - { - __LOG2("CMMCScBkupStateRequestListOfPublicFiles::PerformLastRightsL() - adding progress amount %Ld to existing %Ld)", - totalProgressAmount, Driver().DrvTotalProgress()); - - if( (totalProgressAmount + Driver().DrvTotalProgress()) > KMaxTInt ) - { - __LOG1("CMMCScBkupStateRequestListOfPublicFiles::PerformLastRightsL() - leaving due amount of data (%Ld)", - totalProgressAmount + Driver().DrvTotalProgress()); - User::Leave(KErrNotSupported); - } - else - { - Driver().DrvStoreTotalProgress( totalProgressAmount ); - } - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSpecificPublicFileInfo::CMMCScBkupStateRequestSpecificPublicFileInfo() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateRequestSpecificPublicFileInfo::CMMCScBkupStateRequestSpecificPublicFileInfo( MMMCScBkupDriver& aDriver ) -: CMMCScBkupDriveSpecificRequest( aDriver.DrvParamsBase().DriveAndOperations(), EMMCScBkupOwnerDataTypePublicData ), iDriver(aDriver) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSpecificPublicFileInfo::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateRequestSpecificPublicFileInfo* CMMCScBkupStateRequestSpecificPublicFileInfo::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateRequestSpecificPublicFileInfo* self = new (ELeave) CMMCScBkupStateRequestSpecificPublicFileInfo(aDriver); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSpecificPublicFileInfo::RequestL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateRequestSpecificPublicFileInfo::RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver ) - { - iOwner = &aOwner; - CMMCScBkupDriveSpecificRequest::RequestL( aObserver ); - - // Start the asynchronous request. - CompleteSelf(KErrNone); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() - { - __LOG1("CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() - START - iStatus: %d", iStatus.Int()); - User::LeaveIfError(iStatus.Int()); - // - CDataOwnerInfo& owner = iOwner->Owner(); - const TDriveList& ownerDrives = owner.DriveList(); - TDriveNumber drive = EDriveA; - const TBool driveAvailable = NextValidDrive(drive, ownerDrives); - const TSecureId secureId = iOwner->SecureId(); - - __LOG3("CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() - secureId: 0x%08x, driveAvailable: %d, drive: %c", secureId.iId, driveAvailable, drive + 'A'); - - if (driveAvailable) - { - // This drive needs to be scanned... - TInt err( KErrNone ); - RFileArray files; - CleanupClosePushL(files); - - // Get a copy of the generic data type for which we are - // requesting file listings... - CSBGenericDataType* genericDataType = CSBSecureId::NewL( secureId ); - CleanupStack::PushL( genericDataType ); - TRAP( err, Driver().DrvSecureBackupClient().PublicFileListL( drive, *genericDataType, files ) ); - if( err != KErrNone && err != KErrNotFound ) - { - User::Leave( err ); - } - CleanupStack::PopAndDestroy( genericDataType ); - // Additionally we need to request list of public files registered for packages. - if( MMCScBkupSBEUtils::HasSystemDataL( owner ) ) - { - RFileArray pkgFiles; - CleanupClosePushL( pkgFiles ); - __LOG2("CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() - have %d files before package listing for DO, err %d", files.Count(), err); - TRAP( err, Driver().DrvSecureBackupClient().PublicFileListL( drive, owner.Identifier(), pkgFiles ) ); - __LOG2("CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() - have %d package files for DO, err %d", files.Count(), err); - const TInt pkgCount = pkgFiles.Count(); - for(TInt i = 0; i < pkgCount; i++) - { - files.AppendL( pkgFiles[i] ); - } - CleanupStack::PopAndDestroy( &pkgFiles ); - } - - // Add to the file list - __LOG1("CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() - have %d files for DO", files.Count()); - if (files.Count()) - { - - // We want to be told by the public file collection exactly which files - // it added... We need to do this in order to report progress as accurately - // as possible during the backup operation. - RArray< const CMMCScBkupFileInfo* > addedItems; - CleanupClosePushL(addedItems); - - // Add them to the public data file collection - Driver().DrvFileList().AppendL( files, addedItems, secureId ); - - // For each identified file, update the data owner with the size of public data - const TInt count = addedItems.Count(); - for(TInt i=0; iAddToOperationalSizeL( EMMCScBkupOwnerDataTypePublicData, drive, size ); - } - // - CleanupStack::PopAndDestroy( &addedItems ); - } - // - CleanupStack::PopAndDestroy( &files ); - - // Complete ourself to try the next drive - CompleteSelf( KErrNone ); - } - else - { - CompleteObserverRequest( KErrNone ); - } - - __LOG("CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() - END"); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSpecificPublicFileInfo::DoCancel() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateRequestSpecificPublicFileInfo::DoCancel() - { - } - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateRequestSizeOfBackupData.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateRequestSizeOfBackupData.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,515 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupStateRequestSizeOfBackupData implementation -* -* -*/ - -#include "CMMCScBkupStateRequestSizeOfBackupData.h" - -// System includes -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "MMCScBkupSBEUtils.h" -#include "TMMCScBkupOwnerDataType.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "MMMCScBkupProgressObserver.h" -#include "CMMCScBkupDataOwnerCollection.h" -#include "CMMCScBkupDriveAndOperationTypeManager.h" - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfBackupData::CMMCScBkupStateRequestSizeOfBackupData() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateRequestSizeOfBackupData::CMMCScBkupStateRequestSizeOfBackupData( MMMCScBkupDriver& aDriver ) -: CMMCScBkupState( aDriver ) - { - __LOG1("CMMCScBkupStateRequestSizeOfBackupData::CMMCScBkupStateRequestSizeOfBackupData() - 0x%08x", StateId().iUid ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfBackupData::~CMMCScBkupStateRequestSizeOfBackupData() -// -// C++ destructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateRequestSizeOfBackupData::~CMMCScBkupStateRequestSizeOfBackupData() - { - Cancel(); - // - delete iRequestObject; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfBackupData::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateRequestSizeOfBackupData::ConstructL() - { - iRequestObject = CMMCScBkupStateRequestSizeOfDataOwner::NewL( Driver() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfBackupData::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateRequestSizeOfBackupData* CMMCScBkupStateRequestSizeOfBackupData::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateRequestSizeOfBackupData* self = new(ELeave) CMMCScBkupStateRequestSizeOfBackupData( aDriver); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfBackupData::StateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateRequestSizeOfBackupData::StateId() const - { - return KMMCScBkupStateIdRequestSizeOfBackupData; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfBackupData::NextStateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateRequestSizeOfBackupData::NextStateId() const - { - return KMMCScBkupStateIdRequestListOfPublicFiles; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfBackupData::PerformStateInitL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateRequestSizeOfBackupData::PerformStateInitL() - { - // Set to -1 so that the first time RunL is called, we start with - // the data owner at index 0. - iCurrentDataOwnerIndex = -1; - CompleteSelf(KErrNone); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousStateStepL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousStateStepL() - { - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - const TInt count = dataOwners.Count(); - // - if ( ++iCurrentDataOwnerIndex < dataOwners.Count() ) - { - CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner(iCurrentDataOwnerIndex); - - // Request all the public files (on all supported drives) for this - // particular data owner - __ASSERT_ALWAYS(iRequestObject->IsActive() == EFalse, User::Invariant()); - // - __LOG3("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousStateStepL() - START - owner[%3d/%3d], sid: 0x%08x", iCurrentDataOwnerIndex, count, owner.SecureId().iId); - iRequestObject->RequestL(owner, iStatus); - SetActive(); - } - else - { - __LOG("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousStateStepL() - END"); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup( TInt aError ) - { - (void) aError; - __LOG1("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup() - **** - error: %d", aError ); - TBool continueProcessing = ETrue; - - // Cancel requester. Its probably already inactive, but just in case... - PerformAsynchronousCancellation(); - - // Reset state and move to next item. Treat the current (badly behaving) item - // as completed/processed. - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - if ( iCurrentDataOwnerIndex < dataOwners.Count() ) - { - CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iCurrentDataOwnerIndex ); - - (void) owner; - __LOGFILE2("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup() - **** - error: %d, SID: 0x%08x - SIZE OF DATA skipped for DO", aError, owner.SecureId().iId ); - - // Ensures that asynchronous state step is called again.. - CompleteSelf(); - } - else - { - continueProcessing = EFalse; - } - // - __LOG1("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup() - END - continueProcessing: %d", continueProcessing ); - return continueProcessing; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousCancellation() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousCancellation() - { - if ( iRequestObject ) - { - iRequestObject->Cancel(); - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfDataOwner::CMMCScBkupStateRequestSizeOfDataOwner() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateRequestSizeOfDataOwner::CMMCScBkupStateRequestSizeOfDataOwner( MMMCScBkupDriver& aDriver ) -: CMMCScBkupDriveSpecificRequest( aDriver.DrvParamsBase().DriveAndOperations(), EMMCScBkupOwnerDataTypeAny ), iDriver(aDriver) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfDataOwner::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateRequestSizeOfDataOwner* CMMCScBkupStateRequestSizeOfDataOwner::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateRequestSizeOfDataOwner* self = new (ELeave) CMMCScBkupStateRequestSizeOfDataOwner(aDriver); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfDataOwner::RequestL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateRequestSizeOfDataOwner::RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver ) - { - iOwner = &aOwner; - CMMCScBkupDriveSpecificRequest::RequestL( aObserver ); - - // Start the asynchronous request. - CompleteSelf(KErrNone); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfDataOwner::RunL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateRequestSizeOfDataOwner::RunL() - { - __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::RunL() - START - iStatus: %d, sid: 0x%08x", iStatus.Int(), iOwner->SecureId().iId); - - User::LeaveIfError(iStatus.Int()); - // - TDriveNumber drive = EDriveA; - const TDriveList& ownerDrives = iOwner->Owner().DriveList(); - const TBool driveAvailable = NextValidDrive(drive, ownerDrives); - // - if (driveAvailable) - { - CDataOwnerInfo& owner = iOwner->Owner(); - CSBGenericDataType& identifier = owner.Identifier(); - - // Size any active and passive data - GetActiveAndPassiveDataSizesL( owner, identifier, drive ); - - // Size any system package data - GetSystemDataSizesL( owner, identifier, drive ); - - // Size any java data - GetJavaDataSizesL( owner, identifier, drive ); - - // Complete ourself to try the next drive - CompleteSelf(KErrNone); - __LOG1("CMMCScBkupStateRequestSizeOfDataOwner::RunL() - END - sid: 0x%08x, checking next drive...", iOwner->SecureId().iId); - } - else - { - __LOG1("CMMCScBkupStateRequestSizeOfDataOwner::RunL() - END - sid: 0x%08x, last drive scanned => notifying observer", iOwner->SecureId().iId); - CompleteObserverRequest(KErrNone); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfDataOwner::DoCancel() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateRequestSizeOfDataOwner::DoCancel() - { - CompleteObserverRequest( KErrCancel ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfDataOwner::GetActiveAndPassiveDataSizesL() -// -// -// --------------------------------------------------------------------------- -TUint CMMCScBkupStateRequestSizeOfDataOwner::GetActiveAndPassiveDataSizesL( const CDataOwnerInfo& aOwner, - CSBGenericDataType& /*aIdentifier*/, TDriveNumber aDrive ) - { - // Passive Data - const TBool passiveBURSupported = MMCScBkupSBEUtils::HasPassiveDataL( aOwner ); - const TBool passiveDataTransferAllowedForDrive = DriveAndOperations().IsDataTypeAllowedToAccessDrive( aDrive, EMMCScBkupOwnerDataTypePassiveData ); - __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - passiveBURSupported: %d, passiveDataTransferAllowedForDrive: %d", passiveBURSupported, passiveDataTransferAllowedForDrive ); - - TUint ret = 0; - TUint itemSize = 0; - if ( passiveBURSupported && passiveDataTransferAllowedForDrive ) - { - const TSecureId secureId = iOwner->SecureId(); - const TTransferDataType type = Driver().DrvParamsBase().PassiveTransferType(); - __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - sid: 0x%08x claims PASSIVE Data... type: %d", iOwner->SecureId().iId, type); - - itemSize = GetSIDSpecificSizeL( secureId, aDrive, type ); - iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypePassiveData, aDrive, itemSize ); - ret += itemSize; - __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - sid: 0x%08x, passive size: %8d", secureId.iId, itemSize); - } - - // Active Data - const TBool activeBURSupported = MMCScBkupSBEUtils::HasActiveDataL( aOwner ); - const TBool activeDataTransferAllowedForDrive = DriveAndOperations().IsDataTypeAllowedToAccessDrive( aDrive, EMMCScBkupOwnerDataTypeActiveData ); - __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - activeBURSupported: %d, activeDataTransferAllowedForDrive: %d", activeBURSupported, activeDataTransferAllowedForDrive ); - - if ( activeBURSupported && activeDataTransferAllowedForDrive ) - { - const TSecureId secureId = iOwner->SecureId(); - const TTransferDataType type = Driver().DrvParamsBase().ActiveTransferType(); - __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - sid: 0x%08x claims ACTIVE Data... type: %d", iOwner->SecureId().iId, type); - - - // Technically, we should wait for an active data owner to become ready before we ask - // for its sizing information. If we don't wait, we might receive KErrNotReady back - // from our SBE request. - // - // Currently, the MMC engine doesn't actually make any use of the active data sizing - // info, so we trap (and ignore) the error in this situation. In the future, we will - // have to change the state machine in order to request the active data statuses - // before the sizing can be requested. - itemSize = 0; - TRAPD(err, GetSIDSpecificSizeL( secureId, aDrive, type )); - __LOG3("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - sid: 0x%08x, active size: %8d, fetchError: %d", secureId.iId, itemSize, err); - - if ( err == KErrNone || err == KErrNotReady ) - { - err = KErrNone; - } - else - { - User::LeaveIfError( err ); - } - - iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypeActiveData, aDrive, itemSize ); - ret += itemSize; - __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - sid: 0x%08x, active size: %8d", secureId.iId, itemSize); - } - - return ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSpecificSizeL() -// -// -// --------------------------------------------------------------------------- -TUint CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSpecificSizeL( TSecureId aSecureID, TDriveNumber aDrive, TTransferDataType aDataType ) - { - CSBSIDTransferType* transferType = CSBSIDTransferType::NewL( aSecureID, - aDrive, - aDataType - ); - CleanupStack::PushL( transferType ); - const TUint size = Driver().DrvSecureBackupClient().ExpectedDataSizeL( *transferType ); - CleanupStack::PopAndDestroy( transferType ); - return size; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL() -// -// -// --------------------------------------------------------------------------- -TUint CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL( const CDataOwnerInfo& aOwner, CSBGenericDataType& aIdentifier, TDriveNumber aDrive ) - { - TUint size = 0; - // - const TBool systemBURSupported = MMCScBkupSBEUtils::HasSystemDataL( aOwner ); - const TBool systemDataTransferAllowedForDrive = DriveAndOperations().IsDataTypeAllowedToAccessDrive( aDrive, EMMCScBkupOwnerDataTypeSystemData ); - __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL() - systemBURSupported: %d, systemDataTransferAllowedForDrive: %d", systemBURSupported, systemDataTransferAllowedForDrive ); - - if ( systemBURSupported && systemDataTransferAllowedForDrive ) - { - __LOG1("CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL() - sid: 0x%08x claims SYSTEM Data...", iOwner->SecureId().iId); - - // Again we have to create a temporary in order to actually retrieve the info... - CSBPackageId* packageGeneric = static_cast( MMCScBkupSBEUtils::CopyLC( aIdentifier ) ); - const TUid packageId = packageGeneric->PackageIdL(); - // - const TPackageDataType type = Driver().DrvParamsBase().PackageTransferType(); - CSBPackageTransferType* transferType = CSBPackageTransferType::NewL( packageId, - aDrive, - type - ); - CleanupStack::PushL( transferType ); - size = Driver().DrvSecureBackupClient().ExpectedDataSizeL( *transferType ); - __LOG3("CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL() - packageId: 0x%08x, sid: 0x%08x, package size: %8d", packageId.iUid, iOwner->SecureId().iId, size); - CleanupStack::PopAndDestroy( transferType ); - // - iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypeSystemData, aDrive, size ); - CleanupStack::PopAndDestroy( packageGeneric ); - } - - return size; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfDataOwner::GetJavaDataSizesL() -// -// -// --------------------------------------------------------------------------- -TUint CMMCScBkupStateRequestSizeOfDataOwner::GetJavaDataSizesL( const CDataOwnerInfo& aOwner, CSBGenericDataType& aIdentifier, TDriveNumber aDrive ) - { - TUint size = 0; - // - const TBool javaBURSupported = MMCScBkupSBEUtils::HasJavaDataL( aOwner ); - const TBool javaDataTransferAllowedForDrive = DriveAndOperations().IsDataTypeAllowedToAccessDrive( aDrive, EMMCScBkupOwnerDataTypeJavaData ); - __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSizesL() - javaBURSupported: %d, javaDataTransferAllowedForDrive: %d", javaBURSupported, javaDataTransferAllowedForDrive ); - - if ( javaBURSupported && javaDataTransferAllowedForDrive ) - { - // Again we have to create a temporary in order to actually retrieve the info... - CSBJavaId* packageGeneric = static_cast(MMCScBkupSBEUtils::CopyLC( aIdentifier )); - const TPtrC pHash(packageGeneric->SuiteHashL()); - __LOG1("CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSizesL() - midlet hash: %S", &pHash ); - - const TUint midletSize = GetJavaSpecificSizeL( pHash, aDrive, EJavaMIDlet); - __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSizesL() - EJavaMIDlet, sid: 0x%08x, size: %8d", iOwner->SecureId().iId, midletSize); - - const TUint midletDataSize = GetJavaSpecificSizeL( pHash, aDrive, EJavaMIDletData); - __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSizesL() - EJavaMIDletData, sid: 0x%08x, size: %8d", iOwner->SecureId().iId, midletDataSize); - - // We put the midlet itself in the special 'java data' category (the 'system data' equivalent for - // java midlets). - iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypeJavaData, aDrive, midletSize ); - - // We put the midlet's data (e.g. any data files that it created) inside - // the 'passive data' bucket. - iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypePassiveData, aDrive, midletDataSize ); - - // Java abuses the passive data slot. We would've initially set passive data's completion status - // to ETrue inside CMMCScBkupDataOwnerInfo::ConstructL() as a result of receiving a Java - // transfer type... but we can reset it back to "not yet completed" if the midlet - // does indeed have some 'passive data'. - iOwner->SetCompletionStatus( EMMCScBkupOwnerDataTypePassiveData, ( midletDataSize == 0 ) ); - - CleanupStack::PopAndDestroy( packageGeneric ); - // - size = midletSize + midletDataSize; - } - - return size; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSpecificSizeL() -// -// -// --------------------------------------------------------------------------- -TUint CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSpecificSizeL( const TDesC& aHash, TDriveNumber aDrive, TJavaTransferType aDataType ) - { - CSBJavaTransferType* transferType = CSBJavaTransferType::NewL( aHash, - aDrive, - aDataType - ); - CleanupStack::PushL( transferType ); - const TUint size = Driver().DrvSecureBackupClient().ExpectedDataSizeL( *transferType ); - CleanupStack::PopAndDestroy( transferType ); - return size; - } diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateSetPhoneMode.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateSetPhoneMode.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupStateSetPhoneMode implementation -* -* -*/ - -#include "CMMCScBkupStateSetPhoneMode.h" - -// System includes -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupDriveAndOperationTypeManager.h" - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateSetPhoneMode::CMMCScBkupStateSetPhoneMode() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateSetPhoneMode::CMMCScBkupStateSetPhoneMode( MMMCScBkupDriver& aDriver ) -: CMMCScBkupState( aDriver ) - { - __LOG1("CMMCScBkupStateSetPhoneMode::CMMCScBkupStateSetPhoneMode() - 0x%08x", StateId().iUid ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateSetPhoneMode::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateSetPhoneMode* CMMCScBkupStateSetPhoneMode::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateSetPhoneMode* self = new(ELeave) CMMCScBkupStateSetPhoneMode( aDriver); - return self; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateSetPhoneMode::StateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateSetPhoneMode::StateId() const - { - return KMMCScBkupStateIdSetPhoneMode; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateSetPhoneMode::NextStateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateSetPhoneMode::NextStateId() const - { - TMMCScBkupStateId nextState = KMMCScBkupStateIdNotifyAllSnapshotsSupplied; - // - const TMMCScBkupOperationType type = Driver().DrvOperation(); - switch(type) - { - case EMMCScBkupOperationTypeFullBackup: - nextState = KMMCScBkupStateIdNotifyAllSnapshotsSupplied; - break; - case EMMCScBkupOperationTypeFullRestore: - nextState = KMMCScBkupStateIdArchiveOpSystemData; - break; - default: - ASSERT( EFalse ); - break; - } - // - return nextState; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateSetPhoneMode::PerformStateInitL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateSetPhoneMode::PerformStateInitL() - { - __LOG("CMMCScBkupStateSetPhoneMode::PerformStateInitL()" ); - // - const CMMCScBkupOpParamsBase& params = Driver().DrvParamsBase(); - // - Driver().DrvSecureBackupClient().SetBURModeL( params.DriveAndOperations().DriveList(), - params.PartType(), - params.IncrementType(), - iStatus ); - SetActive(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateSetPhoneMode::PerformAsynchronousStateStepL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateSetPhoneMode::PerformAsynchronousStateStepL() - { - __LOG("CMMCScBkupStateSetPhoneMode::PerformAsynchronousStateStepL()" ); - } - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupStateValidateDiskSpace.cpp --- a/filemanager/bkupengine/src/CMMCScBkupStateValidateDiskSpace.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,393 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CMMCScBkupStateValidateDiskSpace implementation -* -* -*/ - -#include "CMMCScBkupStateValidateDiskSpace.h" - -// System includes -#include -#include -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupFileInfo.h" -#include "CMMCScBkupArchive.h" -#include "CMMCScBkupArchiveFooter.h" -#include "CMMCScBkupArchiveHeader.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "RMMCScBkupProgressSizer.h" -#include "MMMCScBkupProgressObserver.h" -#include "CMMCScBkupFileListCollection.h" -#include "CMMCScBkupDataOwnerCollection.h" -#include "CMMCScBkupIndexPublicDataFiles.h" -#include "CMMCScBkupDataStrategies.h" -#include "MMCScBkupSBEUtils.h" - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupStateValidateDiskSpace::~CMMCScBkupStateValidateDiskSpace() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateValidateDiskSpace::~CMMCScBkupStateValidateDiskSpace() - { - iDriveSizes.Close(); - iDriveMaxFileSizes.Close(); - } - -// --------------------------------------------------------------------------- -// CMMCScBkupStateValidateDiskSpace::CMMCScBkupStateValidateDiskSpace() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupStateValidateDiskSpace::CMMCScBkupStateValidateDiskSpace( MMMCScBkupDriver& aDriver ) -: CMMCScBkupState( aDriver ), iCumulatedSize(0) - { - __LOG1("CMMCScBkupStateValidateDiskSpace::CMMCScBkupStateValidateDiskSpace() - 0x%08x", StateId().iUid ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateValidateDiskSpace::NewL() -// -// -// --------------------------------------------------------------------------- -CMMCScBkupStateValidateDiskSpace* CMMCScBkupStateValidateDiskSpace::NewL( MMMCScBkupDriver& aDriver ) - { - CMMCScBkupStateValidateDiskSpace* self = new(ELeave) CMMCScBkupStateValidateDiskSpace( aDriver ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } - -// --------------------------------------------------------------------------- -// CMMCScBkupStateValidateDiskSpace::ConstructL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateValidateDiskSpace::ConstructL( ) - { - for( TInt i = EDriveA; i<=EDriveZ; i++ ) - { - const TDriveNumber drive = static_cast< TDriveNumber >( i ); - - // Zero-initialize max. file sizing info arrays - TMMCScBkupDriveAndSize newEntry( drive, 0 ); - iDriveSizes.AppendL( newEntry ); - TMMCScBkupDriveAndSize maxEntry( drive, 0 ); - iDriveMaxFileSizes.AppendL( maxEntry ); - } - } - -// --------------------------------------------------------------------------- -// CMMCScBkupStateValidateDiskSpace::StateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateValidateDiskSpace::StateId() const - { - return KMMCScBkupStateIdValidateDiskSpace; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateValidateDiskSpace::NextStateId() -// -// -// --------------------------------------------------------------------------- -TMMCScBkupStateId CMMCScBkupStateValidateDiskSpace::NextStateId() const - { - TMMCScBkupStateId nextState = KMMCScBkupStateIdOperationComplete; - // - const TMMCScBkupOperationType type = Driver().DrvOperation(); - switch(type) - { - case EMMCScBkupOperationTypeFullBackup: - nextState = KMMCScBkupStateIdArchiveOpPublicDataFiles; - break; - case EMMCScBkupOperationTypeFullRestore: - nextState = KMMCScBkupStateIdSetPhoneMode; - break; - default: - ASSERT( EFalse ); - break; - } - // - return nextState; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateValidateDiskSpace::PerformStateInitL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateValidateDiskSpace::PerformStateInitL() - { - CompleteSelf(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateValidateDiskSpace::PerformAsynchronousStateStepL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateValidateDiskSpace::PerformAsynchronousStateStepL() - { - const TMMCScBkupOperationType type = Driver().DrvOperation(); - - switch(type) - { - case EMMCScBkupOperationTypeFullBackup: - { - ValidateFreeSpaceBeforeBackupL(); - break; - } - case EMMCScBkupOperationTypeFullRestore: - { - ValidateFreeSpaceBeforeRestoreL(); - break; - } - default: - User::Leave(KErrNotSupported); - break; - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - { - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - TInt64 uncompressedSize; - - __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - START"); - - // Calculate the total progress required for the entire backup operation - uncompressedSize = dataOwners.TotalOperationalSizeL(); - __LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - Total estimated uncompressed size for archive %Ld", uncompressedSize); - const TInt ownerCount = dataOwners.Count(); - - for( TInt i=0; i volInfo.iFree) - { - percentFree = TInt( (volInfo.iFree * 100 ) / iCumulatedSize ); // accurate enough, no rounding - } - - err = Driver().DrvProgressHandler().MMCScBkupHandleFreeSpace( percentFree ); - if( err != KErrNone ) - { - // Error indicates backup creation no more allowed - Driver().DrvProgressHandler().MMCScBkupStartBackuping( EFalse ); - User::Leave( err ); - } - else - { - Driver().DrvProgressHandler().MMCScBkupStartBackuping( ETrue ); - } - } - else - { - __LOG3("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - Cumulated size now %Ld, free size on drive %c is %Ld", - iCumulatedSize, driveNumber + 'A', volInfo.iFree); - } - } - else - { - __LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - Volume info error %d", err); - } - } - - __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - END"); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - { - CMMCScBkupArchiveFooter& footer = Driver().DrvArchive().Footer(); - CMMCScBkupIndexPublicDataFiles& index = static_cast( footer.IndexByType( EMMCScBkupOwnerDataTypePublicData ) ); - CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); - CMMCScBkupFileListCollection& fileList = Driver().DrvFileList(); - TInt indexValueCurrent(0); - - __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - START"); - - const TInt ownerCount = dataOwners.Count(); - - // We can only make a direct comparison for public data - for( TInt i=0; i( i ); - - const TInt64 size = owner.OperationalSize( EMMCScBkupOwnerDataTypePublicData, drive ); - TMMCScBkupDriveAndSize& entry = iDriveSizes[ drive ]; - entry.SetSize(entry.Size() + size); - __LOG4("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - DO: 0x%08x has %Ld bytes for drive %c (total %Ld)", - owner.SecureId().iId, size, entry.Drive() + 'A', entry.Size()); - } - } - } - -#if defined(__MMCSCBKUPLOGGING_ENABLED__) - for( TInt i = EDriveA; i<=EDriveZ; i++ ) - { - TMMCScBkupDriveAndSize& entry = iDriveSizes[ i ]; - __LOG2("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Initially %Ld bytes required on drive %c", - entry.Size(), entry.Drive() + 'A'); - } -#endif - - const TInt count = index.Count(); - - __LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Public files to compare %d", count); - - // Check needed size by comparing archived public files to files in disk - decrease size if matching file found - while( ++indexValueCurrent < count ) - { - // Get the entry to restore - TMMCScBkupArchiveVector entryInfo; - //const CMMCScBkupFileInfo& fileInfo = index.At( indexValueCurrent, entryInfo ); - const CMMCScBkupFileInfo& fileInfo = fileList.Entry(indexValueCurrent); - const TDriveNumber drive = fileInfo.Drive(); - - __LOG2("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Archived file: %S, of size %d", &fileInfo.FileName(), fileInfo.Size()); - - // Check file (if any) size in disk - RFile64 restoreFile; - TInt64 fileSize = 0; - TInt error = restoreFile.Open(ADI().ADIFsSession(), fileInfo.FileName(), EFileShareReadersOnly | EFileRead); - if(error == KErrNone) - { - error = restoreFile.Size(fileSize); - if(error == KErrNone) - { - __LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Found matching file of size %d", fileInfo.Size()); - - // Take into account biggest file already on disk, because reserves that much space temporarily - if(iDriveMaxFileSizes[ drive ].Size() < fileSize && KMMCScBkupUseTempFile) - { - TMMCScBkupDriveAndSize& bigFile = iDriveMaxFileSizes[ drive ]; - bigFile.SetSize(fileSize); - } - } - else - { - fileSize = 0; - __LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Error % requesting file size", error); - } - - restoreFile.Close(); - } - - TMMCScBkupDriveAndSize& entry = iDriveSizes[ drive ]; - entry.SetSize(entry.Size() - fileSize); - - __LOG2("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - %Ld bytes required now on drive %c", entry.Size(), entry.Drive() + 'A'); - } - - __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - No estimation for private and system files"); - - if(Driver().DrvLastCategory()) - { - TVolumeInfo volInfo; - TInt spaceCheck(KErrNone); - - // Let user interrupt restore if necessary in future. Currently if any of drives cannot be restored, we interrupt restore. - for( TInt i = EDriveA; i<=EDriveZ; i++ ) - { - // Check whether data fits into this drive. - const TDriveNumber drive = static_cast< TDriveNumber >( i ); - - TInt err = ADI().ADIFsSession().Volume( volInfo, drive ); - if( err == KErrNone) - { - // Total compressed size. If this exceeds total size of drive, then restore does not succeed for sure. - const TInt64 size = dataOwners.DiskSpaceRequiredForRestore( drive ); - __LOG3("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - drive %c requires %Ld + %Ld for temporary file", - iDriveSizes[ drive ].Drive() + 'A', iDriveSizes[ drive ].Size(), iDriveMaxFileSizes[ drive ].Size()); - - if ( (( iDriveSizes[ drive ].Size() + iDriveMaxFileSizes[ drive ].Size() ) > volInfo.iFree ) || - ( size > volInfo.iSize ) ) - { - __LOG2("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Not enough space (%Ld) on drive %c", - TInt(volInfo.iFree), iDriveSizes[ drive ].Drive() + 'A'); - spaceCheck = KErrDiskFull; - break; - } - } - } - - User::LeaveIfError(spaceCheck); - } - else - { - __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Checking next category..."); - } - - __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - END"); - } - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupTransferReadRequest.cpp --- a/filemanager/bkupengine/src/CMMCScBkupTransferReadRequest.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,517 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupReadDataTransferRequestBase implementation -* -* -*/ - -#include "CMMCScBkupTransferReadRequest.h" - -// User includes -#include "MMCScBkupLogger.h" -#include "MMMCScBkupDriver.h" -#include "CMMCScBkupArchive.h" -#include "MMMCScBkupArchiveDataInterface.h" -#include "MMMCScBkupProgressObserver.h" -#include - -// Constants -const TBool KMMCScBkupDontUpdateOpSizes = EFalse; - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupReadDataTransferRequestBase::CMMCScBkupReadDataTransferRequestBase() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupReadDataTransferRequestBase::CMMCScBkupReadDataTransferRequestBase( - MMMCScBkupDriver& aDriver, - TMMCScBkupOwnerDataType aElementType, - TInt aChunkSize, - TInt aPriority ) -: CMMCScBkupTransferRequestBase( aDriver, aElementType, KMMCScBkupDontUpdateOpSizes, aPriority ), - iReadChunkSize( aChunkSize ), - iCurrentIndex( -1 ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupReadDataTransferRequestBase::~CMMCScBkupReadDataTransferRequestBase() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupReadDataTransferRequestBase::~CMMCScBkupReadDataTransferRequestBase() - { - delete iTransferType; - delete iTemporaryTransferSink; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupReadDataTransferRequestBase::RequestL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupReadDataTransferRequestBase::RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver, const RArray& aEntries ) - { -#ifdef __MMCSCBKUPLOGGING_ENABLED__ - if ( ElementType() == EMMCScBkupOwnerDataTypeJavaData ) - { - HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( aOwner.Owner().Identifier() ); - __LOG2("CMMCScBkupReadDataTransferRequestBase::RequestL() - START - reading data from SBE for JavaHash: %S, ElementType: %S", hash, &MMCScBkupLogger::DataType( ElementType() )); - CleanupStack::PopAndDestroy( hash ); - } - else - { - __LOG2("CMMCScBkupReadDataTransferRequestBase::RequestL() - START - reading data from SBE for DO: 0x%08x, ElementType: %S", aOwner.SecureId().iId, &MMCScBkupLogger::DataType( ElementType() )); - } -#endif - - CMMCScBkupTransferRequestBase::RequestL( aOwner, aObserver ); - // - if ( !iTemporaryTransferSink ) - { - iTemporaryTransferSink = HBufC8::NewL( iReadChunkSize ); - } - // - iEntries = &aEntries; - iCurrentIndex = -1; // Increased by one in PrepareForNextEntry - // - TState nextState = EProcessData; - const TBool entryAvailable = PrepareForNextEntry(); - if ( !entryAvailable ) - { - nextState = EFinished; - } - // - SetState( nextState ); - CompleteSelf(); - __LOG1("CMMCScBkupReadDataTransferRequestBase::RequestL() - END - nextState: %d", nextState); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupReadDataTransferRequestBase::ProcessChunkOfDataL() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupReadDataTransferRequestBase::ProcessChunkOfDataL() - { - __ASSERT_ALWAYS( iCurrentIndex >= 0, User::Invariant() ); - - TBool callAgain = EFalse; - - // Do we need to move to the next entry? - TBool entryAvailable = ( iCurrentIndex < iEntries->Count() ); - if ( entryAvailable ) - { - // At least one more entry left to process.. but have we finished - // the current entry? If we've read all the data, then the - // answer is yes... - const TMMCScBkupArchiveDriveAndVector& entry = (*iEntries)[ iCurrentIndex ]; - const TInt endOffset = entry.iVector.EndOffset(); - -#ifdef __MMCSCBKUPLOGGING_ENABLED__ - if ( ElementType() == EMMCScBkupOwnerDataTypeJavaData ) - { - HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( DataOwner().Owner().Identifier() ); - __LOG6("CMMCScBkupReadDataTransferRequestBase::ProcessChunkOfDataL() - START - JavaHash: %S, ElementType: %S, offset: %8d, length: %8d, endOffset: %8d, drive: %c:", hash, &MMCScBkupLogger::DataType( ElementType() ), entry.iVector.Offset(), entry.iVector.Length(), endOffset, entry.iDrive + 'A' ); - CleanupStack::PopAndDestroy( hash ); - } - else - { - __LOG6("CMMCScBkupReadDataTransferRequestBase::ProcessChunkOfDataL() - START - DO: 0x%08x, ElementType: %S, offset: %8d, length: %8d, endOffset: %8d, drive: %c:", DataOwner().SecureId().iId, &MMCScBkupLogger::DataType( ElementType() ), entry.iVector.Offset(), entry.iVector.Length(), endOffset, entry.iDrive + 'A' ); - } -#endif - - // Check bounds - if ( CurrentOffset() < 0 || CurrentOffset() > endOffset ) - { - ASSERT( EFalse ); - User::Leave( KErrCorrupt ); - } - // - if ( iCurrentOffset == endOffset ) - { - // We're done with this entry - move to the next - entryAvailable = PrepareForNextEntry(); - } - } - // - if ( entryAvailable ) - { - // We need to read more archive data in order to transfer this - // entry to the SBE - callAgain = DoProcessChunkOfDataL(); - } - else - { - // No more left to process - we're finished! - SetState( EFinished ); - CompleteSelf(); - } - // - return callAgain; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() - { - __ASSERT_ALWAYS(iTransferChunkPointer != NULL, User::Invariant()); - const CSBGenericDataType& generic = DataOwner().Owner().Identifier(); - - // Prepare the transfer type with a virtual function call... - CSBGenericTransferType* transferType = PrepareTransferTypeL( generic, CurrentDrive(), - DataOwner().Version()); - delete iTransferType; - iTransferType = transferType; - -#ifdef __MMCSCBKUPLOGGING_ENABLED__ - TInt lengthOfDataReadyForTransfer = 0; - if ( iTransferChunkPointer != NULL ) - { - lengthOfDataReadyForTransfer = iTransferChunkPointer->Length(); - } - - if ( iTransferType->DerivedTypeL() == EJavaTransferDerivedType ) - { - HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( DataOwner().Owner().Identifier() ); - __LOG5("CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() - supplying %d bytes of data for has: %S, drive: %c, iTransferChunkPointer addr: 0x%08x, iTransferChunkPointer length: %d", lengthOfDataReadyForTransfer, hash, 'A' + CurrentDrive(), iTransferChunkPointer->Ptr(), iTransferChunkPointer->Length() ); - CleanupStack::PopAndDestroy( hash ); - } - else - { - const TSecureId sid = DataOwner().SecureId(); - __LOG5("CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() - supplying %d bytes of data for sid: 0x%08x, drive: %c, iTransferChunkPointer addr: 0x%08x, iTransferChunkPointer length: %d", lengthOfDataReadyForTransfer, sid.iId, 'A' + CurrentDrive(), iTransferChunkPointer->Ptr(), iTransferChunkPointer->Length() ); - } -#endif - - // - Driver().DrvSecureBackupClient().SupplyDataL( *iTransferType, iFinishedSupplyingData, iStatus ); - SetActive(); - - // Reset - ResetDataTransferCounter(); - iTransferChunkPointer = NULL; // Address is retrieved from global chunk in DoProcessChunkOfDataL - - __LOG("CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() - data transmitted, waiting for request completion..."); - - // When the SBE informs us that it has read the data, we'll need to send it the next - // chunk. - SetState( EProcessData ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupReadDataTransferRequestBase::ReadChunkL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupReadDataTransferRequestBase::ReadChunkL( TDes8& aSink, TInt aLength ) - { - const TInt endOffset = CurrentReadInfo().EndOffset(); - __LOG4("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - START - aLength: %d, endOffset: %d, iCurrentOffset: %d, sinkLength: %d", aLength, endOffset, iCurrentOffset, aSink.Length()); - // - if ( iCurrentOffset >= 0 && iCurrentOffset <= endOffset ) - { - if ( aLength > 0 ) - { - MMMCScBkupArchiveDataInterface& archiveDataInterface = Driver().DrvADI(); - - // We read based upon the current offset and the specified length - TPtr8 sink( iTemporaryTransferSink->Des() ); - const TMMCScBkupArchiveVector readRequest( iCurrentOffset, aLength ); - const TMMCScBkupArchiveVector& readResult = archiveDataInterface.ADIReadL( sink, readRequest ); - __LOG2("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - read result - offset: %d, length: %d", readResult.Offset(), readResult.Length()); - - // Update offset - iCurrentOffset += readResult.Length(); - aSink.Append( sink ); - __LOG2("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - new offset (iCurrentOffset): %d, sink Length: %d", iCurrentOffset, aSink.Length()); - -#ifdef DEBUGGING_DATA_TRANSFER - TRAP_IGNORE( DumpTransferDataL( archiveDataInterface.ADIFsSession(), sink) ); -#endif - - if ( iCurrentOffset > CurrentReadInfo().EndOffset() ) - { - __LOG("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - Fatal Error - read went beyond archive entry boundary!"); - ASSERT( EFalse ); - User::Leave( KErrCorrupt ); - } - else - { - __LOG("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - read was okay - updating stats & reporting progress..."); - - // We managed to read the data okay, so let's update our stats - DataTransferred( readResult.Length() ); - - // ... and also update progress - Driver().DrvProgressHandler().MMCScBkupHandleProgress( readResult.Length() ); - } - } - } - else - { - __LOG("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - Fatal Error - current offset out of bounds!"); - ASSERT( EFalse ); - User::Leave( KErrCorrupt ); - } - - __LOG("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - END"); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() - { - MMMCScBkupDriver& driver = Driver(); - const TInt startingOffset = CurrentOffset(); - const TInt finalOffset = CurrentReadInfo().EndOffset(); - - // Calculate how much data is remaining - const TInt amountOfDataStillToBeRead = finalOffset - startingOffset; - - __LOG4("CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() - START - startingOffset: 0x%08x, finalOffset: 0x%08x, amountToBeRead: %8d, iFinishedSupplyingData: %d", - startingOffset, finalOffset, amountOfDataStillToBeRead, iFinishedSupplyingData); - - // Get a handle to the received data - but only if we don't already - // have a handle to it! Calling this method resets whatever is already - // in the transfer chunk - hence we must only call it once (at the beginning - // of a multi-chunked transfer) - if ( iTransferChunkPointer == NULL ) - { - iTransferChunkPointer = &driver.DrvSecureBackupClient().TransferDataAddressL(); - } - - // How much space is available? - const TInt spaceAvailable = iTransferChunkPointer->MaxLength() - iTransferChunkPointer->Length(); - const TInt amountToRead = Min( spaceAvailable, Min( iReadChunkSize, amountOfDataStillToBeRead ) ); - __LOG2("CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() - xfer space available: %8d, amountToRead: %8d", spaceAvailable, amountToRead); - - // Do the read - ReadChunkL( *iTransferChunkPointer, amountToRead ); - - // Was this the last time we needed to perform a read? - const TBool lastReadFromArchive = ( CurrentOffset() == finalOffset ); - __LOG1("CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() - read data okay - lastReadFromArchive: %d", lastReadFromArchive); - - // Check to see if the data sink chunk is full. If so then we need to let - // the SBE process what we've prepared so far, then we'll fill it with more - // data. - iFinishedSupplyingData = lastReadFromArchive; - TBool moreToBeRead = !lastReadFromArchive; - if ( !iFinishedSupplyingData && iTransferChunkPointer->Length() == iTransferChunkPointer->MaxLength() ) - { - // Also cope with the boundary condition that the sink is full - // but we've also just given it the last byte anyway. In which case, - // we don't need to request a repeat transfer. This is actually - // all the data in one go. - moreToBeRead = EFalse; - } - // - __LOG1("CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() - END - more to read: %d", moreToBeRead); - return moreToBeRead; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupReadDataTransferRequestBase::PrepareForNextEntry() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupReadDataTransferRequestBase::PrepareForNextEntry() - { - TBool anotherEntryAvailable = EFalse; - - // Update our starting offset - iFinishedSupplyingData = EFalse; - iCurrentOffset = -1; - // - if ( ++iCurrentIndex < iEntries->Count() ) - { - const TMMCScBkupArchiveVector& currentReadInfo = CurrentReadInfo(); - iCurrentOffset = currentReadInfo.Offset(); - - __LOG3("CMMCScBkupReadDataTransferRequestBase::PrepareForNextEntry() - offset: %6d, length: %6d, drive: %c:", currentReadInfo.Offset(), currentReadInfo.Length(), 'A' + CurrentDrive() ); - - anotherEntryAvailable = ETrue; - } - // - return anotherEntryAvailable; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupReadDataTransferRequestBase::CurrentDrive() -// -// -// --------------------------------------------------------------------------- -TDriveNumber CMMCScBkupReadDataTransferRequestBase::CurrentDrive() const - { - return CurrentEntry().iDrive; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupReadDataTransferRequestBase::CurrentReadInfo() -// -// -// --------------------------------------------------------------------------- -const TMMCScBkupArchiveVector& CMMCScBkupReadDataTransferRequestBase::CurrentReadInfo() const - { - return CurrentEntry().iVector; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupReadDataTransferRequestBase::CurrentEntry() -// -// -// --------------------------------------------------------------------------- -const TMMCScBkupArchiveDriveAndVector& CMMCScBkupReadDataTransferRequestBase::CurrentEntry() const - { - __ASSERT_ALWAYS( iCurrentIndex >= 0 && iCurrentIndex < iEntries->Count(), User::Invariant() ); - - // Get the next entry - const TMMCScBkupArchiveDriveAndVector& entry = (*iEntries)[ iCurrentIndex ]; - return entry; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupReadDataTransferRequestBase::RunError() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupReadDataTransferRequestBase::RunError( TInt aError ) - { -#if defined(__MMCSCBKUPLOGGING_ENABLED__) - const TSecureId sid = DataOwner().SecureId(); - __LOGFILE3("CMMCScBkupReadDataTransferRequestBase::RunError() - **** - aError: %d, sid: 0x%08x, drive: %c", aError, sid.iId, 'A' + CurrentDrive() ); -#endif - - TInt ret = KErrNone; - - if ( aError == KErrNotFound ) - { - // KErrNotFound is treated as non-fatal. - const TBool entryAvailable = PrepareForNextEntry(); - - // Try the next entry (if any) - TState nextState = EProcessData; - if ( entryAvailable ) - { - __LOGFILE("CMMCScBkupReadDataTransferRequestBase::RunError() - **** - another drive available for same DO - trying the next drive..."); - nextState = EProcessData; - } - else - { - // Done - __LOGFILE("CMMCScBkupReadDataTransferRequestBase::RunError() - **** - no drives let for same DO..."); - nextState = EFinished; - } - - SetState( nextState ); - CompleteSelf(); - } - else - { - // Everything else is fatal - __LOGFILE1( "CMMCScBkupReadDataTransferRequestBase::RunError() - **** - FATAL ERROR (%d)", aError ); - ret = CMMCScBkupTransferRequestBase::RunError( aError ); - } - // - return ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupReadDataTransferRequestBase::DumpTransferDataL() -// -// -// --------------------------------------------------------------------------- -#ifdef DEBUGGING_DATA_TRANSFER -void CMMCScBkupReadDataTransferRequestBase::DumpTransferDataL( RFs& aFsSession, const TDesC8& aData ) const - { - TPtrC subDirectory( KNullDesC ); - // - switch( ElementType() ) - { - case EMMCScBkupOwnerDataTypeJavaData: - subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataJava); - break; - case EMMCScBkupOwnerDataTypeSystemData: - subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataSystem); - break; - case EMMCScBkupOwnerDataTypePassiveData: - subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataPassive); - break; - case EMMCScBkupOwnerDataTypeActiveData: - subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataActive); - break; - default: - User::Leave( KErrNotSupported ); - break; - } - // - const TSecureId secureId = DataOwner().SecureId(); - _LIT(KMMCScBkupFormatDes, "%S%S"); - TFileName transferDumpFileName; - const TDesC& path = PathInfo::MemoryCardRootPath(); - transferDumpFileName.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot); - - transferDumpFileName.Append( subDirectory ); - transferDumpFileName.Append( KMMCScBkupDataTransferDebuggingPathDataRestore ); - transferDumpFileName.AppendFormat( KMMCScBkupDataTransferDebuggingFileName, secureId.iId, 'a' + CurrentDrive() ); - // - RFile64 file; - TInt error = KErrNone; - TEntry entry; - if ( aFsSession.Entry( transferDumpFileName, entry ) == KErrNone ) - { - // Already exists - append data - error = file.Open( aFsSession, transferDumpFileName, EFileWrite | EFileStream | EFileShareExclusive ); - } - else - { - entry.iSize = 0; - error = file.Create( aFsSession, transferDumpFileName, EFileWrite | EFileStream | EFileShareExclusive ); - } - // - User::LeaveIfError( error ); - CleanupClosePushL( file ); - error = file.Write( entry.iSize, aData ); - CleanupStack::PopAndDestroy( &file ); - } -#endif - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupTransferRequest.cpp --- a/filemanager/bkupengine/src/CMMCScBkupTransferRequest.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,271 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupTransferRequestBase implementation -* -* -*/ - -#include "CMMCScBkupTransferRequest.h" - -// User includes -#include "MMCScBkupLogger.h" -#include "MMMCScBkupDriver.h" -#include "CMMCScBkupArchive.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "MMMCScBkupArchiveDataInterface.h" - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupTransferRequestBase::CMMCScBkupTransferRequestBase() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupTransferRequestBase::CMMCScBkupTransferRequestBase( MMMCScBkupDriver& aDriver, TMMCScBkupOwnerDataType aElementType, TBool aUpdateOperationalSizes, TInt aPriority ) -: CActive( aPriority ), iDriver( aDriver ), iElementType( aElementType ), iUpdateOperationalSizes( aUpdateOperationalSizes ) - { - CActiveScheduler::Add( this ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupTransferRequestBase::~CMMCScBkupTransferRequestBase() -// -// C++ destructor. -// --------------------------------------------------------------------------- -CMMCScBkupTransferRequestBase::~CMMCScBkupTransferRequestBase() - { - Cancel(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupTransferRequestBase::RequestL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupTransferRequestBase::RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver ) - { - __ASSERT_ALWAYS( !IsActive(), User::Invariant() ); - // - iDataOwner = &aOwner; - SetObserver( aObserver ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupTransferRequestBase::SingleDriveTransferCompleteL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupTransferRequestBase::SingleDriveTransferCompleteL() - { - if ( iUpdateOperationalSizes ) - { - const TDriveNumber drive = CurrentDrive(); - const TInt amount = AmountOfDataTransferred(); - __LOG3("CMMCScBkupTransferRequestBase::SingleDriveTransferCompleteL() - drive: %c:, amount: %8d, elementType: %S", drive + 'A', amount, &MMCScBkupLogger::DataType( ElementType() ) ); - // - ASSERT( drive >= EDriveA && drive <= EDriveZ ); - } - - ResetDataTransferCounter(); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupTransferRequestBase::TransferCompleteL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupTransferRequestBase::TransferCompleteL() - { - DataOwner().SetCompletionStatus( iElementType, ETrue ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupTransferRequestBase::CompleteSelf() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupTransferRequestBase::CompleteSelf( TInt aCompletionCode ) - { - SetActive(); - TRequestStatus* status = &iStatus; - User::RequestComplete(status, aCompletionCode); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupTransferRequestBase::SetObserver() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupTransferRequestBase::SetObserver( TRequestStatus& aObserver ) - { - __ASSERT_DEBUG( iObserver == NULL, User::Invariant() ); - iObserver = &aObserver; - aObserver = KRequestPending; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupTransferRequestBase::CompleteObserverRequest() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupTransferRequestBase::CompleteObserverRequest( TInt aCompletionCode ) - { - __LOG1("CMMCScBkupTransferRequestBase::CompleteObserverRequest() - aCompletionCode: %d", aCompletionCode); - __ASSERT_ALWAYS(iObserver != NULL, User::Invariant()); - User::RequestComplete(iObserver, aCompletionCode); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupTransferRequestBase::RunL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupTransferRequestBase::RunL() - { - __LOG2("CMMCScBkupTransferRequestBase::RunL() - START - iStatus: %d, iState: %d", iStatus.Int(), iState); - - User::LeaveIfError( iStatus.Int() ); - // - switch( State() ) - { - case ETransferData: - __LOG("CMMCScBkupTransferRequestBase::RunL() - ETransferData"); - PrepareDataTransferL(); - break; - - case EProcessData: - __LOG("CMMCScBkupTransferRequestBase::RunL() - EProcessData"); - ProcessDataChunkL(); - break; - - case EFinished: - // Inform any interested derived classes - __LOG("CMMCScBkupTransferRequestBase::RunL() - EFinished - transfer complete...."); - TransferCompleteL(); - - // Notify observer - __LOG("CMMCScBkupTransferRequestBase::RunL() - EFinished - complete observer..."); - CompleteObserverRequest( KErrNone ); - break; - - default: - case EIdle: - __LOG("CMMCScBkupTransferRequestBase::RunL() - EIdle - User::Invariant()"); - ASSERT( EFalse ); - break; - } - - __LOG2("CMMCScBkupTransferRequestBase::RunL() - END - iStatus: %d, iState: %d", iStatus.Int(), iState); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupTransferRequestBase::DoCancel() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupTransferRequestBase::DoCancel() - { - CompleteObserverRequest( KErrCancel ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupTransferRequestBase::RunError() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupTransferRequestBase::RunError( TInt aError ) - { - if ( aError != KErrNone ) - { - __LOGFILE1("CMMCScBkupTransferRequestBase::RunError() - **** - ERROR (%d) -> complete observer with error code", aError); - } - // - CompleteObserverRequest( aError ); - return KErrNone; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupTransferRequestBase::ProcessDataChunkL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupTransferRequestBase::ProcessDataChunkL() - { - __LOG("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - START"); - - // Now call virtual function to do the processing - const TBool requiresMoreChunkProcessing = ProcessChunkOfDataL(); - __LOG1("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - requiresMoreChunkProcessing: %d", requiresMoreChunkProcessing); - // - TState nextState = EProcessData; - if ( !requiresMoreChunkProcessing ) - { - __LOG("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - didnt require more processing... "); - SingleDriveTransferCompleteL(); - // - nextState = ETransferData; - __LOG("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - nextState is: ETransferData"); - } - else - { - __LOG("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - nextState is: EProcessData"); - } - - // Must check IsActive(), since CMMCScBkupReadDataTransferRequestBase::ProcessChunkOfDataL() - // changes state and set's active within the ProcessChunkOfDataL callback - if ( !IsActive() ) - { - __LOG("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - not active - completing self and changing state!"); - SetState( nextState ); - CompleteSelf(); - } - else - { - __LOG1("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - already active - state is: %d", State()); - } - - __LOG("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - END"); - } - - - - - - - - - - - - - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/CMMCScBkupTransferWriteRequest.cpp --- a/filemanager/bkupengine/src/CMMCScBkupTransferWriteRequest.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,491 +0,0 @@ -/* -* Copyright (c) 2005 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: CMMCScBkupWriteDataTransferRequestBase implementation -* -* -*/ - -#include "CMMCScBkupTransferWriteRequest.h" - -// User includes -#include "MMCScBkupLogger.h" -#include "MMMCScBkupDriver.h" -#include "CMMCScBkupArchive.h" -#include "MMCScBkupSBEUtils.h" -#include "RMMCScBkupProgressSizer.h" -#include "MMMCScBkupProgressObserver.h" -#include "MMMCScBkupArchiveDataInterface.h" -#include "CMMCScBkupDriveAndOperationTypeManager.h" -#include - - - -#ifdef __MMCSCBKUP_DATA_LOGGING_ENABLED__ - -static void __DebugDump( const TDesC& aFmt, const TUint8* aAddress, const TUint8* aDisplayStartAddress, TInt aLength, TInt aMaxLength) - { - const TInt maxLen = aMaxLength; - TInt len = aLength; - const TUint8* pDataAddr = aAddress; - - TBuf<81> out; - TBuf<20> ascii; - TInt offset = 0; - const TUint8* a = pDataAddr; - const TUint8* displayAddress = aDisplayStartAddress; - // - while(len>0) - { - out.Zero(); - ascii.Zero(); - out.AppendNumFixedWidth((TUint) displayAddress, EHex, 8); - out.Append(_L(": ")); - - TUint b; - for (b=0; b<16; b++) - { - TUint8 c = ' '; - if ((pDataAddr + offset + b) < pDataAddr + maxLen) - { - c = *(pDataAddr + offset + b); - out.AppendNumFixedWidth(c, EHex, 2); - } - else - { - out.Append(_L(" ")); - } - out.Append(' '); - if (c<=0x20 || c>=0x7f || c=='%') - c=0x2e; - ascii.Append(TChar(c)); - } - out.Append(ascii); - out.ZeroTerminate(); - - RDebug::Print(aFmt, &out); - - displayAddress += 16; - a += 16; - offset += 16; - len -= 16; - } - } - -#endif - - - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMMCScBkupWriteDataTransferRequestBase::CMMCScBkupWriteDataTransferRequestBase() -// -// C++ constructor. -// --------------------------------------------------------------------------- -CMMCScBkupWriteDataTransferRequestBase::CMMCScBkupWriteDataTransferRequestBase( - MMMCScBkupDriver& aDriver, - MMMCScBkupIndexHandler& aIndexHandler, - TMMCScBkupOwnerDataType aElementType, - TSBDerivedType aExpectedTransferType, - TInt aPriority ) - -: CMMCScBkupTransferRequestBase( aDriver, aElementType, aPriority ), - iIndexHandler( aIndexHandler ), - iExpectedTransferType( aExpectedTransferType ) - { - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupWriteDataTransferRequestBase::~CMMCScBkupWriteDataTransferRequestBase() -// -// Destructor. -// --------------------------------------------------------------------------- -CMMCScBkupWriteDataTransferRequestBase::~CMMCScBkupWriteDataTransferRequestBase() - { - delete iTransferType; - if ( iStreamIsOpen ) - { - iStream.Close(); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupWriteDataTransferRequestBase::RequestL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupWriteDataTransferRequestBase::RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver, const CMMCScBkupDriveAndOperationTypeManager& aDriveAndOperations ) - { -#ifdef __MMCSCBKUPLOGGING_ENABLED__ - if ( ElementType() == EMMCScBkupOwnerDataTypeJavaData ) - { - HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( aOwner.Owner().Identifier() ); - __LOG2("CMMCScBkupWriteDataTransferRequestBase::RequestL() - START - reading data from SBE for JavaHash: %S, ElementType: %S", hash, &MMCScBkupLogger::DataType( ElementType() )); - CleanupStack::PopAndDestroy( hash ); - } - else - { - __LOG2("CMMCScBkupWriteDataTransferRequestBase::RequestL() - START - reading data from SBE for DO: 0x%08x, ElementType: %S", aOwner.SecureId().iId, &MMCScBkupLogger::DataType( ElementType() )); - } -#endif - - iDriveAndOperations = &aDriveAndOperations; - CMMCScBkupTransferRequestBase::RequestL( aOwner, aObserver ); - // - iDriveFilter.Reset(); - iDriveFilter.SetPrimaryDriveFilter( iDriveAndOperations->DriveList() ); - iDriveFilter.SetSecondaryDriveFilter( aOwner.Owner().DriveList() ); - - // Set us going - SetState( ETransferData ); - CompleteSelf(); - __LOG("CMMCScBkupWriteDataTransferRequestBase::RequestL() - END"); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() -// -// -// --------------------------------------------------------------------------- -TBool CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - { - MMMCScBkupDriver& driver = Driver(); - MMMCScBkupArchiveDataInterface& archiveDataInterface = driver.DrvADI(); - - // Get a handle to the received data - TBool finished = EFalse; - CSBGenericTransferType* receivedTransferInfo = NULL; - const TPtrC8& pData = driver.DrvSecureBackupClient().TransferDataInfoL( receivedTransferInfo, finished ); - iAdditionalTransferRequired = !finished; - - __LOG4("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - received: %d bytes from SBE for SID: 0x%08x, Drive: %c:, ElementType: %S", pData.Length(), DataOwner().SecureId().iId, 'A' + CurrentDrive(), &MMCScBkupLogger::DataType( ElementType() ) ); - - // Validate the data - CleanupStack::PushL( receivedTransferInfo ); - ValidateTransferInfoL( receivedTransferInfo ); - CleanupStack::PopAndDestroy( receivedTransferInfo ); - - // If we've never written any registration data before, then we must - // request a write stream at the current archive write pos... - if ( pData.Length() && !iStreamIsOpen ) - { - __LOG("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - stream isnt open - opening now..." ); - - iStream = archiveDataInterface.ADIWriteStreamUncompressedLC(); - CleanupStack::Pop(); // iWriteStream - gets closed in dtor in case of leave - iStreamIsOpen = ETrue; - } - - // Write the data - assumes stream already open if this is not the - // first time that we've received data for this drive... - // - // We don't use the externalisation operators, as we want to write - // only the data (no leading byte count etc). - if ( pData.Length() ) - { - __LOG1("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - got %d bytes of data...", pData.Length() ); - -#ifdef __MMCSCBKUP_DATA_LOGGING_ENABLED__ - _LIT(KDumpFormat, "SBEData - %S - "); - __DebugDump( KDumpFormat, pData.Ptr(), pData.Ptr(), pData.Length(), pData.Length() ); -#endif - - // Write the data to the stream - __LOG1("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - writing %d bytes to stream...", pData.Length() ); - iStream.WriteL(pData); - __LOG("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - data written OK"); - - // Update our stats. We overwrite any earlier estimate from the SBE - // with the actual values that we ultimately end up writing to the - // archive. This allows us to provide a more accurate restore progress - // experience. - DataTransferred( pData.Length() ); - -#ifdef DEBUGGING_DATA_TRANSFER - TRAP_IGNORE( DumpTransferDataL( archiveDataInterface.ADIFsSession(), pData ) ); -#endif - } - - // If we've received everything we can commit & close the stream - if ( finished ) - { - __LOG("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - finished..."); - - // Implicitly, if the stream is open then we have written some - // data to the archive. Therefore we only add an index record - // when the stream is open. - if ( iStreamIsOpen ) - { - __LOG("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - Committing stream..."); - iStream.CommitL(); - - __LOG("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - Closing stream..."); - iStream.Close(); - iStreamIsOpen = EFalse; - - // Must store the position, as we're going to also write an index at - // the end of this whole process. - __LOG("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - Adding index record..."); - CMMCScBkupArchiveFooter& footer = driver.DrvArchive().Footer(); - const TMMCScBkupArchiveVector& info = archiveDataInterface.ADICurrentArchiveVectorInfo(); - - // If we actually wrote something to the archive, then add an index record. - if (info.Length()) - { - iIndexHandler.AddIndexRecordL( footer, DataOwner(), info, CurrentDrive() ); - } - } - } - - // Not yet supporting chunked transfer - __LOG("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - END"); - return EFalse; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() - { - // If we must make a repeat transfer request, then we don't yet - // move to the next drive. - if ( iAdditionalTransferRequired ) - { - // Must ask for more of the same data, so no need - // to rebuild transfer info - we just reuse it - RequestDataTransferL(); - } - else - { - // Can move to the next drive - TDriveNumber drive = EDriveA; - const TBool driveAvailable = iDriveFilter.NextValidDrive( drive ); - __LOG1("CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() - current drive: %c", drive + 'A'); - __LOG1("CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() - driveAvailable: %d", driveAvailable); - - if ( driveAvailable ) - { - const TBool dataTransferAllowableForDrive = iDriveAndOperations->IsDataTypeAllowedToAccessDrive( drive, ElementType() ); - __LOG1("CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() - dataTransferAllowableForDrive: %d", dataTransferAllowableForDrive); - - if ( dataTransferAllowableForDrive ) - { - __LOG1("CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() - making transfer request for drive: %c", drive + 'A'); - - // Update the current drive - SetCurrentDrive( drive ); - - // Make virtual function call to make transfer object - const CSBGenericDataType& generic = DataOwner().Owner().Identifier(); - CSBGenericTransferType* transferType = PrepareTransferTypeL( generic, CurrentDrive(), DataOwner().Version() ); - delete iTransferType; - iTransferType = transferType; - - // We have a transfer packet, so now request data - RequestDataTransferL(); - } - else - { - // Couldn't process this drive, let's try to find another drive. - // This means we don't change state this time. - __LOG("CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() - not allowed to back up this drive... trying next one..."); - CompleteSelf( KErrNone ); - } - } - else - { - // No more drives left, we've finished! - __LOG("CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() - no more drives to process - we're finished!"); - SetState( EFinished ); - CompleteSelf(); - } - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupWriteDataTransferRequestBase::CurrentDrive() -// -// -// --------------------------------------------------------------------------- -TDriveNumber CMMCScBkupWriteDataTransferRequestBase::CurrentDrive() const - { - return iCurrentDrive; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupWriteDataTransferRequestBase::ValidateTransferInfoL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupWriteDataTransferRequestBase::ValidateTransferInfoL( CSBGenericTransferType* aInfo ) - { - if ( !aInfo ) - { - User::Leave( KErrCorrupt ); - } - - // Check the type is as expected - const TSBDerivedType type = aInfo->DerivedTypeL(); - if ( type != iExpectedTransferType ) - { - __LOG2("CMMCScBkupWriteDataTransferRequestBase::ValidateTransferInfoL() - ERROR - types dont match! type: %d vs expected: %d", type, iExpectedTransferType ); - User::Leave( KErrNotSupported ); - } - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupWriteDataTransferRequestBase::RequestDataTransferL() -// -// -// --------------------------------------------------------------------------- -void CMMCScBkupWriteDataTransferRequestBase::RequestDataTransferL() - { - __LOG3("CMMCScBkupWriteDataTransferRequestBase::RequestDataTransferL() - requesting data from SBE for SID: 0x%08x, Drive: %c:, ElementType: %S", DataOwner().SecureId().iId, 'A' + CurrentDrive(), &MMCScBkupLogger::DataType( ElementType() ) ); - - CSBEClient& sbeClient = Driver().DrvSecureBackupClient(); - sbeClient.RequestDataL( *iTransferType, iStatus ); - SetActive(); - SetState( EProcessData ); - - // Report the progress - RMMCScBkupProgressSizer progressSizer( Driver().DrvParamsBase().DriveAndOperations() ); - progressSizer.BackupReportFixedProgressForOpL( Driver().DrvProgressHandler(), ElementType() ); - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupWriteDataTransferRequestBase::RunError() -// -// -// --------------------------------------------------------------------------- -TInt CMMCScBkupWriteDataTransferRequestBase::RunError( TInt aError ) - { -#if defined(__MMCSCBKUPLOGGING_ENABLED__) - const TSecureId sid = DataOwner().SecureId(); - __LOGFILE3("CMMCScBkupWriteDataTransferRequestBase::RunError() - **** - aError: %d, sid: 0x%08x, drive: %c", aError, sid.iId, 'A' + CurrentDrive() ); -#endif - - TInt ret = KErrNone; - - // Make sure we close the stream (if we had it open) - if ( iStreamIsOpen ) - { - iStream.Close(); - iStreamIsOpen = EFalse; - } - - // Now notify the observer or silently try again (depends on type of error) - if ( aError == KErrNotFound ) - { - __LOGFILE1("CMMCScBkupWriteDataTransferRequestBase::RunError() - **** - non fatal error (%d) so trying the next drive...", aError); - - // Try the next drive - if none is available, it will complete the - // observer as if nothing went wrong. - iAdditionalTransferRequired = EFalse; - SetState( ETransferData ); - CompleteSelf(); - } - else - { - __LOGFILE1("CMMCScBkupWriteDataTransferRequestBase::RunError() - **** - FATAL ERROR (%d)", aError); - ret = CMMCScBkupTransferRequestBase::RunError( aError ); - } - // - return ret; - } - - -// --------------------------------------------------------------------------- -// CMMCScBkupWriteDataTransferRequestBase::DumpTransferDataL() -// -// -// --------------------------------------------------------------------------- -#ifdef DEBUGGING_DATA_TRANSFER -void CMMCScBkupWriteDataTransferRequestBase::DumpTransferDataL( RFs& aFsSession, const TDesC8& aData ) const - { - TPtrC subDirectory( KNullDesC ); - // - switch( ElementType() ) - { - case EMMCScBkupOwnerDataTypeJavaData: - subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataJava); - break; - case EMMCScBkupOwnerDataTypeSystemData: - subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataSystem); - break; - case EMMCScBkupOwnerDataTypePassiveData: - subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataPassive); - break; - case EMMCScBkupOwnerDataTypeActiveData: - subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataActive); - break; - default: - User::Leave( KErrNotSupported ); - break; - } - // - const TSecureId secureId = DataOwner().SecureId(); - _LIT(KMMCScBkupFormatDes, "%S%S"); - TFileName transferDumpFileName; - const TDesC& path = PathInfo::MemoryCardRootPath(); - transferDumpFileName.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot); - - transferDumpFileName.Append( subDirectory ); - transferDumpFileName.Append( KMMCScBkupDataTransferDebuggingPathDataBackup ); - transferDumpFileName.AppendFormat( KMMCScBkupDataTransferDebuggingFileName, secureId.iId, 'a' + CurrentDrive() ); - // - RFile64 file; - TInt error = KErrNone; - TEntry entry; - if ( aFsSession.Entry( transferDumpFileName, entry ) == KErrNone ) - { - // Already exists - append data - error = file.Open( aFsSession, transferDumpFileName, EFileWrite | EFileStream | EFileShareExclusive ); - } - else - { - entry.iSize = 0; - error = file.Create( aFsSession, transferDumpFileName, EFileWrite | EFileStream | EFileShareExclusive ); - } - // - User::LeaveIfError( error ); - CleanupClosePushL( file ); - error = file.Write( entry.iSize, aData ); - CleanupStack::PopAndDestroy( &file ); - } -#endif - - - - - - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/MMCScBkupArchiveUtils.cpp --- a/filemanager/bkupengine/src/MMCScBkupArchiveUtils.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,709 +0,0 @@ -/* -* Copyright (c) 2005 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: MMCScBkupArchiveUtils implementation -* -* -*/ - -#include "MMCScBkupArchiveUtils.h" - -// System includes -#include -#include - -// User includes -#include "MMCScBkupLogger.h" -#include "MMCScBkupDllUids.h" -#include "MMCScBkupPhoneModelUtils.h" -#include "CMMCScBkupArchiveFooter.h" -#include "CMMCScBkupArchiveHeader.h" -#include "MMMCScBkupArchiveDataInterface.h" -#include "MMCScBkupArchiveFlags.h" - -// Constants -const TInt8 KMMCScBkupArchiveFileFormatVersionMajor = 1; -#ifdef RD_FILE_MANAGER_BACKUP -const TInt8 KMMCScBkupArchiveFileFormatVersionMinor = 1; -#else -const TInt8 KMMCScBkupArchiveFileFormatVersionMinor = 0; -#endif -const TInt16 KMMCScBkupArchiveFileFormatVersionBuild = 1; -const TUid KMMCScBkupArchiveFileFormatUid1 = { KMMCAppEngUID3 }; -const TUid KMMCScBkupArchiveFileFormatUid2 = { 0 }; -const TUid KMMCScBkupArchiveFileFormatUid3 = { 0x0BACCCCC }; // FIX - - /** - * Fixed Header - * ============ - * - * 12 bytes = 3 uids - * 4 bytes = 1 uid crc checksum - * - * ARCHIVE FILE FORMAT VERSION - * { - * 1 byte = version major - * 1 byte = version minor - * 2 bytes = version build - * } - * - * 4 bytes = size of footer in bytes - this is always the same - * fixed length, hence we can write the size here. - * The value can then be used to work from the back of the - * archive to the starting position of the footer (where - * most of the juicy info is). - * - * 4 bytes = archive flags - * - * 4 bytes = archive payload CRC (activated when RD_FILE_MANAGER_BACKUP) - * - * 4 bytes = archive category - * - * 4 bytes = archive header CRC (activated when RD_FILE_MANAGER_BACKUP) - * - * KMMCScSpareByteCount bytes = spare padding - * - * 1 byte = phone model version string length - * n bytes = phone model version string - * - * - * - * Note that we deliberately do not use the streaming chevrons - * as we then risk the problem of running the string through - * a unicode compressor first. - */ - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::ArchiveUidType() -// -// -// --------------------------------------------------------------------------- -void MMCScBkupArchiveUtils::ArchiveUidType(TUidType& aType) - { - aType = TUidType( KMMCScBkupArchiveFileFormatUid1, - KMMCScBkupArchiveFileFormatUid2, - KMMCScBkupArchiveFileFormatUid3 ); - } - - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::ArchiveCheckedUid() -// -// -// --------------------------------------------------------------------------- -void MMCScBkupArchiveUtils::ArchiveCheckedUid(TCheckedUid& aCheckedUids) - { - TUidType uidType; - ArchiveUidType( uidType ); - aCheckedUids.Set( uidType ); - } - - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::PhoneModelFromArchiveLC() -// -// -// --------------------------------------------------------------------------- -HBufC8* MMCScBkupArchiveUtils::PhoneModelFromArchiveLC( MMMCScBkupArchiveDataInterface& aADI ) - { - const TInt phoneModelOffset = OffsetOfModelInformation(); - // - RReadStream stream( aADI.ADIReadStreamUncompressedLC( phoneModelOffset ) ); - HBufC8* modelInfo = PhoneModelFromArchiveLC( stream); - CleanupStack::PopAndDestroy(); // stream - // - return modelInfo; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::ReadPhoneValidityInformationL() -// -// -// --------------------------------------------------------------------------- -void MMCScBkupArchiveUtils::ReadPhoneValidityInformationL( RFs& aFsSession, const TDesC& aFileName, HBufC8*& aPhoneModelData, TBitFlags& aArchiveFlags, TVersion& aArchiveVersion ) - { - __ASSERT_DEBUG( aPhoneModelData == NULL, User::Invariant() ); - // - RFile64 file; - TInt error = file.Open( aFsSession, aFileName, EFileShareReadersOnly | EFileStream | EFileRead ); - User::LeaveIfError( error ); - CleanupClosePushL(file); - - // First, read the archive flags - aArchiveFlags = ReadArchiveFlagsL( file ); - - // Read version - ReadArchiveVersionL( file, aArchiveVersion ); - - // Then, create a stream interface to the file - const TInt phoneModelOffset = OffsetOfModelInformation(); - RFileReadStream stream( file, phoneModelOffset ); - CleanupStack::Pop( &file ); - CleanupClosePushL( stream ); // stream takes ownership of the file now - // - HBufC8* modelInfo = PhoneModelFromArchiveLC( stream ); - - // Unfortunately we have to juggle the cleanup stack - CleanupStack::Pop( modelInfo ); - CleanupStack::PopAndDestroy( &stream ); // also closes the file - - // Done - aPhoneModelData = modelInfo; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::ArchiveRunTimeFileFormatVersion() -// -// -// --------------------------------------------------------------------------- -TVersion MMCScBkupArchiveUtils::ArchiveRunTimeFileFormatVersion() - { - return TVersion( KMMCScBkupArchiveFileFormatVersionMajor, - KMMCScBkupArchiveFileFormatVersionMinor, - KMMCScBkupArchiveFileFormatVersionBuild ); - } - - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::WriteHeaderL() -// -// -// --------------------------------------------------------------------------- -const TMMCScBkupArchiveVector& MMCScBkupArchiveUtils::WriteHeaderL( MMMCScBkupArchiveDataInterface& aADI, - TBitFlags aCategory ) - { - __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - START"); - RWriteStream stream( aADI.ADIWriteStreamUncompressedLC() ); - - // 16 bytes = uids + *uid* checksum - __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [16] write uids + checksum"); - TCheckedUid checkedUid; - ArchiveCheckedUid( checkedUid ); - const TPtrC8 pUidAndCRC( checkedUid.Des() ); - stream.WriteL( pUidAndCRC ); - - // 4 bytes = file format version - __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [ 4] write version"); - const TVersion version( ArchiveRunTimeFileFormatVersion() ); - stream.WriteInt8L( version.iMajor ); - stream.WriteInt8L( version.iMinor ); - stream.WriteInt16L( version.iBuild ); - - // 4 bytes = Footer length - starts life as length of 0, and - // is then written to again later on after the footer has - // been exteranlised. - __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [ 4] write size of footer (starts life as 0)"); - const TInt footerLength = 0; - stream.WriteInt32L( footerLength ); - - // 4 bytes = Archive flags - __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [ 4] archive flags (archive starts life invalid)"); - const TUint32 defaultArchiveFlags = DefaultArchiveFlags(); - stream.WriteUint32L( defaultArchiveFlags ); - - // 4 bytes = Initial payload CRC value, this will be updated with the final - // CRC once the entire archive has been prepared. - __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [ 4] archive payload CRC"); - const TUint32 initialPayloadCRC = 0; - stream.WriteUint32L( initialPayloadCRC ); - - __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [ 4] archive category"); - stream.WriteUint32L( aCategory.iFlags ); - - // 4 bytes = Initial header CRC value, this will be updated with the final - // CRC once the entire archive has been prepared. - __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [ 4] archive header CRC"); - const TUint32 initialHeaderCRC = 0; - stream.WriteUint32L( initialHeaderCRC ); - - // KMMCScSpareByteCount = padding, for future use - __LOG1("MMCScBkupArchiveUtils::WriteHeaderL() - [%d] padding/spare data", KMMCScSpareByteCount); - for(TInt i = 0; i < KMMCScSpareByteCount/sizeof(TInt32); i++) - { - stream.WriteInt32L( 0 ); - } - - // 1 byte = Phone model version string length - __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [ 1] phone model length"); - HBufC8* phoneModelString = MMCScBkupPhoneModelUtils::CurrentPhoneModelLC(); - stream.WriteInt8L( phoneModelString->Length() ); - - // Then the version string itself - __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [??] phone model string"); - stream.WriteL( *phoneModelString ); - - // Tidy up - __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - committing stream..."); - stream.CommitL(); - __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - destroying stream..."); - CleanupStack::PopAndDestroy( 2 ); // phoneModelString and stream - - __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - END"); - return aADI.ADICurrentArchiveVectorInfo(); - } - - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::ReadHeaderL() -// -// -// --------------------------------------------------------------------------- -const TMMCScBkupArchiveVector& MMCScBkupArchiveUtils::ReadHeaderL( MMMCScBkupArchiveDataInterface& aADI, CMMCScBkupArchiveHeader& aHeader ) - { - __LOG("MMCScBkupArchiveUtils::ReadHeaderL() - START"); - RReadStream stream( aADI.ADIReadStreamUncompressedLC() ); - - // 16 bytes = uids + *uid* checksum - TBuf8<16> uidBuffer; - stream.ReadL( uidBuffer, uidBuffer.MaxLength() ); - - // Create a UID type objjec - TCheckedUid checkedUid( uidBuffer ); - const TUidType uids( checkedUid.UidType()) ; - __LOG3("MMCScBkupArchiveUtils::ReadHeaderL() - uids: 0x%08x/0x%08x/0x%08x", uids[0], uids[1], uids[2] ); - if ( uids[0] == KNullUid && uids[1] == KNullUid && uids[2] == KNullUid ) - { - // Apparently, TCheckedUid sets the uids to 0 when the CRC doesn't match - // the value read from the file. - User::Leave( KErrNotSupported ); - } - aHeader.SetCheckedUid( checkedUid ); - - // 4 bytes = file format version - TVersion version; - version.iMajor = stream.ReadInt8L(); - version.iMinor = stream.ReadInt8L(); - version.iBuild = stream.ReadInt16L(); - aHeader.SetVersion( version ); - __LOG3("MMCScBkupArchiveUtils::ReadHeaderL() - version: %3d.%3d.%6d", version.iMajor, version.iMinor, version.iBuild ); - - // 4 bytes = Length of footer - const TInt footerLength = stream.ReadInt32L(); - aHeader.SetFooterLength( footerLength ); - __LOG1("MMCScBkupArchiveUtils::ReadHeaderL() - footerLength: %d", footerLength); - - // 4 bytes = Archive flags - const TUint32 archiveFlags = stream.ReadUint32L(); - aHeader.SetArchiveFlags( archiveFlags ); - __LOG1("MMCScBkupArchiveUtils::ReadHeaderL() - archiveFlags: %d", archiveFlags); - - // 4 bytes = Archive payload CRC - const TUint32 payloadCRC = stream.ReadUint32L(); - __LOG1("MMCScBkupArchiveUtils::ReadHeaderL() - archive payload CRC: %d", payloadCRC); - - // 4 bytes = Archive Category - const TUint32 archiveCategory = stream.ReadUint32L(); - __LOG1("MMCScBkupArchiveUtils::ReadHeaderL() - archiveCategory: %d", archiveCategory); - - // 4 bytes = Archive header CRC - const TUint32 headerCRC = stream.ReadUint32L(); - __LOG1("MMCScBkupArchiveUtils::ReadHeaderL() - archive header CRC: %d", headerCRC); - - // KMMCScSpareByteCount of padding (spare) data. Skip for now - for(TInt i = 0; i < KMMCScSpareByteCount/sizeof(TInt32); i++) - { - (void) stream.ReadInt32L(); - } - - // Then the version string itself - which is handled through a separate method: - HBufC8* phoneModel = PhoneModelFromArchiveLC( stream ); - aHeader.SetPhoneModelIdentifierL( *phoneModel ); - CleanupStack::PopAndDestroy( phoneModel ); - - // Clean up - CleanupStack::PopAndDestroy(); // stream - - __LOG("MMCScBkupArchiveUtils::ReadHeaderL() - END"); - return aADI.ADICurrentArchiveVectorInfo(); - } - - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::OffsetOfModelInformation() -// -// -// --------------------------------------------------------------------------- -TInt MMCScBkupArchiveUtils::OffsetOfModelInformation() - { - return EArchiveOffsetPhoneModelStringLength; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::PhoneModelFromArchiveLC() -// -// -// --------------------------------------------------------------------------- -HBufC8* MMCScBkupArchiveUtils::PhoneModelFromArchiveLC( RReadStream& aStream ) - { - const TInt length = aStream.ReadInt8L(); - - // Validate against preconditions - const TInt maxLength = MMCScBkupPhoneModelUtils::MaximumPhoneModelIdentifierLength(); - if ( length > maxLength || length < 0 ) - { - User::Leave( KErrCorrupt ); - } - - // Now try to read the model identifier - HBufC8* model = HBufC8::NewLC( length ); - TPtr8 pModel( model->Des() ); - aStream.ReadL( pModel, length ); - - // All done - return model; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::DefaultArchiveFlags() -// -// -// --------------------------------------------------------------------------- -TUint32 MMCScBkupArchiveUtils::DefaultArchiveFlags() - { - return EMMCScBkupArchiveFlagsDefault; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::SetArchiveContentAsValidL() -// -// -// --------------------------------------------------------------------------- -void MMCScBkupArchiveUtils::SetArchiveContentAsValidL( RFile64& aArchive ) - { - TInt error = KErrNone; - - // Calculate the offset to the archive flags: - const TUint archiveFlagsFileOffset = EArchiveOffsetArchiveFlags; - - // Flags are four bytes. Read the existing raw flag data - TBuf8< KMMCScArchiveFlagsByteCount > flagData; - error = aArchive.Read( static_cast( archiveFlagsFileOffset ), flagData ); - User::LeaveIfError( error ); - - // Interpret the flag data as real flags - RDesReadStream readStream( flagData ); - CleanupClosePushL( readStream ); - TUint32 archiveFlags = readStream.ReadUint32L(); - CleanupStack::PopAndDestroy( &readStream ); - - // Twiddle the "archive is complete/valid" bits - archiveFlags |= EMMCScBkupArchiveFlagsContentValid; - - // Write the flags back out the descriptor - flagData.Zero(); - RDesWriteStream writeStream( flagData ); - CleanupClosePushL( writeStream ); - writeStream.WriteUint32L( archiveFlags ); - writeStream.CommitL(); - CleanupStack::PopAndDestroy( &writeStream ); - - // Then write them to the file itself - error = aArchive.Write( static_cast( archiveFlagsFileOffset ), flagData ); - User::LeaveIfError( error ); - } - - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::SetFooterLengthL() -// -// -// --------------------------------------------------------------------------- -void MMCScBkupArchiveUtils::SetFooterLengthL( RFile64& aArchive, TInt aLength ) - { - TInt error = KErrNone; - - // Calculate the offset to the footer length: - const TUint archiveFooterLengthOffset = EArchiveOffsetFooterLength; - - // Prepare externalized representation of length - TBuf8< KMMCScArchiveFooterLengthByteCount > footerLengthData; - RDesWriteStream writeStream( footerLengthData ); - CleanupClosePushL( writeStream ); - writeStream.WriteInt32L( aLength ); - writeStream.CommitL(); - CleanupStack::PopAndDestroy( &writeStream ); - - // Then write them to the file itself - error = aArchive.Write( static_cast( archiveFooterLengthOffset ), footerLengthData ); - User::LeaveIfError( error ); - } - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::ReadBkUpCategoryInformationL() -// -// -// --------------------------------------------------------------------------- -TBitFlags MMCScBkupArchiveUtils::ReadBkUpCategoryInformationL( RFs& aFsSession, const TDesC& aFileName ) - { - RFile64 file; - TInt error = file.Open( aFsSession, aFileName, EFileShareReadersOnly | EFileStream | EFileRead ); - User::LeaveIfError( error ); - CleanupClosePushL(file); - - // Then, create a stream interface to the file - RFileReadStream stream( file, EArchiveOffsetArchiveCategory ); - CleanupStack::Pop( &file ); - CleanupClosePushL( stream ); // stream takes ownership of the file now - // - TUint category = stream.ReadUint32L(); - - CleanupStack::PopAndDestroy( &stream ); // also closes the file - - TBitFlags ret; - ret.SetValue( category ); - - return ret; - } - - -#ifdef RD_FILE_MANAGER_BACKUP -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::SetArchiveCrcsL() -// -// -// --------------------------------------------------------------------------- -void MMCScBkupArchiveUtils::SetArchiveCrcsL( RFile64& aArchive, TUint32 aCrc ) - { - TInt error = KErrNone; - - // Payload crc - SetArchiveCrcL( aArchive, aCrc, EArchiveOffsetArchivePayloadCRC ); - - // Calculate and write header crc also to the file - TBuf8< KMMCScArchivePhoneModelStringLength > length; - TUint32 modelLength; - TUint32 headerCrc = 0; - - error = aArchive.Read( static_cast( EArchiveOffsetPhoneModelStringLength ), length ); - User::LeaveIfError(error); - RDesReadStream readStream( length ); - CleanupClosePushL( readStream ); - modelLength = readStream.ReadUint8L(); - CleanupStack::PopAndDestroy( &readStream ); - - CalculateCrcFromArchive( headerCrc, aArchive, 0, EArchiveOffsetArchiveHeaderCRC); - CalculateCrcFromArchive( headerCrc, aArchive, EArchiveOffsetArchiveHeaderCRC + KMMCScArchiveCrcByteCount, - KMMCScSpareByteCount + KMMCScArchivePhoneModelStringLength + modelLength); - SetArchiveCrcL( aArchive, headerCrc, EArchiveOffsetArchiveHeaderCRC ); - } - - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::ValidateArchiveCrcsL() -// -// -// --------------------------------------------------------------------------- -TBool MMCScBkupArchiveUtils::ValidateArchiveCrcsL( RFs& aFsSession, const TDesC& aFileName ) - { - TBool validCrc = EFalse; - - RFile64 file; - TInt64 size; - - TInt error = file.Open( aFsSession, aFileName, EFileShareReadersOnly | EFileRead ); - - if ( error == KErrNone && file.Size(size) == KErrNone) - { - TBuf8< KMMCScArchiveFlagsByteCount > headerCrc; - TBuf8< KMMCScArchiveFlagsByteCount > payloadCrc; - TBuf8< KMMCScArchivePhoneModelStringLength > length; - TUint32 archivedHeaderCrc, calculatedHeaderCrc; - TUint32 archivedPayloadCrc, calculatedPayloadCrc; - TUint32 modelLength; - - // Read crcs from header - error = file.Read( static_cast( EArchiveOffsetArchiveHeaderCRC ), headerCrc ); - User::LeaveIfError(error); - error = file.Read( static_cast( EArchiveOffsetArchivePayloadCRC ), payloadCrc ); - User::LeaveIfError(error); - error = file.Read( static_cast( EArchiveOffsetPhoneModelStringLength ), length ); - User::LeaveIfError(error); - CleanupClosePushL( file ); - - RDesReadStream readStream( headerCrc ); - CleanupClosePushL( readStream ); - archivedHeaderCrc = readStream.ReadUint32L(); - readStream.Close(); - readStream.Open(payloadCrc); - archivedPayloadCrc = readStream.ReadUint32L(); - readStream.Close(); - readStream.Open(length); - modelLength = readStream.ReadUint8L(); - CleanupStack::PopAndDestroy( &readStream ); - - // Calculate crc from header in two parts - calculatedHeaderCrc = 0; - CalculateCrcFromArchive( calculatedHeaderCrc, file, 0, EArchiveOffsetArchiveHeaderCRC); - CalculateCrcFromArchive( calculatedHeaderCrc, file, EArchiveOffsetArchiveHeaderCRC + KMMCScArchiveCrcByteCount, - KMMCScSpareByteCount + KMMCScArchivePhoneModelStringLength + modelLength); - - // Calculate crc from payload and footer - TInt payloadSize = size - (EArchiveOffsetPhoneModelString + modelLength); - calculatedPayloadCrc = 0; - CalculateCrcFromArchive( calculatedPayloadCrc, file, EArchiveOffsetPhoneModelString + modelLength, payloadSize); - - if(archivedPayloadCrc == calculatedPayloadCrc && archivedHeaderCrc == calculatedHeaderCrc) - { - validCrc = ETrue; - } - else - { - __LOG4("MMCScBkupArchiveUtils::ValidateArchiveCrcsL() - crc mismatch: %u vs. %u - %u vs. %u", - archivedPayloadCrc, calculatedPayloadCrc, archivedHeaderCrc, calculatedHeaderCrc); - } - - CleanupStack::PopAndDestroy( &file ); - } - - return validCrc; - } -#endif // RD_FILE_MANAGER_BACKUP - - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::ReadArchiveFlagsL() -// -// -// --------------------------------------------------------------------------- -TBitFlags MMCScBkupArchiveUtils::ReadArchiveFlagsL( RFile64& aArchive ) - { - TInt error = KErrNone; - - // Calculate the offset to the archive flags: - const TUint archiveFlagsFileOffset = EArchiveOffsetArchiveFlags; - - // Flags are four bytes. Read the existing raw flag data - TBuf8< KMMCScArchiveFlagsByteCount > flagData; - error = aArchive.Read( static_cast( archiveFlagsFileOffset ), flagData ); - User::LeaveIfError( error ); - - // Interpret the flag data as real flags - RDesReadStream readStream( flagData ); - CleanupClosePushL( readStream ); - TUint32 archiveFlags = readStream.ReadUint32L(); - CleanupStack::PopAndDestroy( &readStream ); - - // Done - TBitFlags ret; - ret.SetValue( archiveFlags ); - return ret; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::ReadArchiveVersionL() -// -// -// --------------------------------------------------------------------------- -void MMCScBkupArchiveUtils::ReadArchiveVersionL( RFile64& aArchive, TVersion& aVersion ) - { - TInt error = KErrNone; - - // Calculate the offset to the archive flags: - const TUint archiveVersionFileOffset = EArchiveOffsetFileFormatVersion; - - // Flags are four bytes. Read the existing raw flag data - TBuf8< KMMCScArchiveVersionByteCount > versionData; - error = aArchive.Read( static_cast( archiveVersionFileOffset ), versionData ); - User::LeaveIfError( error ); - - // Interpret the flag data as real flags - RDesReadStream readStream( versionData ); - CleanupClosePushL( readStream ); - aVersion.iMajor = readStream.ReadInt8L(); - aVersion.iMinor = readStream.ReadInt8L(); - aVersion.iBuild = readStream.ReadInt16L(); - CleanupStack::PopAndDestroy( &readStream ); - } - - -#ifdef RD_FILE_MANAGER_BACKUP -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::SetArchiveCrcL() -// -// -// --------------------------------------------------------------------------- -void MMCScBkupArchiveUtils::SetArchiveCrcL( RFile64& aArchive, TUint32 aCrc, TUint aOffset ) - { - TInt error = KErrNone; - - // Prepare externalized representation of crc - TBuf8< KMMCScArchiveCrcByteCount > crcData; - RDesWriteStream writeStream( crcData ); - CleanupClosePushL( writeStream ); - writeStream.WriteInt32L( aCrc ); - writeStream.CommitL(); - CleanupStack::PopAndDestroy( &writeStream ); - - // Then write crc to the file itself - error = aArchive.Write( static_cast( aOffset ), crcData ); - User::LeaveIfError( error ); - } - - -// --------------------------------------------------------------------------- -// MMCScBkupArchiveUtils::CalculateCrcFromArchive() -// -// -// --------------------------------------------------------------------------- -void MMCScBkupArchiveUtils::CalculateCrcFromArchive( TUint32& aCrc, RFile64& aArchive, TUint32 aOffset, TUint32 aLength ) - { - const TInt KBigBufSize=0x10000; - const TInt KMediumBufSize=0x8000; - const TInt KSmallBufSize=0x1000; - - // Allocate as large buffer as possible for crc validation, because - // need to read file content in chunks for crc calculation. - HBufC8* bufPtr = HBufC8::New(KBigBufSize); - - if ( bufPtr == NULL ) - bufPtr = HBufC8::New(KMediumBufSize); - if ( bufPtr == NULL ) - bufPtr = HBufC8::New(KSmallBufSize); - - if ( bufPtr != NULL) - { - TPtr8 copyBuf = bufPtr->Des(); - TInt64 pos = aOffset; - TInt size = aLength; - - // Loop through archive file skipping archive crc - while(size) - { - TInt s; - - s = Min( size, copyBuf.MaxSize() ); - - TInt error = aArchive.Read( pos, copyBuf, s ); - - if ( error == KErrNone && copyBuf.Length() != s ) - break; - - pos += s; - size -= s; - Mem::Crc32(aCrc, copyBuf.Ptr(), copyBuf.Length()); - } - - delete bufPtr; - } - } -#endif // RD_FILE_MANAGER_BACKUP - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/MMCScBkupLogger.cpp --- a/filemanager/bkupengine/src/MMCScBkupLogger.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,251 +0,0 @@ -/* -* Copyright (c) 2005 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: MMCScBkupLogger implementation -* -* -*/ - -#include "MMCScBkupLogger.h" - -// System includes -#include -#include -#include - -#if defined(__MMCSCBKUPLOGGING_ENABLED__) - -// Constants -const TInt KMMCScBkupLoggingMaxLogTextLength = 1024; -const TInt KMMCScBkupLoggingMaxLogSize = 10240; - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// MMCScBkupLogger::LogRaw() -// -// -// --------------------------------------------------------------------------- -void MMCScBkupLogger::LogRaw( const TDesC& aData ) - { -#if defined(__MMCSCBKUPLOGGING_MODE_FILE__) - - _LIT( KMMCScBkupLoggingDir, "FMBkup" ); - _LIT( KMMCScBkupLoggingFileName, "FMBkup.txt" ); - - ///////////// - // FLOGGER - ///////////// - RFileLogger::Write( KMMCScBkupLoggingDir, KMMCScBkupLoggingFileName, EFileLoggingModeAppend, aData ); - -#elif defined(__MMCSCBKUPLOGGING_MODE_RDEBUG__) - - ///////////// - // RDEBUG - ///////////// - _LIT( KLogComponentName, "[MMC] "); - HBufC* printBuf = HBufC::New( aData.Length() + KLogComponentName().Length() ); - if ( printBuf ) - { - TPtr pBuf( printBuf->Des() ); - pBuf.Append( KLogComponentName ); - pBuf.Append( aData ); - RDebug::Print( *printBuf ); - delete printBuf; - } - else - { - RDebug::Print( aData ); - } - -#endif - } - - -// --------------------------------------------------------------------------- -// MMCScBkupLogger::Log() -// -// -// --------------------------------------------------------------------------- -void MMCScBkupLogger::Log( TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - - HBufC* buf = HBufC::New( KMMCScBkupLoggingMaxLogTextLength ); - if ( buf ) - { - TPtr pBuf( buf->Des() ); - pBuf.FormatList(aFmt, list); - LogRaw( *buf ); - delete buf; - } - } - - -// --------------------------------------------------------------------------- -// MMCScBkupLogger::DataType() -// -// -// --------------------------------------------------------------------------- -const TDesC& MMCScBkupLogger::DataType( TMMCScBkupOwnerDataType aType ) - { - switch( aType ) - { - case EMMCScBkupOwnerDataTypeDataOwner: - { - _LIT(KRet, "EMMCScBkupOwnerDataTypeDataOwner"); - return KRet; - } - case EMMCScBkupOwnerDataTypeJavaData: - { - _LIT(KRet, "EMMCScBkupOwnerDataTypeJavaData"); - return KRet; - } - case EMMCScBkupOwnerDataTypePublicData: - { - _LIT(KRet, "EMMCScBkupOwnerDataTypePublicData"); - return KRet; - } - case EMMCScBkupOwnerDataTypeSystemData: - { - _LIT(KRet, "EMMCScBkupOwnerDataTypeSystemData"); - return KRet; - } - case EMMCScBkupOwnerDataTypeActiveData: - { - _LIT(KRet, "EMMCScBkupOwnerDataTypeActiveData"); - return KRet; - } - case EMMCScBkupOwnerDataTypePassiveData: - { - _LIT(KRet, "EMMCScBkupOwnerDataTypePassiveData"); - return KRet; - } - case EMMCScBkupOwnerDataTypeAny: - { - _LIT(KRet, "EMMCScBkupOwnerDataTypeAny"); - return KRet; - } - default: - break; - } - - _LIT(KRet, "UNKNOWN!"); - return KRet; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupLogger::FriendlyNameForSID() -// -// -// --------------------------------------------------------------------------- -const TDesC& MMCScBkupLogger::FriendlyNameForSID( TSecureId aSID ) - { - switch( aSID.iId ) - { - case 0x10202be9: - { - _LIT(KRet, "[CentRep]"); - return KRet; - } - case 0x10008d38: - { - _LIT(KRet, "[FavouritesSrv]"); - return KRet; - } - case 0x101f51f2: - { - _LIT(KRet, "[RightsServer]"); - return KRet; - } - case 0x101f7993: - { - _LIT(KRet, "[VpnManager]"); - return KRet; - } - case 0x101fd288: - { - _LIT(KRet, "[EventMediator]"); - return KRet; - } - default: - break; - } - - _LIT(KRet, ""); - return KRet; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupLogger::LogFile() -// -// -// --------------------------------------------------------------------------- -void MMCScBkupLogger::LogFile( TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - - HBufC* buf = HBufC::New( KMMCScBkupLoggingMaxLogTextLength ); - if ( buf ) - { - TPtr pBuf( buf->Des() ); - pBuf.FormatList(aFmt, list); -#ifdef _DEBUG - LogRaw( *buf ); -#endif - RFile64 file; - RFs& fsSession(CCoeEnv::Static()->FsSession()); - TEntry entry; - TInt error; - - if ( fsSession.Entry( KMMCScBkupLoggingFullPathAndName, entry ) == KErrNone ) - { - error = file.Open( fsSession, KMMCScBkupLoggingFullPathAndName, EFileWrite | EFileShareExclusive ); - } - else - { - entry.iSize = 0; - error = file.Create( fsSession, KMMCScBkupLoggingFullPathAndName, EFileWrite | EFileShareExclusive ); - } - - if(error == KErrNone) - { - TInt64 size = 0; - - error = file.Size( size ); - if(error == KErrNone && size < KMMCScBkupLoggingMaxLogSize) - { - HBufC8* buf8 = HBufC8::New( KMMCScBkupLoggingMaxLogTextLength ); - if(buf8) - { - const TText8 KLineFeed( '\n' ); - TPtr8 data( buf8->Des() ); - - data.Copy(buf->Des()); - data.Append(KLineFeed); - file.Write(static_cast(entry.iSize), data); - delete buf8; - } - } - } - file.Close(); - delete buf; - } - } - -#endif - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/MMCScBkupPhoneModelUtils.cpp --- a/filemanager/bkupengine/src/MMCScBkupPhoneModelUtils.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/* -* Copyright (c) 2005 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: MMCScBkupPhoneModelUtils implementation -* -* -*/ - -#include "MMCScBkupPhoneModelUtils.h" - -// User includes -#include "MMCScBkupArchiveFlags.h" -#include "MMCScBkupArchiveUtils.h" - -// System includes -#include - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// MMCScBkupPhoneModelUtils::CurrentPhoneModelLC() -// -// -// --------------------------------------------------------------------------- -HBufC8* MMCScBkupPhoneModelUtils::CurrentPhoneModelLC() - { - HBufC8* ret = HBufC8::NewLC( MaximumPhoneModelIdentifierLength() ); - // - TBuf version; - const TInt thirdLine(3); - const TInt err = SysUtil::GetSWVersion( version); - - if ( err == KErrNone ) - { - // Assume syntax Vxx.xx\ndd-mm-yy\nNHL-vvv\n(c) - // Extract model version from third line - for(TInt i(0); i < thirdLine; i++) - { - TInt cutPos = version.Locate( '\n' ); - - if( cutPos == KErrNotFound ) - { - break; - } - else if(i < ( thirdLine - 1 ) ) - { - version.Delete( 0, cutPos + 1 ); - } - else - { - cutPos = version.Locate( '\n' ); - if( cutPos != KErrNotFound ) - { - version.Delete( cutPos, (version.Length() - cutPos) ); - } - ret->Des().Copy( version ); - } - } - } - - // Implicit requirement - should always be the case though - __ASSERT_ALWAYS( ret->Length() <= 255, User::Invariant()); - return ret; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupPhoneModelUtils::MaximumPhoneModelIdentifierLength() -// -// -// --------------------------------------------------------------------------- -TInt MMCScBkupPhoneModelUtils::MaximumPhoneModelIdentifierLength() - { - return KSysUtilVersionTextLength; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupPhoneModelUtils::ArchiveRestorePermissableL() -// -// -// --------------------------------------------------------------------------- -TBool MMCScBkupPhoneModelUtils::ArchiveRestorePermissableL( const TDesC8& aPhoneModelData, TBitFlags aArchiveFlags, const TVersion& aArchiveVersion ) - { - TBool restoreOkay = EFalse; - - // Check version first - restoreOkay = ( aArchiveVersion.iMajor >= KMMCScBkupArchiveFileFormatFirstRestorableMajorVersion ); - - // Check flags next - if ( restoreOkay ) - { - restoreOkay = ( aArchiveFlags.Value() & EMMCScBkupArchiveFlagsContentValid ); - - // Only check model if the flags were alright - if ( restoreOkay ) - { - HBufC8* currentData = CurrentPhoneModelLC(); - restoreOkay = ( aPhoneModelData.Compare( *currentData ) == 0 ); - CleanupStack::PopAndDestroy( currentData ); - } - } - - // Done - return restoreOkay; - } - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/MMCScBkupSBEUtils.cpp --- a/filemanager/bkupengine/src/MMCScBkupSBEUtils.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,523 +0,0 @@ -/* -* Copyright (c) 2005 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: MMCScBkupSBEUtils implementation -* -* -*/ - -#include "MMCScBkupSBEUtils.h" - -// System includes -#include -#include -#include "CMMCScBkupDataOwnerInfo.h" - -// Namespaces -using namespace conn; - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// MMCScBkupSBEUtils::SecureIdFromGenericL() -// -// -// --------------------------------------------------------------------------- -TSecureId MMCScBkupSBEUtils::SecureIdFromGenericL(const CSBGenericDataType& aGeneric) - { - TSecureId ret = 0; - CSBGenericDataType* nonConstOriginal = const_cast(&aGeneric); - const TSBDerivedType type = aGeneric.DerivedTypeL(); - // - switch(type) - { - case ESIDDerivedType: - { - CSBSecureId* temp = CSBSecureId::NewL( nonConstOriginal ); - CleanupStack::PushL( temp ); - ret = temp->SecureIdL(); - CleanupStack::PopAndDestroy( temp ); - break; - } - case ESIDTransferDerivedType: - { - // First make a generic transfer type object... - CSBGenericTransferType* transferTypeTemp = CSBGenericTransferType::NewL( nonConstOriginal->Externalise() ); - CleanupStack::PushL(transferTypeTemp); - - // Now make instance transfer type - CSBSIDTransferType* temp = CSBSIDTransferType::NewL( transferTypeTemp ); - CleanupStack::PushL(temp); - - // Now get the result - ret = temp->SecureIdL(); - - // Tidy up - CleanupStack::PopAndDestroy(2, transferTypeTemp); - break; - } - case EPackageDerivedType: - { - CSBPackageId* temp = CSBPackageId::NewL( nonConstOriginal ); - CleanupStack::PushL( temp ); - ret = temp->SecureIdL(); - CleanupStack::PopAndDestroy( temp ); - break; - } - case EPackageTransferDerivedType: - case EJavaDerivedType: - case EJavaTransferDerivedType: - default: - __BREAKPOINT(); - User::Leave(KErrNotSupported); - break; - } - // - return ret; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupSBEUtils::PackageIdFromGenericL() -// -// -// --------------------------------------------------------------------------- -TUid MMCScBkupSBEUtils::PackageIdFromGenericL(const CSBGenericDataType& aGeneric) - { - TUid ret = KNullUid; - CSBGenericDataType* nonConstOriginal = const_cast(&aGeneric); - const TSBDerivedType type = aGeneric.DerivedTypeL(); - // - switch(type) - { - case EPackageDerivedType: - { - CSBPackageId* temp = CSBPackageId::NewL( nonConstOriginal ); - CleanupStack::PushL(temp); - ret = temp->PackageIdL(); - CleanupStack::PopAndDestroy(temp); - break; - } - case EPackageTransferDerivedType: - { - // First make a generic transfer type object... - CSBGenericTransferType* transferTypeTemp = CSBGenericTransferType::NewL( nonConstOriginal->Externalise() ); - CleanupStack::PushL(transferTypeTemp); - - // Now make instance transfer type - CSBPackageTransferType* temp = CSBPackageTransferType::NewL( transferTypeTemp ); - CleanupStack::PushL(temp); - - // Now get the result - ret = temp->PackageIdL(); - - // Tidy up - CleanupStack::PopAndDestroy(2, transferTypeTemp); - break; - } - case ESIDDerivedType: - case ESIDTransferDerivedType: - case EJavaDerivedType: - case EJavaTransferDerivedType: - default: - __BREAKPOINT(); - User::Leave(KErrNotSupported); - break; - } - // - return ret; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupSBEUtils::JavaHashFromGenericLC() -// -// -// --------------------------------------------------------------------------- -HBufC* MMCScBkupSBEUtils::JavaHashFromGenericLC(const CSBGenericDataType& aGeneric) - { - HBufC* ret = NULL; - CSBGenericDataType* nonConstOriginal = const_cast(&aGeneric); - const TSBDerivedType type = aGeneric.DerivedTypeL(); - // - switch(type) - { - case EJavaDerivedType: - { - CSBJavaId* temp = CSBJavaId::NewL( nonConstOriginal ); - CleanupStack::PushL(temp); - ret = temp->SuiteHashL().AllocL(); - CleanupStack::PopAndDestroy(temp); - CleanupStack::PushL( ret ); - break; - } - case EJavaTransferDerivedType: - { - // First make a generic transfer type object... - CSBGenericTransferType* transferTypeTemp = CSBGenericTransferType::NewL( nonConstOriginal->Externalise() ); - CleanupStack::PushL(transferTypeTemp); - - // Now make a instance transfer type - CSBJavaTransferType* temp = CSBJavaTransferType::NewL( transferTypeTemp ); - CleanupStack::PushL(temp); - - // Now get the result - ret = temp->SuiteHashL().AllocL(); - - // Tidy up - CleanupStack::PopAndDestroy(2, transferTypeTemp); - CleanupStack::PushL( ret ); - break; - } - case ESIDDerivedType: - case ESIDTransferDerivedType: - case EPackageDerivedType: - case EPackageTransferDerivedType: - default: - __BREAKPOINT(); - User::Leave(KErrNotSupported); - break; - } - // - if ( ret == NULL ) - { - ret = KNullDesC().AllocLC(); - } - // - return ret; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupSBEUtils::CopyLC() -// -// -// --------------------------------------------------------------------------- -CSBGenericDataType* MMCScBkupSBEUtils::CopyLC(const CSBGenericDataType& aToBeCopied) - { - CSBGenericDataType* ret = NULL; - - // Have to do this through poor implementation of SBE API - CSBGenericDataType* nonConstOriginal = const_cast(&aToBeCopied); - // - const TSBDerivedType type = nonConstOriginal->DerivedTypeL(); - switch(type) - { - case ESIDDerivedType: - ret = CSBSecureId::NewL(nonConstOriginal); - break; - case EPackageDerivedType: - ret = CSBPackageId::NewL(nonConstOriginal); - break; - case EJavaDerivedType: - ret = CSBJavaId::NewL(nonConstOriginal); - break; - case ESIDTransferDerivedType: - case EPackageTransferDerivedType: - case EJavaTransferDerivedType: - { - // Must first create a generic transfer type object... sigh... - CSBGenericTransferType* transferType = CSBGenericTransferType::NewL( nonConstOriginal->Externalise() ); - CleanupStack::PushL( transferType ); - if ( ESIDTransferDerivedType == type ) - { - ret = CSBSIDTransferType::NewL( transferType ); - } - else if ( EPackageTransferDerivedType == type ) - { - ret = CSBPackageTransferType::NewL( transferType ); - } - // Type is EJavaTransferDerivedType - else - { - ret = CSBJavaTransferType::NewL( transferType ); - } - CleanupStack::PopAndDestroy( transferType ); - } - default: - break; - } - // - if (!ret) - { - __BREAKPOINT(); - User::Leave(KErrNotSupported); - } - CleanupStack::PushL(ret); - return ret; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupSBEUtils::TransferTypeLC() -// -// -// --------------------------------------------------------------------------- -CSBGenericTransferType* MMCScBkupSBEUtils::TransferTypeLC( const CSBGenericDataType& aDT, TDriveNumber aDrive, - TTransferDataType aTransferType, TInt aVersion ) - { - CSBGenericTransferType* ret = NULL; - - // Have to do this through poor implementation of SBE API - CSBGenericDataType* nonConstOriginal = const_cast< CSBGenericDataType* >( &aDT ); - // - const TSBDerivedType type = nonConstOriginal->DerivedTypeL(); - switch( type ) - { - case ESIDDerivedType: - case ESIDTransferDerivedType: - { - const TSecureId secureId = SecureIdFromGenericL( aDT ); - ret = CSBSIDTransferType::NewL( secureId, aDrive, aTransferType ); - break; - } - - case EPackageDerivedType: - { - TSecureId secureId = SecureIdFromGenericL( aDT ); - if( secureId.iId == KNullUid.iUid && aVersion > CMMCScBkupDataOwnerInfo::EStreamFormatVersionFirst ) - { - secureId = MMCScBkupSBEUtils::PackageIdFromGenericL( aDT ); - } - ret = CSBSIDTransferType::NewL( secureId, aDrive, aTransferType ); - break; - } - - default: - case EPackageTransferDerivedType: - case EJavaDerivedType: - case EJavaTransferDerivedType: - __BREAKPOINT(); - User::Leave( KErrNotSupported ); - break; - } - // - CleanupStack::PushL( ret ); - return ret; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupSBEUtils::TransferTypeLC() -// -// -// --------------------------------------------------------------------------- -CSBGenericTransferType* MMCScBkupSBEUtils::TransferTypeLC(const CSBGenericDataType& aDT, TDriveNumber aDrive, - TPackageDataType aDataType, TInt /*aVersion*/) - { - CSBGenericTransferType* ret = NULL; - - // Have to do this through poor implementation of SBE API - CSBGenericDataType* nonConstOriginal = const_cast(&aDT); - // - const TSBDerivedType type = nonConstOriginal->DerivedTypeL(); - switch(type) - { - case EPackageDerivedType: - case EPackageTransferDerivedType: - { - const TUid packageId = PackageIdFromGenericL(aDT); - ret = CSBPackageTransferType::NewL(packageId, aDrive, aDataType); - break; - } - - default: - case ESIDDerivedType: - case ESIDTransferDerivedType: - case EJavaDerivedType: - case EJavaTransferDerivedType: - __BREAKPOINT(); - User::Leave(KErrNotSupported); - break; - } - // - CleanupStack::PushL(ret); - return ret; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupSBEUtils::TransferTypeLC() -// -// -// --------------------------------------------------------------------------- -CSBGenericTransferType* MMCScBkupSBEUtils::TransferTypeLC(const CSBGenericDataType& aDT, TDriveNumber aDrive, - TJavaTransferType aDataType, TInt /*aVersion*/) - { - CSBGenericTransferType* ret = NULL; - - // Have to do this through poor implementation of SBE API - CSBGenericDataType* nonConstOriginal = const_cast(&aDT); - // - const TSBDerivedType type = nonConstOriginal->DerivedTypeL(); - switch(type) - { - case EJavaDerivedType: - case EJavaTransferDerivedType: - { - HBufC* hash = JavaHashFromGenericLC( aDT ); - ret = CSBJavaTransferType::NewL( *hash, aDrive, aDataType ); - CleanupStack::PopAndDestroy( hash ); - break; - } - - default: - case ESIDDerivedType: - case ESIDTransferDerivedType: - case EPackageDerivedType: - case EPackageTransferDerivedType: - __BREAKPOINT(); - User::Leave(KErrNotSupported); - break; - } - // - CleanupStack::PushL(ret); - return ret; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupSBEUtils::PhoneIsInBackupOrRestoreModeL() -// -// -// --------------------------------------------------------------------------- -TBool MMCScBkupSBEUtils::PhoneIsInBackupOrRestoreModeL() - { - TBool backupInProgress = EFalse; - // - TInt value = 0; - const TInt error = RProperty::Get( KUidSystemCategory, KUidBackupRestoreKey, value ); - User::LeaveIfError( error ); - // - const TBURPartType partType = static_cast< TBURPartType >( value & KBURPartTypeMask ); - if (value != 0) - { - switch(partType) - { - case EBURUnset: - case EBURNormal: - break; - case EBURBackupFull: - case EBURBackupPartial: - case EBURRestoreFull: - case EBURRestorePartial: - backupInProgress = ETrue; - break; - } - } - // - return backupInProgress; - } - - -// --------------------------------------------------------------------------- -// MMCScBkupSBEUtils::EndBackupOrRestoreL() -// -// -// --------------------------------------------------------------------------- -void MMCScBkupSBEUtils::EndBackupOrRestoreL( CSBEClient& aSBEClient ) - { - TDriveList nullDriveList; - aSBEClient.SetBURModeL( nullDriveList, EBURNormal, ENoBackup); - } - - -// --------------------------------------------------------------------------- -// MMCScBkupSBEUtils::HasSystemDataL() -// -// -// --------------------------------------------------------------------------- -TBool MMCScBkupSBEUtils::HasSystemDataL( const CDataOwnerInfo& aDataOwner ) - { - const TSBDerivedType type = aDataOwner.Identifier().DerivedTypeL(); - const TBool systemDataType = ( type == EPackageDerivedType || - type == EPackageTransferDerivedType ); - const TBool hasSystemData = ( aDataOwner.CommonSettings() & EHasSystemFiles ); - // - return ( systemDataType && hasSystemData ); - } - - -// --------------------------------------------------------------------------- -// MMCScBkupSBEUtils::HasJavaDataL() -// -// -// --------------------------------------------------------------------------- -TBool MMCScBkupSBEUtils::HasJavaDataL( const CDataOwnerInfo& aDataOwner ) - { - const TSBDerivedType type = aDataOwner.Identifier().DerivedTypeL(); - const TBool javaDataType = ( type == EJavaDerivedType || - type == EJavaTransferDerivedType ); - const TBool hasSystemData = ( aDataOwner.CommonSettings() & EHasSystemFiles ); - - // Java abuses the "has system files flag" - this has been confirmed - // with Symbian. - return ( javaDataType && hasSystemData ); - } - - -// --------------------------------------------------------------------------- -// MMCScBkupSBEUtils::HasPassiveDataL() -// -// -// --------------------------------------------------------------------------- -TBool MMCScBkupSBEUtils::HasPassiveDataL( const CDataOwnerInfo& aDataOwner ) - { - const TSBDerivedType type = aDataOwner.Identifier().DerivedTypeL(); - const TBool passiveDataType = ( type == ESIDDerivedType || - type == ESIDTransferDerivedType || - type == EPackageDerivedType || - type == EPackageTransferDerivedType ); - const TBool hasPassiveData = ( aDataOwner.CommonSettings() & EPassiveBUR ); - // - return ( passiveDataType && hasPassiveData ); - } - - -// --------------------------------------------------------------------------- -// MMCScBkupSBEUtils::HasActiveDataL() -// -// -// --------------------------------------------------------------------------- -TBool MMCScBkupSBEUtils::HasActiveDataL( const CDataOwnerInfo& aDataOwner ) - { - const TSBDerivedType type = aDataOwner.Identifier().DerivedTypeL(); - const TBool activeDataType = ( type == ESIDDerivedType || - type == ESIDTransferDerivedType || - type == EPackageDerivedType || - type == EPackageTransferDerivedType ); - const TBool hasActiveData = ( aDataOwner.CommonSettings() & EActiveBUR ); - // - return ( activeDataType && hasActiveData ); - } - - -// --------------------------------------------------------------------------- -// MMCScBkupSBEUtils::HasPublicDataL() -// -// -// --------------------------------------------------------------------------- -TBool MMCScBkupSBEUtils::HasPublicDataL( const CDataOwnerInfo& aDataOwner ) - { - const TSBDerivedType type = aDataOwner.Identifier().DerivedTypeL(); - const TBool publicDataType = ( type == ESIDDerivedType || - type == ESIDTransferDerivedType || - type == EPackageDerivedType || - type == EPackageTransferDerivedType ); - const TBool hasPublicData = ( aDataOwner.PassiveSettings() & EHasPublicFiles ); - // - return ( hasPublicData && publicDataType ); - } - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/RMMCScBkupArchiveStreams.cpp --- a/filemanager/bkupengine/src/RMMCScBkupArchiveStreams.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,256 +0,0 @@ -/* -* Copyright (c) 2005 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: RMMCScBkupArchiveReadStream implementation -* -* -*/ - -#include "RMMCScBkupArchiveStreams.h" - -// User includes -#include "MMCScBkupLogger.h" -#include "CMMCScBkupArchiveDataManager.h" - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// RMMCScBkupArchiveBuf::RMMCScBkupArchiveBuf() -// -// -// --------------------------------------------------------------------------- -RMMCScBkupArchiveBuf::RMMCScBkupArchiveBuf() -: iADM(NULL) - { - } - - -// --------------------------------------------------------------------------- -// RMMCScBkupArchiveBuf::AttachL() -// -// -// --------------------------------------------------------------------------- -void RMMCScBkupArchiveBuf::AttachL( CMMCScBkupArchiveDataManager& aADM, RFile64& aFile, TInt aPos, TBool aForWrite ) - { - //__LOG3("RMMCScBkupArchiveBuf::AttachL() - START - aFile: 0x%08x, aPos: %d, aForWrite: %d", aFile.SubSessionHandle(), aPos, aForWrite); - - // Prevent RFileBuf from resetting our file handle - RFile64 file(aFile); - RFileBuf::Attach(file, aPos); - - // We save the attach pos so that we can update the ADM with the final - // length of data that was read or written... - iInfo.Reset(); - iInfo.SetOffset(aPos); - - iWriteMode = aForWrite; - iADM = &aADM; - - //__LOG("RMMCScBkupArchiveBuf::AttachL() - END"); - } - - -// --------------------------------------------------------------------------- -// RMMCScBkupArchiveBuf::Close() -// -// -// --------------------------------------------------------------------------- -EXPORT_C void RMMCScBkupArchiveBuf::Close() - { - //__LOG1("RMMCScBkupArchiveBuf::Close() - START - File: 0x%08x", File().SubSessionHandle()); - - TRAP_IGNORE(DoSynchL()); - Detach(); - Reset(); - - //__LOG1("RMMCScBkupArchiveBuf::Close() - END - File: 0x%08x", File().SubSessionHandle()); - } - - -// --------------------------------------------------------------------------- -// RMMCScBkupArchiveBuf::IsOpen() -// -// -// --------------------------------------------------------------------------- -TBool RMMCScBkupArchiveBuf::IsOpen() const - { - return (File().SubSessionHandle() != KNullHandle); - } - - -// --------------------------------------------------------------------------- -// RMMCScBkupArchiveBuf::DoRelease() -// -// -// --------------------------------------------------------------------------- -void RMMCScBkupArchiveBuf::DoRelease() - { - //__LOG1("RMMCScBkupArchiveBuf::DoRelease() - START - File: 0x%08x", File().SubSessionHandle()); - - TRAP_IGNORE( UpdateInfoL() ); - Detach(); - RFileBuf::DoRelease(); - - //__LOG1("RMMCScBkupArchiveBuf::DoRelease() - END - File: 0x%08x", File().SubSessionHandle()); - } - - -// --------------------------------------------------------------------------- -// RMMCScBkupArchiveBuf::DoSynchL() -// -// -// --------------------------------------------------------------------------- -void RMMCScBkupArchiveBuf::DoSynchL() - { - //__LOG1("RMMCScBkupArchiveBuf::DoSynchL() - START - File: 0x%08x", File().SubSessionHandle()); - - RFileBuf::DoSynchL(); - UpdateInfoL(); - - //__LOG1("RMMCScBkupArchiveBuf::DoSynchL() - END - File: 0x%08x", File().SubSessionHandle()); - } - - -#ifdef RD_FILE_MANAGER_BACKUP -// --------------------------------------------------------------------------- -// RMMCScBkupArchiveBuf::DoWriteL() -// -// -// --------------------------------------------------------------------------- -void RMMCScBkupArchiveBuf::DoWriteL(const TAny* aPtr,TInt aLength) - { - iADM->CalculateCrc(aPtr, aLength); - RFileBuf::DoWriteL(aPtr, aLength); - } -#endif - - -// --------------------------------------------------------------------------- -// RMMCScBkupArchiveBuf::UpdateInfoL() -// -// -// --------------------------------------------------------------------------- -void RMMCScBkupArchiveBuf::UpdateInfoL() - { - //__LOG1("RMMCScBkupArchiveBuf::UpdateInfoL() - START - File: 0x%08x", File().SubSessionHandle()); - - // Update our stats - if ( iADM && File().SubSessionHandle() != KNullHandle ) - { - TStreamPos pos; - if ( iWriteMode ) - { - pos = TellL( MStreamBuf::EWrite ); - //__LOG("RMMCScBkupArchiveBuf::UpdateInfoL() - write mode..."); - } - else - { - pos = TellL( MStreamBuf::ERead ); - //__LOG("RMMCScBkupArchiveBuf::UpdateInfoL() - read mode..."); - } - // - const TInt currentOffset = pos.Offset(); - const TInt length = currentOffset - iInfo.Offset(); - - //__LOG1("RMMCScBkupArchiveBuf::UpdateInfoL() - currentOffset: %8d", currentOffset); - //__LOG1("RMMCScBkupArchiveBuf::UpdateInfoL() - length: %8d", length); - iInfo.SetLength( length ); - - // Inform ADM of final info - iADM->SetCurrentVector( iInfo ); - } - - //__LOG1("RMMCScBkupArchiveBuf::UpdateInfoL() - END - File: 0x%08x", File().SubSessionHandle()); - } - - - - - - - - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// RMMCScBkupArchiveReadStream::OpenLC() -// -// -// --------------------------------------------------------------------------- -void RMMCScBkupArchiveReadStream::OpenLC( CMMCScBkupArchiveDataManager& aADM, RFile64& aArchiveFile, TInt aPos ) - { - CleanupClosePushL( *this ); - // - iSource.AttachL( aADM, aArchiveFile, aPos, EFalse ); - RReadStream::Attach( &iSource ); - } - - -// --------------------------------------------------------------------------- -// RMMCScBkupArchiveReadStream::IsOpen() -// -// -// --------------------------------------------------------------------------- -TBool RMMCScBkupArchiveReadStream::IsOpen() const - { - return iSource.IsOpen(); - } - - - - - - - - - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// RMMCScBkupArchiveWriteStream::OpenLC() -// -// -// --------------------------------------------------------------------------- -void RMMCScBkupArchiveWriteStream::OpenLC( CMMCScBkupArchiveDataManager& aADM, RFile64& aArchiveFile, TInt aPos ) - { - CleanupClosePushL( *this ); - // - iSink.AttachL( aADM, aArchiveFile, aPos, ETrue ); - RWriteStream::Attach( &iSink ); - } - - -// --------------------------------------------------------------------------- -// RMMCScBkupArchiveWriteStream::IsOpen() -// -// -// --------------------------------------------------------------------------- -TBool RMMCScBkupArchiveWriteStream::IsOpen() const - { - return iSink.IsOpen(); - } - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/RMMCScBkupProgressSizer.cpp --- a/filemanager/bkupengine/src/RMMCScBkupProgressSizer.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,250 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: RMMCScBkupProgressSizer implementation -* -* -*/ - -#include "RMMCScBkupProgressSizer.h" - -// User includes -#include "MMCScBkupLogger.h" -#include "MMCScBkupSBEUtils.h" -#include "CMMCScBkupDataOwnerInfo.h" -#include "MMMCScBkupProgressObserver.h" -#include "CMMCScBkupDriveAndOperationTypeManager.h" - -// Constants -const TInt KMMCScBkupWeightingFactor = 10000; - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// RMMCScBkupProgressSizer::RMMCScBkupProgressSizer() -// -// C++ constructor. -// --------------------------------------------------------------------------- -RMMCScBkupProgressSizer::RMMCScBkupProgressSizer( const CMMCScBkupDriveAndOperationTypeManager& aDriveAndOperationTypes ) -: iDriveAndOperationTypes( aDriveAndOperationTypes ), iDriveFilter( aDriveAndOperationTypes.DriveList() ) - { - } - - -// --------------------------------------------------------------------------- -// RMMCScBkupProgressSizer::BackupTotalProgressValueL() -// -// Calculate the total amount of progress steps that a particular data owner -// requires. This method can only be called after all of the sizing info -// has been obtained from the SBE -// --------------------------------------------------------------------------- -TInt64 RMMCScBkupProgressSizer::BackupTotalProgressValueL( const CMMCScBkupDataOwnerInfo& aDataOwner ) - { - __LOG(" "); - __LOG1("RMMCScBkupProgressSizer::BackupTotalProgressValueL() - START - DO: 0x%08x", aDataOwner.SecureId().iId); - TInt64 totalStepCount = 0; - - ////////////////////////////////////////////////////////////////////// - // THESE ELEMENTS HAVE PSEUDO-PROGRESS - that is, the report a fixed - // number of progress nibbles per operation. For example: - // - // TYPE DRIVE PROGRESS - // ======================================= - // ACTIVE (C:) 1 x 2000 - // PASSIVE (C:) 1 x 2000 - // SYSTEM (C:, E:) 2 x 2000 - // JAVA (C:) 1 x 2000 - // PUBLIC (C: = 12k) 12 x 1024 - // ---------------------------------------- - // total 10000 + (12 x 1024) - // - ////////////////////////////////////////////////////////////////////// - - const CDataOwnerInfo& sbeDataOwner = aDataOwner.Owner(); - - // Passive data - if ( MMCScBkupSBEUtils::HasPassiveDataL( sbeDataOwner ) ) - { - const TInt opsCount = NumberOfDriveOpsRequiredL( aDataOwner, EMMCScBkupOwnerDataTypePassiveData ); - __LOG2("RMMCScBkupProgressSizer::BackupTotalProgressValueL() - passive - %d of progress (%d ops)", opsCount * KMMCScBkupWeightingFactor, opsCount); - totalStepCount += ( opsCount * KMMCScBkupWeightingFactor ); - } - - // Active data - if ( MMCScBkupSBEUtils::HasActiveDataL( sbeDataOwner ) ) - { - const TInt opsCount = NumberOfDriveOpsRequiredL( aDataOwner, EMMCScBkupOwnerDataTypeActiveData ); - __LOG2("RMMCScBkupProgressSizer::BackupTotalProgressValueL() - active - %d of progress (%d ops)", opsCount * KMMCScBkupWeightingFactor, opsCount); - totalStepCount += ( opsCount * KMMCScBkupWeightingFactor ); - } - - // System data - if ( MMCScBkupSBEUtils::HasSystemDataL( sbeDataOwner ) ) - { - const TInt opsCount = NumberOfDriveOpsRequiredL( aDataOwner, EMMCScBkupOwnerDataTypeSystemData ); - __LOG2("RMMCScBkupProgressSizer::BackupTotalProgressValueL() - system - %d of progress (%d ops)", opsCount * KMMCScBkupWeightingFactor, opsCount); - totalStepCount += ( opsCount * KMMCScBkupWeightingFactor ); - } - - // Java data - if ( MMCScBkupSBEUtils::HasJavaDataL( sbeDataOwner ) ) - { - const TInt opsCount = NumberOfDriveOpsRequiredL( aDataOwner, EMMCScBkupOwnerDataTypeJavaData ); - __LOG2("RMMCScBkupProgressSizer::BackupTotalProgressValueL() - java - %d of progress (%d ops)", opsCount * KMMCScBkupWeightingFactor, opsCount); - totalStepCount += ( opsCount * KMMCScBkupWeightingFactor ); - } - - - /////////////////////////////////// - // PUBLIC REPORTS ACTUAL SIZING - /////////////////////////////////// - - // Public data - if ( MMCScBkupSBEUtils::HasPublicDataL( sbeDataOwner ) ) - { - const TInt64 size = AmountOfPublicDataToBeRestoredL( aDataOwner ); - __LOG1("RMMCScBkupProgressSizer::BackupTotalProgressValueL() - public - %Ld of progress", size); - totalStepCount += size; - } - - // - __LOG2("RMMCScBkupProgressSizer::BackupTotalProgressValueL() - END - DO: 0x%08x, totalStepCount: %8Ld", aDataOwner.SecureId().iId, totalStepCount); - return totalStepCount; - } - - -// --------------------------------------------------------------------------- -// RMMCScBkupProgressSizer::BackupReportFixedProgressForOpL() -// -// -// --------------------------------------------------------------------------- -void RMMCScBkupProgressSizer::BackupReportFixedProgressForOpL( MMMCScBkupProgressObserver& aProgressManager, TMMCScBkupOwnerDataType aType ) - { - switch( aType ) - { - case EMMCScBkupOwnerDataTypeSystemData: - case EMMCScBkupOwnerDataTypeActiveData: - case EMMCScBkupOwnerDataTypePassiveData: - case EMMCScBkupOwnerDataTypeJavaData: - __LOG2("RMMCScBkupProgressSizer::BackupReportFixedProgressForOpL() - aType: %d, amount: %d ", aType, KMMCScBkupWeightingFactor ); - aProgressManager.MMCScBkupHandleProgress( KMMCScBkupWeightingFactor ); - break; - default: - case EMMCScBkupOwnerDataTypeDataOwner: - case EMMCScBkupOwnerDataTypePublicData: - ASSERT( EFalse ); - break; - } - } - - -// --------------------------------------------------------------------------- -// RMMCScBkupProgressSizer::RestoreCombinedDataSizeL() -// -// -// --------------------------------------------------------------------------- -TInt64 RMMCScBkupProgressSizer::RestoreCombinedDataSizeL( const CMMCScBkupDataOwnerInfo& aOwner ) - { - TInt64 size = 0; - // - iDriveFilter.Reset(); - iDriveFilter.SetSecondaryDriveFilter( aOwner.Owner().DriveList() ); - // - TDriveNumber drive = EDriveA; - while ( iDriveFilter.NextValidDrive( drive ) ) - { - for( TInt i=0; i ( i ); - const TBool allowedForDrive = iDriveAndOperationTypes.IsDataTypeAllowedToAccessDrive( drive, dataType ); - // - if ( allowedForDrive ) - { - // Get the amount of data for this drive - size += aOwner.OperationalSize( dataType, drive ); - } - } - } - // - return size; - } - - - - - - - - - - - -// --------------------------------------------------------------------------- -// RMMCScBkupProgressSizer::NumberOfDriveOpsRequiredL() -// -// -// --------------------------------------------------------------------------- -TInt RMMCScBkupProgressSizer::NumberOfDriveOpsRequiredL( const CMMCScBkupDataOwnerInfo& aOwner, TMMCScBkupOwnerDataType aType ) - { - TInt count = 0; - // - iDriveFilter.Reset(); - iDriveFilter.SetSecondaryDriveFilter( aOwner.Owner().DriveList() ); - // - TDriveNumber drive = EDriveA; - while ( iDriveFilter.NextValidDrive( drive ) ) - { - const TBool allowedForDrive = iDriveAndOperationTypes.IsDataTypeAllowedToAccessDrive( drive, aType ); - // - if ( allowedForDrive ) - { - ++count; - } - } - // - return count; - } - - -// --------------------------------------------------------------------------- -// RMMCScBkupProgressSizer::AmountOfPublicDataToBeRestoredL() -// -// -// --------------------------------------------------------------------------- -TInt64 RMMCScBkupProgressSizer::AmountOfPublicDataToBeRestoredL( const CMMCScBkupDataOwnerInfo& aOwner ) - { - TInt64 size = 0; - // - iDriveFilter.Reset(); - iDriveFilter.SetSecondaryDriveFilter( aOwner.Owner().DriveList() ); - // - TDriveNumber drive = EDriveA; - while ( iDriveFilter.NextValidDrive( drive ) ) - { - const TBool allowedForDrive = iDriveAndOperationTypes.IsDataTypeAllowedToAccessDrive( drive, EMMCScBkupOwnerDataTypePublicData ); - // - if ( allowedForDrive ) - { - // Get the amount of data for this drive - size += aOwner.OperationalSize( EMMCScBkupOwnerDataTypePublicData, drive ); - } - } - // - return size; - } - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/TMMCScBkupArchiveVector.cpp --- a/filemanager/bkupengine/src/TMMCScBkupArchiveVector.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* -* Copyright (c) 2005 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: TMMCScBkupArchiveVector implementation -* -* -*/ - -#include "TMMCScBkupArchiveVector.h" - - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// TMMCScBkupArchiveVector::ExternalizedSize() -// -// -// --------------------------------------------------------------------------- - -TInt TMMCScBkupArchiveVector::ExternalizedSize() - { - return 20; // 4 bytes for offset, 4 bytes for length, 4 bytes stream version, 4 bytes spare1, 4 bytes spare2 - } - - -// --------------------------------------------------------------------------- -// TMMCScBkupArchiveVector::ExternalizeL() -// -// -// --------------------------------------------------------------------------- - -void TMMCScBkupArchiveVector::ExternalizeL(RWriteStream& aStream) const - { - aStream.WriteInt32L( EStreamFormatVersion1 ); - aStream.WriteInt32L( Offset() ); - aStream.WriteInt32L( Length() ); - aStream.WriteInt32L( 0 ); // Spare1 - aStream.WriteInt32L( 0 ); // Spare2 - } - -// --------------------------------------------------------------------------- -// TMMCScBkupArchiveVector::InternalizeL() -// -// -// --------------------------------------------------------------------------- - -void TMMCScBkupArchiveVector::InternalizeL(RReadStream& aStream) - { - aStream.ReadInt32L(); // stream format version - iOffset = aStream.ReadInt32L(); - iLength = aStream.ReadInt32L(); - aStream.ReadInt32L(); // Spare1 - aStream.ReadInt32L(); // Spare2 - // - if (iOffset < 0 || iLength < 0) - { - User::Leave(KErrCorrupt); - } - } - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// TMMCScBkupArchiveDriveAndVector::InternalizeL() -// -// -// --------------------------------------------------------------------------- -void TMMCScBkupArchiveDriveAndVector::InternalizeL( RReadStream& aStream ) - { - aStream.ReadInt32L(); // EStreamFormatVersion1 - aStream.ReadInt32L(); // spare1 - aStream.ReadInt32L(); // spare2 - aStream.ReadInt32L(); // spare3 - // - iDrive = static_cast( aStream.ReadUint8L() ); - aStream >> iVector; - } - - -// --------------------------------------------------------------------------- -// TMMCScBkupArchiveDriveAndVector::ExternalizeL() -// -// -// --------------------------------------------------------------------------- -void TMMCScBkupArchiveDriveAndVector::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt32L( EStreamFormatVersion1 ); - aStream.WriteInt32L( 0 ); // spare1 - aStream.WriteInt32L( 0 ); // spare2 - aStream.WriteInt32L( 0 ); // spare3 - // - aStream.WriteUint8L( iDrive ); - aStream << iVector; - } - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/TMMCScBkupDriveAndSize.cpp --- a/filemanager/bkupengine/src/TMMCScBkupDriveAndSize.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: TMMCScBkupDriveAndSize implementation -* -* -*/ - -#include "TMMCScBkupDriveAndSize.h" - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// TMMCScBkupDriveAndSize::InternalizeL() -// -// -// --------------------------------------------------------------------------- -void TMMCScBkupDriveAndSize::InternalizeL( RReadStream& aStream ) - { - aStream.ReadInt32L(); // EStreamFormatVersion1 - aStream.ReadInt32L(); // spare1 - aStream.ReadInt32L(); // spare2 - // - iDrive = static_cast( aStream.ReadUint8L() ); - - iSize = aStream.ReadInt32L(); - // If 64-bit handling will be supported in the future. - // That will mean in practice a break in archive file format. - /* - if ( format == EStreamFormatVersion1 ) - { - iSize = aStream.ReadInt32L(); - } - else - { - iSize = aStream.ReadReal64L(); - } - */ - } - - -// --------------------------------------------------------------------------- -// TMMCScBkupDriveAndSize::ExternalizeL() -// -// -// --------------------------------------------------------------------------- -void TMMCScBkupDriveAndSize::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt32L( EStreamFormatVersion1 ); - aStream.WriteInt32L( 0 ); // spare1 - aStream.WriteInt32L( 0 ); // spare2 - // - aStream.WriteUint8L( iDrive ); - aStream.WriteInt32L( iSize ); - //aStream.WriteReal64L( iSize ); // If 64-bit handling will be supported in the future. - // That will mean in practice a break in archive file format. - } - - diff -r 95243422089a -r 491b3ed49290 filemanager/bkupengine/src/TMMCScBkupDriveFilter.cpp --- a/filemanager/bkupengine/src/TMMCScBkupDriveFilter.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -/* -* Copyright (c) 2005 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: TMMCScBkupDriveFilter implementation -* -* -*/ - -#include "TMMCScBkupDriveFilter.h" - -// Constants -const TInt KMMCScBkupInitialDriveIndex = -1; - - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// TMMCScBkupDriveFilter::Reset() -// -// -// --------------------------------------------------------------------------- -void TMMCScBkupDriveFilter::Reset() - { - iCurrentDrive = KMMCScBkupInitialDriveIndex; - } - - -// --------------------------------------------------------------------------- -// TMMCScBkupDriveFilter::SetPrimaryDriveFilter() -// -// -// --------------------------------------------------------------------------- -void TMMCScBkupDriveFilter::SetPrimaryDriveFilter( const TDriveList& aDriveList ) - { - iPrimaryDriveList = aDriveList; - } - - -// --------------------------------------------------------------------------- -// TMMCScBkupDriveFilter::SetSecondaryDriveFilter() -// -// -// --------------------------------------------------------------------------- -void TMMCScBkupDriveFilter::SetSecondaryDriveFilter( const TDriveList& aDriveList ) - { - iSecondaryDriveList = aDriveList; - iHaveSecondaryList = ETrue; - } - - -// --------------------------------------------------------------------------- -// TMMCScBkupDriveFilter::NextValidDrive() -// -// -// --------------------------------------------------------------------------- -TBool TMMCScBkupDriveFilter::NextValidDrive( TDriveNumber& aDrive ) - { - // Always move to the next drive before checking its availability. - // FindValidDrive takes care of ensuring the value falls within A-Z - // range. - ++iCurrentDrive; - - // Do we have an available primary drive? - TBool driveAvailable = EFalse; - while( iCurrentDrive >= EDriveA && iCurrentDrive <= EDriveZ ) - { - TDriveNumber drive; - driveAvailable = FindValidDrive( iPrimaryDriveList, drive ); - if ( driveAvailable && iHaveSecondaryList ) - { - // Verify against secondary drive list also... - const TBool makeOnlyOneDirectAttempt = ETrue; - driveAvailable = FindValidDrive( iSecondaryDriveList, drive, makeOnlyOneDirectAttempt ); - } - else if (!driveAvailable) - { - // No more primary drives left, so we're done here. - break; - } - - // Did we find a match on (just) the primary drive, or then - // the primary and secondary drive lists combined? - if (driveAvailable) - { - // Yes, match found - we're finished here. - aDrive = drive; - break; - } - else - { - // Try to search for the next drive that matches both the - // primary and secondary lists (if supported) - ++iCurrentDrive; - } - } - // - return driveAvailable; - } - - -// --------------------------------------------------------------------------- -// TMMCScBkupDriveFilter::CurrentDrive() -// -// -// --------------------------------------------------------------------------- -TDriveNumber TMMCScBkupDriveFilter::CurrentDrive() const - { - return static_cast< TDriveNumber >( iCurrentDrive ); - } - - -// --------------------------------------------------------------------------- -// TMMCScBkupDriveFilter::FindValidDrive() -// -// -// --------------------------------------------------------------------------- -TBool TMMCScBkupDriveFilter::FindValidDrive( const TDriveList& aList, TDriveNumber& aDrive, TBool aOneAttemptOnly ) - { - // If we've already reached Z then there isn't any sense in continuing - // as all drives have been processed. - TBool driveAvailable = EFalse; - - // Keep checking drives until we go past Z - while( iCurrentDrive >= EDriveA && iCurrentDrive <= EDriveZ ) - { - if ( aList[ iCurrentDrive ] != 0 ) - { - // Found an available drive - aDrive = static_cast< TDriveNumber >( iCurrentDrive ); - driveAvailable = ETrue; - break; - } - else if ( aOneAttemptOnly ) - { - break; - } - - // Try next drive - ++iCurrentDrive; - } - // - return driveAvailable; - } - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/cenrep/keys_s60filemanager.xls Binary file filemanager/cenrep/keys_s60filemanager.xls has changed diff -r 95243422089a -r 491b3ed49290 filemanager/conf/s60filemanager.confml Binary file filemanager/conf/s60filemanager.confml has changed diff -r 95243422089a -r 491b3ed49290 filemanager/conf/s60filemanager_1020506B.crml Binary file filemanager/conf/s60filemanager_1020506B.crml has changed diff -r 95243422089a -r 491b3ed49290 filemanager/examples/demo_fmfiledialog/demo_fmfiledialog.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/examples/demo_fmfiledialog/demo_fmfiledialog.iby Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,30 @@ +/* +* 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 __FMFILEDIALOG_IBY__ +#define __FMFILEDIALOG_IBY__ + +#include + +#define HB_UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc + +file=ABI_DIR\BUILD_DIR\demo_fmfiledialog.exe SHARED_LIB_DIR\demo_fmfiledialog.exe +HB_UPGRADABLE_APP_REG_RSC(demo_fmfiledialog) +S60_APP_RESOURCE(demo_fmfiledialog) + +#endif + diff -r 95243422089a -r 491b3ed49290 filemanager/examples/demo_fmfiledialog/demo_fmfiledialog.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/examples/demo_fmfiledialog/demo_fmfiledialog.pro Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,31 @@ +# 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: +# +# + +CONFIG += hb +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . +symbian { + include(rom.pri) +} + +# Input +HEADERS += mainwindow.h +SOURCES += main.cpp mainwindow.cpp + +LIBS += -lfmfiledialog diff -r 95243422089a -r 491b3ed49290 filemanager/examples/demo_fmfiledialog/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/examples/demo_fmfiledialog/main.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* +* Description: +* +* +*/ + +#include +#include + +#include "mainwindow.h" +int main( int argc, char *argv[] ) +{ + HbApplication app( argc, argv ); + app.setApplicationName( "filemanager" ); + + TestMainWindow *mainWindow = new TestMainWindow; + mainWindow->init(); + mainWindow->show(); + + + return app.exec(); +} diff -r 95243422089a -r 491b3ed49290 filemanager/examples/demo_fmfiledialog/mainwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/examples/demo_fmfiledialog/mainwindow.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* +* Description: +* +* +*/ + +#include "mainwindow.h" +#include "fmfiledialog.h" +#include "hbmessagebox.h" + +#define getDir "getExistingDirectory" +#define getFile "getOpenFileName" +#define saveFile "getSaveFileName" + +#define getDir_SetDir "getExistingDirectory_setDir" +#define getFile_SetDir "getOpenFileName_setDir" +#define saveFile_SetDir "getSaveFileName_setDir" + +#define getDir_SetFilter "getExistingDirectory_setFilter" +#define getDir_SetFilter_AllDirs "getExistingDirectory_setFilter_AllDirs" +#define getFile_SetFilter "getOpenFileName_setFilter" +#define saveFile_SetFilter "getSaveFileName_setFilter" + +TestMainWindow::TestMainWindow() +{ +} +TestMainWindow::~TestMainWindow() +{ +} + +void TestMainWindow::init() +{ + HbView *mainView = new HbView; + addView( mainView ); + + HbListWidget *listWidget = new HbListWidget( mainView ); + mainView->setWidget( listWidget ); + + listWidget->addItem( getDir ); + listWidget->addItem( getFile ); + listWidget->addItem( saveFile ); + listWidget->addItem( " " ); + listWidget->addItem( getDir_SetDir ); + listWidget->addItem( getFile_SetDir ); + listWidget->addItem( saveFile_SetDir ); + listWidget->addItem( " " ); + listWidget->addItem( getDir_SetFilter ); + listWidget->addItem( getDir_SetFilter_AllDirs ); + listWidget->addItem( getFile_SetFilter ); + listWidget->addItem( saveFile_SetFilter ); + listWidget->addItem( " " ); + listWidget->addItem( "placeHolderA" ); + listWidget->addItem( "placeHolderB" ); + listWidget->addItem( "placeHolderC" ); + listWidget->addItem( "placeHolderD" ); + listWidget->addItem( "placeHolderE" ); + listWidget->addItem( "placeHolderF" ); + listWidget->addItem( "placeHolderG" ); + listWidget->addItem( "placeHolderH" ); + listWidget->addItem( "placeHolderI" ); + listWidget->addItem( "placeHolderJ" ); + listWidget->addItem( "placeHolderK" ); + listWidget->addItem( "placeHolderL" ); + listWidget->addItem( "placeHolderM" ); + listWidget->addItem( "placeHolderN" ); + listWidget->addItem( "placeHolderO" ); + listWidget->addItem( "placeHolderP" ); + listWidget->addItem( "placeHolderQ" ); + listWidget->addItem( "placeHolderR" ); + listWidget->addItem( "placeHolderS" ); + listWidget->addItem( "placeHolderT" ); + listWidget->addItem( "placeHolderU" ); + listWidget->addItem( "placeHolderV" ); + listWidget->addItem( "placeHolderW" ); + listWidget->addItem( "placeHolderX" ); + listWidget->addItem( "placeHolderY" ); + listWidget->addItem( "placeHolderZ" ); + + connect(listWidget, SIGNAL(activated(HbListWidgetItem*)), this,SLOT(activatedListItem(HbListWidgetItem*)) ); +} + +void TestMainWindow::activatedListItem(HbListWidgetItem *item) +{ + if( item->text().compare( getDir ) == 0 ) { + getExistingDirectory(); + } else if( item->text().compare( getFile ) == 0 ) { + getOpenFileName(); + } else if( item->text().compare( saveFile ) == 0 ) { + getSaveFileName(); + } else if( item->text().compare( getDir_SetDir ) == 0 ) { + getExistingDirectory_SetDir(); + } else if( item->text().compare( getFile_SetDir ) == 0 ) { + getOpenFileName_SetDir(); + } else if( item->text().compare( saveFile_SetDir ) == 0 ) { + getSaveFileName_SetDir(); + } else if( item->text().compare( getDir_SetFilter ) == 0 ) { + getExistingDirectory_SetFilter(); + } else if( item->text().compare( getDir_SetFilter_AllDirs ) == 0 ) { + getExistingDirectory_SetFilter_AllDirs(); + } else if( item->text().compare( getFile_SetFilter ) == 0 ) { + getOpenFileName_SetFilter(); + } else if( item->text().compare( saveFile_SetFilter ) == 0 ) { + getSaveFileName_SetFilter(); + } +} + +void TestMainWindow::getExistingDirectory() +{ + // getExistingDirectory with default parameter. + QString path = FmFileDialog::getExistingDirectory(); + HbMessageBox::information( path ); +} +void TestMainWindow::getOpenFileName() +{ + // getOpenFileName with default parameter. + QString path = FmFileDialog::getOpenFileName(); + HbMessageBox::information( path ); +} +void TestMainWindow::getSaveFileName() +{ + // getSaveFileName with default parameter. + QString path = FmFileDialog::getSaveFileName(); + HbMessageBox::information( path ); +} + +void TestMainWindow::getExistingDirectory_SetDir() +{ + // getExistingDirectory and set header & default Directory + QString path = FmFileDialog::getExistingDirectory( 0, "Look in:", "C:/Data/Images" ); + HbMessageBox::information( path ); +} +void TestMainWindow::getOpenFileName_SetDir() +{ + // getOpenFileName and set header & default Directory + QString path = FmFileDialog::getOpenFileName( 0, "Look in:", "C:/Data/Images" ); + HbMessageBox::information( path ); +} +void TestMainWindow::getSaveFileName_SetDir() +{ + // getSaveFileName and set header & default Directory + QString path = FmFileDialog::getSaveFileName( 0, "Look in:", "C:/Data/Images" ); + HbMessageBox::information( path ); +} + +void TestMainWindow::getExistingDirectory_SetFilter() +{ + // getExistingDirectory and set folder&file filter + QStringList filterList; + filterList<<"*data*"<<"*image*"<<"*sound*"; + QString path = FmFileDialog::getExistingDirectory( 0, "Look in:", "", filterList ); + HbMessageBox::information( path ); +} + +void TestMainWindow::getExistingDirectory_SetFilter_AllDirs() +{ + // getExistingDirectory and set folder&file filter + QStringList filterList; + filterList<<"*data*"<<"*image*"<<"*sound*"; + QString path = FmFileDialog::getExistingDirectory( 0, "Look in:", "", filterList, FmFileDialog::DisplayAllDirs ); + HbMessageBox::information( path ); +} + +void TestMainWindow::getOpenFileName_SetFilter() +{ + // getOpenFileName and set file filter + //Set DisplayAllDirs to display all folders, otherwise folders will also be filted. + QStringList filterList; + filterList<<"*.jpg"<<"*.gif"<<"*.png"; + QString path = FmFileDialog::getOpenFileName( 0, "Look in:", "", filterList, FmFileDialog::DisplayAllDirs ); + HbMessageBox::information( path ); +} +void TestMainWindow::getSaveFileName_SetFilter() +{ + // getSaveFileName and set file filter + //Set DisplayAllDirs to display all folders, otherwise folders will also be filted. + QStringList filterList; + filterList<<"*.jpg"<<"*.gif"<<"*.png"; + QString path = FmFileDialog::getSaveFileName( 0, "Look in:", "", filterList, FmFileDialog::DisplayAllDirs ); + HbMessageBox::information( path ); +} diff -r 95243422089a -r 491b3ed49290 filemanager/examples/demo_fmfiledialog/mainwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/examples/demo_fmfiledialog/mainwindow.h Tue Aug 31 15:06:05 2010 +0300 @@ -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: +* +* +*/ + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + + +class TestMainWindow : public HbMainWindow +{ + Q_OBJECT +public: + TestMainWindow(); + ~TestMainWindow(); + + void init(); +private slots: + void activatedListItem(HbListWidgetItem *item); + +private: + void getExistingDirectory(); + void getOpenFileName(); + void getSaveFileName(); + + void getExistingDirectory_SetDir(); + void getOpenFileName_SetDir(); + void getSaveFileName_SetDir(); + + void getExistingDirectory_SetFilter(); + void getExistingDirectory_SetFilter_AllDirs(); + void getOpenFileName_SetFilter(); + void getSaveFileName_SetFilter(); +}; diff -r 95243422089a -r 491b3ed49290 filemanager/examples/demo_fmfiledialog/rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/examples/demo_fmfiledialog/rom.pri Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,28 @@ +# 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: +# Rom exports for demo_fmfiledialog +# + +symbian { + DEMO_FMFILEDIALOG_IBY_DIR = $$section(PWD, ":", 1) + + exists(/epoc32/include/platform_paths.hrh) { + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " + } else { + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " + } + + BLD_INF_RULES.prj_exports += "$$DEMO_FMFILEDIALOG_IBY_DIR/demo_fmfiledialog.iby CORE_APP_LAYER_IBY_EXPORT_PATH(demo_fmfiledialog.iby)" +} diff -r 95243422089a -r 491b3ed49290 filemanager/examples/examples.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/examples/examples.pro Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,18 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = subdirs +SUBDIRS = demo_fmfiledialog diff -r 95243422089a -r 491b3ed49290 filemanager/filemanager.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/filemanager.pro Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,24 @@ +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +TEMPLATE = subdirs + +symbian { + include(rom/rom.pri) +} + +SUBDIRS += src/fmbkupenginewrapper +SUBDIRS += src/filemanager \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/filemanager_plat/inc/filemanager_plat.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/filemanager_plat/inc/filemanager_plat.pri Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,20 @@ +# +# 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: +# + +PLATFORM_HEADERS += $$PWD/fmglobal.h \ + $$PWD/fmfiledialog.h + +HEADERS += $$PLATFORM_HEADERS \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/filemanager_plat/inc/fmfiledialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/filemanager_plat/inc/fmfiledialog.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,126 @@ +/* +* 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: +* The header file of the file dialog +* +*/ + +#ifndef FMFILEDIALOG_H +#define FMFILEDIALOG_H + +#include "fmglobal.h" + + +#include + +class QString; +class QStringList; +class FmFileDialogPrivate; + +class FMFILEDIALOG_EXPORT FmFileDialog : public HbDialog +{ +Q_OBJECT +public: + + enum Option + { + /* + * Open dir as dialog's working directory and prevent user up to parent directory + */ + PreventDirUp = 0x00000001, + /* + * Ignore filter for dir, list all directory. Set this when need only filter filename. + */ + DisplayAllDirs = 0x00000002 + }; + Q_DECLARE_FLAGS(Options, Option) + + /** + * Static function that will return an existing directory selected by the user + * @param parent Parent widget + * @param title Title for dialog + * @param dir Dialog's working directory is set to dir + * @param nameFilters used for filter folder + * @param Options Options + * @return Directory path that user selected. + * user can select cancel to close dialog and empty string will be returned + */ + static QString getExistingDirectory( HbWidget *parent = 0, + const QString &title = QString(), + const QString &dir = QString(), + const QStringList &nameFilters = QStringList(), + Options options = 0 ); + + /** + * Static function that returns an existing file selected by the use + * @param parent Parent widget + * @param title Title for dialog + * @param dir Dialog's working directory is set to dir + * @param nameFilters used for filter file/folder, such as "*.jpg", "*.txt" + * Please set options with "DisplayAllDirs" to avoid folder be filtered when only filter filename. + * @param Options Options + * @return File path that user selected. It is an esisting file. + * user can select cancel to close dialog and empty string will be returned + */ + static QString getOpenFileName( HbWidget *parent = 0, + const QString &title = QString(), + const QString &dir = QString(), + const QStringList &nameFilters = QStringList(), + Options options = 0 ); + /** + * Static function that will return a file name selected by the user. The file does not have to exist. + * @param parent Parent widget + * @param title Title for dialog + * @param dir Dialog's working directory is set to dir + * @param nameFilters used for filter file/folder, such as "*.jpg", "*.txt" + * Please set options with "DisplayAllDirs" to avoid folder be filtered when only filter filename. + * @param Options Options + * @return File path that user selected or inputted in file name line edit. + * This file does not have to exist. + * user can select cancel to close dialog and empty string will be returned + */ + static QString getSaveFileName( HbWidget *parent = 0, + const QString &title = QString(), + const QString &dir = QString(), + const QStringList &nameFilters = QStringList(), + Options options = 0 ); + +private slots: + void dialogClosed(HbAction *action); + +private: + explicit FmFileDialog( QGraphicsItem *parent ); + ~FmFileDialog(); + + bool exec(); + HbAction *primaryAction() const; + void setPrimaryAction( HbAction *action ); + + HbAction *secondaryAction() const; + void setSecondaryAction( HbAction *action ); + + FmFileDialogPrivate *d_ptr; + + Q_DISABLE_COPY( FmFileDialog) + Q_DECLARE_PRIVATE_D(d_ptr,FmFileDialog) + Q_PRIVATE_SLOT(d_func(),void _q_handleUpButton()) + Q_PRIVATE_SLOT(d_func(),void _q_handleTextChanged(QString)) + Q_PRIVATE_SLOT(d_func(),void _q_handlePathChanged(QString)) + Q_PRIVATE_SLOT(d_func(),void _q_handleFileActivated(QString)) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(FmFileDialog::Options) + +#endif // FMFILEDIALOG_H diff -r 95243422089a -r 491b3ed49290 filemanager/filemanager_plat/inc/fmglobal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/filemanager_plat/inc/fmglobal.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,29 @@ +/* +* 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 FMGLOBAL_H +#define FMGLOBAL_H + +#include + +#ifdef FMFILEDIALOG_LIBRARY +# define FMFILEDIALOG_EXPORT Q_DECL_EXPORT +#else +# define FMFILEDIALOG_EXPORT Q_DECL_IMPORT +#endif + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/group/FileManager.mmp --- a/filemanager/group/FileManager.mmp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project specification of FileManager -* -*/ - - -#include -#include -#include "FileManagerUID.h" -MACRO _F32_STRICT_64_BIT_MIGRATION - -TARGET filemanager.exe -TARGETTYPE exe -EPOCSTACKSIZE 0x5000 -EPOCHEAPSIZE 0x20000 0x800000 // Min 128KB, Max 8MB -UID KEPOCAppUID2 KFileManagerUID3 - -VENDORID VID_DEFAULT -CAPABILITY CAP_APPLICATION DiskAdmin AllFiles PowerMgmt - -SOURCEPATH ../App/src -SOURCE CFileManagerApplication.cpp -SOURCE CFileManagerDocument.cpp -SOURCE CFileManagerAppUi.cpp -SOURCE CFileManagerFileSelectionFilter.cpp -SOURCE CFileManagerStringCache.cpp -SOURCE CFileManagerViewBase.cpp -SOURCE CFileManagerContainerBase.cpp -SOURCE CFileManagerFileListContainer.cpp -SOURCE CFileManagerFoldersView.cpp -SOURCE Cfilemanagersearchresultsview.cpp -SOURCE CFileManagerMainView.cpp -SOURCE CFileManagerMemoryStoreView.cpp -#ifdef RD_FILE_MANAGER_BACKUP -SOURCE CFileManagerBackupView.cpp -SOURCE CFileManagerRestoreView.cpp -SOURCE CFileManagerSettingListContainer.cpp -SOURCE CFileManagerTaskScheduler.cpp -SOURCE CFileManagerSchBackupHandler.cpp -#endif // RD_FILE_MANAGER_BACKUP - -START RESOURCE ../data/FileManager.rss -TARGETPATH APP_RESOURCE_DIR -HEADER -LANGUAGE_IDS -END - -START RESOURCE ../data/FileManager_reg.rss -DEPENDS filemanager.rsg -// Do not change the UID below. -TARGETPATH /private/10003a3f/apps -END - -USERINCLUDE . ../App/inc - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE . ../View/inc ../Engine/inc - -LIBRARY euser.lib cone.lib apparc.lib -LIBRARY eikcore.lib eikctl.lib eikcoctl.lib -LIBRARY avkon.lib -LIBRARY commonengine.lib -LIBRARY filemanagerview.lib filemanagerengine.lib -LIBRARY commondialogs.lib -LIBRARY bafl.lib -LIBRARY sendui.lib -LIBRARY memstatepopup.lib -LIBRARY hlplch.lib -LIBRARY efsrv.lib -LIBRARY aknskins.lib -LIBRARY gdi.lib -LIBRARY drmhelper.lib -LIBRARY charconv.lib -LIBRARY ecom.lib -LIBRARY centralrepository.lib -#ifdef RD_FILE_MANAGER_BACKUP -LIBRARY ws32.lib -LIBRARY schsvr.lib -LIBRARY apgrfx.lib -LIBRARY eikdlg.lib -#endif // RD_FILE_MANAGER_BACKUP -LIBRARY caf.lib -LIBRARY commonui.lib -LIBRARY servicehandler.lib -LIBRARY platformenv.lib -LIBRARY ssmcmn.lib // state manager - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/group/FileManagerEngine.mmp --- a/filemanager/group/FileManagerEngine.mmp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project specification of FileManagerEngine -* -*/ - - - -#include -#include -#include "FileManagerUID.h" -MACRO _F32_STRICT_64_BIT_MIGRATION - -TARGET filemanagerengine.dll -TARGETTYPE dll -UID KEPOCStaticDllUID2 KFileManagerUID3 -VENDORID VID_DEFAULT -CAPABILITY CAP_GENERAL_DLL - - -START RESOURCE ../Engine/data/FileManagerEngine.rss -TARGETPATH RESOURCE_FILES_DIR -HEADER -LANGUAGE_IDS -END - -SOURCEPATH ../Engine/src -SOURCE CFileManagerEngine.cpp -#ifndef RD_MULTIPLE_DRIVE -SOURCE CFileManagerFolderEntry.cpp -#endif // RD_MULTIPLE_DRIVE -SOURCE Cfilemanagerfolderarray.cpp -SOURCE CFileManagerItemProperties.cpp -SOURCE CFilemanagerMimeIconArray.cpp -SOURCE CFileManagerActiveExecute.cpp -SOURCE CFileManagerIRReceiver.cpp -SOURCE CFileManagerFileSystemIterator.cpp -SOURCE Cfilemanagerindexiterator.cpp -SOURCE CfilemanageractiveDelete.cpp -SOURCE CFileManagerRefresher.cpp -SOURCE Cfilemanagerfilesystemevent.cpp -SOURCE Cfilemanageractivesize.cpp -SOURCE CFileManagerUtils.cpp -SOURCE CfilemanagerActiveCount.cpp -SOURCE CFileManagerItemFilter.cpp -SOURCE TFileManagerDriveInfo.cpp -SOURCE CFileManagerDocHandler.cpp -SOURCE CFileManagerThreadWrapper.cpp -SOURCE CFileManagerRemovableDriveHandler.cpp -SOURCE CFileManagerRemoteDriveHandler.cpp -SOURCE CFileManagerPropertySubscriber.cpp -#ifdef RD_FILE_MANAGER_BACKUP -SOURCE CFileManagerBackupSettingsFull.cpp -SOURCE CFileManagerRestoreSettingsFull.cpp -#else // RD_FILE_MANAGER_BACKUP -SOURCE CFileManagerBackupSettings.cpp -SOURCE CFileManagerRestoreSettings.cpp -#endif // RD_FILE_MANAGER_BACKUP -SOURCE CFileManagerActiveBase.cpp -SOURCE CFileManagerActiveRename.cpp -SOURCE CFileManagerFeatureManager.cpp - -USERINCLUDE . ../Engine/inc ../GFLM/inc ../bkupengine/inc - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/connect - -LIBRARY euser.lib -LIBRARY gflm.lib -LIBRARY efsrv.lib -LIBRARY bafl.lib -LIBRARY cone.lib -LIBRARY irobex.lib -LIBRARY esock.lib -LIBRARY irda.lib -LIBRARY sysutil.lib -LIBRARY featmgr.lib -LIBRARY commonengine.lib -//LIBRARY MGXMediaFileApi.lib -LIBRARY tzclient.lib -LIBRARY caf.lib -LIBRARY drmdcf.lib -LIBRARY commonui.lib -LIBRARY apparc.lib -LIBRARY apmime.lib -LIBRARY avkon.lib -LIBRARY platformenv.lib -LIBRARY filemanagerbkupengine.lib -LIBRARY apgrfx.lib -LIBRARY ws32.lib -LIBRARY rsfwmountman.lib -LIBRARY centralrepository.lib -#ifdef __KEEP_DRM_CONTENT_ON_PHONE -#ifdef FILE_MANAGER_USE_DISTRIBUTABLECHECKER -LIBRARY distributablechecker.lib -#endif // FILE_MANAGER_USE_DISTRIBUTABLECHECKER -#endif // __KEEP_DRM_CONTENT_ON_PHONE -LIBRARY directorylocalizer.lib -//LIBRARY mgexternalservices.lib -LIBRARY eikcore.lib -LIBRARY drmutility.lib - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/group/FileManagerUID.h --- a/filemanager/group/FileManagerUID.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +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: File Manager UID definitions -* -*/ - - -#ifndef __FILEMANAGERUID_H__ -#define __FILEMANAGERUID_H__ - - -// MACROS - -/// File Manager application UID3 -#define KFileManagerUID3 0x101F84EB - -/// File Manager scheduled backup module UID3 -#define KFileManagerSchBkupUID3 0x2000B182 - -// -// Common system UIDs -// -#define KEPOCAppUID2 0x100039ce -#define KEPOCStaticDllUID2 0x1000008d - - -#endif // __FILEMANAGERUID_H__ - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/group/FileManagerView.mmp --- a/filemanager/group/FileManagerView.mmp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project specification of FileManagerView -* -*/ - - -#include -#include -#include "FileManagerUID.h" -MACRO _F32_STRICT_64_BIT_MIGRATION - -TARGET filemanagerview.dll -TARGETTYPE dll -UID KEPOCStaticDllUID2 KFileManagerUID3 -VENDORID VID_DEFAULT -CAPABILITY CAP_GENERAL_DLL - -START RESOURCE ../View/data/FileManagerView.rss -TARGETPATH RESOURCE_FILES_DIR -HEADER -LANGUAGE_IDS -END - -SOURCEPATH ../View/src -SOURCE CFileManagerIconArray.cpp -SOURCE CFileManagerPopupBase.cpp -SOURCE CFileManagerInfoPopup.cpp -SOURCE Cfilemanagerfoldernavigationpane.cpp -SOURCE Cfilemanagerfoldernamequerydlg.cpp -SOURCE CFileManagerFileNameQueryDlg.cpp -SOURCE CFileManagerFullOmaDrmInfo.cpp -SOURCE FileManagerDlgUtils.cpp -SOURCE CFileManagerCheckBoxSettingPage.cpp -SOURCE CFileManagerMMCInfoPopup.cpp -SOURCE CFileManagerGlobalDlgFull.cpp -SOURCE CFileManagerGlobalQueryDlg.cpp - -USERINCLUDE . ../View/inc - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE . ../Engine/inc - -LIBRARY euser.lib cone.lib -LIBRARY eikcore.lib eikcoctl.lib eikdlg.lib -LIBRARY avkon.lib -LIBRARY egul.lib -LIBRARY bafl.lib -LIBRARY commonengine.lib -LIBRARY filemanagerengine.lib -LIBRARY aknskins.lib -LIBRARY drmhelper.lib -LIBRARY efsrv.lib -LIBRARY cdlengine.lib -LIBRARY aknicon.lib -LIBRARY gdi.lib -LIBRARY aknlayout2scalable.lib -LIBRARY aknnotify.lib -LIBRARY memstatepopup.lib -LIBRARY drmrights.lib -LIBRARY drmuihandling.lib - -// ----------- Touch feedback additions start -#ifdef RD_TACTILE_FEEDBACK -LIBRARY touchfeedback.lib -#endif //RD_TACTILE_FEEDBACK -// ----------- Touch feedback additions end - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/group/GFLM.mmp --- a/filemanager/group/GFLM.mmp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2002-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: Project specification of GFLM -* -*/ - - - -#include -#include -#include "../GFLM/inc/GFLMUid.h" -MACRO _F32_STRICT_64_BIT_MIGRATION - -TARGET gflm.dll -TARGETTYPE DLL -UID KSymbianDLLUid2 KGflmUid3 - -VENDORID VID_DEFAULT -CAPABILITY CAP_GENERAL_DLL - - -SOURCEPATH ../GFLM/src -SOURCE CGflmNavigatorModel.cpp -SOURCE CGflmFileListModel.cpp -SOURCE CGflmItemGroupImpl.cpp -SOURCE CGflmItemLocalizer.cpp -SOURCE CGflmGroupItem.cpp -SOURCE CGflmGlobalActionItem.cpp -SOURCE CGflmFileSystemItem.cpp -SOURCE CGflmDirectoryListingCache.cpp -SOURCE CGflmFileRecognizer.cpp -SOURCE CGflmDriveResolver.cpp -SOURCE GflmUtils.cpp -SOURCE CGflmDriveItem.cpp -SOURCE CGflmFileFinder.cpp -SOURCE CGflmFileFinderItem.cpp - -SOURCEPATH ../GFLM/data -START RESOURCE GflmFileExtensionMimeTypes.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -END - -USERINCLUDE ../GFLM/inc -USERINCLUDE ../Engine/inc // For debug definitions - -APP_LAYER_SYSTEMINCLUDE - -LIBRARY apgrfx.lib // RApaLsSession -LIBRARY apmime.lib // TDataType -LIBRARY bafl.lib -LIBRARY efsrv.lib -LIBRARY euser.lib -LIBRARY directorylocalizer.lib - -#ifdef RD_MULTIPLE_DRIVE -LIBRARY platformenv.lib -#endif // RD_MULTIPLE_DRIVE diff -r 95243422089a -r 491b3ed49290 filemanager/group/backup_registration.xml --- a/filemanager/group/backup_registration.xml Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - - - diff -r 95243422089a -r 491b3ed49290 filemanager/group/bld.inf --- a/filemanager/group/bld.inf Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* Copyright (c) 2002-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: Build information file for project FileManager -* -*/ - - -#include - -PRJ_PLATFORMS -DEFAULT -// Help exports -#include "../help/group/bld.inf" - -PRJ_EXPORTS -//Configuration tool migration -../conf/s60filemanager.confml APP_LAYER_CONFML(s60filemanager.confml) -../conf/s60filemanager_1020506B.crml APP_LAYER_CRML(s60filemanager_1020506b.crml) - -../group/backup_registration.xml z:/private/101f84eb/backup_registration.xml - -../rom/FileManager.iby CORE_APP_LAYER_IBY_EXPORT_PATH(FileManager.iby) -../rom/FileManagerResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(FileManagerResources.iby) -../loc/FileManager.loc APP_LAYER_LOC_EXPORT_PATH(filemanager.loc) - - -PRJ_EXTENSIONS -START EXTENSION s60/mifconv - OPTION TARGETFILE filemanager.mif - OPTION HEADERFILE filemanager.mbg -#ifdef RD_MULTIPLE_DRIVE - OPTION SOURCES \ - -c8,1 qgn_prop_mmc_memc -c8,1 qgn_prop_phone_memc -c8,1 qgn_prop_memc_phone_tab \ - -c8,1 qgn_prop_memc_mmc_tab -c8,1 qgn_prop_folder_tab -c8,1 qgn_prop_memc_phone_tab2 \ - -c8,1 qgn_prop_memc_mmc_tab2 -c8,8 qgn_prop_file_swf_small -c8,8 qgn_prop_fmgr_phone_memc_sub \ - -c8,8 qgn_prop_fmgr_mmc_sub -c8,8 qgn_prop_fmgr_mmc_no_sub -c8,8 qgn_prop_fmgr_backup_sub \ - -c8,8 qgn_indi_connection_on_add -c8,8 qgn_menu_fmgr_remote_drive -c8,8 qgn_prop_fmgr_remote_drive_tab \ - -c8,8 qgn_prop_folder_empty -c8,8 qgn_indi_mmc_add -c8,8 qgn_prop_fmgr_ms_sub \ - -c8,8 qgn_prop_memc_ms_tab -c8,8 qgn_prop_usb_memc_sub.svg -c8,8 qgn_prop_usb_memc_tab \ - -c8,8 qgn_indi_usb_memc.svg -#else - OPTION SOURCES \ - -c8,1 qgn_prop_mmc_memc -c8,1 qgn_prop_phone_memc -c8,1 qgn_prop_memc_phone_tab \ - -c8,1 qgn_prop_memc_mmc_tab -c8,1 qgn_prop_folder_tab -c8,1 qgn_prop_memc_phone_tab2 \ - -c8,1 qgn_prop_memc_mmc_tab2 -c8,8 qgn_prop_file_swf_small -c8,8 qgn_prop_fmgr_phone_memc_sub \ - -c8,8 qgn_prop_fmgr_mmc_sub -c8,8 qgn_prop_fmgr_mmc_no_sub -c8,8 qgn_prop_fmgr_backup_sub \ - -c8,8 qgn_indi_connection_on_add -c8,8 qgn_menu_fmgr_remote_drive -c8,8 qgn_prop_fmgr_remote_drive_tab \ - -c8,8 qgn_prop_folder_empty -c8,8 qgn_indi_mmc_add -c8,8 qgn_indi_usb_memc.svg -#endif -END - -PRJ_EXTENSIONS -START EXTENSION s60/mifconv - OPTION TARGETFILE filemanager_aif.mif - OPTION SOURCES -c8,8 qgn_menu_fmgr -END - - - -PRJ_MMPFILES -/* - #ifdef RD_MULTIPLE_DRIVE - gnumakefile fmgr_icons_multiple_drive_dc.mk - #else // RD_MULTIPLE_DRIVE - gnumakefile fmgr_icons_merge_dc.mk - #endif // RD_MULTIPLE_DRIVE - - #ifdef __SCALABLE_ICONS - gnumakefile fmgr_icons_aif_scalable_dc.mk - #else - gnumakefile fmgr_icons_aif_bitmaps_dc.mk - #endif -*/ - -GFLM.mmp -filemanagerbkupengine.mmp -#ifdef RD_FILE_MANAGER_BACKUP - filemanagerschbkup.mmp -#endif // RD_FILE_MANAGER_BACKUP -FileManagerEngine.mmp -FileManagerView.mmp -FileManager.mmp -filemanagerbkupchecker.mmp -filemanageraiwprovider.mmp - diff -r 95243422089a -r 491b3ed49290 filemanager/group/filemanageraiwprovider.mmp --- a/filemanager/group/filemanageraiwprovider.mmp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project definition file for project filemanageraiwprovider -* -*/ - - -#include -#include -MACRO _F32_STRICT_64_BIT_MIGRATION -TARGET filemanageraiwprovider.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x200110F8 - -CAPABILITY CAP_ECOM_PLUGIN -VENDORID VID_DEFAULT - -SOURCEPATH ../aiwprovider/src -SOURCE filemanageraiwprovider.cpp - -USERINCLUDE . -USERINCLUDE ../aiwprovider/inc -USERINCLUDE ../Engine/inc -APP_LAYER_SYSTEMINCLUDE - -SOURCEPATH ../aiwprovider/data -START RESOURCE 200110F8.rss -TARGET filemanageraiwprovider.rsc -END - -LIBRARY euser.lib -LIBRARY apparc.lib -LIBRARY ws32.lib -LIBRARY apgrfx.lib -LIBRARY ecom.lib -LIBRARY servicehandler.lib -LIBRARY avkon.lib -LIBRARY centralrepository.lib diff -r 95243422089a -r 491b3ed49290 filemanager/group/filemanagerbkupchecker.mmp --- a/filemanager/group/filemanagerbkupchecker.mmp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +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 filemanagerbkupchecker -* -*/ - - -#include -#include -MACRO _F32_STRICT_64_BIT_MIGRATION - -TARGET filemanagerbkupplugin.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x10205078 - -CAPABILITY CAP_ECOM_PLUGIN -VENDORID VID_DEFAULT - -SOURCEPATH ../bkupchecker/src -SOURCE filemanagerbkupchecker.cpp -USERINCLUDE . ../bkupchecker/inc - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE ../Engine/inc - -SOURCEPATH ../bkupchecker/data -START RESOURCE 10205078.rss -TARGET filemanagerbkupplugin.rsc -END - -START RESOURCE filemanagerbkupchecker.rss -TARGET filemanagerbkupchecker.rsc -TARGETPATH RESOURCE_FILES_DIR -HEADER -LANGUAGE_IDS -END - -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY bafl.lib -LIBRARY apfile.lib -LIBRARY akncapserverclient.lib -LIBRARY eikcore.lib -LIBRARY apparc.lib - diff -r 95243422089a -r 491b3ed49290 filemanager/group/filemanagerbkupengine.mmh --- a/filemanager/group/filemanagerbkupengine.mmh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +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 header file for project FileManagerBkupEngine -* -*/ - -SOURCE CMMCScBkupArchive.cpp -SOURCE CMMCScBkupArchiveDataManager.cpp -SOURCE CMMCScBkupArchiveFooter.cpp -SOURCE CMMCScBkupArchiveHeader.cpp -SOURCE CMMCScBkupArchiveInfo.cpp -SOURCE CMMCScBkupBufferManagers.cpp -SOURCE CMMCScBkupDataOwnerCollection.cpp -SOURCE CMMCScBkupDataOwnerInfo.cpp -SOURCE CMMCScBkupDataStrategies.cpp -SOURCE CMMCScBkupDriveSpecificRequest.cpp -SOURCE CMMCScBkupEngine.cpp -SOURCE CMMCScBkupEngineImpl.cpp -SOURCE CMMCScBkupFileInfo.cpp -SOURCE CMMCScBkupFileListCollection.cpp -SOURCE CMMCScBkupIndexBase.cpp -SOURCE CMMCScBkupIndexDataOwners.cpp -SOURCE CMMCScBkupIndexActiveData.cpp -SOURCE CMMCScBkupIndexPassiveData.cpp -SOURCE CMMCScBkupIndexPublicDataFiles.cpp -SOURCE CMMCScBkupIndexJavaData.cpp -SOURCE CMMCScBkupIndexSystemData.cpp -SOURCE CMMCScBkupIndexWithIdentifier.cpp -SOURCE CMMCScBkupOperationParameters.cpp -SOURCE CMMCScBkupState.cpp -SOURCE CMMCScBkupStateArchiveOpActiveData.cpp -SOURCE CMMCScBkupStateArchiveOpArchiveFooter.cpp -SOURCE CMMCScBkupStateArchiveOpArchiveHeader.cpp -SOURCE CMMCScBkupStateArchiveOpDataOwners.cpp -SOURCE CMMCScBkupStateArchiveOpPassiveData.cpp -SOURCE CMMCScBkupStateArchiveOpPublicDataFiles.cpp -SOURCE CMMCScBkupStateArchiveOpSystemData.cpp -SOURCE CMMCScBkupStateArchiveOpJavaData.cpp -SOURCE CMMCScBkupStateFactory.cpp -SOURCE CMMCScBkupStateGetDataOwners.cpp -SOURCE CMMCScBkupStateGetDataOwnerStatuses.cpp -SOURCE CMMCScBkupStateOpAware.cpp -SOURCE CMMCScBkupStateRequestListOfPublicFiles.cpp -SOURCE CMMCScBkupStateRequestSizeOfBackupData.cpp -SOURCE CMMCScBkupStateSetPhoneMode.cpp -SOURCE CMMCScBkupStateNotifyAllSnapshotsSupplied.cpp -SOURCE CMMCScBkupStateValidateDiskSpace.cpp -SOURCE CMMCScBkupTransferReadRequest.cpp -SOURCE CMMCScBkupTransferRequest.cpp -SOURCE CMMCScBkupTransferWriteRequest.cpp -SOURCE CMMCScBkupDriveAndOperationTypeManager.cpp -SOURCE CMMCScBkupDriveDataSizeManager.cpp -SOURCE MMCScBkupArchiveUtils.cpp -SOURCE MMCScBkupPhoneModelUtils.cpp -SOURCE MMCScBkupSBEUtils.cpp -SOURCE MMCScBkupLogger.cpp -SOURCE RMMCScBkupArchiveStreams.cpp -SOURCE RMMCScBkupProgressSizer.cpp -SOURCE TMMCScBkupArchiveVector.cpp -SOURCE TMMCScBkupDriveFilter.cpp -SOURCE TMMCScBkupDriveAndSize.cpp diff -r 95243422089a -r 491b3ed49290 filemanager/group/filemanagerbkupengine.mmp --- a/filemanager/group/filemanagerbkupengine.mmp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +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 FileManagerBkupEngine -* -*/ - - -#include -#include "../bkupengine/inc/MMCScBkupDllUids.h" -MACRO _F32_STRICT_64_BIT_MIGRATION - -TARGET filemanagerbkupengine.dll -TARGETTYPE dll -UID KEPOCDLLUID2 KMMCAppEngUID3 -VENDORID VID_DEFAULT -CAPABILITY CAP_GENERAL_DLL DiskAdmin AllFiles PowerMgmt - -SOURCEPATH ../bkupengine/src -#include "filemanagerbkupengine.mmh" - -USERINCLUDE ../bkupengine/inc - -APP_LAYER_SYSTEMINCLUDE -//SYSTEMINCLUDE /epoc32/include/connect - -LIBRARY sbeclient.lib -LIBRARY euser.lib -LIBRARY ezlib.lib -LIBRARY bafl.lib -LIBRARY efsrv.lib -LIBRARY sysutil.lib -LIBRARY commonengine.lib -LIBRARY featmgr.lib -LIBRARY estor.lib -LIBRARY centralrepository.lib -LIBRARY platformenv.lib -LIBRARY cone.lib - - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/group/filemanagerschbkup.mmp --- a/filemanager/group/filemanagerschbkup.mmp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +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 FileManagerSchBkup -* -*/ - - -#include -#include "FileManagerUID.h" -MACRO _F32_STRICT_64_BIT_MIGRATION -TARGET filemanagerschbkup.exe -TARGETTYPE exe -UID KEPOCAppUID2 KFileManagerSchBkupUID3 - -VENDORID VID_DEFAULT -CAPABILITY CAP_APPLICATION - -SOURCEPATH ../schbkup/src -SOURCE filemanagerschbackupmain.cpp -SOURCE filemanagerschbackuptask.cpp -SOURCE filemanagerschsubscriber.cpp -SOURCE fmsystemstatemonitor.cpp - -USERINCLUDE . ../schbkup/inc ../Engine/inc - -APP_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY estor.lib -LIBRARY schsvr.lib -LIBRARY ws32.lib -LIBRARY apgrfx.lib -LIBRARY apparc.lib -LIBRARY centralrepository.lib -LIBRARY ssmcmn.lib // state manager - diff -r 95243422089a -r 491b3ed49290 filemanager/help/data/xhtml.zip Binary file filemanager/help/data/xhtml.zip has changed diff -r 95243422089a -r 491b3ed49290 filemanager/help/group/bld.inf --- a/filemanager/help/group/bld.inf Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* 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: -* Export help related files. -* -*/ - -#include -PRJ_EXPORTS -:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite -:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite - -../inc/fmgr.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/fmgr.hlp.hrh) -../rom/filemanagerhelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(filemanagerhelps_variant.iby) diff -r 95243422089a -r 491b3ed49290 filemanager/help/inc/fmgr.hlp.hrh --- a/filemanager/help/inc/fmgr.hlp.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* 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: -* -*/ - -// -// fmgr.hlp.hrh generated by CSXHelp Utilities. -// - -#ifndef __FMGR_HLP_HRH__ -#define __FMGR_HLP_HRH__ - -_LIT(KFMGR_HLP_MEM_STORE_VIEW, "FMGR_HLP_MEM_STORE_VIEW"); // -_LIT(KFMGR_HLP_MAIN_VIEW, "FMGR_HLP_MAIN_VIEW"); // -_LIT(KFMGR_HLP_SEARCH_RESULTS, "FMGR_HLP_SEARCH_RESULTS"); // -_LIT(KFMGR_HLP_BACKUP_VIEW, "FMGR_HLP_BACKUP_VIEW"); // - -#endif \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/help/rom/filemanagerhelps_variant.iby --- a/filemanager/help/rom/filemanagerhelps_variant.iby Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* 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 __FILEMANAGERHELPS_VARIANT_IBY__ -#define __FILEMANAGERHELPS_VARIANT_IBY__ - -#if defined(FF_S60_HELPS_IN_USE) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F84EB\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x101F84EB\contents.zip) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F84EB\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101F84EB\index.xml) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F84EB\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101F84EB\keywords.xml) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F84EB\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101F84EB\meta.xml) -#endif - -#endif \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/loc/FileManager.loc --- a/filemanager/loc/FileManager.loc Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2138 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Localization strings for project FileManager -* -*/ - - -/* - The syntax of a logical name entry in this file is the following: - - // d:context description (line 1) - // d:context description (line N) - // l:layout id - // w: - // r:release information - // - #define qtn__?freetext "?text" - - where - "qtn_" starts a logical name. Note: "text_" has been used in - old logical names, but is deprecated. - "?feature/application" is 2-5 lower-case characters and/or numbers - identifying the larger context of the display text. - "?freetext" is the free text portion of the logical name. - It may contain only lower-case letters ('a' to 'z'), numbers - ('0' to '9'), and the underscore ('_'). The total length of - the logical name does must not exceed 50 characters. - "d:" Starts a description line clarifying the entry's context with - information like: - - Is a word a verb in imperative or is it a noun? (For instance, - what does "Set" mean?) - - What will replace %U (unicode text parameter) or %N (number - parameter) included in texts? (For instance, is it a phone - number or an e-mail address?) - "l:" Starts a layout id information (one line). - "P" and "No" are symbols in LAF's information table - - "P" is parent pane or current pane - - "No" is reference number in table - "r:" Starts a release information: one line indicating in which - S60 release the text was used for the first time. - - Refer to the S60 localization instructions for more information. - - Examples: - -// d:Command in options list in short term memories. -// d:Opens the call list view that is focused. -// l:list_single_popup_menu_pane_1 -// r:3.1 -// -#define text_logs_stm_cmd_open "Open" - -// d:Title pane text in converter main state. -// l:title_pane_1 -// r:3.0 -// -#define qtn_cnv_title "Converter" - -// d:Prompt text for currency data query in converter. -// l:popup_query_data_window_1 -// r:4.0 -// -#define qtn_cnv_edit_name_prompt "Currency name" - -// d:Active call is terminated and a held call becomes active. -// d:Operation is confirmed with this info note. -// d:%U stands for the call identification of the activated call. -// l:popup_note_window_1 -// r:3.1 -// -#define qtn_multc_unhold_done_note "%U active" - -*/ - -// LOCALISATION STRINGS - -//d:Title pane text in File Manager main state. -//d:Application name. -//l:title_pane_t2/opt9 -//w: -//r:3.0 -// -#define qtn_fmgr_main_title "File Manager" - -//d:Caption string for AIF file (short) -//l:cell_app_pane_t1 -//w: -//r:3.0 -// -#define qtn_apps_fmgr_grid "File Manager" - -//d:Caption string for AIF file (long) -//l:list_single_large_graphic_pane_t1 -//w: -//r:3.0 -// -#define qtn_apps_fmgr_list "File Manager" - -//d:Command in options list -//l:list_single_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_fmgr_options_find_file "Find" - -//d:Command in options list -//l:list_single_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_album_cmd_receive_via_ir "Receive via infrared" - -//d:Title text for info popup (when focus is on file) -//l:heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_fmgr_info_heading_file "File details:" - -//d:Title text for info popup (when focus is on folder) -//l:heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_fmgr_info_heading_fldr "Folder details:" - -//d:Title text for info popup (when focus is on link) -//l:heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_fmgr_info_heading_link "Link details:" - -//d:heading item text for the info popup listbox -//l:list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_fmgr_info_fldr_default "Folder:" - -//d:heading item text for the info popup listbox -//l:list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_fmgr_info_contain_fldr "Sub folders:" - -//d:heading item text for the info popup listbox -//l:list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_fmgr_info_contain_file "Files:" - -//d:data item text for the info popup listbox when focus is on default folder. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_fmgr_info_def_fldr_text "Default folder" - -//d:heading item text for the info popup listbox -//l:list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_swins_lsh2_apps_name "Name:" - -//d:heading item text for the info popup listbox -//l:list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_swins_lsh2_apps_type "Type:" - -//d:heading item text for the info popup listbox -//l:list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_album_datim_date "Date:" - -//d:heading item text for the info popup listbox -//l:list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_album_datim_time "Time:" - -//d:heading item text for the info popup listbox -//l:list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_album_litxt_size "Size:" - -//d:Title text for memory state popup -//l:heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_fmgr_mstate_heading "Memory state:" - -//d:Information note text -//d:if focused file type is not supported, this text is shown -//l:popup_note_window -//w: -//r:3.0 -// -#define qtn_fmgr_error_unsupport "File is unsupported and can't be opened" - -//d:Information note text -//d:if focused file type is not supported, this text is shown -//l:popup_note_window -//w: -//r:3.0 -// -#define qtn_fmgr_error_cant_open "File can't be opened" - -//d:Information note text -//d:if user tries to delete default folder, this text is shown -//l:popup_note_window -//w: -//r:3.0 -// -#define qtn_fmgr_error_del_def_fldr "The folder is used as default folder for some other application. You can't delete it." - -//d:Information note text -//d:if user tries to delete a file that is currently in use, this text is shown -//l:popup_note_window -//w: -//r:3.0 -// -#define qtn_fmgr_error_delete_file_open "The file is currently open. Can't be deleted" - -//d:Prompt text in common file dialog -//d:shown when user is prompted to select memory to be searched -//l:heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_fmgr_find_prtx "Look in:" - -//d:a prompt for entering text to be searched -//l:popup_query_data_window_t3/opt2 -//w: -//r:3.0 -// -#define qtn_fmgr_find_dataq_prtx "Searched text:" - -//d:text displayed in wait dialog when searching files -//l:popup_note_wait_window -//w: -//r:3.0 -// -#define qtn_fmgr_wnote_search "Searching" - -//d:text displayed in search view if there are no results -//l:main_list_empty_pane -//w: -//r:3.0 -// -#define qtn_fmgr_search_not_found "No found files or folders" - -//d: a progress note when connecting to other device before receiving a file -//l: popup_note_wait_window -//w: -//r:3.0 -// -#define qtn_ir_connecting "Connecting via infrared" - -//d:text displayed in progress dialog when receiving file -//l:popup_note_wait_window -//w: -//r:3.0 -// -#define qtn_fmgr_note_receive_ir "Receiving file %N%" - -//d:Separates folder icons in navipane when subfolders are browsed. -//d:only for __SERIES60_MMC -//l:list_cale_time_pane_t2/opt10 -//w: -//r:3.0 -// -#define qtn_memc_main_separator "\\" - -//d:End character for navipane when subfolders are browsed beyond the maximum -//d:navigation depth -//l:list_cale_time_pane_t2/opt10 -//w: -//r:3.0 -// -#define qtn_memc_main_end "..." - -//d:Information note text -//d: User is trying to delete a folder, one file is open in that folder so it cannot be deleted and this text is shown -//l:popup_note_window -//w: -//r:3.0 -// -#define qtn_fmgr_error_del_fldr_open_1 "The folder contains open file. Folder can't be deleted" - -//d:Information note text -//d: User is trying to delete a folder, several files are open in that folder so it cannot be deleted -//l:popup_note_window -//w: -//r:3.0 -// -#define qtn_fmgr_error_del_fldr_open_se "The folder contains several open files. Folder can't be deleted" - -/////////////////////////////////////////////////////////////// -// DRM view info, these are also introduced in Rights Manager. -/////////////////////////////////////////////////////////////// - -//d: This is displayed in view info popup -//d: Type of rights, play -//l: navi_navi_text_pane_srt_t1 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det2_play "Play" - -//d: This is displayed in view info popup -//d: Type of rights, display -//l: navi_navi_text_pane_srt_t1 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det2_display "Display" - -//d: This is displayed in view info popup -//d: Type of rights, execute -//l: navi_navi_text_pane_srt_t1 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det2_execute "Execute" - -//d: This is displayed in view info popup -//d: Type of rights, print -//l: navi_navi_text_pane_srt_t1 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det2_print "Print" - -//d: This is displayed in view info popup -//d: Full Rights label. In parentheses there will be either play, display, execute or print word -//l: list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_full_x "Rights (%U)" - -//d: This is displayed in view info popup -//d: Full Rights data, unlimited usage -//l: list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_unlimited "Unlimited" - -//d: This is displayed in view info popup -//d: Count label. In parentheses there will be either play, display, execute or print word -//l: list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_utl_x "Times left (%U)" - -//d: This is displayed in view info popup -//d: Count data. 1 count -//l: list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_1_count "1 count" - -//d: This is displayed in view info popup -//d: Count data. more than 1 count -//l: list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_n_counts "%N counts" - -//d: This is displayed in view info popup -//d: Interval label, which is not activated. In parentheses there will be either play, -// display, execute or print word -//l: list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_uts_x "Times status (%U)" - -//d: This is displayed in view info popup -//d: Interval data. Not activated -//l: list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_not_act "Not activated" - -//d: This is displayed in view info popup -//d: Interval time left label. In parentheses there will be either play, -// display, execute or print word -//l: list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_udl_x "Time left (%U)" - -//d: This is displayed in view info popup -//d: Interval data. One measurement -//l: list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_inter "%U" - -//d: This is displayed in view info popup -//d: Interval data. Two measurement -//l: list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_inter_two "%0U, %1U" - -//d:Possible second line for fourth entry of Details View listbox -//d:It reports that the time constraint for this type of object is 1 year. -//d:Other quantities of time may follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_years_one "1 year" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of years of an interval -//d:It is used for period of years ending with 1 from 21 (21, 31, 41,etc.) -//d:It reports that the time constraint for this type of object is %N years. -//d:Other quantities of time may follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_years_one_final "%N years" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of years of an interval -//d:It is used for period of years ending from 2 to 4, excluded 12-14 (2-4, -//d:22-24, 32-34, etc.) -//d:It reports that the time constraint for this type of object is %N years. -//d:Other quantities of time may follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_years_two_four "%N years" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of years of an interval -//d:It is used for period of years ending from 5 to 0 plus range between 11 and -//d:14 (5-20, 25-30, 35-40, etc.) -//d:It reports that the time constraint for this type of object is %N years. -//d:Other quantities of time may follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_years_five_zero "%N years" - -//d:Possible second line for fourth entry of Details View listbox -//d:It reports that the time constraint for this type of object is 1 month. -//d:Other quantities of time may precede or follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_months_one "1 month" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of months of an interval -//d:It is used for period from two to four months -//d:It reports that the time constraint for this type of object is %N months. -//d:Other quantities of time may precede or follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_months_two_four "%N months" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of months of an interval -//d:It is used for period greater than four months -//d:It reports that the time constraint for this type of object is %N months. -//d:Other quantities of time may precede or follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_months_five_zero "%N months" - -//d:Possible second line for fourth entry of Details View listbox -//d:It reports that the time constraint for this type of object is 1 day. -//d:Other quantities of time may precede or follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_days_one "1 day" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of days of an interval -//d:It is used for a period of 21 days -//d:It reports that the time constraint for this type of object is %N days. -//d:Other quantities of time may precede or follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_days_one_final "%N days" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of days of an interval -//d:It is used for period of days ending from 2 to 4, excluded 12-14 (2-4, -//d:22-24) -//d:It reports that the time constraint for this type of object is %N days. -//d:Other quantities of time may precede or follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_days_two_four "%N days" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of days of an interval -//d:It is used for period of days ending from 5 to 0 plus range between 11 and -//d:14 (5-20, 25-30) -//d:It reports that the time constraint for this type of object is %N days. -//d:Other quantities of time may precede or follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_days_five_zero "%N days" - -//d:Possible second line for fourth entry of Details View listbox -//d:It reports that the time constraint for this type of object is 1 hour. -//d:Other quantities of time may precede or follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_hours_one "1 hour" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of hours of an interval -//d:It is used for a period of 21 hours -//d:It reports that the time constraint for this type of object is %N hours. -//d:Other quantities of time may precede or follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_hours_one_final "%N hours" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of hours of an interval -//d:It is used for period of hours ending from 2 to 4, excluded 12-14 (2-4, -//d:22-23) -//d:It reports that the time constraint for this type of object is %N hours. -//d:Other quantities of time may precede or follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_hours_two_four "%N hours" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of hours of an interval -//d:It is used for a period included from 5 to 20 hours -//d:It reports that the time constraint for this type of object is %N hours. -//d:Other quantities of time may precede or follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_hours_five_zero "%N hours" - -//d:Possible second line for fourth entry of Details View listbox -//d:It reports that the time constraint for this type of object is 1 minute. -//d:Other quantities of time may precede or follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_mins_one "1 minute" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of minutes of an interval -//d:It is used for period of minutes ending with 1 from 21 (21, 31, 41, 51) -//d:It reports that the time constraint for this type of object is %N minutes. -//d:Other quantities of time may precede or follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_mins_one_final "%N minutes" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of minutes of an interval -//d:It is used for period of minutes ending from 2 to 4, excluded 12-14 (2-4, -//d:22-24, 32-34, 42-44, 52-54) -//d:It reports that the time constraint for this type of object is %N minutes. -//d:Other quantities of time may precede or follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_mins_two_four "%N minutes" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of minutes of an interval -//d:It is used for period of minutes ending from 5 to 0 plus range between 11 -//d:and 14 (5-20, 25-30, 35-40, 45-50, 53-59) -//d:It reports that the time constraint for this type of object is %N minutes. -//d:Other quantities of time may precede or follow. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_mins_five_zero "%N minutes" - -//d:Possible second line for fourth entry of Details View listbox -//d:It reports that the time constraint for this type of object is 1 second. -//d:Other quantities of time may precede. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_secs_one "1 second" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of seconds of an interval -//d:It is used for period of seconds ending with 1 from 21 (21, 31, 41, 51) -//d:It reports that the time constraint for this type of object is %N seconds. -//d:Other quantities of time may precede. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_secs_one_final "%N seconds" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of seconds of an interval -//d:It is used for period of seconds ending from 2 to 4, excluded 12-14 (2-4, -//d:22-24, 32-34, 42-44, 52-54) -//d:It reports that the time constraint for this type of object is %N seconds. -//d:Other quantities of time may precede. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_secs_two_four "%N seconds" - -//d:Possible second line for fourth entry of Details View listbox -//d:%N number of seconds of an interval -//d:It is used for period of minutes ending from 5 to 0 plus range between 11 -//d:and 14 (5-20, 25-30, 35-40, 45-50, 53-59) -//d:It reports that the time constraint for this type of object is %N seconds. -//d:Other quantities of time may precede. -//l:list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_nbr_of_secs_five_zero "%N seconds" - -//d: This is displayed in view info popup -//d: Date and time label. Beginning time. In parentheses there will be either play, -// display, execute or print word -//l: list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_rvf_x "Valid from (%U)" - -//d: This is displayed in view info popup -//d: Date and time label. Ending time. In parentheses there will be either play, -// display, execute or print word -//l: list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_rvt_x "Valid until (%U)" - -//d: This is displayed in view info popup -//d: Sending label. -//l: list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_cs "Content sending" - -//d: This is displayed in view info popup -//d: Sending data. Item sending is allowed -//l: list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_allowed "Allowed" - -//d: This is displayed in view info popup -//d: Sending data. Item sending is forbidden -//l: list_double_pane_t2_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_forbid "Forbidden" - -//d:First line of first entry of Details View listbox -//d:It indicates the current status of the selected Right Object -//d:Second line is qtn_drm_mgr_det_valid or qtn_drm_mgr_det_exp -//l:list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_stat "Status" - -//d:Possible first line for fourth entry of Details View listbox -//d:Second line is qtn_drm_mgr_det_inter or qtn_drm_mgr_det_inter_two, meaning -//d:a quantity of time that specifies how long this object can be used. -//l:list_double_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_det_accum_time_left "Usage time left" - -//d:Title pane text in main view -//l:title_pane_t2/opt9 -//w: -//r:3.0 -// -#define qtn_drm_mgr_title_pane "Activation Keys" - -//d:Menu item used in Group view to see the details of a Media Object. -//l:list_single_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_drm_mgr_group_mo_view_det "View details" - -/////////////////////////////////////////////////////////////// -// End of DRM view info logical names -/////////////////////////////////////////////////////////////// - -//d:Warning note -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_fm_warning_file_extension "If file extension is changed file may become unusable" - -//d:Phone memory name in main page, item data -//l:list_single_large_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_main_phone "Phone memory" - -//d:Default memory card name in main page, item data -//l:list_single_large_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_main_card_default "Memory card" - -//d:Caption string. -//l:list_single_large_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_title_phone_mem "Phone memory" - -//d:Caption string. -//l:list_single_large_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_title_mem_card "Memory card" - -//d:Options menu command. -//l:list_single_pane_t1_cp2 -//w: -//r:3.1 -// -#define qtn_fmgr_options_eject "Eject" - -//d:Options menu command. -//l:list_single_pane_t1_cp2/opt3 -//w: -//r:3.1 -// -#define qtn_fmgr_options_organise "Organise" - -//d:Options menu command. -//l:list_single_pane_t1_cp2/opt3 -//w: -//r:3.1 -// -#define qtn_fmgr_options_details "Details" - -//d:Options menu command. -//l:list_single_pane_t1_cp2/opt3 -//w: -//r:3.1 -// -#define qtn_fmgr_options_card "Memory card" - -//d:Options menu command. -//l:list_single_pane_t1_cp2/opt3 -//w: -//r:3.1 -// -#define qtn_fmgr_options_card_password "Memory card password" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_options_set_password "Set" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_options_change_passwd "Change" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_options_remove_passwd "Remove" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_options_card_name "Name" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_options_card_rename "Rename" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_options_card_format "Format" - -//d:Caption string for memory card details popup -//l:heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_memcard_info_heading "Memory card details" - -//d:This is displayed in memory card details info popup -//l:list_single_heading_pane_t2_cp2 -//w: -//r:3.1 -// -#define qtn_fmgr_card_info_name "Name" - -//d:This is displayed in memory card details info popup -//l:list_single_heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_card_info_default_name "Memory card" - -//d:This is displayed in memory card details info popup -//l:list_single_heading_pane_t2_cp2 -//w: -//r:3.1 -// -#define qtn_fmgr_card_info_size "Capacity" - -//d:This is displayed in memory card details info popup -//l:list_single_heading_pane_t2_cp2 -//w: -//r:3.1 -// -#define qtn_fmgr_card_info_used "Used" - -//d:This is displayed in memory card details info popup -//l:list_single_heading_pane_t2_cp2 -//w: -//r:3.1 -// -#define qtn_fmgr_card_info_free "Free" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_options_card_details "Memory card" - - -// OPTIONS MENU TEXTS - -//d:Options menu command. -//d:Start backup. -//l:list_single_pane_t1_cp2 -//w: -//r:3.1 -// -#define qtn_memc_options_backup "Backup to memory card" - -//d:Options menu command. -//d:Start restore. -//l:list_single_pane_t1_cp2 -//w: -//r:3.1 -// -#define qtn_memc_options_restore "Restore from memory card" - -//d:Options menu command. -//d:Start format. -//l:list_single_pane_t1_cp2 -//w: -//r:3.1 -// -#define qtn_memc_options_format "Format memory card" - -//d:Options menu command. -//d:Unlock card. -//l:list_single_pane_t1_cp2 -//w: -//r:3.1 -// -#define qtn_memc_options_unlock "Unlock memory card" - - -// BACKUP TEXTS - -//d:Backup confirmation. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_backup_query1 "Do you want to make a backup to memory card?" - -//d:Backup confirmation, earlier backup exists. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_backup_query2 "Do you want to make a backup to memory card? Previous backup will be overwritten." - -//d:Confirmation for continuing, when there's little space. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_backup_query3 "There might not be enough space on memory card, do you want to continue?" - -//d:Not enough space error. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_backup_enoughspace "There isn’t enough space on the memory card! (Backup can’t be done)" - -//d:Progress note text. -//l:popup_note_wait_window -//w: -//r:3.1 -// -#define qtn_memc_backup_inprogress "Backup is in progress!" - -//d:Completion note. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_backup_completed "Backup is completed!" - -//d:Notify about files not backed up. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_backup_info1 "%N files could not be backed up!" - -//d:Notify about a file not backed up. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_backup_info2 "1 file could not be backed up!" - - - -// RESTORE TEXTS - -//d:Restore confirmation. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_restore_query1 "Do you want to restore backup files to phone memory?" - -//d:Not enough space error. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_restore_enoughspace "There isn’t enough space to restore the entire memory card! (Restore can’t be done)" - -//d:Progress note text. -//l:popup_note_wait_window -//w: -//r:3.1 -// -#define qtn_memc_restore_inprogress "Restore is in progress! Avoid using other applications during restore." - -//d:Completion note. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_restore_completed "Restore is completed!" - -//d:Notify about files not restored -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_restore_info1 "%N files could not be restored!" - -//d:Notify about a file not restored -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_restore_info2 "1 file could not be restored!" - - -// FORMAT TEXTS - -//d:Format confirmation. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_format_query1 "Do you want to format the memory card? (Data will be erased)" - -//d:Progress note text. -//l:popup_note_wait_window -//w: -//r:3.1 -// -#define qtn_memc_format_inprogress "Format is in progress!" - -//d:Completion note. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_format_completed "Format is completed!" - - -// MMC NAME TEXTS - -//d:Default memory card label to be written to MMC. -//d:Limited by FAT to maximum of 11 ascii characters. -//d:Limited by FAT to maximum of 5 characters in Chinese variant. -//l:query_popup_data_pane_t1/opt4 -//w: -//r:3.1 -// -#define qtn_memc_mmc_default_label "Mcard" - -//d:Card name query. -//l:popup_query_data_window_t3/opt2 -//w: -//r:3.1 -// -#define qtn_memc_name_prompt "Card name:" - -//d:Illegal characters note. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_name_note1 "Illegal characters! Use only letters and numbers." - -//d:Name changed note. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_name_note2 "The card name has been changed!" - - -// SET PASSWORD TEXTS - -//d:Password query. -//l:popup_query_data_window_t3/opt2 -//w: -//r:3.1 -// -#define qtn_memc_set_password_prompt1 "New password:" - -//d:Password confirmation query. -//l:popup_query_data_window_t3/opt2 -//w: -//r:3.1 -// -#define qtn_memc_set_password_prompt2 "Confirm new password:" - -//d:The passwords don't match. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_set_password_error "The passwords don’t match, try again!" - -//d:Password set note. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_set_password_info "The password has been set!" - - -// CHANGE PASSWORD TEXTS - -//d:Old password query. -//l:popup_query_data_window_t3/opt2 -//w: -//r:3.1 -// -#define qtn_memc_change_pwd_prompt1 "Old password:" - -//d:Wrong password note, changing password. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_change_pwd_error1 "The password is incorrect, try again!" - -//d:Password changed note. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_change_pwd_info "The password has been changed!" - -//d:Wrong password note, unlocking. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_unlock_pwd_error "The password is incorrect, try again!" - - -// REMOVE PASSWORD TEXTS - -//d:Remove password query. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_remove_pwd_query "Do you want to remove the password? Memory card becomes unlocked." - -//d:Password removed note. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_remove_pwd_info "The password has been removed!" - - -// PASSWORD QUERY TEXTS - -//d:Password query. -//l:popup_query_data_window_t3/opt2 -//w: -//r:3.1 -// -#define qtn_memc_remove_pwd_prompt "Password:" - -//d:Unlock password query. -//l:popup_query_data_window_t3/opt2 -//w: -//r:3.1 -// -#define qtn_memc_unlock_pwd_prompt "Password:" - - -// ERROR CASE TEXTS - -//d:Corrupt note. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_memorycard_error "Memory card is corrupted!" - -//d:General error. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_gen_error "Error occurred, operation cancelled!" - -//d:Format error. Memory card in use. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_memc_format_card_used "Formatting failed. Memory card used by other application." - -//d:Options menu command. -//l:list_single_pane_t1_cp2 -//w: -//r:3.1 -// -#define qtn_rd_opt_connect "Connect" - -//d:Options menu command. -//l:list_single_pane_t1_cp2 -//w: -//r:3.1 -// -#define qtn_rd_opt_disconnect "Disconnect" - -//d:Options menu command. -//l:list_single_pane_t1_cp2 -//w: -//r:3.1 -// -#define qtn_fmgr_opt_remote_drives "Remote drives" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_opt_rd_settings "Settings" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_opt_rd_new_drive "Map new drive" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_opt_rd_delete_drive "Delete drive" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_options_file_details "File" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_options_folder_details "Folder" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_options_memory_details "Memory" - -// REMOTE DRIVE ERRORS - -//d:Text in confirmation query when deleting a drive -//l:popup_note_window -//w: -//r:3.1 -#define qtn_rd_query_delete_drive "Delete configuration for %U?" - -//d:Error text when remote drive is not connected. -//l:main_list_empty_pane -//w: -//r:3.1 -// -#define qtn_fmgr_empty_remote_drive "(Not connected)" - -//d:This is displayed in memory card details info popup -//l:list_single_heading_pane_t2_cp2 -//w: -//r:3.1 -// -#define qtn_fmgr_card_info_data "%N %U" - -//d:Options menu command. -//l:list_single_pane_t1_cp2 -//w: -//r:3.1 -// -#define qtn_fmgr_rd_opt_refresh "Refresh" - -//d:Information note text -//d:if focused file is not supported remotely, this text is shown -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_fmgr_infonote_unable_open_remotely "Unable to open the file remotely. Copy file to phone and try opening it again." - -//d:Backup name in main page, item data -//l:list_single_large_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_main_backup "Backup" - -//d:Backup caption string. -//l:title_pane_t2/opt9 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_title "Backup" - -//d:Backup setting item title -//l:list_setting_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_contents "Backup contents" - -//d:Backup setting item title -//l:list_setting_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_scheduling "Backup scheduling" - -//d:Backup setting item title -//l:list_setting_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_weekday "Weekday" - -//d:Backup setting item title -//l:list_setting_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_time "Time" - -//d:Options menu command. -//l:list_single_pane_t1_cp2 -//w: -//r:3.1 -// -#define qtn_fmgr_options_backup_now "Backup now" - -//d:Options menu command. -//l:list_single_pane_t1_cp2 -//w: -//r:3.1 -// -#define qtn_fmgr_options_restore "Restore" - -//d:Backup setting item value -//l:list_set_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_content_all "All" - -//d:Backup setting item value -//l:list_set_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_content_selected "%N selected" - -//d:Backup setting item value -//l:list_set_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_content_settings "Settings" - -//d:Backup setting item value -//l:list_set_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_content_messages "Messages" - -//d:Backup setting item value -//l:list_set_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_content_contacts "Contacts" - -//d:Backup setting item value -//l:list_set_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_content_calendar "Calendar" - -//d:Backup setting item value -//l:list_set_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_content_bookmarks "Bookmarks" - -//d:Backup setting item value -//l:list_set_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_content_userfiles "User files" - -//d:Backup setting item value -//l:list_set_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_no_scheduling "No scheduling" - -//d:Backup setting item value -//l:list_set_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_daily "Daily" - -//d:Backup setting item value -//l:list_set_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_weekly "Weekly" - -//d:Backup confirmation. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_fmgr_backup_query "Create backup to %U?" - -//d:Backup confirmation. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_fmgr_backup_query_exists "Create backup to %U? Existing data will be overwritten." - -//d:Scheduled backup inprogress note. -//l:popup_note_wait_window -//w: -//r:3.1 -// -#define qtn_fmgr_scheduled_backup_progress "Scheduled backup. Do not remove %U" - -//d:Backup confirmation. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_fmgr_backup_tight_memory "%U may not contain enough space. Continue anyway?" - -//d:No space for backup note -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_fmgr_backup_destination_full "Not enough space in %U. Backup cancelled." - -//d:Scheduled backup error note -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_fmgr_scheduled_backup_error "Backup was scheduled but destination memory store was unavailable." - -//d:Restore caption string. -//l:title_pane_t2/opt9 -//w: -//r:3.1 -// -#define qtn_fmgr_restore_title "Restore" - -//d:Restore item name. -//l:list_double_large_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_restore_settings "Settings" - -//d:Restore item name. -//l:list_double_large_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_restore_messages "Messages" - -//d:Restore item name. -//l:list_double_large_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_restore_contacts "Contacts" - -//d:Restore item name. -//l:list_double_large_graphic_pane_t1 -// -#define qtn_fmgr_restore_calendar "Calendar" - -//d:Restore item name. -//l:list_double_large_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_restore_bookmarks "Bookmarks" - -//d:Restore item name. -//l:list_double_large_graphic_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_restore_userfiles "User files" - -//d:Restore item name. -//l:main_list_empty_pane -//w: -//r:3.1 -// -#define qtn_fmgr_restore_no_backups "No backup items available" - -//d:Restore confirmation -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_fmgr_restore_query "Restore selected backed up content to phone memory?" - -//d:Restore error -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_fmgr_restore_space_error "Not enough space for restore" - -//d:Scheduled backup query. -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_fmgr_scheduled_backup_query "Scheduled backup is starting. Continue?" - -//d:Backup setting item title -//l:list_setting_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_backup_destination "Backup destination" - -//d:Prompt text in common file dialog -//d:shown when user is prompted to select memory to be backup target -//l:heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_fmgr_select_backup_destination "Select destination:" - -//d:Progress note text. -//l:popup_note_wait_window -//w: -//r:3.1 -// -#define qtn_fmgr_progress_preparing_backup "Preparing for backup." - -//d:Progress note text. -//l:popup_note_wait_window -//w: -//r:3.2 -// -#define qtn_fmgr_progress_preparing_restore "Preparing for restoring." - -//d:General error. -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_fmgr_error_corrupted_backup_file "Backup file is corrupted. Operation cancelled." - -//d:Error note for unavailable backup destination -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_fmgr_error_backup_memorycard_not_available "Backup destination is not available." - -//d:Application launch prevented during backup info text -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_fmgr_backup_applaunch_prevented "Cannot start application during backup" - -//d:Application launch prevented during restore info text -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_fmgr_restore_applaunch_prevented "Cannot start application during restore" - -//d:Format query when memory card in use. -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_memc_format_query2 "Memory card in use by other application. Proceed anyway?" - -//d:error note; not able to add a new drive -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_rd_error_max_drives "Maximum number of remote drives configured. Remove old configurations to create new." - -//d:Device memory name in main page, item data -//d:%U is the drive letter -//l:list_single_large_graphic_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_main_device_memory "%U Device memory" - -//d:Mass storage name in main page, item data -//d:%U is the drive letter -//l:list_single_large_graphic_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_main_mass_storage "%U Mass storage" - -//d:Memory card in main page, item data -//d:%U is the drive letter -//l:list_single_large_graphic_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_main_memory_card_default "%U Memory card" - -//d:Named memory card in main page, item data -//d:%0U is the drive letter and %1U is the name of the memory card -//l:list_single_large_graphic_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_main_named_memory_card "%0U %1U" - -//d:Caption string. -//d:%U is the drive letter -//l:list_single_large_graphic_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_title_device_memory "%U Device memory" - -//d:Caption string. -//d:%U is the drive letter -//l:list_single_large_graphic_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_title_mass_storage "%U Mass storage" - -//d:Caption string. -//d:%0U is the drive letter and %1U is the name of the memory card -//l:list_single_large_graphic_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_title_named_memory_card "%0U %1U" - -//d:Caption string. -//d:%U is the drive letter -//l:list_single_large_graphic_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_title_memory_card_default "%U Memory card" - -//d:Error text when mass storage is in use -//l:main_list_empty_pane -//w: -//r:3.2 -// -#define qtn_memc_mass_storage_in_use "(Memory is in use)" - -//d:Error text when mass storage is corrupted -//l:main_list_empty_pane -//w: -//r:3.2 -// -#define qtn_memc_mass_storage_corrupted "(Memory is corrupted)" - -//d:Named memory card eject confirmation query. -//d:%0U is the drive letter and %1U is the name of the memory card -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_memc_conf_eject_multiple "Eject %0U %1U? Some applications will be closed." - -//d:Memory card eject confirmation query. -//d:%U is the drive letter -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_memc_conf_eject_multiple_defaultname "Eject %U memory card? Some applications will be closed." - -//d:Swap named memory card note. -//d:%0U is the drive letter and %1U is the name of the memory card -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_memc_info_eject_multiple "Remove %0U %1U and press OK." - -//d:Swap memory card note. -//d:%U is the drive letter -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_memc_info_eject_multiple_defaultname "Remove %U memory card and press OK." - -//d:Password query for named memory card. -//d:%0U is the drive letter and %1U is the name of the memory card -//l:popup_query_data_window_t3/opt2 -//w: -//r:3.2 -// -#define qtn_memc_unlock_password_multiple "Password for %0U %1U:" - -//d:Password query for memory card. -//d:%U is the drive letter -//l:popup_query_data_window_t3/opt2 -//w: -//r:3.2 -// -#define qtn_memc_unlock_password_multiple_defaultname "Password for %U memory card:" - -//d:Information note text -//d:%U is the drive letter -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_memc_multiple_memc_read_only "Unable to perform operation. %U memory card is read only." - -//d:Information note text -//d:%U is the drive letter -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_memc_memory_card_corrupted_multiple "%U memory card is corrupted." - -//d:Options menu command. -//d:Start mass storage format. -//l:list_single_pane_t1_cp2 -//w: -//r:3.2 -// -#define qtn_fmgr_options_format_mass "Format mass storage" - -//d:Mass storage format query -//d:%U is the drive letter -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_fmgr_format_mass_query1 "Format %U mass storage. Data will be deleted during formatting." - -//d:Progress note text -//l:popup_note_wait_window -//w: -//r:3.2 -// -#define qtn_fmgr_mass_format_inprogress "Formatting mass storage" - -//d:Completion note. -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_fmgr_mass_format_completed "Formatting complete" - -//d:Format query when mass storage is in use -//l:popup_note_window -//w: -//r:3.2 -// -#define qtn_fmgr_format_mass_query2 "Mass storage in use by other application. Proceed anyway?" - -//d:Possible second line for first entry of Details View listbox -//l:list_double_pane_t2_cp2 -//w: -//r:5.0 -// -#define qtn_drm_mgr_det_not_valid_yet "Activation key not valid yet" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1/opt1 -//w: -//r:5.0 -// -#define qtn_fmgr_options_sort_by_match "By match" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1/opt1 -//w: -//r:5.0 -// -#define qtn_fmgr_options_sort_by_name "By name" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1/opt1 -//w: -//r:5.0 -// -#define qtn_fmgr_options_sort_by_type "By type" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1/opt1 -//w: -//r:5.0 -// -#define qtn_fmgr_options_sort_recent_first "Most recent first" - -//d:Options menu command. -//l:list_single_popup_submenu_pane_t1/opt1 -//w: -//r:5.0 -// -#define qtn_fmgr_options_sort_largest_first "Largest first" - -//d:Scheduled backup info note -//l:popup_note_window -//w: -//r:5.0 -// -#define qtn_fmgr_scheduled_backup_cancelled_ps "Power saving is active, scheduled backup is cancelled." - -//d:Options menu command. -//l:list_single_pane_t1_cp2/opt3 -//w: -//r:5.0 -// -#define qtn_fmgr_options_sort_submenu "Sort" - -//d:Free memory amount in main page, item data -//d:%0U is the size and %1U is the unit, for example 15.5 MB -//l:list_double_large_graphic_pane_t2 -//w: -//r:3.2 -// -#define qtn_fmgr_free_memory_var_units "Free: %0U %1U" - -//d:Free memory unit in main page, item data -//l:list_double_large_graphic_pane_t2 -//w: -//r:3.2 -// -#define qtn_fmgr_units_byte "B" - -//d:Free memory unit in main page, item data -//l:list_double_large_graphic_pane_t2 -//w: -//r:3.2 -// -#define qtn_fmgr_units_kilobyte "kB" - -//d:Free memory unit in main page, item data -//l:list_double_large_graphic_pane_t2 -//w: -//r:3.2 -// -#define qtn_fmgr_units_megabyte "MB" - -//d:Free memory unit in main page, item data -//l:list_double_large_graphic_pane_t2 -//w: -//r:3.2 -// -#define qtn_fmgr_units_gigabyte "GB" - -//d: Note when there is not enough memory to execute operation on device memory. -//d: %U is the drive letter of the drive. -//l: popup_note_window -//w: -//r:3.2 -// -#define qtn_memlo_not_enough_device_memory "Not enough memory to perform operation. Delete some data from %U Device memory." - -//d: Note when there is not enough memory to execute operation on memory card. -//d:%0U is the drive letter and %1U is the name of the memory card -//l: popup_note_window -//w: -//r:3.2 -// -#define qtn_memlo_not_enough_memory_card_name "Not enough memory to perform operation. Delete some data from %0U %1U." - -//d: Note when there is not enough memory to execute operation on memory card. -//d: %U is the drive letter of the drive. -//l: popup_note_window -//w: -//r:3.2 -// -#define qtn_memlo_not_enough_memory_card_defaultname "Not enough memory to perform operation. Delete some data from %U Memory card." - -//d: Note when there is not enough memory to execute operation on mass storage. -//d: %U is the drive letter of the drive. -//l: popup_note_window -//w: -//r:3.2 -// -#define qtn_memlo_not_enough_mass_memory "Not enough memory to perform operation. Delete some data from %U Mass storage." - -//d: Primary text for an unnamed USB memory storage. -//d: %U is the drive letter of the drive. -//l: list_double_large_graphic_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_main_usb_default "%U USB memory" - -//d: When the view is on the root of an unnamed USB memory. -//d: %U is the drive letter of the drive. -//l: list_single_large_graphic_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_title_usb_default "%U USB memory" - -//d: Main view Options menu item. -//l: list_single_pane_t1_cp2/opt3 -//w: -//r:3.2 -// -#define qtn_fmgr_options_memory_sub "Memory storage" - -//d: Memory storage submenu items -//l: list_single_popup_submenu_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_unlock_memory "Unlock memory" - -//d: Memory storage submenu items -//l: list_single_popup_submenu_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_options_memory_storage_details "Details" - -//d: Memory storage submenu items -//l: list_single_popup_submenu_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_options_set_memc_passwd "Set password" - -//d: Memory storage submenu items -//l: list_single_popup_submenu_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_options_change_memc_passwd "Change password" - -//d: Memory storage submenu items -//l: list_single_popup_submenu_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_options_remove_memc_passwd "Remove password" - -//d: Default name of the query when naming or renaming a memory store -//l: query_popup_data_pane_t1/opt4 -//w: -//r:3.2 -// -#define qtn_fmgr_usb_memory_default_name "USB memory" - -//d: confirmation query text when want to format USB memory -//d: %0U is the drive letter, %1U is the drive name. -//l: popup_note_window -//w: -//r:3.2 -// -#define qtn_fmgr_usb_memory_format_query "Format USB memory %0U %1U? All data will be deleted." - -//d: progress text when formatting memory storage -//l: popup_note_wait_window -//w: -//r:3.2 -// -#define qtn_fmgr_formatting_memory_progress "Formatting memory storage" - -//d: Prompt text of the query when naming or renaming a memory store -//l: popup_query_data_window_t3/opt2 -//w: -//r:3.2 -// -#define qtn_fmgr_memory_name_prompt "Memory storage name" - -//d: After a successful operation of naming or renaming -//l: popup_note_window -//w: -//r:3.2 -// -#define qtn_fmgr_confirm_memory_name_changed "Memory storage name changed" - -//d: confirmation text if memory used when want to format the memory store -//l: popup_note_window -//w: -//r:3.2 -// -#define qtn_fmgr_memory_in_use_format "Memory storage is being used by another application. Proceed anyway?" - -//d: Backup view Options menu if backup exists -//l: list_single_pane_t1_cp2 -//w: -//r:3.2 -// -#define qtn_fmgr_options_delete_backup "Delete backup" - -//d: Delete backup view title pane -//l: title_pane_t2/opt9 -//w: -//r:3.2 -// -#define qtn_fmgr_delete_backup_title "Delete backup" - -//d: query text when want to delete backup content -//l: popup_note_window -//w: -//r:3.2 -// -#define qtn_fmgr_delete_backup_query "Delete selected backup content?" - -//d: backup content -//d: %U is the drive letter of the drive. -//l: list_set_graphic_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_backup_content_device_memory "Files from %U Device memory" - -//d: backup content -//d: %U is the drive letter of the drive. -//l: list_set_graphic_pane_t1 -//w: -//r:3.2 -// -#define qtn_fmgr_backup_content_mass_storage "Files from %U Mass storage" - -//d: restore content -//d: %U is the drive letter of the drive. -//l: list_double_graphic_pane_t1_cp2 -//w: -//r:3.2 -// -#define qtn_fmgr_restore_device_memory "Files from %U Device memory" - -//d: restore content -//d: %U is the drive letter of the drive. -//l: list_double_graphic_pane_t1_cp2 -//w: -//r:3.2 -// -#define qtn_fmgr_restore_mass_storage "Files from %U Mass storage" - -//d:Error text when memory is not available -//l:main_list_empty_pane -//w: -//r:3.2 -// -#define qtn_memc_not_available "(Memory is not available)" - -//d: note text when the system is not ready for user to do backup&restore operation -//l: popup_note_window -//w: -//r:5.2 -// -#define qtn_fmgr_system_not_ready "System is not ready. Please try again" - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/rom/FileManager.iby --- a/filemanager/rom/FileManager.iby Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Image description file for project File Manager -* -*/ - - -#ifndef __FILEMANAGER_IBY__ -#define __FILEMANAGER_IBY__ - -S60_APP_EXE(FileManager) -S60_APP_AIF_ICONS(FileManager) -S60_APP_AIF_RSC(FileManager) - -ECOM_PLUGIN(filemanagerbkupplugin.dll, 0x10205078.rsc) -ECOM_PLUGIN(filemanageraiwprovider.dll, 0x200110F8.rsc) - -file=ABI_DIR\BUILD_DIR\FILEMANAGERENGINE.DLL SHARED_LIB_DIR\FileManagerEngine.dll -file=ABI_DIR\BUILD_DIR\FILEMANAGERVIEW.DLL SHARED_LIB_DIR\FileManagerView.dll -SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,FileManager) -file=ABI_DIR\BUILD_DIR\GFLM.dll SHARED_LIB_DIR\GFLM.dll -data=DATAZ_\RESOURCE_FILES_DIR\GflmFileExtensionMimeTypes.rsc RESOURCE_FILES_DIR\GflmFileExtensionMimeTypes.rsc - -file=ABI_DIR\BUILD_DIR\filemanagerbkupengine.dll SHARED_LIB_DIR\filemanagerbkupengine.dll -#ifdef RD_FILE_MANAGER_BACKUP - file=ABI_DIR\BUILD_DIR\filemanagerschbkup.exe SHARED_LIB_DIR\filemanagerschbkup.exe -#endif // RD_FILE_MANAGER_BACKUP - -data=DATAZ_\private\101F84EB\backup_registration.xml private\101F84EB\backup_registration.xml - -#endif // __FILEMANAGER_IBY__ diff -r 95243422089a -r 491b3ed49290 filemanager/rom/FileManagerResources.iby --- a/filemanager/rom/FileManagerResources.iby Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2002-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: Image description file for File Manager resources -* -*/ - - -#ifndef __FILEMANAGERRESOURCES_IBY__ -#define __FILEMANAGERRESOURCES_IBY__ - -REM Filemanager Localized Data - -data=DATAZ_\RESOURCE_FILES_DIR\FILEMANAGERENGINE.rsc RESOURCE_FILES_DIR\FILEMANAGERENGINE.rsc -data=DATAZ_\RESOURCE_FILES_DIR\FILEMANAGERVIEW.rsc RESOURCE_FILES_DIR\FILEMANAGERVIEW.rsc -data=DATAZ_\APP_RESOURCE_DIR\FILEMANAGER.rsc APP_RESOURCE_DIR\FileManager.rsc -data=DATAZ_\RESOURCE_FILES_DIR\filemanagerbkupchecker.rsc RESOURCE_FILES_DIR\filemanagerbkupchecker.rsc - -#endif // __FILEMANAGERRESOURCES_IBY__ diff -r 95243422089a -r 491b3ed49290 filemanager/rom/filemngr.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/rom/filemngr.iby Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,38 @@ +/* +* 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 __FILEMNGR_IBY__ +#define __FILEMNGR_IBY__ + +#include + +#define HB_UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc + +file=ABI_DIR\BUILD_DIR\filemngr.exe SHARED_LIB_DIR\filemngr.exe +data = ZRESOURCE\apps\filemngr.mif APP_RESOURCE_DIR\filemngr.mif +HB_UPGRADABLE_APP_REG_RSC(filemngr) + + +file=ABI_DIR\BUILD_DIR\fmbkupengine.dll SHARED_LIB_DIR\fmbkupengine.dll +file=ABI_DIR\BUILD_DIR\fmfiledialog.dll SHARED_LIB_DIR\fmfiledialog.dll +file=ABI_DIR\BUILD_DIR\fmbkupenginewrapper.dll SHARED_LIB_DIR\fmbkupenginewrapper.dll + +data=DATAZ_\private\2002BCC0\backup_registration.xml private\2002BCC0\backup_registration.xml +data=DATAZ_\private\2002BCC0\burconfig.xml private\2002BCC0\burconfig.xml + +#endif + diff -r 95243422089a -r 491b3ed49290 filemanager/rom/filemngr_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/rom/filemngr_resources.iby Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef __FILEMNGR_RESOURCES_IBY__ +#define __FILEMNGR_RESOURCES_IBY__ + +#include + +data=DATAZ_\QT_TRANSLATIONS_DIR\filemanager.qm QT_TRANSLATIONS_DIR\filemanager.qm +data=DATAZ_\APP_RESOURCE_DIR\filemngr.rsc APP_RESOURCE_DIR\filemngr.rsc + +#endif \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/rom/rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/rom/rom.pri Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,24 @@ +# 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: +# Zhiqiang Yang +# +# Description: +# Rom exports for filemngr +# + +symbian { + FILEMNGR_IBY_DIR = $$section(PWD, ":", 1) + + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include" + BLD_INF_RULES.prj_exports += "$$FILEMNGR_IBY_DIR/filemngr.iby CORE_APP_LAYER_IBY_EXPORT_PATH(filemngr.iby)" + BLD_INF_RULES.prj_exports += "$$FILEMNGR_IBY_DIR/filemngr_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(filemngr_resources.iby)" +} diff -r 95243422089a -r 491b3ed49290 filemanager/schbkup/inc/filemanagerschbackuptask.h --- a/filemanager/schbkup/inc/filemanagerschbackuptask.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +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: Handles file manager scheduled backup task start -* -*/ - - -#ifndef C_FILEMANAGERSCHBACKUPTASK_H -#define C_FILEMANAGERSCHBACKUPTASK_H - - -// INCLUDE FILES -#include -#include "filemanagerschobserver.h" -#include "fmsystemstatemonitor.h" - -// FORWARD DECLARATIONS -class CScheduledTask; -class CFileManagerSchSubscriber; -class CRepository; - - -// CLASS DECLARATION -/** - * This class handles scheduled backup task start functionality - * - * @since S60 3.1 - */ -class CFileManagerSchBackupTask : public CActive, - public MFileManagerSchObserver, - public MFmSystemStateMonitorObserver - { - -public: - /** - * Two-phased constructor. - */ - static CFileManagerSchBackupTask* NewL( const CScheduledTask& aTask ); - - /** - * Destructor - */ - ~CFileManagerSchBackupTask(); - -private: // From CActive - void RunL(); - - void DoCancel(); - - TInt RunError( TInt aError ); - -private: // From FileManagerSchObserver - void NotifyKeyChangeOrTimeoutL( - const TUid& aCategory, - const TUint aKey, - const TBool aTimeout ); - -public: // From MFmSystemStateMonitorObserver - /** - * Called when the system state changed - * @since 5.2 - */ - void SystemStateChangedEvent(); - -private: // New methods - /** - * Constructors - */ - CFileManagerSchBackupTask(); - - void ConstructL( const CScheduledTask& aTask ); - - /** - * Starts backup task start procedure - */ - void StartL(); - - /** - * Exists backup task start procedure - */ - void Exit(); - - /** - * Retries backup task start procedure - */ - void Retry(); - - /** - * Starts file manager to run backup - */ - void StartFileManagerL(); - - /** - * Checks is backup required - */ - TBool CheckBackupRequired(); - - /** - * Checks phone state is it ok to start backup - */ - TBool CheckPhoneStateL(); - -private: // Data - /** - * Backup weekday, given from originator - */ - TInt iDay; - - /** - * Subscriber to observe phone and backup start states - * Own. - */ - CFileManagerSchSubscriber* iSubscriber; - - /** - * Pointer to file manager settings in CenRep - * Own. - */ - CRepository* iCenRep; - - /** - * Start attempts left - */ - TInt iAttemptsLeft; - - /** - * Own: Pointer to system state monitor - */ - CFmSystemStateMonitor* iSystemStateMonitor; - - }; - - -#endif // C_FILEMANAGERSCHBACKUPTASK_H - -// End of file diff -r 95243422089a -r 491b3ed49290 filemanager/schbkup/inc/filemanagerschobserver.h --- a/filemanager/schbkup/inc/filemanagerschobserver.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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: Observes subscribed notifications -* -*/ - - -#ifndef M_FILEMANAGERSCHOBSERVER_H -#define M_FILEMANAGERSCHOBSERVER_H - - -// INCLUDES -#include - - -// CLASS DECLARATION -/** - * This class observes subscribed notifications - * - * @since S60 3.1 - */ -class MFileManagerSchObserver - { - -public: - /** - * Handles notification - * - * @since S60 3.1 - * @param aCategory Subcribed category uid - * @param aKey Subcribed key id - * @param aTimeout Is triggered by timeout or actual event - */ - virtual void NotifyKeyChangeOrTimeoutL( - const TUid& aCategory, - const TUint aKey, - const TBool aTimeout ) = 0; - - }; - -#endif // M_FILEMANAGERSCHOBSERVER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/schbkup/inc/filemanagerschsubscriber.h --- a/filemanager/schbkup/inc/filemanagerschsubscriber.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +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: Handles P&S and CenRep notifications -* -*/ - - -#ifndef C_FILEMANAGERSCHSUBSCRIBER_H -#define C_FILEMANAGERSCHSUBSCRIBER_H - - -// INCLUDES -#include -#include - - -// FORWARD DECLARATIONS -class MFileManagerSchObserver; -class CRepository; - - -// CLASS DECLARATION -/** - * This class handles P&S and CenRep notifications - * - * @since S60 3.1 - */ -class CFileManagerSchSubscriber : public CActive - { - -public: - /** Type of subscribed notifications */ - enum TType - { - ESubscribePS = 0, - ESubscribeCR - }; - - /** - * Two-phased constructor. - */ - static CFileManagerSchSubscriber* NewL( - MFileManagerSchObserver& aObserver, - const TUid& aCategory, - const TUint aKey, - const TType aType, - const TInt aTimeoutSecs ); - - /** - * Destructor - */ - ~CFileManagerSchSubscriber(); - -private: // New methods - /** - * Constructors - */ - CFileManagerSchSubscriber( - MFileManagerSchObserver& aObserver, - const TUid& aCategory, - const TUint aKey, - const TType aType, - const TInt aTimeoutSecs ); - - void ConstructL(); - - /** - * Subscribes notification - */ - void SubscribeL(); - - /** - * Timeout callback - * @param aPtr Pointer to subcriber - * @return System wide error code - */ - static TInt TimeoutCB( void* aPtr ); - - /** - * Handles timeout - */ - void Timeout(); - -private: // From CActive - void RunL(); - - TInt RunError( TInt aError ); - - void DoCancel(); - -private: // Data - /** - * Reference to observer interface - * Not own. - */ - MFileManagerSchObserver& iObserver; - - /** - * Pointer to CenRep - * Own. - */ - CRepository* iCenRep; - - /** - * Handle to PS - */ - RProperty iProperty; - - /** - * Category Uid - */ - TUid iCategory; - - /** - * Key id - */ - TUint iKey; - - /** - * Subscriber type - */ - TType iType; - - /** - * Timeout seconds - */ - TInt iTimeoutSecs; - - /** - * Timer for timeout - * Own. - */ - CPeriodic* iTimer; - - /** - * Indicates timeout status - */ - TBool iTimeout; - - }; - -#endif // C_FILEMANAGERSCHSUBSCRIBER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/schbkup/inc/fmsystemstatemonitor.h --- a/filemanager/schbkup/inc/fmsystemstatemonitor.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: system State monitor -* -*/ - -#ifndef __FM_SYSTEMSTATE_MONITOR__ -#define __FM_SYSTEMSTATE_MONITOR__ - -#include -#include - -/** - * MFmSystemStateMonitorObserver - * - * Monitor component observer. - * - * @since S60 5.2 - */ -class MFmSystemStateMonitorObserver - { - public: - /** - * Called when the system State changed - */ - virtual void SystemStateChangedEvent() = 0; - }; - -/** - * CFmSystemStateMonitor - * - * Component for monitoring system state - * - * @since S60 5.2 - */ -class CFmSystemStateMonitor : public CActive - { - public: - /** - * Create new monitor - * - * @param aObserver monitor observer - * @since S60 5.2 - */ - static CFmSystemStateMonitor* NewL( - MFmSystemStateMonitorObserver& aObserver ); - - /** - * Destructor - * - * @since S60 5.2 - */ - ~CFmSystemStateMonitor(); - - /** - * Start monitor - * - * @param aStateToMonitor the state needs monitored - * @since S60 5.2 - */ - void StartMonitor( TUint aStateToMonitor ); - - /** - * Indicate system state is normal or not - * - * @since S60 5.2 - * @return ETrue if system state is normal, EFalse if not - */ - TBool IsSystemStateNormal(); - - private: - /** - * C++ constructor - * - * @param aObserver monitor observer. - * @since S60 5.2 - */ - CFmSystemStateMonitor( MFmSystemStateMonitorObserver& aObserver ); - - /** - * Symbian 2nd phase constructor - * - * @since S60 5.2 - */ - void ConstructL(); - - private: // From CActive - /** - * From CActive - */ - void RunL(); - - /** - * From CActive - * @since S60 5.2 - */ - void DoCancel(); - - /** - * From CActive - * @since S60 5.2 - */ - TInt RunError( TInt aError ); - - private: - // observer used to inform try schedule backup again when system state become normal - MFmSystemStateMonitorObserver& iObserver; - - // State aware session. - RSsmStateAwareSession iSAS; - - // State to monitor - TUint iStateToMonitor; - }; - -#endif // __FM_SYSTEMSTATE_MONITOR__ diff -r 95243422089a -r 491b3ed49290 filemanager/schbkup/src/filemanagerschbackupmain.cpp --- a/filemanager/schbkup/src/filemanagerschbackupmain.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +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: Launches file manager scheduled backup task -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include "FileManagerDebug.h" -#include "filemanagerschbackuptask.h" - - -// CONSTANTS -_LIT_SECURE_ID( KTaskSchedulerSID, 0x10005399 ); - - -// ======== LOCAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// StartSchTaskL -// --------------------------------------------------------------------------- -// -LOCAL_C void StartSchTaskL( RFile& aTaskFile ) - { - INFO_LOG( "StartSchTaskL()-Started" ) - - // Create and install the active scheduler we need - CActiveScheduler* scheduler = new ( ELeave ) CActiveScheduler(); - CleanupStack::PushL( scheduler ); - CActiveScheduler::Install( scheduler ); - - // Get scheduled task parameters - CFileStore* store = CDirectFileStore::FromLC( aTaskFile ); - RStoreReadStream instream; - instream.OpenLC( *store, store->Root() ); - - TInt count( instream.ReadInt32L() ); - if ( !count ) - { - User::Leave( KErrNotFound ); - } - - // Create the task to be started - CScheduledTask* task = CScheduledTask::NewLC( instream ); - CFileManagerSchBackupTask* fmTask = - CFileManagerSchBackupTask::NewL( *task ); - CleanupStack::PopAndDestroy( task ); - CleanupStack::PopAndDestroy( &instream ); - CleanupStack::PopAndDestroy( store ); - - // Start scheduler to handle the backup launch. - // This call exists after backup launch has finished. - CActiveScheduler::Start(); - - // Cleanup the task and scheduler - delete fmTask; - CleanupStack::PopAndDestroy( scheduler ); - - INFO_LOG( "StartSchTaskL()-Finished" ) - } - - -// ======== GLOBAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// E32Main -// --------------------------------------------------------------------------- -// -GLDEF_C TInt E32Main() - { - __UHEAP_MARK; - - INFO_LOG( "FileManagerSchBackup-E32Main()-Started" ) - - TInt err( KErrPermissionDenied ); - - // Check process creator and start scheduled task - if( User::CreatorSecureId() == KTaskSchedulerSID ) - { - CTrapCleanup* cleanupStack = CTrapCleanup::New(); - if ( cleanupStack ) - { - INFO_LOG( "FileManagerSchBkup-E32Main()-Adopt task file" ) - - RFile file; - err = file.AdoptFromCreator( - TScheduledTaskFile::FsHandleIndex(), - TScheduledTaskFile::FileHandleIndex() ); - if ( err == KErrNone ) - { - TRAP( err, StartSchTaskL( file ) ); - file.Close(); - } - delete cleanupStack; - } - else - { - err = KErrNoMemory; - } - } - - LOG_IF_ERROR1( err, "FileManagerSchBackup-E32Main()-Error=%d", err ) - - INFO_LOG( "FileManagerSchBackup-E32Main()-Finished" ) - - __UHEAP_MARKEND; - - return err; - } - -// End of file diff -r 95243422089a -r 491b3ed49290 filemanager/schbkup/src/filemanagerschbackuptask.cpp --- a/filemanager/schbkup/src/filemanagerschbackuptask.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,499 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Handles file manager scheduled backup task start -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "filemanagerschbackuptask.h" -#include "filemanagerschsubscriber.h" -#include "FileManagerUID.h" -#include "FileManagerDebug.h" -#include "FileManagerSchDefinitions.h" -#include "FileManagerPrivateCRKeys.h" - -using namespace conn; - -// CONSTANTS -const TUid KUidFileManager = { KFileManagerUID3 }; -_LIT_SECURE_ID( KFileManagerSID, KFileManagerUID3 ); -const TInt KStartStateChangeTimeoutSecs = 30; -const TInt KPhoneStateChangeTimeoutSecs = 120; -const TInt KNumAttempts = -1; // Try forever - - -// ======== LOCAL FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// FindStandaloneAppL -// --------------------------------------------------------------------------- -// -static TBool FindStandaloneAppL( - RWsSession& aWs, const TUid& aUid, TInt& aWgId ) - { - FUNC_LOG - - aWgId = 0; // Used window group id is always greater than zero - RArray< RWsSession::TWindowGroupChainInfo > windowChain; - User::LeaveIfError( aWs.WindowGroupList( &windowChain ) ); - CleanupClosePushL( windowChain ); - TInt count( windowChain.Count() ); - for( TInt i( 0 ); i < count; ++i ) - { - const RWsSession::TWindowGroupChainInfo& entry( windowChain[ i ] ); - CApaWindowGroupName* app = CApaWindowGroupName::NewLC( - aWs, entry.iId ); - TUid appUid( app->AppUid() ); - CleanupStack::PopAndDestroy( app ); - // Match the app's UID and the embedded status. - // The app is standalone when there is no parent window group. - if ( appUid == aUid && entry.iParentId <= 0 ) - { - // Standalone application found - aWgId = entry.iId; - break; - } - } - CleanupStack::PopAndDestroy( &windowChain ); - return aWgId > 0; - } - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CFileManagerSchBackupTask::CFileManagerSchBackupTask -// --------------------------------------------------------------------------- -// -CFileManagerSchBackupTask::CFileManagerSchBackupTask() : - CActive( EPriorityStandard ), - iDay( KErrNotFound ), - iAttemptsLeft( KNumAttempts ) - { - FUNC_LOG - } - -// --------------------------------------------------------------------------- -// CFileManagerSchBackupTask::NewL -// --------------------------------------------------------------------------- -// -CFileManagerSchBackupTask* CFileManagerSchBackupTask::NewL( - const CScheduledTask& aTask ) - { - FUNC_LOG - - CFileManagerSchBackupTask* self = - new ( ELeave ) CFileManagerSchBackupTask(); - CleanupStack::PushL( self ); - self->ConstructL( aTask ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CFileManagerSchBackupTask::~CFileManagerSchBackupTask -// --------------------------------------------------------------------------- -// -CFileManagerSchBackupTask::~CFileManagerSchBackupTask() - { - FUNC_LOG - - delete iSubscriber; - delete iCenRep; - delete iSystemStateMonitor; - Cancel(); - } - -// --------------------------------------------------------------------------- -// CFileManagerSchBackupTask::RunL -// --------------------------------------------------------------------------- -// -void CFileManagerSchBackupTask::RunL() - { - StartL(); - } - -// --------------------------------------------------------------------------- -// CFileManagerSchBackupTask::DoCancel -// --------------------------------------------------------------------------- -// -void CFileManagerSchBackupTask::DoCancel() - { - delete iSubscriber; - iSubscriber = NULL; - } - -// --------------------------------------------------------------------------- -// CFileManagerSchBackupTask::RunError() -// --------------------------------------------------------------------------- -// -TInt CFileManagerSchBackupTask::RunError( -#ifdef FILE_MANAGER_ERROR_LOG_ENABLED - TInt aError -#else // FILE_MANAGER_ERROR_LOG_ENABLED - TInt /*aError*/ -#endif // FILE_MANAGER_ERROR_LOG_ENABLED - ) - { - ERROR_LOG1( "CFileManagerSchBackupTask::RunError()-Error=%d", aError ) - - // Try again - Retry(); - - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CFileManagerSchBackupTask::ConstructL -// --------------------------------------------------------------------------- -// -void CFileManagerSchBackupTask::ConstructL( const CScheduledTask& aTask ) - { - FUNC_LOG - - INFO_LOG1( "CFileManagerTaskScheduler::ConstructL()-Repeat=%d", - aTask.Info().iRepeat ) - - CActiveScheduler::Add( this ); - - // Check task creator - if( aTask.SecurityInfo().iSecureId.iId != KFileManagerSID ) - { - User::Leave( KErrPermissionDenied ); - } - - // Get pointer to file manager settings - iCenRep = CRepository::NewL( KCRUidFileManagerSettings ); - - // Get backup weekday if given from originator - const HBufC& data( aTask.Data() ); - if ( data.Length() ) - { - TLex parse; - parse.Assign( data ); - User::LeaveIfError( parse.Val( iDay ) ); - } - - // Get pointer to system state monitor - iSystemStateMonitor = CFmSystemStateMonitor::NewL( *this ); - - Retry(); - } - -// --------------------------------------------------------------------------- -// CFileManagerSchBackupTask::CheckBackupRequired -// --------------------------------------------------------------------------- -// -TBool CFileManagerSchBackupTask::CheckBackupRequired() - { - TBool ret( ETrue ); - - // Check schedule type - TInt scheduling( 0 ); - iCenRep->Get( KFileManagerBackupScheduling, scheduling ); - if ( scheduling == EFileManagerBackupScheduleNone ) - { - // Backup is not required - ret = EFalse; - } - - // Check weekday - if ( ret && iDay != KErrNotFound ) - { - TTime time; - time.HomeTime(); - if ( time.DayNoInWeek() != iDay ) - { - // Backup is not required today - ret = EFalse; - } - } - - if ( !ret ) - { - INFO_LOG( "CFileManagerSchBackupTask::CheckBackupRequired()-No" ) - Exit(); - } - - return ret; - } - -// --------------------------------------------------------------------------- -// CFileManagerSchBackupTask::CheckPhoneStateL -// --------------------------------------------------------------------------- -// -TBool CFileManagerSchBackupTask::CheckPhoneStateL() - { - - // Check phone is normal state or not - if ( !iSystemStateMonitor->IsSystemStateNormal() ) - { - INFO_LOG( "CFileManagerSchBackupTask::CheckPhoneStateL()-System State is not normal" ) - iSystemStateMonitor->StartMonitor( ESsmNormal ); - return EFalse; - } - - // Check call state - TInt callState( 0 ); - RProperty::Get( - KPSUidCtsyCallInformation, KCTsyCallState, callState ); - if ( callState != EPSCTsyCallStateNone ) - { - INFO_LOG1( "CFileManagerSchBackupTask::CheckPhoneStateL()-callState=%d", - callState ) - - // Set subscriber to wait call to finish - iSubscriber = CFileManagerSchSubscriber::NewL( - *this, - KPSUidCtsyCallInformation, - KCTsyCallState, - CFileManagerSchSubscriber::ESubscribePS, - KPhoneStateChangeTimeoutSecs ); - return EFalse; - } - - // Check usb transfer state - TInt usbState( 0 ); - RProperty::Get( - KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, usbState ); - if ( usbState == KUsbPersonalityIdMS ) - { - INFO_LOG( "CFileManagerSchBackupTask::CheckPhoneStateL()-Usb transfer on" ) - - // Set subscriber to wait usb transfer to finish - iSubscriber = CFileManagerSchSubscriber::NewL( - *this, - KPSUidUsbWatcher, - KUsbWatcherSelectedPersonality, - CFileManagerSchSubscriber::ESubscribePS, - KPhoneStateChangeTimeoutSecs ); - return EFalse; - } - - // Check synchronization state - TInt syncState( 0 ); - RProperty::Get( - KPSUidDataSynchronizationInternalKeys, KDataSyncStatus, syncState ); - if ( syncState > 0 ) - { - INFO_LOG( "CFileManagerSchBackupTask::CheckPhoneStateL()-Synchronization on" ) - - // Set subscriber to wait usb transfer to finish - iSubscriber = CFileManagerSchSubscriber::NewL( - *this, - KPSUidDataSynchronizationInternalKeys, - KDataSyncStatus, - CFileManagerSchSubscriber::ESubscribePS, - KPhoneStateChangeTimeoutSecs ); - return EFalse; - } - - // Check backup/restore (e.g. PC Suite initiated) state - TInt burState( 0 ); - RProperty::Get( - KUidSystemCategory, KUidBackupRestoreKey, burState ); - - const TBURPartType partType = static_cast< TBURPartType > - ( burState & KBURPartTypeMask ); - - if ( partType != EBURUnset && partType != EBURNormal ) - { - INFO_LOG( "CFileManagerSchBackupTask::CheckPhoneStateL()-Backup/restore on" ) - - // Set subscriber to wait backup or restore to finish - iSubscriber = CFileManagerSchSubscriber::NewL( - *this, - KUidSystemCategory, - KUidBackupRestoreKey, - CFileManagerSchSubscriber::ESubscribePS, - KPhoneStateChangeTimeoutSecs ); - return EFalse; - } - - return ETrue; - } - -// --------------------------------------------------------------------------- -// CFileManagerSchBackupTask::StartL -// --------------------------------------------------------------------------- -// -void CFileManagerSchBackupTask::StartL() - { - FUNC_LOG - - delete iSubscriber; - iSubscriber = NULL; - - if ( !CheckBackupRequired() ) - { - return; - } - if ( !CheckPhoneStateL() ) - { - return; - } - - // Set backup starting state - iCenRep->Set( - KFileManagerLastSchBackupStatus, - EFileManagerSchBackupStatusStarting ); - - // Set subscriber to watch backup start success - iSubscriber = CFileManagerSchSubscriber::NewL( - *this, - KCRUidFileManagerSettings, - KFileManagerLastSchBackupStatus, - CFileManagerSchSubscriber::ESubscribeCR, - KStartStateChangeTimeoutSecs ); - - // Start file manager for backup and ensure that it starts properly - StartFileManagerL(); - } - -// --------------------------------------------------------------------------- -// CFileManagerSchBackupTask::Exit -// --------------------------------------------------------------------------- -// -void CFileManagerSchBackupTask::Exit() - { - FUNC_LOG - - Cancel(); - CActiveScheduler::Stop(); - } - -// --------------------------------------------------------------------------- -// CFileManagerSchBackupTask::Retry -// --------------------------------------------------------------------------- -// -void CFileManagerSchBackupTask::Retry() - { - if ( iAttemptsLeft != 0 ) - { - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone ); - SetActive(); - - if ( iAttemptsLeft > 0 ) - { - --iAttemptsLeft; - } - } - else - { - Exit(); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerSchBackupTask::StartFileManagerL -// --------------------------------------------------------------------------- -// -void CFileManagerSchBackupTask::StartFileManagerL() - { - FUNC_LOG - - RWsSession wsSession; - User::LeaveIfError( wsSession.Connect() ); - CleanupClosePushL( wsSession ); - // Backup cannot be done from embedded file manager. - // Backup operation closes the app where file manager is started and - // the backup operation stops because file manager gets closed as well. - TInt wgId( 0 ); - if ( FindStandaloneAppL( wsSession, KUidFileManager, wgId ) ) - { - // Notify running standalone file manager to start backup - HBufC8* param8 = HBufC8::NewLC( KSchBackupTaskName().Length() ); - TPtr8 paramPtr( param8->Des() ); - paramPtr.Copy( KSchBackupTaskName ); - wsSession.SendMessageToWindowGroup( - wgId, - TUid::Uid( KUidApaMessageSwitchOpenFileValue ), - *param8 ); - CleanupStack::PopAndDestroy( param8 ); - } - else - { - // Start standalone file manager for backup - TApaAppInfo appInfo; - RApaLsSession apaLsSession; - User::LeaveIfError( apaLsSession.Connect() ); - CleanupClosePushL( apaLsSession ); - User::LeaveIfError( apaLsSession.GetAppInfo( - appInfo, KUidFileManager ) ); - CApaCommandLine* apaCmdLine = CApaCommandLine::NewLC(); - apaCmdLine->SetExecutableNameL( appInfo.iFullName ); - apaCmdLine->SetCommandL( EApaCommandBackground ); - TThreadId fmThreadId; - User::LeaveIfError( apaLsSession.StartApp( - *apaCmdLine, fmThreadId ) ); - CleanupStack::PopAndDestroy( apaCmdLine ); - CleanupStack::PopAndDestroy( &apaLsSession ); - } - CleanupStack::PopAndDestroy( &wsSession ); - } - -// --------------------------------------------------------------------------- -// CFileManagerSchBackupTask::NotifyKeyChangeOrTimeoutL -// --------------------------------------------------------------------------- -// -void CFileManagerSchBackupTask::NotifyKeyChangeOrTimeoutL( - const TUid& aCategory, - const TUint aKey, - const TBool aTimeout ) - { - FUNC_LOG - - if ( aCategory == KCRUidFileManagerSettings && - aKey == KFileManagerLastSchBackupStatus && - !aTimeout ) - { - // Backup was started, the task starter can be finished - Exit(); - } - else - { - // Backup was not started, try starting it again - Retry(); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerSchBackupTask::SystemStateChangedEvent -// --------------------------------------------------------------------------- -// -void CFileManagerSchBackupTask::SystemStateChangedEvent() - { - FUNC_LOG - - // Backup was not started, try starting it again - Retry(); - } - -// End of file diff -r 95243422089a -r 491b3ed49290 filemanager/schbkup/src/filemanagerschsubscriber.cpp --- a/filemanager/schbkup/src/filemanagerschsubscriber.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,216 +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: Handles P&S and CenRep notifications -* -*/ - - - -// INCLUDES -#include -#include "filemanagerschsubscriber.h" -#include "filemanagerschobserver.h" -#include "FileManagerDebug.h" - - -// CONSTANTS -const TUint32 KMicroSecsPerSec = 1000000; - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CFileManagerSchSubscriber::NewL() -// --------------------------------------------------------------------------- -// -CFileManagerSchSubscriber* CFileManagerSchSubscriber::NewL( - MFileManagerSchObserver& aObserver, - const TUid& aCategory, - const TUint aKey, - const TType aType, - const TInt aTimeoutSecs ) - { - CFileManagerSchSubscriber* self = - new (ELeave)CFileManagerSchSubscriber( - aObserver, aCategory, aKey, aType, aTimeoutSecs ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// --------------------------------------------------------------------------- -// CFileManagerSchSubscriber::ConstructL() -// --------------------------------------------------------------------------- -// -void CFileManagerSchSubscriber::ConstructL() - { - CActiveScheduler::Add( this ); - - if ( iType == ESubscribePS ) - { - User::LeaveIfError( iProperty.Attach( iCategory, iKey ) ); - } - else - { - iCenRep = CRepository::NewL( iCategory ); - } - - SubscribeL(); - } - -// --------------------------------------------------------------------------- -// CFileManagerSchSubscriber::SubscribeL() -// --------------------------------------------------------------------------- -// -void CFileManagerSchSubscriber::SubscribeL() - { - iTimeout = EFalse; - - if ( iType == ESubscribePS ) - { - iProperty.Subscribe( iStatus ); - } - else - { - User::LeaveIfError( iCenRep->NotifyRequest( iKey, iStatus ) ); - } - - if ( iTimeoutSecs > 0 ) - { - delete iTimer; - iTimer = NULL; - - iTimer = CPeriodic::NewL( EPriorityStandard ); - TUint32 us( iTimeoutSecs * KMicroSecsPerSec ); - iTimer->Start( us, us, TCallBack( TimeoutCB, this ) ); - } - - SetActive(); - } - -// --------------------------------------------------------------------------- -// CFileManagerSchSubscriber::TimeoutCB() -// --------------------------------------------------------------------------- -// -TInt CFileManagerSchSubscriber::TimeoutCB( void* aPtr ) - { - CFileManagerSchSubscriber* self = - static_cast< CFileManagerSchSubscriber* >( aPtr ); - - self->Timeout(); - - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CFileManagerSchSubscriber::Timeout() -// --------------------------------------------------------------------------- -// -void CFileManagerSchSubscriber::Timeout() - { - delete iTimer; - iTimer = NULL; - - Cancel(); - - // Set timeout status - iTimeout = ETrue; - - // Complete - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone ); - SetActive(); - } - -// --------------------------------------------------------------------------- -// CFileManagerSchSubscriber::CFileManagerSchSubscriber() -// --------------------------------------------------------------------------- -// -CFileManagerSchSubscriber::CFileManagerSchSubscriber( - MFileManagerSchObserver& aObserver, - const TUid& aCategory, - const TUint aKey, - const TType aType, - const TInt aTimeoutSecs ) : - CActive( EPriorityStandard ), - iObserver( aObserver ), - iCategory( aCategory), - iKey( aKey ), - iType( aType ), - iTimeoutSecs ( aTimeoutSecs ) - { - } - -// --------------------------------------------------------------------------- -// CFileManagerSchSubscriber::RunL() -// --------------------------------------------------------------------------- -// -void CFileManagerSchSubscriber::RunL() - { - // If timeout, no need to resubscribe - if ( !iTimeout ) - { - SubscribeL(); - } - - iObserver.NotifyKeyChangeOrTimeoutL( iCategory, iKey, iTimeout ); - } - -// --------------------------------------------------------------------------- -// CFileManagerSchSubscriber::DoCancel() -// --------------------------------------------------------------------------- -// -void CFileManagerSchSubscriber::DoCancel() - { - delete iTimer; - iTimer = NULL; - - if ( iType == ESubscribePS ) - { - iProperty.Cancel(); - } - else - { - iCenRep->NotifyCancel( iKey ); - } - } - -// --------------------------------------------------------------------------- -// CFileManagerSchSubscriber::RunError() -// --------------------------------------------------------------------------- -// -TInt CFileManagerSchSubscriber::RunError( TInt aError ) - { - ERROR_LOG1( "CFileManagerSchSubscriber::RunError()-Error=%d", aError ) - return aError; - } - -// --------------------------------------------------------------------------- -// CFileManagerSchSubscriber::~CFileManagerSchSubscriber() -// --------------------------------------------------------------------------- -// -CFileManagerSchSubscriber::~CFileManagerSchSubscriber() - { - Cancel(); - iProperty.Close(); - delete iCenRep; - delete iTimer; - } - -// End of File - - diff -r 95243422089a -r 491b3ed49290 filemanager/schbkup/src/fmsystemstatemonitor.cpp --- a/filemanager/schbkup/src/fmsystemstatemonitor.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* -* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: system state monitor -* -*/ - -#include -#include -#include "fmsystemstatemonitor.h" - -// ========================= MEMBER FUNCTIONS ================================== - -// ----------------------------------------------------------------------------- -// CFmSystemStateMonitor::NewL() -// Two-phased constructor -// ----------------------------------------------------------------------------- -CFmSystemStateMonitor* CFmSystemStateMonitor::NewL( - MFmSystemStateMonitorObserver& aObserver ) - { - CFmSystemStateMonitor* self = new ( ELeave ) CFmSystemStateMonitor( aObserver ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CFmSystemStateMonitor::~CFmSystemStateMonitor() -// Destructor. -// ----------------------------------------------------------------------------- -// -CFmSystemStateMonitor::~CFmSystemStateMonitor() - { - Cancel(); - iSAS.Close(); - } - -// ----------------------------------------------------------------------------- -// CFmSystemStateMonitor::StartMonitor() -// Start monitor -// ----------------------------------------------------------------------------- -// -void CFmSystemStateMonitor::StartMonitor( TUint aStateToMonitor ) - { - if( !IsActive() ) - { - iStateToMonitor = aStateToMonitor; - iSAS.RequestStateNotification( iStatus ); - SetActive(); - } - } - -// ----------------------------------------------------------------------------- -// CFmSystemStateMonitor::IsSystemStateNormal() -// Indicate the system state normal or not -// ----------------------------------------------------------------------------- -// -TBool CFmSystemStateMonitor::IsSystemStateNormal() - { - TSsmState state = iSAS.State(); - return ( state.MainState() == ESsmNormal ); - } - -// ----------------------------------------------------------------------------- -// CFmSystemStateMonitor::CFmSystemStateMonitor() -// C++ default constructor can NOT contain any code, that might leave. -// ----------------------------------------------------------------------------- -CFmSystemStateMonitor::CFmSystemStateMonitor( MFmSystemStateMonitorObserver& aObserver ) : - CActive( EPriorityStandard ),iObserver( aObserver ) - { - CActiveScheduler::Add( this ); - } - -// ----------------------------------------------------------------------------- -// CFmSystemStateMonitor::ConstructL() -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CFmSystemStateMonitor::ConstructL() - { - User::LeaveIfError( iSAS.Connect( KSM2GenMiddlewareDomain3 ) ); - } - -// ----------------------------------------------------------------------------- -// CFmSystemStateMonitor::RunL -// ----------------------------------------------------------------------------- -// -void CFmSystemStateMonitor::RunL() - { - User::LeaveIfError( iStatus.Int() ); - - TSsmState state = iSAS.State(); - if ( state.MainState() == iStateToMonitor ) - { - iObserver.SystemStateChangedEvent(); - iSAS.AcknowledgeStateNotification( KErrNone ); - } - else - { - iSAS.AcknowledgeAndRequestStateNotification( KErrNone, iStatus ); - SetActive(); - } - } - -// ----------------------------------------------------------------------------- -// CFmSystemStateMonitor::DoCancel() -// From CActive. -// ----------------------------------------------------------------------------- -// -void CFmSystemStateMonitor::DoCancel() - { - iSAS.RequestStateNotificationCancel(); - } - -// ----------------------------------------------------------------------------- -// CFmSystemStateMonitor::RunError() -// From CActive. -// ----------------------------------------------------------------------------- -// -TInt CFmSystemStateMonitor::RunError( TInt aError ) - { - return aError; - } - -// End of File - diff -r 95243422089a -r 491b3ed49290 filemanager/src/common.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/common.pri Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,65 @@ +# +# 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: filemanager project - common qmake settings +# + +CONFIG += debug_and_release + +# On win32 and mac, debug and release libraries are named differently. +# We must follow the debug and release settings Qt was compiled with: +# build debug iff Qt built debug, build release iff Qt built release. + +win32|mac { + !contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) { + CONFIG -= debug_and_release debug release + contains(QT_CONFIG,debug): CONFIG+=debug + contains(QT_CONFIG,release):CONFIG+=release + } +} + +CONFIG(debug, debug|release) { + SUBDIRPART = debug +} else { + SUBDIRPART = release +} + +win32 { + DESTDIR = $$PWD/../bin + OBJECTS_DIR = $$PWD/../$$SUBDIRPART/tmp/$$TARGET +} + +# Add the output dirs to the link path too +LIBS += -L$$DESTDIR + +MOC_DIR = moc +OBJECT_DIR = obj +RCC_DIR = rcc + +#For some reason the default include path doesn't include MOC_DIR on symbian +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MOC_DIR + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} + +INCLUDEPATH += $$PWD/inc +win32 { + # add platfrom API for windows + INCLUDEPATH += $$PWD/../filemanager_plat/inc +} + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/backup_registration.xml Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,7 @@ + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/burconfig.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/burconfig.xml Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,127 @@ + + + + + EBkupDeviceMemories|EBkupInternalMassStorages + EMMCScBkupOwnerDataTypeDataOwner + + + + EBkupDeviceMemories|EBkupInternalMassStorages + EMMCScBkupOwnerDataTypeJavaData + + + + EBkupDeviceMemories|EBkupInternalMassStorages + EMMCScBkupOwnerDataTypePublicData + + + + EBkupDeviceMemories|EBkupInternalMassStorages + EMMCScBkupOwnerDataTypeSystemData + + + + EBkupDeviceMemories|EBkupInternalMassStorages + EMMCScBkupOwnerDataTypeActiveData + + + + EBkupDeviceMemories|EBkupInternalMassStorages + EMMCScBkupOwnerDataTypePassiveData + + + + + + EBUCatAllInOne + Backup.arc + EBUCatSpecAll + EBUCatSpecNone + + + + + + EBUCatSettings + Settings.arc + EBUCatSpecAll + EBUCatSpecSystem+EBUCatSpecJava + + 0x1000484b + 0x100058db + 0x100058eb + 0x2001FE79 + 0x2002A542 + 0x10003a73 + 0x101f4cce + 0x10003a5b + 0x10005901 + 0x10008d38 + 0x101f401d + 0x101f8599 + 0x101f84eb + 0x20029f80 + 0x1028246F + 0x10282475 + 0x102033E6 + + + + EBUCatMessages + Messages.arc + EBUCatSpecNone + EBUCatSpecNone + 0x1000484b + 0x100058db + 0x100058eb + 0x2001FE79 + 0x2002A542 + + + + + EBUCatContacts + Contacts.arc + EBUCatSpecNone + EBUCatSpecNone + 0x10003a73 + 0x101f4cce + + + + + EBUCatCalendar + Calendar.arc + EBUCatSpecNone + EBUCatSpecNone + 0x10003a5b + 0x10005901 + + + + + EBUCatBookmarks + Bookmarks.arc + EBUCatSpecNone + EBUCatSpecNone + 0x10008d38 + + + + + EBUCatUserFiles + UserFiles.arc + EBUCatSpecSystem+EBUCatSpecJava + EBUCatSpecNone + 0x101f401d + + 0x2002bcc0 + 0x20029f80 + 0x1028246F + 0x200211DC + 0x102033E6 + + + + \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/filemanager.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/filemanager.pri Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,109 @@ +# +# 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: filemanager source files +# + +INCLUDEPATH += ./src +INCLUDEPATH += ./src/components +INCLUDEPATH += ./src/backuprestore +INCLUDEPATH += ./src/operationservice + +HEADERS += src/fmdriverlistwidget.h \ + src/fmfileview.h \ + src/fmfilebrowsewidget.h \ + src/fmdriverview.h \ + src/fmmainwindow.h \ + src/fmsplitview.h \ + src/fmfindthread.h \ + src/fmfindresultmodel.h \ + src/fmfindview.h \ + src/fmfindwidget.h \ + src/fmviewmanager.h \ + src/fmviewbase.h \ + src/operationservice/fmoperationservice.h \ + src/operationservice/fmoperationthread.h \ + src/operationservice/fmoperationbase.h \ + src/operationservice/fmoperationresultprocesser.h \ + src/operationservice/fmoperationcopyormove.h \ + src/operationservice/fmoperationremove.h \ + src/operationservice/fmoperationformat.h \ + src/operationservice/fmoperationviewdetails.h \ + src/backuprestore/fmbackupview.h \ + src/backuprestore/fmbackupwidget.h \ + src/backuprestore/fmrestoreview.h \ + src/backuprestore/fmrestorewidget.h \ + src/backuprestore/fmrestoreviewitem.h \ + src/backuprestore/fmbackupconfigloader.h \ + src/backuprestore/fmbackuprestorehandler.h \ + src/backuprestore/fmdeletebackupview.h \ + src/backuprestore/fmdeletebackupwidget.h \ + src/components/fmcombinedquery.h \ + src/components/fmdlgutils.h \ + src/components/fmtimequery.h \ + src/components/fmsingletextquery.h \ + src/components/fmmultitextquery.h \ + src/components/fmviewdetailsdialog.h \ + src/components/fmviewdetailsitem.h \ + src/components/fmdrivedetailstype.h \ + src/components/fmmessagebox.h \ + src/components/fmdialog.h \ + src/components/fmdrivequery.h + +SOURCES += src/main.cpp \ + src/fmdriverlistwidget.cpp \ + src/fmfileview.cpp \ + src/fmfilebrowsewidget.cpp \ + src/fmdriverview.cpp \ + src/fmmainwindow.cpp \ + src/fmsplitview.cpp \ + src/fmfindthread.cpp \ + src/fmfindresultmodel.cpp \ + src/fmfindview.cpp \ + src/fmfindwidget.cpp \ + src/fmviewmanager.cpp \ + src/fmviewbase.cpp \ + src/operationservice/fmoperationservice.cpp \ + src/operationservice/fmoperationthread.cpp \ + src/operationservice/fmoperationbase.cpp \ + src/operationservice/fmoperationresultprocesser.cpp \ + src/operationservice/fmoperationcopyormove.cpp \ + src/operationservice/fmoperationremove.cpp \ + src/operationservice/fmoperationviewdetails.cpp \ + src/backuprestore/fmbackupview.cpp \ + src/backuprestore/fmbackupwidget.cpp \ + src/backuprestore/fmrestoreview.cpp \ + src/backuprestore/fmrestorewidget.cpp \ + src/backuprestore/fmrestoreviewitem.cpp \ + src/backuprestore/fmbackupconfigloader.cpp \ + src/backuprestore/fmbackuprestorehandler.cpp \ + src/backuprestore/fmdeletebackupview.cpp \ + src/backuprestore/fmdeletebackupwidget.cpp \ + src/components/fmcombinedquery.cpp \ + src/components/fmdlgutils.cpp \ + src/components/fmtimequery.cpp \ + src/components/fmsingletextquery.cpp \ + src/components/fmmultitextquery.cpp \ + src/components/fmviewdetailsdialog.cpp \ + src/components/fmviewdetailsitem.cpp \ + src/components/fmdrivedetailstype.cpp \ + src/components/fmmessagebox.cpp \ + src/components/fmdialog.cpp \ + src/components/fmdrivequery.cpp + +win32 { + SOURCES += src/operationservice/fmoperationformat_win.cpp +} +symbian { + SOURCES += src/operationservice/fmoperationformat_s60.cpp +} \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/filemanager.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/filemanager.pro Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,55 @@ +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# Zhiqiang Yang +# +# Description: +# The project file of file manager +# + +CONFIG += hb +TEMPLATE = app +TARGET = filemngr +ICON = resources/qtg_large_filemgr.svg +RESOURCES += filemanager.qrc +INCLUDEPATH += ../fmbkupenginewrapper/inc +# remove this path when export plat header to app layer path +# INCLUDEPATH += ../../filemanager_plat/inc + +include ( ../common.pri ) +include ( ../inc/commoninc.pri ) +include ( ../inc/commonutils.pri ) +include ( filemanager.pri ) + +LIBS += -lfmbkupenginewrapper +LIBS += -lfmfiledialog + +symbian { + SKINICON = qtg_large_filemgr + LIBS += -lplatformenv \ + -lapmime \ + -lxqservice \ + -lxqutils \ + -lshareui \ + -lefsrv \ + -lapgrfx \ + -lcone \ + -lsysutil + + TARGET.UID3 = 0x2002BCC0 + TARGET.EPOCHEAPSIZE = 0x020000 0x1000000 + TARGET.CAPABILITY = CAP_APPLICATION DiskAdmin AllFiles PowerMgmt + + BLD_INF_RULES.prj_exports += "./backup_registration.xml z:/private/2002BCC0/backup_registration.xml" + BLD_INF_RULES.prj_exports += "./burconfig.xml z:/private/2002BCC0/burconfig.xml" +} + +TRANSLATIONS = filemanager.ts diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/filemanager.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/filemanager.qrc Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,13 @@ + + + image/qtg_indi_status_back.svg + image/qgn_prop_mmc_locked.svg + image/qgn_prop_mmc_memc.svg + image/qgn_prop_fmgr_mmc_no_sub.svg + image/qgn_prop_phone_memc.svg + image/qgn_prop_usb_memc.svg + image/qgn_prop_fmgr_ms.svg + resources/hblistviewitem.css + resources/hblistviewitem.widgetml + + \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/image/qgn_prop_fmgr_mmc_no_sub.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/image/qgn_prop_fmgr_mmc_no_sub.svg Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/image/qgn_prop_fmgr_ms.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/image/qgn_prop_fmgr_ms.svg Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/image/qgn_prop_mmc_locked.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/image/qgn_prop_mmc_locked.svg Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/image/qgn_prop_mmc_memc.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/image/qgn_prop_mmc_memc.svg Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/image/qgn_prop_phone_memc.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/image/qgn_prop_phone_memc.svg Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/image/qgn_prop_usb_memc.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/image/qgn_prop_usb_memc.svg Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/image/qtg_indi_status_back.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/image/qtg_indi_status_back.svg Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,17 @@ + + + +]> + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/resources/hblistviewitem.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/resources/hblistviewitem.css Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,57 @@ + +HbListViewItem[layoutName="drive"]:portrait{ + layout: drive-portrait; +} + + +HbListViewItem[layoutName="drive"]:landscape{ + layout: drive-landscape; +} + +HbListViewItem::text-1[layoutName="drive"]:portrait{ + top: -var(hb-param-margin-gene-middle-vertical); + font-variant: primary; + text-align: left; +} + +HbListViewItem::text-2[layoutName="drive"]:portrait{ + font-variant: secondary; + text-align: left; +} +HbListViewItem::text-3[layoutName="drive"]:portrait{ + bottom: var(hb-param-margin-gene-middle-vertical); + font-variant: secondary-small; + text-align: left; +} +HbListViewItem::icon-1[layoutName="drive"]:portrait{ + top: -var(hb-param-margin-gene-top); + left: -var(hb-param-margin-gene-middle-horizontal); + + fixed-height: var(hb-param-graphic-size-primary-large); + fixed-width: var(hb-param-graphic-size-primary-large); +} + +HbListViewItem::text-1[layoutName="drive"]:landscape{ + top: -var(hb-param-margin-gene-top); + font-variant: primary; + text-align: left; +} + +HbListViewItem::text-2[layoutName="drive"]:landscape { + top: -var(hb-param-margin-gene-top); + font-variant: secondary; + text-align: left; +} +HbListViewItem::text-3[layoutName="drive"]:landscape{ + bottom: var(hb-param-margin-gene-top); + font-variant: secondary-small; + text-align: left; +} +HbListViewItem::icon-1[layoutName="drive"]:landscape{ + top: -var(hb-param-margin-gene-top); + left: -var(hb-param-margin-gene-middle-horizontal); + bottom: var(hb-param-margin-gene-bottom); + fixed-height: var(hb-param-graphic-size-primary-large); + fixed-width: var(hb-param-graphic-size-primary-large); +} + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/resources/hblistviewitem.widgetml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/resources/hblistviewitem.widgetml Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/resources/qtg_large_filemgr.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/resources/qtg_large_filemgr.svg Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmbackupconfigloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackupconfigloader.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,261 @@ +/* + * 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: + * The source file of the back up config loader of file manager + */ + +#include "fmbackupconfigloader.h" +#include "fmbkupengine.h" +#include "fmbkupcommon.h" +#include "fmutils.h" + +#include +#include +#include + +FmBackupConfigLoader::FmBackupConfigLoader(void) +{ + +} + +FmBackupConfigLoader::~FmBackupConfigLoader(void) +{ + /* + if( mProgressDialog ) + delete mProgressDialog; + */ +} + +void FmBackupConfigLoader::loadData() +{ + if( mDrivesAndOperationList.count() != 0 || mBackupCategoryList.count() != 0 ) { + return; + } + + QString path = QCoreApplication::applicationDirPath (); + path = FmUtils::getBurConfigPath( path ); + QFile file( path ); + if( !file.exists() ) { + Q_ASSERT( false ); + return; + } + if( !file.open( QIODevice::ReadOnly ) ) { + Q_ASSERT( false ); + return; + } + QByteArray data = file.readAll(); + xml.clear(); + xml.addData(data); + file.close(); + parseXml(); + +// mBackupSettings->load(); +} + +QList FmBackupConfigLoader::driversAndOperationList() +{ + loadData(); + return mDrivesAndOperationList; +} +QList FmBackupConfigLoader::backupCategoryList() +{ + loadData(); + return mBackupCategoryList; +} + +void FmBackupConfigLoader::parseXml() +{ + while(!xml.atEnd()){ + xml.readNext(); + if( xml.isStartElement() ){ + currentTag = xml.name().toString(); + if( xml.name() == "drivesAndOperation" ){ + parseDrivesAndOperation(); + } + else if( xml.name() == "backupCategory" ){ + parseBackupCategory(); + } + } + } + if (xml.error() && xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) { + qDebug("XML ERROR: %d :%s"), xml.lineNumber() ,xml.errorString().toAscii().data(); + } +} + + +void FmBackupConfigLoader::parseDrivesAndOperation() +{ + FmBkupDrivesAndOperation* driversAndOperation = + new FmBkupDrivesAndOperation; + + while( !( xml.isEndElement() && xml.name() == "drivesAndOperation" ) ) + { + xml.readNext(); + currentTag = xml.name().toString(); + if( xml.name() == "drive" ) + { + driveString = xml.readElementText(); + } + else if( xml.name() == "type" ) + { + typeString = xml.readElementText(); + } + } + + bool ok = false; + bool everyParamOk = true; + + unsigned int driveInt = + ConfigStringConverter::drivesAndOperations_DriveToUInt( &ok, driveString ); + if( !ok ){ + everyParamOk = false; + } + + unsigned int typeInt = + ConfigStringConverter::drivesAndOperations_TypeToUInt( &ok, typeString ); + if( !ok ){ + everyParamOk = false; + } + + if( everyParamOk ){ + driversAndOperation->setDrvCategories( driveInt ); + driversAndOperation->setOwnerDataType( typeInt ); + mDrivesAndOperationList.append(driversAndOperation); + } + else{ + delete driversAndOperation; + } + + QString debugString; + debugString = debugString + "drive = " + driveString; + debugString = debugString + "\n type = " + typeString; + //QMessageBox::notifyation( NULL, "drive&Type = ", debugString, QMessageBox::Ok, QMessageBox::NoButton ); + + driveString.clear(); + typeString.clear(); +} + +void FmBackupConfigLoader::parseBackupCategory() +{ + FmBkupBackupCategory* backupCategory = + new FmBkupBackupCategory(); + + while( !( xml.isEndElement() && xml.name() == "backupCategory" ) ) + { + xml.readNext(); + currentTag = xml.name().toString(); + if( xml.name() == "category" ) + { + categoryString = xml.readElementText(); + } + else if( xml.name() == "archive_name" ) + { + archive_nameString = xml.readElementText(); + } + else if( xml.name() == "special_flags" ) + { + special_flagsString = xml.readElementText(); + } + else if( xml.name() == "exclude_special_flags" ) + { + exclude_special_flagsString = xml.readElementText(); + } + else if( xml.name() == "uids" ){ + QString tempString = xml.readElementText(); + if( tempString.length()>0 ){ + /// debug----------- + uidsString += '|'; + uidsString += tempString; + /// debug----------- + + bool ok = false; + unsigned int value = tempString.toUInt( &ok, 16); + if( ok ){ + backupCategory->addUids( value ); + } + } + } + else if( xml.name() == "exclude_uids" ){ + QString tempString = xml.readElementText(); + if( tempString.length()>0 ){ + /// debug----------- + exclude_uidsString += '|'; + exclude_uidsString += tempString; + /// debug----------- + + bool ok = false; + unsigned int value = tempString.toUInt( &ok, 16); + if( ok ){ + backupCategory->addExclude_uids( value ); + } + } + } + } + + + bool ok = false; + bool everyParamOk = true; + + unsigned int categoryInt = + ConfigStringConverter::backupCategory_CategoryToUInt( &ok, categoryString ); + if( !ok ){ + everyParamOk = false; + } + + if( archive_nameString.length() <= 0 ){ + everyParamOk = false; + } + + unsigned int special_flagsInt = + ConfigStringConverter::backupCategory_Special_flagsToUInt( &ok, special_flagsString ); + if( !ok ){ + everyParamOk = false; + } + + unsigned int exclude_special_flagsInt = + ConfigStringConverter::backupCategory_Special_flagsToUInt( &ok, exclude_special_flagsString ); + if( !ok ){ + everyParamOk = false; + } + + if( everyParamOk ){ + backupCategory->setCategory( categoryInt ); + backupCategory->setArchive_name( archive_nameString ); + backupCategory->setSpecial_flags( special_flagsInt ); + backupCategory->setExclude_special_flags( exclude_special_flagsInt ); + mBackupCategoryList.append( backupCategory ); + } + else{ + delete backupCategory; + } + + QString debugString; + debugString = debugString + "category = " + categoryString; + debugString = debugString + "\n archive_name = " + archive_nameString; + debugString = debugString + "\n special_flags = " + special_flagsString; + debugString = debugString + "\n exclude_special_flags = " + special_flagsString; + debugString = debugString + "\n exclude_special_flags = " + exclude_special_flagsString; + debugString = debugString + "\n uids = " + uidsString; + debugString = debugString + "\n exclude_uids = " + exclude_uidsString; + //QMessageBox::notifyation( NULL, "category = ", debugString, QMessageBox::Ok, QMessageBox::NoButton ); + + categoryString.clear(); + archive_nameString.clear(); + special_flagsString.clear(); + exclude_special_flagsString.clear(); + uidsString.clear(); + exclude_uidsString.clear(); +} + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmbackupconfigloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackupconfigloader.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,71 @@ +/* + * 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: + * The header file of the back up config loader of file manager + */ + +#ifndef FMBACKUPCONFIGLOADER_H +#define FMBACKUPCONFIGLOADER_H + +#include +#include + +#include "fmcommon.h" + +class FmBkupDrivesAndOperation; +class FmBkupBackupCategory; +class FmBackupSettings; + +class FmBackupConfigLoader : public QObject +{ +Q_OBJECT + +public: + FmBackupConfigLoader(void); + ~FmBackupConfigLoader(void); + +public: + void loadData(); + QList driversAndOperationList(); + QList backupCategoryList(); + +private: + void parseXml(); + void parseDrivesAndOperation(); + void parseBackupCategory(); + +private: + + QXmlStreamReader xml; + + QString currentTag; + + QString driveString; + QString typeString; + + QString categoryString; + QString archive_nameString; + QString special_flagsString; + QString exclude_special_flagsString; + QString uidsString; + QString exclude_uidsString; + + QList mDrivesAndOperationList; + QList mBackupCategoryList; +}; + +#endif + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,155 @@ +/* + * 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: + * The source file of backup and restore handler of file manager + */ + +#include "fmbackuprestorehandler.h" +#include "fmbackupsettings.h" +#include "fmrestoresettings.h" +#include "fmoperationservice.h" +#include "fmbackupconfigloader.h" +#include "fmbkupengine.h" +#include "fmoperationbase.h" +#include "fmcommon.h" +#include "fmdlgutils.h" + +FmBackupRestoreHandler::FmBackupRestoreHandler( QObject *parent ) : QObject( parent ), mBackupConfigLoader( 0 ) +{ + mBkupEngine = new FmBkupEngine( this ); + + mCurrentProcess = ProcessNone; + + connect( mBkupEngine, SIGNAL( notifyPreparing( bool ) ), this, SLOT( onNotifyPreparing( bool ) ), Qt::QueuedConnection ); + connect( mBkupEngine, SIGNAL( notifyStart( bool, int) ), this, SLOT( onNotifyStart( bool, int ) ), Qt::QueuedConnection ); + connect( mBkupEngine, SIGNAL( notifyUpdate(int) ), this, SLOT( onNotifyUpdate(int) ), Qt::QueuedConnection ); + connect( mBkupEngine, SIGNAL( notifyFinish(int) ), + this, SLOT( onNotifyFinish(int) ), Qt::DirectConnection ); + connect( mBkupEngine, SIGNAL( notifyMemoryLow(int, int& ) ), + this, SLOT( onNotifyMemoryLow(int, int&) ) ); + connect( mBkupEngine, SIGNAL( notifyBackupFilesExist( bool& )), this, SLOT( onNotifyBackupFilesExist( bool& ))); + +} +FmBackupRestoreHandler::~FmBackupRestoreHandler() +{ + delete mBkupEngine; + delete mBackupConfigLoader; +} + +FmBkupEngine *FmBackupRestoreHandler::bkupEngine() +{ + return mBkupEngine; +} + +FmBackupConfigLoader *FmBackupRestoreHandler::backupConfigLoader() +{ + if( !mBackupConfigLoader ) { + mBackupConfigLoader = new FmBackupConfigLoader(); + } + return mBackupConfigLoader; +} + +int FmBackupRestoreHandler::error() +{ + return mBkupEngine->error(); +} + +bool FmBackupRestoreHandler::startBackup( FmOperationBackup *operationBackup ) +{ + Q_UNUSED( operationBackup ); + mCurrentProcess = ProcessBackup; + bool ret = mBkupEngine->startBackup( backupConfigLoader()->driversAndOperationList(), + backupConfigLoader()->backupCategoryList(), + operationBackup->targetDrive(), // targetDrive is stored in FmOperationBackup + operationBackup->content() ); // content is stored in FmOperationBackup + + if( !ret ) { + mCurrentProcess = ProcessNone; + } + return ret; +} +void FmBackupRestoreHandler::cancelBackup() +{ + mBkupEngine->cancelBackup(); +} +bool FmBackupRestoreHandler::startRestore( FmOperationRestore *operationRestore ) +{ + mCurrentProcess = ProcessRestore; + mBkupEngine->RestoreSettingsL()->SetSelection( operationRestore->selection() ); + bool ret = mBkupEngine->startRestore( backupConfigLoader()->driversAndOperationList() ); + if( !ret ) { + mCurrentProcess = ProcessNone; + } + return ret; +} + +int FmBackupRestoreHandler::deleteBackup( quint64 selection ) +{ + mBkupEngine->RestoreSettingsL()->SetSelection( selection ); + mBkupEngine->deleteBackup( backupConfigLoader()->driversAndOperationList() ); + return FmErrNone; +} + +void FmBackupRestoreHandler::onNotifyMemoryLow( int memoryValue, int &userError ) +{ + userError = FmErrNone; + if( memoryValue < FmEstimateLowerLimit ) { + userError = FmErrDiskFull; + } else if( memoryValue < FmEstimateUpperLimit ) { + if ( !FmDlgUtils::question( "memory low, continue?" ) ){ + userError = FmErrCancel; + } + } +} +void FmBackupRestoreHandler::onNotifyBackupFilesExist( bool &isContinue ) + { + if ( FmDlgUtils::question( "some backup files exist, continue?" ) ) + { + isContinue = true; + } + else + { + isContinue = false; + } + } + + +void FmBackupRestoreHandler::onNotifyPreparing( bool cancelable ) +{ + emit notifyPreparing( cancelable ); +} +void FmBackupRestoreHandler::onNotifyStart( bool cancelable, int maxSteps ) +{ + emit notifyStart( cancelable, maxSteps ); +} +void FmBackupRestoreHandler::onNotifyUpdate( int currentStep ) +{ + emit notifyProgress( currentStep ); +} +void FmBackupRestoreHandler::onNotifyFinish( int err ) +{ + if( err == FmErrNone ) { + emit notifyFinish(); + } else if( err == FmErrCancel ){ + emit notifyCanceled(); + } else { + emit notifyError( err, QString("") ); + } +} + +void FmBackupRestoreHandler::getBackupDriveList( QStringList &driveList ) +{ + mBkupEngine->getBackupDriveList( driveList ); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,82 @@ +/* + * 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: + * The header file of backup and restore handler of file manager + */ + +#ifndef FMBACKUPRESTOREHANDLER_H +#define FMBACKUPRESTOREHANDLER_H + +#include + +#include "fmoperationservice.h" + +class FmBkupEngine; +class FmOperationBackup; +class FmOperationRestore; +class FmBackupConfigLoader; + +class FmBackupRestoreHandler : public QObject +{ +Q_OBJECT + +public: + + FmBackupRestoreHandler( QObject *parent ); + ~FmBackupRestoreHandler(); + + int error(); + + bool startBackup( FmOperationBackup *operationBackup ); + void cancelBackup(); + + bool startRestore( FmOperationRestore *operationRestore ); + + int deleteBackup( quint64 selection ); + FmBkupEngine *bkupEngine(); + FmBackupConfigLoader *backupConfigLoader(); + void getBackupDriveList( QStringList &driveList ); + +signals: + void notifyPreparing( bool cancelable ); + void notifyStart( bool cancelable, int maxSteps ); + void notifyProgress( int currentStep ); + void notifyFinish(); + void notifyError( int error, QString errString ); + void notifyCanceled(); + + +public slots: + void onNotifyPreparing( bool cancelable ); + void onNotifyMemoryLow( int memoryValue, int &userError ); + + void onNotifyStart( bool cancelable, int maxSteps ); + void onNotifyUpdate( int currentStep ); + void onNotifyFinish( int err ); + + void onNotifyBackupFilesExist( bool &isContinue ); +private: + enum Process{ + ProcessNone = 0, + ProcessBackup, + ProcessRestore + }; +private: + FmBkupEngine *mBkupEngine; + FmBackupConfigLoader *mBackupConfigLoader; + Process mCurrentProcess; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmbackupview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackupview.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,151 @@ +/* + * 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: + * The source file of the back up view of file manager + */ + +#include "fmbackupview.h" +#include "fmbackupwidget.h" +#include "fmviewmanager.h" +#include "fmoperationbase.h" +#include "fmdlgutils.h" + +#include + +#include +#include +#include +#include + +FmBackupView::FmBackupView() : FmViewBase( EBackupView ) +{ + setTitle( hbTrId( "Backup" ) ); + + initToolBar(); + initMainWidget(); + initMenu(); + mOperationService = FmViewManager::viewManager()->operationService(); + +} + +FmBackupView::~FmBackupView() +{ + removeToolBarAction(); +} + +void FmBackupView::initMenu() +{ + HbAction *action = 0; + +#ifdef FM_CHANGE_ORIENT_ENABLE + action = new HbAction( this ); + action->setObjectName( "rotateAction" ); + action->setText( hbTrId( "Change orientation" ) ); + menu()->addAction( action ); + connect( action, SIGNAL(triggered()), this, SLOT( on_rotateAction_triggered() ), Qt::QueuedConnection ); +#endif + + action = new HbAction( this ); + action->setObjectName( "backupAction" ); + action->setText( hbTrId( "Start backup" ) ); + menu()->addAction( action ); + connect( action, SIGNAL(triggered()), this, SLOT( on_backupAction_triggered() ), Qt::QueuedConnection ); + + action = new HbAction( this ); + action->setObjectName( "deleteBackupAction" ); + action->setText( hbTrId( "Delete backup" ) ); + menu()->addAction( action ); + connect( action, SIGNAL(triggered()), this, SLOT( on_deleteBackupAction_triggered() ), Qt::QueuedConnection ); +} + +void FmBackupView::initMainWidget() +{ + mMainWidget = new FmBackupWidget( this ); + setWidget( mMainWidget ); + +} + +void FmBackupView::initToolBar() +{ + mToolBarAction = new HbAction( this ); + mToolBarAction->setObjectName( "leftAction" ); + mToolBarAction->setText( hbTrId("Start backup") ); + toolBar()->addAction( mToolBarAction ); + connect( mToolBarAction, SIGNAL(triggered()), this, SLOT( on_leftAction_triggered() ), Qt::QueuedConnection ); + + toolBar()->setOrientation( Qt::Horizontal ); +} + +void FmBackupView::on_leftAction_triggered() +{ + int ret = mOperationService->asyncBackup(); + FM_LOG( "FmBackupView_asyncBackup: ret= " + QString::number(ret) ); + switch( ret ) + { + case FmErrNone: + break; + case FmErrWrongParam: + FmDlgUtils::information( QString( hbTrId("Operation canceled with wrong param!") ) ); + break; + case FmErrAlreadyStarted: + FmDlgUtils::information( QString( hbTrId("Operation canceled because already started!") ) ); + break; + case FmErrPathNotFound: + FmDlgUtils::information( QString( hbTrId("Operation canceled because can not find target path or drive is not available!") ) ); + break; + case FmErrAlreadyExists: + FmDlgUtils::information( QString( hbTrId("backup canceled") ) ); + break; + default: + FmDlgUtils::information( QString( hbTrId("backup failed") ) ); + break; + } +} +#ifdef FM_CHANGE_ORIENT_ENABLE +void FmBackupView::on_rotateAction_triggered() +{ + if ( mainWindow()->orientation() == Qt::Vertical ) { + mainWindow()->setOrientation( Qt::Horizontal ); + } + else { + mainWindow()->setOrientation( Qt::Vertical ); + } +} +#endif //FM_CHANGE_ORIENT_ENABLE + +void FmBackupView::on_backupAction_triggered() +{ + on_leftAction_triggered(); +} + +void FmBackupView::on_deleteBackupAction_triggered() +{ + FmViewManager::viewManager()->createDeleteBackupView(); +} + +void FmBackupView::removeToolBarAction() +{ + toolBar()->removeAction( mToolBarAction ); +} + +void FmBackupView::refreshBackupDate() +{ + mMainWidget->updateBackupDate(); +} + +void FmBackupView::refreshModel() +{ + mMainWidget->refreshModel(); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmbackupview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackupview.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * + * Description: + * The header file of the back up view of file manager + */ + +#ifndef FMBACKUPVIEW_H +#define FMBACKUPVIEW_H + +#include "fmoperationservice.h" +#include "fmviewbase.h" + +class FmBackupWidget; +class FmOperationService; + +class HbAction; + +class FmBackupView : public FmViewBase +{ + Q_OBJECT + +public: + FmBackupView(); + ~FmBackupView(); + +signals: + void activateRestoreView(); + +private: + void initMenu(); + void initMainWidget(); + void initToolBar(); + + void removeToolBarAction(); + +public slots: + void refreshBackupDate(); + void refreshModel(); + +private slots: + void on_leftAction_triggered(); + + void on_backupAction_triggered(); + void on_deleteBackupAction_triggered(); + +#ifdef FM_CHANGE_ORIENT_ENABLE + void on_rotateAction_triggered(); +#endif + +private: + FmBackupWidget *mMainWidget; + FmOperationService *mOperationService; + + HbAction *mToolBarAction; +}; + +#endif + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,351 @@ +/* + * 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: + * The header file of the back up widget of file manager + */ + +#include "fmbackupwidget.h" +#include "fmbackupsettings.h" +#include "fmdlgutils.h" +#include "fmviewmanager.h" +#include "fmoperationservice.h" +#include "fmbkupengine.h" +#include "fmbackuprestorehandler.h" +#include "fmutils.h" + + +#include +#include + +#include +#include +#include +#include + + +FmBackupWidget::FmBackupWidget( QGraphicsItem *parent ) +: HbWidget( parent ) +{ + init(); +} + +FmBackupWidget::~FmBackupWidget() +{ + mDataForm->setModel( 0 ); + delete mModel; +} + + +void FmBackupWidget::on_list_activated( const QModelIndex &index ) +{ + // change item data when receive activated signal + HbDataFormModelItem *item = mModel->itemFromIndex(index); + if( item == mContentsItem ){ + emit changeContents(); + } else if( item == mTargetItem ){ + emit changeTargetDrive(); + } else if( item == mSchedulingItem ){ + emit changeScheduling(); + } else if( item == mWeekdayItem ){ + emit changeWeekday(); + } else if( item == mTimeItem ){ + emit changeTime(); + } +} + +void FmBackupWidget::init() +{ + QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout( this ); + vLayout->setOrientation( Qt::Vertical ); + + + mModel = new HbDataFormModel(); + initModel(); + + mDataForm = new HbDataForm( this ); + mDataForm->setModel( mModel ); + vLayout->addItem( mDataForm ); + + connect( mDataForm, SIGNAL( activated( const QModelIndex & ) ), + this, SLOT( on_list_activated( const QModelIndex & ) ) ); + + connect( this, SIGNAL( doModelRefresh() ), + this, SLOT( refreshModel() ), Qt::QueuedConnection ); + + connect( this, SIGNAL(changeContents()), this, SLOT(on_changeContents()), Qt::QueuedConnection); + connect( this, SIGNAL(changeScheduling()), this, SLOT(on_changeScheduling()), Qt::QueuedConnection); + connect( this, SIGNAL(changeWeekday()), this, SLOT(on_changeWeekday()), Qt::QueuedConnection); + connect( this, SIGNAL(changeTime()), this, SLOT(on_changeTime()), Qt::QueuedConnection); + connect( this, SIGNAL(changeTargetDrive()), this, SLOT(on_changeTargetDrive()), Qt::QueuedConnection); + + //mBackupSettings = new FmBackupSettings(); + mBackupSettings = FmViewManager::viewManager()->operationService()->backupRestoreHandler()->bkupEngine()->BackupSettingsL(); + mBackupSettings->load(); + + emit doModelRefresh(); + +} + +void FmBackupWidget::expandAllGroup() +{ + FM_LOG( QString( "function expandAllGroup start" ) ); + + mDataForm->setModel( 0 ); + mDataForm->setModel( mModel ); + + HbDataFormViewItem *itemScheduling = + (HbDataFormViewItem *)(mDataForm->itemByIndex(mModel->indexFromItem(mSchedulingGroup))); + if( itemScheduling ){ + FM_LOG( QString( "expand itemScheduling start" ) ); + itemScheduling->setExpanded( true ); + FM_LOG( QString( "expand itemScheduling end" ) ); + } + + HbDataFormViewItem *itemGroup = + (HbDataFormViewItem *)(mDataForm->itemByIndex(mModel->indexFromItem(mContentsGroup))); + if( itemGroup ){ + FM_LOG( QString( "expand itemGroup start" ) ); + itemGroup->setExpanded( true ); + FM_LOG( QString( "expand itemGroup end" ) ); + } + FM_LOG( QString( "function expandAllGroup end" ) ); +} + +void FmBackupWidget::initModel() +{ + mContentsGroup = mModel->appendDataFormGroup( + QString( hbTrId( "Contents" ) ), mModel->invisibleRootItem()); + + mContentsItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString( "" ), mContentsGroup ); + mContentsItem->setContentWidgetData( QString("readOnly"), QString("true") ); + mContentsItem->setContentWidgetData( QString("objectName"), QString("backupContentItem") ); + + mTargetItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString( "" ), mContentsGroup ); + mTargetItem->setContentWidgetData( QString("readOnly"), QString("true") ); + mTargetItem->setContentWidgetData( QString("objectName"), QString("backupTargetItem") ); + + mSchedulingGroup = mModel->appendDataFormGroup( + QString( hbTrId( "Scheduling" ) ), mModel->invisibleRootItem()); + + mSchedulingItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString( "" ), mSchedulingGroup ); + mSchedulingItem->setContentWidgetData( QString("readOnly"), QString("true") ); + mSchedulingItem->setContentWidgetData( QString("objectName"), QString("backupSchedulingItem") ); + + mWeekdayItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString( "" ), mSchedulingGroup ); + mWeekdayItem->setContentWidgetData( QString("readOnly"), QString("true") ); + mWeekdayItem->setContentWidgetData( QString("objectName"), QString("backupWeekdayItem") ); + + mTimeItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString( "" ), mSchedulingGroup ); + mTimeItem->setContentWidgetData( QString("readOnly"), QString("true") ); + mTimeItem->setContentWidgetData( QString("objectName"), QString("backupTimeItem") ); + + mLastBackupDateItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString( ( "" )), mModel->invisibleRootItem() ); + mLastBackupDateItem->setContentWidgetData( QString("readOnly"), QString("true") ); + mLastBackupDateItem->setContentWidgetData( QString("objectName"), QString("backupLastBackupDateItem") ); +} + + + +void FmBackupWidget::refreshModel() +{ + mDataForm->setModel( 0 ); + + mBackupSettings->load(); + + int index = 0; + + index = mSchedulingGroup->indexOf( mWeekdayItem ); + if( index >=0 ){ + mSchedulingGroup->removeChild( index ); + mWeekdayItem = 0; + } + + index = mSchedulingGroup->indexOf( mTimeItem ); + if( index >=0 ){ + mSchedulingGroup->removeChild( index ); + mTimeItem = 0; + } + + index = mContentsGroup->indexOf( mTargetItem ); + if( index >=0 ){ + mContentsGroup->removeChild( index ); + mTargetItem = 0; + } + + QList< FmBackupEntry* > backupEntryList = mBackupSettings->backupEntryList(); + + QList< FmBackupEntry* >::iterator it; + + for ( it = backupEntryList.begin(); it != backupEntryList.end(); ++it ){ + + int type = ( *it )->type(); + + QString title = ( *it )->title(); + QString tips = ( *it )->tips(); + + switch ( type ) + { + case FmBackupEntry::EContents: + { + mContentsItem->setLabel(title); + mContentsItem->setContentWidgetData( QString("text"), tips ); + break; + } + case FmBackupEntry::ETarget: + { + mTargetItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString( "" ), mContentsGroup ); + mTargetItem->setContentWidgetData( QString("readOnly"), QString("true") ); + mTargetItem->setLabel(title); + mTargetItem->setContentWidgetData( QString("text"), tips ); + break; + } + case FmBackupEntry::EScheduling: + { + mSchedulingItem->setLabel(title); + mSchedulingItem->setContentWidgetData( QString("text"), tips ); + break; + } + case FmBackupEntry::EWeekday: + { + mWeekdayItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString( "" ), mSchedulingGroup ); + mWeekdayItem->setContentWidgetData( QString("readOnly"), QString("true") ); + mWeekdayItem->setLabel(title); + mWeekdayItem->setContentWidgetData( QString("text"), tips ); + break; + } + case FmBackupEntry::ETime: + { + mTimeItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString( "" ), mSchedulingGroup ); + mTimeItem->setContentWidgetData( QString("readOnly"), QString("true") ); + mTimeItem->setLabel(title); + mTimeItem->setContentWidgetData( QString("text"), tips ); + break; + } + case FmBackupEntry::EBackupdate: + { + mLastBackupDateItem->setContentWidgetData( QString("text"), tips ); + break; + } + } + } + + mDataForm->setModel( mModel ); + + expandAllGroup(); +} + +void FmBackupWidget::on_changeContents() +{ + + QString title = mContentsItem->label(); + QStringList queryStringList; + quint32 contentMask = FmBackupSettings::EFileManagerBackupContentAll; + while ( contentMask <= FmBackupSettings::EFileManagerBackupContentLast) + { + queryStringList.push_back( mBackupSettings->contentToString( contentMask ) ); + contentMask = contentMask << 1; + } + quint32 select = mBackupSettings->content(); + if( FmDlgUtils::showMultiSettingQuery( title, queryStringList, select, 0 ) ) + { + mBackupSettings->setContent( select ); + emit doModelRefresh(); + } + +} + + +void FmBackupWidget::on_changeScheduling() +{ + QString title = mSchedulingItem->label(); + QStringList queryStringList; + + FmBackupSettings::TFileManagerBackupSchedule schedule = FmBackupSettings::EFileManagerBackupScheduleNever; + while ( schedule <= FmBackupSettings::EFileManagerBackupScheduleWeekly ) + { + queryStringList.push_back( mBackupSettings->schedulingToString( schedule ) ); + schedule = FmBackupSettings::TFileManagerBackupSchedule(((int)schedule)+1); + } + + // adjust index offset against monday. + int selectIndex = mBackupSettings->scheduling() - FmBackupSettings::EFileManagerBackupScheduleNever; + if( FmDlgUtils::showSingleSettingQuery( title, queryStringList, selectIndex ) ) + { + selectIndex += FmBackupSettings::EFileManagerBackupScheduleNever; + mBackupSettings->setScheduling( ( FmBackupSettings::TFileManagerBackupSchedule )selectIndex ); + emit doModelRefresh(); + } +} + +void FmBackupWidget::on_changeWeekday() +{ + QString title = mWeekdayItem->label(); + QStringList queryStringList; + + FmBackupSettings::TFileManagerBackupWeekday weekday = FmBackupSettings::EFileManagerBackupWeekdayMonday; + while ( weekday <= FmBackupSettings::EFileManagerBackupWeekdaySunday ) + { + queryStringList.push_back( mBackupSettings->weekdayToString( weekday ) ); + weekday = FmBackupSettings::TFileManagerBackupWeekday(((int)weekday)+1); + } + + // adjust index offset against monday. + int selectIndex = mBackupSettings->weekday() - FmBackupSettings::EFileManagerBackupWeekdayMonday; + if( FmDlgUtils::showSingleSettingQuery( title, queryStringList, selectIndex ) ) + { + selectIndex += FmBackupSettings::EFileManagerBackupWeekdayMonday; + mBackupSettings->setWeekday( (FmBackupSettings::TFileManagerBackupWeekday)selectIndex ); + emit doModelRefresh(); + } +} + +void FmBackupWidget::on_changeTime() +{ + QString title = mTimeItem->label(); + QTime queryTime = mBackupSettings->time(); + + if( FmDlgUtils::showTimeSettingQuery( title, queryTime ) ) + { + mBackupSettings->setTime( queryTime ); + emit doModelRefresh(); + } +} + + +void FmBackupWidget::on_changeTargetDrive() +{ + QString title = mTargetItem->label(); + QString drive = FmDlgUtils::showBackupDriveQuery( title ); + if( ( !drive.isEmpty() ) && + ( mBackupSettings->targetDrive().compare( drive, Qt::CaseInsensitive ) != 0 ) ) { + mBackupSettings->setTargetDrive( drive ); + emit doModelRefresh(); + } +} + +void FmBackupWidget::updateBackupDate() +{ + mBackupSettings->updateBackupDate(); + emit doModelRefresh(); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmbackupwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,84 @@ +/* + * 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: + * The header file of the back up widget of file manager + */ + +#ifndef FMBACKUPWIDGET_H +#define FMBACKUPWIDGET_H + +#include + +class FmBackupSettings; + +class HbDataForm; +class HbDataFormModel; +class HbDataFormModelItem; +class FmBackupConfigLoader; + +class FmBackupWidget : public HbWidget +{ + Q_OBJECT + +public: + FmBackupWidget( QGraphicsItem *parent = 0 ); + ~FmBackupWidget(); + void updateBackupDate(); + +signals: + void doModelRefresh(); + void changeContents(); + void changeScheduling(); + void changeWeekday(); + void changeTime(); + void changeTargetDrive(); + +public slots: + // refresh whole model immediately. + void refreshModel(); + +private slots: + void on_list_activated( const QModelIndex &index ); + + void on_changeContents(); + void on_changeScheduling(); + void on_changeWeekday(); + void on_changeTime(); + void on_changeTargetDrive(); + +private: + + void initModel(); + void init(); + void expandAllGroup(); + +private: + + HbDataForm *mDataForm; + HbDataFormModel *mModel; + HbDataFormModelItem *mContentsGroup; + HbDataFormModelItem *mSchedulingGroup; + + HbDataFormModelItem *mContentsItem; + HbDataFormModelItem *mTargetItem; + HbDataFormModelItem *mSchedulingItem; + HbDataFormModelItem *mWeekdayItem; + HbDataFormModelItem *mTimeItem; + HbDataFormModelItem *mLastBackupDateItem; + FmBackupSettings *mBackupSettings; + FmBackupConfigLoader *mBackupConfigLoader; +}; + +#endif // FMBACKUPWIDGET_H diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,143 @@ +/* + * 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: + * Zhiqiang Yang + * + * Description: + * The source file of the delete backup view of file manager + */ + +#include "fmdeletebackupview.h" +#include "fmdeletebackupwidget.h" +#include "fmviewmanager.h" +#include "fmoperationbase.h" +#include "fmdlgutils.h" + +#include + +#include +#include +#include +#include + +FmDeleteBackupView::FmDeleteBackupView() : FmViewBase( EDeleteBackupView ) +{ + setTitle( hbTrId( "Delete Backup" ) ); + + initMainWidget(); + initToolBar(); + initMenu(); + mOperationService = FmViewManager::viewManager()->operationService(); +} + +FmDeleteBackupView::~FmDeleteBackupView() +{ + removeToolBarAction(); +} + +void FmDeleteBackupView::initMenu() +{ +#ifdef FM_CHANGE_ORIENT_ENABLE + HbAction *action = 0; + action = new HbAction( this ); + action->setObjectName( "rotateAction" ); + action->setText( hbTrId( "Change orientation" ) ); + menu()->addAction( action ); + connect( action, SIGNAL(triggered()), this, SLOT( on_rotateAction_triggered() ), Qt::QueuedConnection ); +#endif + + mDeleteAction = new HbAction( this ); + mDeleteAction->setObjectName( "deleteAction" ); + mDeleteAction->setText( hbTrId( "Delete backups" ) ); + menu()->addAction( mDeleteAction ); + mDeleteAction->setEnabled(false); + connect( mDeleteAction, SIGNAL(triggered()), this, SLOT( on_deleteAction_triggered() ), Qt::QueuedConnection ); +} + +void FmDeleteBackupView::initMainWidget() +{ + mDeleteBackupWidget = new FmDeleteBackupWidget( this ); + mDeleteBackupWidget->setObjectName( "deleteBackupWidget" ); + setWidget( mDeleteBackupWidget ); + connect(mDeleteBackupWidget, SIGNAL(stateChanged(int)), this, SLOT(on_deleteBackupWidget_stateChanged(int))); + +} + +void FmDeleteBackupView::on_deleteBackupWidget_stateChanged(int state) +{ + Q_UNUSED(state); + QList items = mDeleteBackupWidget->selectionIndexes(); + if (items.count() > 0) { + mLeftAction->setEnabled(true); + mDeleteAction->setEnabled(true); + } else { + mLeftAction->setEnabled(false); + mDeleteAction->setEnabled(false); + } +} + +void FmDeleteBackupView::initToolBar() +{ + mLeftAction = new HbAction( this ); + mLeftAction->setObjectName( "leftAction" ); + mLeftAction->setText( hbTrId( "delete" ) ); + toolBar()->addAction( mLeftAction ); + mLeftAction->setEnabled(false); + toolBar()->setOrientation( Qt::Horizontal ); + + connect( mLeftAction, SIGNAL(triggered()), this, SLOT( on_leftAction_triggered() ), Qt::QueuedConnection ); +} + +void FmDeleteBackupView::on_leftAction_triggered() +{ + on_deleteAction_triggered(); +} + +#ifdef FM_CHANGE_ORIENT_ENABLE +void FmDeleteBackupView::on_rotateAction_triggered() +{ + if ( mainWindow()->orientation() == Qt::Vertical ) { + mainWindow()->setOrientation( Qt::Horizontal ); + } + else { + mainWindow()->setOrientation( Qt::Vertical ); + } +} +#endif + +void FmDeleteBackupView::on_deleteAction_triggered() +{ + QList items = mDeleteBackupWidget->selectionIndexes(); + if( items.count() <= 0 || !FmDlgUtils::question( hbTrId("Confirm Deletion?" ) ) ){ + return; + } + + quint64 selection( 0 ); + for ( int i( 0 ); i < items.count(); ++i ) + { + selection |= ( ( quint64 ) 1 ) << ( items[ i ] ); + } + + mOperationService->syncDeleteBackup( selection ); + mDeleteBackupWidget->refresh(); + on_deleteBackupWidget_stateChanged(0); +} + +void FmDeleteBackupView::removeToolBarAction() +{ + toolBar()->removeAction( mLeftAction ); +} + +void FmDeleteBackupView::refreshDeleteBackupView() +{ + mDeleteBackupWidget->refresh(); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,63 @@ +/* + * 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: + * The header file of the delete backup view of file manager + */ + +#ifndef FMDELETEBACKUPVIEW_H +#define FMDELETEBACKUPVIEW_H + +#include "fmoperationservice.h" +#include "fmviewbase.h" + +class FmDeleteBackupWidget; +class FmOperationService; +class HbAction; + + +class FmDeleteBackupView : public FmViewBase +{ + Q_OBJECT + +public: + FmDeleteBackupView(); + ~FmDeleteBackupView(); + +private slots: + void on_leftAction_triggered(); + void on_deleteAction_triggered(); + void on_deleteBackupWidget_stateChanged(int state); + void refreshDeleteBackupView(); +#ifdef FM_CHANGE_ORIENT_ENABLE + void on_rotateAction_triggered(); +#endif + +private: + void initMenu(); + void initMainWidget(); + void initToolBar(); + void removeToolBarAction(); + +private: + + FmDeleteBackupWidget *mDeleteBackupWidget; + FmOperationService *mOperationService; + + HbAction *mDeleteAction; + HbAction *mLeftAction; +}; + +#endif + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,137 @@ +/* + * 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: + * The header file of the delete backup widget of file manager + */ +#include "fmdeletebackupwidget.h" +#include "fmrestoresettings.h" +#include "fmrestoreviewitem.h" +#include "fmoperationservice.h" +#include "fmviewmanager.h" +#include "fmbackupconfigloader.h" +#include "fmbkupengine.h" +#include "fmbackuprestorehandler.h" + +#include +#include +#include +#include + +FmDeleteBackupWidget::FmDeleteBackupWidget( HbWidget *parent ) +: HbWidget( parent ), mModel( 0 ) +{ + init(); +} + +FmDeleteBackupWidget::~FmDeleteBackupWidget() +{ + mListView->setModel( 0 ); + delete mModel; +} + +void FmDeleteBackupWidget::refresh() +{ + mListView->setModel( 0 ); + loadData(); + mListView->setModel( mModel ); + for (int i = 0; i < mModel->rowCount(); ++i) { + QModelIndex index = mModel->index(i); + FmRestoreViewItem* restoreViewItem = static_cast< FmRestoreViewItem* > + (mListView->itemByIndex(index)); + connect(restoreViewItem, SIGNAL(stateChanged(int)), this, SIGNAL(stateChanged(int))); + } + emit stateChanged(0); +} + +QList FmDeleteBackupWidget::selectionIndexes() +{ + QList selectionList; + + for ( int i=0; irowCount(); i++ ) { + FmRestoreViewItem *item = static_cast( + mListView->itemByIndex( mModel->index( i ) ) ); + if( item && item->getCheckBoxState() ) { + selectionList.push_back( i ); + } + } + + return selectionList; +} + +void FmDeleteBackupWidget::loadData() +{ + if( !mModel ) { + mModel = new QStringListModel(); + } + mModel->removeRows( 0, mModel->rowCount() ); + + mRestoreSettings = FmViewManager::viewManager()->operationService()->backupRestoreHandler()->bkupEngine()->RestoreSettingsL(); + mBackupConfigLoader = FmViewManager::viewManager()->operationService()->backupRestoreHandler()->backupConfigLoader(); + mRestoreSettings->load( mBackupConfigLoader->driversAndOperationList() ); + + int index = 0; + + QList< FmRestoreEntry* > retoreEntryList = mRestoreSettings->restoreEntryList(); + mModel->insertRows( 0, retoreEntryList.count() ); + + for ( QList< FmRestoreEntry* >::iterator it = retoreEntryList.begin(); + it != retoreEntryList.end(); ++it ){ + QString string = ( *it )->text(); + QDateTime datetime = ( *it )->restoreInfo().dateTime(); + QString drive = ( *it )->restoreInfo().drive(); + string.append( '\t' ); + string.append( datetime.toString( "hh:mm ap dd/MM/yyyy") ); + string.append( '\t' ); + string.append( drive ); + QVariant variant( string ); + mModel->setData( mModel->index( index ), variant, Qt::DisplayRole ); + ++index; + } + +} + +void FmDeleteBackupWidget::init() +{ + QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout( this ); + vLayout->setOrientation( Qt::Vertical ); + + mListView = new HbListView( this ); + connect( mListView, SIGNAL( activated( const QModelIndex & ) ), + this, SLOT( on_list_activated( const QModelIndex & ) ) ); + + mListView->setSelectionMode( HbAbstractItemView::MultiSelection ); + + vLayout->addItem( mListView ); + + loadData(); + mListView->setModel( mModel ); + + mListView->setItemPrototype( new FmRestoreViewItem( this ) ); + + +} + +void FmDeleteBackupWidget::on_list_activated( const QModelIndex &index ) +{ + FmRestoreViewItem *restoreViewItem = static_cast< FmRestoreViewItem* > + ( mListView->itemByIndex( index ) ); + + restoreViewItem->setCheckBoxState(); +} + +int FmDeleteBackupWidget::backupDataCount() +{ + return mModel->rowCount(); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,59 @@ +/* + * 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: + * The header file of the delete backup widget of file manager + */ + +#ifndef FMDELETEBACKUPWIDGET_H +#define FMDELETEBACKUPWIDGET_H + +#include + +class HbListView; +class QStringListModel; +class FmRestoreSettings; +class FmBackupConfigLoader; +class FmRestoreViewItem; + +class FmDeleteBackupWidget : public HbWidget +{ + Q_OBJECT + +public: + + explicit FmDeleteBackupWidget( HbWidget *parent = 0 ); + ~FmDeleteBackupWidget(); + void refresh(); + QList selectionIndexes(); + int backupDataCount(); +signals: + void stateChanged(int state); +private: + void loadData(); + void init(); + +private slots: + void on_list_activated( const QModelIndex &index ); + + +private: + HbListView *mListView; + QStringListModel *mModel; + + FmRestoreSettings *mRestoreSettings; + FmBackupConfigLoader *mBackupConfigLoader; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,150 @@ +/* + * 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: + * Zhiqiang Yang + * + * Description: + * The source file of the restore view of file manager + */ + +#include "fmrestoreview.h" +#include "fmrestorewidget.h" +#include "fmviewmanager.h" +#include "fmoperationbase.h" +#include "fmdlgutils.h" + +#include + +#include +#include +#include +#include + +FmRestoreView::FmRestoreView(): FmViewBase( ERestoreView ) +{ + setTitle( hbTrId( "Restore" ) ); + + initMainWidget(); + initToolBar(); + initMenu(); + mOperationService = FmViewManager::viewManager()->operationService(); +} + +FmRestoreView::~FmRestoreView() +{ + removeToolBarAction(); +} + +void FmRestoreView::initMenu() +{ +#ifdef FM_CHANGE_ORIENT_ENABLE + HbAction *action = 0; + action = new HbAction( this ); + action->setObjectName( "rotateAction" ); + action->setText( hbTrId( "Change orientation" ) ); + menu()->addAction( action ); + connect( action, SIGNAL(triggered()), this, SLOT( on_rotateAction_triggered() ), Qt::QueuedConnection ); +#endif + + mRestoreAction = new HbAction( this ); + mRestoreAction->setObjectName( "restoreAction" ); + mRestoreAction->setText( hbTrId( "Restore data" ) ); + menu()->addAction( mRestoreAction ); + mRestoreAction->setEnabled(false); + connect( mRestoreAction, SIGNAL(triggered()), this, SLOT( on_restoreAction_triggered() ), Qt::QueuedConnection ); +} + +void FmRestoreView::initMainWidget() +{ + mRestoreWigdet = new FmRestoreWigdet( this ); + + setWidget( mRestoreWigdet ); + connect(mRestoreWigdet, SIGNAL(stateChanged(int)), this, SLOT(onCheckBoxStateChange())); + +} + +void FmRestoreView::initToolBar() +{ + mLeftAction = new HbAction( this ); + mLeftAction->setObjectName( "leftAction" ); + mLeftAction->setText( hbTrId( "Restore" ) ); + toolBar()->addAction( mLeftAction ); + connect( mLeftAction, SIGNAL(triggered()), this, SLOT( on_leftAction_triggered() ), Qt::QueuedConnection ); + + mLeftAction->setEnabled(false); + toolBar()->setOrientation( Qt::Horizontal ); +} + +void FmRestoreView::on_leftAction_triggered() +{ + QList items = mRestoreWigdet->selectionIndexes(); + quint64 selection( 0 ); + for ( int i( 0 ); i < items.count(); ++i ) + { + selection |= ( ( quint64 ) 1 ) << ( items[ i ] ); + } + + int ret = mOperationService->asyncRestore( selection ); + switch( ret ) + { + case FmErrNone: + break; + case FmErrWrongParam: + FmDlgUtils::information( QString( hbTrId("Operation canceled with wrong param!") ) ); + break; + case FmErrAlreadyStarted: + FmDlgUtils::information( QString( hbTrId("Operation canceled because already started!") ) ); + break; + default: + FmDlgUtils::information(hbTrId("restore failed")); + break; + } +} + +#ifdef FM_CHANGE_ORIENT_ENABLE +void FmRestoreView::on_rotateAction_triggered() +{ + if ( mainWindow()->orientation() == Qt::Vertical ) { + mainWindow()->setOrientation( Qt::Horizontal ); + } + else { + mainWindow()->setOrientation( Qt::Vertical ); + } +} +#endif + +void FmRestoreView::on_restoreAction_triggered() +{ + on_leftAction_triggered(); +} + +void FmRestoreView::removeToolBarAction() +{ + toolBar()->removeAction( mLeftAction ); +} + +void FmRestoreView::onCheckBoxStateChange() +{ + QList items = mRestoreWigdet->selectionIndexes(); + if (items.count() > 0) { + mLeftAction->setEnabled(true); + mRestoreAction->setEnabled(true); + } else { + mLeftAction->setEnabled(false); + mRestoreAction->setEnabled(false); + } +} + +void FmRestoreView::refreshRestoreView() +{ + mRestoreWigdet->refresh(); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmrestoreview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreview.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,61 @@ +/* + * 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: + * The header file of the restore view of file manager + */ + +#ifndef FMRESTOREVIEW_H +#define FMRESTOREVIEW_H + +#include "fmoperationservice.h" +#include "fmviewbase.h" + +class FmRestoreWigdet; +class FmOperationService; + + +class FmRestoreView : public FmViewBase +{ + Q_OBJECT + +public: + FmRestoreView(); + ~FmRestoreView(); + +private slots: + void on_leftAction_triggered(); + void on_restoreAction_triggered(); + void onCheckBoxStateChange(); + void refreshRestoreView(); +#ifdef FM_CHANGE_ORIENT_ENABLE + void on_rotateAction_triggered(); +#endif + +private: + void initMenu(); + void initMainWidget(); + void initToolBar(); + void removeToolBarAction(); + +private: + + FmRestoreWigdet *mRestoreWigdet; + FmOperationService *mOperationService; + HbAction *mRestoreAction; + HbAction *mLeftAction; +}; + +#endif + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * + * Description: + * The source file of the restore view list item of file manager + */ +#include "fmrestoreviewitem.h" +#include "fmfileiconprovider.h" +#include +#include +#include +#include +#include +#include + +//FmRestoreViewItem +FmRestoreViewItem::FmRestoreViewItem( QGraphicsItem *parent ) + : HbListViewItem( parent ), + mRestoreContentLabel( 0 ), + mDateTimeLabel( 0 ), + mCheckBox( 0 ), + hLayout( 0 ), + mParentWidget((HbWidget *)parent) +{ + //init(); +} + +FmRestoreViewItem::~FmRestoreViewItem() +{ +} + + +HbAbstractViewItem *FmRestoreViewItem::createItem() +{ + return new FmRestoreViewItem( *this ); +} + +void FmRestoreViewItem::polish(HbStyleParameters& params) +{ + Q_UNUSED(params); +} + +void FmRestoreViewItem::updateChildItems() +{ + if( !hLayout ) { + init(); + } + QString string = modelIndex().data( Qt::DisplayRole ).toString(); + + QStringList stringList = string.split( '\t' ); + + if( stringList.count() == 0 ){ + return; + } + + mRestoreContentLabel->setPlainText(stringList.first()); + + if (stringList.size() > 0) + { + mDateTimeLabel->setPlainText(stringList.at(1)); + } + if (stringList.size() > 1) + { + QIcon icon = mIconProvider->icon(QFileInfo(stringList.at(2))); + // FmFileIconProvider already handle null icon issue + mIconLabel->setIcon(HbIcon(icon)); + } + + connect(this, SIGNAL(stateChanged(int)), mParentWidget, + SIGNAL(stateChanged(int))); + +} + +void FmRestoreViewItem::init() +{ + mIconProvider = new FmFileIconProvider(); + hLayout = new QGraphicsLinearLayout(); + hLayout->setOrientation(Qt::Horizontal); + hLayout->addItem(layout()); + + mCheckBox = new HbCheckBox(this); + hLayout->addItem(mCheckBox); + hLayout->setAlignment(mCheckBox, Qt::AlignVCenter); + + QGraphicsGridLayout *vLayout = new QGraphicsGridLayout(); + + mRestoreContentLabel = new HbLabel(""); + mRestoreContentLabel->setFontSpec(HbFontSpec(HbFontSpec::Primary)); + + mIconLabel = new HbLabel(); + + mDateTimeLabel = new HbLabel(""); + mDateTimeLabel->setFontSpec(HbFontSpec(HbFontSpec::Secondary)); + + vLayout->addItem(mRestoreContentLabel, 0, 0); + vLayout->addItem(mIconLabel, 0, 1); + vLayout->addItem(mDateTimeLabel, 1, 0); + + HbWidget *textWidget = new HbWidget(); + textWidget->setLayout(vLayout); + + hLayout->addItem(textWidget); + hLayout->setAlignment(textWidget, Qt::AlignVCenter); + + connect(mCheckBox, SIGNAL(stateChanged(int)), this, + SIGNAL(stateChanged(int))); + setLayout(hLayout); +} + +void FmRestoreViewItem::setCheckBoxState() +{ + if ( mCheckBox->checkState() == Qt::Unchecked ){ + mCheckBox->setCheckState( Qt::Checked ); + setSelected( true ); + } + else if( mCheckBox->checkState() == Qt::Checked ){ + mCheckBox->setCheckState( Qt::Unchecked ); + setSelected( false ); + } +} + +bool FmRestoreViewItem::getCheckBoxState() +{ + if( mCheckBox->checkState() == Qt::Unchecked ) { + return false; + } else { + return true; + } +} + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,65 @@ +/* + * 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: + * The header file of the restore view list item of file manager + */ + +#ifndef FMRESTOREVIEWITEM_H +#define FMRESTOREVIEWITEM_H + +#include + +class HbLabel; +class HbCheckBox; +class HbLineEdit; +class QGraphicsLinearLayout; +class HbWidget; +class FmFileIconProvider; +//FmRestoreViewItem +class FmRestoreViewItem : public HbListViewItem +{ + Q_OBJECT + +public: + FmRestoreViewItem( QGraphicsItem *parent = 0 ); + ~FmRestoreViewItem(); + +public: + virtual HbAbstractViewItem *createItem(); + virtual void updateChildItems(); + void setCheckBoxState(); + bool getCheckBoxState(); +signals: + void stateChanged(int); + + +private: + virtual void polish(HbStyleParameters& params); + +private: + void init(); + +private: + HbLabel *mRestoreContentLabel; + HbLabel *mDateTimeLabel; + + HbCheckBox *mCheckBox; + QGraphicsLinearLayout *hLayout; + HbWidget *mParentWidget; + HbLabel *mIconLabel; + FmFileIconProvider *mIconProvider; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmrestorewidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestorewidget.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,160 @@ +/* + * 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: + * The header file of the restore widget of file manager + */ +#include "fmrestorewidget.h" +#include "fmrestoresettings.h" +#include "fmbackupsettings.h" +#include "fmrestoreviewitem.h" +#include "fmoperationservice.h" +#include "fmviewmanager.h" + +#include "fmbackupconfigloader.h" +#include "fmbkupengine.h" +#include "fmbackuprestorehandler.h" + +#include +#include +#include + +#include + + + +FmRestoreWigdet::FmRestoreWigdet( QGraphicsItem *parent ) +: HbWidget( parent ) +{ + init(); +} + +FmRestoreWigdet::~FmRestoreWigdet() +{ +} + +QList FmRestoreWigdet::selectionIndexes() +{ + QList selectionList; + + for ( int i=0; irowCount(); i++ ) { + FmRestoreViewItem *item = static_cast( + mListView->itemByIndex( mModel->index( i ) ) ); + if( item && item->getCheckBoxState() ) { + selectionList.push_back( i ); + } + } + + return selectionList; +} + +void FmRestoreWigdet::init() +{ + QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout( this ); + vLayout->setOrientation( Qt::Vertical ); + + mListView = new HbListView( this ); + connect( mListView, SIGNAL( activated( const QModelIndex & ) ), + this, SLOT( on_list_activated( const QModelIndex & ) ) ); + + mListView->setSelectionMode( HbAbstractItemView::MultiSelection ); + + vLayout->addItem( mListView ); + + mModel = new QStringListModel(); + mListView->setModel( mModel ); + mRestoreSettings = FmViewManager::viewManager()->operationService()->backupRestoreHandler()->bkupEngine()->RestoreSettingsL(); + mBackupConfigLoader = FmViewManager::viewManager()->operationService()->backupRestoreHandler()->backupConfigLoader(); + + // load backup settings to refresh default target drive + FmViewManager::viewManager()->operationService()->backupRestoreHandler()->bkupEngine()->BackupSettingsL()->load(); + mRestoreSettings->load( mBackupConfigLoader->driversAndOperationList() ); + + int index = 0; + + QList< FmRestoreEntry* > retoreEntryList = mRestoreSettings->restoreEntryList(); + mModel->insertRows( 0, retoreEntryList.count() ); + + for ( QList< FmRestoreEntry* >::iterator it = retoreEntryList.begin(); + it != retoreEntryList.end(); ++it ){ + QString string = ( *it )->text(); + QDateTime datetime = ( *it )->restoreInfo().dateTime(); + string.append( '\t' ); + string.append( datetime.toString( "hh:mm ap dd/MM/yyyy") ); + QString drive = ( *it )->restoreInfo().drive(); + string.append( '\t' ); + string.append( drive ); + QVariant variant( string ); + + mModel->setData( mModel->index( index ), variant, Qt::DisplayRole ); + + ++index; + } + + mListView->setItemPrototype( new FmRestoreViewItem(this) ); +} + +void FmRestoreWigdet::on_list_activated( const QModelIndex &index ) +{ + FmRestoreViewItem *restoreViewItem = static_cast< FmRestoreViewItem* > + ( mListView->itemByIndex( index ) ); + + restoreViewItem->setCheckBoxState(); +} + +int FmRestoreWigdet::backupDataCount() +{ + return mModel->rowCount(); +} + +void FmRestoreWigdet::refresh() +{ + mListView->setModel( 0 ); + if( !mModel ) { + mModel = new QStringListModel(); + } + mModel->removeRows( 0, mModel->rowCount() ); + + mRestoreSettings = FmViewManager::viewManager()->operationService()->backupRestoreHandler()->bkupEngine()->RestoreSettingsL(); + mBackupConfigLoader = FmViewManager::viewManager()->operationService()->backupRestoreHandler()->backupConfigLoader(); + mRestoreSettings->load( mBackupConfigLoader->driversAndOperationList() ); + + int index = 0; + QList< FmRestoreEntry* > retoreEntryList = mRestoreSettings->restoreEntryList(); + mModel->insertRows( 0, retoreEntryList.count() ); + for ( QList< FmRestoreEntry* >::iterator it = retoreEntryList.begin(); + it != retoreEntryList.end(); ++it ){ + QString string = ( *it )->text(); + QDateTime datetime = ( *it )->restoreInfo().dateTime(); + QString drive = ( *it )->restoreInfo().drive(); + string.append( '\t' ); + string.append( datetime.toString( "hh:mm ap dd/MM/yyyy") ); + string.append( '\t' ); + string.append( drive ); + QVariant variant( string ); + mModel->setData( mModel->index( index ), variant, Qt::DisplayRole ); + ++index; + } + mListView->setModel( mModel ); + mListView->setItemPrototype( new FmRestoreViewItem( this ) ); + + for (int i = 0; i < mModel->rowCount(); ++i) { + QModelIndex index = mModel->index(i); + FmRestoreViewItem* restoreViewItem = static_cast< FmRestoreViewItem* > + (mListView->itemByIndex(index)); + connect(restoreViewItem, SIGNAL(stateChanged(int)), this, SIGNAL(stateChanged(int))); + } + emit stateChanged(0); + +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/backuprestore/fmrestorewidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestorewidget.h Tue Aug 31 15:06:05 2010 +0300 @@ -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: + * The header file of the restore widget of file manager + */ + +#ifndef FMRESTOREWIDGET_H +#define FMRESTOREWIDGET_H + +#include + +class HbListView; +class QStringListModel; +class FmRestoreSettings; +class FmBackupConfigLoader; + +class FmRestoreWigdet : public HbWidget +{ + Q_OBJECT + +public: + FmRestoreWigdet( QGraphicsItem *parent = 0 ); + ~FmRestoreWigdet(); + + QList selectionIndexes(); + int backupDataCount(); + void refresh(); +private: + void init(); + +signals: + void stateChanged(int state); + +private slots: + void on_list_activated( const QModelIndex &index ); + +private: + HbListView *mListView; + QStringListModel *mModel; + + FmRestoreSettings *mRestoreSettings; + FmBackupConfigLoader *mBackupConfigLoader; +}; + +#endif // FMRESTOREWIDGET_H diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmcombinedquery.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmcombinedquery.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,200 @@ +/* + * 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: + * The source file of combined query of file manager + */ + +#include "fmcombinedquery.h" + +#include + +#include +#include +#include +#include + +FmCombinedQuery::FmCombinedQuery( QGraphicsItem *parent ) : FmDialog( parent ), + mSelectMode ( MultiSelectMode ), mDominantIndex ( -1 ) +{ + setObjectName( "combinedQueryDialog" ); + mContentWidget = new QGraphicsWidget(); + mContentWidget->setObjectName( "CombinedQueryContentWidget" ); + setContentWidget(mContentWidget); + + QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout(); + vLayout->setOrientation( Qt::Vertical ); + + mListWidget = new HbListWidget(); + vLayout->addItem( mListWidget ); + + mListWidget->setFontSpec( HbFontSpec( HbFontSpec::Primary ) ); + mListWidget->setObjectName( "CombinedQueryListWidget" ); + this->setTimeout( NoTimeout ); + mContentWidget->setLayout( vLayout ); + + setSelectMode( mSelectMode ); + connect( mListWidget, SIGNAL( activated ( const QModelIndex& ) ), this, SLOT( activated( const QModelIndex& ) ) ); + connect( this, SIGNAL( doCheckForPrimaryAction () ), this, SLOT( checkForPrimaryAction() ), Qt::QueuedConnection ); + this->setDismissPolicy( NoDismiss ); + + doCheckForPrimaryAction(); +} + +void FmCombinedQuery::setSelectMode( SelectMode mode ) +{ + mSelectMode = mode; + switch ( mSelectMode ) + { + case SingleSelectMode: + mListWidget->setSelectionMode( HbAbstractItemView::SingleSelection ); + break; + + case MultiSelectMode: + mListWidget->setSelectionMode( HbAbstractItemView::MultiSelection ); + break; + + case NoSelectMode: + default: + mListWidget->setSelectionMode( HbAbstractItemView::NoSelection ); + break; + } +} + +FmCombinedQuery::~FmCombinedQuery(void) +{ +} + +void FmCombinedQuery::setMarkedListItem( int row, bool mark ) +{ + QModelIndex index = mListWidget->model()->index( row, 0 ); + if ( mark ){ + mListWidget->selectionModel()->select( index, QItemSelectionModel::Select ); + } + else{ + mListWidget->selectionModel()->select( index, QItemSelectionModel::Deselect ); + } +} + +void FmCombinedQuery::setDominantIndex( int index ) +{ + mDominantIndex = index; +} + +void FmCombinedQuery::setListItems( const QMap< int, QString > &list ) +{ + mListWidget->clear(); + + for( QMap< int, QString >::const_iterator it = list.begin(); + it != list.end(); ++it ){ + HbListWidgetItem* modelItem = new HbListWidgetItem(); + if( !modelItem ){ + return; + } + + modelItem->setText( it.value() ); + modelItem->setData( it.key() ); + + mListWidget->addItem( modelItem ); + } +} + +void FmCombinedQuery::activated( const QModelIndex &index ) +{ + int selectedRow = index.row(); + if( selectedRow == mDominantIndex ){ + QModelIndexList modelIndexList = mListWidget->selectionModel()->selectedIndexes(); + for( QModelIndexList::const_iterator it = modelIndexList.begin(); it != modelIndexList.end(); ++it ){ + if( ( *it ) == index ){ + mListWidget->clearSelection(); + setMarkedListItem( selectedRow ); + } + } + } + else if( mDominantIndex >= 0 ){ + setMarkedListItem( mDominantIndex, false ); + } + + emit doCheckForPrimaryAction(); +} + +QStringList FmCombinedQuery::selectedValues() const +{ + QStringList selList; + QItemSelectionModel *selectionModel = 0; + QList selIndexes; + + if( !mListWidget ){ + return selList; + } + + selectionModel = mListWidget->selectionModel(); + + if( selectionModel ){ + QModelIndexList indexes = selectionModel->selectedIndexes(); + int count = indexes.count(); + QModelIndex index; + for( int i = 0; i < count; ++i ){ + index = indexes[i]; + HbListWidgetItem *item = mListWidget->item( index.row() ); + if (item) { + QString text = item->text(); + selList.append( text ); + } + } + } + + return selList; +} + + +QList FmCombinedQuery::selectedKeys() const +{ + QList selList; + QItemSelectionModel *selectionModel = 0; + QList selIndexes; + + if( !mListWidget ){ + return selList; + } + + selectionModel = mListWidget->selectionModel(); + + if( selectionModel ){ + QModelIndexList indexes = selectionModel->selectedIndexes(); + int count = indexes.count(); + QModelIndex index; + for( int i = 0; i < count; ++i ){ + index = indexes[i]; + HbListWidgetItem *item = mListWidget->item( index.row() ); + if ( item ) { + int key = item->data().toInt(); + selList.append( key ); + } + } + } + + return selList; +} + +void FmCombinedQuery::checkForPrimaryAction() +{ + QItemSelectionModel *selectionModel = mListWidget->selectionModel(); + + if( selectionModel->selectedIndexes().count() <= 0 ) { + primaryAction()->setDisabled( true ); + } else { + primaryAction()->setDisabled( false ); + } +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmcombinedquery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmcombinedquery.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,119 @@ +/* + * 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: + * The header file of combined query of of file manager + */ +#ifndef FMCOMBINEDQUERY_H +#define FMCOMBINEDQUERY_H + +#include "fmcommon.h" +#include "fmdialog.h" + +#include +#include +#include +#include + +class HbListWidget; +class QGraphicsWidget; + +// CLASS DECLARATION +/** + * This class is used for popup query dialog + * Support multi, single select + * + */ +class FmCombinedQuery : public FmDialog +{ + Q_OBJECT +public: + enum SelectMode + { + NoSelectMode = 0, + SingleSelectMode = 1, + MultiSelectMode = 2, + }; + + FmCombinedQuery( QGraphicsItem *parent = 0 ); + ~FmCombinedQuery( void ); + + /** + * Set select mode + * @param mode select mode + * @see SelectMode + */ + void setSelectMode( SelectMode mode ); + + /** + * Set select mode + * @param mode select mode + * @return return select mode + * @see SelectMode + */ + inline SelectMode selectMode() const + { + return mSelectMode; + } + + /** + * Set one row as marked + * @param row the row number which need be marked + */ + void setMarkedListItem( int row, bool mark = true ); + + /** + * Set dominant index for query list, if click dominant item, clear check status of other items. + * @param index dominant index + */ + void setDominantIndex( int index ); + + /** + * Set list item data + * @param list item data as QMap, key is the userdata of list item as value will be displayed. + * @see selectedValues + * @see selectedKeys + */ + void setListItems(const QMap< int, QString > &list); + + /** + * Fetch the selected result of vaules from QMap those are set by setListItems function + * @return QStringList of selected values + * @see setListItems + * @see selectedKeys + */ + QStringList selectedValues() const; + + /** + * Fetch the selected result of keys from QMap those are set by setListItems function + * @return QList with int of selected keys + * @see setListItems + * @see selectedValues + */ + QList selectedKeys() const; + +signals: + void doCheckForPrimaryAction(); + +public slots: + void activated(const QModelIndex &index); + void checkForPrimaryAction(); +private: + SelectMode mSelectMode; /// select mode , MultiSelectMode is default value + QGraphicsWidget *mContentWidget; /// Content widget of popup dialog + HbListWidget *mListWidget; /// list widget + int mDominantIndex; /// index of dominant item. -1 for none +}; + +#endif //FMCOMBINEDQUERY_H diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmdialog.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,91 @@ +/* + * 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: + * The source file of filemanager base dialog class + */ + +#include "fmdialog.h" +#include + +FmDialog::FmDialog( QGraphicsItem *parent) : HbDialog( parent ), mRetAction( 0 ) +{ + +} + +HbAction *FmDialog::exec() +{ + HbDialog::open( this, SLOT(dialogClosed(HbAction*)) ); + mEventLoop.exec(); + return mRetAction; +} + +void FmDialog::dialogClosed(HbAction *action) +{ + mRetAction = action; + mEventLoop.exit(); +} + +HbAction *FmDialog::primaryAction() const +{ + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() > 0) { + return (HbAction *)(actionList.at(0)); + } else { + return 0; + } + +} + +void FmDialog::setPrimaryAction( HbAction *action ) +{ + action->setObjectName( "primaryAction" ); + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() == 0) { + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 1) { + actionList.clear(); + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 2) { + actionList.removeAt(0); + actionList.insert(0, action); + } +} + +HbAction *FmDialog::secondaryAction() const +{ + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() > 1) { + return (HbAction *)(actionList.at(1)); + } else { + return 0; + } +} + +void FmDialog::setSecondaryAction( HbAction *action ) +{ + action->setObjectName( "secondaryAction" ); + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() == 0) { + HbAction *primaryAction = new HbAction(hbTrId("txt_common_button_ok")); + primaryAction->setObjectName( "primaryAction" ); + QGraphicsWidget::addAction(primaryAction); + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 1) { + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 2) { + actionList.removeAt(1); + actionList.insert(1, action); + } +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmdialog.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,45 @@ +/* + * 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: + * The header file of filemanager base dialog class + */ + +#ifndef FMDIALOG_H +#define FMDIALOG_H + +#include +#include +#include +#include +class FmDialog : public HbDialog +{ +Q_OBJECT +public: + explicit FmDialog( QGraphicsItem *parent = 0 ); + HbAction *exec(); + + HbAction *primaryAction() const; + void setPrimaryAction( HbAction *action ); + + HbAction *secondaryAction() const; + void setSecondaryAction( HbAction *action ); +public slots: + void dialogClosed(HbAction *action); +private: + QEventLoop mEventLoop; + HbAction *mRetAction; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmdlgutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmdlgutils.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,495 @@ +/* + * 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: + * The source file of the query sdialog utility of file manager + */ + +#include "fmdlgutils.h" +#include "fmcombinedquery.h" +#include "fmtimequery.h" +#include "fmsingletextquery.h" +#include "fmmultitextquery.h" +#include "fmutils.h" +#include "fmviewmanager.h" +#include "fmmessagebox.h" +#include "fmdrivequery.h" + +#include +#include +#include + +#include +#include + +/* + Private Constructor +*/ +FmDlgUtils::FmDlgUtils() +{ +} + +/*! + Destructor +*/ +FmDlgUtils::~FmDlgUtils() +{ +} + +/*! + Shows single select setting query dialog + \a title used for title text + \a textList used for text list for available settings + \a selectedIndex used for storing selected index + Dialog will be closed as canceled while drive in \a associatedDrives is removed + return true if selection made, otherwise false +*/ +bool FmDlgUtils::showSingleSettingQuery( + const QString &title, + const QStringList &textList, + int &selectedIndex, const QString &associatedDrives ) +{ + bool ret( false ); + + int i = 0; + QMap< int, QString > items; // Maps list item with corresponding text in viewer + for( QStringList::const_iterator it = textList.begin(); it!= textList.end(); ++it ){ + items.insert( i, *it ); + ++i; + } + bool ok ( false ); // SK return (out parameter) + + FmCombinedQuery *cQuery=new FmCombinedQuery; + cQuery->setSelectMode( FmCombinedQuery::SingleSelectMode ); + cQuery->setHeadingWidget( new HbLabel( title ) ); + cQuery->setListItems( items ); + + if( selectedIndex != -1 ){ + cQuery->setMarkedListItem( selectedIndex ); + } + + QString sk1 ( hbTrId( "txt_common_button_ok" ) ); + QString sk2 ( hbTrId("txt_common_button_cancel" ) ); + + if( !sk1.isEmpty() ) { + HbAction *primary = new HbAction( sk1 ); + cQuery->setPrimaryAction( primary ); + } + + if( !sk2.isEmpty() ) { + HbAction *secondary = new HbAction( sk2 ); + cQuery->setSecondaryAction( secondary ); + } + + //HbAction* action = cQuery->exec(); + HbAction* action = executeDialog( cQuery, associatedDrives ); + if( action == cQuery->primaryAction() ){ + ok = true; + } + else{ + ok = false; + } + if( ok ){ + //get selected key list. + QList selectedKeyList = cQuery->selectedKeys(); + + // Get new selection and notify changes + int selectionResult( 0 ); + int i = 0; + for ( QMap< int, QString >::const_iterator it = items.begin(); it != items.end(); ++it ){ + // if one item has been selected( judge if the key is in the selected key list) + if ( selectedKeyList.indexOf( it.key() ) >= 0 ) { + selectionResult = i; + break; + } + ++i; + } + if ( selectionResult != selectedIndex ){ + selectedIndex = selectionResult; + ret = true; + } + } + delete cQuery; + return ret; +} + +/*! + Shows multi select setting query dialog + \a title used for title text + \a textList used for text list for available settings + \a selection used for storing selected indexes as bitmask + \a dominantIndex used for dominant index for select all behaviour + Dialog will be closed as canceled while drive in \a associatedDrives is removed + return true if selection made, otherwise false +*/ +bool FmDlgUtils::showMultiSettingQuery( + const QString &title, + const QStringList &textList, + quint32 &selection, + int dominantIndex, const QString &associatedDrives ) +{ + bool ret( false ); + + int i = 0; + QMap items; // Maps list item with corresponding text in viewer + for( QStringList::const_iterator it = textList.begin(); it!= textList.end(); ++it){ + items.insert( i, *it ); + ++i; + } + bool ok ( false ); // SK return (out parameter) + + FmCombinedQuery *cQuery=new FmCombinedQuery; + cQuery->setSelectMode( FmCombinedQuery::MultiSelectMode ); + cQuery->setHeadingWidget( new HbLabel( title ) ); + cQuery->setListItems( items ); + cQuery->setDominantIndex( dominantIndex ); + + // Create selection array + int count( textList.count() ); + for ( int i( 0 ); i < count; ++i ){ + if ( selection & ( 1 << i ) ){ + cQuery->setMarkedListItem( i ); + } + } + + + QString sk1 ( hbTrId( "txt_common_button_ok" ) ); + QString sk2 ( hbTrId( "txt_common_button_cancel" ) ); + + if( !sk1.isEmpty() ) { + HbAction *primary = new HbAction( sk1 ); + cQuery->setPrimaryAction( primary ); + } + + if( !sk2.isEmpty() ) { + HbAction *secondary = new HbAction( sk2 ); + cQuery->setSecondaryAction( secondary ); + } + + HbAction* action = executeDialog( cQuery, associatedDrives ); + if( action == cQuery->primaryAction() ){ + ok = true; + } + else{ + ok = false; + } + if( ok ) + { + //get selected key list. + QList selectedKeyList = cQuery->selectedKeys(); + + // Get new selection and notify changes + quint32 selectionResult( 0 ); + int i = 0; + for ( QMap< int, QString >::const_iterator it = items.begin(); it != items.end(); ++it ){ + // if one item has been selected( judge if the key is in the selected key list) + if ( selectedKeyList.indexOf( it.key() ) >= 0 ) { + selectionResult |= 1 << i; + } + ++i; + } + if ( selectionResult != selection ){ + selection = selectionResult; + ret = true; + } + } + delete cQuery; + return ret; +} + +/*! + Shows time setting query dialog + \a title used for title text + \a time used for selected time + Dialog will be closed as canceled while drive in \a associatedDrives is removed + return true if selection made, otherwise false +*/ +bool FmDlgUtils::showTimeSettingQuery( + const QString &title, QTime &time, const QString &associatedDrives ) +{ + bool ret( false ); + bool ok ( false ); // SK return (out parameter) + + FmTimeQuery *cQuery=new FmTimeQuery; + cQuery->setHeadingWidget( new HbLabel( title ) ); + cQuery->setTime( time ); + + QString sk1 ( hbTrId( "txt_common_button_ok" ) ); + QString sk2 ( hbTrId( "txt_common_button_cancel" ) ); + + if( !sk1.isEmpty() ) { + HbAction *primary = new HbAction( sk1 ); + cQuery->setPrimaryAction( primary ); + } + + if( !sk2.isEmpty() ) { + HbAction *secondary = new HbAction( sk2 ); + cQuery->setSecondaryAction( secondary ); + } + + HbAction* action = executeDialog( cQuery, associatedDrives ); + if( action == cQuery->primaryAction() ){ + ok = true; + } + else{ + ok = false; + } + if( ok ) + { + QTime resultTime = cQuery->getTime(); + if ( resultTime != time ){ + time = resultTime; + ret = true; + } + } + delete cQuery; + return ret; +} + +/*! + Shows text query dialog + \a title used for title text + \a text used for receiving user input text + \a validRegExpStringList used for set valid regExp string list + \a maxLength used for setting max length of input text + Dialog will be closed as canceled while drive in \a associatedDrives is removed + Set \a isReturnFalseWhenNoTextChanged true if need make return value as true while no text changed + return true if text change is made, otherwise false +*/ +bool FmDlgUtils::showTextQuery( + const QString& title, QString& text, QStringList validRegExpStringList, + int maxLength, const QString &associatedDrives, bool isReturnFalseWhenNoTextChanged ) +{ + bool ret( false ); + bool ok ( true ); // SK return (out parameter) + + FmSingleTextQuery *cQuery = new FmSingleTextQuery(); + if( maxLength != -1 ){ + cQuery->setLineEditMaxLength( maxLength ); + } + cQuery->setHeadingWidget( new HbLabel( title ) ); + + cQuery->setRegExpStringList( validRegExpStringList ); + + QString sk1 ( hbTrId ( "txt_common_button_ok" ) ); + QString sk2 ( hbTrId ( "txt_common_button_cancel" ) ); + + if( !sk1.isEmpty() ) { + HbAction *primary = new HbAction( sk1 ); + cQuery->setPrimaryAction( primary ); + } + + if( !sk2.isEmpty() ) { + HbAction *secondary = new HbAction( sk2 ); + cQuery->setSecondaryAction( secondary ); + } + cQuery->setLineEditText( text ); + cQuery->checkActions(); + + HbAction* action = executeDialog( cQuery, associatedDrives ); + if( action == cQuery->primaryAction() ){ + ok = true; + } + else{ + ok = false; + } + + if( ok ){ + QString newName = cQuery->getLineEditText(); + if ( newName == text ){ + if( isReturnFalseWhenNoTextChanged ) { + ret = false; + } + else { + ret = true; + } + } else { + text = newName; + ret = true; + } + } + delete cQuery; + return ret; +} + +/*! + Shows single-line password query dialog + \a title used for title text + \a pwd used for receiving user input password + \a maxLength used for setting max length of input password + Dialog will be closed as canceled while drive in \a associatedDrives is removed + return true if password text is inputted, otherwise false +*/ +bool FmDlgUtils::showSinglePasswordQuery( const QString &title, QString &pwd, int maxLength, const QString &associatedDrives ) +{ + bool ret( false ); + + FmSingleTextQuery *cQuery = new FmSingleTextQuery( HbLineEdit::Password ); + if( maxLength != -1 ){ + cQuery->setLineEditMaxLength( maxLength ); + } + cQuery->setHeadingWidget( new HbLabel( title ) ); + + // validate that length is not zero. space is acceptable character. + cQuery->setRegExpStringList( QStringList( Regex_ValidUnZeroLength ) ); + QString sk1 ( hbTrId("txt_common_button_ok" ) ); + QString sk2 ( hbTrId("txt_common_button_cancel" ) ); + + if( !sk1.isEmpty() ) { + HbAction *primary = new HbAction( sk1 ); + cQuery->setPrimaryAction( primary ); + } + + if( !sk2.isEmpty() ) { + HbAction *secondary = new HbAction( sk2 ); + cQuery->setSecondaryAction( secondary ); + } + cQuery->checkActions(); + + HbAction* action = executeDialog( cQuery, associatedDrives ); + if( action == cQuery->primaryAction() ){ + ret = true; + pwd = cQuery->getLineEditText(); + } + else{ + ret = false; + } + + delete cQuery; + return ret; +} + +/*! + Shows mulit-line password query dialog. If two password is not equal, primary action is dimmed + \a firstLabel used for first line title text + \a secondLabel used for second line title text + \a pwd used for receiving user input password + \a maxLength used for setting max length of input password + Dialog will be closed as canceled while drive in \a associatedDrives is removed + return true if password text is inputted, otherwise false +*/ +bool FmDlgUtils::showMultiPasswordQuery( + const QString &firstLabel, const QString &secondLabel, QString &pwd, int maxLength, const QString &associatedDrives ) +{ + bool ret( false ); + + FmMultiTextQuery *cQuery = new FmMultiTextQuery( HbLineEdit::Password ); + if( maxLength != -1 ){ + cQuery->setLineEditMaxLength( maxLength ); + } + cQuery->setFirstLabelText( firstLabel ); + cQuery->setSecondLabelText( secondLabel ); + + QString sk1 = ( hbTrId( "txt_common_button_ok" ) ); + QString sk2 = ( hbTrId( "txt_common_button_cancel" ) ); + + if( !sk1.isEmpty() ) { + HbAction *primary = new HbAction( sk1 ); + cQuery->setPrimaryAction( primary ); + } + + if( !sk2.isEmpty() ) { + HbAction *secondary = new HbAction( sk2 ); + cQuery->setSecondaryAction( secondary ); + } + cQuery->checkActions(); + + HbAction* action = executeDialog( cQuery, associatedDrives ); + if( action == cQuery->primaryAction() ){ + QString firstPwd = cQuery->getFirstEditText(); + QString secondPwd = cQuery->getSecondEditText(); + if ( firstPwd == secondPwd ){ + pwd = secondPwd; + ret = true; + } + } + else{ + ret = false; + } + + delete cQuery; + return ret; +} + +/*! + This is a convenience function for showing a question dialog with \a questionText + Default buttons are Yes and No. +*/ +bool FmDlgUtils::question( const QString &questionText, + HbMessageBox::StandardButtons buttons ) +{ + FmMessageBox msgBox; + return msgBox.question( questionText, buttons ); +} + +/*! + This is a convenience function for showing an information dialog with \a informationText + Default button is OK. +*/ +void FmDlgUtils::information( const QString &informationText, + HbMessageBox::StandardButtons buttons ) +{ + FmMessageBox msgBox; + return msgBox.information( informationText, buttons ); +} + +/*! + Shows query dialog for select backup drive + \a title used for title text + only backup target drives will be shown. + return selected drive, and empty string for cancel. +*/ +QString FmDlgUtils::showBackupDriveQuery( const QString& title ) +{ + QString ret; + + FmDriveQuery *cQuery = new FmDriveQuery(); + cQuery->setHeadingWidget( new HbLabel( title ) ); + + QString sk = ( hbTrId( "txt_common_button_cancel" ) ); + + HbAction *primary = new HbAction( sk ); + cQuery->setPrimaryAction( primary ); + + executeDialog( cQuery, QString() ); + ret = cQuery->selectedDrive(); + + delete cQuery; + return ret; +} + +/* + Private function used to popup \a dialog + If want popup dialog in class FmDlgUtils, please call this function. + Dialog will be closed as canceled while drive in \a associatedDrives is removed + return selected action. +*/ +HbAction *FmDlgUtils::executeDialog( FmDialog *dialog, const QString &associatedDrives ) +{ + for( int i = 0; i < associatedDrives.length(); i++ ) { + QString drive( associatedDrives[i] + QString( ":/" ) ); + if( !FmUtils::isDriveAvailable( drive ) ) { + FM_LOG( "executeDialog return 0_ " + associatedDrives ); + return 0; + } + } + + FmDlgCloseUnit dlgCloseUnit( dialog ); + dlgCloseUnit.addAssociatedDrives( associatedDrives ); + + FmViewManager::viewManager()->addDlgCloseUnit( &dlgCloseUnit ); + HbAction* action = dialog->exec(); + FmViewManager::viewManager()->removeDlgCloseUnit( &dlgCloseUnit ); + return action; +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmdlgutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmdlgutils.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,86 @@ +/* + * 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: + * The header file of the query dialog utility of file manager + */ + +#ifndef FMDLGUTILS_H +#define FMDLGUTILS_H + +#include "fmcommon.h" + +#include +#include +#include + +#include +#include + +class FmDialog; +class HbAction; + +/*! + \class FmDlgUtils + \brief The class FmDlgUtils is static utility class. Used to popup dialogs + */ +class FmDlgUtils : public QObject +{ + Q_OBJECT +public: + static bool showSingleSettingQuery( + const QString &title, + const QStringList &textList, + int &selectedIndex, + const QString &associatedDrives = QString() ); + + static bool showMultiSettingQuery( + const QString &title, + const QStringList &textList, + quint32 &selection, + int dominantIndex, + const QString &associatedDrives = QString() ); + + static bool showTimeSettingQuery( + const QString &title, QTime &time, + const QString &associatedDrives = QString() ); + + static bool showTextQuery( + const QString &title, QString &text, QStringList validRegExpStringList = QStringList( Regex_ValidUnEmpty ), + int maxLength = -1, const QString &associatedDrives = QString(), bool isReturnFalseWhenNoTextChanged = true ); + + static bool showSinglePasswordQuery( + const QString &title, QString &pwd, int maxLength = -1, + const QString &associatedDrives = QString() ); + + static bool showMultiPasswordQuery( + const QString &firstLabel, const QString &secondLabel, QString &pwd, int maxLength = -1, + const QString &associatedDrives = QString() ); + + static bool question( const QString &questionText, + HbMessageBox::StandardButtons buttons = HbMessageBox::Yes | HbMessageBox::No ); + + static void information( const QString &informationText, + HbMessageBox::StandardButtons buttons = HbMessageBox::Ok ); + + static QString showBackupDriveQuery( const QString& title ); + + ~FmDlgUtils(); +private: + FmDlgUtils(); + static HbAction *executeDialog( FmDialog *dialog, const QString &associatedDrives ); +}; + + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmdrivedetailstype.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmdrivedetailstype.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,225 @@ +/* + * 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: + * The source file of the drive details type + */ + +#include "fmdrivedetailstype.h" +#include "fmfiletyperecognizer.h" +#include "fmutils.h" + +#include +#include +#include + +int FmDriveDetailsContent::querySizeofContent( const QString &driveName, + QList &detailsSizeList, volatile bool *isStopped ) +{ + int err = FmErrNone; + detailsSizeList.clear(); + err = getDataSizeByTraversePath( driveName, detailsSizeList, isStopped ); + if( err != FmErrNone ) { + return err; + } + + QStringList dataPathList; + dataPathList.append( QString( FmViewDetail_Contacts ) ); + FmDriveDetailsDataGroup driveDetailsDataGroup( FmDriveDetailsSize::ETypeContacts, dataPathList ); + + err = getDataSizeByAbsolutePath(driveName, driveDetailsDataGroup, detailsSizeList, isStopped); + if( err != FmErrNone ) { + return err; + } + + return FmErrNone; +} +int FmDriveDetailsContent::getDataSizeByTraversePath( const QString &driveName, + QList &detailsSizeList, volatile bool *isStopped ) +{ + qint64 imageSize( 0 ); + qint64 soundSize( 0 ); + qint64 midpJavaSize( 0 ); + qint64 nativeAppsSize( 0 ); + qint64 videoSize( 0 ); + qint64 documentsSize( 0 ); + + FmFileTypeRecognizer fileTypeRecognizer; + + QList dirs; + dirs.append( QDir( driveName ) ); + + // traverse the whole drive + while (!dirs.isEmpty()) { + QDir::Filters filter = QDir::NoDotAndDotDot | QDir::AllEntries; + // do not summarize system and hidden files, these size will go into others category + // if( isSysHiddenIncluded ) { + // filter = filter | QDir::Hidden | QDir::System; + // } + + QFileInfoList infoList = dirs.first().entryInfoList( filter ); + for ( QFileInfoList::const_iterator it = infoList.begin(); it != infoList.end(); ++it ) { + if ( *isStopped ){ + return FmErrCancel; + } + + if ( it->isFile() ) { + FmFileTypeRecognizer::FileType fileType = + fileTypeRecognizer.getType( it->absoluteFilePath() ); + switch ( fileType ) + { + case FmFileTypeRecognizer::FileTypeImage: + imageSize += it->size(); + break; + case FmFileTypeRecognizer::FileTypeTone: + soundSize += it->size(); + break; + case FmFileTypeRecognizer::FileTypeJava: + midpJavaSize += it->size(); + break; + case FmFileTypeRecognizer::FileTypeSisx: + nativeAppsSize += it->size(); + break; + case FmFileTypeRecognizer::FileTypeVideo: + videoSize += it->size(); + break; + case FmFileTypeRecognizer::FileTypeText: + documentsSize += it->size(); + break; + default: + // do not need handle other type + break; + } + } + else if ( it->isDir() ) { + dirs.append( QDir( it->absoluteFilePath() ) ); + } + } + dirs.removeFirst(); + } + + // store result to detailsSizeList. + detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeImages, imageSize ) ) ; + detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeSoundFiles, soundSize ) ); + detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeMidpJava, midpJavaSize ) ); + detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeNativeApps, nativeAppsSize ) ); + detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeVideos, videoSize ) ); + detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeDocuments, documentsSize ) ); + return FmErrNone; +} + +int FmDriveDetailsContent::getDataSizeByAbsolutePath( const QString &driveName, + const FmDriveDetailsDataGroup &dataGroup, + QList &detailsSizeList, volatile bool *isStopped ) +{ + quint64 totalSize = 0; + QStringList typeFilter = dataGroup.pathList(); + + for( QStringList::const_iterator it = typeFilter.begin(); + it!= typeFilter.end(); ++it ) { + if ( *isStopped ){ + return FmErrCancel; + } + QString driver(FmUtils::removePathSplash(FmUtils::getDriveNameFromPath(driveName))); + QFileInfo fileInfo(QString(driver + (*it))); + if (fileInfo.exists()) { + totalSize += fileInfo.size(); + } + } + + detailsSizeList.append( new FmDriveDetailsSize( dataGroup.dataType(), totalSize ) ); + return FmErrNone; +} + +int FmFolderDetails::queryDetailOfContentList( const QStringList folderPathList,int &numofFolders, + int &numofFiles, quint64 &totalSize, + volatile bool *isStopped, bool isSysHiddenIncluded ) +{ + numofFolders = 0; + numofFiles = 0; + totalSize = 0; + + int tempNumofFolders = 0; + int tempNumofFiles = 0; + quint64 tempSize = 0; + + int ret = FmErrNone; + + foreach( const QString& folderPath, folderPathList ) { + QFileInfo fileInfo( folderPath ); + if( fileInfo.isDir() ){ + int tempNumofSubFolders = 0; + ret = getNumofSubfolders( folderPath, tempNumofSubFolders, + tempNumofFiles, tempSize, isStopped, isSysHiddenIncluded ); + tempNumofFolders = tempNumofSubFolders + 1; // add itself to folder count; + } else if( fileInfo.isFile() ) { + tempNumofFiles = 1; + tempSize = fileInfo.size(); + ret = FmErrNone; + } else { + ret = FmErrIsNotFileOrFolder; + } + if( ret != FmErrNone ) { + return ret; + } + numofFolders+= tempNumofFolders; + numofFiles += tempNumofFiles; + totalSize += tempSize; + + tempNumofFolders = 0; + tempNumofFiles = 0; + tempSize = 0; + } + + return ret; +} + +int FmFolderDetails::getNumofSubfolders( const QString &folderPath, int &numofSubFolders, + int &numofFiles, quint64 &sizeofFolder, + volatile bool *isStopped, bool isSysHiddenIncluded ) +{ + numofSubFolders = 0; + numofFiles = 0; + sizeofFolder = 0; + + QList dirs; + dirs.append( QDir( folderPath ) ); + + while (!dirs.isEmpty()) { + QDir::Filters filter = QDir::NoDotAndDotDot | QDir::AllEntries; + if( isSysHiddenIncluded ) { + filter = filter | QDir::Hidden | QDir::System; + } + + QFileInfoList infoList = dirs.first().entryInfoList( filter ); + for ( QFileInfoList::const_iterator it = infoList.begin(); it != infoList.end(); ++it ) { + if ( *isStopped ){ + return FmErrCancel; + } + + if ( it->isFile() ) { + ++numofFiles; + sizeofFolder += it->size(); + } + else if ( it->isDir() ) { + ++numofSubFolders; + dirs.append( QDir( it->absoluteFilePath() ) ); + } + } + + dirs.removeFirst(); + } + + return FmErrNone; +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmdrivedetailstype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmdrivedetailstype.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,194 @@ +/* + * 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: + * The header file of the drive details type + */ + +#ifndef FMDRIVEDETAILSTYPE_H +#define FMDRIVEDETAILSTYPE_H + +#include +#include +#include + +/* + \class FmDriveDetailsSize + \brief The class FmDriveDetailsSize used to store view details result. + */ +class FmDriveDetailsSize +{ +public: + enum TDataType{ + ETypeImages = 0, + ETypeSoundFiles, + ETypeMidpJava, + ETypeNativeApps, + ETypeVideos, + ETypeDocuments, + ETypeCalendar, + ETypeContacts, + ETypeMessages, + ETypeOthers + }; + +public: + FmDriveDetailsSize( TDataType dataType, quint64 size ) + : mDataType( dataType ), mSize( size ) {} + FmDriveDetailsSize( const FmDriveDetailsSize &other ) + { + *this = other; + } + + FmDriveDetailsSize &operator= ( const FmDriveDetailsSize &rhs ) + { + this->mDataType = rhs.mDataType; + this->mSize = rhs.mSize; + return *this; + } + + /*! + request the stored data type + */ + TDataType dataType() const { return mDataType; } + + /*! + request the stored size that related to data type + */ + quint64 size() const { return mSize; } + +private: + /*! + store the data type + */ + TDataType mDataType; + + /*! + store the size that related to mDataType + */ + quint64 mSize; +}; + +/* + \class FmDriveDetailsDataGroup + \brief The class FmDriveDetailsDataGroup used to store command of get size of absolute file path. + */ +class FmDriveDetailsDataGroup +{ +public: + FmDriveDetailsDataGroup( FmDriveDetailsSize::TDataType dataType, + QStringList filePathList ) + : mDataType( dataType ), mFilePath( filePathList ) + { + } + FmDriveDetailsDataGroup( const FmDriveDetailsDataGroup &other ) + { + *this = other; + } + + FmDriveDetailsDataGroup &operator= ( const FmDriveDetailsDataGroup &rhs ) + { + this->mDataType = rhs.mDataType; + this->mFilePath = rhs.mFilePath; + return *this; + } + + FmDriveDetailsSize::TDataType dataType() const { return mDataType; } + QStringList pathList() const { return mFilePath; } +private: + /*! + Store which data type does mFilePath belong to. + */ + FmDriveDetailsSize::TDataType mDataType; + + /*! + Store absolute file path that will used to calcuate whole data size related to mDataType + */ + QStringList mFilePath; +}; + +/* + \class FmDriveDetailsContent + \brief The class FmDriveDetailsContent is the interface of view details feature + */ +class FmDriveDetailsContent +{ +public: + /*! + Gets data size for drive + \a driveName which drive is searching + \a detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList + \a isStopped isStopped will be set as true if user cancel this operation + return Filemanage wide error. Please refer to fmdefine.h + */ + static int querySizeofContent( + const QString &driveName, QList &detailsSizeList, volatile bool *isStopped ); + +private: + /*! + Gets data size(related to file type,e.g. image, sound) by traverse designated drive name. + provide size except the path related to absolute path(getDataSizeByAbsolutePath) + \sa driveName which drive is searching + \a detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList + \a isStopped isStopped will be set as true if user cancel this operation + return Filemanage wide error. Please refer to fmdefine.h + */ + static int getDataSizeByTraversePath( const QString &driveName, + QList &detailsSizeList, volatile bool *isStopped ); + + /*! + Gets data size for single FmDriveDetailsDataGroup, the method is find file of absolute path + \a driveName which drive is searching + \a dataGroup which dataGroup is searching, for example, EGroupContacts... + \a detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList + \a isStopped isStopped will be set as true if user cancel this operation + return Filemanage wide error. Please refer to fmdefine.h + */ + static int getDataSizeByAbsolutePath( const QString &driveName, const FmDriveDetailsDataGroup &dataGroup, + QList &detailsSizeList, volatile bool *isStopped ); +}; + +class FmFolderDetails +{ +public: + + /*! + Gets details for a list of folders + \a folderPathList folder path list + \a numofFolders output how many folders and subfolders in the list + \a numofFiles output how many files in the list + \a totalSize output the total size + \a isStopped isStopped will be set as true if user cancel this operation + \a isSysHiddenIncluded will add QDir::Hidden | QDir::System into filter if true + return Filemanage wide error. Please refer to fmdefine.h + */ + static int queryDetailOfContentList( const QStringList folderPathList,int &numofFolders, + int &numofFiles, quint64 &totalSize, volatile bool *isStopped, bool isSysHiddenIncluded = false ); + /*! + Gets details for a folder + \a folderPath path of the folder + \a numofSubFolders output how many subfolders in the list, not include itself + \a numofFiles output how many files in the folder + \a sizeofFolder output the size of folder + \a isStopped isStopped will be set as true if user cancel this operation + \a isSysHiddenIncluded will add QDir::Hidden | QDir::System into filter if true + return Filemanage wide error. Please refer to fmdefine.h + */ + static int getNumofSubfolders( const QString &folderPath, int &numofSubFolders, + int &numofFiles, quint64 &sizeofFolder, + volatile bool *isStopped, bool isSysHiddenIncluded = false ); +}; + +#endif /* FMDRIVEDETAILSTYPE_H */ + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmdrivequery.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmdrivequery.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,96 @@ +/* + * 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: + * The source file of backup drive query of file manager + */ + +#include "fmdrivequery.h" +#include "fmviewmanager.h" +#include "fmbackuprestorehandler.h" + +#include +#include "hblistview.h" + +FmDriveQuery::FmDriveQuery( QGraphicsItem *parent ) : FmDialog( parent ) +{ + setObjectName( "driveQueryDialog" ); + mContentWidget = new QGraphicsWidget(); + mContentWidget->setObjectName( "driveQueryContentWidget" ); + setContentWidget(mContentWidget); + + QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout(); + vLayout->setOrientation( Qt::Vertical ); + + mListView = new HbListView(); + mListView->setObjectName( "driveQueryListView" ); + vLayout->addItem( mListView ); + + mListView->setFontSpec( HbFontSpec( HbFontSpec::Primary ) ); + + this->setTimeout( NoTimeout ); + mContentWidget->setLayout( vLayout ); + + connect( mListView, SIGNAL( activated ( const QModelIndex& ) ), this, SLOT( activated( const QModelIndex& ) ) ); + this->setDismissPolicy( NoDismiss ); + + + mDriveModel = new FmDriveModel( this, + FmDriveModel::FillWithVolume | FmDriveModel::FillWithDefaultVolume, this ); + mListView->setModel( mDriveModel ); + + // connect refreshModel signal of viewmanager for drive insert/remove event. + connect( FmViewManager::viewManager(), SIGNAL( refreshModel( QString ) ), + this, SLOT( refreshModel( QString ) ) ); +} + +FmDriveQuery::~FmDriveQuery(void) +{ + delete mDriveModel; + mDriveModel = 0; +} + +void FmDriveQuery::getDriveList( QStringList &driveList ) +{ + // provide drive list which is got from backup engine wrapper. + FmViewManager::viewManager()->operationService()->backupRestoreHandler()->getBackupDriveList( driveList ); +} + +void FmDriveQuery::activated( const QModelIndex &index ) +{ + QString driveName( mDriveModel->driveName( index ) ); + + // if drive is not available, ignore activate signal. + FmDriverInfo driveInfo = FmUtils::queryDriverInfo( driveName ); + if( !( driveInfo.driveState() & FmDriverInfo::EDriveAvailable ) ) { + return; + } + + mSelectedDrive = driveName; + close(); +} + +QString FmDriveQuery::selectedDrive() const +{ + return mSelectedDrive; +} + +void FmDriveQuery::refreshModel( QString path ) +{ + if( !path.isEmpty() ) { + // ignore non-empty refresh signal as it means change of folder/file, not drive. + return; + } + mDriveModel->refresh(); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmdrivequery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmdrivequery.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * + * Description: + * The header file of backup drive query of of file manager + */ +#ifndef FMDRIVEQUERY_H +#define FMDRIVEQUERY_H + +#include "fmcommon.h" +#include "fmdialog.h" +#include "fmdrivemodel.h" + +#include +#include +#include +#include + +class HbListView; +class QGraphicsWidget; + +// CLASS DECLARATION +/** + * This class is used for drive select query dialog + * + */ +class FmDriveQuery : public FmDialog, public FmDriveListProvider +{ + Q_OBJECT +public: + FmDriveQuery( QGraphicsItem *parent = 0 ); + ~FmDriveQuery(); + QString selectedDrive() const; + + // from FmDriveListProvider + virtual void getDriveList( QStringList &driveList ); + +public slots: + void activated(const QModelIndex &index); + void refreshModel( QString path ); +private: + QGraphicsWidget *mContentWidget; /// Content widget of popup dialog + HbListView *mListView; /// list view + FmDriveModel *mDriveModel; /// drive model + + QString mSelectedDrive; +}; + +#endif //FMDRIVEQUERY_H diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmmessagebox.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmmessagebox.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -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: + * The source file of filemanager messagebox + */ + +#include "fmmessagebox.h" +#include + +/*! + This is a convenience function for showing an information dialog with \a informationText +*/ +void FmMessageBox::information( const QString &informationText, + HbMessageBox::StandardButtons buttons ) +{ + HbMessageBox::information ( informationText, + this, SLOT(dialogClosed(HbAction*)), buttons ); + mEventLoop.exec(); +} + +/*! + This is a convenience function for showing a question dialog with \a questionText +*/ +bool FmMessageBox::question( const QString &questionText, + HbMessageBox::StandardButtons buttons ) +{ + HbMessageBox::question ( questionText, + this, SLOT(dialogClosed(HbAction*)), buttons ); + mEventLoop.exec(); + return mRet; +} + +void FmMessageBox::dialogClosed(HbAction *action) +{ + HbMessageBox *dlg = static_cast(sender()); + if(action == dlg->actions().at(0)) + { + mRet = true; + } + else + { + mRet = false; + } + mEventLoop.exit(); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmmessagebox.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmmessagebox.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,49 @@ +/* + * 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: + * The header file of filemanager messagebox + */ + +#ifndef FMMESSAGEBOX_H +#define FMMESSAGEBOX_H + +#include +#include +#include + +class FmMessageBox : public QObject +{ +Q_OBJECT +public: + FmMessageBox() + { + } + ~FmMessageBox() + { + } + void information( const QString &informationText, + HbMessageBox::StandardButtons buttons ); + + bool question( const QString &questionText, + HbMessageBox::StandardButtons buttons ); + +public slots: + void dialogClosed(HbAction *action); +private: + QEventLoop mEventLoop; + bool mRet; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmmultitextquery.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmmultitextquery.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,127 @@ +/* + * 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: + * The source file of the multi text query of file manager + */ + +#include "fmmultitextquery.h" + +#include + +#include +#include +#include +#include + +FmMultiTextQuery::FmMultiTextQuery( HbLineEdit::EchoMode echoMode, QGraphicsItem *parent ) : + FmDialog( parent ), mEchoMode( echoMode ) +{ + init(); +} + +FmMultiTextQuery::~FmMultiTextQuery() +{ +} + +void FmMultiTextQuery::init() +{ + setObjectName( "MultiTextQuery" ); + setDismissPolicy( HbPopup::NoDismiss ); + mContentWidget = new HbWidget(); + mContentWidget->setObjectName( "MultiTextContentWidget" ); + setContentWidget( mContentWidget ); + + QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout(); + vLayout->setOrientation( Qt::Vertical ); + + mFirstLabel = new HbLabel(); + mFirstLabel->setObjectName( "MutiTextFirstLabel" ); + mFirstLabel->setFontSpec( HbFontSpec( HbFontSpec::Primary ) ); + vLayout->addItem( mFirstLabel ); + + mFirstEdit = new HbLineEdit(); + mFirstEdit->setEchoMode( mEchoMode ); + mFirstEdit->setFontSpec( HbFontSpec( HbFontSpec::Primary ) ); + mFirstEdit->setObjectName("firstLineEdit"); + vLayout->addItem( mFirstEdit ); + + mSecondLabel = new HbLabel(); + mSecondLabel->setFontSpec( HbFontSpec( HbFontSpec::Primary ) ); + mSecondLabel->setObjectName( "MutiTextSecondLabel" ); + vLayout->addItem( mSecondLabel ); + + mSecondEdit = new HbLineEdit(); + mSecondEdit->setEchoMode( mEchoMode ); + mSecondEdit->setFontSpec( HbFontSpec( HbFontSpec::Primary ) ); + mSecondEdit->setObjectName("secondLineEdit"); + vLayout->addItem( mSecondEdit ); + + mContentWidget->setLayout( vLayout ); + + setTimeout( NoTimeout ); + connect( mFirstEdit, SIGNAL(contentsChanged()), this, SLOT(checkActions()) ); + connect( mSecondEdit, SIGNAL(contentsChanged()), this, SLOT(checkActions()) ); + +} + +void FmMultiTextQuery::setLineEditMaxLength( int length ) +{ + mFirstEdit->setMaxLength( length ); + mSecondEdit->setMaxLength( length ); +} + +void FmMultiTextQuery::setFirstEditText( const QString &text ) +{ + mFirstEdit->setText( text ); +} + +void FmMultiTextQuery::setSecondEditText( const QString &text ) +{ + mSecondEdit->setText( text ); +} + +QString FmMultiTextQuery::getFirstEditText() +{ + QString text = mFirstEdit->text(); + + return text; +} + +QString FmMultiTextQuery::getSecondEditText() +{ + QString text = mSecondEdit->text(); + + return text; +} + +void FmMultiTextQuery::setFirstLabelText( const QString &text ) +{ + mFirstLabel->setPlainText( text ); +} + +void FmMultiTextQuery::setSecondLabelText( const QString &text ) +{ + mSecondLabel->setPlainText( text ); +} + +void FmMultiTextQuery::checkActions() +{ + if( !mFirstEdit->text().isEmpty() && + mFirstEdit->text().compare( mSecondEdit->text(), Qt::CaseSensitive ) == 0 ){ + this->primaryAction()->setEnabled( true ); + } else { + this->primaryAction()->setEnabled( false ); + } +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmmultitextquery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmmultitextquery.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,62 @@ +/* + * 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: + * The header file of the multi text query of file manager + */ + +#ifndef FMMULTITEXTQUERY_H +#define FMMULTITEXTQUERY_H + +#include "fmcommon.h" +#include "fmdialog.h" + +#include + +class HbWidget; +class HbLabel; + +class FmMultiTextQuery : public FmDialog +{ +Q_OBJECT +public: + explicit FmMultiTextQuery( HbLineEdit::EchoMode echoMode = HbLineEdit::Normal, QGraphicsItem *parent = 0 ); + ~FmMultiTextQuery(); + +public: + void setLineEditMaxLength( int length ); + void setFirstEditText( const QString &text ); + void setSecondEditText( const QString &text ); + void setFirstLabelText( const QString &text ); + void setSecondLabelText( const QString &text ); + QString getFirstEditText(); + QString getSecondEditText(); + +public slots: + void checkActions(); + +private: + void init(); + +private: + HbWidget *mContentWidget; + HbLineEdit *mFirstEdit; + HbLineEdit *mSecondEdit; + HbLabel *mFirstLabel; + HbLabel *mSecondLabel; + HbLineEdit::EchoMode mEchoMode; + +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmsingletextquery.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmsingletextquery.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * + * Description: + * The source file of the drive rename query of file manager + */ + +#include "fmsingletextquery.h" + +#include +#include + +#include +#include +#include + +FmSingleTextQuery::FmSingleTextQuery( HbLineEdit::EchoMode echoMode, QGraphicsItem *parent ) : + FmDialog( parent ), mEchoMode( echoMode ) +{ + init(); +} + +FmSingleTextQuery::~FmSingleTextQuery() +{ +} + +void FmSingleTextQuery::init() +{ + setObjectName( "SingleTextQuery " ); + setDismissPolicy( HbPopup::NoDismiss ); + mContentWidget = new HbWidget(); + mContentWidget->setObjectName( "SingleTextContentWidget" ); + setContentWidget( mContentWidget ); + + + QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout(); + vLayout->setOrientation( Qt::Vertical ); + + mTextEdit = new HbLineEdit(); + mTextEdit->setEchoMode( mEchoMode ); + mTextEdit->setFontSpec( HbFontSpec( HbFontSpec::Primary ) ); + mTextEdit->setObjectName( "textLineEdit" ); + vLayout->addItem( mTextEdit ); + + mContentWidget->setLayout( vLayout ); + + setTimeout( NoTimeout ); + + connect( mTextEdit, SIGNAL(contentsChanged()), this, SLOT(checkActions()) ); +} + +void FmSingleTextQuery::setLineEditText( const QString &text ) +{ + mTextEdit->setText( text ); + mTextEdit->setSelection( 0, text.length() ); +} + +QString FmSingleTextQuery::getLineEditText() +{ + QString text = mTextEdit->text(); + + return text; +} + +void FmSingleTextQuery::setLineEditMaxLength( int length ) +{ + mTextEdit->setMaxLength( length ); +} + +void FmSingleTextQuery::setRegExpStringList( QStringList regExpStringList ) +{ + mRegExpStringList = regExpStringList; +} + +void FmSingleTextQuery::checkActions() +{ + // check if all regExp match, disable primary action if not match + bool validateResult = true; + foreach( const QString ®ExpString, mRegExpStringList ) { + if( !regExpString.isEmpty() ) { + QRegExp regExp( regExpString ); + if( !regExp.exactMatch( mTextEdit->text() ) ) { + validateResult = false; + } + } + } + if( validateResult ) { + this->primaryAction()->setEnabled( true ); + } else { + this->primaryAction()->setEnabled( false ); + } +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmsingletextquery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmsingletextquery.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,56 @@ +/* + * 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: + * The header file of the drive rename query of file manager + */ + +#ifndef FMSINGLETEXTQUERY_H +#define FMSINGLETEXTQUERY_H + +#include "fmdialog.h" +#include + +class HbWidget; + +class FmSingleTextQuery : public FmDialog +{ +Q_OBJECT +public: + + explicit FmSingleTextQuery( HbLineEdit::EchoMode echoMode = HbLineEdit::Normal, QGraphicsItem *parent = 0 ); + ~FmSingleTextQuery(); + +public: + void setLineEditText( const QString &text ); + QString getLineEditText(); + void setLineEditMaxLength( int length ); + void setRegExpStringList( QStringList regExpStringList ); + +public slots: + void checkActions(); + +private: + void init(); + +private: + HbWidget *mContentWidget; + HbLineEdit *mTextEdit; + HbLineEdit::EchoMode mEchoMode; + + // used to check if input text is valid. Disable primary action when text is not valid + QStringList mRegExpStringList; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmtimequery.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmtimequery.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,62 @@ +/* + * 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: + * The source file of the time query of file manager + */ + +#include "fmtimequery.h" + +#include +#include + +#include + + +FmTimeQuery::FmTimeQuery( QGraphicsItem *parent ) : FmDialog( parent ) +{ + setObjectName( "timeQueryDialog" ); + mContentWidget = new QGraphicsWidget(); + setContentWidget(mContentWidget); + mContentWidget->setObjectName( "timeQueryContentWidget" ); + QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout(); + vLayout->setOrientation( Qt::Vertical ); + + mTimeWidget = new HbDateTimePicker(); + mTimeWidget->setObjectName( "timeQueryTimeWidget" ); + vLayout->addItem( mTimeWidget ); + + mTimeWidget->setFontSpec( HbFontSpec( HbFontSpec::Primary ) ); + mTimeWidget->setDisplayFormat( "hh:mm" ); + mTimeWidget->setDateTime( QDateTime::currentDateTime() ); + + this->setTimeout( NoTimeout ); + mContentWidget->setLayout( vLayout ); +} + +FmTimeQuery::~FmTimeQuery(void) +{ +} + +void FmTimeQuery::setTime( const QTime &time ) +{ + QDateTime dateTime = QDateTime::currentDateTime(); + dateTime.setTime( time ); + mTimeWidget->setDateTime( dateTime ); +} + +QTime FmTimeQuery::getTime() +{ + return mTimeWidget->dateTime().time(); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmtimequery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmtimequery.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,53 @@ +/* + * 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: + * The header file of the time query of file manager + */ + +#ifndef FMTIMEQUERY_H +#define FMTIMEQUERY_H + +#include "fmcommon.h" +#include "fmdialog.h" + +#include + +class QGraphicsWidget; +class HbDateTimePicker; +class FmTimeQuery : public FmDialog +{ +public: + FmTimeQuery(QGraphicsItem *parent=0); + ~FmTimeQuery( void ); + + /** + * Set time to query + * @param time time whant to display when query dialog shown + */ + void setTime( const QTime &time ); + + /** + * Get the time that set by user + * @return time + */ + QTime getTime(); + +private: + QGraphicsWidget *mContentWidget; + HbDateTimePicker *mTimeWidget; + +}; + +#endif //FMTIMEQUERY_H diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmviewdetailsdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmviewdetailsdialog.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,395 @@ +/* + * 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: + * The source file of view details dialog of file manager + */ + +#include "fmviewdetailsdialog.h" +#include "fmutils.h" +#include "fmviewdetailsitem.h" +#include "fmdrivedetailstype.h" +#include "fmviewmanager.h" + +#include +#include +#include +#include + +#include +#include +#include + +FmViewDetailsDialog::FmViewDetailsDialog( QGraphicsItem *parent ) + : FmDialog( parent ), + mNumofSubFolers( 0 ), + mNumofFiles( 0 ), + mSizeofFolder( 0 ), + mSizeofImage( 0 ), + mSizeofSounds( 0 ), + mSizeofVideo( 0 ), + mSizeofJava( 0 ), + mSizeofNativeFiles( 0 ), + mSizeofDocument( 0 ), + mSizeofCalendar( 0 ), + mSizeofContacts( 0 ) +{ + init(); + + setTimeout( NoTimeout ); +} + +FmViewDetailsDialog::~FmViewDetailsDialog() +{ + if( mDataListModel ){ + mListView->setModel( 0 ); + delete mListView; + } +} + +void FmViewDetailsDialog::init() +{ + setObjectName( "viewDetailsDialog" ); + mHeaderLabel = new HbLabel( this ); + setHeadingWidget( mHeaderLabel ); + mHeaderLabel->setObjectName( "viewDetailsHeaderLabel" ); + + mListView = new HbListView( this ); + mListView->setObjectName( "viewDetailsListView" ); + setContentWidget( mListView ); + + // init QStardardItemModel as 0 row and 1 column + mDataListModel = new QStandardItemModel( 0, 1 ); + mListView->setModel( mDataListModel ); + mListView->listItemPrototype()->setStretchingStyle(HbListViewItem::StretchLandscape); + + mOkAction = new HbAction( this ); + mOkAction->setText( hbTrId("txt_common_button_ok") ); + setPrimaryAction( mOkAction ); +} + +void FmViewDetailsDialog::setDriveDetails( const QString &driverName ) +{ + const QString dataDir = "C:\\data"; + QStringList dataList; + mHeaderLabel->setPlainText( hbTrId( "txt_fmgr_title_memory_details" ) ); + + quint64 sizeOfOthers = 0; + + FmDriverInfo driverInfo = FmUtils::queryDriverInfo( driverName ); + QString detailString( "" ); + + mDataListModel->removeRows( 0, mDataListModel->rowCount() ); + mDataListModel->insertRows( 0, EDriveDetailEntryEnd ); + + dataList.clear(); + dataList << hbTrId ( "txt_fmgr_dblist_memory_name" ); + dataList << FmUtils::fillDriveVolume( driverInfo.name(), true ) ; + mDataListModel->setData( mDataListModel->index( EMemoryName, 0 ), dataList, Qt::DisplayRole ); + + dataList.clear(); + dataList << hbTrId ( "txt_fmgr_dblist_size_memory" ); + dataList << FmUtils::formatStorageSize( driverInfo.size() ) ; + mDataListModel->setData( mDataListModel->index( EMemorySize, 0 ), dataList, Qt::DisplayRole ); + + dataList.clear(); + dataList << hbTrId ( "txt_fmgr_dblist_free_memory" ); + dataList << FmUtils::formatStorageSize( driverInfo.freeSize() ); + mDataListModel->setData( mDataListModel->index( EMemoryFree, 0 ), dataList, Qt::DisplayRole ); + + sizeOfOthers = driverInfo.size() - driverInfo.freeSize(); + +// getContentDetails( dataDir ); + + dataList.clear(); + dataList << hbTrId ( "Images:" ) ; + dataList << FmUtils::formatStorageSize( mSizeofImage ); + mDataListModel->setData( mDataListModel->index( EMemoryImages, 0 ), dataList, Qt::DisplayRole ); + + sizeOfOthers -= mSizeofImage; + + dataList.clear(); + dataList << hbTrId ( "Sounds:" ); + dataList << FmUtils::formatStorageSize( mSizeofSounds ); + mDataListModel->setData( mDataListModel->index( EMemorySounds, 0 ), dataList, Qt::DisplayRole ); + + sizeOfOthers -= mSizeofSounds; + + dataList.clear(); + dataList << hbTrId ( "Video:" ); + dataList << FmUtils::formatStorageSize( mSizeofVideo ); + mDataListModel->setData( mDataListModel->index( EMemoryVideos, 0 ), dataList, Qt::DisplayRole ); + + sizeOfOthers -= mSizeofVideo; + + dataList.clear(); + dataList << hbTrId ( "Java Files:" ); + dataList << FmUtils::formatStorageSize( mSizeofJava ); + mDataListModel->setData( mDataListModel->index( EMemoryMidpJava, 0 ), dataList, Qt::DisplayRole ); + + sizeOfOthers -= mSizeofJava; + + dataList.clear(); + dataList << hbTrId ( "Sis files:" ); + dataList << FmUtils::formatStorageSize( mSizeofNativeFiles ); + mDataListModel->setData( mDataListModel->index( EMemoryNativeApps, 0 ), dataList, Qt::DisplayRole ); + + sizeOfOthers -= mSizeofNativeFiles; + + dataList.clear(); + dataList << hbTrId ( "Documents:" ); + dataList << FmUtils::formatStorageSize( mSizeofDocument ); + mDataListModel->setData( mDataListModel->index( EMemoryDocuments, 0 ), dataList, Qt::DisplayRole ); + + sizeOfOthers -= mSizeofDocument; + + dataList.clear(); + dataList << hbTrId ( "Calendars:" ); + dataList << FmUtils::formatStorageSize( mSizeofCalendar ); + mDataListModel->setData( mDataListModel->index( EMemoryCalendar, 0 ), dataList, Qt::DisplayRole ); + + sizeOfOthers -= mSizeofCalendar; + + dataList.clear(); + dataList << hbTrId ( "Contacts:" ); + dataList << FmUtils::formatStorageSize( mSizeofContacts ); + mDataListModel->setData( mDataListModel->index( EMemoryContacts, 0 ), dataList, Qt::DisplayRole ); + + sizeOfOthers -= mSizeofContacts; + + dataList.clear(); + dataList << hbTrId ( "Others:" ); + dataList << FmUtils::formatStorageSize( sizeOfOthers ); + mDataListModel->setData( mDataListModel->index( EMemoryOthers, 0 ), dataList, Qt::DisplayRole ); +} + +void FmViewDetailsDialog::setFolderDetails( const QString &folderPath ) +{ + mHeaderLabel->setPlainText( hbTrId( "txt_fmgr_title_folder_details" ) ); + + QString detailString( "" ); + QStringList dataList; + QFileInfo fileInfo( folderPath ); + + mDataListModel->removeRows( 0, mDataListModel->rowCount() ); + mDataListModel->insertRows( 0, EFolderDetailEntryEnd ); + + dataList << hbTrId ( "txt_fmgr_dblist_name_folder" ); + dataList << fileInfo.fileName(); + mDataListModel->setData( mDataListModel->index( EFolderName, 0 ), dataList, Qt::DisplayRole ); + + QDateTime modifiedDateTime = fileInfo.lastModified (); + QDate modifiedDate = modifiedDateTime.date(); + QTime modifiedTime = modifiedDateTime.time(); + + dataList.clear(); + dataList << hbTrId ( "txt_fmgr_dblist_date_folder" ); + dataList << modifiedDate.toString(); + mDataListModel->setData( mDataListModel->index( EModifiedDate, 0 ), dataList, Qt::DisplayRole ); + + dataList.clear(); + dataList << hbTrId ( "txt_fmgr_dblist_time_folder" ); + dataList << modifiedTime.toString(); + mDataListModel->setData( mDataListModel->index( EModifiedTime, 0 ), dataList, Qt::DisplayRole ); + + dataList.clear(); + dataList << hbTrId ( "txt_fmgr_dblist_size_folder" ); + dataList << FmUtils::formatStorageSize( mSizeofFolder ); + mDataListModel->setData( mDataListModel->index( EFolderSize, 0 ), dataList, Qt::DisplayRole ); + + dataList.clear(); + dataList << hbTrId ( "txt_fmgr_dblist_subfolders" ); + dataList << QString::number( mNumofSubFolers ); + mDataListModel->setData( mDataListModel->index( ENumofSubFolders, 0 ), dataList, Qt::DisplayRole ); + + dataList.clear(); + dataList << hbTrId ( "txt_fmgr_dblist_files" ); + dataList << QString::number( mNumofFiles ); + mDataListModel->setData( mDataListModel->index( ENumofFiles, 0 ), dataList, Qt::DisplayRole ); +} + +void FmViewDetailsDialog::setFileDetails( const QString &filePath ) +{ + mHeaderLabel->setPlainText( hbTrId( "txt_fmgr_title_file_details") ); + + QString detailString( "" ); + QStringList dataList; + + QFileInfo fileInfo( filePath ); + + mDataListModel->removeRows( 0, mDataListModel->rowCount() ); + mDataListModel->insertRows( 0, EFileDetailEntryEnd ); + + dataList << hbTrId ( "txt_fmgr_dblist_name_file" ); + dataList << fileInfo.fileName(); + mDataListModel->setData( mDataListModel->index( EFileName, 0 ), dataList, Qt::DisplayRole ); + + dataList.clear(); + dataList << hbTrId ( "txt_fmgr_dblist_type_file" ); + + + + QString fileType = FmUtils::getFileType( filePath ); + if( fileType.isEmpty() ){ + fileType.append( fileInfo.suffix() ); + } + dataList << fileType; + mDataListModel->setData( mDataListModel->index( EFileType, 0 ), dataList, Qt::DisplayRole ); + + QDateTime modifiedDateTime = fileInfo.lastModified (); + QDate modifiedDate = modifiedDateTime.date(); + QTime modifiedTime = modifiedDateTime.time(); + + dataList.clear(); + dataList << hbTrId ( "txt_fmgr_dblist_date_file" ); + dataList << modifiedDate.toString(); + mDataListModel->setData( mDataListModel->index( EFileModifiedDate, 0 ), dataList, Qt::DisplayRole ); + + dataList.clear(); + dataList << hbTrId ( "txt_fmgr_dblist_time_file" ); + dataList << modifiedTime.toString(); + mDataListModel->setData( mDataListModel->index( EFileModifiedTime, 0 ), dataList, Qt::DisplayRole ); + + dataList.clear(); + dataList << hbTrId ( "txt_fmgr_dblist_size_file" ); + dataList << FmUtils::formatStorageSize( fileInfo.size() ); + mDataListModel->setData( mDataListModel->index( EFileSize, 0 ), dataList, Qt::DisplayRole ); +} + +void FmViewDetailsDialog::setNumofSubfolders( int numofSubFolders, int numofFiles, quint64 sizeofFolder ) +{ + mNumofSubFolers = 0; + mNumofFiles = 0; + mSizeofFolder = 0; + + mNumofSubFolers = numofSubFolders; + mNumofFiles = numofFiles; + mSizeofFolder = sizeofFolder; +} + +void FmViewDetailsDialog::setSizeofContent( QList detailsSizeList ) +{ + mSizeofImage = 0; + mSizeofSounds = 0; + mSizeofVideo = 0; + mSizeofJava = 0; + mSizeofNativeFiles = 0; + mSizeofDocument = 0; + mSizeofCalendar = 0; + mSizeofContacts = 0; + + for( QList< FmDriveDetailsSize* >::const_iterator it = detailsSizeList.begin(); + it!= detailsSizeList.end(); ++it ){ + + switch( ( *it )->dataType() ){ + case FmDriveDetailsSize::ETypeImages: + { + mSizeofImage = ( *it )->size(); + break; + } + case FmDriveDetailsSize::ETypeSoundFiles: + { + mSizeofSounds = ( *it )->size(); + break; + } + case FmDriveDetailsSize::ETypeMidpJava: + { + mSizeofJava = ( *it )->size(); + break; + } + case FmDriveDetailsSize::ETypeNativeApps: + { + mSizeofNativeFiles = ( *it )->size(); + break; + } + case FmDriveDetailsSize::ETypeVideos: + { + mSizeofVideo = ( *it )->size(); + break; + } + case FmDriveDetailsSize::ETypeDocuments: + { + mSizeofDocument = ( *it )->size(); + break; + } + case FmDriveDetailsSize::ETypeCalendar: + { + mSizeofCalendar = ( *it )->size(); + break; + } + case FmDriveDetailsSize::ETypeContacts: + { + mSizeofContacts = ( *it )->size(); + break; + } + default: + break; + } + } +} + +HbAction *FmViewDetailsDialog::executeDialog( FmDialog *dialog, const QString &associatedDrives ) +{ + for( int i = 0; i < associatedDrives.length(); i++ ) { + QString drive( associatedDrives[i] + QString( ":/" ) ); + if( !FmUtils::isDriveAvailable( drive ) ) { + FM_LOG( "executeDialog return 0_ " + associatedDrives ); + return 0; + } + } + + FmDlgCloseUnit dlgCloseUnit( dialog ); + dlgCloseUnit.addAssociatedDrives( associatedDrives ); + + FmViewManager::viewManager()->addDlgCloseUnit( &dlgCloseUnit ); + FM_LOG( " Exec Dialog start " ); + HbAction* action = dialog->exec(); + FM_LOG( " Exec Dialog end " ); + FmViewManager::viewManager()->removeDlgCloseUnit( &dlgCloseUnit ); + return action; +} + +void FmViewDetailsDialog::showDriveViewDetailsDialog( const QString &driverName, + QList detailsSizeList, const QString& associatedDrives ) +{ + FM_LOG( "showDriveViewDetailsDialog_" + associatedDrives ); + FmViewDetailsDialog viewDetailsDialog; + + viewDetailsDialog.setSizeofContent( detailsSizeList ); + viewDetailsDialog.setDriveDetails( driverName ); + + //viewDetailsDialog.exec(); + executeDialog( &viewDetailsDialog , associatedDrives ); +} + +void FmViewDetailsDialog::showFolderViewDetailsDialog( const QString &folderPath, + int numofSubFolders, int numofFiles, quint64 sizeofFolder, const QString& associatedDrives ) +{ + FmViewDetailsDialog viewDetailsDialog; + + viewDetailsDialog.setNumofSubfolders( numofSubFolders, numofFiles, sizeofFolder ); + viewDetailsDialog.setFolderDetails( folderPath ); + + //viewDetailsDialog.exec(); + executeDialog( &viewDetailsDialog , associatedDrives ); +} + +void FmViewDetailsDialog::showFileViewDetailsDialog( const QString &filePath, const QString& associatedDrives ) +{ + FmViewDetailsDialog viewDetailsDialog; + viewDetailsDialog.setFileDetails( filePath ); + + //viewDetailsDialog.exec(); + executeDialog( &viewDetailsDialog , associatedDrives ); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmviewdetailsdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmviewdetailsdialog.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,114 @@ +/* + * 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: + * The header file of view details dialog of file manager + */ + +#ifndef FMVIEWDETAILSDIALOG_H +#define FMVIEWDETAILSDIALOG_H + +#include "fmcommon.h" +#include "fmdialog.h" + +class QStandardItemModel; +class HbListView; +class HbLabel; +class HbAction; +class FmDriveDetailsSize; + +class FmViewDetailsDialog : public FmDialog +{ + Q_OBJECT + +public: + enum driveDetailEntry{ + EMemoryName = 0, + EMemorySize, + EMemoryFree, + EMemoryImages, + EMemorySounds, + EMemoryVideos, + EMemoryMidpJava, + EMemoryNativeApps, + EMemoryDocuments, + EMemoryCalendar, + EMemoryContacts, + EMemoryOthers, + EDriveDetailEntryEnd + }; + + enum folderDetailEntry{ + EFolderName = 0, + EModifiedDate, + EModifiedTime, + EFolderSize, + ENumofSubFolders, + ENumofFiles, + EFolderDetailEntryEnd + }; + + enum fileDetailEntry{ + EFileName = 0, + EFileType, + EFileModifiedDate, + EFileModifiedTime, + EFileSize, + EFileDetailEntryEnd + }; + +public: + virtual ~FmViewDetailsDialog(); + + static void showDriveViewDetailsDialog( const QString &driverName, + QList detailsSizeList, + const QString& associatedDrives = QString() ); + static void showFolderViewDetailsDialog( const QString &folderPath, + int numofSubFolders, int numofFiles, + quint64 sizeofFolder, const QString& associatedDrives = QString() ); + static void showFileViewDetailsDialog( const QString &filePath, const QString& associatedDrives = QString() ); + +private: + FmViewDetailsDialog( QGraphicsItem *parent = 0 ); + + void init(); + void setDriveDetails( const QString &driverName ); + void setFolderDetails( const QString &folderPath ); + void setFileDetails( const QString &filePath ); + void setNumofSubfolders( int numofSubFolders, int numofFiles, quint64 sizeofFolder ); + void setSizeofContent( QList detailsSizeList ); + + static HbAction *executeDialog( FmDialog *dialog, const QString &associatedDrives ); +private: + HbListView *mListView; + HbLabel *mHeaderLabel; + HbAction *mOkAction; + + QStandardItemModel *mDataListModel; + QString mDrive; + + int mNumofSubFolers; + int mNumofFiles; + quint64 mSizeofFolder; + quint64 mSizeofImage; + quint64 mSizeofSounds; + quint64 mSizeofVideo; + quint64 mSizeofJava; + quint64 mSizeofNativeFiles; + quint64 mSizeofDocument; + quint64 mSizeofCalendar; + quint64 mSizeofContacts; +}; + +#endif /* FMVIEWDETAILSDIALOG_H_ */ diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmviewdetailsitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmviewdetailsitem.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * + * Description: + * The source file of the view details list item of file manager + */ + +#include "fmviewdetailsitem.h" +#include "fmviewmanager.h" + +#include + +#include + +FmViewDetailsItem::FmViewDetailsItem( QGraphicsItem *parent ) + : HbListViewItem( parent ), + mDetailsContentLabel( 0 ), + mDetailsLabel( 0 ), + mLayout( 0 ) + +{ +} + +FmViewDetailsItem::~FmViewDetailsItem() +{ +} + +HbAbstractViewItem *FmViewDetailsItem::createItem() +{ + return new FmViewDetailsItem( *this ); +} + +bool FmViewDetailsItem::canSetModelIndex( const QModelIndex &index ) const +{ + Q_UNUSED( index ); + return true; +} + +void FmViewDetailsItem::polish(HbStyleParameters& params) +{ + Q_UNUSED(params); +} + +void FmViewDetailsItem::updateChildItems() +{ + if( !mLayout ) { + init(); + } + QString string = modelIndex().data( Qt::DisplayRole ).toString(); + + mDetailsContentLabel->setPlainText( string ); + + string = modelIndex().data( Qt::UserRole ).toString(); + + mDetailsLabel->setPlainText( string ); + +} + +void FmViewDetailsItem::init() +{ + mLayout = new QGraphicsLinearLayout(); + + if( FmViewManager::viewManager()->orientation() == Qt::Vertical ){ + mLayout->setOrientation( Qt::Vertical ); + } + else{ + mLayout->setOrientation( Qt::Horizontal ); + } + + + mDetailsContentLabel = new HbLabel(""); + mDetailsContentLabel->setFontSpec( HbFontSpec( HbFontSpec::Primary ) ); + mDetailsContentLabel->setObjectName( "detaisContentLabel" ); + mLayout->addItem( mDetailsContentLabel ); + mLayout->setAlignment( mDetailsContentLabel, Qt::AlignLeft ); + + mDetailsLabel = new HbLabel(""); + mDetailsLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) ); + mDetailsLabel->setObjectName( "detailsLabel" ); + mLayout->addItem( mDetailsLabel ); + mLayout->setAlignment( mDetailsLabel, Qt::AlignLeft ); + + setLayout( mLayout ); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/components/fmviewdetailsitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/components/fmviewdetailsitem.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,53 @@ +/* + * 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: + * The header file of the view details list item of file manager + */ + +#ifndef FMVIEWDETAILSITEM_H +#define FMVIEWDETAILSITEM_H + +#include + +class HbLabel; +class QGraphicsLinearLayout; + +class FmViewDetailsItem : public HbListViewItem +{ + Q_OBJECT + +public: + FmViewDetailsItem( QGraphicsItem *parent = 0 ); + virtual ~FmViewDetailsItem(); + +public: + virtual bool canSetModelIndex( const QModelIndex &index ) const; + virtual HbAbstractViewItem *createItem(); + virtual void updateChildItems(); + +private: + virtual void polish(HbStyleParameters& params); + +private: + void init(); + +private: + HbLabel *mDetailsContentLabel; + HbLabel *mDetailsLabel; + + QGraphicsLinearLayout *mLayout; +}; + +#endif /* FMVIEWDETAILSITEM_H */ diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmdriverlistwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmdriverlistwidget.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,459 @@ +/* + * 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: + * Yong Zhang + * + * Description: + * The driver model file for file manager + */ +#include "fmdriverlistwidget.h" +#include "fmutils.h" +#include "fmdlgutils.h" +#include "fmviewmanager.h" +#include "fmviewdetailsdialog.h" +#include "fmoperationbase.h" +#include "fmdrivemodel.h" +#include "fmfiledialog.h" +#include "fmoperationservice.h" +#include +#include +#include +#include + +#include +#include +#include +#include + +FmDriverListWidget::FmDriverListWidget( QGraphicsItem *parent ) +: HbWidget( parent ), mListView(0), mModel(0), + mCurrentItem(0), mSearchPanel(0), + mFileSystemWatcher(0), mLayout(0), mContextMenu(0), mListLongPressed( false ) +{ + init(); + mFileSystemWatcher = new QFileSystemWatcher( this ); + connect( mFileSystemWatcher, SIGNAL( directoryChanged ( const QString & ) ), + this, SLOT( on_directoryChanged( const QString & ) ) ); + + QMetaObject::connectSlotsByName( this ); +} + +FmDriverListWidget::~FmDriverListWidget() +{ + if (mContextMenu) { + mContextMenu->deleteLater(); + } +} + +void FmDriverListWidget::on_list_activated( const QModelIndex &index ) +{ + FM_LOG("FmDriverListWidget::on_list_activated"); + if( mListLongPressed ) { + FM_LOG("FmDriverListWidget::on_list_activated return because long pressed"); + return; + } + FM_LOG("FmDriverListWidget::on_list_activated emit activate to open drive"); + emit activated( mModel->driveName( index ) ); +} + +void FmDriverListWidget::init() +{ + mLayout = new QGraphicsLinearLayout( this ); + mLayout->setOrientation( Qt::Vertical ); + + mListView = new HbListView( this ); + mListView->setLayoutName( "drive" ); + mModel = new FmDriveModel( this, + FmDriveModel::FillWithVolume | FmDriveModel::FillWithDefaultVolume | + FmDriveModel::FillWithTotalSize | FmDriveModel::FillWithFreeSize ); + mListView->setModel( mModel ); + mLayout->addItem( mListView ); + mSearchPanel = new HbSearchPanel( this ); + mSearchPanel->setObjectName( "searchPanel" ); + mSearchPanel->setSearchOptionsEnabled( true ); + mSearchPanel->setProgressive( false ); + mSearchPanel->hide(); + connect( mListView, SIGNAL( activated( const QModelIndex & ) ), + this, SLOT( on_list_activated( const QModelIndex & ) ) ); + connect( mListView, SIGNAL( pressed( const QModelIndex & ) ), + this, SLOT( on_list_pressed( const QModelIndex & ) ) ); + + connect( mListView, SIGNAL( longPressed( HbAbstractViewItem *, const QPointF & ) ), + this, SLOT( on_list_longPressed( HbAbstractViewItem *, const QPointF & ) ) ); + + connect( mSearchPanel, SIGNAL( searchOptionsClicked() ), + this, SLOT( on_searchPanel_searchOptionsClicked() ), Qt::QueuedConnection ); + + connect( mSearchPanel, SIGNAL( criteriaChanged( const QString & ) ), + this, SLOT( on_searchPanel_criteriaChanged( const QString & ) ) ); + + connect( mSearchPanel, SIGNAL( exitClicked() ), + this, SLOT( on_searchPanel_exitClicked() ) ); + + setLayout( mLayout ); +} + +void FmDriverListWidget::refreshDrive() +{ + mModel->refresh(); +} + +void FmDriverListWidget::on_list_longPressed( HbAbstractViewItem *item, const QPointF &coords ) +{ + FM_LOG("FmDriverListWidget::on_list_longPressed"); + mListLongPressed = true; + mCurrentItem = item; + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); + + if( !mContextMenu ) { + mContextMenu = new HbMenu(); + } else { + mContextMenu->clearActions(); + } + FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName ); + FmDriverInfo::DriveType driveType = driverInfo.driveType(); + FmDriverInfo::DriveState state = driverInfo.driveState(); + if( !( state & FmDriverInfo::EDriveNotPresent ) ) { + if( state & FmDriverInfo::EDriveAvailable ) { + HbAction *viewAction = new HbAction(); + viewAction->setObjectName( "viewAction" ); + viewAction->setText( hbTrId( "txt_fmgr_menu_view_details_memory" ) ); + mContextMenu->addAction( viewAction ); + connect( viewAction, SIGNAL( triggered() ), + this, SLOT( on_viewAction_triggered() ), Qt::QueuedConnection ); + + if( driveType == FmDriverInfo::EDriveTypeMemoryCard || driveType == FmDriverInfo::EDriveTypeUsbMemory ) { + // MMC or Usb memory + + // Name/Rename action + if ( driverInfo.volumeName().length() ){ + HbAction *renameAction = new HbAction(); + renameAction->setObjectName( "renameAction" ); + renameAction->setText( hbTrId( "txt_fmgr_menu_rename" ) ); + mContextMenu->addAction( renameAction ); + + connect( renameAction, SIGNAL( triggered() ), + this, SLOT( on_renameAction_triggered() ), Qt::QueuedConnection ); + } else { + HbAction *nameAction = new HbAction(); + nameAction->setObjectName( "nameAction" ); + nameAction->setText( hbTrId( "txt_fmgr_menu_name" ) ); + mContextMenu->addAction( nameAction ); + + connect( nameAction, SIGNAL( triggered() ), + this, SLOT( on_nameAction_triggered() ), Qt::QueuedConnection ); + } + + // Set/Change/Remove password action + if( driveType == FmDriverInfo::EDriveTypeMemoryCard ) { // MMC + if( state & FmDriverInfo::EDrivePasswordProtected ){ + HbAction *changePwdAction = new HbAction(); + changePwdAction->setObjectName( "changePwdAction" ); + changePwdAction->setText( hbTrId( "txt_fmgr_menu_change_password" ) ); + mContextMenu->addAction( changePwdAction ); + + HbAction *removePwdAction = new HbAction(); + removePwdAction->setObjectName( "removePwdAction" ); + removePwdAction->setText( hbTrId( "txt_fmgr_menu_remove_password" ) ); + mContextMenu->addAction( removePwdAction ); + + connect( changePwdAction, SIGNAL( triggered() ), + this, SLOT( on_changePwdAction_triggered() ), Qt::QueuedConnection ); + connect( removePwdAction, SIGNAL( triggered() ), + this, SLOT( on_removePwdAction_triggered() ), Qt::QueuedConnection ); + } + else{ + HbAction *setPwdAction = new HbAction(); + setPwdAction->setObjectName( "setPwdAction" ); + setPwdAction->setText( hbTrId( "txt_fmgr_menu_set_password" ) ); + mContextMenu->addAction( setPwdAction ); + + connect( setPwdAction, SIGNAL( triggered() ), + this, SLOT( on_setPwdAction_triggered() ), Qt::QueuedConnection ); + } + } + } //if( driveType == FmDriverInfo::EDriveTypeMemoryCard || driveType == FmDriverInfo::EDriveTypeUsbMemory ) + } //if( state & FmDriverInfo::EDriveAvailable ) + + // Eject action + // put outside of EDriveAvailable so that removable drive which is corrupted or locked can be removed + if( state & FmDriverInfo::EDriveEjectable ){ + HbAction *ejectAction = new HbAction(); + ejectAction->setObjectName( "ejectAction" ); + ejectAction->setText( hbTrId( "txt_fmgr_menu_eject" ) ); + mContextMenu->addAction( ejectAction ); + + connect( ejectAction, SIGNAL( triggered() ), + this, SLOT( on_ejectAction_triggered() ), Qt::QueuedConnection ); + } + + // Format action + if ( ( state & FmDriverInfo::EDriveRemovable ) || ( state & FmDriverInfo::EDriveCorrupted ) + || ( state & FmDriverInfo::EDriveLocked ) ){ + HbAction *formatAction = new HbAction(); + formatAction->setObjectName( "formatAction" ); + formatAction->setText( hbTrId( "txt_fmgr_menu_format" ) ); + mContextMenu->addAction( formatAction ); + + connect( formatAction, SIGNAL( triggered() ), + this, SLOT( on_formatAction_triggered() ), Qt::QueuedConnection ); + } + } //if( !( state & FmDriverInfo::EDriveNotPresent ) ) + + // Unlock action + // put ouside of !EDriveNotPresent judgment so that + // user could unlock drive if connected to PC with mass storage mode + if( state & FmDriverInfo::EDriveLocked ){ + HbAction *unLockedAction = new HbAction(); + unLockedAction->setObjectName( "unLockedAction" ); + unLockedAction->setText( hbTrId( "Unlock" ) ); + mContextMenu->addAction( unLockedAction ); + + connect( unLockedAction, SIGNAL( triggered() ), + this, SLOT( on_unLockedAction_triggered() ), Qt::QueuedConnection ); + } + + // Pop up menu or open drive + if( mContextMenu->actions().count() > 0 ) { + mContextMenu->setPreferredPos( coords ); + mContextMenu->open(); + } else { + emit activated( diskName ); + } +} + +void FmDriverListWidget::on_list_pressed( const QModelIndex & index ) +{ + Q_UNUSED( index ); + mListLongPressed = false; +} + +void FmDriverListWidget::on_viewAction_triggered() +{ + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); + FmViewManager::viewManager()->operationService()->asyncViewDriveDetails( diskName ); +} + +void FmDriverListWidget::on_renameAction_triggered() +{ + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); + + FmDriverInfo::DriveState state = FmUtils::queryDriverInfo( diskName ).driveState(); + FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName ); + + if ( state & FmDriverInfo::EDriveWriteProtected ){ + FmDlgUtils::information( hbTrId( "Unable to perform operation. Memory card is read only." ) ); + return; + } + + QString title( hbTrId( "Drive name ") ); + //save the volume status, empty or set + bool needToSetVolume = false; + QString volumeName = FmUtils::getVolumeNameWithDefaultNameIfNull( diskName, needToSetVolume ); + QString oldVolumeName( volumeName ); + QString associatedDrives( FmUtils::getDriveLetterFromPath( diskName ) ); + //use isReturnFalseWhenNoTextChanged = false in order that FmUtils::renameDrive( driveName, volumeName ) will + //be excuted at lease once to set the volume name. + while( FmDlgUtils::showTextQuery( title, volumeName, QStringList(), FmMaxLengthofDriveName, associatedDrives, false ) ){ + //if volume is not set or oldVolumeName != volumeName , FmUtils::renameDrive will be called + if ( oldVolumeName == volumeName && !needToSetVolume ) { + break; + } + int err = FmUtils::renameDrive( diskName, volumeName ); + if ( err == FmErrNone ) { + FmDlgUtils::information( hbTrId( "The name has been changed!" ) ); + mModel->refresh(); + break; + } else if( err == FmErrBadName ) { + FmDlgUtils::information( hbTrId( "Illegal characters! Use only letters and numbers." ) ); + } else{ + FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) ); + break; + } + } +} + +void FmDriverListWidget::on_nameAction_triggered() +{ + on_renameAction_triggered(); +} + +void FmDriverListWidget::on_setPwdAction_triggered() +{ + QString firstLabel( hbTrId( "New Password: ") ); + QString secondLabel( hbTrId( "Confirm new Password: ") ); + + QString oldPwd; + QString newPwd; + + FmUtils::emptyPwd( oldPwd ); + + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); + + QString associatedDrives( FmUtils::getDriveLetterFromPath( diskName ) ); + if( FmDlgUtils::showMultiPasswordQuery( firstLabel, secondLabel, newPwd, FmMaxLengthofDrivePassword, associatedDrives ) ) { + if ( FmUtils::setDrivePwd( diskName, oldPwd, newPwd ) == 0 ){ + FmDlgUtils::information( hbTrId( "The password has been set!" ) ); + } + else{ + FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) ); + } + } +} + +void FmDriverListWidget::on_changePwdAction_triggered() +{ + QString title( hbTrId( "txt_common_dialog_password") ); + QString firstLabel( hbTrId( "txt_common_dialog_new_password") ); + QString secondLabel( hbTrId( "Confirm new Password: ") ); + + QString oldPwd; + QString newPwd; + + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); + + QString associatedDrives( FmUtils::getDriveLetterFromPath( diskName ) ); + while( FmDlgUtils::showSinglePasswordQuery( title, oldPwd, FmMaxLengthofDrivePassword, associatedDrives ) ) { + if ( FmUtils::checkDrivePwd( diskName, oldPwd ) == 0 ){ + if( FmDlgUtils::showMultiPasswordQuery( firstLabel, secondLabel, newPwd, FmMaxLengthofDrivePassword, associatedDrives ) ){ + if ( FmUtils::setDrivePwd( diskName, oldPwd, newPwd ) == 0 ){ + FmDlgUtils::information( hbTrId( "The password has been changed!" ) ); + } else { + FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) ); + } + break; + } else { + //cancel muti password query + break; + } + } else { + FmDlgUtils::information( hbTrId( "The password is incorrect, try again!" ) ); + } + + } +} + +void FmDriverListWidget::on_removePwdAction_triggered() +{ + QString title( hbTrId( "Password: ") ); + + QString oldPwd; + + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); + if( FmDlgUtils::question( hbTrId( "Do you want to remove the password? Memory card becomes unlocked." ) ) ){ + QString associatedDrives( FmUtils::getDriveLetterFromPath( diskName ) ); + while( FmDlgUtils::showSinglePasswordQuery( title, oldPwd, FmMaxLengthofDrivePassword, associatedDrives ) ) { + if ( FmUtils::checkDrivePwd( diskName, oldPwd ) == 0 ) { + if ( FmUtils::removeDrivePwd( diskName, oldPwd ) == 0 ){ + FmDlgUtils::information( hbTrId( "The password has been removed!" ) ); + } + else{ + FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) ); + } + break; + } + else { + FmDlgUtils::information( hbTrId( "The password is incorrect, try again!" ) ); + } + + } + } +} + +void FmDriverListWidget::on_unLockedAction_triggered() +{ + QString title( hbTrId( "Password: ") ); + + QString oldPwd; + + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); + + //Do not add associatedDrives as Locked MMC is not available Drive but only present Drive + while( FmDlgUtils::showSinglePasswordQuery( title, oldPwd, FmMaxLengthofDrivePassword ) ) { + int err = FmUtils::unlockDrive( diskName, oldPwd ); + if( err == FmErrNone ) { + FmDlgUtils::information( hbTrId( "The memory is unlocked!" ) ); + break; + } else if ( err == FmErrAccessDenied ) { + FmDlgUtils::information( hbTrId( "The password is incorrect, try again!" ) ); + } else if (err == FmErrAlreadyExists ) { + FmDlgUtils::information( hbTrId( "The disk has already been unlocked!" ) ); + break; + } else if( err == FmErrNotSupported ) { + FmDlgUtils::information( hbTrId( "The media does not support password locking!" ) ); + break; + } else { + FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) ); + break; + } + } +} + +void FmDriverListWidget::on_formatAction_triggered() +{ + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); + + if( FmDlgUtils::question( hbTrId( "Format? Data will be deleted during formatting." ) ) ){ + if( FmErrNone != FmViewManager::viewManager()->operationService()->asyncFormat( diskName ) ) + FmDlgUtils::information( hbTrId( "Formatting failed." ) ); + } +} + +void FmDriverListWidget::on_ejectAction_triggered() +{ + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); + + if( FmDlgUtils::question( hbTrId( "Eject memory card? Some applications will be closed." ) ) ){ + FmUtils::ejectDrive( diskName ); + } +} + +void FmDriverListWidget::on_directoryChanged( const QString &path ) +{ + Q_UNUSED( path ); + mModel->refresh(); +} + +void FmDriverListWidget::activeSearchPanel() +{ + QStringList driveList; + FmUtils::getDriveList( driveList, true ); + if(driveList.count() > 0 ) { + mFindTargetPath = driveList.first(); + if( FmUtils::isDriveC( mFindTargetPath ) ) { + mFindTargetPath = QString( Folder_C_Data ); + } + } else { + mFindTargetPath.clear(); + } + mLayout->addItem( mSearchPanel ); + mSearchPanel->show(); +} + +void FmDriverListWidget::on_searchPanel_searchOptionsClicked() +{ + mFindTargetPath = FmUtils::fillPathWithSplash( FmFileDialog::getExistingDirectory( 0, hbTrId( "Look in:" ), + QString(""), QStringList() ) ); +} + +void FmDriverListWidget::on_searchPanel_criteriaChanged( const QString &criteria ) +{ + emit startSearch( mFindTargetPath, criteria ); + mSearchPanel->hide(); + mLayout->removeItem( mSearchPanel ); +} + +void FmDriverListWidget::on_searchPanel_exitClicked() +{ + mSearchPanel->hide(); + mLayout->removeItem( mSearchPanel ); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmdriverlistwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmdriverlistwidget.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,88 @@ +/* + * 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: + * Zhiqiang Yang + * + * Description: + * The header file of file manager disk list widget + */ + +#ifndef FMDRIVERLISTWIDGET_H +#define FMDRIVERLISTWIDGET_H + +#include "fmcommon.h" +#include + +class FmDriveModel; +class HbListView; +class HbAbstractViewItem; +class HbSearchPanel; +class HbMenu; +class QFileSystemWatcher; + +class QGraphicsLinearLayout; + +class FmDriverListWidget : public HbWidget +{ + Q_OBJECT +public: + FmDriverListWidget( QGraphicsItem *parent = 0 ); + ~FmDriverListWidget(); + +public: + int updatePwd( const QString& oldPwd, const QString& pwd); + void refreshDrive(); + void activeSearchPanel(); + +signals: + void activated( const QString &path ); + void startSearch( const QString &targetPath, const QString &criteria ); + +private slots: + void on_list_activated( const QModelIndex &index ); + void on_list_longPressed( HbAbstractViewItem *item, const QPointF &coords ); + void on_list_pressed( const QModelIndex & index ) ; + + void on_viewAction_triggered(); + void on_renameAction_triggered(); + void on_nameAction_triggered(); + void on_changePwdAction_triggered(); + void on_removePwdAction_triggered(); + void on_setPwdAction_triggered(); + void on_unLockedAction_triggered(); + void on_formatAction_triggered(); + void on_ejectAction_triggered(); + void on_directoryChanged( const QString &path ); + + void on_searchPanel_searchOptionsClicked(); + void on_searchPanel_criteriaChanged( const QString &criteria ); + void on_searchPanel_exitClicked(); +private: + void init(); + +private: + HbListView *mListView; + FmDriveModel *mModel; + HbAbstractViewItem* mCurrentItem; + HbSearchPanel* mSearchPanel; + + QFileSystemWatcher *mFileSystemWatcher; + + QString mFindTargetPath; + QGraphicsLinearLayout *mLayout; + HbMenu *mContextMenu; + + //used to avoid activate when long press list. + bool mListLongPressed; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmdriverview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmdriverview.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,174 @@ +/* + * 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: + * Zhiqiang Yang + * + * Description: + * The source file of File Manager driver view + */ + +#include "fmdriverview.h" +#include "fmdriverlistwidget.h" +#include "fmviewmanager.h" +#include "fmcommon.h" + +#include + +#include +#include +#include +#include +#include + +FmDriverView::FmDriverView() : FmViewBase( EDriverView ) +{ + FM_LOG( "FmDriverView::FmDriverView" ); + initMenu(); + initToolBar(); + initDiskListWidget(); + + QMetaObject::connectSlotsByName( this ); +} + +FmDriverView::~FmDriverView() +{ + removeToolBarAction(); +} + +void FmDriverView::initMenu() +{ + HbAction *action = 0; + +#ifdef FM_CHANGE_ORIENT_ENABLE + action = new HbAction( this ); + action->setObjectName( "rotateAction" ); + action->setText( hbTrId( "Change orientation" ) ); + menu()->addAction( action ); +#endif + + action = new HbAction( this ); + action->setObjectName( "findAction" ); + action->setText( hbTrId( "txt_fmgr_opt_find" ) ); + menu()->addAction( action ); + + action = new HbAction( this ); + action->setObjectName( "backupAction" ); + action->setText( hbTrId( "txt_fmgr_opt_backup" ) ); + menu()->addAction( action ); + + action = new HbAction( this ); + action->setObjectName( "restoreAction" ); + action->setText( hbTrId( "txt_fmgr_opt_restore" ) ); + menu()->addAction( action ); + + action = new HbAction( this ); + action->setObjectName( "exitAction" ); + action->setText( hbTrId( "Exit" ) ); + menu()->addAction( action ); + +} + +void FmDriverView::initDiskListWidget() +{ + mDriverList = new FmDriverListWidget( this ); + connect( mDriverList, SIGNAL( activated( const QString& ) ), + this, SLOT( activated( const QString& ) ), Qt::QueuedConnection ); + + connect( mDriverList, SIGNAL( startSearch( const QString&, const QString& ) ), + this, SLOT( startSearch( const QString&, const QString& ) ) ); + + setWidget( mDriverList ); +} + +void FmDriverView::initToolBar() +{ + mToolBarLeftAction = new HbAction( this ); + mToolBarLeftAction->setObjectName( "leftAction" ); + mToolBarLeftAction->setText( hbTrId( "txt_fmgr_opt_backup" ) ); + toolBar()->addAction( mToolBarLeftAction ); + + mToolBarRightAction = new HbAction( this ); + mToolBarRightAction->setObjectName( "rightAction" ); + mToolBarRightAction->setText( hbTrId( "txt_fmgr_opt_restore" ) ); + toolBar()->addAction( mToolBarRightAction ); + + toolBar()->setOrientation( Qt::Horizontal ); +} + +void FmDriverView::activated( const QString& pathName ) +{ + FmViewManager::viewManager()->createFileView( pathName ); +} + +void FmDriverView::refreshDrive() +{ + FM_LOG( QString( "FmDriverView::refreshDrive start" ) ); + mDriverList->refreshDrive(); + FM_LOG( QString( "FmDriverView::refreshDrive end" ) ); +} + +void FmDriverView::on_leftAction_triggered() +{ + FmViewManager::viewManager()->createBackupView(); +} + +void FmDriverView::on_rightAction_triggered() +{ + FmViewManager::viewManager()->createRestoreView(); +} + +#ifdef FM_CHANGE_ORIENT_ENABLE +void FmDriverView::on_rotateAction_triggered() +{ + if ( mainWindow()->orientation() == Qt::Vertical ) { + mainWindow()->setOrientation( Qt::Horizontal ); + } + else { + mainWindow()->setOrientation( Qt::Vertical ); + } +} +#endif + +void FmDriverView::on_exitAction_triggered() +{ + qApp->quit(); +} + +void FmDriverView::on_backupAction_triggered() +{ + FmViewManager::viewManager()->createBackupView(); +} + +void FmDriverView::on_restoreAction_triggered() +{ + FmViewManager::viewManager()->createRestoreView(); +} + +void FmDriverView::on_findAction_triggered() +{ + mDriverList->activeSearchPanel(); +} + +void FmDriverView::startSearch( const QString &targetPath, const QString &criteria ) +{ + if ( !criteria.isEmpty() && !targetPath.isEmpty() ) { + FmViewManager::viewManager()->createFindView( criteria, targetPath ); + } +} + +void FmDriverView::removeToolBarAction() +{ + toolBar()->removeAction( mToolBarLeftAction ); + toolBar()->removeAction( mToolBarRightAction ); +} + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmdriverview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmdriverview.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,69 @@ +/* + * 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: + * Zhiqiang Yang + * + * Description: + * The header file of File Manager driver view + */ + +#ifndef FMDRIVERVIEW_H +#define FMDRIVERVIEW_H + +#include "fmcommon.h" +#include "fmviewbase.h" + +class FmDriverListWidget; +class FmOperationService; +class HbSearchPanel; +class HbAction; + +class FmDriverView : public FmViewBase +{ + Q_OBJECT +public: + FmDriverView(); + virtual ~FmDriverView(); + +private slots: + void on_leftAction_triggered(); + void on_rightAction_triggered(); + void on_exitAction_triggered(); + void on_backupAction_triggered(); + void on_restoreAction_triggered(); + void on_findAction_triggered(); + + void activated( const QString &pathName ); + void refreshDrive(); + void startSearch( const QString &targetPath, const QString &criteria ); + +#ifdef FM_CHANGE_ORIENT_ENABLE + void on_rotateAction_triggered(); +#endif + +private: + void initMenu(); + void initDiskListWidget(); + void initToolBar(); + + void removeToolBarAction(); + +private: + FmDriverListWidget *mDriverList; + HbSearchPanel* mSearchPanel; + + HbAction *mToolBarLeftAction; + HbAction *mToolBarRightAction; +}; + +#endif + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmfilebrowsewidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,740 @@ +/* +* 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: +* Zhiqiang Yang +* Steven Yao +* Yong Zhang +* +* Description: +* The source file of the widget to browse files +* +*/ + +#include "fmfilebrowsewidget.h" +#include "fmviewdetailsdialog.h" +#include "fmviewmanager.h" +#include "fmfiledialog.h" +#include "fmdlgutils.h" +#include "fmfileiconprovider.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +// These define comes from implementation of QFileSystemModel +#define QFileSystemSortName 0 +#define QFileSystemSortSize 1 +#define QFileSystemSortType 2 +#define QFileSystemSortTime 3 + +FmFileBrowseWidget::FmFileBrowseWidget( HbWidget *parent, FmFileBrowseWidget::Style style ) + : HbWidget( parent ), + mTreeView( 0 ), + mListView( 0 ), + mLayout( 0 ), + mModel( 0 ), + mSelectable( false ), + mStyle( NoStyle ), + mFileBrowseStyle( style ), + mCurrentItem( 0 ), + mOperationService( 0 ), + mSearchPanel( 0 ), + mListLongPressed( false ) +{ + initFileModel(); + initListView(); + initTreeView(); + initSearchPanel(); + initEmptyTipsLabel(); + initLayout(); + + mOperationService = FmViewManager::viewManager()->operationService(); + setStyle( style ); +} + +FmFileBrowseWidget::~FmFileBrowseWidget() +{ + //take the model out from view and delete it. + //so that the model could be destroy earlier + //since there is a thread running in background + //if the model destroy later, the thread might not quit properly. + + mTreeView->setModel( 0 ); + mListView->setModel( 0 ); + delete mModel; + + delete mFileIconProvider; +} + +QFileInfo FmFileBrowseWidget::currentPath() const +{ + QModelIndex index = mListView->rootIndex(); + if( !index.isValid() ) { + return QFileInfo(); + } + + if (mStyle == ListStyle) { + return mModel->fileInfo( mListView->rootIndex() ); + } else if ( mStyle == TreeStyle ) { + return QFileInfo(); + } else { + return QFileInfo(); + } +} + +QList FmFileBrowseWidget::checkedItems() const +{ + QList infos; + + QItemSelection selection; + if (mStyle == ListStyle) { + selection = mListView->selectionModel()->selection(); + } + + QModelIndexList indexes = selection.indexes(); + for (int i = 0; i < indexes.size(); ++i) { + infos.append( mModel->fileInfo( indexes.at(i) ) ); + } + + return infos; +} + +void FmFileBrowseWidget::setRootPath( const QString &pathName ) +{ + QString logString = "FmFileBrowseWidget::setRootPath(" + pathName + ')'; + FM_LOG( logString ); + + int err = checkPathAndSetStyle( pathName ); + switch( err ) + { + case FmErrNone: + { + mListView->setRootIndex( mModel->setRootPath( pathName ) ); + emit currentPathChanged( pathName ); + break; + } + case FmErrPathNotExist: + { + FmDlgUtils::information( hbTrId( "Path is not exist" ) ); + break; + } + case FmErrDriveNotAvailable: + { + // do not take any action as widget set note in label already. + break; + } + case FmErrDriveDenied: + case FmErrPathDenied: + { + FmDlgUtils::information( hbTrId( "Can not access" ) ); + break; + } + default: + Q_ASSERT_X( false, "setRootPath", "please handle all error from isPathAccessabel" ); + break; + } + mCurrentDrive = pathName.left( 3 ); +} + +void FmFileBrowseWidget::setStyle( FmFileBrowseWidget::Style style ) +{ + if ( mStyle == style ) { + return; + } + + if ( mStyle == ListStyle ) { + mLayout->removeItem( mListView ); + mListView->hide(); + } else if ( mStyle == TreeStyle ) { + mLayout->removeItem( mTreeView ); + mTreeView->hide(); + } else if( mStyle == LabelStyle ){ + mLayout->removeItem( mEmptyTipLabel ); + mEmptyTipLabel->hide(); + } + + if ( style == ListStyle ) { + mLayout->addItem( mListView ); + mListView->show(); + mFileBrowseStyle = ListStyle; + } else if ( style == TreeStyle ) { + mLayout->addItem( mTreeView ); + mTreeView->show(); + mFileBrowseStyle = TreeStyle; + } else if ( style == LabelStyle ){ + mLayout->addItem( mEmptyTipLabel ); + mEmptyTipLabel->show(); + } + + mStyle = style; +} + +bool FmFileBrowseWidget::selectable() const +{ + return mSelectable; +} + +void FmFileBrowseWidget::setSelectable( bool enable ) +{ + if (mSelectable != enable) { + mSelectable = enable; + if (mStyle == ListStyle) { + mListView->setSelectionMode( mSelectable ? HbAbstractItemView::MultiSelection + : HbAbstractItemView::NoSelection ); + } + } +} + +void FmFileBrowseWidget::clearSelection() +{ + QItemSelectionModel *selectionModel = 0; + + if (mStyle == ListStyle) { + selectionModel = mListView->selectionModel(); + } else if (mStyle == TreeStyle) { + selectionModel = mTreeView->selectionModel(); + } + + if( selectionModel ){ + selectionModel->clear(); + } + +} + + +bool FmFileBrowseWidget::rename( const QString &oldName, const QString &newName ) +{ + return QFile::rename( oldName, newName ); +} + + + + +bool FmFileBrowseWidget::cdUp() +{ + if (mStyle == ListStyle) { + QModelIndex parentIndex = mListView->rootIndex().parent(); + // QFileSystemModel will auto refresh for file/folder change + if (parentIndex.isValid()) { + changeRootIndex( parentIndex ); + return true; + } + } + + return false; +} + +void FmFileBrowseWidget::on_list_activated( const QModelIndex &index ) +{ + mActivatedModelIndex = index; + emit listActivated(); +} + +void FmFileBrowseWidget::on_listActivated() +{ + FM_LOG("FmFileBrowseWidget::on_listActivated start"); + if( mListLongPressed ) { + FM_LOG("FmFileBrowseWidget::on_list_activated end because longPressed"); + return; + } + if (!mSelectable) { + if (mModel->isDir(mActivatedModelIndex) ) { + FM_LOG("FmFileBrowseWidget::on_list_activated changeRootIndex>>"); + changeRootIndex( mActivatedModelIndex ); + FM_LOG("FmFileBrowseWidget::on_list_activated changeRootIndex<<"); + } else { + QString filePath( mModel->filePath( mActivatedModelIndex ) ); + QFileInfo fileInfo( filePath ); + if ( fileInfo.isFile() ) { + mOperationService->syncLaunchFileOpen( filePath ); + } + } + } + FM_LOG("FmFileBrowseWidget::on_listActivated end"); +} + +void FmFileBrowseWidget::on_tree_activated( const QModelIndex &index ) +{ + if (!mSelectable) { + mTreeView->setExpanded( index, !mTreeView->isExpanded( index ) ); + } +} + +void FmFileBrowseWidget::on_list_longPressed( HbAbstractViewItem *item, const QPointF &coords ) +{ + mListLongPressed = true; + HbMenu *contextMenu = new HbMenu(); + mCurrentItem = item; + + HbAction *viewAction = new HbAction(); + viewAction->setObjectName( "viewAction" ); + viewAction->setText( hbTrId( "txt_fmgr_menu_view_details_file" ) ); + contextMenu->addAction( viewAction ); + + connect( viewAction, SIGNAL( triggered() ), + this, SLOT( on_viewAction_triggered() ), Qt::QueuedConnection ); + + //copy + HbAction *copyAction = new HbAction(); + copyAction->setObjectName( "copyAction" ); + copyAction->setText( hbTrId( "txt_fmgr_menu_copy" ) ); + contextMenu->addAction( copyAction ); + + connect( copyAction, SIGNAL( triggered() ), + this, SLOT( on_copyAction_triggered() ), Qt::QueuedConnection ); + + + QString filePath( mModel->filePath( item->modelIndex() ) ); + QString formatFilePath( FmUtils::fillPathWithSplash( filePath ) ); + QFileInfo fileInfo( filePath ); + + if( ( fileInfo.isFile() ) || ( fileInfo.isDir() && !( FmUtils::isDefaultFolder( formatFilePath ) ) ) ){ + //Move + HbAction *moveAction = new HbAction(); + moveAction->setObjectName( "moveAction" ); + moveAction->setText( hbTrId( "txt_fmgr_menu_move" ) ); + contextMenu->addAction( moveAction ); + + connect( moveAction, SIGNAL( triggered() ), + this, SLOT( on_moveAction_triggered() ), Qt::QueuedConnection ); + + //Delete + HbAction *deleteAction = new HbAction(); + deleteAction->setObjectName( "deleteAction" ); + deleteAction->setText( hbTrId( "txt_fmgr_menu_delete" ) ); + contextMenu->addAction( deleteAction ); + + connect( deleteAction, SIGNAL( triggered() ), + this, SLOT( on_deleteAction_triggered() ), Qt::QueuedConnection ); + + //rename + HbAction *renameAction = new HbAction(); + renameAction->setObjectName( "renameAction" ); + renameAction->setText( hbTrId( "txt_fmgr_menu_rename" ) ); + contextMenu->addAction( renameAction ); + + connect( renameAction, SIGNAL( triggered() ), + this, SLOT( on_renameAction_triggered() ), Qt::QueuedConnection ); + } + +// if( fileInfo.isFile() ){ +// HbAction *sendAction = new HbAction(); +// sendAction->setObjectName( "sendAction" ); +// sendAction->setText( hbTrId( "txt_fmgr_menu_send" ) ); +// contextMenu->addAction( sendAction ); +// +// connect( sendAction, SIGNAL( triggered() ), +// this, SLOT( on_sendAction_triggered() ) ); +// } + + contextMenu->setPreferredPos( coords ); + contextMenu->open(); +} + +void FmFileBrowseWidget::on_list_pressed( const QModelIndex & index ) +{ + mListLongPressed = false; +} + +void FmFileBrowseWidget::on_tree_longPressed( HbAbstractViewItem *item, const QPointF &coords ) +{ + Q_UNUSED( item ); + Q_UNUSED( coords ); + /* + HbMenu *contextMenu = new HbMenu( this ); + + if ( isFolder( item->modelIndex() ) ) { + contextMenu->addAction("View details"); + contextMenu->addAction("Copy"); + contextMenu->addAction("Rename"); + contextMenu->addAction("Delete"); + } else { + contextMenu->addAction("View details"); + contextMenu->addAction("Open"); + contextMenu->addAction("Copy"); + contextMenu->addAction("Rename"); + contextMenu->addAction("Delete"); + } + + contextMenu->exec( coords ); + */ +} + +void FmFileBrowseWidget::initListView() +{ + mListView = new HbListView(); + mListView->setObjectName( "list" ); + mListView->setModel( mModel ); + + connect( mListView, SIGNAL( activated( const QModelIndex& ) ), + this, SLOT( on_list_activated( const QModelIndex& ) ) ); + connect( this, SIGNAL( listActivated() ), + this, SLOT( on_listActivated() ), Qt::QueuedConnection ); + connect( mListView, SIGNAL( pressed( const QModelIndex & ) ), + this, SLOT( on_list_pressed( const QModelIndex & ) ) ); + connect( mListView, SIGNAL( longPressed( HbAbstractViewItem *, const QPointF & ) ), + this, SLOT( on_list_longPressed( HbAbstractViewItem *, const QPointF & ) ) ); +} + +void FmFileBrowseWidget::initTreeView() +{ + mTreeView = new HbTreeView(); + mTreeView->setObjectName( "tree" ); + mTreeView->setModel( mModel ); + + connect( mTreeView, SIGNAL( activated( const QModelIndex& ) ), + this, SLOT( on_tree_activated( const QModelIndex& ) ) ); + connect( mTreeView, SIGNAL( longPressed( HbAbstractViewItem *, const QPointF & ) ), + this, SLOT( on_tree_longPressed( HbAbstractViewItem *, const QPointF & ) ) ); +} + +void FmFileBrowseWidget::initFileModel() +{ + mModel = new QFileSystemModel( this ); + mModel->setReadOnly( false ); + + mFileIconProvider = new FmFileIconProvider(); + mModel->setIconProvider( mFileIconProvider ); +} + +void FmFileBrowseWidget::initLayout() +{ + mLayout = new QGraphicsLinearLayout( this ); + mLayout->setOrientation( Qt::Vertical ); + + setLayout( mLayout ); +} + +void FmFileBrowseWidget::initSearchPanel() +{ + mSearchPanel = new HbSearchPanel( this ); + mSearchPanel->setObjectName( "searchPanel" ); + mSearchPanel->setSearchOptionsEnabled( true ); + mSearchPanel->setProgressive( false ); + mSearchPanel->hide(); + + connect( mSearchPanel, SIGNAL( searchOptionsClicked() ), + this, SLOT( on_searchPanel_searchOptionsClicked() ), Qt::QueuedConnection ); + + connect( mSearchPanel, SIGNAL( criteriaChanged( const QString & ) ), + this, SLOT( on_searchPanel_criteriaChanged( const QString & ) ) ); + + connect( mSearchPanel, SIGNAL( exitClicked() ), + this, SLOT( on_searchPanel_exitClicked() ) ); +} + +void FmFileBrowseWidget::initEmptyTipsLabel() +{ + mEmptyTipLabel = new HbLabel( this ); + mEmptyTipLabel->setObjectName( "searchPanel" ); + mEmptyTipLabel->hide(); +} + + +void FmFileBrowseWidget::changeRootIndex( const QModelIndex &index ) +{ + QString filePath = mModel->fileInfo( index ).absoluteFilePath(); + setRootPath( filePath ); +} + +bool FmFileBrowseWidget::isDriver(const QModelIndex &index) const +{ + QString path = mModel->filePath(index); + return path.right(1) == ":"; +} + +bool FmFileBrowseWidget::isFolder(const QModelIndex &index) const +{ + if( isDriver( index ) ) { + return false; + } + + return mModel->isDir(index); +} + +void FmFileBrowseWidget::setModelFilter( QDir::Filters filters ) +{ + mModel->setFilter( filters ); +} + +void FmFileBrowseWidget::on_driveChanged() +{ + FM_LOG( "FmFileBrowseWidget::on_driveChanged start" ); + QString currPath( currentPath().absoluteFilePath() ); + + if(style()==ListStyle) { + // display normally, setRootPath again to check if drive is available + setRootPath( currPath ); + } else{ + // display label style, setRootPath to drive root + setRootPath( mCurrentDrive ); + } + emit setTitle( FmUtils::fillDriveVolume( mCurrentDrive, true ) ); + FM_LOG( "FmFileBrowseWidget::on_driveChanged end" ); +} + +int FmFileBrowseWidget::checkPathAndSetStyle( const QString& path ) +{ + FM_LOG( "FmFileBrowseWidget::checkPathAndSetStyle start_" + path ); + int err = FmUtils::isPathAccessabel( path ); + switch( err ) + { + case FmErrNone: + { + setStyle( mFileBrowseStyle ); + emit setEmptyMenu( false ); + break; + } + case FmErrDriveNotAvailable: + { + QString driveName = FmUtils::getDriveNameFromPath( path ); + FmDriverInfo::DriveState state = FmUtils::queryDriverInfo( driveName ).driveState(); + + if( state & FmDriverInfo::EDriveLocked ) { + mEmptyTipLabel->setPlainText( hbTrId( "Drive is locked" ) ); + } else if( state & FmDriverInfo::EDriveNotPresent ) { + mEmptyTipLabel->setPlainText( hbTrId( "Drive is not present" ) ); + } else if( state & FmDriverInfo::EDriveCorrupted ) { + mEmptyTipLabel->setPlainText( hbTrId( "Drive is Corrupted" ) ); + } else { + mEmptyTipLabel->setPlainText( hbTrId( "Drive can not be opened " ) ); + } + setStyle( LabelStyle ); + //hide search panel when the drive is removed + if ( mSearchPanel->isVisible() ){ + mSearchPanel->hide(); + mLayout->removeItem( mSearchPanel ); + } + emit setEmptyMenu( true ); + break; + } + case FmErrPathNotExist: + case FmErrDriveDenied: + case FmErrPathDenied: + { + // do not tack any action, error note shoule be shown by invoker. + // checkPathAndSetStyle just check path and set style. + break; + } + default: + Q_ASSERT_X( false, "checkPathAndSetStyle", "please handle all error from isPathAccessabel" ); + break; + } + return err; +} + +void FmFileBrowseWidget::sortFiles( TSortType sortType ) +{ + switch( sortType ){ + case ESortByName:{ + mModel->sort( QFileSystemSortName ); + } + break; + case ESortByTime:{ + mModel->sort( QFileSystemSortTime ); + } + break; + case ESortBySize:{ + mModel->sort( QFileSystemSortSize ); + } + break; + case ESortByType:{ + mModel->sort( QFileSystemSortType ); + } + break; + default: + break; + } +} + +void FmFileBrowseWidget::activeSearchPanel() +{ + mFindTargetPath.clear(); + mLayout->addItem( mSearchPanel ); + mSearchPanel->show(); +} + +void FmFileBrowseWidget::on_searchPanel_searchOptionsClicked() +{ + mFindTargetPath = FmUtils::fillPathWithSplash( FmFileDialog::getExistingDirectory( 0, hbTrId( "Look in:" ), QString(""), + QStringList() ) ); +} + +void FmFileBrowseWidget::on_searchPanel_criteriaChanged( const QString &criteria ) +{ + if( mFindTargetPath.isEmpty() ){ + mFindTargetPath = currentPath().filePath(); + } + emit startSearch( mFindTargetPath, criteria ); + + mSearchPanel->hide(); + mLayout->removeItem( mSearchPanel ); +} + +void FmFileBrowseWidget::on_searchPanel_exitClicked() +{ + mSearchPanel->hide(); + mLayout->removeItem( mSearchPanel ); +} + +void FmFileBrowseWidget::on_sendAction_triggered() +{ + QString filePath = mModel->filePath( mCurrentItem->modelIndex() ); + QStringList list; + list.append( filePath ); + FmUtils::sendFiles( list ); +} + +void FmFileBrowseWidget::on_viewAction_triggered() +{ + QString filePath = mModel->filePath( mCurrentItem->modelIndex() ); + QFileInfo fileInfo = mModel->fileInfo( mCurrentItem->modelIndex() ); + + if( fileInfo.isDir() ){ + mOperationService->asyncViewFolderDetails( filePath ); + } + else if( fileInfo.isFile() ){ + FmViewDetailsDialog::showFileViewDetailsDialog( filePath, FmUtils::getDriveLetterFromPath( filePath ) ); + } +} + +void FmFileBrowseWidget::on_deleteAction_triggered() +{ + QStringList fileList; + fileList.push_back( mModel->filePath( mCurrentItem->modelIndex() ) ); + if ( FmDlgUtils::question( hbTrId("Confirm Deletion?" ) )) { + int ret = mOperationService->asyncRemove( fileList ); + switch( ret ) { + case FmErrNone: + // no error, do not show note to user + break; + case FmErrAlreadyStarted: + // last operation have not finished + FmDlgUtils::information( hbTrId( "Operatin already started!" ) ); + break; + case FmErrWrongParam: + FmDlgUtils::information( hbTrId( "Wrong parameters!" ) ); + break; + default: + FmDlgUtils::information( hbTrId( "Operation fail to start!" ) ); + } + } +} + +void FmFileBrowseWidget::on_copyAction_triggered() +{ + QStringList srcFileList; + srcFileList.push_back( mModel->filePath( mCurrentItem->modelIndex() ) ); + + QString targetPathName = FmFileDialog::getExistingDirectory( 0, hbTrId( "copy to" ), + QString(""), QStringList() ); + if( !targetPathName.isEmpty() ) { + targetPathName = FmUtils::fillPathWithSplash( targetPathName ); + + int ret = mOperationService->asyncCopy( + srcFileList, targetPathName ); + switch( ret ) { + case FmErrNone: + // no error, do not show note to user + break; + case FmErrAlreadyStarted: + // last operation have not finished + FmDlgUtils::information( hbTrId( "Operatin already started!" ) ); + break; + case FmErrWrongParam: + FmDlgUtils::information( hbTrId( "Wrong parameters!" ) ); + break; + default: + FmDlgUtils::information( hbTrId( "Operation fail to start!" ) ); + } + } + +} + +void FmFileBrowseWidget::on_moveAction_triggered() +{ + QStringList fileList; + fileList.push_back( mModel->filePath( mCurrentItem->modelIndex() ) ); + + QString targetPathName = FmFileDialog::getExistingDirectory( 0, hbTrId( "move to" ), + QString(""), QStringList() ); + + if( !targetPathName.isEmpty() ) { + targetPathName = FmUtils::fillPathWithSplash( targetPathName ); + + int ret = mOperationService->asyncMove( fileList, targetPathName ); + switch( ret ) { + case FmErrNone: + // no error, do not show note to user + break; + case FmErrAlreadyStarted: + // last operation have not finished + FmDlgUtils::information( hbTrId( "Operatin already started!" ) ); + break; + case FmErrWrongParam: + FmDlgUtils::information( hbTrId( "Wrong parameters!" ) ); + break; + default: + FmDlgUtils::information( hbTrId( "Operation fail to start!" ) ); + } + } +} + + +void FmFileBrowseWidget::on_renameAction_triggered() +{ + QString filePath = mModel->filePath( mCurrentItem->modelIndex() ); + QFileInfo fileInfo = mModel->fileInfo( mCurrentItem->modelIndex() ); + int maxFileNameLength = FmUtils::getMaxFileNameLength(); + // regExpList used to disable primary action of text query dialog if input text is not match + QStringList regExpList = (QStringList() << Regex_ValidFileFolderName << Regex_ValidNotEndWithDot ); + + QString oldSuffix( fileInfo.suffix() ); + QString newName( fileInfo.fileName() ); + while( FmDlgUtils::showTextQuery( hbTrId( "Enter new name for %1" ).arg( newName ), newName, regExpList, + maxFileNameLength, QString() , true ) ){ + // remove whitespace from the start and the end. + newName = newName.trimmed(); + QString newTargetPath = FmUtils::fillPathWithSplash( + fileInfo.absolutePath() ) + newName; + QFileInfo newFileInfo( newTargetPath ); + QString errString; + // check if name/path is available for use + // add new Name to check, in order to avoid problem of newName is empty + if( !FmUtils::checkNewFolderOrFile( newName, newTargetPath, errString ) ) { + FmDlgUtils::information( errString ); + continue; + } + if( !rename( fileInfo.absoluteFilePath(), newTargetPath ) ) { + FmDlgUtils::information( hbTrId("Rename failed!") ); + } + else { + // Rename succeed + if ( ( oldSuffix.compare( newFileInfo.suffix(), Qt::CaseInsensitive ) != 0 ) + && newFileInfo.isFile() ) { + // popup warning when the suffix of file is changed. + FmDlgUtils::information( hbTrId( "File may become unusable when file name extension is changed" ) ); + } + } + break; + } +} + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmfilebrowsewidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,152 @@ +/* +* 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: +* Zhiqiang Yang +* +* Description: +* The header file of the widget to browse files +* +*/ + +#ifndef FMFILEBROWSEWIDGET_H +#define FMFILEBROWSEWIDGET_H + +#include "fmcommon.h" +#include "fmoperationservice.h" + +#include + +#include +#include + +class QFileSystemModel; +class QGraphicsLinearLayout; +class HbListView; +class HbTreeView; +class HbAbstractViewItem; +class HbSearchPanel; +class HbLabel; + +class FmFileIconProvider; + +class FmFileBrowseWidget : public HbWidget +{ + Q_OBJECT + +public: + enum Style { + NoStyle, + ListStyle, + TreeStyle, + LabelStyle + }; + + enum TSortType{ + ESortByName, + ESortByTime, + ESortBySize, + ESortByType + }; + + explicit FmFileBrowseWidget( HbWidget *parent = 0, FmFileBrowseWidget::Style style = ListStyle ); + ~FmFileBrowseWidget(); + + QFileInfo currentPath() const; + QList checkedItems() const; + Style style() const { return mStyle; } + void setStyle( FmFileBrowseWidget::Style style ); + bool selectable() const; + void setSelectable( bool enable ); + void clearSelection(); + + bool rename( const QString &oldName, const QString &newName ); + void setModelFilter( QDir::Filters filters ); + + int checkPathAndSetStyle( const QString& path ); + void sortFiles( TSortType sortType ); + void activeSearchPanel(); + +public slots: + bool cdUp(); + void setRootPath( const QString &pathName ); + + // triggered when drive is ejected/inserted + void on_driveChanged(); + + void on_searchPanel_searchOptionsClicked(); + void on_searchPanel_criteriaChanged( const QString &criteria ); + void on_searchPanel_exitClicked(); + +signals: + void currentPathChanged( const QString& ); + void startSearch( const QString &targetPath, const QString &criteria ); + void setEmptyMenu( bool isMenuEmpty ); + void setTitle( const QString &title ); + void listActivated(); + +private slots: + void on_list_activated( const QModelIndex &index ); + void on_listActivated(); + void on_tree_activated( const QModelIndex &index ); + void on_list_longPressed( HbAbstractViewItem *item, const QPointF &coords ); + void on_list_pressed( const QModelIndex & index ) ; + void on_tree_longPressed( HbAbstractViewItem *item, const QPointF &coords ); + + void on_viewAction_triggered(); + void on_copyAction_triggered(); + void on_moveAction_triggered(); + void on_deleteAction_triggered(); + void on_renameAction_triggered(); + void on_sendAction_triggered(); + +private: + void initListView(); + void initTreeView(); + void initFileModel(); + void initLayout(); + void initSearchPanel(); + void initEmptyTipsLabel(); + + void changeRootIndex( const QModelIndex &index ); + bool isDriver(const QModelIndex &index) const; + bool isFolder(const QModelIndex &index) const; + + HbTreeView *mTreeView; + HbListView *mListView; + QGraphicsLinearLayout *mLayout; + QFileSystemModel *mModel; + + bool mSelectable; + + //currentStyle + Style mStyle; + //used to store original tree/list style + Style mFileBrowseStyle; + + HbAbstractViewItem* mCurrentItem; + FmOperationService *mOperationService; + + QString mFindTargetPath; + HbSearchPanel *mSearchPanel; + HbLabel *mEmptyTipLabel; + + QString mCurrentDrive; + + //used to avoid activate when long press list. + bool mListLongPressed; + QModelIndex mActivatedModelIndex; + + // provide icon from filemanger + FmFileIconProvider *mFileIconProvider; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmfileview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmfileview.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,531 @@ +/* +* 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: +* Zhiqiang Yang +* Steven Yao +* +* Description: +* The source file of the file browse view of file manager +* +*/ + +#include "fmfileview.h" +#include "fmutils.h" +#include "fmfiledialog.h" +#include "fmfilebrowsewidget.h" +#include "fmviewmanager.h" +#include "fmoperationservice.h" +#include "fmdlgutils.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +FmFileView::FmFileView() : FmViewBase( EFileView ), mWidget( 0 ), + mUpButton( 0 ), mStyleAction( 0 ), mSelectableAction( 0 ), + mFindAction( 0 ), mOperationService( 0 ), mMenu( 0 ), mIsFindDisabled( false ) +{ + mOperationService = FmViewManager::viewManager()->operationService(); + initMenu(); + initMainWidget(); + initToolBar(); + + QMetaObject::connectSlotsByName( this ); +} + +FmFileView::~FmFileView() +{ + removeToolBarAction(); +} + +void FmFileView::setRootPath( const QString &pathName ) +{ + if( pathName.isEmpty() ) { + return; + } + mWidget->setRootPath( pathName ); + QString driveName = FmUtils::getDriveNameFromPath( pathName ); + /* + FmDriverInfo driverInfo = FmUtils::queryDriverInfo( driveName ); + QString volumeName = driverInfo.volumeName(); + if( volumeName.isEmpty() ){ + FmDriverInfo::DriveState driveState = FmUtils::queryDriverInfo( driveName ).driveState(); + if( !( driveState & FmDriverInfo::EDriveNotPresent ) ){ + if( driveState & FmDriverInfo::EDriveRemovable ) { + if( driveState & FmDriverInfo::EDriveMassStorage ) { + volumeName.append( hbTrId( "Mass Storage" ) ); + } + else{ + volumeName.append( hbTrId( "Memory Card" ) ); + } + } + else{ + volumeName.append( hbTrId( "Phone Memory" ) ); + } + } + } + */ + //QString titleText = FmUtils::removePathSplash( driverInfo.name() ) + ' ' + volumeName; + QString titleText( FmUtils::fillDriveVolume( driveName, true ) ); + setTitle( titleText ); +} + +void FmFileView::setRootLevelPath( const QString &pathName ) +{ + rootLevelPath = FmUtils::fillPathWithSplash( pathName ); +} + +void FmFileView::setFindDisabled( bool disable ) +{ + mIsFindDisabled = disable; + if( mFindAction ) { + mFindAction->setDisabled( mIsFindDisabled ); + } +} + +void FmFileView::initMenu() +{ + HbAction *action = 0; +#ifdef FM_CHANGE_ORIENT_ENABLE + action = new HbAction( this ); + action->setObjectName( "rotateAction" ); + action->setText( hbTrId( "Change orientation" ) ); + menu()->addAction( action ); +#endif + +// mStyleAction = new HbAction(); +// mStyleAction->setObjectName( "switchStyle" ); +// menu()->addAction( mStyleAction ); + + mSelectableAction = new HbAction(); + mSelectableAction->setObjectName( "setSelectable" ); + menu()->addAction( mSelectableAction ); + connect( mSelectableAction, SIGNAL( triggered() ), + this, SLOT( on_setSelectable_triggered() ), Qt::QueuedConnection ); + + + action = new HbAction(); + action->setObjectName( "delete" ); + action->setText( hbTrId( "txt_fmgr_menu_delete" ) ); + menu()->addAction( action ); + connect( action, SIGNAL( triggered() ), + this, SLOT( on_delete_triggered() ), Qt::QueuedConnection ); + + action = new HbAction(); + action->setObjectName( "copy" ); + action->setText( hbTrId( "txt_fmgr_menu_copy" ) ); + menu()->addAction( action ); + connect( action, SIGNAL( triggered() ), + this, SLOT( on_copy_triggered() ), Qt::QueuedConnection ); + + action = new HbAction(); + action->setObjectName( "move" ); + action->setText( hbTrId( "txt_fmgr_menu_move" ) ); + menu()->addAction( action ); + connect( action, SIGNAL( triggered() ), + this, SLOT( on_move_triggered() ), Qt::QueuedConnection ); + + action = new HbAction(); + action->setObjectName( "newFolder" ); + action->setText( hbTrId( "txt_fmgr_opt_new_folder" ) ); + menu()->addAction( action ); + connect( action, SIGNAL( triggered() ), + this, SLOT( on_newFolder_triggered() ), Qt::QueuedConnection ); + + HbMenu *subMenu = new HbMenu( hbTrId( "Sort" ) ); + HbAction *sortNameAction = new HbAction( subMenu ); + sortNameAction->setObjectName( "sortNameAction" ); + sortNameAction->setText( hbTrId( "Sort by name" ) ); + subMenu->addAction( sortNameAction ); + + HbAction *sortTimeAction = new HbAction( subMenu ); + sortTimeAction->setObjectName( "sortTimeAction" ); + sortTimeAction->setText( hbTrId( "Sort by time" ) ); + subMenu->addAction( sortTimeAction ); + + HbAction *sortSizeAction = new HbAction( subMenu ); + sortSizeAction->setObjectName( "sortSizeAction" ); + sortSizeAction->setText( hbTrId( "Sort by size" ) ); + subMenu->addAction( sortSizeAction ); + + HbAction* sortTypeAction = new HbAction( subMenu ); + sortTypeAction->setObjectName( "sortTypeAction" ); + sortTypeAction->setText( hbTrId( "Sort by type" ) ); + subMenu->addAction( sortTypeAction ); + + menu()->addMenu( subMenu ); + + connect( sortNameAction, SIGNAL( triggered() ), + this, SLOT( on_sortNameAction_triggered() ), Qt::QueuedConnection ); + connect( sortTimeAction, SIGNAL( triggered() ), + this, SLOT( on_sortTimeAction_triggered() ), Qt::QueuedConnection ); + connect( sortSizeAction, SIGNAL( triggered() ), + this, SLOT( on_sortSizeAction_triggered() ), Qt::QueuedConnection ); + connect( sortTypeAction, SIGNAL( triggered() ), + this, SLOT( on_sortTypeAction_triggered() ), Qt::QueuedConnection ); + + mMenu = takeMenu(); +} + +void FmFileView::initMainWidget() +{ + QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout( this ); + vLayout->setOrientation( Qt::Vertical ); + + mWidget = new FmFileBrowseWidget( this ); + mWidget->setObjectName( "mainWidget" ); + setStyle( FmFileBrowseWidget::ListStyle ); + setSelectable( false ); + + vLayout->addItem( mWidget ); + //set stretch factor to file browser widget, so that it could fully cover the client area. + vLayout->setStretchFactor( mWidget, 1 ); + + setLayout( vLayout ); + + connect( mWidget, SIGNAL( startSearch( const QString&, const QString& ) ), + this, SLOT( startSearch( const QString&, const QString& ) ) ); + connect( mWidget, SIGNAL( setEmptyMenu( bool ) ), + this, SLOT( on_mainWidget_setEmptyMenu( bool ) ) ); + connect( mWidget, SIGNAL( setTitle( const QString & ) ), + this, SLOT( on_mainWidget_setTitle( const QString & ) ) ); +} + +void FmFileView::initToolBar() +{ + toolBar()->clearActions(); + mFindAction = new HbAction( this ); + mFindAction->setObjectName( "leftAction" ); + mFindAction->setText( hbTrId("txt_fmgr_opt_find") ); + mFindAction->setDisabled( mIsFindDisabled ); + toolBar()->addAction( mFindAction ); + + mToolBarRightAction = new HbAction( this ); + mToolBarRightAction->setObjectName( "rightAction" ); + mToolBarRightAction->setText( hbTrId( "up" ) ); + toolBar()->addAction( mToolBarRightAction ); + + toolBar()->setOrientation( Qt::Horizontal ); + + //mToolBar = takeToolBar(); + connect( mFindAction, SIGNAL( triggered() ), + this, SLOT( on_leftAction_triggered() ) ); + connect( mToolBarRightAction, SIGNAL( triggered() ), + this, SLOT( on_rightAction_triggered() ), Qt::QueuedConnection ); + +} + +void FmFileView::setStyle( FmFileBrowseWidget::Style style ) +{ + /* + if ( style == FmFileBrowseWidget::ListStyle ) { + mStyleAction->setText( hbTrId("Tree") ); + } else if ( style == FmFileBrowseWidget::TreeStyle ) { + mStyleAction->setText( hbTrId("List") ); + } + */ + mWidget->setStyle( style ); +} + +void FmFileView::setSelectable( bool enable ) +{ + if (enable) { + mSelectableAction->setText( hbTrId("No Select") ); + } else { + mSelectableAction->setText( hbTrId("Select") ); + } + + mWidget->setSelectable( enable ); +} + +void FmFileView::infoNoFileSelected() +{ + FmDlgUtils::information( hbTrId("No File/Folder selected" ) ); +} + +#ifdef FM_CHANGE_ORIENT_ENABLE +void FmFileView::on_rotateAction_triggered() +{ + if ( mainWindow()->orientation() == Qt::Vertical ) { + mainWindow()->setOrientation( Qt::Horizontal ); + } + else { + mainWindow()->setOrientation( Qt::Vertical ); + } +} +#endif + +void FmFileView::on_switchStyle_triggered() +{ + if (mWidget->style() == FmFileBrowseWidget::ListStyle) { + setStyle( FmFileBrowseWidget::TreeStyle ); + } else if (mWidget->style() == FmFileBrowseWidget::TreeStyle) { + setStyle( FmFileBrowseWidget::ListStyle ); + } +} + +void FmFileView::on_setSelectable_triggered() +{ + setSelectable( !mWidget->selectable() ); +} + +void FmFileView::on_delete_triggered() +{ + QList files = mWidget->checkedItems(); + if (files.size() == 0) { + infoNoFileSelected(); + } else { + if (FmDlgUtils::question( hbTrId("Confirm Deletion?" ) )) { + QStringList fileList; + for (int i = 0; i < files.size(); ++i) { + fileList.push_back( files[i].absoluteFilePath() ); + } + int ret = mOperationService->asyncRemove( fileList ); + switch( ret ) { + case FmErrNone: + // no error, do not show note to user + break; + case FmErrAlreadyStarted: + // last operation have not finished + FmDlgUtils::information( hbTrId( "Operatin already started!" ) ); + break; + case FmErrWrongParam: + FmDlgUtils::information( hbTrId( "Wrong parameters!" ) ); + break; + default: + FmDlgUtils::information( hbTrId( "Operation fail to start!" ) ); + } + setSelectable( false ); + } + } +} + +void FmFileView::on_copy_triggered() +{ + QList files = mWidget->checkedItems(); + QStringList srcFileList; + + if (files.size() == 0) { + infoNoFileSelected(); + } else { + QString targetPathName = FmFileDialog::getExistingDirectory( 0, hbTrId( "copy to" ), + QString(""), QStringList() ); + if( !targetPathName.isEmpty() && files.size() > 0 ) { + targetPathName = FmUtils::fillPathWithSplash( targetPathName ); + + foreach( QFileInfo fileInfo, files ){ + srcFileList.push_back( fileInfo.absoluteFilePath() ); + } + + int ret = mOperationService->asyncCopy( + srcFileList, targetPathName ); + switch( ret ) { + case FmErrNone: + // no error, do not show note to user + break; + case FmErrAlreadyStarted: + // last operation have not finished + FmDlgUtils::information( hbTrId( "Operatin already started!" ) ); + break; + case FmErrWrongParam: + FmDlgUtils::information( hbTrId( "Wrong parameters!" ) ); + break; + default: + FmDlgUtils::information( hbTrId( "Operation fail to start!" ) ); + } + setSelectable( false ); + } + } + +} + +void FmFileView::on_move_triggered() +{ + QList files = mWidget->checkedItems(); + + if (files.size() == 0) { + infoNoFileSelected(); + } else { + QString targetPathName = FmFileDialog::getExistingDirectory( 0, hbTrId( "move to" ), + QString(""), QStringList() ); + + if( !targetPathName.isEmpty() && files.size() > 0 ) { + targetPathName = FmUtils::fillPathWithSplash( targetPathName ); + + QStringList fileList; + for (int i = 0; i < files.size(); ++i) { + fileList.push_back( files[i].absoluteFilePath() ); + } + int ret = mOperationService->asyncMove( fileList, targetPathName ); + switch( ret ) { + case FmErrNone: + // no error, do not show note to user + break; + case FmErrAlreadyStarted: + // last operation have not finished + FmDlgUtils::information( hbTrId( "Operatin already started!" ) ); + break; + case FmErrWrongParam: + FmDlgUtils::information( hbTrId( "Wrong parameters!" ) ); + break; + default: + FmDlgUtils::information( hbTrId( "Operation fail to start!" ) ); + } + setSelectable( false ); + } + } +} + +void FmFileView::on_newFolder_triggered() +{ + int maxFileNameLength = FmUtils::getMaxFileNameLength(); + QString associatedDrive = FmUtils::getDriveLetterFromPath( mWidget->currentPath().absoluteFilePath() ); + QString path = FmUtils::fillPathWithSplash( mWidget->currentPath().absoluteFilePath() ); + QString dirName = createDefaultFolderName( path ); + QStringList regExpList = (QStringList() << Regex_ValidFileFolderName << Regex_ValidNotEndWithDot ); + + QDir dir( path ); + if( dir.exists() ) { + while( FmDlgUtils::showTextQuery( hbTrId( "txt_fmgr_title_new_folder" ), dirName, + regExpList, maxFileNameLength, associatedDrive , false ) ){ + // remove whitespace from the start and the end. + dirName = dirName.trimmed(); + QString newTargetPath = FmUtils::fillPathWithSplash( + dir.absolutePath() ) + dirName; + QString errString; + // check if name/path is available for use + if( !FmUtils::checkNewFolderOrFile( dirName, newTargetPath, errString ) ) { + FmDlgUtils::information( errString ); + continue; + } + if( !dir.mkdir( dirName ) ) { + FmDlgUtils::information( hbTrId("Operation failed!") ); + } + break; + } + + } +} + +void FmFileView::on_upAction_triggered() +{ + mWidget->cdUp(); +} + +void FmFileView::on_leftAction_triggered() +{ + mWidget->activeSearchPanel(); +} + +void FmFileView::on_rightAction_triggered() +{ + QString currentPath( + FmUtils::fillPathWithSplash( mWidget->currentPath().filePath() ) ); + if( rootLevelPath.length() != 0 && + rootLevelPath.compare( currentPath, Qt::CaseInsensitive ) == 0 ) { + emit popViewAndShow(); + } else if ( !mWidget->cdUp() ) { + //hbInstance->allMainWindows()[0]->softKeyAction(Hb::SecondarySoftKey)->trigger(); + emit popViewAndShow(); + } +} + +void FmFileView::on_driveChanged() +{ + mWidget->on_driveChanged(); +} + +void FmFileView::on_sortNameAction_triggered() +{ + mWidget->sortFiles( FmFileBrowseWidget::ESortByName ); +} + +void FmFileView::on_sortTimeAction_triggered() +{ + mWidget->sortFiles( FmFileBrowseWidget::ESortByTime ); +} + +void FmFileView::on_sortSizeAction_triggered() +{ + mWidget->sortFiles( FmFileBrowseWidget::ESortBySize ); +} + +void FmFileView::on_sortTypeAction_triggered() +{ + mWidget->sortFiles( FmFileBrowseWidget::ESortByType ); +} + +void FmFileView::startSearch( const QString &targetPath, const QString &criteria ) +{ + if ( !criteria.isEmpty() && !targetPath.isEmpty() ) { + FmViewManager::viewManager()->createFindView( criteria, targetPath ); + } +} + +void FmFileView::removeToolBarAction() +{ + toolBar()->clearActions(); +} + +void FmFileView::on_mainWidget_setEmptyMenu( bool isMenuEmpty ) +{ + if( isMenuEmpty ){ + FM_LOG( "setEmptyMenu true" ); + if( !mMenu ) { + mMenu = takeMenu(); + } + toolBar()->clearActions(); + } + else { + FM_LOG( "setEmptyMenu false" ); + if( mMenu ) { + setMenu( mMenu ); + mMenu = 0; + } + initToolBar(); + } +} + +void FmFileView::on_mainWidget_setTitle( const QString &title ) +{ + this->setTitle( title ); +} + +QString FmFileView::createDefaultFolderName( const QString &path ) +{ + // create new folder name, for example, New folder(01), New folder(02) + QString checkedPath( FmUtils::fillPathWithSplash( path ) ); + QString dirName( hbTrId( "txt_fmgr_dialog_entry_new_folder" ) ); + QString dirAbsolutePath( checkedPath + dirName ); + QFileInfo fileInfo( dirAbsolutePath ); + int i = 0; + while ( fileInfo.exists() ) { + ++i; + QString numName; + if ( i < 10 ) { + numName.append( QString::number(0) ); + } + numName.append( QString::number(i) ); + // txt_fmgr_dialog_entry_new_folder_l1 is not available now. use actual text instead of it. + dirName = hbTrId( "New folder (%L1)" ).arg( numName ); + dirAbsolutePath = checkedPath + dirName; + fileInfo.setFile( dirAbsolutePath ); + } + return dirName; +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmfileview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmfileview.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,114 @@ +/* +* 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: +* Zhiqiang Yang +* +* Description: +* The header file of the file browse view of file manager +* +*/ + +#ifndef FMFILEVIEW_H +#define FMFILEVIEW_H + +#include "fmcommon.h" +#include "fmfilebrowsewidget.h" +#include "fmviewbase.h" + + +class HbLineEdit; +class HbPushButton; +class HbMenu; +class FmOperationService; + +class FmFileView : public FmViewBase +{ + Q_OBJECT +public: + FmFileView(); + virtual ~FmFileView(); + + void setRootLevelPath( const QString &pathName ); + void setFindDisabled( bool display ); + +public slots: + void setRootPath( const QString &pathName ); + + // triggered when drive is ejected/inserted. connected by FmViewManager + void on_driveChanged(); + +signals: + // connected by viewmanager to close view + void popViewAndShow(); + +private slots: + + void on_switchStyle_triggered(); + void on_setSelectable_triggered(); + void on_delete_triggered(); + void on_copy_triggered(); + void on_move_triggered(); + void on_newFolder_triggered(); + void on_upAction_triggered(); + void on_leftAction_triggered(); + void on_rightAction_triggered(); + void on_sortNameAction_triggered(); + void on_sortTimeAction_triggered(); + void on_sortSizeAction_triggered(); + void on_sortTypeAction_triggered(); + + void startSearch( const QString &targetPath, const QString &criteria ); + void on_mainWidget_setEmptyMenu( bool isMenuEmpty ); + void on_mainWidget_setTitle( const QString &title ); + +#ifdef FM_CHANGE_ORIENT_ENABLE + void on_rotateAction_triggered(); +#endif + +private: + void initMenu(); + void initMainWidget(); + void initToolBar(); + + void setStyle( FmFileBrowseWidget::Style style ); + void setSelectable( bool enable ); + void infoNoFileSelected(); + void removeToolBarAction(); + + /** + * Create Default folder name while create folder. + * + * @param path Current path. + * @return Default folder name for new folder. + */ + QString createDefaultFolderName( const QString &path ); + +private: + FmFileBrowseWidget *mWidget; + HbPushButton *mUpButton; + //HbLineEdit *mLineEdit; + HbAction *mStyleAction; + HbAction *mSelectableAction; + HbAction *mFindAction; + QString rootLevelPath; + + FmOperationService *mOperationService; + + HbAction *mToolBarRightAction; + HbMenu *mMenu; + + // store the disable state of find action. true for disabled + bool mIsFindDisabled; +}; + +#endif + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmfindresultmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmfindresultmodel.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,354 @@ +/* + * 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: + * Zhiqiang Yang + * + * Description: + * The find result model source file of file manager + */ + +#include "fmfindresultmodel.h" +#include "fmfindthread.h" +#include "fmfileiconprovider.h" + +#include + +#include + +/*! + \fn void finished() + This signal is emitted when find is finished. +*/ + +/*! + \fn void modelCountChanged( int count ) + This signal is emitted when data count in model is changed + \a count is current data count in model. + Currently only start find and get more find result will emit this signal. +*/ + +FmFindResultModel::FmFindResultModel( QObject *parent ) + : QAbstractListModel( parent ) +{ + init(); + connect( mFindThread, SIGNAL(finished()), this, SIGNAL(finished()) ); + connect( mFindThread, SIGNAL(found(QStringList)), this, SLOT(on_findThread_found( QStringList) ), Qt::BlockingQueuedConnection ); +} + +FmFindResultModel::~FmFindResultModel() +{ + delete mIconProvider; +} + +/*! + Returns the number of rows in the model. This value corresponds to the + number of items in the model's internal string list. + + The optional \a parent argument is in most models used to specify + the parent of the rows to be counted. Because this is a list if a + valid parent is specified, the result will always be 0. + + \sa insertRows(), removeRows(), QAbstractItemModel::rowCount() +*/ +int FmFindResultModel::rowCount( const QModelIndex &parent ) const +{ + if ( !parent.isValid() ) + return mFindResult.count(); + + return 0; +} + +int FmFindResultModel::columnCount( const QModelIndex &parent ) const +{ + if ( !parent.isValid() ) + return 4; + + return 0; +} + +QVariant FmFindResultModel::data( const QModelIndex &index, int role ) const +{ + if (!indexValid( index )) + return QVariant(); + + if (role == Qt::DisplayRole) { + switch (index.column()) { + case 0: return fileInfo( index ).fileName(); + case 1: return fileInfo( index ).size(); + case 2: return mIconProvider->type( fileInfo( index ) ); + case 3: return fileInfo( index ).lastModified().toString( Qt::LocalDate ); + default: + qWarning( "FmFindResultData: invalid display value column %d", index.column() ); + return QVariant(); + } + } + + if (index.column() == 0) { + if (role == FileIconRole) { + return mIconProvider->icon( fileInfo( index ) ); + } + } + + if (index.column() == 1 && role == Qt::TextAlignmentRole) { + return Qt::AlignRight; + } + + return QVariant(); +} + +QString FmFindResultModel::filePath ( const QModelIndex & index ) const +{ + return fileInfo( index ).filePath(); +} + +QVariant FmFindResultModel::headerData( int section, Qt::Orientation orientation, int role ) const +{ + if (orientation == Qt::Horizontal) { + if (role != Qt::DisplayRole) + return QVariant(); + + switch (section) { + case 0: return hbTrId("Name"); + case 1: return hbTrId("Size"); + case 2: return hbTrId("Type"); + case 3: return hbTrId("Date Modified"); + default: return QVariant(); + } + } + + return QAbstractItemModel::headerData( section, orientation, role ); +} + +/*! + Inserts \a dataList into the model, beginning at the given \a row. + + The \a parent index of the rows is optional and is only used for + consistency with QAbstractItemModel. By default, a null index is + specified, indicating that the rows are inserted in the top level of + the model. + + \sa QAbstractItemModel::insertRows() +*/ + +bool FmFindResultModel::insertRows( int row, const QStringList &dataList, const QModelIndex &parent ) +{ + if ( row < 0 || dataList.count() < 1 || row > rowCount(parent) ) + return false; + + beginInsertRows( QModelIndex(), row, row + dataList.count() - 1 ); + mFindResult.append( dataList ); + endInsertRows(); + + // emit modelCountChanged could let FmFindWidget switch style between EmptyTipWidget and ResultListview + // FmFindWidget will show an empty tip widget such as "No found files or folderss" if set 0 as parameter + emit modelCountChanged( rowCount() ); + + return true; +} + +/*! + Removes \a count rows from the model, beginning at the given \a row. + + The \a parent index of the rows is optional and is only used for + consistency with QAbstractItemModel. By default, a null index is + specified, indicating that the rows are removed in the top level of + the model. + + \sa QAbstractItemModel::removeRows() +*/ +bool FmFindResultModel::removeRows( int row, int count, const QModelIndex &parent ) +{ + if (row < 0 || count < 1 || (row + count) > rowCount(parent) ) + return false; + + beginRemoveRows( QModelIndex(), row, row + count - 1 ); + + for (int i = 0; i < count; ++i) + mFindResult.removeAt(row); + + endRemoveRows(); + + // emit modelCountChanged could let FmFindWidget switch style between EmptyTipWidget and ResultListview + // FmFindWidget will show an empty tip widget such as "No found files or folderss" if set 0 as parameter + emit modelCountChanged( rowCount() ); + + return true; +} + +QFileInfo FmFindResultModel::fileInfo( const QModelIndex &index ) const +{ + if (index.row() >= 0 && index.row() < mFindResult.size()) + return QFileInfo( mFindResult[index.row()] ); + else + return QFileInfo(); +} + +QString FmFindResultModel::findPath() const +{ + return mFindThread->findPath(); +} + +void FmFindResultModel::setFindPath( const QString &path ) +{ + mFindThread->setFindPath( path ); +} + +QRegExp FmFindResultModel::pattern() const +{ + return mFindThread->pattern(); +} + +void FmFindResultModel::setPattern( const QRegExp ®Exp ) +{ + mFindThread->setPattern( regExp ); +} + +void FmFindResultModel::find() +{ + if(mFindThread->isRunning()) + return; + + if( findPath().isEmpty() ){ + mFindThread->setLastResult( mFindResult ); + } + removeRows( 0, rowCount() ); + mFindThread->start(); +} + +void FmFindResultModel::stop() +{ + mFindThread->stop(); + mFindThread->wait(); +} + +bool FmFindResultModel::isFinding() const +{ + return mFindThread->isRunning(); +} + +/* + Receive \a dataList as some found result + Then insert dataList to model +*/ +void FmFindResultModel::on_findThread_found( const QStringList &dataList ) +{ + if( dataList.isEmpty() ) { + return; + } + insertRows( rowCount(), dataList ); +} + +bool FmFindResultModel::indexValid( const QModelIndex &index ) const +{ + Q_UNUSED( index ); + return true; +} + +void FmFindResultModel::init() +{ + mFindThread = new FmFindThread( this ); + mFindThread->setObjectName( "findThread" ); + mIconProvider = new FmFileIconProvider(); +} + +bool FmFindResultModel::caseNameLessThan(const QPair &s1, + const QPair &s2) +{ + QFileInfo info1( s1.first ); + QFileInfo info2( s2.first ); + + return info1.fileName() < info2.fileName(); +} + +bool FmFindResultModel::caseTimeLessThan(const QPair &s1, + const QPair &s2) +{ + QFileInfo info1( s1.first ); + QFileInfo info2( s2.first ); + + return info1.lastModified() < info2.lastModified(); +} + +bool FmFindResultModel::caseSizeLessThan(const QPair &s1, + const QPair &s2) +{ + QFileInfo info1( s1.first ); + QFileInfo info2( s2.first ); + + return info1.size() < info2.size(); +} + +bool FmFindResultModel::caseTypeLessThan(const QPair &s1, + const QPair &s2) +{ + QFileInfo info1( s1.first ); + QFileInfo info2( s2.first ); + + if( info1.isDir() != info2.isDir() ){ + return info1.isDir(); + } + else{ + return info1.suffix().toLower() < info2.suffix().toLower(); + } +} + +/*! + \reimp + Sort by \a column, which is aligned to \a SortFlag + \sa SortFlag +*/ +void FmFindResultModel::sort ( int column, Qt::SortOrder order ) +{ + // Sort algorithm comes from + // void QListModel::sort(int column, Qt::SortOrder order) + + Q_UNUSED( order ); + emit layoutAboutToBeChanged(); + + // store value and row pair. + QVector < QPair > sorting(mFindResult.count()); + for (int i = 0; i < mFindResult.count(); ++i) { + QString item = mFindResult.at(i); + sorting[i].first = item; + sorting[i].second = i; + } + + // sort in "sorting" + switch( ( SortFlag )column ) + { + case Name: + qSort( sorting.begin(), sorting.end(), caseNameLessThan ); + break; + case Time: + qSort( sorting.begin(), sorting.end(), caseTimeLessThan ); + break; + case Size: + qSort( sorting.begin(), sorting.end(), caseSizeLessThan ); + break; + case Type: + qSort( sorting.begin(), sorting.end(), caseTypeLessThan ); + break; + } + + // create from Indexes and toIndexes, then set sorted data back to mFindResult + QModelIndexList fromIndexes; + QModelIndexList toIndexes; + for (int r = 0; r < sorting.count(); ++r) { + QString item = sorting.at(r).first; + toIndexes.append(createIndex(r, 0)); + fromIndexes.append(createIndex(sorting.at(r).second, 0)); + mFindResult[r] = sorting.at(r).first; + } + changePersistentIndexList(fromIndexes, toIndexes); + + emit layoutChanged(); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmfindresultmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmfindresultmodel.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,97 @@ +/* + * 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: + * Zhiqiang Yang + * + * Description: + * The find result model header file of file manager + */ + +#ifndef FMFINDRESULTMODEL_H +#define FMFINDRESULTMODEL_H + +#include "fmcommon.h" + +#include +#include +#include +#include + +class FmFindThread; +class FmFileIconProvider; + +class FmFindResultModel : public QAbstractListModel +{ + Q_OBJECT +public: + enum Roles { + FileIconRole = Qt::DecorationRole + }; + + enum SortFlag { + Name = 0, + Time = 1, + Size = 2, + Type = 3 + }; + + FmFindResultModel( QObject *parent = 0 ); + ~FmFindResultModel(); + + int rowCount( const QModelIndex &parent = QModelIndex() ) const; + int columnCount( const QModelIndex &parent = QModelIndex() ) const; + QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; + QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; + bool insertRows( int row, const QStringList &dataList, const QModelIndex &parent = QModelIndex() ); + bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() ); + QString filePath ( const QModelIndex & index ) const; + + QFileInfo fileInfo( const QModelIndex &index ) const; + + QString findPath() const; + void setFindPath( const QString &path ); + + QRegExp pattern() const; + void setPattern( const QRegExp ®Exp ); + + void find(); + void stop(); + bool isFinding() const; + + virtual void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder ); + + static bool caseNameLessThan( const QPair &s1, + const QPair &s2 ); + static bool caseTimeLessThan( const QPair &s1, + const QPair &s2 ); + static bool caseSizeLessThan( const QPair &s1, + const QPair &s2 ); + static bool caseTypeLessThan( const QPair &s1, + const QPair &s2 ); + +signals: + void finished(); + void modelCountChanged( int count ); + +private slots: + void on_findThread_found( const QStringList &dataList ); + +private: + bool indexValid( const QModelIndex &index ) const; + void init(); + + FmFindThread *mFindThread; + QStringList mFindResult; + FmFileIconProvider *mIconProvider; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmfindthread.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmfindthread.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,173 @@ +/* + * 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: + * Zhiqiang Yang + * + * Description: + * The find thread header file of file manager + */ + +#include "fmfindthread.h" + +#include + +// current path, it may come from findDirs.first().entryInfoList() +#define CurrentDir QString( "." ) + +// parent path, it may come from findDirs.first().entryInfoList() +#define ParentDir QString( ".." ) + +// if got 5 result and have not send notify event, then send notify event +const int notifyPerCount = 5; + +// if got notifyPerElapsedTime milliseconds and have not send notify event, then send notify event. +const int notifyPerElapsedTime = 500; + +/*! + \fn void found( const QStringList &dataList ) + This signal is emitted when some data has been found and \a dataList is provided as data list. + Please connect this signal by Qt::BlockingQueuedConnection as dataList will be cleared immediately +*/ + +FmFindThread::FmFindThread( QObject *parent ) + : QThread( parent ) +{ + setPriority( LowPriority ); +} + +FmFindThread::~FmFindThread() +{ +} + +QString FmFindThread::findPath() const +{ + return mFindPath; +} + +void FmFindThread::setFindPath( const QString &path ) +{ + mFindPath = path; +} + +QRegExp FmFindThread::pattern() const +{ + return findPattern; +} + +void FmFindThread::setPattern( const QRegExp ®Exp ) +{ + findPattern = regExp; +} + +void FmFindThread::stop() +{ + mStop = true; +} + +void FmFindThread::run() +{ + mStop = false; + tempResultList.clear(); + if (findPattern.isEmpty() || !findPattern.isValid()) + return; + + QDir dir( mFindPath ); + if (!dir.exists()) + return; + + if( mFindPath.isEmpty() ){ + findInResult(); + return; + } + + QList findDirs; + findDirs.append( dir ); + time.restart(); + mStop = false; + while (!findDirs.isEmpty()) { + QFileInfoList infoList = findDirs.first().entryInfoList(); + for (QFileInfoList::Iterator it = infoList.begin(); it != infoList.end(); ++it) { + QString name = it->fileName(); + QString absolutPath = it->absoluteFilePath(); + if (findPattern.exactMatch( it->fileName() )) { + tempResultList.append( it->absoluteFilePath() ); + if (tempResultList.count() > notifyPerCount) { + emitFound(); + } else if (time.elapsed() > notifyPerElapsedTime && tempResultList.count() > 0) { + emitFound(); + } + } + + //We are stopped; + if (mStop) { + if( tempResultList.count() > 0 ) { + emitFound(); + } + return; + } + + // exclude directory named ".." and "." + if (it->isDir() && it->fileName() != ParentDir && it->fileName() != CurrentDir ) { + findDirs.append( QDir( it->absoluteFilePath() ) ); + } + } + + findDirs.removeFirst(); + } + + emitFound(); +} + +/* + Emit signal "found" to send out found data +*/ +void FmFindThread::emitFound() +{ + if( tempResultList.count() > 0 ) { + emit found( tempResultList ); + tempResultList.clear(); + time.restart(); + } +} + +void FmFindThread::setLastResult( QStringList r ) +{ + mLastResult = r; +} + +/* + Find keyword in last result + \sa setLastResult, this function must be called to set last result for findInResult +*/ +void FmFindThread::findInResult() +{ + if( mFindPath.isEmpty() ){ + for (QStringList::Iterator it = mLastResult.begin(); it != mLastResult.end(); ++it) { + if (mStop){ + return; + } + QString absolutPath = (*it); + QFileInfo fileInfo( absolutPath ); + QString fileName = fileInfo.fileName(); + + if (findPattern.exactMatch( fileName ) ) { + tempResultList.append( absolutPath ); + if ( tempResultList.count() > notifyPerCount ) { + emitFound(); + } else if (time.elapsed() > notifyPerElapsedTime && tempResultList.count() > 0) { + emitFound(); + } + } + } + } + emitFound(); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmfindthread.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmfindthread.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,66 @@ +/* + * 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: + * Zhiqiang Yang + * + * Description: + * The find thread header file of file manager + */ + +#ifndef FMFINDTHREAD_H +#define FMFINDTHREAD_H + +#include "fmcommon.h" + +#include +#include +#include +#include + +class FmFindThread : public QThread +{ + Q_OBJECT +public: + explicit FmFindThread( QObject *parent = 0 ); + ~FmFindThread(); + + QString findPath() const; + void setFindPath( const QString &path ); + + QRegExp pattern() const; + void setPattern( const QRegExp ®Exp ); + + void setLastResult( QStringList r ); + + void stop(); + +signals: + void found( const QStringList &dataList ); + +protected: + void run(); + +private: + void emitFound(); + void findInResult(); + + volatile bool mStop; + int count; + QString mFindPath; + QTime time; + QRegExp findPattern; + QStringList mLastResult; + // Used to store temp search result. if emit found, the result will be cleared. + QStringList tempResultList; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmfindview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmfindview.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,183 @@ +/* +* 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: +* Zhiqiang Yang +* +* Description: +* The source file of the file find view of file manager +* +*/ + +#include "fmfindview.h" +#include "fmfindwidget.h" +#include "fmviewmanager.h" + +#include +#include +#include + +FmFindView::FmFindView() : FmViewBase( EFindView ), + mWaitNote( 0 ), + mMenu( 0 ) +{ + initMenu(); + initMainWidget(); + initToolBar(); + + QMetaObject::connectSlotsByName( this ); +} + +FmFindView::~FmFindView() +{ + delete mWaitNote; + mWaitNote = 0; +} + +void FmFindView::activated( const QString& pathName ) +{ + FM_LOG( QString( "activate path from findview:" ) + pathName ); + FmViewManager::viewManager()->createFileView( pathName, true, true ); +} + +void FmFindView::find( const QString &keyword, const QString &path ) +{ + setTitle( keyword ); + mFindWidget->find( keyword, path ); + mWaitNote->open(); +} + +void FmFindView::stopFind() +{ + mFindWidget->stopFind(); +} + +void FmFindView::findFinished() +{ + if( mWaitNote ){ + mWaitNote->close(); + } +// mFindWidget->activeSearchPanel(); +} + +void FmFindView::initMenu() +{ + HbAction *findAction = new HbAction( this ); + findAction->setObjectName( "findAction" ); + findAction->setText( hbTrId( "Find" ) ); + menu()->addAction( findAction ); + + HbMenu *subMenu = new HbMenu( hbTrId( "Sort" ) ); + + HbAction *sortNameAction = new HbAction( subMenu ); + sortNameAction->setObjectName( "sortNameAction" ); + sortNameAction->setText( hbTrId( "Sort by name" ) ); + subMenu->addAction( sortNameAction ); + + HbAction *sortTimeAction = new HbAction( subMenu ); + sortTimeAction->setObjectName( "sortTimeAction" ); + sortTimeAction->setText( hbTrId( "Sort by time" ) ); + subMenu->addAction( sortTimeAction ); + + HbAction *sortSizeAction = new HbAction( subMenu ); + sortSizeAction->setObjectName( "sortSizeAction" ); + sortSizeAction->setText( hbTrId( "Sort by size" ) ); + subMenu->addAction( sortSizeAction ); + + HbAction *sortTypeAction = new HbAction( subMenu ); + sortTypeAction->setObjectName( "sortTypeAction" ); + sortTypeAction->setText( hbTrId( "Sort by type" ) ); + subMenu->addAction( sortTypeAction ); + + menu()->addMenu( subMenu ); + + connect( findAction, SIGNAL( triggered() ), + this, SLOT( on_findAction_triggered() ) ); + connect( sortNameAction, SIGNAL( triggered() ), + this, SLOT( on_sortNameAction_triggered() ) ); + connect( sortTimeAction, SIGNAL( triggered() ), + this, SLOT( on_sortTimeAction_triggered() ) ); + connect( sortSizeAction, SIGNAL( triggered() ), + this, SLOT( on_sortSizeAction_triggered() ) ); + connect( sortTypeAction, SIGNAL( triggered() ), + this, SLOT( on_sortTypeAction_triggered() ) ); + + mMenu = takeMenu(); +} + +void FmFindView::initMainWidget() +{ + mFindWidget = new FmFindWidget( this ); + connect( mFindWidget, SIGNAL(finished()), this, SLOT(findFinished()) ); + setWidget( mFindWidget ); + + if( !mWaitNote ){ + mWaitNote = new HbProgressDialog( HbProgressDialog::WaitDialog ); + mWaitNote->setText( hbTrId( "Finding..." ) ); + } + connect( mWaitNote, SIGNAL(cancelled()), this, SLOT(stopFind()) ); + connect( mFindWidget, SIGNAL(activated( const QString&)), this, SLOT( activated(const QString&)) ); + connect( mFindWidget, SIGNAL( startSearch( const QString&, const QString& ) ), + this, SLOT( startSearch( const QString&, const QString& ) ) ); + connect( mFindWidget, SIGNAL( setEmptyMenu( bool ) ), + this, SLOT( on_findWidget_setEmptyMenu( bool ) ) ); +} + +void FmFindView::initToolBar() +{ +} + +void FmFindView::on_sortNameAction_triggered() +{ + mFindWidget->sortFiles( FmFindResultModel::Name ); +} + +void FmFindView::on_sortTimeAction_triggered() +{ + mFindWidget->sortFiles( FmFindResultModel::Time ); +} + +void FmFindView::on_sortSizeAction_triggered() +{ + mFindWidget->sortFiles( FmFindResultModel::Size ); +} + +void FmFindView::on_sortTypeAction_triggered() +{ + mFindWidget->sortFiles( FmFindResultModel::Type ); +} + +void FmFindView::startSearch( const QString &targetPath, const QString &criteria ) +{ + if ( !criteria.isEmpty( ) ) { + find( criteria, targetPath ); + } +} + +void FmFindView::on_findAction_triggered() +{ + mFindWidget->activeSearchPanel(); +} + +void FmFindView::on_findWidget_setEmptyMenu( bool isMenuEmpty ) +{ + if( isMenuEmpty ){ + if( !mMenu ) { + mMenu = takeMenu(); + } + } + else{ + if( mMenu ) { + setMenu( mMenu ); + mMenu = 0; + } + } +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmfindview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmfindview.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,65 @@ +/* +* 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: +* Zhiqiang Yang +* +* Description: +* The header file of the file find view of file manager +* +*/ + +#ifndef FMFINDVIEW_H +#define FMFINDVIEW_H + +#include "fmcommon.h" +#include "fmviewbase.h" + +class HbProgressDialog; +class HbMenu; +class FmFindWidget; + +class FmFindView : public FmViewBase +{ + Q_OBJECT +public: + FmFindView(); + virtual ~FmFindView(); + + void find( const QString &keyword, const QString &path ); + +public slots: + void activated( const QString &pathName ); + void stopFind(); + +private slots: + void findFinished(); + void on_findAction_triggered(); + void on_sortNameAction_triggered(); + void on_sortTimeAction_triggered(); + void on_sortSizeAction_triggered(); + void on_sortTypeAction_triggered(); + + void startSearch( const QString &targetPath, const QString &criteria ); + + void on_findWidget_setEmptyMenu( bool isMenuEmpty ); + +private: + void initMenu(); + void initMainWidget(); + void initToolBar(); + + FmFindWidget *mFindWidget; + HbProgressDialog *mWaitNote; + HbMenu *mMenu; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmfindwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmfindwidget.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,203 @@ +/* +* 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: +* Zhiqiang Yang +* +* Description: +* The source file of the file find widget of file manager +* +*/ + +#include "fmfindwidget.h" +#include "fmfindresultmodel.h" +#include "fmviewmanager.h" +#include "fmoperationservice.h" + +#include +#include + +#include +#include +#include +#include + +FmFindWidget::FmFindWidget( QGraphicsItem *parent ) + : HbWidget( parent ) +{ + init(); +} + +FmFindWidget::~FmFindWidget() +{ +} + +void FmFindWidget::itemActivated(const QModelIndex &index) +{ + FmOperationService *operationService = FmViewManager::viewManager()->operationService(); + if( !operationService ) { + return; + } + + QFileInfo fileInfo = mModel->fileInfo( index ); + if ( fileInfo.isFile() ) { + operationService->syncLaunchFileOpen( fileInfo.filePath() ); + }else if( fileInfo.isDir() ) { + emit activated( fileInfo.filePath() ); + } +} + +void FmFindWidget::find( const QString &keyword, const QString &path ) +{ + mModel->setFindPath( path ); + + QRegExp regExp( '*' + keyword + '*' ); + regExp.setPatternSyntax( QRegExp::Wildcard ); + regExp.setCaseSensitivity( Qt::CaseInsensitive ); + mModel->setPattern( regExp ); + + mModel->find(); +} + +void FmFindWidget::stopFind() +{ + mModel->stop(); +} + +void FmFindWidget::on_resultModel_finished() +{ + emit finished(); +} + +void FmFindWidget::on_resultModel_modelCountChanged( int count ) +{ + if( count > 0 ) { + activateContentWidget( ResultListView ); + } else { + activateContentWidget( EmptyTipWidget ); + } +} + +void FmFindWidget::activateContentWidget( ContentWidgetType contentWidgetType ) +{ + switch( contentWidgetType ) + { + case EmptyTipWidget: + { + if( mLayout->count() > 0 ) { + if( mLayout->itemAt( 0 ) == mListView ) { + mLayout->removeItem( mListView ); + mLayout->addItem( mEmptyTipWidget ); + } + } else { + mLayout->addItem( mEmptyTipWidget ); + } + mListView->hide(); + mEmptyTipWidget->show(); + deActiveSearchPanel(); + emit setEmptyMenu( true ); + } + break; + case ResultListView: + { + if( mLayout->count() > 0 ) { + if( mLayout->itemAt( 0 ) == mEmptyTipWidget ) { + mLayout->removeItem( mEmptyTipWidget ); + mLayout->addItem( mListView ); + } + } else { + mLayout->addItem( mListView ); + } + mEmptyTipWidget->hide(); + mListView->show(); + activeSearchPanel(); + emit setEmptyMenu( false ); + } + break; + } +} + +void FmFindWidget::init() +{ + mLayout = new QGraphicsLinearLayout( this ); + mLayout->setOrientation( Qt::Vertical ); + + mModel = new FmFindResultModel( this ); + mModel->setObjectName( "resultModel" ); + + connect( mModel, SIGNAL(finished()), this, SLOT( on_resultModel_finished()) ); + + connect( mModel, SIGNAL( modelCountChanged( int )), + this, SLOT( on_resultModel_modelCountChanged( int )) ); + + mListView = new HbListView( this ); + mListView->setModel( mModel ); + + mEmptyTipWidget = new HbWidget( this ); + QGraphicsLinearLayout *emptyTipLayout = new QGraphicsLinearLayout( mEmptyTipWidget ); + HbLabel *emptyTipLable = new HbLabel( hbTrId( "No found files or folders" ), mEmptyTipWidget ); + emptyTipLayout->addItem( emptyTipLable ); + + initSearchPanel(); + activateContentWidget( EmptyTipWidget ); + + setLayout( mLayout ); + + connect( mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex))); +} + +void FmFindWidget::initSearchPanel() +{ + mSearchPanel = new HbSearchPanel( this ); + mSearchPanel->setObjectName( "searchPanel" ); +// mSearchPanel->setSearchOptionsEnabled( true ); + mSearchPanel->setProgressive( false ); + mSearchPanel->hide(); + + connect( mSearchPanel, SIGNAL( criteriaChanged( const QString & ) ), + this, SLOT( on_searchPanel_criteriaChanged( const QString & ) ) ); + + connect( mSearchPanel, SIGNAL( exitClicked() ), + this, SLOT( on_searchPanel_exitClicked() ) ); +} + +void FmFindWidget::sortFiles( FmFindResultModel::SortFlag sortFlag ) +{ + mModel->sort( sortFlag ); +} + +void FmFindWidget::activeSearchPanel() +{ + mLayout->addItem( mSearchPanel ); + mSearchPanel->show(); +} + +void FmFindWidget::on_searchPanel_criteriaChanged( const QString &criteria ) +{ + mFindTargetPath.clear(); + emit startSearch( mFindTargetPath, criteria ); +} + +void FmFindWidget::on_searchPanel_exitClicked() +{ + mSearchPanel->hide(); + mLayout->removeItem( mSearchPanel ); +} + +void FmFindWidget::deActiveSearchPanel() +{ + mSearchPanel->hide(); + mLayout->removeItem( mSearchPanel ); + +} + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmfindwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmfindwidget.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,84 @@ +/* +* 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: +* Zhiqiang Yang +* +* Description: +* The header file of the file find widget of file manager +* +*/ + +#ifndef FMFINDWIDGET_H +#define FMFINDWIDGET_H + +#include "fmcommon.h" +#include "fmfindresultmodel.h" + +#include + +class HbListView; +class HbSearchPanel; +class HbWidget; + +class QGraphicsLinearLayout; + +class FmFindWidget : public HbWidget +{ + Q_OBJECT +public: + enum ContentWidgetType + { + EmptyTipWidget, + ResultListView + }; + FmFindWidget( QGraphicsItem *parent = 0 ); + ~FmFindWidget(); + + void find( const QString &keyword, const QString &path ); + void stopFind(); + void sortFiles( FmFindResultModel::SortFlag sortFlag ); + + void activeSearchPanel(); + void deActiveSearchPanel(); + +signals: + void finished(); + void activated( const QString &pathName ); + + void startSearch( const QString &targetPath, const QString &criteria ); + void setEmptyMenu( bool isMenuEmpty ); + +private slots: + void itemActivated(const QModelIndex &index); + + void on_searchPanel_criteriaChanged( const QString &criteria ); + void on_searchPanel_exitClicked(); + + void on_resultModel_finished(); + void on_resultModel_modelCountChanged( int count ); + +private: + void init(); + void initSearchPanel(); + void activateContentWidget( ContentWidgetType contentWidgetType ); + +private: + HbListView *mListView; + FmFindResultModel *mModel; + HbWidget *mEmptyTipWidget; + + QGraphicsLinearLayout *mLayout; + HbSearchPanel* mSearchPanel; + QString mFindTargetPath; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmmainwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmmainwindow.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,77 @@ +/* + * 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: + * Zhiqiang Yang + * + * Description: + * The source file of File Manager main window + */ + +#include "fmmainwindow.h" +#include "fmcommon.h" + +#include + +FmMainWindow::FmMainWindow() : mViewManager( 0 ), mFirstViewLoaded( false ) +{ + // connect(this, SIGNAL(viewReady()), this, SLOT(delayedLoading())); + init(); +} + +FmMainWindow::~FmMainWindow() +{ + //save file manager activity to activity manager. + mViewManager->saveActivity(); + FmViewManager::RemoveViewManager(); +} + +void FmMainWindow::onOrientationChanged( Qt::Orientation orientation ) +{ + Q_UNUSED( orientation ); + /* + if ( orientation == Qt::Vertical ) { + activateDriverView(); + } else { + activateSplitView(); + } + */ +} + +void FmMainWindow::init() +{ + FM_LOG("FmMainWindow::init start"); + mViewManager = FmViewManager::CreateViewManager( this ); + mViewManager->createDriverView(); + connect(this, SIGNAL(aboutToChangeView(HbView *, HbView *)), + mViewManager, SLOT(onAboutToChangeView(HbView *, HbView *))); + connect( this, SIGNAL( orientationChanged( Qt::Orientation ) ), + this, SLOT( onOrientationChanged( Qt::Orientation ) ) ); + + FM_LOG("FmMainWindow::init end"); +// if ( orientation() == Qt::Vertical ) { +// createDriverView(); +// } else { +// createSplitView(); +// } +} + +void FmMainWindow::delayedLoading() +{ + FM_LOG("FmMainWindow::delayedLoading start"); + if( mFirstViewLoaded ) { + return; + } + init(); + mFirstViewLoaded = true; + FM_LOG("FmMainWindow::delayedLoading end"); +} + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmmainwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmmainwindow.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * Zhiqiang Yang + * + * Description: + * The header file of File Manager main window + */ + +#ifndef FMMAINWINDOW_H +#define FMMAINWINDOW_H + +#include "fmcommon.h" +#include "fmviewmanager.h" + +#include + +class HbAction; + +class FmMainWindow : public HbMainWindow +{ + Q_OBJECT +public: + FmMainWindow(); + ~FmMainWindow(); + +private slots: + void onOrientationChanged( Qt::Orientation orientation ); + void delayedLoading(); +private: + void init(); + + FmViewManager *mViewManager; + bool mFirstViewLoaded; +}; + +#endif + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmsplitview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmsplitview.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,86 @@ +/* +* 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: +* Zhiqiang Yang +* +* Description: +* The source file of the split view of file manager +* +*/ +#include "fmsplitview.h" +#include "fmfilebrowsewidget.h" +#include "fmdriverlistwidget.h" +#include + +#include +#include +#include + +FmSplitView::FmSplitView() : FmViewBase( ESplitView ) +{ + initMenu(); + initMainWidget(); + + QMetaObject::connectSlotsByName( this ); +} + +FmSplitView::~FmSplitView() +{ +} + +void FmSplitView::on_rotateAction_triggered() +{ + if ( mainWindow()->orientation() == Qt::Vertical ) { + mainWindow()->setOrientation( Qt::Horizontal ); + } + else { + mainWindow()->setOrientation( Qt::Vertical ); + } +} + +void FmSplitView::on_normalViewAction_triggered() +{ + mainWindow()->setCurrentView( mainWindow()->views().first() ); +} + +void FmSplitView::initMenu() +{ + HbAction *action = 0; +#ifdef FM_CHANGE_ORIENT_ENABLE + action = new HbAction( this ); + action->setObjectName( "rotateAction" ); + action->setText( hbTrId( "Change orientation" ) ); + menu()->addAction( action ); +#endif + + action = new HbAction( this ); + action->setObjectName( "normalViewAction" ); + action->setText( hbTrId( "Switch to normal view" ) ); + menu()->addAction( action ); +} + +void FmSplitView::initMainWidget() +{ + QGraphicsLinearLayout *hLayout = new QGraphicsLinearLayout( this ); + hLayout->setOrientation( Qt::Horizontal ); + + mDriverWidget = new FmDriverListWidget( this ); + mDriverWidget->setMaximumWidth( 200.0 ); + hLayout->addItem( mDriverWidget ); + + + mFileWidget = new FmFileBrowseWidget( this, FmFileBrowseWidget::TreeStyle ); + hLayout->addItem( mFileWidget ); + + connect( mDriverWidget, SIGNAL( activated( const QString & ) ), + mFileWidget, SLOT( setRootPath( const QString & ) ) ); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmsplitview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmsplitview.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,48 @@ +/* +* 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: +* Zhiqiang Yang +* +* Description: +* The header file of the split view of file manager +* +*/ +#ifndef FMSPLITVIEW_H +#define FMSPLITVIEW_H + +#include "fmcommon.h" +#include "fmviewbase.h" + +class FmDriverListWidget; +class FmFileBrowseWidget; + +class FmSplitView : public FmViewBase +{ + Q_OBJECT +public: + FmSplitView(); + virtual ~FmSplitView(); + +private slots: + void on_normalViewAction_triggered(); + void on_rotateAction_triggered(); + +private: + void initMenu(); + void initMainWidget(); + + + FmDriverListWidget *mDriverWidget; + FmFileBrowseWidget *mFileWidget; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmviewbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmviewbase.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,46 @@ +/* +* 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: +* The source file of filemanager view base +* +*/ + +#include "fmviewbase.h" +#include "fmviewmanager.h" + +#include + +FmViewBase::FmViewBase( TViewType viewType ) +{ + mViewType = viewType; + init(); + QMetaObject::connectSlotsByName( this ); +} + +FmViewBase::~FmViewBase(void) +{ +} + +void FmViewBase::init() +{ + mBackAction = new HbAction( Hb::BackNaviAction, this ); + mBackAction->setObjectName( "backAction" ); + setNavigationAction( mBackAction ); +} + +void FmViewBase::on_backAction_triggered() +{ + FmViewManager::viewManager()->popViewAndShow(); +} + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmviewbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmviewbase.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,66 @@ +/* +* 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: +* The source file of filemanager view base +* +*/ + +#ifndef FMVIEWBASE_H +#define FMVIEWBASE_H + +#include + +class HbAction; + +class FmViewBase : public HbView +{ +Q_OBJECT +public: + enum TViewType + { + ENone = 0, + EDriverView, + EFileView, + EFindView, + EBackupView, + ERestoreView, + ESplitView, + EDeleteBackupView + }; + + + explicit FmViewBase( TViewType viewType ); + virtual ~FmViewBase(void); + + TViewType viewType() + { + return mViewType; + } + +private slots: + void on_backAction_triggered(); + +signals: + void tryToExit(); + +private: + void init(); +private: + TViewType mViewType; + + HbAction *mBackAction; +}; + +#endif + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmviewmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmviewmanager.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,345 @@ +/* +* 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: +* The source file of filemanager view manager +* +*/ + +#include "fmviewmanager.h" +#include "fmmainwindow.h" +#include "fmdriverview.h" +#include "fmfileview.h" +#include "fmfindview.h" +#include "fmbackupview.h" +#include "fmrestoreview.h" +#include "fmdeletebackupview.h" +#include "fmsplitview.h" +#include "fmoperationservice.h" +#include "fmoperationbase.h" +#include "fmdrivewatcher.h" +#include "fmdialog.h" +#include "fmdlgutils.h" + +#include +#include +#include +#include +#include +#include +#include + +FmViewManager *FmViewManager::mViewManager = 0; + + +FmDlgCloseUnit::FmDlgCloseUnit( FmDialog *dialog ) : mDialog( dialog ) +{ +} +FmDlgCloseUnit::~FmDlgCloseUnit() +{ +} + +void FmDlgCloseUnit::addAssociatedDrives( QString drives ) +{ + for( int i = 0; i< drives.length(); ++i ) { + if( !mAssociatedDrives.contains( drives[i], Qt::CaseInsensitive ) ) { + mAssociatedDrives += drives[i]; + } + } +} +void FmDlgCloseUnit::removeAssociatedDrives( QString drives ) +{ + for( int i = 0; i < drives.length(); ++i ){ + mAssociatedDrives.remove( drives[i], Qt::CaseInsensitive ); + } +} +QString FmDlgCloseUnit::associatedDrives() +{ + return mAssociatedDrives; +} + +FmDialog *FmDlgCloseUnit::dialog() +{ + return mDialog; +} + +FmViewManager::FmViewManager( FmMainWindow* mainWindow ) : mOperationService( 0 ) +{ + mMainWindow = mainWindow; + mDriveWatcher = new FmDriveWatcher( this ); + mDriveWatcher->setObjectName( "driveWatcher" ); + mDriveWatcher->startWatch(); + + QMetaObject::connectSlotsByName( this ); +} + +FmViewManager::~FmViewManager(void) +{ + FmViewBase *view = static_cast( mMainWindow->currentView() ); + while( view ) { + mMainWindow->removeView( view ); + delete view; + view = static_cast( mMainWindow->currentView() ); + } + + delete mOperationService; + mOperationService = 0; + + mDriveWatcher->cancelWatch(); + delete mDriveWatcher; + mDriveWatcher = 0; + +} + +FmViewManager *FmViewManager::CreateViewManager( FmMainWindow* mainWindow ) +{ + if( !mViewManager ){ + mViewManager = new FmViewManager( mainWindow ); + } + + return mViewManager; +} +void FmViewManager::RemoveViewManager() +{ + delete mViewManager; + mViewManager = 0; +} + +FmViewManager *FmViewManager::viewManager() +{ + return mViewManager; +} + +FmOperationService *FmViewManager::operationService() +{ + if ( !mOperationService ) { + mOperationService = new FmOperationService( this ); + mOperationService->setObjectName( "operationService" ); + } + return mOperationService; +} + +void FmViewManager::popViewAndShow() +{ + FmViewBase *view = static_cast( mMainWindow->currentView() ); + view->setNavigationAction( 0 ); + // grap the screen when only the drive view is in view stack. + if( viewCount() == 1 ) { + mScreenShot = QPixmap::grabWidget(mMainWindow, mMainWindow->rect()); + } + mMainWindow->removeView( view ); + delete view; + + if( viewCount() < 1 ) + { + mMainWindow->close(); + } +} + +void FmViewManager::on_operationService_driveSpaceChanged( FmOperationBase *operationBase ) +{ + Q_UNUSED( operationBase ); + // request drive view to refresh + emit driveSpaceChanged(); +} + +void FmViewManager::on_operationService_notifyFinish( FmOperationBase *operationBase ) +{ + if( !operationBase ){ + Q_ASSERT_X( false, "FmViewManager", + "NULL is not accepted in on_operationService_notifyFinish()" ); + return; + } + + if( operationBase->operationType() == FmOperationService::EOperationTypeBackup ) + { + // after finish backup, we need refresh backup date in backup view. + emit refreshBackupDate(); + } +} + + +int FmViewManager::viewCount() +{ + return mMainWindow->views().count(); +} + + +void FmViewManager::createDriverView() +{ + FmDriverView *driverView= new FmDriverView(); + + mMainWindow->addView( driverView ); + mMainWindow->setCurrentView( driverView ); + HbActivityManager* activityManager = qobject_cast(qApp)->activityManager(); + bool ok = activityManager->removeActivity("FMMemoryStoragesList"); + + connect( this, SIGNAL( driveSpaceChanged() ), + driverView, SLOT( refreshDrive() ) ); + // Refresh drive view when gaining foreground + // ( switch back to filemanager from home screen or any other applications ) + connect( mMainWindow, SIGNAL( revealed() ), + driverView, SLOT( refreshDrive() ) ); + + // use Qt::QueuedConnection because synchronous refresh is not work well while + // connected with another OTG device which have more than one external drive in it. + // File server only give driveChanged event once, but two drive is inserted. + // Synchronous refresh will miss another drive. + // So use Qt::QueuedConnection to performance asynchronous refresh. + connect( this, SIGNAL( driveChanged() ), + driverView, SLOT( refreshDrive() ), Qt::QueuedConnection ); +} + +void FmViewManager::createFileView( const QString &path, + bool enableBackPathCheck, bool disableFind ) +{ + QFileInfo fileInfo( path ); + QString absolutePath = fileInfo.absoluteFilePath(); + + QString checkedPath = FmUtils::checkDriveToFolderFilter( absolutePath ); + if( FmUtils::isDriveAvailable( path ) ) { + if( FmErrNone != FmUtils::isPathAccessabel( checkedPath ) ) { + checkedPath.clear(); + } + } + + if( checkedPath.isEmpty() ) { + FmDlgUtils::information( QString( hbTrId("Path: %1 is unavailable!").arg( path )) ); + return; + } + + FmFileView *fileView= new FmFileView(); + fileView->setRootPath( checkedPath ); + if( enableBackPathCheck ) { + fileView->setRootLevelPath( checkedPath ); + } + + fileView->setFindDisabled( disableFind ); + + mMainWindow->addView( fileView ); + mMainWindow->setCurrentView( fileView ); + + connect( this, SIGNAL( driveChanged() ), //emit when drive changed. + fileView, SLOT( on_driveChanged() ) ); + + connect( fileView, SIGNAL( popViewAndShow() ), //emit when fileView need delete itself and pop&show view from stack. + this, SLOT( popViewAndShow() ), Qt::QueuedConnection ); +} + +void FmViewManager::createFindView( const QString &keyword, const QString &path ) +{ + FmFindView *findView= new FmFindView(); + + mMainWindow->addView( findView ); + mMainWindow->setCurrentView( findView ); + + findView->find( keyword, path ); + } + +void FmViewManager::createSplitView() +{ + FmSplitView *splitView = new FmSplitView(); + mMainWindow->addView( splitView ); + mMainWindow->setCurrentView( splitView ); + +} + +void FmViewManager::createBackupView() +{ + FmBackupView *backupView= new FmBackupView(); + + mMainWindow->addView( backupView ); + mMainWindow->setCurrentView( backupView ); + connect( this, SIGNAL( driveChanged() ), //emit when need refresh model + backupView, SLOT( refreshModel() ) ); + connect( this, SIGNAL( refreshBackupDate() ), //emit when need refresh backup date + backupView, SLOT( refreshBackupDate() ) ); +} + +void FmViewManager::createRestoreView() +{ + FmRestoreView *restoreView= new FmRestoreView(); + + mMainWindow->addView( restoreView ); + mMainWindow->setCurrentView( restoreView ); + connect( this, SIGNAL( driveChanged() ), restoreView, SLOT( refreshRestoreView() ) ); + +} + +void FmViewManager::createDeleteBackupView() +{ + FmDeleteBackupView *deleteBackupView= new FmDeleteBackupView(); + + mMainWindow->addView( deleteBackupView ); + mMainWindow->setCurrentView( deleteBackupView ); + connect( this, SIGNAL( driveChanged() ), deleteBackupView, SLOT( refreshDeleteBackupView() ) ); + +} + +Qt::Orientation FmViewManager::orientation(){ + return mMainWindow->orientation(); +} + +void FmViewManager::on_driveWatcher_driveAddedOrChanged() +{ + FM_LOG( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged start" ) ); + emit driveChanged(); + checkDlgCloseUnit(); + FM_LOG( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged end" ) ); + +} + + +void FmViewManager::checkDlgCloseUnit() +{ + foreach( FmDlgCloseUnit* unit, mDlgCloseUnitList ) { + QString drives( unit->associatedDrives() ); + for( int i = 0; i < drives.length(); i++ ) { + QString drive( drives[i] + QString( ":/" ) ); + if( !FmUtils::isDriveAvailable( drive ) ) { + FM_LOG( " close Dialog start " ); + unit->dialog()->close(); + FM_LOG( " close Dialog end " ); + } + } + } +} + +void FmViewManager::saveActivity() +{ + //grap the screen when current view is drive view. + FmDriverView *driveView = qobject_cast(mMainWindow->currentView()); + if ( ( driveView != 0 ) && ( driveView->viewType() == FmViewBase::EDriverView ) ) { + mScreenShot = QPixmap::grabWidget(mMainWindow, mMainWindow->rect()); + } + QVariantHash metadata; + metadata.insert("screenshot", mScreenShot); + HbActivityManager* activityManager = qobject_cast(qApp)->activityManager(); + // add the activity to the activity manager + bool ok = activityManager->addActivity("FMMemoryStoragesList", QVariant(), metadata); + if ( !ok ) + { + qFatal("Add failed" ); + } + +} + +void FmViewManager::onAboutToChangeView(HbView * oldView, HbView *newView) +{ + Q_UNUSED(newView); + //grap the screen when oldView is drive view. + FmDriverView *driveView = qobject_cast(oldView); + if ( ( driveView != 0 ) && ( driveView->viewType() == FmViewBase::EDriverView ) ) { + mScreenShot = QPixmap::grabWidget(mMainWindow, mMainWindow->rect()); + } +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/fmviewmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/fmviewmanager.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,157 @@ +/* +* 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: +* The header file of filemanager view manager +* +*/ + +#ifndef FMVIEWMANAGER_H +#define FMVIEWMANAGER_H + +#include +#include +#include "fmcommon.h" +#include + +class FmMainWindow; +class HbView; +class FmViewManager; +class FmOperationService; +class FmOperationBase; +class QFileSystemWatcher; +class FmDriveWatcher; +class FmDialog; + +/* + * this class is used to record relationship between dialog and drive name + * FmViewManager will auto-close dialog which related drive is not available again. + * for example. set name to MMC will pop a dialog, if add the dialog to FmViewManager::addDlgCloseUnit + * then after eject MMC, the dialog will be auto-closed by FmViewManager::checkDlgCloseUnit() + */ +class FmDlgCloseUnit +{ +public: + FmDlgCloseUnit( FmDialog *dialog ); + ~FmDlgCloseUnit(); + + void addAssociatedDrives( QString drives ); + void removeAssociatedDrives( QString drives ); + QString associatedDrives(); + FmDialog *dialog(); + +private: + FmDialog *mDialog; + QString mAssociatedDrives; +}; + +class FmViewManager : public QObject +{ + Q_OBJECT + +public: + int viewCount(); + static FmViewManager *CreateViewManager( FmMainWindow* mainWindow ); + static void RemoveViewManager(); + static FmViewManager *viewManager(); + FmOperationService *operationService(); + + Qt::Orientation orientation(); + + void createFileView( const QString &path, + bool enableBackPathCheck = true, bool disableFind = false ); + void createFindView( const QString &keyword, const QString &path ); + void createDriverView(); + void createSplitView(); + void createBackupView(); + void createRestoreView(); + void createDeleteBackupView(); + void saveActivity(); + // add a close unit. this is used to auto-close dialog which related drive is not available again. + void addDlgCloseUnit( FmDlgCloseUnit* unit ) + { + FM_LOG( "FmViewManager::addDlgCloseUnit_" + unit->associatedDrives() ); + mDlgCloseUnitList.append( unit ); + } + + // remove a close unit. + void removeDlgCloseUnit( FmDlgCloseUnit* unit ) + { + FM_LOG( "FmViewManager::removeDlgCloseUnit_" + unit->associatedDrives() ); + mDlgCloseUnitList.removeOne( unit ); + } + +protected: + explicit FmViewManager( FmMainWindow* mainWindow ); + ~FmViewManager(); + +public slots: + /// popViewAndShow will delete current view and pop view from stack, then show it. + void popViewAndShow(); + + // triggered when drive space is changed + // this slots is used to watch filemanager internal events + // drive space event from other applictaion will not be observed here + void on_operationService_driveSpaceChanged( FmOperationBase* operationBase ); + + // triggered when drive is ejected/inserted, or other drive event. it will impact available property + void on_driveWatcher_driveAddedOrChanged(); + + // if operation finished, some addition works( such as refresh... ) should be done in some views + // so this is the central controller function + void on_operationService_notifyFinish( FmOperationBase *operationBase ); + + void onAboutToChangeView(HbView * oldView, HbView *newView); + +signals: + // emit when drive space is changed by some operation inside filemanager. + void driveSpaceChanged(); + + // emit when drive is ejected/inserted, this is watched by FmDriveWatcher + void driveChanged(); + + // when backup is created, backup date should be updated. + void refreshBackupDate(); + +private: + // when drive is ejected, this function will be called and exam dialogs in mDlgCloseUnitList + // it will colse dialogs if related drive is not available + void checkDlgCloseUnit(); + +private: + static FmViewManager *mViewManager; + +private: + // main window + FmMainWindow *mMainWindow; + + // operation service, used to start operations such as copy, move, delete, format... + FmOperationService *mOperationService; + + // used to watch drive event, for example, eject/insert drive + FmDriveWatcher *mDriveWatcher; + + // used to record some dialogs that related to drive + // the dialog should be closed in checkDlgCloseUnit if drive is not available + QList mDlgCloseUnitList; + + QPixmap mScreenShot; +}; + + + + + +#endif + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/main.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,50 @@ +/* +* 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: +* Zhiqiang Yang +* Steven Yao +* Yong Zhang +* +* Description: +* The main application file for file manager +* +*/ + + +#include "fmmainwindow.h" + +#include +#include +#include +#include +#include + +int main( int argc, char *argv[] ) +{ + FM_LOG( "main start" ); + HbApplication app( argc, argv ); + + HbTranslator translator("filemanager"); + translator.loadCommon(); + app.setApplicationName( hbTrId("txt_fmgr_title_file_manager") ); + + HbStyleLoader::registerFilePath(":/resources/hblistviewitem.css"); + HbStyleLoader::registerFilePath(":/resources/hblistviewitem.widgetml"); + + FM_LOG( "main_createMainwindow start" ); + FmMainWindow mw; + FM_LOG( "main_createMainwindow end" ); + + mw.show(); + FM_LOG( "main end" ); + return app.exec(); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationbase.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,166 @@ +/* +* 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: +* The source file of the operation param of file manager +* +*/ + +#include "fmoperationbase.h" +#include "fmdrivedetailstype.h" +#include +/* + * \fn void showNote( const QString ¬e ) + * This signal is emitted when operation needs operation service to show some note. + * \a note indicates the note to show. + */ + +/* \fn void notifyWaiting( bool cancelable ) + * This signal is emitted when operation needs operation service to wait. + * \a cancelable indicates whether it could be canceled. + */ + +/* \fn void notifyPreparing( bool cancelable ) + * This signal is emitted when operation needs operation service to prepare. + * \a cancelable indicates whether it could be canceled. + */ + +/* \fn void notifyStart( bool cancelable, int maxSteps ) + * This signal is emitted when operation starts and operation service shows progress bar. + * \a cancelable indicates whether it could be canceled. + * \a maxStep indicates the max of progress bar. + */ + +/* \fn void notifyProgress( int currentStep ) + * This signal is emitted when operation needs operation service update progress bar. + * \a currentStep the current step. + */ + +/* \fn void notifyFinish() + * This signal is emitted when operation finished. + */ + +/* \fn void notifyError( int error, const QString &errString ) + * This signal is used to notify error. + * \a error the error id. + * \a errString the error string. + */ + +/* + Constructs the base operation with + \a parent parent + \a operationType the type of current operation. +*/ +FmOperationBase::FmOperationBase( QObject *parent, FmOperationService::TOperationType operationType ) : + QObject( parent ), mOperationType( operationType ) +{ +} + +/* + Destructs the operation +*/ +FmOperationBase::~FmOperationBase() +{ + +} + +/* + Returns the current operation type +*/ +FmOperationService::TOperationType FmOperationBase::operationType() +{ + return mOperationType; +} + +/* + Starts the operation, called by FmOperationThread. + Use empty implementation because Backup and Restore + are not done within thread, so they will not reimplement + this function. + \sa FmOperationThread::run +*/ +void FmOperationBase::start( volatile bool */*isStopped*/ ) +{ + +} + +/* + Does some additional work before starting the operation. + Returns the error number. +*/ +int FmOperationBase::prepare() +{ + return FmErrNone; +} + + +/* + Constructs a backup operation with + \a parent parent + \a targetDrive backup target drive + backup \a content is mask for contents want to backup. Refer to mContent in FmBackupSettings +*/ +FmOperationBackup::FmOperationBackup( QObject *parent, const QString &targetDrive, quint32 content ) + : FmOperationBase( parent, FmOperationService::EOperationTypeBackup ), + mTargetDrive( targetDrive ), mContent( content ) +{ +} + + +/* + Destructs the backup operation +*/ +FmOperationBackup::~FmOperationBackup() +{ +} + +/* + Get target backup drive +*/ +QString FmOperationBackup::targetDrive() const +{ + return mTargetDrive; +} + +/* + Get backup content mask. Refer to mContent in FmBackupSettings +*/ +quint32 FmOperationBackup::content() const +{ + return mContent; +} + +/* + Constructs a restore operation with + \a parent parent + \a selection the selected backup items +*/ +FmOperationRestore::FmOperationRestore( QObject *parent, quint64 selection ) + : FmOperationBase( parent, FmOperationService::EOperationTypeRestore ), mSelection( selection ) +{ +} + +/* + Destructs the restore operation +*/ +FmOperationRestore::~FmOperationRestore() +{ +} + +/* + Returns the backup items +*/ +quint64 FmOperationRestore::selection() const +{ + return mSelection; +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationbase.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,82 @@ +/* +* 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: +* The header file of the operation param of file manager +* +*/ + +#ifndef FMOPERATIONBASE_H +#define FMOPERATIONBASE_H + +#include "fmoperationservice.h" + +#include +#include + +class FmOperationBase : public QObject +{ +Q_OBJECT +public: + explicit FmOperationBase( QObject* parent, FmOperationService::TOperationType operationType ); + virtual ~FmOperationBase(); + + FmOperationService::TOperationType operationType(); + virtual int prepare(); + virtual void start( volatile bool *isStopped ); + +signals: + void showNote( const QString ¬e ); + void notifyWaiting( bool cancelable ); + void notifyPreparing( bool cancelable ); + void notifyStart( bool cancelable, int maxSteps ); + void notifyProgress( int currentStep ); + void notifyFinish(); + void notifyError( int error, const QString &errString ); + +private: + FmOperationService::TOperationType mOperationType; + +}; + + +class FmOperationBackup : public FmOperationBase +{ +Q_OBJECT +public: + explicit FmOperationBackup( QObject *parent, const QString &targetDrive, quint32 content ); + virtual ~FmOperationBackup(); + + QString targetDrive() const; + quint32 content() const ; +private: + // used to save backup target drive + QString mTargetDrive; + + // used to save FmBackupSettings::content() + quint32 mContent; +}; + +class FmOperationRestore : public FmOperationBase +{ +Q_OBJECT +public: + explicit FmOperationRestore( QObject *parent, quint64 selection ); + virtual ~FmOperationRestore(); + + quint64 selection() const; +private: + quint64 mSelection; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationcopyormove.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationcopyormove.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,446 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "fmoperationcopyormove.h" +#include "fmcommon.h" +#include "fmoperationbase.h" +#include "fmdrivedetailstype.h" +#include "fmutils.h" + +#include +#include +#include +#include + +/* \fn void askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ) + * This signal is emitted when the same file as \a srcFile exists. + * \a destFile the destination file. + * \a isAccepted whether to replace the destination file. + */ + +/* \fn void askForRename( const QString &srcFile, QString *destFile ) + * This signal is emitted when \a srcFile needs to be renamed. + * \a destFile return the new name. + */ + +/* \fn void driveSpaceChanged() + * This signal is emitted when copy or move is completed, and used to update the drive size. + */ + +//the size of one time copy +const int FmOneTimeCopyOrMoveSize = 1024; +//the total steps of progress bar +const int FmTotalProgressBarSteps = 100; +/* + * Constructs a copy or move operation with + * \a operationService parent + * \a type the type of operation(EOperationTypeCopy or EOperationTypeMove) + * \a sourceList the source file or path lists that will be copied + * \a targetPath the target path where the source file will be copied + */ +FmOperationCopyOrMove::FmOperationCopyOrMove( FmOperationService *operationService, FmOperationService::TOperationType type, const QStringList &sourceList, const QString &targetPath ) + : FmOperationBase( operationService, type ), + mOperationService( operationService ), mSourceList( sourceList ), mTargetPath( targetPath ), + mStop( 0 ), mTotalSize( 0 ), mCopiedOrMovedSize( 0 ), mTotalSteps( FmTotalProgressBarSteps ), mCurrentStep( 0 ) +{ + mTargetPath = FmUtils::fillPathWithSplash( mTargetPath ); + connect( this, SIGNAL( askForRename( QString, QString* ) ), + mOperationService, SLOT( on_operation_askForRename( QString, QString* )), Qt::BlockingQueuedConnection ); + connect( this, SIGNAL( askForReplace( QString, QString, bool* ) ), + mOperationService, SLOT( on_operation_askForReplace( QString, QString, bool* )), Qt::BlockingQueuedConnection ); + connect( this, SIGNAL( driveSpaceChanged() ), + mOperationService, SLOT( on_operation_driveSpaceChanged() ) ); +} + +/* + * Destructs the copy or move operation. + */ +FmOperationCopyOrMove::~FmOperationCopyOrMove() +{ +} + +/* + * Returns the source file or path list + */ +QStringList FmOperationCopyOrMove::sourceList() +{ + return mSourceList; +} + +/* + * Returns the target path + */ +QString FmOperationCopyOrMove::targetPath() +{ + return mTargetPath; +} + +/* + * Starts the operation. + * \a isStopped flag the outside stop operation + */ +void FmOperationCopyOrMove::start( volatile bool *isStopped ) +{ + mStop = isStopped; + mTotalSize = 0; + mCopiedOrMovedSize = 0; + mCurrentStep = 0; + + if ( mSourceList.empty() ) { + emit notifyError( FmErrWrongParam, mErrString ); + return ; + } + emit notifyPreparing( true ); + + int numofFolders = 0; + int numofFiles = 0; + + int ret = FmFolderDetails::queryDetailOfContentList( mSourceList, numofFolders, + numofFiles, mTotalSize, mStop, true ); + if( ret != FmErrNone ) { + emit notifyError( ret, mErrString ); + return; + } + if ( !targetHasEnoughSpace() ) { + emit notifyError( FmErrDiskFull, mErrString ); + return; + } + emit notifyStart( true, mTotalSteps ); + + foreach( const QString& source, mSourceList ) { + // formatPath, but do not append splash in the end + // Otherwise could not get fileName in QFileInfo::fileName + QString checkedSource( FmUtils::formatPath( source ) ); + QFileInfo fi( checkedSource ); + if( !fi.exists() ) { + mErrString = checkedSource; + emit notifyError( FmErrSrcPathDoNotExist, mErrString ); + return; + } + QString newName; + bool isAcceptReplace = false; + QFileInfo destFi( mTargetPath + fi.fileName() ); + + // while for duplicated file/dir + while( destFi.exists() ) { + if( destFi.isFile() && destFi.absoluteFilePath().compare( fi.absoluteFilePath(), Qt::CaseInsensitive ) != 0 ) { + emit askForReplace( destFi.absoluteFilePath(), fi.absoluteFilePath(), &isAcceptReplace ); + if( isAcceptReplace ) { + //delete src file + if( !QFile::remove( destFi.absoluteFilePath() ) ) { + mErrString = destFi.absoluteFilePath(); + ret = FmErrCannotRemove; + break; + } + destFi.setFile( destFi.absoluteFilePath() ); + } else { + queryForRename( destFi.absoluteFilePath(), &newName ); + if( newName.isEmpty() ) { + ret = FmErrCancel; + break; + } + QString targetName = mTargetPath + newName; + destFi.setFile( targetName ); + } + } else{ + // destination is dir + queryForRename( destFi.absoluteFilePath(), &newName ); + if( newName.isEmpty() ) { + ret = FmErrCancel; + break; + } + QString targetName = mTargetPath + newName; + destFi.setFile( targetName ); + } + } + if( ret != FmErrNone ) { + emit notifyError( ret, mErrString ); + // refresh drive space no care if cancel, error or finished. + // as filemanger cannot notify drive space changed + // do not refresh path as QFileSystemModel will do auto-refresh + emit driveSpaceChanged(); + return; + } + ret = copyOrMove( checkedSource, mTargetPath, newName ); + if( ret != FmErrNone ) { + emit notifyError( ret, mErrString ); + emit driveSpaceChanged(); + return; + } + } + emit notifyFinish(); + emit driveSpaceChanged(); +} + +/* + * Copy or move the \a source to \a targetPath + * with \a newTargetName + */ +int FmOperationCopyOrMove::copyOrMove( const QString &source, const QString &targetPath, + const QString &newTargetName ) +{ + if( *mStop ) { + return FmErrCancel; + } + + QFileInfo fi( source ); + if( !fi.exists() ) { + mErrString = source; + return FmErrSrcPathDoNotExist; + } + QString newName; + if( !newTargetName.isEmpty() ) { + newName = targetPath + newTargetName; + } else { + newName = targetPath + fi.fileName(); + } + + int ret = FmErrNone; + + if ( fi.isFile() ) { + if ( FmUtils::getDriveLetterFromPath( source ) == + FmUtils::getDriveLetterFromPath( targetPath ) && + operationType() == FmOperationService::EOperationTypeMove ) + { + return FmUtils::moveInsideDrive( source, newName ); + + } + quint64 fileSize = fi.size(); + ret = copyOneFile( source, newName ); + if (ret != FmErrNone) { + mErrString = source; + return ret; + } + if ( operationType() == FmOperationService::EOperationTypeMove + && !QFile::remove( source ) ) { + mErrString = source; + return FmErrCannotRemove; + } + } else if ( fi.isDir() ) { + if( operationType() == FmOperationService::EOperationTypeMove + && FmUtils::isDefaultFolder( source ) ){ + ret = FmErrRemoveDefaultFolder; + } + else{ + ret = copyOrMoveDirInsideContent( source, newName ); + } + if( ret!= FmErrNone ) { + return ret; + } + if ( operationType() == FmOperationService::EOperationTypeMove + && !fi.dir().rmdir( fi.absoluteFilePath() ) ) { + mErrString = fi.absolutePath(); + return FmErrCannotRemove; + } + } else { + qWarning( "Things other than file and directory are not copied" ); + ret = FmErrIsNotFileOrFolder; + } + + return ret; +} + +/* + copy \a srcPath as \a destPath + both \a srcPath and \a destPath are Directory +*/ +int FmOperationCopyOrMove::copyOrMoveDirInsideContent( const QString &srcPath, const QString &destPath ) +{ + QFileInfo srcInfo( srcPath ); + QFileInfo destInfo( destPath ); + + if( FmUtils::isSubLevelPath( srcPath, destPath ) ) { + mErrString = destPath; + if ( operationType() == FmOperationService::EOperationTypeMove ) { + return FmErrMoveDestToSubFolderInSrc; + } else { + return FmErrCopyDestToSubFolderInSrc; + } + + } + + if( !srcInfo.isDir() || !srcInfo.exists() ) { + mErrString = srcPath; + return FmErrSrcPathDoNotExist; + } + + if( !destInfo.exists() ) { + if( !destInfo.dir().mkdir( destInfo.absoluteFilePath() ) ) { + mErrString = destPath; + return FmErrCannotMakeDir; + } + } + destInfo.setFile( destPath ); + if( !destInfo.isDir() ) { + mErrString = destPath; + return FmErrCannotMakeDir; + } + + //start to copy + QFileInfoList infoList = QDir( srcPath ).entryInfoList( QDir::NoDotAndDotDot | QDir::AllEntries | QDir::Hidden | QDir::System ); + while( !infoList.isEmpty() ) { + if( *mStop ) { + return FmErrCancel; + } + + QFileInfo fileInfo = infoList.takeFirst(); + if( fileInfo.isFile() ){ + //copy file + QString newFilePath = destPath + fileInfo.absoluteFilePath().mid( srcPath.length() ); + int ret = copyOneFile( fileInfo.absoluteFilePath(), newFilePath ); + if ( ret != FmErrNone ) { + mErrString = fileInfo.absoluteFilePath(); + return ret; + } + if( operationType() == FmOperationService::EOperationTypeMove + && !QFile::remove( fileInfo.absoluteFilePath() ) ) { + mErrString = fileInfo.absoluteFilePath(); + return FmErrCannotRemove; + } + } else if( fileInfo.isDir() ) { + //makedir + QString newDirPath = destPath + fileInfo.absoluteFilePath().mid( srcPath.length() ); + if( !QDir( newDirPath ).exists() && !QDir( destPath ).mkdir( newDirPath ) ) { + mErrString = newDirPath; + return FmErrCannotMakeDir; + } + // add dir content to list. + QFileInfoList infoListDir = QDir( fileInfo.absoluteFilePath() ).entryInfoList( + QDir::NoDotAndDotDot | QDir::AllEntries ); + if ( operationType() == FmOperationService::EOperationTypeMove ) { + if( infoListDir.isEmpty() ) { + if ( !fileInfo.dir().rmdir( fileInfo.absoluteFilePath() ) ) { + mErrString = fileInfo.absolutePath(); + return FmErrCannotRemove; + } + } else { + infoList.push_front( fileInfo ); + } + } + while( !infoListDir.isEmpty() ) { + infoList.push_front( infoListDir.takeLast() ); + } + + } else { + mErrString = fileInfo.absoluteFilePath(); + return FmErrIsNotFileOrFolder; + } + + } + + return FmErrNone; +} + +/* + * Increase the progress bar + * \a size the current copy or moved size + */ +void FmOperationCopyOrMove::increaseProgress( quint64 size ) +{ + if( mTotalSize <=0 ) { + return; + } + mCopiedOrMovedSize += size; + int step = ( mCopiedOrMovedSize * FmTotalProgressBarSteps ) / mTotalSize; + if( step > mCurrentStep ) { + mCurrentStep = step; + emit notifyProgress( mCurrentStep ); + } +} + +/* + * Emits askForRename signal. + * \a srcFile the source file path. + * \a destFile get the new name from user input + */ +void FmOperationCopyOrMove::queryForRename( const QString &srcFile, QString *destFile ) +{ + emit askForRename( srcFile, destFile ); +} + +/* + * Copies one file from \a srcFile to \a desFile + */ +int FmOperationCopyOrMove::copyOneFile( const QString &srcFile, const QString &desFile ) +{ + QFile src( srcFile ); + QFile des( desFile ); + if ( !src.open( QIODevice::ReadOnly ) || !des.open( QIODevice::WriteOnly ) ) { + return FmErrCannotCopy; + } + QDataStream outputStream( &src ); + QDataStream inputStream( &des ); + //used to cache data from source file to target file during one copy + QScopedPointer tempString( new char[FmOneTimeCopyOrMoveSize] ); + memset( tempString.data(), 0, FmOneTimeCopyOrMoveSize ); + while ( !outputStream.atEnd() ) { + if ( *mStop ) { + src.close(); + des.close(); + QFile::remove( desFile ); + return FmErrCancel; + } + int ret = outputStream.readRawData(tempString.data(), FmOneTimeCopyOrMoveSize ); + if (ret == -1) { + src.close(); + des.close(); + QFile::remove( desFile ); + return FmErrCannotCopy; + } + ret = inputStream.writeRawData(tempString.data(), ret); + if (ret == -1) { + src.close(); + des.close(); + QFile::remove( desFile ); + return FmErrCannotCopy; + } + memset( tempString.data(), 0, FmOneTimeCopyOrMoveSize ); + increaseProgress( ret ); + } + src.close(); + des.close(); + if ( FmUtils::setFileAttributes( srcFile, desFile ) != FmErrNone ) { + QFile::remove( desFile ); + return FmErrCannotCopy; + } + return FmErrNone; +} + +/* + * Prepare some work before starting operation. + * Returns error number. + */ +int FmOperationCopyOrMove::prepare() +{ + if( mSourceList.empty() ) { + return FmErrWrongParam; + } else { + return FmErrNone; + } +} + +bool FmOperationCopyOrMove::targetHasEnoughSpace() +{ + QString sourceDrive = FmUtils::getDriveLetterFromPath( mSourceList.front() ); + QString targetDrive = FmUtils::getDriveLetterFromPath( mTargetPath ); + if ( sourceDrive == targetDrive && + operationType() == FmOperationService::EOperationTypeMove ) { + return true; + } else { + return FmUtils::hasEnoughSpace( targetDrive, mTotalSize ); + } +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationcopyormove.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationcopyormove.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,63 @@ +/* +* 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 FMOPERATIONCOPYORMOVE_H +#define FMOPERATIONCOPYORMOVE_H + +#include +#include + +#include "fmoperationbase.h" + +class FmOperationCopyOrMove : public FmOperationBase +{ + Q_OBJECT + +public: + explicit FmOperationCopyOrMove( FmOperationService *operationService, FmOperationService::TOperationType type, const QStringList &sourceList, const QString &targetPath ); + virtual ~FmOperationCopyOrMove(); + virtual int prepare(); + virtual void start( volatile bool *isStopped ); + QStringList sourceList(); + QString targetPath(); + +signals: + void askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ); + void askForRename( const QString &srcFile, QString *destFile ); + void driveSpaceChanged(); + +private: + int copyOrMove( const QString &source, const QString &targetPath, const QString &newTargetName = QString() ); + int copyOrMoveDirInsideContent( const QString &srcPath, const QString &destPath ); + void increaseProgress( quint64 size ); + void queryForRename( const QString &srcFile, QString *destFile ); + int copyOneFile( const QString &srcFile, const QString &desFile ); + bool targetHasEnoughSpace(); + +private: + FmOperationService *mOperationService; + QStringList mSourceList; + QString mTargetPath; + volatile bool *mStop; + QString mErrString; + + quint64 mTotalSize; + quint64 mCopiedOrMovedSize; + int mTotalSteps; + int mCurrentStep; +}; +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationformat.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationformat.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,45 @@ +/* +* 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: +* The header file of the operation param of file manager +* +*/ + +#ifndef FMOPERATIONFORMAT_H +#define FMOPERATIONFORMAT_H + +#include "fmoperationbase.h" + +#include +#include + +class FmOperationFormat : public FmOperationBase +{ + Q_OBJECT +public: + explicit FmOperationFormat( QObject *parent, const QString &mDriverName ); + virtual ~FmOperationFormat(); + QString driverName(); + virtual void start( volatile bool *isStopped ); + +signals: + void driveSpaceChanged(); + +private: + QString mDriverName; + + int mTotalSteps; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationformat_s60.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationformat_s60.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,213 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "fmoperationformat.h" +#include "fmcommon.h" +#include "fmoperationbase.h" +#include "fmutils.h" + +#include + +#include +#include +#include + +/* \fn void driveSpaceChanged() + * This signal is emitted when copy or move is completed, and used to update the drive size. + */ + +/* + * Constructs a format operation with \a parent + * \a mDriverName the drive to be formatted. + */ +FmOperationFormat::FmOperationFormat( QObject *parent, const QString &mDriverName ) : FmOperationBase( parent, FmOperationService::EOperationTypeFormat ), + mDriverName( mDriverName ) +{ + connect( this, SIGNAL( driveSpaceChanged() ), + parent, SLOT( on_operation_driveSpaceChanged() ) ); +} + +/* + * Destructs the operation. + */ +FmOperationFormat::~FmOperationFormat() +{ +} + +/* + * Returns the to be formatted drive name + */ +QString FmOperationFormat::driverName() +{ + return mDriverName; +} + +/* + * Starts to format. + * \a isStopped not used + */ +void FmOperationFormat::start( volatile bool */*isStopped*/ ) +{ + QString logString = "FmOperationFormat::start"; + FM_LOG( logString ); + + emit notifyPreparing( false ); + + if( mDriverName.isEmpty() ) { + emit notifyError( FmErrWrongParam, QString() ); + return; + } + + RFormat format; + + RFs fs; + int err = fs.Connect(); + + if( err != KErrNone ){ + emit notifyError( FmErrTypeFormatFailed, QString() ); + return; + } + + TInt drive = 0; + drive = mDriverName[0].toUpper().toAscii() - 'A' + EDriveA; + + TDriveName formatDriveName( TDriveUnit( drive ).Name() ); + + int finalValue = 0; + + format.Close(); + + err = format.Open( + fs, formatDriveName, EFullFormat | ESpecialFormat, finalValue ); + + if( err == KErrNone ){ + logString = "emit notifyStart"; + FM_LOG( logString ); + mTotalSteps = finalValue; + emit notifyStart( false, finalValue ); + } + + logString = "Format open error:" + QString::number( err ); + FM_LOG( logString ); + + if( err == KErrLocked ){ + err = fs.ErasePassword( drive ); + + logString = "ErasePassword error:" + QString::number( err ); + FM_LOG( logString ); + + if( err == KErrNone ){ + err = format.Open( + fs, formatDriveName, EFullFormat, finalValue ); + + if( err == KErrNone ){ + logString = "emit notifyStart"; + FM_LOG( logString ); + mTotalSteps = finalValue; + emit notifyStart( false, finalValue ); + } + logString = "Second format open error:" + QString::number( err ); + FM_LOG( logString ); + } + } + + if (err == KErrInUse){ + TBool reallyFormat = ETrue; + if (reallyFormat){ + err = format.Open( + fs, formatDriveName, EFullFormat | EForceFormat, finalValue ); + + if( err == KErrNone ){ + logString = "emit notifyStart"; + FM_LOG( logString ); + mTotalSteps = finalValue; + emit notifyStart( false, finalValue ); + } + + logString = "Reallyformat open error:" + QString::number( err ); + FM_LOG( logString ); + } + } + + TFullName fsName; + if ( err == KErrNone ) + { + err = fs.FileSystemName( fsName, drive ); + + logString = "FileSystemName error:" + QString::number( err ); + FM_LOG( logString ); + + if ( err == KErrNone && fsName.Length() > 0 ) + { + // Prevent SysAp shutting down applications + RProperty::Set( + KPSUidCoreApplicationUIs, + KCoreAppUIsMmcRemovedWithoutEject, + ECoreAppUIsEjectCommandUsed ); + + logString = "Prevent SysAp shutting down applications" ; + FM_LOG( logString ); + } + else + { + // Don't continue with format if there is no file system name + // or file system name could not be obtained. + err = KErrCancel; + + logString = QString( "Format cancel" ); + FM_LOG( logString ); + } + } + + if( err == KErrNone && finalValue ){ + + while ( finalValue ){ + logString = "Format tracks:" + QString::number( finalValue ); + FM_LOG( logString ); + err = format.Next( finalValue ); + + if( err != KErrNone ){ + logString = "Format error:" + QString::number( err ); + FM_LOG( logString ); + break; + } + + logString = "emit notifyProgress"; + FM_LOG( logString ); + emit notifyProgress( mTotalSteps - finalValue ); + } + } + + if( !finalValue || err != KErrNone ){ + format.Close(); + fs.Close(); + + FmUtils::createDefaultFolders( mDriverName ); + } + + if( err == KErrNone ){ + emit notifyFinish(); + } + else{ + emit notifyError( FmErrTypeFormatFailed, QString() ); + } + // refresh drive space no care if cancel, error or finished. + // as filemanger cannot notify drive space changed + // do not refresh path as QFileSystemModel will do auto-refresh + emit driveSpaceChanged(); + +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationformat_win.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationformat_win.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "fmoperationformat.h" +#include "fmcommon.h" +#include "fmoperationbase.h" +#include "fmutils.h" + +#include + +/* \fn void driveSpaceChanged() + * This signal is emitted when copy or move is completed, and used to update the drive size. + */ + +/* + * Constructs a format operation with \a parent + * \a mDriverName the drive to be formatted. + */ +FmOperationFormat::FmOperationFormat( QObject *parent, const QString &mDriverName ) : FmOperationBase( parent, FmOperationService::EOperationTypeFormat ), + mDriverName( mDriverName ) +{ +} + +/* + * Destructs the operation. + */ +FmOperationFormat::~FmOperationFormat() +{ +} + +/* + * Returns the to be formatted drive name + */ +QString FmOperationFormat::driverName() +{ + return mDriverName; +} + +/* + * Starts to format. + * \a isStopped not used + */ +void FmOperationFormat::start( volatile bool */*isStopped*/ ) +{ + QString logString = "FmOperationFormat::start"; + FM_LOG( logString ); + + if( mDriverName.isEmpty() ) { + emit notifyError( FmErrWrongParam, QString() ); + return; + } + int totalCount( 100 ); + emit notifyStart( totalCount, false ); + for( int i = 0; i < totalCount; i++ ) { + emit notifyProgress( i ); + } + + emit notifyFinish(); + emit driveSpaceChanged(); + +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationremove.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationremove.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "fmoperationremove.h" +#include "fmcommon.h" +#include "fmoperationbase.h" +#include "fmdrivedetailstype.h" +#include "fmutils.h" + +#include +#include +#include +#include + +/* \fn void driveSpaceChanged() + * This signal is emitted when copy or move is completed, and used to update the drive size. + */ + +/* + * Constructs a remove operation with + * \a parent parent + * \a pathList the file or path to be removed. + */ +FmOperationRemove::FmOperationRemove(QObject *parent, const QStringList &pathList ) : + FmOperationBase( parent, FmOperationService::EOperationTypeRemove ), + mPathList( pathList ), + mStop( 0 ), + mTotalCount( 0 ), mRemovedCount( 0 ), mTotalSteps( 100 ), mCurrentStep( 0 ) +{ + connect( this, SIGNAL( driveSpaceChanged() ), + parent, SLOT( on_operation_driveSpaceChanged() ) ); +} + +/* + * Destructs the operation. + */ +FmOperationRemove::~FmOperationRemove() +{ +} + +/* + * Returns the path list + */ +QStringList FmOperationRemove::pathList() +{ + return mPathList; +} + +/* + * Starts the operation. + * \a isStopped flag the outside stop operation + */ +void FmOperationRemove::start( volatile bool *isStopped ) +{ + mStop = isStopped; + mTotalCount = 0; + mRemovedCount = 0; + mCurrentStep = 0; + + if( mPathList.empty() ) { + emit notifyError( FmErrWrongParam, mErrString ); + return ; + } + + emit notifyPreparing( true ); + + quint64 totalSize= 0; + int numofFolders = 0; + int numofFiles = 0; + + int ret = FmFolderDetails::queryDetailOfContentList( mPathList, numofFolders, + numofFiles, totalSize, mStop, true ); + if( ret != FmErrNone ) { + emit notifyError( ret, mErrString ); + return; + } + mTotalCount = numofFolders + numofFiles; + + emit notifyStart( true, mTotalSteps ); + + foreach( const QString& srcPath, mPathList ) { + int ret = remove( srcPath ); + if( ret != FmErrNone ) { + emit notifyError( ret, mErrString ); + // refresh drive space no care if cancel, error or finished. + // as filemanger cannot notify drive space changed + // do not refresh path as QFileSystemModel will do auto-refresh + emit driveSpaceChanged(); + return; + } + } + emit notifyFinish(); + emit driveSpaceChanged(); +} + +/* + * Removes the file or dir with name \a fileName + */ +int FmOperationRemove::remove( const QString &fileName ) +{ + if( *mStop ) { + return FmErrCancel; + } + + int ret = FmErrNone; + QFileInfo fi( fileName ); + if (fi.isFile()) { + if( !QFile::remove( fileName ) ) { + mErrString = fileName; + ret = FmErrCannotRemove; + } + IncreaseProgressOnce(); + } else if (fi.isDir()) { + if( FmUtils::isDefaultFolder( fileName ) ){ + ret = FmErrRemoveDefaultFolder; + } + else{ + ret = recursiveRemoveDir( fileName ); + } + + + } else { + qWarning( "Things other than file and directory are not copied" ); + ret = FmErrIsNotFileOrFolder; + } + return ret; +} + +/* + * Remove the dir with name \a pathName + */ +int FmOperationRemove::recursiveRemoveDir( const QString &pathName ) +{ + QFileInfo fi( pathName ); + if (!fi.exists() || !fi.isDir()) + return FmErrSrcPathDoNotExist; + + QStack dirs; + dirs.push( QDir( pathName ) ); + + while (!dirs.isEmpty()) { + QFileInfoList infoList = dirs.top().entryInfoList( QDir::NoDotAndDotDot | QDir::AllEntries | QDir::Hidden | QDir::System ); + if (infoList.size() == 0) { + QDir dirToRemove( dirs.pop() ); + if ( !dirToRemove.rmdir( dirToRemove.absolutePath() ) ) { + mErrString = dirToRemove.absolutePath(); + return FmErrCannotRemove; + } + IncreaseProgressOnce(); + + } else { + QList dirList; + for (QFileInfoList::Iterator it = infoList.begin(); it != infoList.end(); ++it) { + if( *mStop ) { + return FmErrCancel; + } + + if (it->isDir()) { + dirList.push_front( QDir( it->absoluteFilePath() ) ); + } else { + if ( !QFile::remove( it->absoluteFilePath() ) ) { + mErrString = it->absoluteFilePath(); + return FmErrCannotRemove; + } + IncreaseProgressOnce(); + } + } + foreach( const QDir& dir, dirList ) { + dirs.push( dir ); + } + } + } + return FmErrNone; +} + +/* + * Increase the progress bar + */ +void FmOperationRemove::IncreaseProgressOnce() +{ + if( mTotalCount <= 0 ) + return; + mRemovedCount++; + int step = ( mRemovedCount * 100 ) / mTotalCount; + if( step > mCurrentStep ) { + mCurrentStep = step; + emit notifyProgress( mCurrentStep ); + } +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationremove.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationremove.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef FMOPERATIONREMOVE_H +#define FMOPERATIONREMOVE_H +#include + +#include "fmoperationbase.h" + +class FmOperationRemove : public FmOperationBase +{ + Q_OBJECT + +public: + explicit FmOperationRemove( QObject *parent, const QStringList &pathList ); + virtual ~FmOperationRemove(); + + QStringList pathList(); + void start( volatile bool *isStopped ); + +signals: + void driveSpaceChanged(); + +private: + int remove( const QString &fileName ); + int recursiveRemoveDir( const QString &path ); + void IncreaseProgressOnce(); + +private: + QStringList mPathList; + + volatile bool *mStop; + QString mErrString; + + quint64 mTotalCount; + quint64 mRemovedCount; + int mTotalSteps; + int mCurrentStep; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,593 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "fmoperationresultprocesser.h" +#include "fmoperationbase.h" +#include "fmoperationservice.h" +#include "fmoperationformat.h" +#include "fmbkupengine.h" +#include "fmbackupsettings.h" +#include "fmbackuprestorehandler.h" +#include "fmoperationviewdetails.h" +#include "fmviewdetailsdialog.h" +#include "fmdlgutils.h" +#include "fmutils.h" +#include +#include +#include +#include +#include + +/* + * Constructs one operation result processer with \a operation Service. + */ +FmOperationResultProcesser::FmOperationResultProcesser( FmOperationService *operationService ) + : mOperationService( operationService ), mNote( 0 ) +{ +} + +/* + * Destructs the operation result processer + */ +FmOperationResultProcesser::~FmOperationResultProcesser(void) +{ +} + +/* + * Called by operation service on_operation_askForRename + * \sa FmOperationService::on_operation_askForRename + */ +void FmOperationResultProcesser::onAskForRename( + FmOperationBase* operationBase, const QString &srcFile, QString *destFile ) +{ + Q_UNUSED( operationBase ); + int maxFileNameLength = FmUtils::getMaxFileNameLength(); + + QString questionText = QString( "file " ) + + srcFile + QString( " already exist, please rename:" ); + QString value; + QFileInfo srcFileInfo(srcFile); + QStringList regExpList = (QStringList() << Regex_ValidFileFolderName << Regex_ValidNotEndWithDot ); + + bool ret = FmDlgUtils::showTextQuery( questionText, value, regExpList, + maxFileNameLength, QString(), false ); + while ( ret ) { + // remove whitespace from the start and the end. + value = value.trimmed(); + QString newTargetPath = FmUtils::fillPathWithSplash( + srcFileInfo.absolutePath() ) + value; + QString errString; + // check if name/path is available for use. + if( !FmUtils::checkNewFolderOrFile( value, newTargetPath, errString ) ) { + FmDlgUtils::information( errString ); + ret = FmDlgUtils::showTextQuery( questionText, value, regExpList, maxFileNameLength, QString(), false ); + continue; + } else { + break; + } + } + if( ret ) { + // Got file/folder name for rename, save it to destFile + *destFile = value; + QFileInfo destFileInfo( *destFile ); + if ( ( srcFileInfo.suffix().compare( destFileInfo.suffix(), Qt::CaseInsensitive ) != 0 ) + && srcFileInfo.isFile() ) { + // popup warning when the suffix of file is changed. + FmDlgUtils::information( hbTrId( "File may become unusable when file name extension is changed" ) ); + } + } +} + +/* + * Called by operation service on_operation_askForReplace + * \sa FmOperationService::on_operation_askForReplace + */ +void FmOperationResultProcesser::onAskForReplace( + FmOperationBase* operationBase, const QString &srcFile, const QString &destFile, bool *isAccepted ) +{ + Q_UNUSED( operationBase ); + Q_UNUSED( destFile ); + + QString questionText = QString( "file " ) + + srcFile + QString( " already exist, replace it?" ); + if( FmDlgUtils::question( questionText ) ) { + *isAccepted = true; + } else { + *isAccepted = false; + } +} + +/* + * Called by operation service on_operation_showNote + * \sa FmOperationService::on_operation_showNote + */ +void FmOperationResultProcesser::onShowNote( FmOperationBase* operationBase, const char *noteString ) +{ + Q_UNUSED( operationBase ); + FmDlgUtils::information(hbTrId(noteString)); +} + +/* + * Called by operation service on_operation_notifyWaiting + * \sa FmOperationService::on_operation_notifyWaiting + */ +void FmOperationResultProcesser::onNotifyWaiting( FmOperationBase* operationBase, bool cancelable ) +{ + QString title = hbTrId("Operation"); + switch( operationBase->operationType() ) + { + case FmOperationService::EOperationTypeBackup: + title = hbTrId("backuping"); + break; + case FmOperationService::EOperationTypeRestore: + title = hbTrId("restoring"); + break; + case FmOperationService::EOperationTypeDriveDetails: + title = hbTrId( "Scaning memory..." ); + break; + + case FmOperationService::EOperationTypeFolderDetails: + title = hbTrId( "Scaning folder..." ); + break; + default: + break; + } + + showWaiting( title, cancelable ); +} + +/* + * Called by operation service on_operation_notifyPreparing + * \sa FmOperationService::on_operation_notifyPreparing + */ +void FmOperationResultProcesser::onNotifyPreparing( FmOperationBase* operationBase, bool cancelable ) +{ + QString title = hbTrId("Operation"); + switch( operationBase->operationType() ) + { + case FmOperationService::EOperationTypeBackup: + title = hbTrId("backup preparing"); + break; + case FmOperationService::EOperationTypeRestore: + title = hbTrId("restore preparing"); + break; + case FmOperationService::EOperationTypeCopy: + title = hbTrId("copy preparing"); + break; + case FmOperationService::EOperationTypeMove: + title = hbTrId("move preparing"); + break; + case FmOperationService::EOperationTypeRemove: + title = hbTrId("delete preparing"); + break; + case FmOperationService::EOperationTypeFormat: + title = hbTrId("format preparing"); + break; + default: + break; + } + + showPreparing( title, cancelable ); +} + +/* + * Called by operation service on_operation_notifyStart + * \sa FmOperationService::on_operation_notifyStart + */ +void FmOperationResultProcesser::onNotifyStart( FmOperationBase* operationBase, bool cancelable, int maxSteps ) +{ + QString title = hbTrId("Operation"); + switch( operationBase->operationType() ) + { + case FmOperationService::EOperationTypeBackup: + title = hbTrId("backup..."); + break; + case FmOperationService::EOperationTypeRestore: + title = hbTrId("restore..."); + break; + case FmOperationService::EOperationTypeCopy: + title = hbTrId("copy..."); + break; + case FmOperationService::EOperationTypeMove: + title = hbTrId("move..."); + break; + case FmOperationService::EOperationTypeRemove: + title = hbTrId("delete..."); + break; + case FmOperationService::EOperationTypeFormat: + title = hbTrId("formating..."); + break; + default: + break; + } + + showProgress( title, cancelable, maxSteps ); +} + +/* + * Called by operation service on_operation_notifyProgress + * \sa FmOperationService::on_operation_notifyProgress + */ +void FmOperationResultProcesser::onNotifyProgress( FmOperationBase* operationBase, int currentStep ) +{ + Q_UNUSED( operationBase ); + setProgress( currentStep ); +} + +/* + * Called by operation service on_operation_notifyFinish + * \sa FmOperationService::on_operation_notifyFinish + */ +void FmOperationResultProcesser::onNotifyFinish( FmOperationBase* operationBase ) +{ + + finishProgress(); + switch( operationBase->operationType() ) + { + case FmOperationService::EOperationTypeDriveDetails: + { + FmOperationDriveDetails *paramDriveDetails = static_cast( operationBase ); + QString diskName = paramDriveDetails->driverName(); + FmViewDetailsDialog::showDriveViewDetailsDialog( diskName, paramDriveDetails->detailsSizeList(), + FmUtils::getDriveLetterFromPath( diskName ) ); + break; + } + case FmOperationService::EOperationTypeFolderDetails: + { + FmOperationFolderDetails *paramFolderDetails = static_cast( operationBase ); + FmViewDetailsDialog::showFolderViewDetailsDialog( paramFolderDetails->folderPath(), + paramFolderDetails->numofSubFolders(), + paramFolderDetails->numofFiles(), + paramFolderDetails->sizeofFolder(), + FmUtils::getDriveLetterFromPath( paramFolderDetails->folderPath() ) ); + break; + } + case FmOperationService::EOperationTypeFormat: + { + FmDlgUtils::information( QString( hbTrId("Format succeed!")) ); + FmOperationFormat *paramFormat = static_cast( operationBase ); + QString title( hbTrId( "Drive name ") ); + QString driveName( paramFormat->driverName() ); + FmDriverInfo driverInfo = FmUtils::queryDriverInfo( driveName ); + FmDriverInfo::DriveState state = driverInfo.driveState(); + FmDriverInfo::DriveType driveType = driverInfo.driveType(); + + // If drive is available and it is mmc or usb memory + if( ( state & FmDriverInfo::EDriveAvailable ) && + ( driveType == FmDriverInfo::EDriveTypeMemoryCard || + driveType == FmDriverInfo::EDriveTypeUsbMemory ) ) { + bool needToSetVolume = false; + QString volumeName = FmUtils::getVolumeNameWithDefaultNameIfNull( driveName, needToSetVolume ); + //use isReturnFalseWhenNoTextChanged = false in order that FmUtils::renameDrive( driveName, volumeName ) will + //be excuted at lease once to set the volume name. + while( FmDlgUtils::showTextQuery( title, volumeName, QStringList(), FmMaxLengthofDriveName, QString(), false ) ){ + int err = FmUtils::renameDrive( driveName, volumeName ); + if ( err == FmErrNone ) { + FmDlgUtils::information( hbTrId( "The name has been changed!" ) ); + mOperationService->on_operation_driveSpaceChanged(); + break; + } else if( err == FmErrBadName ) { + FmDlgUtils::information( hbTrId( "Illegal characters! Use only letters and numbers." ) ); + } else{ + FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) ); + break; + } + } + } + break; + } + case FmOperationService::EOperationTypeBackup: + { + FmDlgUtils::information( QString( hbTrId("Backup succeed!")) ); + break; + } + case FmOperationService::EOperationTypeRestore: + { + FmDlgUtils::information( QString( hbTrId("Restore succeed!")) ); + break; + } + default: + FmDlgUtils::information( QString( hbTrId("Operation finished")) ); + + } +} + +/* + * Called by operation service on_operation_notifyError + * \sa FmOperationService::on_operation_notifyError + */ +void FmOperationResultProcesser::onNotifyError( FmOperationBase* operationBase, int error, const QString &errString ) +{ + Q_UNUSED( errString ); + failAndCloseProgress(); + switch( error ) + { + case FmErrCancel: + cancelProgress(); + // Do not pop up general cancel note as it is not needed( according to TB9.2 ). + // If it should be added later, please do not use blocking note. + // Blocking note will cause second backup operaion freeze after cancel previous backup operation + // as QEventLoop::exec will cause some problem when used for blocking dialog. + // HbDialog has already removed exec function which is implemented with QEventLoop::exec. + // If need use QEventLoop::exec to block code execute sequence, It should be invoked in a Qt::QueuedConnection slot. + return; + case FmErrAlreadyStarted: + FmDlgUtils::information( QString( hbTrId("Operation already started!")) ); + return; + case FmErrLocked: + { + FmOperationBackup *operationBackup = qobject_cast(operationBase); + if( operationBackup ) { + // special error note for backup + QString targetDrive( operationBackup->targetDrive() ); + QString defaultDriveVolume( FmUtils::getDefaultVolumeName( targetDrive ) ); + QString driveString( defaultDriveVolume.isEmpty()? targetDrive:defaultDriveVolume ); + FmDlgUtils::information( QString( hbTrId("txt_fmgr_info_backup_locked") ).arg( driveString ) ); + } else { + FmDlgUtils::information( QString( hbTrId("Operation failed because drive is locked!")) ); + } + return; + } + case FmErrPathNotFound: + FmDlgUtils::information( QString( hbTrId("Operation failed because can not find target path or drive is not available!") ) ); + return; + case FmErrCorrupt: + { + FmOperationBackup *operationBackup = qobject_cast(operationBase); + if( operationBackup ) { + // special error note for backup + QString targetDrive( operationBackup->targetDrive() ); + QString defaultDriveVolume( FmUtils::getDefaultVolumeName( targetDrive ) ); + QString driveString( defaultDriveVolume.isEmpty()? targetDrive:defaultDriveVolume ); + FmDlgUtils::information( QString( hbTrId("txt_fmgr_info_backup_corrupted") ).arg( driveString ) ); + } else { + FmDlgUtils::information( QString( hbTrId("Operation failed because target media is corrupted!") ) ); + } + return; + } + case FmErrNotReady: // Caused when MMC & OTG is not inserted when start backup + { + FmOperationBackup *operationBackup = qobject_cast(operationBase); + if( operationBackup ) { + // special error note for backup + QString targetDrive( operationBackup->targetDrive() ); + QString defaultDriveVolume( FmUtils::getDefaultVolumeName( targetDrive ) ); + QString driveString( defaultDriveVolume.isEmpty()? targetDrive:defaultDriveVolume ); + FmDlgUtils::information( QString( hbTrId("txt_fmgr_info_backup_unavailable") ).arg( driveString ) ); + } else { + FmDlgUtils::information( QString( hbTrId("Operation failed because device is not ready!") ) ); + } + return; + } + case FmErrDisMounted: // Caused by eject MMC when preparing backup, will be localized later + FmDlgUtils::information( QString( hbTrId("Operation failed because backup target drive has been removed!") ) ); + return; + case FmErrDiskFull: + FmDlgUtils::information( QString( hbTrId("Not enough space. Operation cancelled!")) ); + return; + case FmErrCopyDestToSubFolderInSrc: + FmDlgUtils::information( QString( hbTrId("Can not copy to sub folder!")) ); + return; + case FmErrMoveDestToSubFolderInSrc: + FmDlgUtils::information( QString( hbTrId("Can not move to sub folder!")) ); + return; + case FmErrCannotRemove:{ + if( operationBase->operationType() == FmOperationService::EOperationTypeCopy ) { + // when copy a file/dir to same name destination, and delete dest fail, this error will occur + FmDlgUtils::information( QString( hbTrId( "Can not copy because %1 can not be deleted!" ).arg( errString ) ) ); + return; + } + else if( operationBase->operationType() == FmOperationService::EOperationTypeMove ) { + // when move a file/dir to same name destination, and delete dest fail, this error will occur + FmDlgUtils::information( QString( hbTrId( "Can not move because %1 can not be deleted!" ).arg( errString ) ) ); + return; + } + // when delete file/dir fail, this error will occur + FmDlgUtils::information( QString( hbTrId( "Can not delete %1!" ).arg( errString ) ) ); + return; + } + case FmErrRemoveDefaultFolder:{ + if( operationBase->operationType() == FmOperationService::EOperationTypeMove ) { + // when move a default folder + FmDlgUtils::information( QString( hbTrId( "Could not move because the default folder %1 can not be deleted!" ).arg( errString ) ) ); + return; + } + else { + // when delete the default folder + FmDlgUtils::information( QString( hbTrId( "Could not remove the default folder %1 " ).arg( errString ) ) ); + return; + } + } + } + + switch( operationBase->operationType() ) + { + case FmOperationService::EOperationTypeFormat: + FmDlgUtils::information( QString( hbTrId("Format failed!")) ); + break; + default: + FmDlgUtils::information( QString( hbTrId("Operation failed")) ); + } + +} + +/* + * Responds to waiting note's cancel signal. + */ +void FmOperationResultProcesser::onProgressCancelled() +{ + mOperationService->cancelOperation(); +} + + +/* + * Shows the waiting dialog with + * \a title the title of the dialog. + * \a cancelable whether it could be cancelled. + */ +void FmOperationResultProcesser::showWaiting( QString title, bool cancelable ) +{ + qDebug("show warning"); + if( mNote ){ + mNote->close(); + delete mNote; + } + + mNote = new HbProgressDialog( HbProgressDialog::WaitDialog ); + connect( mNote, SIGNAL( cancelled() ), this, SLOT(onProgressCancelled() ) ); +// if( !mNote ) { +// mNote = new HbProgressDialog( HbProgressDialog::WaitNote ); +// connect( mNote, SIGNAL( cancelled() ), this, SLOT(onProgressCancelled() ) ); +// } else { +// mNote->setProgressDialogType( HbProgressDialog::WaitNote ); +// } + mNote->setText( title ); + //KRAZY: ignore krazy warning because QAction must be used. + QList actionList = mNote->actions(); + if (actionList.size() > 0) { + QAction *cancelAction = actionList.at(0); + if (!cancelable) { + cancelAction->setDisabled( true ); + } else { + cancelAction->setDisabled( false ); + } + } + mNote->open(); + +} + +/* + * Shows the preparing dialog with + * \a title the title of the dialog. + * \a cancelable whether it could be cancelled. + */ +void FmOperationResultProcesser::showPreparing( QString title, bool cancelable ) +{ + qDebug("show preparing"); + + if( mNote ){ + mNote->close(); + delete mNote; + } + + mNote = new HbProgressDialog( HbProgressDialog::ProgressDialog ); + connect( mNote, SIGNAL( cancelled() ), this, SLOT(onProgressCancelled() ) ); +// if( !mNote ) { +// mNote = new HbProgressDialog( HbProgressDialog::ProgressDialog ); +// connect( mNote, SIGNAL( cancelled() ), this, SLOT(onProgressCancelled() ) ); +// } else { +// mNote->setProgressDialogType( HbProgressDialog::ProgressDialog ); +// } + mNote->setMinimum(0); + mNote->setMaximum( 65535 ); + mNote->setProgressValue( 0 ); + mNote->setText( title ); + //KRAZY: ignore krazy warning because QAction must be used. + QList actionList = mNote->actions(); + if (actionList.size() > 0) { + QAction *cancelAction = actionList.at(0); + if (!cancelable) { + cancelAction->setDisabled( true ); + } else { + cancelAction->setDisabled( false ); + } + } + mNote->open(); +} + +/* + * Shows the progress dialog with + * \a title the title of the dialog. + * \a cancelable whether it could be cancelled. + */ +void FmOperationResultProcesser::showProgress( QString title, bool cancelable, int maxValue ) +{ + qDebug("show progress"); + + if( mNote ){ + mNote->close(); + delete mNote; + } + + mNote = new HbProgressDialog( HbProgressDialog::ProgressDialog ); + connect( mNote, SIGNAL( cancelled() ), this, SLOT(onProgressCancelled() ) ); +// if( !mNote ) { +// mNote = new HbProgressDialog( HbProgressDialog::ProgressDialog ); +// connect( mNote, SIGNAL( cancelled() ), this, SLOT(onProgressCancelled() ) ); +// } else { +// mNote->setProgressDialogType( HbProgressDialog::ProgressDialog ); +// } + mNote->setText( title ); + + mNote->setMinimum(0); + mNote->setMaximum( maxValue ); + + mNote->setProgressValue( 0 ); + //KRAZY: ignore krazy warning because QAction must be used. + QList actionList = mNote->actions(); + if (actionList.size() > 0) { + QAction *cancelAction = actionList.at(0); + if(!cancelable) { + cancelAction->setDisabled( true ); + } else { + cancelAction->setDisabled( false ); + } + } + mNote->open(); +} + +/* + * Sets the current progress value to be \a value + */ +void FmOperationResultProcesser::setProgress( int value ) +{ + qDebug("set progress"); + if( mNote ) + mNote->setProgressValue( value ); +} + +/* + * Finishes the progress. + */ +void FmOperationResultProcesser::finishProgress() +{ + qDebug("finish progress"); + if( mNote ) { + mNote->close(); + } +} + +/* + * Cancels the progress bar. + */ +void FmOperationResultProcesser::cancelProgress() +{ + qDebug("cancel progress"); + if( mNote ) { + mNote->close(); + } +} + +/* + * Fails and closes the progress bar. + */ +void FmOperationResultProcesser::failAndCloseProgress() +{ + qDebug("fail progress"); + if( mNote ) { + mNote->close(); + } +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,61 @@ +/* +* 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 FMOPERATIONRESULTPROCESSER_H +#define FMOPERATIONRESULTPROCESSER_H +#include + +class FmOperationBase; +class FmOperationService; +class HbProgressDialog; + +class FmOperationResultProcesser : + public QObject +{ +Q_OBJECT +public: + explicit FmOperationResultProcesser( FmOperationService* ); + ~FmOperationResultProcesser(void); + + void onAskForRename( FmOperationBase* operationBase, const QString &srcFile, QString *destFile ); + void onAskForReplace( FmOperationBase* operationBase, const QString &srcFile, const QString &destFile, bool *isAccepted ); + void onShowNote( FmOperationBase* operationBase, const char *noteString ); + void onNotifyWaiting( FmOperationBase* operationBase, bool cancelable ); + void onNotifyPreparing( FmOperationBase* operationBase, bool cancelable ); + void onNotifyStart( FmOperationBase* operationBase, bool cancelable, int maxSteps ); + void onNotifyProgress( FmOperationBase* operationBase, int currentStep ); + + + void onNotifyFinish( FmOperationBase* operationBase ); + void onNotifyError( FmOperationBase* operationBase, int error, const QString &errString ); + +private slots: + void onProgressCancelled(); +private: + void showWaiting( QString title, bool cancelable ); + void showPreparing( QString title, bool cancelable ); + void showProgress( QString title, bool cancelable, int maxValue ); + void setProgress( int value ); + void finishProgress(); + void cancelProgress(); + void failAndCloseProgress(); +private: + FmOperationService *mOperationService; + HbProgressDialog *mNote; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,549 @@ +/* + * 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: + * The source file of the operation service of file manager + */ + +#include "fmoperationservice.h" +#include "fmoperationthread.h" +#include "fmbackupconfigloader.h" +#include "fmbkupengine.h" +#include "fmbackupsettings.h" +#include "fmviewdetailsdialog.h" +#include "fmoperationresultprocesser.h" +#include "fmoperationcopyormove.h" +#include "fmoperationremove.h" +#include "fmoperationformat.h" +#include "fmoperationviewdetails.h" +#include "fmbackuprestorehandler.h" +#include + +/* \fn void driveSpaceChanged( FmOperationBase* operationBase ) + * This signal is emitted when disk size changed. + */ + +/* \fn void notifyWaiting( FmOperationBase* operationBase, bool cancelable ) + * This signal is emitted when the operation emits notifyWaiting. + */ + +/* \fn void notifyPreparing( FmOperationBase* operationBase, bool cancelable ) + * This signal is emitted when the operation emits notifyPreparing. + */ + +/* \fn void notifyStart( FmOperationBase* operationBase, bool cancelable, int maxSteps ) + * This signal is emitted when the operation emits notifyStart. + */ + +/* \fn void notifyProgress( FmOperationBase* operationBase, int currentStep ) + * This signal is emitted when the operation emits notifyProgress. + */ + +/* \fn void notifyFinish( FmOperationBase* operationBase ) + * This signal is emitted when the operation emits notifyFinish. + */ + +/* \fn void notifyError( FmOperationBase* operationBase, int error, QString errString ) + * This signal is emitted when the operation emits notifyError. + */ + +/* \fn void notifyCanceled( FmOperationBase* operationBase ) + * This signal is emitted when the operation emits notifyCanceled. + */ + +/* + * Constructs one operation Service with \a parent. + */ +FmOperationService::FmOperationService( QObject *parent ) : QObject( parent ), + mCurrentOperation( 0 ), mBackupRestoreHandler( 0 ) +{ + mThread = new FmOperationThread( this ); + mThread->setObjectName( "operationThread" ); + mOperationResultProcesser = new FmOperationResultProcesser( this ); + + QMetaObject::connectSlotsByName( this ); +} + +/* + * Destructs the operation service. + */ +FmOperationService::~FmOperationService() +{ + delete mThread; + mThread = 0; + delete mBackupRestoreHandler; + mBackupRestoreHandler = 0; +} + +/* + * Returns true if the thread is running, false if not. + */ +bool FmOperationService::isRunning() +{ + return mThread->isRunning(); +} + +/* + * Copies the file or foler \a targetPath asynchronously. + */ +int FmOperationService::asyncCopy( const QStringList &sourceList, const QString &targetPath ) +{ + Q_ASSERT( !mCurrentOperation ); + mCurrentOperation = new FmOperationCopyOrMove( this, FmOperationService::EOperationTypeCopy, sourceList, targetPath ); + connectSignalsAndSlots( mCurrentOperation ); + int ret = mThread->prepareOperationAndStart( mCurrentOperation ); + if ( ret!= FmErrNone ) { + resetOperation(); + return ret; + } + return FmErrNone; +} + +/* + * Moves the file or foler \a sourceList to \a targetPath asynchronously. + */ +int FmOperationService::asyncMove( const QStringList &sourceList, const QString &targetPath ) +{ + Q_ASSERT( !mCurrentOperation ); + + mCurrentOperation = new FmOperationCopyOrMove( this, FmOperationService::EOperationTypeMove, sourceList, targetPath ); + connectSignalsAndSlots( mCurrentOperation ); + int ret = mThread->prepareOperationAndStart( mCurrentOperation ); + if ( ret!= FmErrNone ) { + resetOperation(); + return ret; + } + return FmErrNone; +} + +/* + * Removes the file or dir \a pathList asynchronously. + */ +int FmOperationService::asyncRemove( const QStringList &pathList ) +{ + Q_ASSERT( !mCurrentOperation ); + + mCurrentOperation = new FmOperationRemove( this, pathList ); + connectSignalsAndSlots( mCurrentOperation ); + int ret = mThread->prepareOperationAndStart( mCurrentOperation ); + if ( ret!= FmErrNone ) { + resetOperation(); + return ret; + } + return FmErrNone; +} + +/* + * Formats the drive \a driverName asynchronously. + */ +int FmOperationService::asyncFormat( const QString &driverName ) +{ + Q_ASSERT( !mCurrentOperation ); + + mCurrentOperation = new FmOperationFormat( this, driverName ); + connectSignalsAndSlots( mCurrentOperation ); + int ret = mThread->prepareOperationAndStart( mCurrentOperation ); + if ( ret!= FmErrNone ) { + resetOperation(); + return ret; + } + return FmErrNone; +} + +/* + * Views drive \a driverName details asynchronously. + */ +int FmOperationService::asyncViewDriveDetails( const QString &driverName ) +{ + Q_ASSERT( !mCurrentOperation ); + + mCurrentOperation = new FmOperationDriveDetails( this, driverName ); + connectSignalsAndSlots( mCurrentOperation ); + int ret = mThread->prepareOperationAndStart( mCurrentOperation ); + if ( ret!= FmErrNone ) { + resetOperation(); + return ret; + } + return FmErrNone; +} + +/* + * Views folder \a folderPath details asynchronously. + */ +int FmOperationService::asyncViewFolderDetails( const QString &folderPath ) +{ + Q_ASSERT( !mCurrentOperation ); + + mCurrentOperation = new FmOperationFolderDetails( this, folderPath ); + connectSignalsAndSlots( mCurrentOperation ); + int ret = mThread->prepareOperationAndStart( mCurrentOperation ); + if ( ret!= FmErrNone ) { + resetOperation(); + return ret; + } + return FmErrNone; +} + +/* + * Backups asynchronously. + */ +int FmOperationService::asyncBackup() +{ + if ( isRunning() ) + return FmErrAlreadyStarted; + Q_ASSERT( !mCurrentOperation ); + + // BackupSettingsL will not leave, coding convention will be improvied in another task. + QString targetDrive( backupRestoreHandler()->bkupEngine()->BackupSettingsL()->availableTargetDrive() ); + quint32 content( backupRestoreHandler()->bkupEngine()->BackupSettingsL()->content() ); + FmOperationBackup *operationBackup = + new FmOperationBackup( backupRestoreHandler(), targetDrive, content ); + mCurrentOperation = operationBackup; + int ret = backupRestoreHandler()->startBackup( operationBackup ); + if( ret ){ + return FmErrNone; + } else { + resetOperation(); + return backupRestoreHandler()->error(); + } +} + +/* + * Restores asynchronously. + * \a selection selected restore items + */ +int FmOperationService::asyncRestore( quint64 selection ) +{ + if ( isRunning() ) + return FmErrAlreadyStarted; + Q_ASSERT( !mCurrentOperation ); + + FmOperationRestore* operationRestore = new FmOperationRestore( mBackupRestoreHandler, selection ); + mCurrentOperation = operationRestore; + int ret = backupRestoreHandler()->startRestore( operationRestore ); + if( ret ){ + return FmErrNone; + } else { + resetOperation(); + return backupRestoreHandler()->error(); + } +} + +/* + * Delete backup synchronously. + * \a selection selected backup items + */ +int FmOperationService::syncDeleteBackup( quint64 selection ) +{ + return backupRestoreHandler()->deleteBackup( selection ); +} + +/* + * Cancels current operation. + */ +void FmOperationService::cancelOperation() +{ + switch( mCurrentOperation->operationType() ) + { + case EOperationTypeBackup: + backupRestoreHandler()->cancelBackup(); + break; + case EOperationTypeDriveDetails: + mThread->stop(); + break; + case EOperationTypeFolderDetails: + mThread->stop(); + break; + case EOperationTypeFormat: + //can not cancel format + break; + case EOperationTypeCopy: + mThread->stop(); + break; + case EOperationTypeMove: + mThread->stop(); + break; + case EOperationTypeRemove: + mThread->stop(); + break; + default: + Q_ASSERT( false ); + } +} + +/* + * Set valume synchronously. not used. + */ +int FmOperationService::syncSetVolume( const QString &driverName, const QString &volume ) +{ + Q_UNUSED( driverName ); + Q_UNUSED( volume ); + return FmErrNone; +} + +/* + * Set drive password synchronously. not used. + */ +int FmOperationService::syncSetdDriverPassword( const QString &driverName, + const QString &oldPassword, + const QString &newPassword ) +{ + Q_UNUSED( driverName ); + Q_UNUSED( oldPassword ); + Q_UNUSED( newPassword ); + return FmErrNone; +} + +/* + * Rename synchronously. not used. + */ +int FmOperationService::syncRename( const QString &oldPath, const QString &newName ) +{ + Q_UNUSED( oldPath ); + Q_UNUSED( newName ); + return FmErrNone; +} + +/* + * Launches the file in synchronous way. + */ +int FmOperationService::syncLaunchFileOpen( const QString &filePath ) +{ + return FmUtils::launchFile( filePath ); +} + +/* + * Returns the backup handler. + */ +FmBackupRestoreHandler *FmOperationService::backupRestoreHandler() +{ + if( !mBackupRestoreHandler ) { + mBackupRestoreHandler = new FmBackupRestoreHandler( this ); + mBackupRestoreHandler->setObjectName( "backupRestore" ) ; + QMetaObject::connectSlotsByName( this ); + } + return mBackupRestoreHandler; +} + +/* + * Deletes the operation and set it to be 0. + */ +void FmOperationService::resetOperation() +{ + if( mCurrentOperation ) { + delete mCurrentOperation; + mCurrentOperation = 0; + } +} + +/* + * Connects \a operation's sinals to slots + */ +void FmOperationService::connectSignalsAndSlots( FmOperationBase *operation ) +{ + + connect( operation, SIGNAL( showNote( QString ) ), + this, SLOT( on_operation_showNote( QString )), Qt::BlockingQueuedConnection ); + connect( operation, SIGNAL( notifyError( int, QString ) ), + this, SLOT( on_operation_notifyError( int, QString ) ) ); + connect( operation, SIGNAL( notifyStart( bool, int ) ), + this, SLOT( on_operation_notifyStart( bool, int ) ) ); + connect( operation, SIGNAL( notifyProgress( int ) ), + this, SLOT( on_operation_notifyProgress( int ) ) ); + connect( operation, SIGNAL( notifyFinish() ), + this, SLOT( on_operation_notifyFinish()) ); + connect( operation, SIGNAL( notifyWaiting( bool ) ), + this, SLOT( on_operation_notifyWaiting( bool )) ); + +} + +/* + * Responds to mCurrentOperation's askForRename signal. + * \a srcFile the source file. + * \a destFile the new file name. + */ +void FmOperationService::on_operation_askForRename( const QString &srcFile, QString *destFile ) +{ + mOperationResultProcesser->onAskForRename( + mCurrentOperation, srcFile, destFile ); +} + +/* + * Responds to mCurrentOperation's askForReplace signal. + * \a srcFile the source file. + * \a destFile the target file. + * \a isAccepted whether to replace the target file. + */ +void FmOperationService::on_operation_askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ) +{ + mOperationResultProcesser->onAskForReplace( + mCurrentOperation, srcFile, destFile, isAccepted ); +} + +/* + * Responds to mCurrentOperation's showNote signal. + * \a noteString the note content. + */ +void FmOperationService::on_operation_showNote( const char *noteString ) +{ + mOperationResultProcesser->onShowNote( mCurrentOperation, noteString ); +} + +/* + * Responds to mCurrentOperation's showNote signal. + * \a noteString the note content. + */ +void FmOperationService::on_operation_notifyWaiting( bool cancelable ) +{ + mOperationResultProcesser->onNotifyWaiting( + mCurrentOperation, cancelable ); + emit notifyWaiting( mCurrentOperation, cancelable ); +} + +/* + * Responds to mCurrentOperation's notifyPreparing signal. + * \a cancelable indicates whether the progress bar could be cancelled. + */ +void FmOperationService::on_operation_notifyPreparing( bool cancelable ) +{ + mOperationResultProcesser->onNotifyPreparing( + mCurrentOperation, cancelable ); + emit notifyPreparing( mCurrentOperation, cancelable ); +} + +/* + * Responds to mCurrentOperation's notifyPreparing signal. + * \a cancelable indicates whether the progress bar could be cancelled. + * \maxSteps the length of progress bar. + */ +void FmOperationService::on_operation_notifyStart( bool cancelable, int maxSteps ) +{ + mOperationResultProcesser->onNotifyStart( + mCurrentOperation, cancelable, maxSteps ); + emit notifyStart( mCurrentOperation, cancelable, maxSteps ); +} + +/* + * Responds to mCurrentOperation's notifyPreparing signal. + * \a currentStep indicates the current length of progress bar. + */ +void FmOperationService::on_operation_notifyProgress( int currentStep ) +{ + mOperationResultProcesser->onNotifyProgress( + mCurrentOperation, currentStep ); + emit notifyProgress( mCurrentOperation, currentStep ); +} + +/* + * Responds to mCurrentOperation's notifyFinish signal, indicate the + * progress is over. + */ +void FmOperationService::on_operation_notifyFinish() +{ + mOperationResultProcesser->onNotifyFinish( mCurrentOperation ); + emit notifyFinish( mCurrentOperation ); + resetOperation(); +} + +/* + * Responds to mCurrentOperation's notifyError signal. + * \a error error id. + * \a errString the error string. + */ +void FmOperationService::on_operation_notifyError(int error, QString errString ) +{ + mOperationResultProcesser->onNotifyError( + mCurrentOperation, error, errString ); + emit notifyError( mCurrentOperation, error, errString ); + resetOperation(); +} + +/* + * Responds to mCurrentOperation's driveSpaceChanged + */ +void FmOperationService::on_operation_driveSpaceChanged() +{ + emit driveSpaceChanged( mCurrentOperation ); +} + +/* + * Responds to mBackupRestoreHandler's notifyPreparing + * \a cancelable indicates whether it could be cancelled. + */ +void FmOperationService::on_backupRestore_notifyPreparing( bool cancelable ) +{ + mOperationResultProcesser->onNotifyPreparing( + mCurrentOperation, cancelable ); + emit notifyPreparing( mCurrentOperation, cancelable ); +} + +/* + * Responds to mBackupRestoreHandler's notifyStart + * \a cancelable indicates whether it could be cancelled. + * \a maxSteps the lenth of progress bar. + */ +void FmOperationService::on_backupRestore_notifyStart( bool cancelable, int maxSteps ) +{ + mOperationResultProcesser->onNotifyStart( + mCurrentOperation, cancelable, maxSteps ); + emit notifyStart( mCurrentOperation, cancelable, maxSteps ); +} + +/* + * Responds to mBackupRestoreHandler's notifyProgress + * \a currentStep the current progress bar's step. + */ +void FmOperationService::on_backupRestore_notifyProgress( int currentStep ) +{ + mOperationResultProcesser->onNotifyProgress( + mCurrentOperation, currentStep ); + emit notifyProgress( mCurrentOperation, currentStep ); +} + +/* + * Responds to mBackupRestoreHandler's notifyFinish + */ +void FmOperationService::on_backupRestore_notifyFinish() +{ + mOperationResultProcesser->onNotifyFinish( mCurrentOperation ); + emit notifyFinish( mCurrentOperation ); + resetOperation(); +} + +/* + * Responds to mBackupRestoreHandler's notifyError + * \a error the error id. + * \a errString the error string. + */ +void FmOperationService::on_backupRestore_notifyError(int error, const QString &errString ) +{ + mOperationResultProcesser->onNotifyError( + mCurrentOperation, error, errString ); + emit notifyError( mCurrentOperation, error, errString ); + resetOperation(); +} + +/* + * Responds to mBackupRestoreHandler's notifyCanceled + */ +void FmOperationService::on_backupRestore_notifyCanceled() +{ + mOperationResultProcesser->onNotifyError( + mCurrentOperation, FmErrCancel, QString() ); + emit notifyError( mCurrentOperation, FmErrCancel, QString() ); + resetOperation(); +} + +/// +///////////////////////////////////////////////////// diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationservice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationservice.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,135 @@ +/* + * 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: + * The header file of the operation service of file manager + */ + +#ifndef FMOPERATIONSERVICE_H +#define FMOPERATIONSERVICE_H +#include +#include "fmutils.h" +#include "fmcommon.h" + +#include +#include + +class FmOperationThread; +class FmOperationFormat; +class FmOperationBase; + +class FmBackupRestoreHandler; +class FmDriveDetailsSize; +class FmOperationResultProcesser; + +class FmOperationService : public QObject +{ + Q_OBJECT +public: + + enum TOperationType + { + EOperationTypeNone, + EOperationTypeCopy, + EOperationTypeRemove, + EOperationTypeMove, + EOperationTypeFormat, + EOperationTypeBackup, + EOperationTypeRestore, + EOperationTypeDriveDetails, + EOperationTypeFolderDetails + }; + +public: + explicit FmOperationService( QObject *parent ); + ~FmOperationService(); + + //return error if any path exist. + //renturn error if list count is not as the same the other. + int asyncCopy( const QStringList &sourceList, const QString &targetPath ); + + int asyncMove( const QStringList &sourceList, const QString &targetPath ); + + int asyncRemove( const QStringList &pathList ); + + //return error if can not be format. + //notify error while format error. + int asyncFormat( const QString &driverName ); + int asyncViewDriveDetails( const QString &driverName ); + int asyncViewFolderDetails( const QString &folderPath ); + int asyncBackup(); + int asyncRestore( quint64 selection ); + + void cancelOperation(); + + + int syncSetVolume( const QString &driverName, const QString &volume ); + int syncSetdDriverPassword( const QString &driverName, + const QString &oldPassword, const QString &newPassword ); + int syncRename( const QString &oldPath, const QString &newName ); + int syncLaunchFileOpen( const QString &filePath ); + int syncDeleteBackup( quint64 selection ); + + FmBackupRestoreHandler *backupRestoreHandler(); + bool isRunning(); + +public slots: + void on_backupRestore_notifyPreparing( bool cancelable ); + void on_backupRestore_notifyStart( bool cancelable, int maxSteps ); + void on_backupRestore_notifyProgress( int currentStep ); + void on_backupRestore_notifyFinish(); + void on_backupRestore_notifyError(int error, const QString &errString ); + void on_backupRestore_notifyCanceled(); + void on_operation_askForRename( const QString &srcFile, QString *destFile ); + void on_operation_askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ); + void on_operation_showNote( const char *noteString ); + void on_operation_notifyWaiting( bool cancelable ); + void on_operation_notifyPreparing( bool cancelable ); + void on_operation_notifyStart( bool cancelable, int maxSteps ); + void on_operation_notifyProgress( int currentStep ); + void on_operation_notifyFinish(); + void on_operation_notifyError(int error, QString errString ); + void on_operation_driveSpaceChanged(); + +signals: + + void driveSpaceChanged( FmOperationBase* operationBase ); + + void notifyWaiting( FmOperationBase* operationBase, bool cancelable ); + void notifyPreparing( FmOperationBase* operationBase, bool cancelable ); // this step could not be used if not needed. + void notifyStart( FmOperationBase* operationBase, bool cancelable, int maxSteps ); + void notifyProgress( FmOperationBase* operationBase, int currentStep ); + + void notifyFinish( FmOperationBase* operationBase ); + void notifyError( FmOperationBase* operationBase, int error, QString errString ); + void notifyCanceled( FmOperationBase* operationBase ); + +private: + void resetOperation(); + void connectSignalsAndSlots( FmOperationBase *operation ); + +private: + FmOperationThread *mThread; + FmBackupRestoreHandler *mBackupRestoreHandler; + FmOperationBase* mCurrentOperation; + FmOperationResultProcesser *mOperationResultProcesser; + +}; + + + + + +#endif + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationthread.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationthread.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,75 @@ +/* +* 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: +* The source file of the operation thread of file manager +* +*/ + +#include "fmoperationthread.h" +#include "fmbackuprestorehandler.h" + +#include +#include + +/* + * Constructs the operation thread with \a parent. + */ +FmOperationThread::FmOperationThread( QObject *parent ) : QThread( parent ), + mStop( false), mOperationBase( 0 ) +{ + setPriority( LowestPriority ); +} + +/* + * Destructs the operation thread. + */ +FmOperationThread::~FmOperationThread() +{ +} + +/* + * Prepare some conditions before starts the operation. + * Returns the error id. + * \a operationBase the operation to be prepared. + */ +int FmOperationThread::prepareOperationAndStart( FmOperationBase* operationBase ) +{ + if ( isRunning() ) { + return FmErrAlreadyStarted; + } + mOperationBase = operationBase; + int ret = mOperationBase->prepare(); + if ( ret == FmErrNone ) { + mStop = false; + start(); + } + return ret; +} + +/* Stops the current thread. + * Caused by user interaction. + */ +void FmOperationThread::stop() +{ + mStop = true; +} + +/* + * reimp + */ +void FmOperationThread::run() +{ + mOperationBase->start( &mStop ); +} + diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationthread.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationthread.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,48 @@ +/* +* 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: +* The header file of the operation thread of file manager +* +*/ + +#ifndef FMOPERATIONTHREAD_H +#define FMOPERATIONTHREAD_H + +#include "fmoperationbase.h" +#include "fmcommon.h" + +#include +#include + +#include + +class FmOperationThread : public QThread +{ + Q_OBJECT +public: + FmOperationThread( QObject *parent ); + ~FmOperationThread(); + int prepareOperationAndStart( FmOperationBase* operationBase ); + void stop(); + +protected: + void run(); + +private: + volatile bool mStop; + FmOperationBase* mOperationBase; + QString mErrString; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationviewdetails.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationviewdetails.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,143 @@ +/* +* 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: +* The source file of the operation param of file manager +* +*/ + +#include "fmoperationviewdetails.h" +#include "fmdrivedetailstype.h" +#include + +/* + * Constructs one view drive details operation with + * \a parent parent. + * \a driverName the drive name. + */ +FmOperationDriveDetails::FmOperationDriveDetails( QObject *parent, const QString &driverName ) : + FmOperationBase( parent, FmOperationService::EOperationTypeDriveDetails ), + mDriverName( driverName ), mStop( 0 ) +{ +} + +/* + * Destructs the operation. + */ +FmOperationDriveDetails::~FmOperationDriveDetails() +{ + qDeleteAll(mDetailsSizeList); +} + +/* + * Returns the drive name. + */ +QString FmOperationDriveDetails::driverName() +{ + return mDriverName; +} + +/* + * reimp. + */ +void FmOperationDriveDetails::start( volatile bool *isStopped ) +{ + mStop = isStopped; + emit notifyWaiting( true ); + //FmOperationDriveDetails *operationDriverDetails = static_cast( mOperationBase ); + int ret = FmDriveDetailsContent::querySizeofContent( driverName(), detailsSizeList(), mStop ); + if( ret == FmErrNone ) { + emit notifyFinish(); + } else { + emit notifyError( ret, QString() ); + } +} + +/* + * Returns detail items size list. + */ +QList &FmOperationDriveDetails::detailsSizeList() +{ + return mDetailsSizeList; +} + +/* + * Constructs one view folder details operation with + * \a parent parent. + * \a driverName the drive name. + */ +FmOperationFolderDetails::FmOperationFolderDetails( QObject *parent, const QString &folderPath ) : + FmOperationBase( parent, FmOperationService::EOperationTypeFolderDetails ), + mFolderPath( folderPath ), + mNumofSubFolders( 0 ), + mNumofFiles( 0 ), + mSizeofFolder( 0 ) + +{ +} + +/* + * Destructs the operation. + */ +FmOperationFolderDetails::~FmOperationFolderDetails() +{ + +} + +/* + * Returns the folder path. + */ +QString FmOperationFolderDetails::folderPath() +{ + return mFolderPath; +} + +/* + * Returns the number of sub folders. + */ +int &FmOperationFolderDetails::numofSubFolders() +{ + return mNumofSubFolders; +} + +/* + * Returns the number of files + */ +int &FmOperationFolderDetails::numofFiles() +{ + return mNumofFiles; +} + +/* + * Returns the size of folder. + */ +quint64 &FmOperationFolderDetails::sizeofFolder() +{ + return mSizeofFolder; +} + +/* + * Reimp. + */ +void FmOperationFolderDetails::start( volatile bool *isStopped ) +{ + mStop = isStopped; + emit notifyWaiting( true ); + int ret = FmFolderDetails::getNumofSubfolders( folderPath(), numofSubFolders(), + numofFiles(), sizeofFolder(), mStop ); + if( ret == FmErrNone ) { + emit notifyFinish(); + } else { + emit notifyError( ret, QString() ); + } +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/filemanager/src/operationservice/fmoperationviewdetails.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationviewdetails.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,64 @@ +/* +* 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: +* The header file of the operation param of file manager +* +*/ + +#ifndef FMOPERATIONVIEWDETAILS_H +#define FMOPERATIONVIEWDETAILS_H + +#include "fmoperationservice.h" +#include "fmoperationbase.h" + +#include +#include + +class FmOperationDriveDetails : public FmOperationBase +{ +public: + explicit FmOperationDriveDetails( QObject *parent, const QString &driverName ); + + virtual ~FmOperationDriveDetails(); + QString driverName(); + virtual void start( volatile bool *isStopped ); + QList &detailsSizeList(); + +private: + QString mDriverName; + QList mDetailsSizeList; + volatile bool *mStop; +}; + +class FmOperationFolderDetails : public FmOperationBase +{ +public: + explicit FmOperationFolderDetails( QObject *parent, const QString &folderPath ); + + virtual ~FmOperationFolderDetails(); + virtual void start( volatile bool *isStopped ); + + QString folderPath(); + int &numofSubFolders(); + int &numofFiles(); + quint64 &sizeofFolder(); + +private: + QString mFolderPath; + int mNumofSubFolders; + int mNumofFiles; + quint64 mSizeofFolder; + volatile bool *mStop; +}; +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/bwins/fmbkupengineu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/bwins/fmbkupengineu.def Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,37 @@ +EXPORTS + ?Category@CMMCScBkupArchiveInfo@@QBE?AV?$TBitFlagsT@K@@XZ @ 1 NONAME ; class TBitFlagsT CMMCScBkupArchiveInfo::Category(void) const + ?CancelOperation@CMMCScBkupEngine@@QAEXXZ @ 2 NONAME ; void CMMCScBkupEngine::CancelOperation(void) + ?PackageTransferType@CMMCScBkupOpParamsRestoreFull@@UBE?AW4TPackageDataType@conn@@XZ @ 3 NONAME ; enum conn::TPackageDataType CMMCScBkupOpParamsRestoreFull::PackageTransferType(void) const + ?PassiveTransferType@CMMCScBkupOpParamsRestoreFull@@UBE?AW4TTransferDataType@conn@@XZ @ 4 NONAME ; enum conn::TTransferDataType CMMCScBkupOpParamsRestoreFull::PassiveTransferType(void) const + ??1CMMCScBkupEngine@@UAE@XZ @ 5 NONAME ; CMMCScBkupEngine::~CMMCScBkupEngine(void) + ?NewL@CMMCScBkupEngine@@SAPAV1@AAVRFs@@@Z @ 6 NONAME ; class CMMCScBkupEngine * CMMCScBkupEngine::NewL(class RFs &) + ?TotalOperationSizeL@CMMCScBkupEngine@@QBE_JXZ @ 7 NONAME ; long long CMMCScBkupEngine::TotalOperationSizeL(void) const + ?StartOperationL@CMMCScBkupEngine@@QAEXW4TMMCScBkupOperationType@@AAVMMMCScBkupEngineObserver@@PAVCMMCScBkupOpParamsBase@@@Z @ 8 NONAME ; void CMMCScBkupEngine::StartOperationL(enum TMMCScBkupOperationType, class MMMCScBkupEngineObserver &, class CMMCScBkupOpParamsBase *) + ?IncrementType@CMMCScBkupOpParamsBackupFull@@UBE?AW4TBackupIncType@conn@@XZ @ 9 NONAME ; enum conn::TBackupIncType CMMCScBkupOpParamsBackupFull::IncrementType(void) const + ?Close@RMMCScBkupArchiveBuf@@QAEXXZ @ 10 NONAME ; void RMMCScBkupArchiveBuf::Close(void) + ?PartType@CMMCScBkupOpParamsRestoreFull@@UBE?AW4TBURPartType@conn@@XZ @ 11 NONAME ; enum conn::TBURPartType CMMCScBkupOpParamsRestoreFull::PartType(void) const + ??1CMMCScBkupOpParamsRestoreFull@@UAE@XZ @ 12 NONAME ; CMMCScBkupOpParamsRestoreFull::~CMMCScBkupOpParamsRestoreFull(void) + ?NewL@CMMCScBkupOpParamsRestoreFull@@SAPAV1@PAV?$CArrayFixFlat@VTBkupDrivesAndOperation@@@@V?$TBitFlagsT@K@@@Z @ 13 NONAME ; class CMMCScBkupOpParamsRestoreFull * CMMCScBkupOpParamsRestoreFull::NewL(class CArrayFixFlat *, class TBitFlagsT) + ?ActiveTransferType@CMMCScBkupOpParamsRestoreFull@@UBE?AW4TTransferDataType@conn@@XZ @ 14 NONAME ; enum conn::TTransferDataType CMMCScBkupOpParamsRestoreFull::ActiveTransferType(void) const + ?ListArchivesL@CMMCScBkupEngine@@QBEXAAV?$RPointerArray@VCMMCScBkupArchiveInfo@@@@PAVCMMCScBkupOpParamsBase@@KH@Z @ 15 NONAME ; void CMMCScBkupEngine::ListArchivesL(class RPointerArray &, class CMMCScBkupOpParamsBase *, unsigned long, int) const + ?ActiveTransferType@CMMCScBkupOpParamsBackupFull@@UBE?AW4TTransferDataType@conn@@XZ @ 16 NONAME ; enum conn::TTransferDataType CMMCScBkupOpParamsBackupFull::ActiveTransferType(void) const + ?NewL@CMMCScBkupDriveAndOperationTypeManager@@SAPAV1@PAV?$CArrayFixFlat@VTBkupDrivesAndOperation@@@@@Z @ 17 NONAME ; class CMMCScBkupDriveAndOperationTypeManager * CMMCScBkupDriveAndOperationTypeManager::NewL(class CArrayFixFlat *) + ?AssociatedOpType@CMMCScBkupOpParamsRestoreFull@@UBE?AW4TMMCScBkupOperationType@@XZ @ 18 NONAME ; enum TMMCScBkupOperationType CMMCScBkupOpParamsRestoreFull::AssociatedOpType(void) const + ?SetArchiveInfosL@CMMCScBkupOpParamsBase@@QAEXAAV?$RPointerArray@VCMMCScBkupArchiveInfo@@@@@Z @ 19 NONAME ; void CMMCScBkupOpParamsBase::SetArchiveInfosL(class RPointerArray &) + ?IncrementType@CMMCScBkupOpParamsRestoreFull@@UBE?AW4TBackupIncType@conn@@XZ @ 20 NONAME ; enum conn::TBackupIncType CMMCScBkupOpParamsRestoreFull::IncrementType(void) const + ??1CMMCScBkupOpParamsBackupFull@@UAE@XZ @ 21 NONAME ; CMMCScBkupOpParamsBackupFull::~CMMCScBkupOpParamsBackupFull(void) + ?PackageTransferType@CMMCScBkupOpParamsBackupFull@@UBE?AW4TPackageDataType@conn@@XZ @ 22 NONAME ; enum conn::TPackageDataType CMMCScBkupOpParamsBackupFull::PackageTransferType(void) const + ?PartType@CMMCScBkupOpParamsBackupFull@@UBE?AW4TBURPartType@conn@@XZ @ 23 NONAME ; enum conn::TBURPartType CMMCScBkupOpParamsBackupFull::PartType(void) const + ??1CMMCScBkupDriveAndOperationTypeManager@@UAE@XZ @ 24 NONAME ; CMMCScBkupDriveAndOperationTypeManager::~CMMCScBkupDriveAndOperationTypeManager(void) + ?DriveAndOperations@CMMCScBkupOpParamsBase@@QBEABVCMMCScBkupDriveAndOperationTypeManager@@XZ @ 25 NONAME ; class CMMCScBkupDriveAndOperationTypeManager const & CMMCScBkupOpParamsBase::DriveAndOperations(void) const + ?ValidArchiveForRestore@CMMCScBkupEngine@@QAEHABVTDesC16@@@Z @ 26 NONAME ; int CMMCScBkupEngine::ValidArchiveForRestore(class TDesC16 const &) + ?FileName@CMMCScBkupArchiveInfo@@QBEABVTDesC16@@XZ @ 27 NONAME ; class TDesC16 const & CMMCScBkupArchiveInfo::FileName(void) const + ?NewL@CMMCScBkupOpParamsBackupFull@@SAPAV1@PAV?$CArrayFixFlat@VTBkupDrivesAndOperation@@@@PAV?$RPointerArray@VCBkupCategory@@@@W4TDriveNumber@@V?$TBitFlagsT@K@@@Z @ 28 NONAME ; class CMMCScBkupOpParamsBackupFull * CMMCScBkupOpParamsBackupFull::NewL(class CArrayFixFlat *, class RPointerArray *, enum TDriveNumber, class TBitFlagsT) + ?PassiveTransferType@CMMCScBkupOpParamsBackupFull@@UBE?AW4TTransferDataType@conn@@XZ @ 29 NONAME ; enum conn::TTransferDataType CMMCScBkupOpParamsBackupFull::PassiveTransferType(void) const + ?DateTime@CMMCScBkupArchiveInfo@@QBEABVTTime@@XZ @ 30 NONAME ; class TTime const & CMMCScBkupArchiveInfo::DateTime(void) const + ??1CMMCScBkupOpParamsBase@@UAE@XZ @ 31 NONAME ; CMMCScBkupOpParamsBase::~CMMCScBkupOpParamsBase(void) + ?AssociatedOpType@CMMCScBkupOpParamsBackupFull@@UBE?AW4TMMCScBkupOperationType@@XZ @ 32 NONAME ; enum TMMCScBkupOperationType CMMCScBkupOpParamsBackupFull::AssociatedOpType(void) const + ?Drive@CMMCScBkupArchiveInfo@@QBE?AW4TDriveNumber@@XZ @ 33 NONAME ; enum TDriveNumber CMMCScBkupArchiveInfo::Drive(void) const + ?RebootRequired@CMMCScBkupEngine@@QBEHXZ @ 34 NONAME ; int CMMCScBkupEngine::RebootRequired(void) const + ?DeleteArchivesL@CMMCScBkupEngine@@QBEHAAV?$RPointerArray@VCMMCScBkupArchiveInfo@@@@@Z @ 35 NONAME ; int CMMCScBkupEngine::DeleteArchivesL(class RPointerArray &) const + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/eabi/fmbkupengineu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/eabi/fmbkupengineu.def Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,53 @@ +EXPORTS + _ZN16CMMCScBkupEngine15CancelOperationEv @ 1 NONAME + _ZN16CMMCScBkupEngine15StartOperationLE23TMMCScBkupOperationTypeR24MMMCScBkupEngineObserverP22CMMCScBkupOpParamsBase @ 2 NONAME + _ZN16CMMCScBkupEngine22ValidArchiveForRestoreERK7TDesC16 @ 3 NONAME + _ZN16CMMCScBkupEngine4NewLER3RFs @ 4 NONAME + _ZN16CMMCScBkupEngineD0Ev @ 5 NONAME + _ZN16CMMCScBkupEngineD1Ev @ 6 NONAME + _ZN16CMMCScBkupEngineD2Ev @ 7 NONAME + _ZN20RMMCScBkupArchiveBuf5CloseEv @ 8 NONAME + _ZN22CMMCScBkupOpParamsBase16SetArchiveInfosLER13RPointerArrayI21CMMCScBkupArchiveInfoE @ 9 NONAME + _ZN22CMMCScBkupOpParamsBaseD0Ev @ 10 NONAME + _ZN22CMMCScBkupOpParamsBaseD1Ev @ 11 NONAME + _ZN22CMMCScBkupOpParamsBaseD2Ev @ 12 NONAME + _ZN28CMMCScBkupOpParamsBackupFull4NewLEP13CArrayFixFlatI23TBkupDrivesAndOperationEP13RPointerArrayI13CBkupCategoryE12TDriveNumber10TBitFlagsTImE @ 13 NONAME + _ZN28CMMCScBkupOpParamsBackupFullD0Ev @ 14 NONAME + _ZN28CMMCScBkupOpParamsBackupFullD1Ev @ 15 NONAME + _ZN28CMMCScBkupOpParamsBackupFullD2Ev @ 16 NONAME + _ZN29CMMCScBkupOpParamsRestoreFull4NewLEP13CArrayFixFlatI23TBkupDrivesAndOperationE10TBitFlagsTImE @ 17 NONAME + _ZN29CMMCScBkupOpParamsRestoreFullD0Ev @ 18 NONAME + _ZN29CMMCScBkupOpParamsRestoreFullD1Ev @ 19 NONAME + _ZN29CMMCScBkupOpParamsRestoreFullD2Ev @ 20 NONAME + _ZN38CMMCScBkupDriveAndOperationTypeManager4NewLEP13CArrayFixFlatI23TBkupDrivesAndOperationE @ 21 NONAME + _ZN38CMMCScBkupDriveAndOperationTypeManagerD0Ev @ 22 NONAME + _ZN38CMMCScBkupDriveAndOperationTypeManagerD1Ev @ 23 NONAME + _ZN38CMMCScBkupDriveAndOperationTypeManagerD2Ev @ 24 NONAME + _ZNK16CMMCScBkupEngine13ListArchivesLER13RPointerArrayI21CMMCScBkupArchiveInfoEP22CMMCScBkupOpParamsBasemi @ 25 NONAME + _ZNK16CMMCScBkupEngine14RebootRequiredEv @ 26 NONAME + _ZNK16CMMCScBkupEngine19TotalOperationSizeLEv @ 27 NONAME + _ZNK21CMMCScBkupArchiveInfo5DriveEv @ 28 NONAME + _ZNK21CMMCScBkupArchiveInfo8CategoryEv @ 29 NONAME + _ZNK21CMMCScBkupArchiveInfo8DateTimeEv @ 30 NONAME + _ZNK21CMMCScBkupArchiveInfo8FileNameEv @ 31 NONAME + _ZNK22CMMCScBkupOpParamsBase18DriveAndOperationsEv @ 32 NONAME + _ZNK28CMMCScBkupOpParamsBackupFull13IncrementTypeEv @ 33 NONAME + _ZNK28CMMCScBkupOpParamsBackupFull16AssociatedOpTypeEv @ 34 NONAME + _ZNK28CMMCScBkupOpParamsBackupFull18ActiveTransferTypeEv @ 35 NONAME + _ZNK28CMMCScBkupOpParamsBackupFull19PackageTransferTypeEv @ 36 NONAME + _ZNK28CMMCScBkupOpParamsBackupFull19PassiveTransferTypeEv @ 37 NONAME + _ZNK28CMMCScBkupOpParamsBackupFull8PartTypeEv @ 38 NONAME + _ZNK29CMMCScBkupOpParamsRestoreFull13IncrementTypeEv @ 39 NONAME + _ZNK29CMMCScBkupOpParamsRestoreFull16AssociatedOpTypeEv @ 40 NONAME + _ZNK29CMMCScBkupOpParamsRestoreFull18ActiveTransferTypeEv @ 41 NONAME + _ZNK29CMMCScBkupOpParamsRestoreFull19PackageTransferTypeEv @ 42 NONAME + _ZNK29CMMCScBkupOpParamsRestoreFull19PassiveTransferTypeEv @ 43 NONAME + _ZNK29CMMCScBkupOpParamsRestoreFull8PartTypeEv @ 44 NONAME + _ZTI22CMMCScBkupDataStrategy @ 45 NONAME + _ZTI37CMMCScBkupStateRequestSizeOfDataOwner @ 46 NONAME + _ZTI44CMMCScBkupStateRequestSpecificPublicFileInfo @ 47 NONAME + _ZTV22CMMCScBkupDataStrategy @ 48 NONAME + _ZTV37CMMCScBkupStateRequestSizeOfDataOwner @ 49 NONAME + _ZTV44CMMCScBkupStateRequestSpecificPublicFileInfo @ 50 NONAME + _ZNK16CMMCScBkupEngine15DeleteArchivesLER13RPointerArrayI21CMMCScBkupArchiveInfoE @ 51 NONAME + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/group/bld.inf Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2005 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: bld file +* +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_MMPFILES + +fmbkupengine.mmp diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/group/fmbkupengine.mmh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/group/fmbkupengine.mmh Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,72 @@ +/* +* 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 header file for project FileManagerBkupEngine +* +*/ + +SOURCE CMMCScBkupArchive.cpp +SOURCE CMMCScBkupArchiveDataManager.cpp +SOURCE CMMCScBkupArchiveFooter.cpp +SOURCE CMMCScBkupArchiveHeader.cpp +SOURCE CMMCScBkupArchiveInfo.cpp +SOURCE CMMCScBkupBufferManagers.cpp +SOURCE CMMCScBkupDataOwnerCollection.cpp +SOURCE CMMCScBkupDataOwnerInfo.cpp +SOURCE CMMCScBkupDataStrategies.cpp +SOURCE CMMCScBkupDriveSpecificRequest.cpp +SOURCE CMMCScBkupEngine.cpp +SOURCE CMMCScBkupEngineImpl.cpp +SOURCE CMMCScBkupFileInfo.cpp +SOURCE CMMCScBkupFileListCollection.cpp +SOURCE CMMCScBkupIndexBase.cpp +SOURCE CMMCScBkupIndexDataOwners.cpp +SOURCE CMMCScBkupIndexActiveData.cpp +SOURCE CMMCScBkupIndexPassiveData.cpp +SOURCE CMMCScBkupIndexPublicDataFiles.cpp +SOURCE CMMCScBkupIndexJavaData.cpp +SOURCE CMMCScBkupIndexSystemData.cpp +SOURCE CMMCScBkupIndexWithIdentifier.cpp +SOURCE CMMCScBkupOperationParameters.cpp +SOURCE CMMCScBkupState.cpp +SOURCE CMMCScBkupStateArchiveOpActiveData.cpp +SOURCE CMMCScBkupStateArchiveOpArchiveFooter.cpp +SOURCE CMMCScBkupStateArchiveOpArchiveHeader.cpp +SOURCE CMMCScBkupStateArchiveOpDataOwners.cpp +SOURCE CMMCScBkupStateArchiveOpPassiveData.cpp +SOURCE CMMCScBkupStateArchiveOpPublicDataFiles.cpp +SOURCE CMMCScBkupStateArchiveOpSystemData.cpp +SOURCE CMMCScBkupStateArchiveOpJavaData.cpp +SOURCE CMMCScBkupStateFactory.cpp +SOURCE CMMCScBkupStateGetDataOwners.cpp +SOURCE CMMCScBkupStateGetDataOwnerStatuses.cpp +SOURCE CMMCScBkupStateOpAware.cpp +SOURCE CMMCScBkupStateRequestListOfPublicFiles.cpp +SOURCE CMMCScBkupStateRequestSizeOfBackupData.cpp +SOURCE CMMCScBkupStateSetPhoneMode.cpp +SOURCE CMMCScBkupStateNotifyAllSnapshotsSupplied.cpp +SOURCE CMMCScBkupStateValidateDiskSpace.cpp +SOURCE CMMCScBkupTransferReadRequest.cpp +SOURCE CMMCScBkupTransferRequest.cpp +SOURCE CMMCScBkupTransferWriteRequest.cpp +SOURCE CMMCScBkupDriveAndOperationTypeManager.cpp +SOURCE CMMCScBkupDriveDataSizeManager.cpp +SOURCE MMCScBkupArchiveUtils.cpp +SOURCE MMCScBkupPhoneModelUtils.cpp +SOURCE MMCScBkupSBEUtils.cpp +SOURCE MMCScBkupLogger.cpp +SOURCE RMMCScBkupArchiveStreams.cpp +SOURCE RMMCScBkupProgressSizer.cpp +SOURCE TMMCScBkupArchiveVector.cpp +SOURCE TMMCScBkupDriveFilter.cpp +SOURCE TMMCScBkupDriveAndSize.cpp diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/group/fmbkupengine.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/group/fmbkupengine.mmp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,51 @@ +/* +* 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 FileManagerBkupEngine +* +*/ + + +#include +#include "../inc/MMCScBkupDllUids.h" +MACRO _F32_STRICT_64_BIT_MIGRATION + +TARGET fmbkupengine.dll +TARGETTYPE dll +UID KEPOCDLLUID2 KMMCAppEngUID3 +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL DiskAdmin AllFiles PowerMgmt + +SOURCEPATH ../src +#include "fmbkupengine.mmh" + +USERINCLUDE ../inc + +APP_LAYER_SYSTEMINCLUDE +//SYSTEMINCLUDE /epoc32/include/connect + +LIBRARY sbeclient.lib +LIBRARY euser.lib +LIBRARY ezlib.lib +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY sysutil.lib +LIBRARY commonengine.lib +LIBRARY featmgr.lib +LIBRARY estor.lib +LIBRARY centralrepository.lib +LIBRARY platformenv.lib +LIBRARY cone.lib + + +// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/BKupEngine.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/BKupEngine.rh Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2002-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: +* This file contains declarations for resources. +* The file can be included only in resource file. +* +* +*/ + + +// INCLUDES +#include + +// STRUCTURE DEFINITIONS + +// --------------------------------------------------------- +// BACKUPITEM +// Defines a file or folder to be backed up +// Note! Remember to use a trailing backslash! +// --------------------------------------------------------- +// +STRUCT BACKUPITEM + { + LTEXT item_path; + WORD item_flags; + } + + + +// --------------------------------------------------------- +// MMC_SECURE_BACKUP_DRIVE_LIST +// +// Defines an array of drive numbers, starting at 0 +// (EDriveA), to a maximum of 25 (EDriveZ) +// which are included in a backup/restore to/from MMC +// operation +// +// See TMMCDriveNumber and TBkupDriveCategory (BkupEngine.hrh) +// See TMMCScBkupOwnerDataType in TMMCScBkupOwnerDataType.hrh +// --------------------------------------------------------- +// +STRUCT MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE + { + BYTE drive; // See TMMCDriveNumber and TBkupDriveCategory (BkupEngine.hrh) + BYTE type; // See TMMCScBkupOwnerDataType (TMMCScBkupOwnerDataType.h) + } + + + +// --------------------------------------------------------- +// MMC_SECURE_BACKUP_DRIVES_AND_OPERATIONS +// +// Defines an array of drive numbers and operations. +// The drive starts at 0 (EDriveA), to a maximum of 25 (EDriveZ) +// which are included in a backup/restore to/from MMC +// operation. Each drive should include a number of associated +// operations. For example, for drive C:\ we wish to carry +// out all SBE backup/restore ops. For MMC we wish to only +// back up & restore package data (Required to ensure that +// hashes for MMC-based binaries are recreated on C:\ after +// the internal drive is formatted & a restore is performed). +// +// --------------------------------------------------------- +// +STRUCT MMC_SECURE_BACKUP_DRIVES_AND_OPERATIONS + { + LEN BYTE STRUCT drivesAndOperations[]; // SEE MMC_SECURE_BACKUP_DRIVE_AND_OPERATION_TYPE + } + +// --------------------------------------------------------- +// BACKUPCATEGORY +// Defines a category, name for archive and uids, +// from which backup category consists of +// --------------------------------------------------------- +// +STRUCT BACKUPCATEGORY + { + LONG category; + LTEXT archive_name; + LONG special_flags; + LONG exclude_special_flags; + LONG uids[]; + LONG exclude_uids[]; + } + + +// --------------------------------------------------------- +// BACKUPCATEGORY +// Defines a category, name for archive and uids, +// from which backup category consists of +// --------------------------------------------------------- +// +STRUCT BACKUPCATEGORYARRAY + { + STRUCT backupcategory[]; + } + +// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/BkupEngine.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/BkupEngine.hrh Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2004-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: +* FileManager / FileManagerBkupEngine constants. +* +*/ + + + +#ifndef __BAENGINE_HRH__ +#define __BAENGINE_HRH__ + +// Partial backup categories bitmask values +enum MAEngineBackupCategories + { + EBUCatSettings = 0x1, + EBUCatMessages = 0x2, + EBUCatContacts = 0x4, + EBUCatCalendar = 0x8, + EBUCatBookmarks = 0x10, + EBUCatUserFiles = 0x20, + EBUCatAllInOne = 0x8000000, + EBUCatAllSeparately = 0x7FFFFFF + // Set as 0xFFFFFFF (EBUCatAllInOne+EBUCatAllSeparately) if archive containing + // data from all data owners needs to be created. + }; + +// Bitmask values for special ruling of which category data owner belongs to +#define EBUCatSpecNone 0x0 +#define EBUCatSpecSystem 0x1 +#define EBUCatSpecJava 0x2 +#define EBUCatSpecPublic 0x4 +#define EBUCatSpecAll 0x8 + +#ifndef RD_MULTIPLE_DRIVE + +// Drive list enumeration - see TDriveNumber +// (these must match F32's TDriveNumber exactly) +enum TMMCDriveNumber + { + EMMCDriveNumberA = 0, + EMMCDriveNumberB, + EMMCDriveNumberC, + EMMCDriveNumberD, + EMMCDriveNumberE, + EMMCDriveNumberF, + EMMCDriveNumberG, + EMMCDriveNumberH, + EMMCDriveNumberI, + EMMCDriveNumberJ, + EMMCDriveNumberK, + EMMCDriveNumberL, + EMMCDriveNumberM, + EMMCDriveNumberN, + EMMCDriveNumberO, + EMMCDriveNumberP, + EMMCDriveNumberQ, + EMMCDriveNumberR, + EMMCDriveNumberS, + EMMCDriveNumberT, + EMMCDriveNumberU, + EMMCDriveNumberV, + EMMCDriveNumberW, + EMMCDriveNumberX, + EMMCDriveNumberY, + EMMCDriveNumberZ + }; + +#else // RD_MULTIPLE_DRIVE + +// Defines drive caterories for multiple drives to setup backup sources and restore targets +#define EBkupDeviceMemories 0x1 +#define EBkupInternalMassStorages 0x2 +#define EBkupExternalMassStorages 0x4 + +#endif // RD_MULTIPLE_DRIVE + +#endif // __BAENGINE_HRH__ + +// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupArchive.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupArchive.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CMMCScBkupArchive +* +* +*/ + +#ifndef __CMMCSCBKUPARCHIVE_H__ +#define __CMMCSCBKUPARCHIVE_H__ + +// System includes +#include +#include + +// Classes referenced +class MMMCScBkupDriver; +class CMMCScBkupArchiveHeader; +class CMMCScBkupArchiveFooter; +class MMMCScBkupProgressObserver; +class CMMCScBkupArchiveDataManager; +class MMMCScBkupArchiveDataInterface; + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupArchive) : public CBase + { + public: + + /** + * Static constructor + */ + static CMMCScBkupArchive* NewL( RFs& aFsSession, MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupDriver& aDriver, TBitFlags aCategory ); + + /** + * C++ destructor + */ + ~CMMCScBkupArchive(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupArchive( RFs& aFsSession, MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupDriver& aDriver, TBitFlags aCategory ); + + /** + * + */ + void ConstructL(); + + public: // API + + /** + * + */ + void OpenForReadingL(const TDesC& aName); + + /** + * + */ + void OpenForWritingL(const TDesC& aName); + + /** + * + */ + void RestoreOldArchive(); + + /** + * + */ + void DeleteOldArchive(); + + /** + * + */ + void Close( TInt aError ); + + /** + * + */ + CMMCScBkupArchiveHeader& Header() const; + + /** + * + */ + CMMCScBkupArchiveFooter& Footer() const; + + /** + * + */ + MMMCScBkupArchiveDataInterface& ADI() const; + + /** + * + */ + static TBool ValidArchiveForRestoreL( RFs& aFsSession, const TDesC& aFileName ); + + /** + * + */ + TBitFlags Category() const { return iCategory; } + + private: // Internal enumerations + + /** + * + */ + enum TMode + { + EModeUninitialised = 0, + // + EModeReading, + EModeWriting + }; + + private: // Internal methods + + /** + * + */ + TInt PrepareToOverwrite( const TDesC& aFile ); + + /** + * + */ + void SetMode(TMode aMode); + + /** + * + */ + void PrepareObjectsL(); + + /** + * + */ + inline TMode Mode() const { return iMode; } + + private: // Member data + + // + RFs& iFsSession; + // + RFile64 iArchiveFile; + // + MMMCScBkupProgressObserver& iProgressManager; + // + MMMCScBkupDriver& iDriver; + // + TMode iMode; + // + CMMCScBkupArchiveDataManager* iDataManager; + // + CMMCScBkupArchiveHeader* iHeader; + // + CMMCScBkupArchiveFooter* iFooter; + // + HBufC* iArchiveFileName; + // + HBufC* iOldArchiveFileName; + // + TBitFlags iCategory; + }; + + + + +#endif // __CMMCSCBKUPARCHIVE_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupArchiveDataManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupArchiveDataManager.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2005 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: Declaration of CMMCScBkupArchiveDataManager +* +* +*/ + +#ifndef __CMMCSCBKUPARCHIVEDATAMANAGER_H__ +#define __CMMCSCBKUPARCHIVEDATAMANAGER_H__ + +// System includes +#include +#include + +// User includes +#include "CMMCScBkupBufferManagers.h" +#include "MMMCScBkupArchiveDataInterface.h" +#include "TMMCScBkupArchiveVector.h" +#include "RMMCScBkupArchiveStreams.h" +#include "MMCScBkupOperations.h" +#include "MMCScBkupConfig.h" + +// Classes referenced +class CEZCompressor; +class CEZDecompressor; +class RMMCScBkupArchiveBuf; +class MMMCScBkupProgressObserver; + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupArchiveDataManager) : public CActive, public MMMCScBkupArchiveDataInterface + { + public: + + /** + * Static constructor + */ + static CMMCScBkupArchiveDataManager* NewL( RFs& aFsSession, RFile64& aFile, MMMCScBkupProgressObserver& aProgressManager ); + + /** + * C++ destructor + */ + ~CMMCScBkupArchiveDataManager(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupArchiveDataManager( RFs& aFsSession, RFile64& aFile, MMMCScBkupProgressObserver& aProgressManager ); + + /** + * + */ + void ConstructL(); + + public: // API + + /** + * Leaves on error, returns offset + */ + TInt CurrentOffsetL() const; + + /** + * Returns error or offset + */ + TInt CurrentOffset() const; + + private: // For RMMCScBkupArchiveBuf only + + /** + * + */ + void SetCurrentVector(const TMMCScBkupArchiveVector& aInfo); + + + private: // From MMMCScBkupArchiveDataInterface + RFs& ADIFsSession() const; + RFile64& ADIRawArchiveFile() const; + // + const TMMCScBkupArchiveVector& ADICurrentArchiveVectorInfo() const; + const TMMCScBkupArchiveVector& ADIOverallArchiveVectorInfo() const; + // + RWriteStream& ADIWriteStreamUncompressedLC( TInt aPos ); + RReadStream& ADIReadStreamUncompressedLC( TInt aPos ); + // + const TMMCScBkupArchiveVector& ADIWriteL( const TDesC8& aData ); + const TMMCScBkupArchiveVector& ADIReadL( TDes8& aSink, const TMMCScBkupArchiveVector& aInfo ); + // + void ADIWriteFileL( const TDesC& aSourceFileName, TRequestStatus& aObserver ); + void ADIReadFileL( const TDesC& aDestinationFileName, const TMMCScBkupArchiveVector& aInfo, TRequestStatus& aStatus ); + // + void ADIWriteCompressedL( const TDesC8& aData, TRequestStatus& aObserver ); + void ADIReadDecompressedL( TDes8& aSink, const TMMCScBkupArchiveVector& aInfo, TRequestStatus& aStatus ) ; + // + void ADIAsynchronousCancel(); + void ADIResetResources(TMMCScBkupOperationType aType); +#ifdef RD_FILE_MANAGER_BACKUP + void ADIActivateCrcCalculation(TBool aType) { iCrcCalcActivated = aType; } + TUint32 ADIArchiveCrc() { return iCrc; } +#endif + + + private: // Internal enumerations + + /** + * + */ + enum TOperation + { + EOperationIdle = 0, + EOperationCompressing, + EOperationDecompressing + }; + + private: // Internal methods + + /** + * + */ + void EnsureCompressorExistsL(MEZBufferManager& aBufferManager); + + /** + * + */ + void EnsureDecompressorExistsL(MEZBufferManager& aBufferManager); + + /** + * + */ + void SetObserver(TRequestStatus& aStatus); + + /** + * + */ + void CompleteSelf(TInt aCompletionCode = KErrNone); + + /** + * + */ + void CompleteObserver(TInt aCompletionCode = KErrNone); + + /** + * + */ + void SetOperation(TOperation aOperation); + +#ifdef RD_FILE_MANAGER_BACKUP + /** + * + */ + void CalculateCrc( const TAny* aPtr,TInt aLength ); +#endif + + + private: // From CActive + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + + private: // Member data + + // Owned externally: + // + RFs& iFsSession; + // + RFile64& iFile; + // + MMMCScBkupProgressObserver& iProgressManager; + // + TRequestStatus* iObserverStatus; + + // Owned by this object + // + TOperation iOperation; + // + CMMCScBkupBufferManagerBase* iBufferManager; + // + CEZCompressor* iCompressor; + // + CEZDecompressor* iDecompressor; + // + TMMCScBkupArchiveVector iCurrentVectorInfo; + // + TMMCScBkupArchiveVector iOverallArchiveVectorInfo; + // + RMMCScBkupArchiveWriteStream iWriteStream; + // + RMMCScBkupArchiveReadStream iReadStream; +#ifdef RD_FILE_MANAGER_BACKUP + // + TBool iCrcCalcActivated; + // + TUint32 iCrc; +#if defined(__MMCSCBKUPLOGGING_ENABLED__) + TUint32 iTotalTickCount; +#endif +#endif // RD_FILE_MANAGER_BACKUP + + friend class RMMCScBkupArchiveBuf; + }; + + + + +#endif // __CMMCSCBKUPARCHIVEDATAMANAGER_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupArchiveFooter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupArchiveFooter.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2005 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: Declaration of CMMCScBkupArchiveFooter +* +* +*/ + +#ifndef __CMMCSCBKUPARCHIVEFOOTER_H__ +#define __CMMCSCBKUPARCHIVEFOOTER_H__ + +// System includes +#include + +// User includes +#include "CMMCScBkupIndexBase.h" +#include "RMMCScBkupPointerArray.h" +#include "TMMCScBkupDriveAndSize.h" + +// Classes referenced +class MMMCScBkupDriver; +class MMMCScBkupArchiveDataInterface; +class CMMCScBkupIndexRegistrationData; + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupArchiveFooter) : public CBase + { + public: + + /** + * Static constructor + */ + static CMMCScBkupArchiveFooter* NewL( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ); + + /** + * C++ destructor + */ + ~CMMCScBkupArchiveFooter(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupArchiveFooter( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ); + + /** + * + */ + void ConstructL(); + + public: // API + + /** + * + */ + CMMCScBkupIndexBase& IndexByType( TMMCScBkupOwnerDataType aType ); + + /** + * + */ + CMMCScBkupIndexBase* IndexByTypeOrNull( TMMCScBkupOwnerDataType aType ); + + public: // Store/Restore + + /** + * + */ + void StoreL(); + + /** + * + */ + void RestoreL( TInt aCalculatedFooterOffsetWithinArchive ); + + private: // Internal enumerations + enum + { + EStreamFormatVersion1 = 1 + }; + + private: // Member data + + // + MMMCScBkupArchiveDataInterface& iDataInterface; + // + MMMCScBkupDriver& iDriver; + // + RMMCScBkupPointerArray< CMMCScBkupIndexBase > iIndicies; + }; + + + + +#endif // __CMMCSCBKUPARCHIVEFOOTER_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupArchiveHeader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupArchiveHeader.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2005 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: Declaration of CMMCScBkupArchiveHeader +* +* +*/ + +#ifndef __CMMCSCBKUPARCHIVEHEADER_H__ +#define __CMMCSCBKUPARCHIVEHEADER_H__ + +// System includes +#include +#include + +// User includes +#include "MMCScBkupArchiveFlags.h" + +// Classes referenced +class MMMCScBkupDriver; +class MMMCScBkupArchiveDataInterface; + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupArchiveHeader) : public CBase + { + public: + + /** + * Static constructor + */ + static CMMCScBkupArchiveHeader* NewL( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ); + + /** + * C++ destructor + */ + ~CMMCScBkupArchiveHeader(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupArchiveHeader( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ); + + /** + * + */ + void ConstructL(); + + public: // API + + /** + * + */ + void StoreL(TBitFlags aCategory); + + /** + * + */ + void RestoreL(); + + public: // For Archive Utils + + /** + * + */ + inline void SetCheckedUid( const TCheckedUid& aCheckedUid ) { iCheckedUid = aCheckedUid; } + + /** + * + */ + inline const TCheckedUid& CheckedUid() const { return iCheckedUid; } + + /** + * + */ + inline void SetVersion( const TVersion& aVersion ) { iVersion = aVersion; } + + /** + * + */ + inline const TVersion& Version() const { return iVersion; } + + /** + * + */ + inline void SetFooterLength( TInt aLength ) { iFooterLength = aLength; } + + /** + * + */ + inline TInt FooterLength() const { return iFooterLength; } + + /** + * + */ + void SetPhoneModelIdentifierL( const TDesC8& aModel ); + + /** + * + */ + inline const TDesC8& PhoneModelIdentifier() const { return *iPhoneModelIdentifier; } + + /** + * + */ + inline void SetArchiveFlags( TUint32 aFlagsValue ) { iArchiveFlags.SetValue( aFlagsValue ); } + + /** + * + */ + inline const TBitFlags32& ArchiveFlags() const { return iArchiveFlags; } + + private: // Member data + + // + MMMCScBkupArchiveDataInterface& iDataInterface; + // + MMMCScBkupDriver& iDriver; + // + TCheckedUid iCheckedUid; + // + TVersion iVersion; + // + TInt iFooterLength; + // + HBufC8* iPhoneModelIdentifier; + // + TBitFlags32 iArchiveFlags; + + }; + + + + +#endif // __CMMCSCBKUPARCHIVEHEADER_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupArchiveInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupArchiveInfo.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2005 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: Declaration of CMMCScBkupArchiveInfo +* +* +*/ + +#ifndef __CMMCSCBKUPARCHIVEINFO_H__ +#define __CMMCSCBKUPARCHIVEINFO_H__ + +// System includes +#include +#include +#include + +#include "CMMCScBkupFileInfo.h" + +/** +* Class for encapsulating category specific information +* +* @since 3.2 +*/ +NONSHARABLE_CLASS(CMMCScBkupArchiveInfo) : public CBase + { + public: + + /** + * Static constructor + */ + static CMMCScBkupArchiveInfo* NewL( TResourceReader& aReader ); + + /** + * Static constructor + */ + static CMMCScBkupArchiveInfo* NewL( const TEntry& aEntry ); + + /** + * Static constructor + */ + static CMMCScBkupArchiveInfo* NewLC( const TEntry& aEntry ); + + /** + * C++ destructor + */ + ~CMMCScBkupArchiveInfo(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupArchiveInfo(); + + /** + * C++ default constructor + */ + //CMMCScBkupArchiveInfo( const TEntry& aEntry ); + + /** + * + */ + void ConstructL( const TEntry& aEntry ); + + public: // API - Setters + + /** + * + */ + void SetTargetDrive( TDriveUnit aDrive ) { iTargetDrive = aDrive; } + + /** + * + */ + void SetCategory(TBitFlags aCategories) { iCategory = aCategories; } + + /** + * + */ + void SetSpecialFlags(TBitFlags aFlags) { iSpecialFlags = aFlags; } + + /** + * + */ + void SetExcludedSpecialFlags(TBitFlags aFlags) { iExcludedSpecialFlags = aFlags; } + + /** + * + */ + void SetSIDs( RArray& aSIDs ); + + /** + * + */ + void SetExcludedSIDs( RArray& aExcludedSIDs ); + + public: // API - Getters + + /** + * + */ + IMPORT_C TBitFlags Category() const; + + /** + * + */ + IMPORT_C const TDesC& FileName() const; + + /** + * + */ + IMPORT_C const TTime& DateTime() const; + + /** + * + */ + IMPORT_C TDriveNumber Drive() const; + + /** + * + */ + TBitFlags SpecialFlags() const { return iSpecialFlags; } + + /** + * + */ + TBitFlags ExcludedSpecialFlags() const { return iExcludedSpecialFlags; } + + /** + * + */ + const RArray& SIDs( TBitFlags aCategory ) const; + + /** + * + */ + const RArray& ExcludedSIDs( TBitFlags aCategory ) const; + + private: // Member data + + // + TDriveUnit iTargetDrive; + // + TBitFlags iCategory; + // + TBitFlags iSpecialFlags; + // + TBitFlags iExcludedSpecialFlags; + // + CMMCScBkupFileInfo* iFileInfo; + // + RArray iSecureIds; + // + RArray iExcludedSecureIds; + }; + + + + +#endif // __CMMCSCBKUPARCHIVEINFO_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupBufferManagers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupBufferManagers.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,428 @@ +/* +* Copyright (c) 2005 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: Declaration of CMMCScBkupBufferManagerBase +* +* +*/ + +#ifndef __CMMCSCBKUPBUFFERMANAGERS_H__ +#define __CMMCSCBKUPBUFFERMANAGERS_H__ + +// User includes +#include +#include +#include +#include + +// User includes +#include "TMMCScBkupArchiveVector.h" + +// Classes referenced +class MMMCScBkupArchiveDataInterface; +class CMMCScBkupDataStrategy; +class MMMCScBkupProgressObserver; + +// Constants +const TInt KScBkupDefaultBufferSize = 0x4000; + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupBufferManagerBase) : public CBase, public MEZBufferManager + { + public: // Enumerations + + /** + * + */ + enum TType + { + ETypeDescriptorToArchive = 0, + ETypeFileToArchive, + ETypeArchiveToDescriptor, + ETypeArchiveToFile + }; + + public: // Construct / destruct + + /** + * + */ + static CMMCScBkupBufferManagerBase* NewByTypeL( TType aType, MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI, TAny* aParam1 = NULL, TAny* aParam2 = NULL ); + + /** + * + */ + ~CMMCScBkupBufferManagerBase(); + + protected: // Internal construct + + /** + * + */ + CMMCScBkupBufferManagerBase( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI, TType aType ); + + /** + * + */ + virtual void ConstructL( TInt aBufferSize = KScBkupDefaultBufferSize ); + + public: // Framework API + + /** + * + */ + inline TType Type() const { return iType; } + + /** + * + */ + inline const TMMCScBkupArchiveVector& Info() const { return iInfo; } + + /** + * + */ + inline TMMCScBkupArchiveVector& Info() { return iInfo; } + + /** + * + */ + virtual void InitializeL( TAny* aParam1 = NULL, TAny* aParam2 = NULL ) = 0; + + protected: // Internal methods + + /** + * + */ + inline TPtr8& WriteBuffer() { return iBufferPointer; } + + /** + * + */ + inline const TDesC8& DataView() const { return *iBuffer; } + + /** + * + */ + inline MMMCScBkupProgressObserver& ProgressManager() const { return iProgressManager; } + + /** + * + */ + inline MMMCScBkupArchiveDataInterface& ADI() const { return iADI; } + + /** + * + */ + void WriteToArchiveAndUpdateStatsL( const TDesC8& aData ); + + private: + + /** + * + */ + TType iType; + + /** + * + */ + HBufC8* iBuffer; + + /** + * + */ + TPtr8 iBufferPointer; + + /** + * + */ + MMMCScBkupProgressObserver& iProgressManager; + + /** + * + */ + MMMCScBkupArchiveDataInterface& iADI; + + /** + * + */ + TMMCScBkupArchiveVector iInfo; + }; + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupBufferManagerDescriptorToArchive) : public CMMCScBkupBufferManagerBase + { + private: + + /** + * + */ + CMMCScBkupBufferManagerDescriptorToArchive( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); + + /** + * + */ + static CMMCScBkupBufferManagerDescriptorToArchive* NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); + + public: // From CMMCScBkupBufferManagerBase + void InitializeL(TAny* aParam1, TAny* aParam2); + + private: // From MEZBufferManager + void InitializeL( CEZZStream& aZStream ); + void NeedInputL( CEZZStream& aZStream ); + void NeedOutputL( CEZZStream& aZStream ); + void FinalizeL( CEZZStream& aZStream ); + + private: // Data members + + /** + * + */ + TPtrC8 iSource; + + friend class CMMCScBkupBufferManagerBase; + }; + + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupBufferManagerFileToArchive) : public CMMCScBkupBufferManagerBase + { + public: + + /** + * + */ + ~CMMCScBkupBufferManagerFileToArchive(); + + private: + + /** + * + */ + CMMCScBkupBufferManagerFileToArchive( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); + + /** + * + */ + void ConstructL(const TDesC& aFileName); + + /** + * + */ + static CMMCScBkupBufferManagerFileToArchive* NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); + + public: // From CMMCScBkupBufferManagerBase + void InitializeL(TAny* aParam1, TAny* aParam2); + + private: // From MEZBufferManager + void InitializeL( CEZZStream& aZStream ); + void NeedInputL( CEZZStream& aZStream ); + void NeedOutputL( CEZZStream& aZStream ); + void FinalizeL( CEZZStream& aZStream ); + + private: // Data members + + /** + * + */ + CMMCScBkupDataStrategy* iReadStrategy; + + /** + * + */ + HBufC8* iOutput; + + /** + * + */ + TPtr8 iOutputPointer; + + /** + * Useful for debugging + */ + TPtrC iFileName; + + friend class CMMCScBkupBufferManagerBase; + }; + + + + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupBufferManagerArchiveToDescriptor) : public CMMCScBkupBufferManagerBase + { + public: + + /** + * + */ + ~CMMCScBkupBufferManagerArchiveToDescriptor(); + + private: + + /** + * + */ + CMMCScBkupBufferManagerArchiveToDescriptor( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); + + /** + * + */ + static CMMCScBkupBufferManagerArchiveToDescriptor* NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); + + public: // From CMMCScBkupBufferManagerBase + void InitializeL(TAny* aParam1, TAny* aParam2); + + private: // From MEZBufferManager + void InitializeL( CEZZStream& aZStream ); + void NeedInputL( CEZZStream& aZStream ); + void NeedOutputL( CEZZStream& aZStream ); + void FinalizeL( CEZZStream& aZStream ); + + private: // Internal methods + + /** + * + */ + void TryToReadMoreSourceDataL(); + + private: // Data members + + /** + * + */ + TPtr8 iOutputPointer; + + friend class CMMCScBkupBufferManagerBase; + }; + + + + + + + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupBufferManagerArchiveToFile) : public CMMCScBkupBufferManagerBase + { + public: + + /** + * + */ + ~CMMCScBkupBufferManagerArchiveToFile(); + + private: + + /** + * + */ + CMMCScBkupBufferManagerArchiveToFile( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); + + /** + * + */ + void ConstructL(const TDesC& aFileName); + + /** + * + */ + static CMMCScBkupBufferManagerArchiveToFile* NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ); + + public: // From CMMCScBkupBufferManagerBase + void InitializeL(TAny* aParam1, TAny* aParam2); + + private: // From MEZBufferManager + void InitializeL( CEZZStream& aZStream ); + void NeedInputL( CEZZStream& aZStream ); + void NeedOutputL( CEZZStream& aZStream ); + void FinalizeL( CEZZStream& aZStream ); + + private: // Internal methods + + /** + * + */ + void TryToReadMoreSourceDataL(); + + private: // Data members + + /** + * + */ + CMMCScBkupDataStrategy* iWriteStrategy; + + /** + * + */ + HBufC8* iOutput; + + /** + * + */ + TPtr8 iOutputPointer; + + /** + * Needed, since we restore to temporary file + * and then delete and rename temp file if + * extraction succeeds. + */ + TPtrC iFileName; + + friend class CMMCScBkupBufferManagerBase; + }; + + + + + + + + + + + + + + + +#endif // __CMMCSCBKUPBUFFERMANAGERS_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupDataOwnerCollection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupDataOwnerCollection.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,219 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CMMCScBkupDataOwnerCollection +* +* +*/ + +#ifndef __CMMCSCBKUPDATAOWNERCOLLECTION_H__ +#define __CMMCSCBKUPDATAOWNERCOLLECTION_H__ + +// System includes +#include +#include +#include +#include + +// User includes +#include "RMMCScBkupPointerArray.h" + +// Namespaces +using namespace conn; + +// Classes referenced +class MMMCScBkupDriver; +class CMMCScBkupDriveSizer; +class CMMCScBkupDataOwnerInfo; + +#ifndef RD_FILE_MANAGER_BACKUP +// Type definitions +typedef RPointerArray RDataOwnerInfoArray; +#endif + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupDataOwnerCollection) : public CBase + { + public: + + /** + * Static constructor + */ + static CMMCScBkupDataOwnerCollection* NewL( MMMCScBkupDriver& aDriver, TBitFlags aCategory ); + + /** + * C++ destructor + */ + ~CMMCScBkupDataOwnerCollection(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupDataOwnerCollection( MMMCScBkupDriver& aDriver, TBitFlags aCategory ); + + /** + * + */ + void ConstructL(); + + public: // API + + /** + * + */ +#ifdef RD_FILE_MANAGER_BACKUP + TBool AssignL( const CMMCScBkupDataOwnerInfo& dataOwnersInfo ); +#else + void AssignL( RDataOwnerInfoArray& aArray ); +#endif + + /** + * + */ + void AppendL( CMMCScBkupDataOwnerInfo* aNewEntry ); + + /** + * + */ + TInt Count() const; + + /** + * + */ + CMMCScBkupDataOwnerInfo& Owner( TInt aIndex ); + + /** + * + */ + const CMMCScBkupDataOwnerInfo& Owner( TInt aIndex ) const; + + /** + * + */ + CMMCScBkupDataOwnerInfo& OwnerL( TSecureId aSID ); + + /** + * + */ + const CMMCScBkupDataOwnerInfo& OwnerL( TSecureId aSID ) const; + + /** + * + */ + CMMCScBkupDataOwnerInfo& OwnerL( TUid aPackageId ); + + /** + * + */ + const CMMCScBkupDataOwnerInfo& OwnerL( TUid aPackageId ) const; + + /** + * + */ + CMMCScBkupDataOwnerInfo& OwnerL( const TDesC& aHash ); + + /** + * + */ + const CMMCScBkupDataOwnerInfo& OwnerL( const TDesC& aHash ) const; + + /** + * + */ + void Remove( TInt aIndex ); + + /** + * + */ + void Reset(); + + /** + * The amount of space required spanning all drives. + * This is used as the total progress amount during + * restore operations. + */ + TInt64 TotalOperationalSizeL() const; + + /** + * Whether one or more data owners require a reboot + * after restore has completed. + */ + TBool RebootRequired() const; + + /** + * + */ + TInt64 DiskSpaceRequiredForRestore( TDriveNumber aDrive ) const; + + /** + * + */ + void CalculateDiskSpaceRequiredForRestoreL(); + + /** + * + */ + TBitFlags Category() const { return iCategory; } + + public: + + /** + * Internalize 'iRestoreSizer' from stream + */ + void InternalizeL( RReadStream& aStream ); + + /** + * Externalize 'iRestoreSizer' to stream + */ + void ExternalizeL( RWriteStream& aStream ) const; + + private: + +#ifdef RD_FILE_MANAGER_BACKUP + /** + * + */ + TBool BelongsToL(const CMMCScBkupDataOwnerInfo& aInfo, TBitFlags aFlags, TBitFlags aExcludedFlags, + const RArray aSecureIds, const RArray aExcludedSecureIds) const; +#endif + + private: // Internal enumerations + enum + { + EStreamFormatVersion1 = 1 + }; + + private: // Member data + + // + MMMCScBkupDriver& iDriver; + // Array of data owners + RMMCScBkupPointerArray iOwners; + // + CMMCScBkupDriveSizer* iRestoreSizer; + // + TBitFlags iCategory; + }; + + + + +#endif // __CMMCSCBKUPDATAOWNERCOLLECTION_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupDataOwnerInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupDataOwnerInfo.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,253 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CMMCScBkupDataOwnerInfo +* +* +*/ + +#ifndef __CMMCSCBKUPDATAOWNERINFO_H__ +#define __CMMCSCBKUPDATAOWNERINFO_H__ + +// System includes +#include +#include +#include + +// User includes +#include "TMMCScBkupOwnerDataType.h" + +// Classes referenced +class TMMCScBkupDriveAndSize; +class CMMCScBkupDataTypeSizer; +class MMMCScBkupArchiveDataInterface; + +// Namespaces +using namespace conn; + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupDataOwnerInfo) : public CBase + { + public: + + /** + * Static constructor + */ + static CMMCScBkupDataOwnerInfo* NewLC( CDataOwnerInfo* aOwner ); + + /** + * Static constructor + */ + static CMMCScBkupDataOwnerInfo* NewLC( RReadStream& aStream ); + + /** + * Static constructor + */ + static CMMCScBkupDataOwnerInfo* New( TSecureId aSecureId ); + + /** + * C++ destructor + */ + ~CMMCScBkupDataOwnerInfo(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupDataOwnerInfo( CDataOwnerInfo* aOwner = NULL ); + + /** + * + */ + void ConstructL(); + + public: // API + + /** + * + */ + CDataOwnerInfo& Owner(); + + /** + * + */ + const CDataOwnerInfo& Owner() const; + + /** + * + */ + TDataOwnerStatus Status() const; + + /** + * + */ + void SetStatus( TDataOwnerStatus aStatus ); + + /** + * + */ + void AddToOperationalSizeL( TMMCScBkupOwnerDataType aType, TDriveNumber aDrive, TInt64 aSize ); + + /** + * + */ + void SetOperationalSizeL( TMMCScBkupOwnerDataType aType, TDriveNumber aDrive, TInt64 aSize ); + + /** + * + */ + void ResetOperationalSize( TMMCScBkupOwnerDataType aType ); + + /** + * + */ + TInt64 OperationalSize( TMMCScBkupOwnerDataType aType ) const; + + /** + * + */ + TInt64 OperationalSize( TMMCScBkupOwnerDataType aType, TDriveNumber aDrive ) const; + + /** + * + */ + TInt64 OperationalSize( TDriveNumber aDrive ) const; + + /** + * + */ + void OperationalSizesL( RArray& aSizes ) const; + + /** + * + */ + inline TSecureId SecureId() const { return iSecureId; } + + /** + * + */ + TInt NumberOfOperationsRequiredL() const; + + /** + * + */ + void SetCompletionStatus( TMMCScBkupOwnerDataType aType, TBool aCompleted ); + + /** + * + */ + TBool CompletionStatus( TMMCScBkupOwnerDataType aType ) const; + + /** + * + */ + TInt ActiveDataRetryCount() const; + + /** + * + */ + void SetActiveDataRetryCount( TInt aCount ); + + /** + * + */ + inline TInt Version() const { return iVersion; } + + public: // Store/Restore + + /** + * + */ + void InternalizeL( RReadStream& aStream ); + + /** + * + */ + void ExternalizeL( RWriteStream& aStream ) const; + + public: // Comparison support + + /** + * + */ + static TBool CompareDataOwnerBySIDL( const CMMCScBkupDataOwnerInfo& aLeft, const CMMCScBkupDataOwnerInfo& aRight ); + + /** + * + */ + TBool HasJavaDataL() const; + + /** + * + */ + TBool HasActiveDataL() const; + + /** + * + */ + TBool HasPassiveDataL() const; + + /** + * + */ + TBool HasPublicDataL() const; + + /** + * + */ + TBool HasSystemDataL() const; + + private: // Internal enumerations + enum + { + EStreamFormatVersion1 = 1, + EStreamFormatVersion2, + EStreamFormatVersionLatest + }; + + public: // Public enumerations + enum + { + EStreamFormatVersionFirst = EStreamFormatVersion1 + }; + + private: // Member data + + // Underlying data owner - owned by this object + CDataOwnerInfo* iDataOwner; + // Associated secure id of the data owner (if it has one) + TSecureId iSecureId; + // Ready status of the data owner + TDataOwnerStatus iStatus; + // Size of data that the owner has to backup/restore + CMMCScBkupDataTypeSizer* iOperationalSize; + // The completion status of each individual element + TFixedArray iCompletionStatus; + // For active data, we record how many times the SID has returned "not ready" + TInt iActiveDataRetryCount; + // Version information + TInt iVersion; + }; + + + + +#endif // __CMMCSCBKUPDATAOWNERINFO_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupDataStrategies.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupDataStrategies.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,224 @@ +/* +* Copyright (c) 2005 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: Declaration of CMMCScBkupDataStrategy +* +* +*/ + +#ifndef __CMMCSCBKUPDATASTRATEGIES_H__ +#define __CMMCSCBKUPDATASTRATEGIES_H__ + +// User includes +#include + +// Constants +const TBool KMMCScBkupUseTempFile = EFalse; + + +/** +* +* +* @since 3.0 +*/ +class CMMCScBkupDataStrategy : public CBase + { + public: + + /** + * Factory method + */ + static CMMCScBkupDataStrategy* ReadStrategyLC( const TDesC& aName, RFs& aFsSession ); + + /** + * Factory method + */ + static CMMCScBkupDataStrategy* ReadStrategyLC( const TDesC& aName, RFs& aFsSession, TInt aStartOffset, TInt aLengthToRead ); + + /** + * Factory method + */ + static CMMCScBkupDataStrategy* WriteStrategyLC( const TDesC& aName, RFs& aFsSession, TBool aUseTempFile ); + + public: // Framework API + + /** + * Read data from the source + * + * @return TInt The amount of data read, or 0 if the end of file has been reached + */ + virtual TInt Read(TDes8& aSink) = 0; + + /** + * Write data to the source + * + * @return TInt KErrNone if success, KErrNotSupported if the strategy doesn't support writing + * or any of the other System-Wide error codes upon failure. + */ + virtual TInt Write(const TDesC8& aSource); + + /** + * Perform any final actions + * + * @return TInt an error code. + */ + virtual TInt Finalize(); + + protected: + + /** + * C++ Constructor + */ + CMMCScBkupDataStrategy(); + + private: // Internal methods + + /** + * Sets the offset and length + */ + void SetOffsetAndLength(TInt aStartOffset, TInt aLengthToRead); + + protected: // Internal + inline TInt Offset() const { return iOffset; } + inline TInt LengthToRead() const { return iLengthToRead; } + inline void SetOffset(TInt64 aOffset) { iOffset = aOffset; } + + private: // Data members + + // + TInt iOffset; + // + TInt iLengthToRead; + }; + + + + + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupDataFileStrategy) : public CMMCScBkupDataStrategy + { + public: + + /** + * Static constructor + */ + static CMMCScBkupDataFileStrategy* NewForReadingL( const TDesC& aName, RFs& aFsSession ); + + /** + * Static constructor + */ + static CMMCScBkupDataFileStrategy* NewForWritingL( const TDesC& aName, RFs& aFsSession, TBool aUseTempFile ); + + /** + * C++ Destructor + */ + ~CMMCScBkupDataFileStrategy(); + + private: + + /** + * C++ Constructor + */ + CMMCScBkupDataFileStrategy( RFs& aFsSession, TBool aUseTempFile = EFalse ); + + /** + * Second phase construction + */ + void ConstructL( const TDesC& aName, TUint aMode ); + + public: // From CMMCScBkupDataStrategy + TInt Read(TDes8& aSink); + TInt Write(const TDesC8& aSource); + TInt Finalize(); + + private: // Internal functions + + /** + * + */ + static TInt PrepareToOverwriteFile( RFs& aFsSession, const TDesC& aFileName ); + + private: // Data members + + RFs& iFsSession; + // + RFile64 iFile; + // + TBool iUseTempFile; + // + HBufC* iFileName; + // + TFileName iTempFileName; + }; + + + + + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupDataFileSectionReadStrategy) : public CMMCScBkupDataStrategy + { + public: + + /** + * Static constructor + */ + static CMMCScBkupDataFileSectionReadStrategy* NewL(const TDesC& aName, RFs& aFsSession); + + /** + * C++ Destructor + */ + ~CMMCScBkupDataFileSectionReadStrategy(); + + private: + + /** + * C++ Constructor + */ + CMMCScBkupDataFileSectionReadStrategy(RFs& aFsSession); + + /** + * + */ + void ConstructL(const TDesC& aName); + + public: // From CMMCScBkupDataStrategy + TInt Read(TDes8& aSink); + + private: // Data members + + // + RFs& iFsSession; + // + HBufC* iFileName; + }; + + + + +#endif // __CMMCSCBKUPDATASTRATEGIES_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupDriveAndOperationTypeManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupDriveAndOperationTypeManager.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,154 @@ +/* +* Copyright (c) 2005 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: Declaration of CMMCScBkupDriveAndOperationTypeManager +* +* +*/ + +#ifndef __CMMCSCBKUPDRIVEANDOPERATIONTYPEMANAGER_H__ +#define __CMMCSCBKUPDRIVEANDOPERATIONTYPEMANAGER_H__ + +// System includes +#include +#include +#include + +// User includes +#include "TMMCScBkupOwnerDataType.h" +#include "CMMCScBkupOperationParameters.h" +// Namespaces +using namespace conn; + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(TMMCScBkupDriveAndOperationType) + { + public: + inline TMMCScBkupDriveAndOperationType() + : iDrive( EDriveC ), iType( EMMCScBkupOwnerDataTypeAny ) { } + + inline TMMCScBkupDriveAndOperationType( TDriveNumber aDrive, TMMCScBkupOwnerDataType aType ) + : iDrive( aDrive ), iType( aType ) { } + + public: // Common attributes + + /** + * + */ + inline TDriveNumber Drive() const { return iDrive; } + + /** + * + */ + inline void SetDrive( TDriveNumber aDrive ) { iDrive = aDrive; } + + /** + * + */ + inline TMMCScBkupOwnerDataType DataType() const { return iType; } + + /** + * + */ + inline void SetDataType( TMMCScBkupOwnerDataType aType ) { iType = aType; } + + private: // Data members + + // + TDriveNumber iDrive; + // + TMMCScBkupOwnerDataType iType; + }; + + + + + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupDriveAndOperationTypeManager) : public CBase + { + public: + + /** + * + */ + IMPORT_C static CMMCScBkupDriveAndOperationTypeManager* NewL( + BkupDrivesAndOperationList *aDriveList ); + + /** + * + */ + IMPORT_C ~CMMCScBkupDriveAndOperationTypeManager(); + + private: + + /** + * + */ + CMMCScBkupDriveAndOperationTypeManager(); + + /** + * + */ + void ConstructL( BkupDrivesAndOperationList *aDriveList ); + + + public: // API + + /** + * + */ + TInt Count() const; + + /** + * + */ + const TMMCScBkupDriveAndOperationType& At( TInt aIndex ) const; + + /** + * + */ + inline const TDriveList& DriveList() const { return iCalculatedDriveList; } + + /** + * + */ + TBool IsDataTypeAllowedToAccessDrive( TDriveNumber aDrive, TMMCScBkupOwnerDataType aDataType ) const; + + private: // Internal methods + + + private: // Data members + + // + RArray< TMMCScBkupDriveAndOperationType > iEntries; + // + TDriveList iCalculatedDriveList; + + }; + +#endif // __CMMCSCBKUPDRIVEANDOPERATIONTYPEMANAGER_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupDriveDataSizeManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupDriveDataSizeManager.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,247 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of CMMCScBkupDriveSizer +* +* +*/ + +#ifndef __CMMCSCBKUPDRIVEDATASIZEMANAGER_H__ +#define __CMMCSCBKUPDRIVEDATASIZEMANAGER_H__ + +// System includes +#include +#include + +// User includes +#include "TMMCScBkupDriveAndSize.h" +#include "RMMCScBkupPointerArray.h" +#include "TMMCScBkupOwnerDataType.h" + + +/** +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupDriveSizer) : public CBase + { + public: + + /** + * + */ + static CMMCScBkupDriveSizer* NewLC( TMMCScBkupOwnerDataType aType ); + + /** + * + */ + static CMMCScBkupDriveSizer* NewLC( RReadStream& aStream ); + + /** + * C++ destructor + */ + ~CMMCScBkupDriveSizer(); + + private: + + /** + * C++ constructor + */ + CMMCScBkupDriveSizer( TMMCScBkupOwnerDataType aType ); + + /** + * + */ + void ConstructL(); + + public: // API + + /** + * + */ + inline TMMCScBkupOwnerDataType DataType() const { return iDataType; } + + /** + * + */ + void AddToSizeL( TInt64 aAmount, TDriveNumber aDrive ); + + /** + * + */ + void Reset(); + + /** + * + */ + void Reset( TDriveNumber aDrive ); + + /** + * + */ + TInt64 Size() const; + + /** + * + */ + TInt64 Size( TDriveNumber aDrive ) const; + + public: + + /** + * Internalize object from stream + */ + void InternalizeL( RReadStream& aStream ); + + /** + * Externalize object to stream + */ + void ExternalizeL( RWriteStream& aStream ) const; + + private: // Internal methods + + /** + * + */ + TMMCScBkupDriveAndSize* EntryByDrive( TDriveNumber aDrive ); + + private: // Internal enumerations + enum + { + EStreamFormatVersion1 = 1 + }; + + private: // Data members + + // + RArray iEntries; + // + TMMCScBkupOwnerDataType iDataType; + }; + + + + + + +/** +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupDataTypeSizer) : public CBase + { + public: + + /** + * + */ + static CMMCScBkupDataTypeSizer* NewL(); + + /** + * + */ + static CMMCScBkupDataTypeSizer* NewLC( RReadStream& aStream ); + + /** + * C++ destructor + */ + ~CMMCScBkupDataTypeSizer(); + + private: + + /** + * C++ constructor + */ + CMMCScBkupDataTypeSizer(); + + /** + * + */ + void ConstructL(); + + public: // API + + /** + * + */ + void AddToSizeL( TMMCScBkupOwnerDataType aDataType, TInt64 aAmount, TDriveNumber aDrive ); + + /** + * + */ + void Reset( TMMCScBkupOwnerDataType aDataType ); + + /** + * + */ + void Reset( TMMCScBkupOwnerDataType aDataType, TDriveNumber aDrive ); + + /** + * + */ + TInt64 Size( TMMCScBkupOwnerDataType aDataType ) const; + + /** + * + */ + TInt64 Size( TMMCScBkupOwnerDataType aDataType, TDriveNumber aDrive ) const; + + /** + * + */ + void GetSizesL( RArray& aSizes ) const; + + /** + * + */ + TInt64 CombinedSize( TDriveNumber aDrive ) const; + + public: + + /** + * Internalize object from stream + */ + void InternalizeL( RReadStream& aStream ); + + /** + * Externalize object to stream + */ + void ExternalizeL( RWriteStream& aStream ) const; + + private: // Internal methods + + /** + * + */ + CMMCScBkupDriveSizer* SizerByDataType( TMMCScBkupOwnerDataType aDataType ); + + private: // Internal enumerations + enum + { + EStreamFormatVersion1 = 1 + }; + + private: // Data members + + // + RMMCScBkupPointerArray iSizers; + }; + + + + + + +#endif // __CMMCSCBKUPDRIVEDATASIZEMANAGER_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupDriveSpecificRequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupDriveSpecificRequest.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2005 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: Declaration of CMMCScBkupDriveSpecificRequest +* +* +*/ + +#ifndef __CMMCSCBKUPDRIVESPECIFICREQUEST_H__ +#define __CMMCSCBKUPDRIVESPECIFICREQUEST_H__ + +// System includes +#include +#include + +// User includes +#include "TMMCScBkupOwnerDataType.h" + +// Classes referenced +class CMMCScBkupDriveAndOperationTypeManager; + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupDriveSpecificRequest) : public CActive + { + protected: + + /** + * C++ default constructor + */ + CMMCScBkupDriveSpecificRequest( const CMMCScBkupDriveAndOperationTypeManager& aDriveAndOperations, TMMCScBkupOwnerDataType aDataType, CActive::TPriority aPriority = CActive::EPriorityIdle ); + + /** + * Second phase constructor + */ + void ConstructL( ); + + public: + + /** + * C++ destructor + */ + ~CMMCScBkupDriveSpecificRequest(); + + protected: // API + + /** + * + */ + virtual void RequestL( TRequestStatus& aObserver ); + + protected: // Internal methods + + /** + * + */ + TBool NextValidDrive(TDriveNumber& aDrive); + + /** + * + */ + TBool NextValidDrive(TDriveNumber& aDrive, const TDriveList& aCrossCheckList); + + /** + * Return the current drive + */ + TDriveNumber CurrentDrive() const; + + /** + * + */ + void CompleteObserverRequest(TInt aCompletionCode); + + /** + * + */ + void CompleteSelf(TInt aCompletionCode = KErrNone); + + /** + * + */ + inline const CMMCScBkupDriveAndOperationTypeManager& DriveAndOperations() const { return iDriveAndOperations; } + + private: // From CActive + + /** + * Default behaviour is to do nothing + */ + void DoCancel(); + + /** + * Complete's observer with the error code + */ + TInt RunError(TInt aError); + + private: // Member data + + // + const CMMCScBkupDriveAndOperationTypeManager& iDriveAndOperations; + // + TMMCScBkupOwnerDataType iDataType; + // + TInt iCurrentDrive; + // + TRequestStatus* iObserver; + }; + + + + + + + + +#endif // __CMMCSCBKUPARCHIVE_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupEngine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupEngine.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Scans for names of the files according to array. +* +*/ + +#ifndef __CMMCSCBKUPENGINE_H__ +#define __CMMCSCBKUPENGINE_H__ + +// User includes +#include "MMCScBkupOperations.h" + +// Classes referenced +class RFs; +class CMMCScBkupEngineImpl; +class CMMCScBkupOpParamsBase; +class MMMCScBkupEngineObserver; +class CMMCScBkupArchiveInfo; + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupEngine) : public CBase + { + public: + + /** + * Two-phased constructor. + */ + IMPORT_C static CMMCScBkupEngine* NewL( RFs& aFsSession ); + + /** + * Destructor + */ + IMPORT_C ~CMMCScBkupEngine(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupEngine(); + + /** + * Second phase constructor + */ + void ConstructL( RFs& aFsSession ); + + + public: // API + + /** + * NB. aParams are IMMEDIATELY owned by the engine. Do not pass them in + * left on the cleanup stack. + */ + IMPORT_C void StartOperationL(TMMCScBkupOperationType aOperation, MMMCScBkupEngineObserver& aObserver, CMMCScBkupOpParamsBase* aParams ); + + /** + * + */ + IMPORT_C void CancelOperation(); + + /** + * + */ + IMPORT_C TBool ValidArchiveForRestore( const TDesC& aFileName ); + + /** + * + */ + IMPORT_C TInt64 TotalOperationSizeL() const; + + /** + * + */ + IMPORT_C TBool RebootRequired() const; + + /** + * + */ + IMPORT_C TBool DeleteArchivesL( RPointerArray< CMMCScBkupArchiveInfo >& aArchives ) const; + + /** + * + */ + IMPORT_C void ListArchivesL( + RPointerArray< CMMCScBkupArchiveInfo >& aArchives, + CMMCScBkupOpParamsBase* aParams, + const TUint32 aDriveAttMatch, + const TInt aDriveMatch = KErrNotFound ) const; + + private: // Member data + + // Real engine + CMMCScBkupEngineImpl* iEngine; + }; + + + + +#endif // __CMMCSCBKUPENGINE_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupEngineImpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupEngineImpl.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,277 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Scans for names of the files according to array. +* +*/ + +#ifndef __CMMCSCBKUPENGINEIMPL_H__ +#define __CMMCSCBKUPENGINEIMPL_H__ + +// System includes +#include + +// User includes +#include "MMCScBkupConfig.h" +#include "MMMCScBkupDriver.h" +#include "MMCScBkupStateIds.h" +#include "MMCScBkupOperations.h" +#include "MMMCScBkupEngineObserver.h" +#include "MMMCScBkupProgressObserver.h" + +// Namespaces +using namespace conn; + +// Classes referenced +class RFs; +class CMMCScBkupState; +class CMMCScBkupArchive; +class CMMCScBkupStateFactory; +class CMMCScBkupOpParamsBase; +class MMMCScBkupEngineObserver; +class CMMCScBkupFileListCollection; +class CMMCScBkupDataOwnerCollection; +class MMMCScBkupArchiveDataInterface; +class CMMCScBkupArchiveInfo; + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupEngineImpl) : public CActive, public MMMCScBkupDriver, public MMMCScBkupProgressObserver + { + public: + + /** + * Two-phased constructor. + */ + static CMMCScBkupEngineImpl* NewL( RFs& aFsSession ); + + /** + * Destructor + */ + ~CMMCScBkupEngineImpl(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupEngineImpl( RFs& aFsSession ); + + /** + * Second phase constructor + */ + void ConstructL( ); + + + public: // API + + /** + * + */ + void StartOperationL(TMMCScBkupOperationType aOperation, MMMCScBkupEngineObserver& aObserver, CMMCScBkupOpParamsBase* aParams ); + + /** + * + */ + void CleanupL( TInt aError = KErrNone ); + + /** + * + */ + TBool ValidArchiveForRestoreL( const TDesC& aFileName ); + + /** + * + */ + TInt64 TotalOperationSizeL() const; + + /** + * + */ + TBool RebootRequired() const; + + /** + * + */ + TBool DeleteArchivesL( RPointerArray< CMMCScBkupArchiveInfo >& aArchives ) const; + + /** + * + */ + void ListArchivesL( + RPointerArray< CMMCScBkupArchiveInfo >& aArchives, + CMMCScBkupOpParamsBase* aParams, + const TUint32 aDriveAttMatch, + const TInt aDriveMatch ); + + private: // From MMMCScBkupDriver + void DrvHandleStateExecutionCompleteL( const CMMCScBkupState& aState ); + void DrvHandleStateExecutionCompleteL( const CMMCScBkupState& aState, TMMCScBkupStateId aNextState ); + void DrvHandleStateExecutionErrorL( const CMMCScBkupState& aState, TInt aError ); + + private: // From MMMCScBkupDriver + MMMCScBkupArchiveDataInterface& DrvADI() const; + CMMCScBkupArchive& DrvArchive() const; + CSBEClient& DrvSecureBackupClient() const; + TMMCScBkupOperationType DrvOperation() const; + CMMCScBkupOpParamsBase& DrvParamsBase() const; + CMMCScBkupDataOwnerCollection& DrvDataOwners() const; + RPointerArray& DrvDataOwnersAll(); + CMMCScBkupFileListCollection& DrvFileList() const; + TBool DrvLastCategory() const; + void DrvStoreTotalProgress(TInt64 aProgress); + TInt64 DrvTotalProgress() const; + MMMCScBkupProgressObserver& DrvProgressHandler() const; + + private: // From MMMCScBkupProgressObserver + void MMCScBkupHandleProgress( TInt aAmountCompleted ); + void MMCScBkupHandleProgressDomainUnderstood( TInt aTotalProgressAmount ); + TInt MMCScBkupHandleFreeSpace( TInt aPercentualFree ); + void MMCScBkupStartBackuping( TBool aProceed ); + + private: // From CActive + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + + private: // Internal + + /** + * + */ + void CompleteOwnRequest(TInt aCompletionCode = KErrNone, TBool aSetActive = ETrue); + + /** + * + */ + void NotifyObserver(MMMCScBkupEngineObserver::TEvent aEvent, TInt aAssociatedData = KErrNone); + + /** + * + */ + void PrepareForBackupL(TBool aPartial); + + /** + * + */ + void PrepareForRestoreL(TBool aPartial); + + /** + * + */ + void SetParameters(CMMCScBkupOpParamsBase* aParameters); + + /** + * + */ + void CreateFactoryL(TMMCScBkupOperationType aOperation); + + /** + * + */ + TBool CurrentStateAvailable() const; + + /** + * + */ + TMMCScBkupStateId CurrentStateId() const; + + /** + * + */ + CMMCScBkupState& CurrentState(); + + /** + * + */ + const CMMCScBkupState& CurrentState() const; + + /** + * + */ + void PrepareNextStateL( TMMCScBkupStateId aCurrentStateId ); + + /** + * + */ + void DestroyCurrentState(); + + /** + * + */ + void ExecuteStateL(); + + /** + * + */ + void PrepareObjectsL(); + +#ifdef DEBUGGING_DATA_TRANSFER + + /** + * + */ + void CleanBackupFilesL(); + + /** + * + */ + void ClearRestoreFilesL(); +#endif + + private: // Member data + + // Referenced objects + // file server session + RFs& iFsSession; + // backup engine observer + MMMCScBkupEngineObserver* iObserver; + + // Owned objects + // + TInt64 iCumulativeProgress; + // Secure backup engine client + CSBEClient* iSBEClient; + // Archive array + RMMCScBkupPointerArray iArchives; + // Current operation + TMMCScBkupOperationType iOperationType; + // Operational parameters + CMMCScBkupOpParamsBase* iParameters; + // + CMMCScBkupState* iCurrentState; + // Current factory + CMMCScBkupStateFactory* iFactory; + // + RPointerArray iDataOwners; + // + RPointerArray iFileLists; + // + TInt iCurrentArchive; + // + TInt64 iTotalProgress; + // + TBool iActiveDataProcessingOngoing; + }; + + + + +#endif // __CMMCSCBKUPENGINEIMPL_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupFileInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupFileInfo.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupFileInfo +* +* +*/ + +#ifndef __CMMCSCBKUPFILEINFO_H__ +#define __CMMCSCBKUPFILEINFO_H__ + +// System includes +#include +#include + + +/** +* Represents a public file within an archive. Each public file +* has an associated data owner. This is encapsulated by the SID +* of the owning process. +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupFileInfo) : public CBase + { + public: + + /** + * Static constructor + */ + static CMMCScBkupFileInfo* NewL( const TEntry& aEntry, TSecureId aAssociatedSID ); + + /** + * Static constructor + */ + static CMMCScBkupFileInfo* NewLC( const TEntry& aEntry, TSecureId aAssociatedSID ); + + /** + * Static constructor + */ + static CMMCScBkupFileInfo* NewLC( RReadStream& aStream ); + + /** + * C++ destructor + */ + ~CMMCScBkupFileInfo(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupFileInfo(); + + /** + * C++ default constructor + */ + CMMCScBkupFileInfo( const TEntry& aEntry, TSecureId aAssociatedSID ); + + /** + * + */ + void ConstructL( const TEntry& aEntry ); + + public: // API - Getters + + /** + * + */ + inline const TDesC& FileName() const { return *iFileName; } + + /** + * + */ + inline TInt Size() const { return iSize; } + + /** + * + */ + inline const TTime& DateTime() const { return iDateTime; } + + /** + * + */ + inline TUint Attributes() const { return iAttributes; } + + /** + * + */ + inline TSecureId SecureId() const { return iSecureId; } + + /** + * + */ + TDriveNumber Drive() const; + + public: // Store/Restore + + /** + * + */ + void InternalizeL(RReadStream& aStream); + + /** + * + */ + void ExternalizeL(RWriteStream& aStream) const; + + private: // Internal enumerations + enum + { + EStreamFormatVersion1 = 1 + }; + + public: // Comparison support + + /** + * + */ + static TInt OrderByFileName(const CMMCScBkupFileInfo& aLeft, const CMMCScBkupFileInfo& aRight); + + /** + * + */ + static TBool CompareByFileName(const CMMCScBkupFileInfo& aLeft, const CMMCScBkupFileInfo& aRight); + + private: // Member data + + // File name + HBufC* iFileName; + // + TInt iSize; + // + TTime iDateTime; + // + TUint iAttributes; + // + TSecureId iSecureId; + }; + + + + +#endif // __CMMCSCBKUPFILEINFO_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupFileListCollection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupFileListCollection.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration for CMMCScBkupFileListCollection +* +* +*/ + +#ifndef __CMMCSCBKUPFILELISTCOLLECTION_H__ +#define __CMMCSCBKUPFILELISTCOLLECTION_H__ + +// System includes +#include + +// User includes +#include "RMMCScBkupPointerArray.h" +#include "CMMCScBkupFileInfo.h" +#include + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupFileListCollection) : public CBase + { + public: + + /** + * Static constructor + */ + static CMMCScBkupFileListCollection* NewL( TBitFlags aCategory, RFs& aFsSession ); + + /** + * C++ destructor + */ + ~CMMCScBkupFileListCollection(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupFileListCollection( TBitFlags aCategory, RFs& aFsSession ); + + /** + * + */ + void ConstructL(); + + public: // API + + /** + * + */ + void AppendL( const RArray& aArray, RArray< const CMMCScBkupFileInfo* >& aAddedItems, TSecureId aAssociatedSID ); + + /** + * + */ + void AppendL( CMMCScBkupFileInfo* aFileInfo ); + + /** + * + */ + TInt Count() const; + + /** + * + */ + const CMMCScBkupFileInfo& Entry(TInt aIndex) const; + + /** + * + */ + void Remove( TInt aIndex ); + + /** + * + */ + void Reset(); + + /** + * + */ + TBitFlags Category() const { return iCategory; } + + private: // Member data + + // Array of data owners + RMMCScBkupPointerArray iEntries; + // + TBitFlags iCategory; + // + RFs& iFsSession; + }; + + + + +#endif // __CMMCSCBKUPFILELISTCOLLECTION_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupIndexActiveData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupIndexActiveData.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupIndexActiveData +* +* +*/ + +#ifndef __CMMCSCBKUPINDEXACTIVEDATA_H__ +#define __CMMCSCBKUPINDEXACTIVEDATA_H__ + +// User includes +#include "CMMCScBkupIndexWithIdentifier.h" + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupIndexActiveData) : public CMMCScBkupIndexWithIdentifier< TSecureId > + { + public: + + /** + * Static constructor + */ + static CMMCScBkupIndexActiveData* NewLC(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupIndexActiveData(); + + }; + + + + +#endif // __CMMCSCBKUPINDEXACTIVEDATA_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupIndexBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupIndexBase.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupIndexBase +* +* +*/ + +#ifndef __CMMCSCBKUPINDEXBASE_H__ +#define __CMMCSCBKUPINDEXBASE_H__ + +// System includes +#include + +// User includes +#include "MMMCScBkupDriver.h" +#include "TMMCScBkupOwnerDataType.h" +#include "RMMCScBkupPointerArray.h" +#include "TMMCScBkupArchiveVector.h" + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupIndexBase) : public CBase + { + public: + + /** + * C++ destructor + */ + ~CMMCScBkupIndexBase(); + + protected: + + /** + * C++ default constructor + */ + CMMCScBkupIndexBase(TMMCScBkupOwnerDataType aType); + + /** + * + */ + virtual void ConstructL(); + + public: // API + + /** + * + */ + inline TMMCScBkupOwnerDataType Type() const { return iType; } + + /** + * + */ + inline const TMMCScBkupArchiveVector& Vector() const { return iVector; } + + /** + * + */ + inline void SetVector( const TMMCScBkupArchiveVector& aVector ) { iVector = aVector; } + + public: // Store/Restore + + /** + * + */ + virtual void StoreL(MMMCScBkupDriver& aDriver) = 0; + + /** + * + */ + virtual void RestoreL(MMMCScBkupDriver& aDriver) = 0; + + private: // Member data + + // + TMMCScBkupOwnerDataType iType; + // + TMMCScBkupArchiveVector iVector; + }; + + + + +#endif // __CMMCSCBKUPINDEXBASE_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupIndexDataOwners.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupIndexDataOwners.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupIndexDataOwners +* +* +*/ + +#ifndef __CMMCSCBKUPINDEXDATAOWNERS_H__ +#define __CMMCSCBKUPINDEXDATAOWNERS_H__ + +// System includes +#include + +// User includes +#include "CMMCScBkupIndexBase.h" + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupIndexDataOwners) : public CMMCScBkupIndexBase + { + public: + + /** + * Static constructor + */ + static CMMCScBkupIndexDataOwners* NewLC(); + + /** + * C++ destructor + */ + ~CMMCScBkupIndexDataOwners(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupIndexDataOwners(); + + public: // API + + /** + * + */ + void AddIndexRecordL( const TMMCScBkupArchiveVector& aInfo ); + + /** + * + */ + inline TInt Count() const + { return iEntries.Count(); } + + /** + * + */ + inline const TMMCScBkupArchiveVector& At( TInt aIndex ) const + { return iEntries[ aIndex ]; } + + public: // From CMMCScBkupIndexBase + + /** + * + */ + void StoreL(MMMCScBkupDriver& aDriver); + + /** + * + */ + void RestoreL(MMMCScBkupDriver& aDriver); + + private: // Internal enumerations + enum + { + EStreamFormatVersion1 = 1 + }; + + private: // Member data + + // + RArray iEntries; + + }; + + + + +#endif // __CMMCSCBKUPINDEXDATAOWNERS_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupIndexJavaData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupIndexJavaData.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,222 @@ +/* +* 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: Declaration for CMMCScBkupIndexJavaDataEntry and +* CMMCScBkupIndexJavaData +* +* +*/ + +#ifndef __CMMCSCBKUPINDEXJAVADATA_H__ +#define __CMMCSCBKUPINDEXJAVADATA_H__ + +// User includes +#include "CMMCScBkupIndexWithIdentifier.h" + + + +/** +* +* @since 3.0 +*/ +NONSHARABLE_CLASS( CMMCScBkupIndexJavaDataEntry ) : public CBase + { + public: + + /** + * + */ + static CMMCScBkupIndexJavaDataEntry* NewLC(); + + /** + * + */ + static CMMCScBkupIndexJavaDataEntry* NewLC( RReadStream& aStream ); + + /** + * C++ destructor + */ + ~CMMCScBkupIndexJavaDataEntry(); + + private: + + /** + * + */ + CMMCScBkupIndexJavaDataEntry(); + + /** + * + */ + void ConstructL(); + + public: // API + + /** + * + */ + inline const TDesC& Hash() const { return *iHash; } + + /** + * + */ + void SetHashL( const TDesC& aHash ); + + /** + * + */ + inline TDriveNumber Drive() const { return iDrive; } + + /** + * + */ + inline void SetDrive( TDriveNumber aDrive ) { iDrive = aDrive; } + + /** + * + */ + inline const TMMCScBkupArchiveVector& MidletInfo() const { return iMidletInfo; } + + /** + * + */ + inline void SetMidletInfo( const TMMCScBkupArchiveVector& aInfo ) { iMidletInfo = aInfo; } + + /** + * + */ + inline const TMMCScBkupArchiveVector& MidletDataInfo() const { return iMidletDataInfo; } + + /** + * + */ + inline void SetMidletDataInfo( const TMMCScBkupArchiveVector& aInfo ) { iMidletDataInfo = aInfo; } + + /** + * + */ + inline TBool HasMidletDataInfo() const { return iMidletDataInfo.Length() > 0 && iMidletDataInfo.Offset() > 0; } + + public: // Store & restore + + /** + * + */ + void InternalizeL( RReadStream& aStream ); + + /** + * + */ + void ExternalizeL( RWriteStream& aStream ) const; + + private: // Internal enumerations + enum + { + EStreamFormatVersion1 = 1 + }; + + private: // Data members + // + HBufC* iHash; + // + TDriveNumber iDrive; + // + TMMCScBkupArchiveVector iMidletInfo; + // + TMMCScBkupArchiveVector iMidletDataInfo; + }; + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupIndexJavaData) : public CMMCScBkupIndexBase + { + public: + + /** + * Static constructor + */ + static CMMCScBkupIndexJavaData* NewLC(); + + /** + * C++ destructor + */ + ~CMMCScBkupIndexJavaData(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupIndexJavaData(); + + public: // API + + /** + * + */ + void AddIndexRecordL( const TMMCScBkupArchiveVector& aInfo, const TDesC& aHash, TDriveNumber aDrive, TJavaTransferType aType ); + + /** + * + */ + inline TInt Count() const { return iEntries.Count(); } + + /** + * + */ + const CMMCScBkupIndexJavaDataEntry& At( TInt aIndex ) const; + + public: // From CMMCScBkupIndexBase + + /** + * + */ + void StoreL( MMMCScBkupDriver& aDriver ); + + /** + * + */ + void RestoreL( MMMCScBkupDriver& aDriver ); + + private: // Internal classes + + /** + * + */ + CMMCScBkupIndexJavaDataEntry* EntryByHash( const TDesC& aHash, TDriveNumber aDrive ) const; + + private: // Internal enumerations + enum + { + EStreamFormatVersion1 = 1 + }; + + private: // Member data + + // + RMMCScBkupPointerArray< CMMCScBkupIndexJavaDataEntry > iEntries; + + }; + + + + + +#endif // __CMMCSCBKUPINDEXJAVADATA_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupIndexPassiveData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupIndexPassiveData.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupIndexPassiveData +* +* +*/ + +#ifndef __CMMCSCBKUPINDEXPASSIVEDATA_H__ +#define __CMMCSCBKUPINDEXPASSIVEDATA_H__ + +// System includes +#include + +// User includes +#include "CMMCScBkupIndexWithIdentifier.h" + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupIndexPassiveData) : public CMMCScBkupIndexWithIdentifier< TSecureId > + { + public: + + /** + * Static constructor + */ + static CMMCScBkupIndexPassiveData* NewLC(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupIndexPassiveData(); + + }; + + + + +#endif // __CMMCScBkupIndexPassiveData_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupIndexPublicDataFiles.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupIndexPublicDataFiles.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupIndexPublicDataFiles +* +* +*/ + +#ifndef __CMMCSCBKUPINDEXPUBLICDATAFILES_H__ +#define __CMMCSCBKUPINDEXPUBLICDATAFILES_H__ + +// System includes +#include + +// User includes +#include "CMMCScBkupIndexBase.h" + +// Classes referenced +class CMMCScBkupFileInfo; + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupIndexPublicDataFiles) : public CMMCScBkupIndexBase + { + public: + + /** + * Static constructor + */ + static CMMCScBkupIndexPublicDataFiles* NewLC(); + + /** + * C++ destructor + */ + ~CMMCScBkupIndexPublicDataFiles(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupIndexPublicDataFiles(); + + public: // API + + /** + * + */ + void AddIndexRecordL( const TMMCScBkupArchiveVector& aInfo, const CMMCScBkupFileInfo& aFile ); + + /** + * + */ + inline TInt Count() const { return iEntries.Count(); } + + /** + * + */ + const CMMCScBkupFileInfo& At( TInt aIndex, TMMCScBkupArchiveVector& aInfo ) const; + + public: // From CMMCScBkupIndexBase + + /** + * + */ + void StoreL( MMMCScBkupDriver& aDriver ); + + /** + * + */ + void RestoreL( MMMCScBkupDriver& aDriver ); + + private: // Internal classes + + /** + * + * @since 3.0 + */ + class TMMCScBkupPublicFileEntry + { + public: + inline TMMCScBkupPublicFileEntry() { } + inline TMMCScBkupPublicFileEntry(const TMMCScBkupArchiveVector& aInfo, const CMMCScBkupFileInfo& aFile) + : iInfo(aInfo), iFile(&aFile) + { + } + + public: // Data members + TMMCScBkupArchiveVector iInfo; + const CMMCScBkupFileInfo* iFile; + }; + + private: // Member data + + // + RArray iEntries; + + }; + + +#endif // __CMMCSCBKUPINDEXPUBLICDATAFILES_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupIndexSystemData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupIndexSystemData.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupIndexSystemData +* +* +*/ + +#ifndef __CMMCSCBKUPINDEXSYSTEMDATA_H__ +#define __CMMCSCBKUPINDEXSYSTEMDATA_H__ + +// System includes +#include + +// User includes +#include "CMMCScBkupIndexWithIdentifier.h" + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupIndexSystemData) : public CMMCScBkupIndexWithIdentifier< TInt32 > + { + public: + + /** + * Static constructor + */ + static CMMCScBkupIndexSystemData* NewLC(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupIndexSystemData(); + + }; + + + + + +#endif // __CMMCSCBKUPINDEXSYSTEMDATA_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupIndexWithIdentifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupIndexWithIdentifier.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,329 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupIndexWithIdentifier +* +* +*/ + +#ifndef __CMMCSCBKUPINDEXWITHIDENTIFIER_H__ +#define __CMMCSCBKUPINDEXWITHIDENTIFIER_H__ + +// User includes +#include "CMMCScBkupIndexBase.h" +#include "TMMCScBkupOwnerDataType.h" +#include "TMMCScBkupArchiveVector.h" +#include "MMMCScBkupArchiveDataInterface.h" + + + +/** +* +* +* @since 3.0 +*/ +template < class TIdentifier > +class CMMCScBkupIndexEntry : public CBase + { + public: + inline static CMMCScBkupIndexEntry* NewLC( const TIdentifier& aIdentifier ) + { + CMMCScBkupIndexEntry* self = new(ELeave) CMMCScBkupIndexEntry( aIdentifier ); + CleanupStack::PushL( self ); + return self; + } + + inline static CMMCScBkupIndexEntry* NewLC( RReadStream& aStream ) + { + CMMCScBkupIndexEntry* self = new(ELeave) CMMCScBkupIndexEntry(); + CleanupStack::PushL( self ); + aStream >> *self; + return self; + } + + inline ~CMMCScBkupIndexEntry() + { + iAssociatedData.Close(); + } + + private: + + inline CMMCScBkupIndexEntry() + { + } + + inline CMMCScBkupIndexEntry( const TIdentifier& aIdentifier ) + : iIdentifier( aIdentifier ) + { + } + + private: // Internal enumerations + enum + { + EStreamFormatVersion1 = 1 + }; + + public:// Store & Restore + + inline void InternalizeL( RReadStream& aStream ) + { + aStream.ReadInt32L(); // EStreamFormatVersion1 + aStream.ReadInt32L(); // spare1 + aStream.ReadInt32L(); // spare2 + aStream.ReadInt32L(); // spare3 + // + iIdentifier = aStream.ReadInt32L(); + // + const TInt count = aStream.ReadInt32L(); + for(TInt i=0; i> entry; + // + iAssociatedData.AppendL( entry ); + } + } + + inline void ExternalizeL( RWriteStream& aStream ) const + { + aStream.WriteInt32L( EStreamFormatVersion1 ); + aStream.WriteInt32L( 0 ); // spare1 + aStream.WriteInt32L( 0 ); // spare2 + aStream.WriteInt32L( 0 ); // spare3 + // + aStream.WriteInt32L( iIdentifier ); + // + const TInt count = iAssociatedData.Count(); + aStream.WriteInt32L(count); + // + for(TInt i=0; i& Entries() const + { return iAssociatedData; } + + private: + + /** + * + */ + TIdentifier iIdentifier; + + /** + * + */ + RArray iAssociatedData; + }; + + + + + + +/** +* +* +* @since 3.0 +*/ +template < class TIdentifier > +class CMMCScBkupIndexWithIdentifier : public CMMCScBkupIndexBase + { + + public: + + /** + * C++ destructor + */ + inline ~CMMCScBkupIndexWithIdentifier() + { + iEntries.Close(); + } + + protected: + + /** + * C++ default constructor + */ + inline CMMCScBkupIndexWithIdentifier( TMMCScBkupOwnerDataType aType ) + : CMMCScBkupIndexBase( aType ) + { + } + + private: // Internal enumerations + enum + { + EStreamFormatVersion1 = 1 + }; + + public: // API + + /** + * + */ + inline void AddIndexRecordL( const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive, const TIdentifier& aIdentifier ) + { + // Locate the parent + CMMCScBkupIndexEntry< TIdentifier >& entry = EntryByIdentifierL( aIdentifier ); + + // Create new sub-entry + TMMCScBkupArchiveDriveAndVector subItem; + subItem.iDrive = aDrive; + subItem.iVector = aInfo; + + // Add it to our index + entry.AddEntryL( subItem ); + } + + /** + * + */ + inline TInt Count() const + { return iEntries.Count(); } + + /** + * + */ + inline const CMMCScBkupIndexEntry< TIdentifier >& At( TInt aIndex ) const + { return *iEntries[ aIndex ]; } + + /** + * + */ + inline void StoreL(MMMCScBkupDriver& aDriver) + { + MMMCScBkupArchiveDataInterface& archiveDataInterface = aDriver.DrvADI(); + RWriteStream stream( archiveDataInterface.ADIWriteStreamUncompressedLC() ); + // + stream.WriteInt32L( EStreamFormatVersion1 ); + stream.WriteInt32L( 0 ); // spare1 + stream.WriteInt32L( 0 ); // spare2 + stream.WriteInt32L( 0 ); // spare3 + + const TInt count = iEntries.Count(); + stream.WriteInt32L( count ); + // + for(TInt i=0; i & entry = *iEntries[ i ]; + stream << entry; + } + // + stream.CommitL(); + CleanupStack::PopAndDestroy(); // stream + + // Update our base class info with the offset to the index + SetVector( archiveDataInterface.ADICurrentArchiveVectorInfo() ); + } + + /** + * + */ + inline void RestoreL(MMMCScBkupDriver& aDriver) + { + MMMCScBkupArchiveDataInterface& archiveDataInterface = aDriver.DrvADI(); + RReadStream stream( archiveDataInterface.ADIReadStreamUncompressedLC( Vector().Offset() ) ); + // + stream.ReadInt32L(); // EStreamFormatVersion1 + stream.ReadInt32L(); // spare1 + stream.ReadInt32L(); // spare2 + stream.ReadInt32L(); // spare3 + // + const TInt count = stream.ReadInt32L(); + for(TInt i=0; i* entry = CMMCScBkupIndexEntry< TIdentifier >::NewLC( stream ); + iEntries.AppendL( entry ); + CleanupStack::Pop( entry ); + } + // + CleanupStack::PopAndDestroy(); // stream + // + if ( archiveDataInterface.ADICurrentArchiveVectorInfo().Length() > Vector().Length() ) + { + // We've read too much! + User::Leave( KErrCorrupt ); + } + } + + private: // Internal methods + + /** + * + */ + inline CMMCScBkupIndexEntry< TIdentifier >* EntryByIdentifier( const TIdentifier& aIdentifier ) + { + CMMCScBkupIndexEntry< TIdentifier >* ret = NULL; + // + const TInt count = iEntries.Count(); + for( TInt i=count-1; i>=0; i-- ) + { + CMMCScBkupIndexEntry< TIdentifier >* entry = iEntries[ i ]; + if ( entry->Identifier() == aIdentifier ) + { + ret = entry; + break; + } + } + // + return ret; + } + + /** + * + */ + inline CMMCScBkupIndexEntry< TIdentifier >& EntryByIdentifierL( const TIdentifier& aIdentifier ) + { + CMMCScBkupIndexEntry< TIdentifier >* ret = EntryByIdentifier( aIdentifier ); + if ( !ret ) + { + // Need to make a new entry + ret = CMMCScBkupIndexEntry< TIdentifier >::NewLC( aIdentifier ); + iEntries.AppendL( ret ); + CleanupStack::Pop( ret ); + } + // + return *ret; + } + + private: // Member Data + + // + RMMCScBkupPointerArray< CMMCScBkupIndexEntry< TIdentifier > > iEntries; + }; + + + + + + +#endif // __CMMCSCBKUPINDEXWITHIDENTIFIER_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupOperationParameters.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupOperationParameters.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,356 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupOpParamsBase +* +* +*/ + +#ifndef __CMMCSCBKUPOPERATIONPARAMETERS_H__ +#define __CMMCSCBKUPOPERATIONPARAMETERS_H__ + +// System includes +#include +#include +#include +#include + +// User includes +#include "MMCScBkupOperations.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "RMMCScBkupPointerArray.h" + +// Namespaces +using namespace conn; + +// Classes referenced +class CMMCScBkupDriveAndOperationTypeManager; +class CMMCScBkupArchiveInfo; + +_LIT( KBackUpFolder, "\\Backup\\" ); +_LIT( KBackUpFiles, "*.arc" ); +const TInt KCArrayGranularity = 10; + +class TBkupDrivesAndOperation +{ +public: + TBkupDrivesAndOperation(){} + TBkupDrivesAndOperation( unsigned int drvCategories, unsigned int ownerDataType ); + TBkupDrivesAndOperation( const TBkupDrivesAndOperation &other ) + { + mDrvCategories = other.mDrvCategories; + mOwnerDataType = other.mOwnerDataType; + } + + void setDrvCategories( unsigned int drvCategories ){ mDrvCategories = drvCategories; } + void setOwnerDataType( unsigned int ownerDataType ){ mOwnerDataType = ownerDataType; } + + unsigned int drvCategories(){ return mDrvCategories; } + unsigned int ownerDataType(){ return mOwnerDataType; } +private: + unsigned int mDrvCategories; + unsigned int mOwnerDataType; +}; + +class CBkupCategory: CBase +{ +private: + + CBkupCategory() + { + } +public: + + static CBkupCategory* NewL() + { + CBkupCategory* self = NewLC(); + CleanupStack::Pop(self); + return self; + } + static CBkupCategory* NewLC() + { + CBkupCategory* self = new(ELeave) CBkupCategory(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + void ConstructL() + { + mUids = new ( ELeave ) CArrayFixFlat( KCArrayGranularity ); + mExclude_uids = new ( ELeave ) CArrayFixFlat( KCArrayGranularity ); + mArchive_name = 0; + } + + ~CBkupCategory() + { + mUids->Reset(); + mExclude_uids->Reset(); + delete mArchive_name; + } + + void setCategory( unsigned int category ) + { + mCategory = category; + } + + void setArchive_name( TDesC16& archive_name ) + { + if ( mArchive_name != 0 ) + { + delete mArchive_name; + } + TRAP_IGNORE( mArchive_name = HBufC::NewL( archive_name.Length() ) ); + *mArchive_name = archive_name; + } + + void setSpecial_flags( unsigned int special_flags ) + { + mSpecial_flags = special_flags; + } + + void setExclude_special_flags( unsigned int exclude_special_flags ) + { + mExclude_special_flags = exclude_special_flags; + } + + void addUids( unsigned int uid ) + { + TRAP_IGNORE( mUids->AppendL( uid, sizeof(unsigned int) ) ); + } + + void addExclude_uids( unsigned int exclude_uid ) + { + TRAP_IGNORE( mExclude_uids->AppendL( exclude_uid, sizeof(unsigned int) ) ); + } + + unsigned int category() { return mCategory; } + HBufC* archive_name() { return mArchive_name; } + unsigned int special_flags() { return mSpecial_flags; } + unsigned int exclude_special_flags() { return mExclude_special_flags; } + CArrayFixFlat* uids() { return mUids; } + CArrayFixFlat* exclude_uids() { return mExclude_uids; } + +private: + unsigned int mCategory; + HBufC* mArchive_name; + unsigned int mSpecial_flags; + unsigned int mExclude_special_flags; + CArrayFixFlat* mUids; + CArrayFixFlat* mExclude_uids; +}; + +typedef CArrayFixFlat BkupDrivesAndOperationList; +typedef RPointerArray BkupCategoryList; + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupOpParamsBase) : public CBase + { + public: + + /** + * + */ + IMPORT_C ~CMMCScBkupOpParamsBase(); + + protected: + + /** + * + */ + CMMCScBkupOpParamsBase( ); + + /** + * + */ + void ConstructL( BkupDrivesAndOperationList *aDriveList, TBitFlags aCategories ); + + public: // Common mandatory framework methods + + /** + * + */ + virtual TMMCScBkupOperationType AssociatedOpType() const = 0; + + /** + * + */ + virtual TBURPartType PartType() const = 0; + + /** + * + */ + virtual TBackupIncType IncrementType() const = 0; + + /** + * + */ + virtual TTransferDataType PassiveTransferType() const = 0; + + /** + * + */ + virtual TTransferDataType ActiveTransferType() const = 0; + + /** + * + */ + virtual TPackageDataType PackageTransferType() const = 0; + + public: // Common attributes + + /** + * + */ + IMPORT_C const CMMCScBkupDriveAndOperationTypeManager& DriveAndOperations() const; + + /** + * + */ + IMPORT_C void SetArchiveInfosL(RPointerArray& aInfos); + + /** + * + */ + RMMCScBkupPointerArray& ArchiveInfos(); + + /** + * + */ + const CMMCScBkupArchiveInfo& ArchiveInfo(TBitFlags aCategory) const; + + /** + * + */ + const TDesC& FileName(TInt aIndex) const; + + /** + * + */ + TBitFlags Categories() { return iCategories; } + + private: // Data members + + // + CMMCScBkupDriveAndOperationTypeManager* iDriveAndOperations; + // + RMMCScBkupPointerArray< CMMCScBkupArchiveInfo > iArchiveInfos; + // + TBitFlags iCategories; + }; + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupOpParamsBackupFull) : public CMMCScBkupOpParamsBase + { + public: + + /** + * + */ + IMPORT_C static CMMCScBkupOpParamsBackupFull* NewL( + BkupDrivesAndOperationList *aDriveList, + BkupCategoryList *aCategoryList, + TDriveNumber aDrive, TBitFlags aCategories ); + + /** + * + */ + IMPORT_C ~CMMCScBkupOpParamsBackupFull(); + + private: + + /** + * + */ + CMMCScBkupOpParamsBackupFull( TDriveNumber aDrive ); + + /** + * + */ + void ConstructL( BkupDrivesAndOperationList *aDriveList, + BkupCategoryList *aCategoryList, TBitFlags aCategories ); + + /** + * + */ + void ReadFromResourceL( BkupCategoryList *aCategoryList ); + + public: // From CMMCScBkupOpParamsBase + IMPORT_C TMMCScBkupOperationType AssociatedOpType() const; + IMPORT_C TBURPartType PartType() const; + IMPORT_C TBackupIncType IncrementType() const; + IMPORT_C TTransferDataType PassiveTransferType() const; + IMPORT_C TTransferDataType ActiveTransferType() const; + IMPORT_C TPackageDataType PackageTransferType() const; + + private: // Data members + + // + TDriveNumber iDrive; + }; + + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupOpParamsRestoreFull) : public CMMCScBkupOpParamsBase + { + public: + + /** + * + */ + IMPORT_C static CMMCScBkupOpParamsRestoreFull* NewL( + BkupDrivesAndOperationList *aDriveList, TBitFlags aCategories ); + + /** + * + */ + IMPORT_C ~CMMCScBkupOpParamsRestoreFull(); + + private: + + /** + * + */ + CMMCScBkupOpParamsRestoreFull(); + + public: // From CMMCScBkupOpParamsBase + IMPORT_C TMMCScBkupOperationType AssociatedOpType() const; + IMPORT_C TBURPartType PartType() const; + IMPORT_C TBackupIncType IncrementType() const; + IMPORT_C TTransferDataType PassiveTransferType() const; + IMPORT_C TTransferDataType ActiveTransferType() const; + IMPORT_C TPackageDataType PackageTransferType() const; + }; + + + + + +#endif // __CMMCSCBKUPOPERATIONPARAMETERS_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupState.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupState.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 2002 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: Declaration for CMMCScBkupState +* +* +*/ + +#ifndef __CMMCSCBKUPSTATE_H__ +#define __CMMCSCBKUPSTATE_H__ + +// System includes +#include + +// User includes +#include "MMMCScBkupDriver.h" +#include "MMCScBkupStateIds.h" +#include "RMMCScBkupPointerArray.h" +#include "MMMCScBkupArchiveDataInterface.h" + +// Namespaces +using namespace conn; + +// Classes referenced +class CMMCScBkupState; + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupState) : public CActive + { + public: + + /** + * Enumeration specifying how state is supposed to be handled + */ + enum TStateExecution + { + EStateOnce = 0, + EStatePerCategory, + EStatePerCategoryCommon + }; + + /** + * Destructor + */ + ~CMMCScBkupState(); + + protected: + + /** + * C++ default constructor + */ + CMMCScBkupState( MMMCScBkupDriver& aDriver, TInt aPriority = CActive::EPriorityIdle ); + + public: + + /** + * Return the unique RTTI id of this state + */ + virtual TMMCScBkupStateId StateId() const = 0; + + /** + * Return the next state that should be executed + * after this state has finished. This allows + * for dynamic changes in the state machine + */ + virtual TMMCScBkupStateId NextStateId() const = 0; + + /** + * Return false if no need for category specific actions, otherwise true + */ + virtual TStateExecution CategorySpecific() const { return EStateOnce; } + + /** + * Perform the action associated with this + * state + */ + void ExecuteL(TRequestStatus& aObserver); + + protected: // Virtual framework + + /** + * Perform the initial action associated with this + * state + */ + virtual void PerformStateInitL() = 0; + + /** + * Perform some asynchronous operation + */ + virtual void PerformAsynchronousStateStepL(); + + /** + * Perform some asynchronous cancellation + */ + virtual void PerformAsynchronousCancellation(); + + /** + * Called just before observer's request is completed + * in the case of an error-free operation. Not called + * when errors occur during state processing. + */ + virtual void PerformLastRightsL(); + + /** + * Called from RunError + */ + virtual TBool PerformAsynchronousErrorCleanup(TInt aError); + + private: // Virtual framework + + /** + * Default behaviour is to panic if called + */ + void RunL(); + + /** + * + */ + void DoCancel(); + + /** + * Default behaviour is to return KErrNone + */ + TInt RunError(TInt aError); + + protected: // Internal API + + /** + * + */ + inline MMMCScBkupDriver& Driver() const { return iDriver; } + + /** + * + */ + inline MMMCScBkupArchiveDataInterface& ADI() const { return iDriver.DrvADI(); } + + /** + * + */ + void CompleteSelf(TInt aCompletionCode = KErrNone); + + /** + * + */ + void SetObserver(TRequestStatus& aStatus); + + private: // Internal API + + /** + * + */ + void CompleteObserver(TInt aCompletionCode); + + private: // Member data + + // Driver + MMMCScBkupDriver& iDriver; + // Observer + TRequestStatus* iObserver; + }; + + + + + +#endif // __CMMCSCBKUPSTATE_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpActiveData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpActiveData.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpActiveData +* +* +*/ + +#ifndef __CMMCSCBKUPSTATEARCHIVEOPACTIVEDATA_H__ +#define __CMMCSCBKUPSTATEARCHIVEOPACTIVEDATA_H__ + +// System includes +#include + +// User includes +#include "CMMCScBkupStateOpAware.h" +#include "TMMCScBkupArchiveVector.h" +#include "CMMCScBkupTransferWriteRequest.h" +#include "CMMCScBkupTransferReadRequest.h" + +// Namespaces +using namespace conn; + +// Classes referenced +class CMMCScBkupDataOwnerInfo; + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpActiveData) : public CMMCScBkupStateOpAware, public MMMCScBkupIndexHandler + { + public: + + /** + * Static constructor + */ + static CMMCScBkupStateArchiveOpActiveData* NewL( MMMCScBkupDriver& aDriver ); + + /** + * C++ destructor + */ + ~CMMCScBkupStateArchiveOpActiveData( ); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateArchiveOpActiveData( MMMCScBkupDriver& aDriver ); + + public: // From CMMCScBkupState + TMMCScBkupStateId StateId() const; + + public: // From CMMCScBkupStateOpAware + TMMCScBkupStateId NextStateBackupId( TBool aPartial ) const; + TMMCScBkupStateId NextStateRestoreId( TBool aPartial ) const; + + private: // From CMMCScBkupStateOpAware + void PerformStateInitBackupL( TBool aPartial ); + void PerformStateInitRestoreL( TBool aPartial ); + void PerformAsynchronousStateStepBackupL( TBool aPartial ); + void PerformAsynchronousStateStepRestoreL( TBool aPartial ); + void PerformLastRightsBackupL( TBool aPartial ); + TBool PerformAsynchronousErrorCleanupBackup( TBool aPartial, TInt aError ); + TBool PerformAsynchronousErrorCleanupRestore( TBool aPartial, TInt aError ); + + private: // From CMMCScBkupState + void PerformAsynchronousCancellation(); + + private: // From MMMCScBkupIndexHandler + void AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ); + + private: // Internal members + + /** + * + */ + inline TBool AllDataOwnersHandled() const { return !iAtLeastOneDataOwnerIsNotYetReady; } + + /** + * + */ + void CheckNeedToStartRetryTimerL(); + + private: // Member data + + // + TInt iIndexValueCurrent; + // + TBool iAtLeastOneDataOwnerIsNotYetReady; + // + RTimer iTimer; + // + CMMCScBkupWriteDataTransferRequest< TTransferDataType >* iBackupTransferObject; + // + CMMCScBkupReadDataTransferRequest< TTransferDataType >* iRestoreTransferObject; + }; + + + + + + + + +#endif // __CMMCSCBKUPSTATEARCHIVEOPACTIVEDATA_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpArchiveFooter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpArchiveFooter.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpArchiveFooter +* +* +*/ + +#ifndef __CMMCSCBKUPSTATEARCHIVEOPARCHIVEFOOTER_H__ +#define __CMMCSCBKUPSTATEARCHIVEOPARCHIVEFOOTER_H__ + +// User includes +#include "CMMCScBkupState.h" + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpArchiveFooter) : public CMMCScBkupState + { + public: + + /** + * Static constructor + */ + static CMMCScBkupStateArchiveOpArchiveFooter* NewL( MMMCScBkupDriver& aDriver ); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateArchiveOpArchiveFooter( MMMCScBkupDriver& aDriver ); + + public: // From CMMCScBkupState + TMMCScBkupStateId StateId() const; + TMMCScBkupStateId NextStateId() const; + TStateExecution CategorySpecific() const { return EStatePerCategory; } + + private: // From CMMCScBkupState + void PerformStateInitL(); + void PerformAsynchronousStateStepL(); + }; + + +#endif // __CMMCSCBKUPSTATEARCHIVEOPARCHIVEFOOTER_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpArchiveHeader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpArchiveHeader.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpArchiveHeader +* +* +*/ + +#ifndef __CMMCSCBKUPSTATEARCHIVEOPARCHIVEHEADER_H__ +#define __CMMCSCBKUPSTATEARCHIVEOPARCHIVEHEADER_H__ + +// User includes +#include "CMMCScBkupState.h" + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpArchiveHeader) : public CMMCScBkupState + { + public: + + /** + * Static constructor + */ + static CMMCScBkupStateArchiveOpArchiveHeader* NewL( MMMCScBkupDriver& aDriver ); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateArchiveOpArchiveHeader( MMMCScBkupDriver& aDriver ); + + public: // From CMMCScBkupState + TMMCScBkupStateId StateId() const; + TMMCScBkupStateId NextStateId() const; + TStateExecution CategorySpecific() const { return EStatePerCategory; } + + private: // From CMMCScBkupState + void PerformStateInitL(); + void PerformAsynchronousStateStepL(); + }; + + +#endif // __CMMCSCBKUPSTATEARCHIVEOPARCHIVEHEADER_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpDataOwners.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpDataOwners.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpDataOwners +* +* +*/ + +#ifndef __CMMCSCBKUPSTATEARCHIVEOPDATAOWNERS_H__ +#define __CMMCSCBKUPSTATEARCHIVEOPDATAOWNERS_H__ + +// User includes +#include "CMMCScBkupStateOpAware.h" + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpDataOwners) : public CMMCScBkupStateOpAware + { + public: + + /** + * Static constructor + */ + static CMMCScBkupStateArchiveOpDataOwners* NewL( MMMCScBkupDriver& aDriver ); + + /** + * C++ destructor + */ + ~CMMCScBkupStateArchiveOpDataOwners(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateArchiveOpDataOwners( MMMCScBkupDriver& aDriver ); + + public: // From CMMCScBkupState + TMMCScBkupStateId StateId() const; + + public: // From CMMCScBkupStateOpAware + TMMCScBkupStateId NextStateBackupId( TBool aPartial ) const; + TMMCScBkupStateId NextStateRestoreId( TBool aPartial ) const; + + private: // From CMMCScBkupStateOpAware + + private: // From CMMCScBkupState + void PerformStateInitBackupL( TBool aPartial ); + void PerformStateInitRestoreL( TBool aPartial ); + // + void PerformAsynchronousStateStepBackupL( TBool aPartial ); + void PerformAsynchronousStateStepRestoreL( TBool aPartial ); + // + void PerformLastRightsBackupL( TBool aPartial ); + void PerformLastRightsRestoreL( TBool aPartial ); + // + TBool PerformAsynchronousErrorCleanupRestore( TBool aPartial, TInt aError ); + + private: // Member data + + // + TInt iIndexValueCurrent; + }; + + +#endif // __CMMCSCBKUPSTATEARCHIVEOPDATAOWNERS_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpJavaData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpJavaData.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpJavaData +* +* +*/ + +#ifndef __CMMCSCBKUPSTATEARCHIVEOPJAVADATA_H__ +#define __CMMCSCBKUPSTATEARCHIVEOPJAVADATA_H__ + +// System includes +#include + +// User includes +#include "CMMCScBkupStateOpAware.h" +#include "TMMCScBkupArchiveVector.h" +#include "CMMCScBkupTransferWriteRequest.h" +#include "CMMCScBkupTransferReadRequest.h" + +// Namespaces +using namespace conn; + +// Classes referenced +class CMMCScBkupDataOwnerInfo; + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpJavaData) : public CMMCScBkupStateOpAware, public MMMCScBkupIndexHandler + { + public: + + /** + * Static constructor + */ + static CMMCScBkupStateArchiveOpJavaData* NewL( MMMCScBkupDriver& aDriver ); + + /** + * C++ destructor + */ + ~CMMCScBkupStateArchiveOpJavaData( ); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateArchiveOpJavaData( MMMCScBkupDriver& aDriver ); + + public: // From CMMCScBkupState + TMMCScBkupStateId StateId() const; + + public: // From CMMCScBkupStateOpAware + TMMCScBkupStateId NextStateBackupId( TBool aPartial ) const; + TMMCScBkupStateId NextStateRestoreId( TBool aPartial ) const; + + private: // From CMMCScBkupStateOpAware + void PerformStateInitBackupL( TBool aPartial ); + void PerformStateInitRestoreL( TBool aPartial ); + void PerformAsynchronousStateStepBackupL( TBool aPartial ); + void PerformAsynchronousStateStepRestoreL( TBool aPartial ); + void PerformLastRightsBackupL( TBool aPartial ); + void PerformLastRightsRestoreL( TBool aPartial ); + TBool PerformAsynchronousErrorCleanupBackup( TBool aPartial, TInt aError ); + TBool PerformAsynchronousErrorCleanupRestore( TBool aPartial, TInt aError ); + + private: // From CMMCScBkupState + void PerformAsynchronousCancellation(); + + private: // From MMMCScBkupIndexHandler + void AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ); + + private: // Internal enumerations + enum TJavaState + { + EJavaStateIdle = 0, + EJavaStateMidlet, + EJavaStateMidletData + }; + + private: // Internal methods + void BackupMidletL(); + void BackupMidletDataL(); + void RestoreMidletL(); + void RestoreMidletDataL(); + + private: // Member data + + // + TInt iIndexValueCurrent; + // + TJavaState iCurrentJavaState; + // + RArray iRestoreEntries; + // + CMMCScBkupWriteDataTransferRequest< TJavaTransferType >* iBackupTransferObjectMidlet; + CMMCScBkupWriteDataTransferRequest< TJavaTransferType >* iBackupTransferObjectMidletData; + CMMCScBkupReadDataTransferRequest< TJavaTransferType >* iRestoreTransferObjectMidlet; + CMMCScBkupReadDataTransferRequest< TJavaTransferType >* iRestoreTransferObjectMidletData; + }; + + + + + +#endif // __CMMCSCBKUPSTATEARCHIVEOPJAVADATA_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpPassiveData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpPassiveData.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpPassiveData +* +* +*/ + +#ifndef __CMMCSCBKUPSTATEARCHIVEOPPASSIVEDATA_H__ +#define __CMMCSCBKUPSTATEARCHIVEOPPASSIVEDATA_H__ + +// System includes +#include + +// User includes +#include "CMMCScBkupStateOpAware.h" +#include "TMMCScBkupArchiveVector.h" +#include "CMMCScBkupTransferWriteRequest.h" +#include "CMMCScBkupTransferReadRequest.h" + +// Namespaces +using namespace conn; + +// Classes referenced +class CMMCScBkupDataOwnerInfo; + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpPassiveData) : public CMMCScBkupStateOpAware, public MMMCScBkupIndexHandler + { + public: + + /** + * Static constructor + */ + static CMMCScBkupStateArchiveOpPassiveData* NewL( MMMCScBkupDriver& aDriver ); + + /** + * C++ destructor + */ + ~CMMCScBkupStateArchiveOpPassiveData( ); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateArchiveOpPassiveData( MMMCScBkupDriver& aDriver ); + + public: // From CMMCScBkupState + TMMCScBkupStateId StateId() const; + + public: // From CMMCScBkupStateOpAware + TMMCScBkupStateId NextStateBackupId( TBool aPartial ) const; + TMMCScBkupStateId NextStateRestoreId( TBool aPartial ) const; + + private: // From CMMCScBkupStateOpAware + void PerformStateInitBackupL( TBool aPartial ); + void PerformStateInitRestoreL( TBool aPartial ); + void PerformAsynchronousStateStepBackupL( TBool aPartial ); + void PerformAsynchronousStateStepRestoreL( TBool aPartial ); + void PerformLastRightsBackupL( TBool aPartial ); + TBool PerformAsynchronousErrorCleanupBackup( TBool aPartial, TInt aError ); + TBool PerformAsynchronousErrorCleanupRestore( TBool aPartial, TInt aError ); + + private: // From CMMCScBkupState + void PerformAsynchronousCancellation(); + + private: // From MMMCScBkupIndexHandler + void AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ); + + private: // Member data + + // + TInt iIndexValueCurrent; + // + CMMCScBkupWriteDataTransferRequest< TTransferDataType >* iBackupTransferObject; + // + CMMCScBkupReadDataTransferRequest< TTransferDataType >* iRestoreTransferObject; + }; + + + + +#endif // __CMMCSCBKUPSTATEARCHIVEOPPASSIVEDATA_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpPublicDataFiles.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpPublicDataFiles.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpPublicDataFiles +* +* +*/ + +#ifndef __CMMCSCBKUPSTATEARCHIVEOPPUBLICDATAFILES_H__ +#define __CMMCSCBKUPSTATEARCHIVEOPPUBLICDATAFILES_H__ + +// System includes +#include + +// User includes +#include "CMMCScBkupStateOpAware.h" + +// Namespaces +using namespace conn; + +// Classes referenced +class CMMCScBkupDataOwnerInfo; + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpPublicDataFiles) : public CMMCScBkupStateOpAware + { + public: + + /** + * Static constructor + */ + static CMMCScBkupStateArchiveOpPublicDataFiles* NewL( MMMCScBkupDriver& aDriver ); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateArchiveOpPublicDataFiles( MMMCScBkupDriver& aDriver ); + + public: // From CMMCScBkupState + TMMCScBkupStateId StateId() const; + + public: // From CMMCScBkupStateOpAware + TMMCScBkupStateId NextStateBackupId( TBool aPartial ) const; + TMMCScBkupStateId NextStateRestoreId( TBool aPartial ) const; + + private: // From CMMCScBkupStateOpAware + void PerformStateInitBackupL( TBool aPartial ); + void PerformStateInitRestoreL( TBool aPartial ); + void PerformAsynchronousStateStepBackupL( TBool aPartial ); + void PerformAsynchronousStateStepRestoreL( TBool aPartial ); + void PerformLastRightsBackupL( TBool aPartial ); + void PerformLastRightsRestoreL( TBool aPartial ); + TBool PerformAsynchronousErrorCleanupBackup( TBool aPartial, TInt aError ); + TBool PerformAsynchronousErrorCleanupRestore( TBool aPartial, TInt aError ); + void PerformAsynchronousCancellation(); + + private: // Internal enumerations + + /** + * + */ + enum TState + { + EStateCommonIdle = 0, + EStateCommonKickOff, + EStateCommonProcessingFile, + EStateBackupAddIndexRecord, + EStateRestoreResetAttributes + }; + + private: // Internal methods + + /** + * + */ + void CompressingAndWritingFileL(); + + /** + * + */ + void DecompressingAndWritingFileL(); + + /** + * + */ + void AddIndexRecordL(); + + /** + * + */ + void RestoreFileAttributesL(); + + /** + * + */ + inline void SetState(TState aState) { iState = aState; } + + /** + * + */ + inline TState State() const { return iState; } + + private: // Member data + + // + TInt iIndexValueCurrent; + // + TState iState; + }; + + +#endif // __CMMCSCBKUPSTATEARCHIVEOPPUBLICDATAFILES_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpSystemData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateArchiveOpSystemData.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateArchiveOpSystemData +* +* +*/ + +#ifndef __CMMCSCBKUPSTATEARCHIVEOPSYSTEMDATA_H__ +#define __CMMCSCBKUPSTATEARCHIVEOPSYSTEMDATA_H__ + +// System includes +#include + +// User includes +#include "CMMCScBkupStateOpAware.h" +#include "TMMCScBkupArchiveVector.h" +#include "CMMCScBkupTransferWriteRequest.h" +#include "CMMCScBkupTransferReadRequest.h" + +// Namespaces +using namespace conn; + +// Classes referenced +class CMMCScBkupDataOwnerInfo; + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateArchiveOpSystemData) : public CMMCScBkupStateOpAware, public MMMCScBkupIndexHandler + { + public: + + /** + * Static constructor + */ + static CMMCScBkupStateArchiveOpSystemData* NewL( MMMCScBkupDriver& aDriver ); + + /** + * C++ destructor + */ + ~CMMCScBkupStateArchiveOpSystemData( ); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateArchiveOpSystemData( MMMCScBkupDriver& aDriver ); + + public: // From CMMCScBkupState + TMMCScBkupStateId StateId() const; + + public: // From CMMCScBkupStateOpAware + TMMCScBkupStateId NextStateBackupId( TBool aPartial ) const; + TMMCScBkupStateId NextStateRestoreId( TBool aPartial ) const; + + private: // From CMMCScBkupStateOpAware + void PerformStateInitBackupL( TBool aPartial ); + void PerformStateInitRestoreL( TBool aPartial ); + void PerformAsynchronousStateStepBackupL( TBool aPartial ); + void PerformAsynchronousStateStepRestoreL( TBool aPartial ); + void PerformLastRightsBackupL( TBool aPartial ); + void PerformLastRightsRestoreL( TBool aPartial ); + TBool PerformAsynchronousErrorCleanupBackup( TBool aPartial, TInt aError ); + TBool PerformAsynchronousErrorCleanupRestore( TBool aPartial, TInt aError ); + + private: // From CMMCScBkupState + void PerformAsynchronousCancellation(); + + private: // From MMMCScBkupIndexHandler + void AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ); + + private: // Member data + + // + TInt iIndexValueCurrent; + // Associated secure id of the data owner (if it has one) + TSecureId iSecureId; + // + CMMCScBkupWriteDataTransferRequest< TPackageDataType >* iBackupTransferObject; + CMMCScBkupReadDataTransferRequest< TPackageDataType >* iRestoreTransferObject; + }; + + + + + +#endif // __CMMCSCBKUPSTATEARCHIVEOPSYSTEMDATA_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateFactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateFactory.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateFactory +* +* +*/ + +#ifndef __CMMCSCBKUPSTATEFACTORY_H__ +#define __CMMCSCBKUPSTATEFACTORY_H__ + +// User includes +#include "MMCScBkupStateIds.h" +#include "MMCScBkupOperations.h" + +// Classes referenced +class CMMCScBkupState; +class MMMCScBkupDriver; + +// Type definitions +typedef RPointerArray RMMCScBkupStateArray; + + + +/** +* +* +* @since 3.0 +*/ +class CMMCScBkupStateFactory : public CBase + { + public: + /** + * + */ + static CMMCScBkupStateFactory* FactoryByOperationTypeLC( TMMCScBkupOperationType aOperationType ); + + protected: + + /** + * + */ + CMMCScBkupStateFactory(); + + public: // From CMMCScBkupStateFactory + + /** + * + */ + virtual CMMCScBkupState* GetStateLC(TMMCScBkupStateId aCurrentState, MMMCScBkupDriver& aDriver) = 0; + }; + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateFactoryBackup) : public CMMCScBkupStateFactory + { + public: + static CMMCScBkupStateFactoryBackup* NewL(); + + private: + CMMCScBkupStateFactoryBackup(); + + public: // From CMMCScBkupStateFactory + CMMCScBkupState* GetStateLC(TMMCScBkupStateId aRequiredType, MMMCScBkupDriver& aDriver); + }; + + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateFactoryRestore) : public CMMCScBkupStateFactory + { + public: + static CMMCScBkupStateFactoryRestore* NewL(); + + private: + CMMCScBkupStateFactoryRestore(); + + public: // From CMMCScBkupStateFactory + CMMCScBkupState* GetStateLC(TMMCScBkupStateId aRequiredType, MMMCScBkupDriver& aDriver); + }; + + + + +#endif // __CMMCSCBKUPSTATEFACTORY_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateGetDataOwnerStatuses.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateGetDataOwnerStatuses.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateGetDataOwnerStatuses +* +* +*/ + +#ifndef __CMMCSCBKUPSTATEGETDATAOWNERSTATUSES_H__ +#define __CMMCSCBKUPSTATEGETDATAOWNERSTATUSES_H__ + +// User includes +#include "CMMCScBkupState.h" + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateGetDataOwnerStatuses) : public CMMCScBkupState + { + public: + + /** + * Static constructor + */ + static CMMCScBkupStateGetDataOwnerStatuses* NewL( MMMCScBkupDriver& aDriver ); + + /** + * C++ destructor + */ + ~CMMCScBkupStateGetDataOwnerStatuses( ); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateGetDataOwnerStatuses( MMMCScBkupDriver& aDriver ); + + public: // From CMMCScBkupState + TMMCScBkupStateId StateId() const; + TMMCScBkupStateId NextStateId() const; + TStateExecution CategorySpecific() const { return EStatePerCategory; } + + private: // From CMMCScBkupState + void PerformStateInitL(); + void PerformAsynchronousStateStepL(); + + private: // Internal state enumeration + + /** + * + */ + enum TState + { + EPrearingQuery = 0, + EGettingStatus, + EProcessingResults + }; + + private: // Internal methods + inline TState State() const { return iState; } + inline void SetState(TState aState) { iState = aState; } + // + void PrepareQueryL(); + void ProcessStatusResultsL(); + + private: // Member data + + // + RSIDStatusArray iStatusArray; + // + TState iState; + }; + + + + +#endif // __CMMCSCBKUPSTATEGETDATAOWNERSTATUSES_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateGetDataOwners.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateGetDataOwners.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateGetDataOwners +* +* +*/ + +#ifndef __CMMCSCBKUPSTATEGETDATAOWNERS_H__ +#define __CMMCSCBKUPSTATEGETDATAOWNERS_H__ + +// User includes +#include "CMMCScBkupState.h" + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateGetDataOwners) : public CMMCScBkupState + { + public: + + /** + * Static constructor + */ + static CMMCScBkupStateGetDataOwners* NewL( MMMCScBkupDriver& aDriver ); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateGetDataOwners( MMMCScBkupDriver& aDriver ); + + public: // From CMMCScBkupState + TMMCScBkupStateId StateId() const; + TMMCScBkupStateId NextStateId() const; + + private: // From CMMCScBkupState + void PerformStateInitL(); + void PerformAsynchronousStateStepL(); + }; + + + + +#endif // __CMMCSCBKUPSTATEGETDATAOWNERS_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateNotifyAllSnapshotsSupplied.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateNotifyAllSnapshotsSupplied.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateNotifyAllSnapshotsSupplied +* +* +*/ + +#ifndef __CMMCSCBKUPSTATENOTIFYALLSNAPSHOTSSUPPLIED_H__ +#define __CMMCSCBKUPSTATENOTIFYALLSNAPSHOTSSUPPLIED_H__ + +// User includes +#include "MMCScBkupOperations.h" +#include "CMMCScBkupState.h" + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateNotifyAllSnapshotsSupplied) : public CMMCScBkupState + { + public: + + /** + * Static constructor + */ + static CMMCScBkupStateNotifyAllSnapshotsSupplied* NewL( MMMCScBkupDriver& aDriver ); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateNotifyAllSnapshotsSupplied( MMMCScBkupDriver& aDriver ); + + public: // From CMMCScBkupState + TMMCScBkupStateId StateId() const; + TMMCScBkupStateId NextStateId() const; + + private: // From CMMCScBkupState + void PerformStateInitL(); + }; + + + + +#endif // __CMMCSCBKUPSTATENOTIFYALLSNAPSHOTSSUPPLIED_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateOpAware.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateOpAware.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateOpAware +* +* +*/ + +#ifndef __CMMCSCBKUPSTATEOPAWARE_H__ +#define __CMMCSCBKUPSTATEOPAWARE_H__ + +// User includes +#include "CMMCScBkupState.h" +#include "MMCScBkupOperations.h" + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateOpAware) : public CMMCScBkupState + { + protected: + + /** + * C++ default constructor + */ + CMMCScBkupStateOpAware( MMMCScBkupDriver& aDriver, TInt aPriority = CActive::EPriorityIdle ); + + public: // From CMMCScBkupState + + /** + * + */ + TMMCScBkupStateId NextStateId() const; + + /** + * + */ + TStateExecution CategorySpecific() const { return EStatePerCategory; } + + protected: // New Framework + + /** + * + */ + virtual TMMCScBkupStateId NextStateBackupId( TBool aPartial ) const = 0; + + /** + * + */ + virtual TMMCScBkupStateId NextStateRestoreId( TBool aPartial ) const = 0; + + protected: // New Framework + + /** + * + */ + virtual void PerformStateInitBackupL( TBool aPartial ) = 0; + + /** + * + */ + virtual void PerformStateInitRestoreL( TBool aPartial ) = 0; + + /** + * + */ + virtual void PerformAsynchronousStateStepBackupL( TBool aPartial ); + + /** + * + */ + virtual void PerformAsynchronousStateStepRestoreL( TBool aPartial ); + + /** + * + */ + virtual void PerformAsynchronousCancellationBackup( TBool aPartial ); + + /** + * + */ + virtual void PerformAsynchronousCancellationRestore( TBool aPartial ); + + /** + * + */ + virtual void PerformLastRightsBackupL( TBool aPartial ); + + /** + * + */ + virtual void PerformLastRightsRestoreL( TBool aPartial ); + + /** + * + */ + virtual TBool PerformAsynchronousErrorCleanupBackup( TBool aPartial, TInt aError ); + + /** + * + */ + virtual TBool PerformAsynchronousErrorCleanupRestore( TBool aPartial, TInt aError ); + + protected: // From CMMCScBkupState + void PerformStateInitL(); + void PerformAsynchronousStateStepL(); + void PerformAsynchronousCancellation(); + void PerformLastRightsL(); + TBool PerformAsynchronousErrorCleanup( TInt aError ); + }; + + + + + +#endif // __CMMCSCBKUPSTATEOPAWARE_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateRequestListOfPublicFiles.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateRequestListOfPublicFiles.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateRequestListOfPublicFiles +* +* +*/ + +#ifndef __CMMCSCBKUPSTATEREQUESTLISTOFPUBLICFILES_H__ +#define __CMMCSCBKUPSTATEREQUESTLISTOFPUBLICFILES_H__ + +// User includes +#include "CMMCScBkupState.h" +#include "CMMCScBkupDriveSpecificRequest.h" + +// Namespaces +using namespace conn; + +// Classes referenced +class CMMCScBkupDataOwnerInfo; +class CMMCScBkupStateRequestSpecificPublicFileInfo; + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateRequestListOfPublicFiles) : public CMMCScBkupState + { + public: + + /** + * Static constructor + */ + static CMMCScBkupStateRequestListOfPublicFiles* NewL( MMMCScBkupDriver& aDriver ); + + /** + * C++ destructor + */ + ~CMMCScBkupStateRequestListOfPublicFiles( ); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateRequestListOfPublicFiles( MMMCScBkupDriver& aDriver ); + + /** + * Second phase constructor + */ + void ConstructL( ); + + public: // From CMMCScBkupState + TMMCScBkupStateId StateId() const; + TMMCScBkupStateId NextStateId() const; + TStateExecution CategorySpecific() const { return EStatePerCategory; } + + private: // From CMMCScBkupState + void PerformStateInitL(); + void PerformAsynchronousStateStepL(); + TBool PerformAsynchronousErrorCleanup(TInt aError); + void PerformAsynchronousCancellation(); + void PerformLastRightsL(); + + private: // Data members + + // + TInt iCurrentDataOwnerIndex; + // + CMMCScBkupStateRequestSpecificPublicFileInfo* iRequestObject; + }; + + + + + + + +/** +* +* +* @since 3.0 +*/ +class CMMCScBkupStateRequestSpecificPublicFileInfo : public CMMCScBkupDriveSpecificRequest + { + public: + + /** + * + */ + static CMMCScBkupStateRequestSpecificPublicFileInfo* NewL( MMMCScBkupDriver& aDriver ); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateRequestSpecificPublicFileInfo( MMMCScBkupDriver& aDriver ); + + public: // API + + /** + * + */ + void RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver ); + + private: // From CActive + void RunL(); + void DoCancel(); + + private: // Internal methods + inline MMMCScBkupDriver& Driver() { return iDriver; } + + private: // Member data + + // + MMMCScBkupDriver& iDriver; + // + CMMCScBkupDataOwnerInfo* iOwner; + }; + + + + + + + +#endif // __CMMCSCBKUPSTATEREQUESTLISTOFPUBLICFILES_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateRequestSizeOfBackupData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateRequestSizeOfBackupData.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateRequestSizeOfBackupData +* +* +*/ + +#ifndef __CMMCSCBKUPSTATEREQUESTSIZEOFBACKUPDATA_H__ +#define __CMMCSCBKUPSTATEREQUESTSIZEOFBACKUPDATA_H__ + +// User includes +#include "MMCScBkupOperations.h" +#include "CMMCScBkupState.h" +#include "CMMCScBkupDriveSpecificRequest.h" + +// Classes referenced +class CMMCScBkupDataOwnerInfo; +class CMMCScBkupStateRequestSizeOfDataOwner; + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateRequestSizeOfBackupData) : public CMMCScBkupState + { + public: + + /** + * Static constructor + */ + static CMMCScBkupStateRequestSizeOfBackupData* NewL( MMMCScBkupDriver& aDriver ); + + /** + * C++ destructor + */ + ~CMMCScBkupStateRequestSizeOfBackupData( ); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateRequestSizeOfBackupData( MMMCScBkupDriver& aDriver ); + + /** + * Second phase constructor + */ + void ConstructL( ); + + public: // From CMMCScBkupState + TMMCScBkupStateId StateId() const; + TMMCScBkupStateId NextStateId() const; + TStateExecution CategorySpecific() const { return EStatePerCategory; } + + private: // From CMMCScBkupState + void PerformStateInitL(); + void PerformAsynchronousStateStepL(); + TBool PerformAsynchronousErrorCleanup( TInt aError ); + void PerformAsynchronousCancellation(); + + private: // Data members + + // + TInt iCurrentDataOwnerIndex; + // + CMMCScBkupStateRequestSizeOfDataOwner* iRequestObject; + }; + + + + + + + +/** +* NB. This class only sizes active, passive, system and java data. Public +* data is sized elsewhere. +* +* @since 3.0 +*/ +class CMMCScBkupStateRequestSizeOfDataOwner : public CMMCScBkupDriveSpecificRequest + { + public: + + /** + * + */ + static CMMCScBkupStateRequestSizeOfDataOwner* NewL( MMMCScBkupDriver& aDriver ); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateRequestSizeOfDataOwner( MMMCScBkupDriver& aDriver ); + + public: // API + + /** + * + */ + void RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver ); + + private: // From CActive + void RunL(); + void DoCancel(); + + private: // Internal methods + inline MMMCScBkupDriver& Driver() { return iDriver; } + // + TUint GetActiveAndPassiveDataSizesL( const CDataOwnerInfo& aOwner, CSBGenericDataType& aIdentifier, TDriveNumber aDrive ); + TUint GetSIDSpecificSizeL( TSecureId aSecureID, TDriveNumber aDrive, TTransferDataType aDataType ); + TUint GetSystemDataSizesL( const CDataOwnerInfo& aOwner, CSBGenericDataType& aIdentifier, TDriveNumber aDrive ); + TUint GetJavaDataSizesL( const CDataOwnerInfo& aOwner, CSBGenericDataType& aIdentifier, TDriveNumber aDrive ); + TUint GetJavaSpecificSizeL( const TDesC& aHash, TDriveNumber aDrive, TJavaTransferType aDataType ); + + private: // Member data + + // + MMMCScBkupDriver& iDriver; + // + CMMCScBkupDataOwnerInfo* iOwner; + }; + + + + + +#endif // __CMMCSCBKUPSTATEREQUESTSIZEOFBACKUPDATA_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateSetPhoneMode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateSetPhoneMode.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupStateSetPhoneMode +* +* +*/ + +#ifndef __CMMCSCBKUPSTATESETPHONEMODE_H__ +#define __CMMCSCBKUPSTATESETPHONEMODE_H__ + +// User includes +#include "MMCScBkupOperations.h" +#include "CMMCScBkupState.h" + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateSetPhoneMode) : public CMMCScBkupState + { + public: + + /** + * Static constructor + */ + static CMMCScBkupStateSetPhoneMode* NewL( MMMCScBkupDriver& aDriver ); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateSetPhoneMode( MMMCScBkupDriver& aDriver ); + + public: // From CMMCScBkupState + TMMCScBkupStateId StateId() const; + TMMCScBkupStateId NextStateId() const; + + private: // From CMMCScBkupState + void PerformStateInitL(); + void PerformAsynchronousStateStepL(); + }; + + + + +#endif // __CMMCSCBKUPSTATESETPHONEMODE_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupStateValidateDiskSpace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupStateValidateDiskSpace.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration for CMMCScBkupStateValidateDiskSpace +* +* +*/ + +#ifndef __CMMCSCBKUPSTATEVALIDATEDISKSPACE_H__ +#define __CMMCSCBKUPSTATEVALIDATEDISKSPACE_H__ + +// User includes +#include "CMMCScBkupState.h" + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupStateValidateDiskSpace) : public CMMCScBkupState + { + public: + + /** + * Static constructor + */ + static CMMCScBkupStateValidateDiskSpace* NewL( MMMCScBkupDriver& aDriver ); + + /** + * Destructor + */ + ~CMMCScBkupStateValidateDiskSpace(); + + private: + + /** + * C++ default constructor + */ + CMMCScBkupStateValidateDiskSpace( MMMCScBkupDriver& aDriver ); + + // Second phase + void ConstructL( ); + + public: // From CMMCScBkupState + TMMCScBkupStateId StateId() const; + TMMCScBkupStateId NextStateId() const; + TStateExecution CategorySpecific() const { return EStatePerCategoryCommon; } + + private: // From CMMCScBkupState + void PerformStateInitL(); + void PerformAsynchronousStateStepL(); + + private: // Internal methods + + /** + * + */ + void ValidateFreeSpaceBeforeBackupL(); + void ValidateFreeSpaceBeforeRestoreL(); + + private: // Member data + + // + TInt64 iCumulatedSize; + // + RArray iDriveSizes; + // + RArray iDriveMaxFileSizes; + }; + + +#endif // __CMMCSCBKUPSTATEVALIDATEDISKSPACE_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupTransferReadRequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupTransferReadRequest.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupReadDataTransferRequestBase +* +* +*/ + +#ifndef __CMMCSCBKUPTRANSFERREADREQUEST_H__ +#define __CMMCSCBKUPTRANSFERREADREQUEST_H__ + +// User includes +#include "MMCScBkupConfig.h" +#include "MMCScBkupSBEUtils.h" +#include "TMMCScBkupOwnerDataType.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "CMMCScBkupTransferRequest.h" +#include "CMMCScBkupIndexWithIdentifier.h" + +// Classes referenced +class MMMCScBkupDriver; +class CMMCScBkupArchiveFooter; + +// Constants +const TInt KMMCScBkupDefaultChunkReadSize = 4096; // 4k read chunks + +// CMMCScBkupIndexEntry + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupReadDataTransferRequestBase) : public CMMCScBkupTransferRequestBase + { + public: + + /** + * C++ destructor + */ + ~CMMCScBkupReadDataTransferRequestBase(); + + protected: + + /** + * C++ default constructor + */ + CMMCScBkupReadDataTransferRequestBase( MMMCScBkupDriver& aDriver, + TMMCScBkupOwnerDataType aElementType, + TInt aChunkSize = KMMCScBkupDefaultChunkReadSize, + TInt aPriority = CActive::EPriorityIdle ); + + public: // API + + /** + * + */ + void RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver, const RArray& aEntries ); + + protected: // New Framework API + + /** + * + */ + virtual CSBGenericTransferType* PrepareTransferTypeL( const CSBGenericDataType& aGeneric, + TDriveNumber aDrive, TInt aVersion ) const = 0; + + private: // From CMMCScBkupTransferRequest + TBool ProcessChunkOfDataL(); + void PrepareDataTransferL(); + + private: // Internal methods + + /** + * + */ + void ReadChunkL( TDes8& aSink, TInt aLength ); + + /** + * + */ + TBool DoProcessChunkOfDataL(); + + /** + * + */ + TBool PrepareForNextEntry(); + + /** + * + */ + TDriveNumber CurrentDrive() const; + + /** + * + */ + const TMMCScBkupArchiveVector& CurrentReadInfo() const; + + /** + * + */ + const TMMCScBkupArchiveDriveAndVector& CurrentEntry() const; + + /** + * + */ + inline TInt CurrentOffset() const { return iCurrentOffset; } + + private: // From CActive + TInt RunError( TInt aError ); + + private: // Debugging support + + /** + * + */ +#ifdef DEBUGGING_DATA_TRANSFER + void DumpTransferDataL( RFs& aFsSession, const TDesC8& aData ) const; +#endif + + private: // Member data + + // Owned externally + // + const RArray* iEntries; + + // Owned by this object + + // Pointer to the SBE's shared chunk. It *must* be a reference + // because otherwise the SBE loses track of what we actually write + // to the chunk! + TPtr8* iTransferChunkPointer; + // + const TInt iReadChunkSize; + // + TInt iCurrentIndex; + // + TBool iFinishedSupplyingData; + // + CSBGenericTransferType* iTransferType; + // + TInt iCurrentOffset; + // + HBufC8* iTemporaryTransferSink; + }; + + + + + + + + + +/** +* +* +* @since 3.0 +*/ +template +class CMMCScBkupReadDataTransferRequest : public CMMCScBkupReadDataTransferRequestBase + { + public: // Construction + + /** + * + */ + inline static CMMCScBkupReadDataTransferRequest* NewL( MMMCScBkupDriver& aDriver, + TMMCScBkupOwnerDataType aElementType, + Type aTransferEnumType, + TInt aChunkSize = KMMCScBkupDefaultChunkReadSize, + TInt aPriority = CActive::EPriorityIdle ) + { + CMMCScBkupReadDataTransferRequest* self = new(ELeave) CMMCScBkupReadDataTransferRequest( aDriver, aElementType, aTransferEnumType, aChunkSize, aPriority ); + return self; + } + + private: // Internal construction + + /** + * C++ default constructor + */ + inline CMMCScBkupReadDataTransferRequest( MMMCScBkupDriver& aDriver, + TMMCScBkupOwnerDataType aElementType, + Type aTransferEnumType, + TInt aChunkSize = KMMCScBkupDefaultChunkReadSize, + TInt aPriority = CActive::EPriorityIdle ) + : CMMCScBkupReadDataTransferRequestBase( aDriver, aElementType, aChunkSize, aPriority), + iTransferEnumType( aTransferEnumType ) + { + } + + private: // From CMMCScBkupTransferRequest + inline CSBGenericTransferType* PrepareTransferTypeL( const CSBGenericDataType& aGeneric, + TDriveNumber aDrive, TInt aVersion ) const + { + CSBGenericTransferType* transferType = MMCScBkupSBEUtils::TransferTypeLC( aGeneric, aDrive, + iTransferEnumType, aVersion ); + CleanupStack::Pop( transferType ); + return transferType; + } + + private: // Member data + + // + Type iTransferEnumType; + }; + + + +#endif // __CMMCSCBKUPTRANSFERREADREQUEST_H__ + +// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupTransferRequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupTransferRequest.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,225 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupTransferRequestBase +* +* +*/ + +#ifndef __CMMCSCBKUPTRANSFERREQUEST_H__ +#define __CMMCSCBKUPTRANSFERREQUEST_H__ + +// System includes +#include +#include + +// User includes +#include "TMMCScBkupDriveFilter.h" +#include "TMMCScBkupOwnerDataType.h" +#include "TMMCScBkupArchiveVector.h" + +// Namespaces +using namespace conn; + +// Classes referenced +class CMMCScBkupDataOwnerInfo; +class MMMCScBkupDriver; +class TMMCScBkupArchiveVector; + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupTransferRequestBase) : public CActive + { + public: + + /** + * C++ destructor + */ + ~CMMCScBkupTransferRequestBase(); + + protected: + + /** + * C++ default constructor + */ + CMMCScBkupTransferRequestBase( MMMCScBkupDriver& aDriver, TMMCScBkupOwnerDataType aElementType, TBool aUpdateOperationalSizes = ETrue, TInt aPriority = CActive::EPriorityIdle ); + + public: // API + + /** + * + */ + virtual void RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver ); + + protected: // From CActive + void RunL(); + void DoCancel(); + TInt RunError( TInt aError ); + + protected: // State relation + + /** + * + */ + enum TState + { + EIdle = 0, + EFinished, + // + ETransferData, + EProcessData + }; + + /** + * + */ + inline TState State() const { return iState; } + + /** + * + */ + inline void SetState( TState aState ) { iState = aState; } + + protected: // Internal framework API + + /** + * + */ + virtual TBool ProcessChunkOfDataL() = 0; + + /** + * + */ + virtual void PrepareDataTransferL() = 0; + + /** + * + */ + virtual TDriveNumber CurrentDrive() const = 0; + + /** + * + */ + virtual void SingleDriveTransferCompleteL(); + + /** + * + */ + virtual void TransferCompleteL(); + + protected: // Internal methods + + /** + * + */ + void CompleteSelf( TInt aCompletionCode = KErrNone ); + + /** + * + */ + inline MMMCScBkupDriver& Driver() { return iDriver; } + + /** + * + */ + inline CMMCScBkupDataOwnerInfo& DataOwner() { return *iDataOwner; } + + /** + * + */ + inline const CMMCScBkupDataOwnerInfo& DataOwner() const { return *iDataOwner; } + + /** + * + */ + inline TMMCScBkupArchiveVector& Info() { return iCurrentInfo; } + + /** + * + */ + inline const TMMCScBkupArchiveVector& Info() const { return iCurrentInfo; } + + /** + * + */ + inline TMMCScBkupOwnerDataType ElementType() const { return iElementType; } + + /** + * + */ + inline void DataTransferred( TInt aAmount ) { iDataTransferred += aAmount; } + + /** + * + */ + inline TInt AmountOfDataTransferred() const { return iDataTransferred; } + + /** + * + */ + inline void ResetDataTransferCounter() { iDataTransferred = 0; } + + private: // Internal methods + + /** + * + */ + void SetObserver( TRequestStatus& aObserver ); + + /** + * + */ + void CompleteObserverRequest( TInt aCompletionCode ); + + private: // Internal state methods + + /** + * + */ + void ProcessDataChunkL(); + + private: // Member data + + // Owned externally + // + MMMCScBkupDriver& iDriver; + // + CMMCScBkupDataOwnerInfo* iDataOwner; + // + TRequestStatus* iObserver; + + // Owned by this class + // + TInt iDataTransferred; + // + TState iState; + // + TMMCScBkupArchiveVector iCurrentInfo; + // + const TMMCScBkupOwnerDataType iElementType; + // + const TBool iUpdateOperationalSizes; + }; + + + + + + +#endif // __CMMCSCBKUPTRANSFERREQUEST_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/CMMCScBkupTransferWriteRequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupTransferWriteRequest.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,235 @@ +/* +* Copyright (c) 2005 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: Declaration for CMMCScBkupWriteDataTransferRequestBase +* +* +*/ + +#ifndef __CMMCSCBKUPTRANSFERWRITEREQUEST_H__ +#define __CMMCSCBKUPTRANSFERWRITEREQUEST_H__ + +// User includes +#include "MMCScBkupConfig.h" +#include "MMCScBkupSBEUtils.h" +#include "TMMCScBkupOwnerDataType.h" +#include "CMMCScBkupTransferRequest.h" +#include "CMMCScBkupDataOwnerInfo.h" + +// Classes referenced +class CMMCScBkupArchiveFooter; +class CMMCScBkupDriveAndOperationTypeManager; + +/** +* +* +* @since 3.0 +*/ +class MMMCScBkupIndexHandler + { + public: + + /** + * + */ + virtual void AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ) = 0; + }; + + + + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(CMMCScBkupWriteDataTransferRequestBase) : public CMMCScBkupTransferRequestBase + { + public: + + /** + * C++ destructor + */ + ~CMMCScBkupWriteDataTransferRequestBase(); + + public: // API + + /** + * + */ + void RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver, const CMMCScBkupDriveAndOperationTypeManager& aDriveAndOperations ); + + protected: + + /** + * C++ default constructor + */ + CMMCScBkupWriteDataTransferRequestBase( MMMCScBkupDriver& aDriver, + MMMCScBkupIndexHandler& aIndexHandler, + TMMCScBkupOwnerDataType aElementType, + TSBDerivedType aExpectedTransferType, + TInt aPriority = CActive::EPriorityIdle ); + + protected: // New Framework API + + /** + * + */ + virtual CSBGenericTransferType* PrepareTransferTypeL( const CSBGenericDataType& aGeneric, + TDriveNumber aDrive, TInt aVersion ) const = 0; + + protected: // From CMMCScBkupTransferRequestBase + + /** + * + */ + TBool ProcessChunkOfDataL(); + + /** + * + */ + void PrepareDataTransferL(); + + /** + * + */ + TDriveNumber CurrentDrive() const; + + private: // Internal methods + + /** + * + */ + inline void SetCurrentDrive( TDriveNumber aDrive ) { iCurrentDrive = aDrive; } + + /** + * + */ + void ValidateTransferInfoL( CSBGenericTransferType* aInfo ); + + /** + * + */ + void RequestDataTransferL(); + + private: // From CActive + TInt RunError( TInt aError ); + + private: + + /** + * + */ +#ifdef DEBUGGING_DATA_TRANSFER + void DumpTransferDataL( RFs& aFsSession, const TDesC8& aData ) const; +#endif + + + private: // Member data + + // Owned by this class + // + TMMCScBkupDriveFilter iDriveFilter; + // + MMMCScBkupIndexHandler& iIndexHandler; + // + const TSBDerivedType iExpectedTransferType; + // + const CMMCScBkupDriveAndOperationTypeManager* iDriveAndOperations; + // + RWriteStream iStream; + // + TBool iStreamIsOpen; + // + CSBGenericTransferType* iTransferType; + // + TBool iAdditionalTransferRequired; + // + TDriveNumber iCurrentDrive; + }; + + + + + + + + + + + +/** +* +* +* @since 3.0 +*/ +template +class CMMCScBkupWriteDataTransferRequest : public CMMCScBkupWriteDataTransferRequestBase + { + public: // Construction + + /** + * Static constructor + */ + inline static CMMCScBkupWriteDataTransferRequest* NewL( MMMCScBkupDriver& aDriver, + MMMCScBkupIndexHandler& aIndexHandler, + TMMCScBkupOwnerDataType aElementType, + TSBDerivedType aExpectedTransferType, + Type aTransferEnumType, + TInt aPriority = CActive::EPriorityIdle ) + { + CMMCScBkupWriteDataTransferRequest* self = new(ELeave) CMMCScBkupWriteDataTransferRequest( aDriver, aIndexHandler, aElementType, aExpectedTransferType, aTransferEnumType, aPriority ); + return self; + } + + private: // Internal construction + + /** + * C++ default constructor + */ + inline CMMCScBkupWriteDataTransferRequest( MMMCScBkupDriver& aDriver, + MMMCScBkupIndexHandler& aIndexHandler, + TMMCScBkupOwnerDataType aElementType, + TSBDerivedType aExpectedTransferType, + Type aTransferEnumType, + TInt aPriority ) + : CMMCScBkupWriteDataTransferRequestBase( aDriver, aIndexHandler, aElementType, aExpectedTransferType, aPriority ), + iTransferEnumType( aTransferEnumType ) + { + } + + private: // From CMMCScBkupTransferRequest + inline CSBGenericTransferType* PrepareTransferTypeL( const CSBGenericDataType& aGeneric, + TDriveNumber aDrive, TInt aVersion ) const + { + CSBGenericTransferType* transferType = MMCScBkupSBEUtils::TransferTypeLC( aGeneric, aDrive, + iTransferEnumType, aVersion ); + CleanupStack::Pop( transferType ); + return transferType; + } + + private: // Member data + + // + Type iTransferEnumType; + }; + + + + + +#endif // __CMMCSCBKUPTRANSFERWRITEREQUEST_H__ + +// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/MMCScBkupArchiveFlags.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/MMCScBkupArchiveFlags.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2005 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: Declaration for TMMCScBkupArchiveFlags +* +* +*/ + +#ifndef __MMCSCBKUPARCHIVEFLAGS_H__ +#define __MMCSCBKUPARCHIVEFLAGS_H__ + +enum TMMCScBkupArchiveFlags + { + EMMCScBkupArchiveFlagsDefault = 0x000, + EMMCScBkupArchiveFlagsContentValid = 0x001 + }; + + +#endif // __MMCSCBKUPARCHIVEFLAGS_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/MMCScBkupArchiveUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/MMCScBkupArchiveUtils.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,176 @@ +/* +* Copyright (c) 2005 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: Declaration for MMCScBkupArchiveUtils +* +* +*/ + +#ifndef __MMCSCBKUPARCHIVEUTILS_H__ +#define __MMCSCBKUPARCHIVEUTILS_H__ + +// System includes +#include +#include +#include + +// User includes +#include "TMMCScBkupArchiveVector.h" + +// Classes referenced +class CMMCScBkupArchiveHeader; +class MMMCScBkupArchiveDataInterface; + +// Constants +const TInt KMMCScBkupArchiveFileFormatFirstRestorableMajorVersion = 1; +const TInt KMMCScArchiveUidsByteCount = sizeof( TCheckedUid ); +const TInt KMMCScArchiveVersionByteCount = sizeof( TInt8 ) + sizeof( TInt8 ) + sizeof( TInt16 ); +const TInt KMMCScArchiveFooterLengthByteCount = sizeof( TUint32 ); +const TInt KMMCScArchiveFlagsByteCount = sizeof( TUint32 ); +const TInt KMMCScArchiveCrcByteCount = sizeof( TUint32 ); +const TInt KMMCScArchiveCategoryByteCount = sizeof( TUint32 ); +const TInt KMMCScSpareByteCount = 5 * sizeof(TInt32); +const TInt KMMCScArchivePhoneModelStringLength = sizeof(TUint8); + +/** +* +* +* @since 3.0 +*/ +class MMCScBkupArchiveUtils + { + public: // API + + /** + * + */ + static void ArchiveUidType( TUidType& aType ); + + /** + * + */ + static void ArchiveCheckedUid( TCheckedUid& aCheckedUids ); + + /** + * + */ + static HBufC8* PhoneModelFromArchiveLC( MMMCScBkupArchiveDataInterface& aADI ); + + /** + * + */ + static void ReadPhoneValidityInformationL( RFs& aFsSession, const TDesC& aFileName, HBufC8*& aPhoneModelData, TBitFlags& aArchiveFlags, TVersion& aArchiveVersion ); + + /** + * + */ + static TVersion ArchiveRunTimeFileFormatVersion(); + + /** + * + */ + static const TMMCScBkupArchiveVector& WriteHeaderL( MMMCScBkupArchiveDataInterface& aADI, TBitFlags aCategory ); + + /** + * + */ + static const TMMCScBkupArchiveVector& ReadHeaderL( MMMCScBkupArchiveDataInterface& aADI, CMMCScBkupArchiveHeader& aHeader ); + + /** + * + */ + static void SetArchiveContentAsValidL( RFile64& aArchive ); + + /** + * + */ + static void SetFooterLengthL( RFile64& aArchive, TInt aLength ); + + /** + * + */ + static TBitFlags ReadBkUpCategoryInformationL( RFs& aFsSession, const TDesC& aFileName ); + +#ifdef RD_FILE_MANAGER_BACKUP + /** + * + */ + static void SetArchiveCrcsL( RFile64& aArchive, TUint32 aCrc ); + + /** + * + */ + static TBool ValidateArchiveCrcsL( RFs& aFsSession, const TDesC& aFileName ); +#endif + + private: // Offsets + enum + { + EArchiveOffsetUids = 0, + EArchiveOffsetFileFormatVersion = EArchiveOffsetUids + KMMCScArchiveUidsByteCount, + EArchiveOffsetFooterLength = EArchiveOffsetFileFormatVersion + KMMCScArchiveVersionByteCount, + EArchiveOffsetArchiveFlags = EArchiveOffsetFooterLength + KMMCScArchiveFooterLengthByteCount, + EArchiveOffsetArchivePayloadCRC = EArchiveOffsetArchiveFlags + KMMCScArchiveFlagsByteCount, + EArchiveOffsetArchiveCategory = EArchiveOffsetArchivePayloadCRC + KMMCScArchiveCrcByteCount, + EArchiveOffsetArchiveHeaderCRC = EArchiveOffsetArchiveCategory + KMMCScArchiveCategoryByteCount, + EArchiveOffsetPadding = EArchiveOffsetArchiveHeaderCRC + KMMCScArchiveCrcByteCount, + EArchiveOffsetPhoneModelStringLength = EArchiveOffsetPadding + KMMCScSpareByteCount, + EArchiveOffsetPhoneModelString = EArchiveOffsetPhoneModelStringLength + KMMCScArchivePhoneModelStringLength + }; + + private: // Internal methods + + /** + * + */ + static TInt OffsetOfModelInformation(); + + /** + * + */ + static HBufC8* PhoneModelFromArchiveLC( RReadStream& aStream ); + + /** + * + */ + static TUint32 DefaultArchiveFlags(); + + /** + * + */ + static TBitFlags ReadArchiveFlagsL( RFile64& aFile ); + + /** + * + */ + static void ReadArchiveVersionL( RFile64& aFile, TVersion& aVersion ); + +#ifdef RD_FILE_MANAGER_BACKUP + /** + * + */ + static void SetArchiveCrcL( RFile64& aArchive, TUint32 aCrc, TUint aOffset ); + + /** + * + */ + static void CalculateCrcFromArchive( TUint32& aCrc, RFile64& aArchive, TUint32 aOffset, TUint32 aLength ); +#endif + }; + + + + +#endif // __MMCSCBKUPARCHIVEUTILS_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/MMCScBkupConfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/MMCScBkupConfig.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,154 @@ +/* +* Copyright (c) 2005 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: Macros for scheduled backup configuration +* +* +*/ + +#ifndef __MMCSCBKUPCONFIG_H__ +#define __MMCSCBKUPCONFIG_H__ + +// System includes +#include +#include + + +/** +* +* +* @since 3.0 +*/ +const TDriveNumber KMMCScBkupTempFileDrive = EDriveC; + + +/** +* +* Folder for temporary files, which will be cleaned by Starter if temporary files not deleted. +* Currently in 3.0/3.1 folder from C and E drives is cleaned. +* +* @since 3.0 +*/ +_LIT(KMMCScBkupTempDir, ":\\System\\Temp\\"); + + +/** +* +* +* @since 3.0 +*/ +_LIT(KMMCScBkupMediaGalleryThumbnailFolder, "*\\_PAlbTN\\*"); //Photo Album Thumbnail folder +_LIT(KMMCScBkupVideoCenterFolderPath, "C:\\Data\\videocenter\\"); //video center folder +_LIT(KMMCScBkupVideoCenterFolder, "*\\videocenter\\*"); //video center folder +/** +* +* Allows the data that is received from the SBE or sent to the SBE to be dumped to individual +* files for comparison and inspection purposes. +* +* @since 3.0 +*/ +//#define DEBUGGING_DATA_TRANSFER + +/** +* +* Controls the various directories and files that are generated when debugging +* data transfer +* +* @since 3.0 +*/ +#ifdef DEBUGGING_DATA_TRANSFER + _LIT(KMMCScBkupDataTransferDebuggingAllFiles, "*.*"); + _LIT(KMMCScBkupDataTransferDebuggingFileName, "MMCBackupDataTransfer_0x%08x_(%c).dat"); + // + _LIT(KMMCScBkupDataTransferDebuggingPathRoot, "MMCDataDump\\"); + _LIT(KMMCScBkupDataTransferDebuggingPathDataJava, "JavData\\"); + _LIT(KMMCScBkupDataTransferDebuggingPathDataSystem, "SysData\\"); + _LIT(KMMCScBkupDataTransferDebuggingPathDataPassive, "PasData\\"); + _LIT(KMMCScBkupDataTransferDebuggingPathDataActive, "ActData\\"); + // + _LIT(KMMCScBkupDataTransferDebuggingPathDataBackup, "Backup\\"); + _LIT(KMMCScBkupDataTransferDebuggingPathDataRestore, "Restore\\"); +#endif + +/** +* +* Always makes the SBE logging directory - ensures logs are available +* +* @since 3.0 +*/ +//#define MAKE_SBE_LOGGING_DIRECTORY + +/** +* +* Always makes the MMC Engine logging directory +* +* @since 3.0 +*/ +//#define MAKE_MMCSCBKUP_LOGGING_DIRECTORY + +/** +* +* Controls whether logging is to file or to RDebug +* +* @since 3.0 +*/ +//#ifdef _DEBUG +//# define __MMCSCBKUPLOGGING_ENABLED__ +//#if defined(__MMCSCBKUPLOGGING_ENABLED__) +//# define __MMCSCBKUP_DATA_LOGGING_ENABLED__ +//#endif +# define __MMCSCBKUPLOGGING_MODE_FILE__ +//# define __MMCSCBKUPLOGGING_MODE_RDEBUG__ +//#endif + + +/** +* Use these to disable backup for the various data types. +* +* E.g: +* +* __DEBUG_TESTING_SKIP_BACKUP_REG_DATA return +* +* ... will ensure that registration data is not backed up (for any DO). +* +* @since 3.0 +*/ +#define __DEBUG_TESTING_SKIP_BACKUP_REG_DATA +#define __DEBUG_TESTING_SKIP_BACKUP_ACT_DATA +#define __DEBUG_TESTING_SKIP_BACKUP_PAS_DATA +#define __DEBUG_TESTING_SKIP_BACKUP_SYS_DATA +#define __DEBUG_TESTING_SKIP_BACKUP_JAV_DATA +#define __DEBUG_TESTING_SKIP_BACKUP_PUB_DATA + +/** +* Use these to disable restore for the various data types +* +* E.g: +* +* __DEBUG_TESTING_SKIP_RESTORE_REG_DATA return +* +* ... will ensure that registration data is not restored (for any DO). +* +* @since 3.0 +*/ +#define __DEBUG_TESTING_SKIP_RESTORE_REG_DATA +#define __DEBUG_TESTING_SKIP_RESTORE_ACT_DATA +#define __DEBUG_TESTING_SKIP_RESTORE_PAS_DATA +#define __DEBUG_TESTING_SKIP_RESTORE_SYS_DATA +#define __DEBUG_TESTING_SKIP_RESTORE_JAV_DATA +#define __DEBUG_TESTING_SKIP_RESTORE_PUB_DATA + + +#endif // __MMCSCBKUPCONFIG_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/MMCScBkupDllUids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/MMCScBkupDllUids.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2002 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: +* Contains the UIDs for FileManager / FileManagerBkupEngine +* +*/ + +#ifndef __MMCSCBKUPDLLUIDS_H__ +#define __MMCSCBKUPDLLUIDS_H__ + +// Module UIDs +#define KEPOCDLLUID2 0x1000008d // Symbian defined +#define KMMCAppEngUID3 0x2002BCC2 + +#endif // __MMCSCBKUPDLLUIDS_H__ + +// End Of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/MMCScBkupLogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/MMCScBkupLogger.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2005 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: +* Macro definition file for logging. +* +* +*/ + +#ifndef __MMCSCBKUPLOGGER_H__ +#define __MMCSCBKUPLOGGER_H__ + +// System includes +#include + +// User includes +#include "MMCScBkupConfig.h" +#include "TMMCScBkupOwnerDataType.h" + +class MMCScBkupLogger + { + public: + static void LogRaw( const TDesC& aData ); + static void Log( TRefByValue aFmt, ... ); + static void LogFile( TRefByValue aFmt, ... ); + static const TDesC& DataType( TMMCScBkupOwnerDataType aType ); + static const TDesC& FriendlyNameForSID( TSecureId aSID ); + }; + + +// Logging Macros +#if defined(__MMCSCBKUPLOGGING_ENABLED__) + + _LIT( KMMCScBkupLoggingFullPath, "C:\\Logs\\MMCScBkup\\" ); + + #define __LOG(aFmt) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes); } + #define __LOG1(aFmt, A) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A); } + #define __LOG2(aFmt, A, B) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A, B); } + #define __LOG3(aFmt, A, B, C) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A, B, C); } + #define __LOG4(aFmt, A, B, C, D) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A, B, C, D); } + #define __LOG5(aFmt, A, B, C, D, E) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A, B, C, D, E); } + #define __LOG6(aFmt, A, B, C, D, E, F) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A, B, C, D, E, F); } + #define __LOG7(aFmt, A, B, C, D, E, F, G) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A, B, C, D, E, F, G); } + #define __LOG8(aFmt, A, B, C, D, E, F, G, H) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::Log(tempLogDes, A, B, C, D, E, F, G, H); } + + // Path for backup log containing possible errors encountered during backup + // or restore. This is needed because all errors won't interrupt operation. + _LIT( KMMCScBkupLoggingFullPathAndName, "C:\\Private\\101F84EB\\BURLog\\bur.txt" ); + + #define __LOGFILE(aFmt) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::LogFile(tempLogDes); } + #define __LOGFILE1(aFmt, A) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::LogFile(tempLogDes, A); } + #define __LOGFILE2(aFmt, A, B) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::LogFile(tempLogDes, A, B); } + #define __LOGFILE3(aFmt, A, B, C) { _LIT(tempLogDes, aFmt); MMCScBkupLogger::LogFile(tempLogDes, A, B, C); } + +#else + + #define __LOG(aFmt) + #define __LOG1(aFmt, A) + #define __LOG2(aFmt, A, B) + #define __LOG3(aFmt, A, B, C) + #define __LOG4(aFmt, A, B, C, D) + #define __LOG5(aFmt, A, B, C, D, E) + #define __LOG6(aFmt, A, B, C, D, E, F) + #define __LOG7(aFmt, A, B, C, D, E, F, G) + #define __LOG8(aFmt, A, B, C, D, E, F, G, H) + + #define __LOGFILE(aFmt) + #define __LOGFILE1(aFmt, A) + #define __LOGFILE2(aFmt, A, B) + #define __LOGFILE3(aFmt, A, B, C) + +#endif + +#endif // __MMCSCBKUPLOGGER_H__ diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/MMCScBkupOperations.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/MMCScBkupOperations.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2005 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: Declaration for TMMCScBkupOperationType +* +* +*/ + +#ifndef __MMCSCBKUPOPERATIONS_H__ +#define __MMCSCBKUPOPERATIONS_H__ + +// System includes +#include + + +/** +* +* +* @since 3.0 +*/ +enum TMMCScBkupOperationType + { + EMMCScBkupOperationTypeIdle = 0, + EMMCScBkupOperationTypeFullBackup, + EMMCScBkupOperationTypeFullRestore, + EMMCScBkupOperationTypePartialBackup, + EMMCScBkupOperationTypePartialRestore + }; + + + + +#endif // __MMCSCBKUPOPERATIONS_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/MMCScBkupPhoneModelUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/MMCScBkupPhoneModelUtils.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2005 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: Declaration for MMCScBkupPhoneModelUtils +* +* +*/ + +#ifndef __MMCSCBKUPPHONEMODELUTILS_H__ +#define __MMCSCBKUPPHONEMODELUTILS_H__ + +// System includes +#include +#include + +/** +* +* +* @since 3.0 +*/ +class MMCScBkupPhoneModelUtils + { + public: + + /** + * + */ + static HBufC8* CurrentPhoneModelLC(); + + /** + * + */ + static TInt MaximumPhoneModelIdentifierLength(); + + /** + * + */ + static TBool ArchiveRestorePermissableL( const TDesC8& aPhoneModelData, TBitFlags aArchiveFlags, const TVersion& aArchiveVersion ); + }; + + + + +#endif // __MMCScBkupPhoneModelUtils_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/MMCScBkupSBEUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/MMCScBkupSBEUtils.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2005 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: Declaration for MMCScBkupSBEUtils +* +* +*/ + +#ifndef __MMCSCBKUPSBEUTILS_H__ +#define __MMCSCBKUPSBEUTILS_H__ + +// System includes +#include +#include +#include + +// Namespaces +using namespace conn; + + +/** +* +* +* @since 3.0 +*/ +class MMCScBkupSBEUtils + { + public: + + /** + * + */ + static TSecureId SecureIdFromGenericL(const CSBGenericDataType& aGeneric); + + /** + * + */ + static TUid PackageIdFromGenericL(const CSBGenericDataType& aGeneric); + + /** + * + */ + static HBufC* JavaHashFromGenericLC(const CSBGenericDataType& aGeneric); + + /** + * + */ + static CSBGenericDataType* CopyLC(const CSBGenericDataType& aToBeCopied); + + /** + * + */ + static CSBGenericTransferType* TransferTypeLC(const CSBGenericDataType& aDT, TDriveNumber aDrive, + TTransferDataType aTransferType, TInt aVersion); + + /** + * + */ + static CSBGenericTransferType* TransferTypeLC(const CSBGenericDataType& aDT, TDriveNumber aDrive, + TPackageDataType aDataType, TInt aVersion); + + /** + * + */ + static CSBGenericTransferType* TransferTypeLC(const CSBGenericDataType& aDT, TDriveNumber aDrive, + TJavaTransferType aDataType, TInt aVersion); + + /** + * + */ + static TBool PhoneIsInBackupOrRestoreModeL(); + + /** + * + */ + static void EndBackupOrRestoreL( CSBEClient& aSBEClient ); + + /** + * + */ + static TBool HasSystemDataL( const CDataOwnerInfo& aDataOwner ); + + /** + * + */ + static TBool HasJavaDataL( const CDataOwnerInfo& aDataOwner ); + + /** + * + */ + static TBool HasPassiveDataL( const CDataOwnerInfo& aDataOwner ); + + /** + * + */ + static TBool HasActiveDataL( const CDataOwnerInfo& aDataOwner ); + + /** + * + */ + static TBool HasPublicDataL( const CDataOwnerInfo& aDataOwner ); + }; + + + + +#endif // __MMCSCBKUPSBEUTILS_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/MMCScBkupStateIds.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/MMCScBkupStateIds.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,247 @@ +/* +* Copyright (c) 2005 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: Constants for scheduled backup state IDs +* +* +*/ + +#ifndef __MMCSCBKUPSTATEIDS_H__ +#define __MMCSCBKUPSTATEIDS_H__ + +// System includes +#include + +// Type definitions +typedef TUid TMMCScBkupStateId; + +// Constants + + +/** +* Archive Header +* =========================== +* +* BACKUP: Step 1 - first archive write operation: store archive header +* RESTORE: Step 1 - first archive read operation: restore archive header +*/ +const TInt32 KMMCScBkupStateIdValueArchiveOpArchiveHeader = 0x0BAC001; +const TMMCScBkupStateId KMMCScBkupStateArchiveOpArchiveHeader = { KMMCScBkupStateIdValueArchiveOpArchiveHeader }; + +/** +* Obtain List of Data Owners +* ========================== +* +* BACKUP: Step 2 - Get list of data owners from SBE +*/ +const TInt32 KMMCScBkupStateIdValueGetDataOwners = 0x0BAC0002; +const TMMCScBkupStateId KMMCScBkupStateIdGetDataOwners = { KMMCScBkupStateIdValueGetDataOwners }; + +/** +* Set Smartphone into Backup Mode +* =============================== +* +* BACKUP: Step 3 +* RESTORE: +*/ +const TInt32 KMMCScBkupStateIdValueSetPhoneMode = 0x0BAC0003; +const TMMCScBkupStateId KMMCScBkupStateIdSetPhoneMode = { KMMCScBkupStateIdValueSetPhoneMode }; + +/** +* Supply Data Snapshots (Not Currently Supported) +* =============================================== +* +* BACKUP: Step 4 +*/ +const TInt32 KMMCScBkupStateIdValueSupplyDataSnapshots = 0x0BAC0004; // Not supported +const TMMCScBkupStateId KMMCScBkupStateIdSupplyDataSnapshots = { KMMCScBkupStateIdValueSupplyDataSnapshots }; + +/** +* Inform the Device that All Snapshots Have Been Supplied +* ======================================================= +* +* BACKUP: Step 5 +*/ +const TInt32 KMMCScBkupStateIdValueNotifyAllSnapshotsSupplied = 0x0BAC0005; +const TMMCScBkupStateId KMMCScBkupStateIdNotifyAllSnapshotsSupplied = { KMMCScBkupStateIdValueNotifyAllSnapshotsSupplied }; + +/** +* Request Size of Backup Data +* =========================== +* +* BACKUP: Step 6 +*/ +const TInt32 KMMCScBkupStateIdValueRequestSizeOfBackupData = 0x0BAC0006; +const TMMCScBkupStateId KMMCScBkupStateIdRequestSizeOfBackupData = { KMMCScBkupStateIdValueRequestSizeOfBackupData }; + +/** +* Archive Operation: data owners +* ============================== +* +* BACKUP: Step 7 - second archive write operation: store data owners +*/ +const TInt32 KMMCScBkupStateIdValueArchiveOpDataOwners = 0x0BAC0007; +const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpDataOwners = { KMMCScBkupStateIdValueArchiveOpDataOwners }; + +/** +* Request List of Public Files +* ============================ +* +* BACKUP: Step 8 +*/ +const TInt32 KMMCScBkupStateIdValueRequestListOfPublicFiles = 0x0BAC0008; +const TMMCScBkupStateId KMMCScBkupStateIdRequestListOfPublicFiles = { KMMCScBkupStateIdValueRequestListOfPublicFiles }; + +/** +* Calculate disk space required for backup or restore +* ============================ +* +* BACKUP: Step 8 +*/ +const TInt32 KMMCScBkupStateIdValueValidateDiskSpace = 0x0BAC0009; +const TMMCScBkupStateId KMMCScBkupStateIdValidateDiskSpace = { KMMCScBkupStateIdValueValidateDiskSpace }; + + +/** +* Archive Operation: public data files +* ==================================== +* +* BACKUP: Step 10 - forth archive write operation: store public data files +*/ +const TInt32 KMMCScBkupStateIdValueArchiveOpPublicDataFiles = 0x0BAC000A; +const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpPublicDataFiles = { KMMCScBkupStateIdValueArchiveOpPublicDataFiles }; + +/** +* Request System Data +* =================== +* +* BACKUP: Step 11 - fifth archive write operation: store system data +*/ +const TInt32 KMMCScBkupStateIdValueArchiveOpSystemData = 0x0BAC000B; +const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpSystemData = { KMMCScBkupStateIdValueArchiveOpSystemData }; + +/** +* Request Java Data +* =================== +* +* BACKUP: Step 12 - sixth archive write operation: store system data +*/ +const TInt32 KMMCScBkupStateIdValueArchiveOpJavaData = 0x0BAC000C; +const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpJavaData = { KMMCScBkupStateIdValueArchiveOpJavaData }; + +/** +* Request Request State of Active Data Owners +* =========================================== +* +* BACKUP: Step 13 +*/ +const TInt32 KMMCScBkupStateIdValueGetDataOwnerStatuses = 0x0BAC000D; +const TMMCScBkupStateId KMMCScBkupStateIdGetDataOwnerStatuses = { KMMCScBkupStateIdValueGetDataOwnerStatuses }; + +/** +* Request Active Private Data +* =========================== +* +* BACKUP: Step 14 - seventh archive write operation: store active data +*/ +const TInt32 KMMCScBkupStateIdValueArchiveOpActiveData = 0x0BAC000E; +const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpActiveData = { KMMCScBkupStateIdValueArchiveOpActiveData }; + +/** +* Request Passive Private Data +* =========================== +* +* BACKUP: Step 15 - eighth archive write operation: store passive data +*/ +const TInt32 KMMCScBkupStateIdValueArchiveOpPassiveData = 0x0BAC000F; +const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpPassiveData = { KMMCScBkupStateIdValueArchiveOpPassiveData }; + +/** +* Archive Footer +* =========================== +* +* BACKUP: Step 16 - nineth archive write operation: store footer +*/ +const TInt32 KMMCScBkupStateIdValueArchiveOpArchiveFooter = 0x0BAC0010; +const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpArchiveFooter = { KMMCScBkupStateIdValueArchiveOpArchiveFooter }; + +/** +* Archive Header +* =========================== +* +* COMMON: Special step to indicate no more steps required +*/ +const TInt32 KMMCScBkupStateIdValueOperationComplete = 0x0BAC0011; +const TMMCScBkupStateId KMMCScBkupStateIdOperationComplete = { KMMCScBkupStateIdValueOperationComplete }; + + + +/** +* Archive Operation: read data owners +* =================================== +* +* RESTORE: Step 2 - read from archive, inform to secure backup engine +*/ +const TInt32 KMMCScBkupStateIdValueArchiveOpReadDataOwners = 0x0BAC0012; +const TMMCScBkupStateId KMMCScBkupStateIdArchiveOpReadDataOwners = { KMMCScBkupStateIdValueArchiveOpReadDataOwners }; + + + + +/** +* BACKUP STATE FLOW +* ================= +* +* 1) KMMCScBkupStateIdArchiveOpArchiveHeader +* 2) KMMCScBkupStateIdGetDataOwners +* 3) KMMCScBkupStateIdSetPhoneMode +* 4) KMMCScBkupStateIdNotifyAllSnapshotsSupplied +* 5) KMMCScBkupStateIdRequestSizeOfBackupData +* 6) KMMCScBkupStateIdRequestListOfPublicFiles +* 7) KMMCScBkupStateIdValidateDiskSpace +* 8) KMMCScBkupStateIdArchiveOpPublicDataFiles +* 9) KMMCScBkupStateIdArchiveOpSystemData +* 10) KMMCScBkupStateIdArchiveOpJavaData +* 11) KMMCScBkupStateIdGetDataOwnerStatuses +* 12) KMMCScBkupStateIdArchiveOpActiveData +* 13) KMMCScBkupStateIdArchiveOpPassiveData +* 14) KMMCScBkupStateIdArchiveOpDataOwners +* 15) KMMCScBkupStateIdArchiveOpArchiveFooter +* 16) KMMCScBkupStateIdOperationComplete +* +*/ + + + +/** +* RESTORE STATE FLOW +* ================= +* +* 1) KMMCScBkupStateIdArchiveOpArchiveHeader +* 2) KMMCScBkupStateIdArchiveOpArchiveFooter +* 3) KMMCScBkupStateIdArchiveOpDataOwners +* 4) KMMCScBkupStateIdValidateDiskSpace +* 5) KMMCScBkupStateIdSetPhoneMode +* 6) KMMCScBkupStateIdArchiveOpSystemData +* 7) KMMCScBkupStateIdArchiveOpJavaData +* 8) KMMCScBkupStateIdArchiveOpPassiveData +* 9) KMMCScBkupStateIdGetDataOwnerStatuses +* 10) KMMCScBkupStateIdArchiveOpActiveData +* 11) KMMCScBkupStateIdArchiveOpPublicDataFiles +* 12) KMMCScBkupStateIdOperationComplete +* +*/ + +#endif // __MMCSCBKUPSTATEIDS_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/MMMCScBkupArchiveDataInterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/MMMCScBkupArchiveDataInterface.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2002 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: Declaration for MMMCScBkupArchiveDataInterface +* +* +*/ + +#ifndef __MMMCSCBKUPARCHIVEDATAINTERFACE_H__ +#define __MMMCSCBKUPARCHIVEDATAINTERFACE_H__ + +// System includes +#include +#include + +// User includes +#include "TMMCScBkupArchiveVector.h" +#include "MMCScBkupOperations.h" + +// Constants +const TInt KMMCScBkupArchiveWriteStreamCurrentPos = -1; +const TInt KMMCScBkupArchiveReadStreamCurrentPos = -1; + +/** +* +* +* @since 3.0 +*/ +class MMMCScBkupArchiveDataInterface + { + public: // From MMMCScBkupArchiveDataInterface + + /** + * + */ + virtual RFs& ADIFsSession() const = 0; + + /** + * + */ + virtual RFile64& ADIRawArchiveFile() const = 0; + + /** + * + */ + virtual const TMMCScBkupArchiveVector& ADICurrentArchiveVectorInfo() const = 0; + + /** + * + */ + virtual const TMMCScBkupArchiveVector& ADIOverallArchiveVectorInfo() const = 0; + + /** + * + */ + virtual RWriteStream& ADIWriteStreamUncompressedLC( TInt aPos = KMMCScBkupArchiveWriteStreamCurrentPos ) = 0; + + /** + * + */ + virtual RReadStream& ADIReadStreamUncompressedLC( TInt aPos = KMMCScBkupArchiveReadStreamCurrentPos ) = 0; + + /** + * + */ + virtual const TMMCScBkupArchiveVector& ADIWriteL( const TDesC8& aData ) = 0; + + /** + * + */ + virtual const TMMCScBkupArchiveVector& ADIReadL( TDes8& aSink, const TMMCScBkupArchiveVector& aInfo ) = 0; + + /** + * + */ + virtual void ADIWriteFileL( const TDesC& aSourceFileName, TRequestStatus& aStatus ) = 0; + + /** + * + */ + virtual void ADIReadFileL( const TDesC& aDestinationFileName, const TMMCScBkupArchiveVector& aInfo, TRequestStatus& aStatus ) = 0; + + /** + * + */ + virtual void ADIWriteCompressedL( const TDesC8& aData, TRequestStatus& aStatus ) = 0; + + /** + * + */ + virtual void ADIReadDecompressedL( TDes8& aSink, const TMMCScBkupArchiveVector& aInfo, TRequestStatus& aStatus ) = 0; + + /** + * + */ + virtual void ADIAsynchronousCancel() = 0; + + /** + * + */ + virtual void ADIResetResources(TMMCScBkupOperationType aType) = 0; + +#ifdef RD_FILE_MANAGER_BACKUP + /** + * + */ + virtual void ADIActivateCrcCalculation(TBool aType) = 0; + + /** + * + */ + virtual TUint32 ADIArchiveCrc() = 0; +#endif + }; + + + + +#endif // __MMMCSCBKUPARCHIVEDATAINTERFACE_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/MMMCScBkupDriver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/MMMCScBkupDriver.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration for MMMCScBkupDriver +* +* +*/ + +#ifndef __MMMCSCBKUPDRIVER_H__ +#define __MMMCSCBKUPDRIVER_H__ + +// System includes +#include + +// User includes +#include "MMCScBkupStateIds.h" +#include "MMCScBkupOperations.h" +#include "CMMCScBkupOperationParameters.h" + +// Classes referenced +class CMMCScBkupState; +class CMMCScBkupArchive; +class MMMCScBkupProgressObserver; +class CMMCScBkupDataOwnerCollection; +class CMMCScBkupFileListCollection; +class MMMCScBkupArchiveDataInterface; + +// Namespaces +using namespace conn; + + +/** +* +* +* @since 3.0 +*/ +class MMMCScBkupDriver + { + public: // From MMMCScBkupDriver + + /** + * + */ + virtual MMMCScBkupArchiveDataInterface& DrvADI() const = 0; + + /** + * + */ + virtual CMMCScBkupArchive& DrvArchive() const = 0; + + /** + * + */ + virtual CSBEClient& DrvSecureBackupClient() const = 0; + + /** + * + */ + virtual TMMCScBkupOperationType DrvOperation() const = 0; + + /** + * + */ + virtual CMMCScBkupOpParamsBase& DrvParamsBase() const = 0; + + /** + * + */ + virtual CMMCScBkupDataOwnerCollection& DrvDataOwners() const = 0; + + /** + * + */ + virtual RPointerArray& DrvDataOwnersAll() = 0; + + /** + * + */ + virtual CMMCScBkupFileListCollection& DrvFileList() const = 0; + + /** + * + */ + virtual TBool DrvLastCategory() const = 0; + + /** + * + */ + virtual void DrvStoreTotalProgress(TInt64 aProgress) = 0; + + /** + * + */ + virtual TInt64 DrvTotalProgress() const = 0; + + /** + * + */ + virtual MMMCScBkupProgressObserver& DrvProgressHandler() const = 0; + }; + + + + +#endif // __MMMCSCBKUPDRIVER_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/MMMCScBkupEngineObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/MMMCScBkupEngineObserver.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2002 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: Declaration for MMMCScBkupEngineObserver +* +* +*/ + +#ifndef __MMMCSCBKUPENGINEOBSERVER_H__ +#define __MMMCSCBKUPENGINEOBSERVER_H__ + +/** +* +* +* @since 3.0 +*/ +class MMMCScBkupEngineObserver + { + public: + + /** + * + */ + enum TEvent + { + // COMMON + ECommonEventFirst = 0, + ECommonOperationStarting = ECommonEventFirst, + ECommonSizeOfTaskUnderstood, + ECommonOperationPrepareEnded, + ECommonOperationEnded, + ECommonOperationError, + ECommonProgress, + ECommonEventLast, + + // BACKUP + EBackupEventFirst = 100, + EBackupAnalysingData, + EBackupEventLast, + + // RESTORE + ERestoreEventFirst = 200, + ERestoreEventLast + }; + + public: // From MMMCScBkupEngineObserver + + /** + * + */ + virtual TInt HandleBkupEngineEventL(TEvent aEvent, TInt aAssociatedData) = 0; + + }; + + +#endif // __MMMCSCBKUPENGINEOBSERVER_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/MMMCScBkupProgressObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/MMMCScBkupProgressObserver.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration for MMMCScBkupProgressObserver +* +* +*/ + +#ifndef __MMMCSCBKUPPROGRESSOBSERVER_H__ +#define __MMMCSCBKUPPROGRESSOBSERVER_H__ + +// System includes +#include + +// User includes + + +/** +* +* +* @since 3.0 +*/ +class MMMCScBkupProgressObserver + { + public: // From MMMCScBkupProgressObserver + + /** + * + */ + virtual void MMCScBkupHandleProgress( TInt aAmountCompleted ) = 0; + + + /** + * + */ + virtual void MMCScBkupHandleProgressDomainUnderstood( TInt aTotalProgressAmount ) = 0; + + + /** + * + */ + virtual TInt MMCScBkupHandleFreeSpace( TInt aPercent ) = 0; + + + /** + * + */ + virtual void MMCScBkupStartBackuping( TBool aProceed ) = 0; + }; + + + + +#endif // __MMMCSCBKUPPROGRESSOBSERVER_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/RMMCScBkupArchiveStreams.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/RMMCScBkupArchiveStreams.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,173 @@ +/* +* Copyright (c) 2005 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: Declaration for RMMCScBkupArchiveReadStream +* +* +*/ + +#ifndef __RMMCSCBKUPARCHIVESTREAMS_H__ +#define __RMMCSCBKUPARCHIVESTREAMS_H__ + +// System includes +#include +#include + +// User includes +#include "TMMCScBkupArchiveVector.h" + +// Classes referenced +class CMMCScBkupArchiveDataManager; + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(RMMCScBkupArchiveBuf) : public RFileBuf + { + public: + + /** + * + */ + RMMCScBkupArchiveBuf(); + + public: // API + + /** + * + */ + void AttachL(CMMCScBkupArchiveDataManager& aADM, RFile64& aFile, TInt aPos, TBool aForWrite ); + + /** + * + */ + IMPORT_C void Close(); + + /** + * + */ + TBool IsOpen() const; + + private: // From MStreamBuf + + /** + * + */ + void DoRelease(); + + /** + * + */ + void DoSynchL(); + +#ifdef RD_FILE_MANAGER_BACKUP + /** + * + */ + void DoWriteL(const TAny* aPtr,TInt aLength); +#endif + + private: + + /** + * + */ + void UpdateInfoL(); + + private: // Member data + + // + TBool iWriteMode; + // + CMMCScBkupArchiveDataManager* iADM; + // + TMMCScBkupArchiveVector iInfo; + + }; + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(RMMCScBkupArchiveReadStream) : public RReadStream + { + public: // Constructors + + /** + * + */ + inline RMMCScBkupArchiveReadStream() { } + + public: // API + + /** + * + */ + void OpenLC(CMMCScBkupArchiveDataManager& aADM, RFile64& aArchiveFile, TInt aPos=0); + + /** + * + */ + TBool IsOpen() const; + + private: // Member data + + // + RMMCScBkupArchiveBuf iSource; + }; + + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(RMMCScBkupArchiveWriteStream) : public RWriteStream + { + public: // Constructors + + /** + * + */ + inline RMMCScBkupArchiveWriteStream() + {} + + public: // API + + /** + * + */ + void OpenLC(CMMCScBkupArchiveDataManager& aADM, RFile64& aArchiveFile, TInt aPos=0); + + /** + * + */ + TBool IsOpen() const; + + private: // Member data + + // + RMMCScBkupArchiveBuf iSink; + }; + + + +#endif // __RMMCSCBKUPARCHIVESTREAMS_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/RMMCScBkupPointerArray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/RMMCScBkupPointerArray.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2005 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: Declaration for RMMCScBkupPointerArray +* +* +*/ + +#ifndef __RMMCSCBKUPPOINTERARRAY_H__ +#define __RMMCSCBKUPPOINTERARRAY_H__ + +// User includes +#include + + +/** +* +* +* @since 3.0 +*/ +template +class RMMCScBkupPointerArray : public RPointerArray + { +public: + inline RMMCScBkupPointerArray(); + inline explicit RMMCScBkupPointerArray(TInt aGranularity); + inline void Close(); + }; + + + + + +// Inline methods + +template +inline RMMCScBkupPointerArray::RMMCScBkupPointerArray() + : RPointerArray() + {} + +template +inline RMMCScBkupPointerArray::RMMCScBkupPointerArray(TInt aGranularity) + : RPointerArray( aGranularity ) + {} + +template +inline void RMMCScBkupPointerArray::Close() + { + RPointerArray::ResetAndDestroy(); + RPointerArray::Close(); + } + + + + + + +#endif // __RMMCSCBKUPPOINTERARRAY_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/RMMCScBkupProgressSizer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/RMMCScBkupProgressSizer.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration for RMMCScBkupProgressSizer +* +* +*/ + +#ifndef __RMMCSCBKUPPROGRESSSIZER_H__ +#define __RMMCSCBKUPPROGRESSSIZER_H__ + +// System includes +#include + +// User includes +#include "TMMCScBkupDriveFilter.h" +#include "TMMCScBkupOwnerDataType.h" + +// Classes referenced +class CMMCScBkupDataOwnerInfo; +class MMMCScBkupProgressObserver; +class CMMCScBkupDriveAndOperationTypeManager; + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(RMMCScBkupProgressSizer) + { + public: + + /** + * C++ default constructor + */ + RMMCScBkupProgressSizer( const CMMCScBkupDriveAndOperationTypeManager& aDriveAndOperationTypes ); + + public: // BACKUP SIZING API + + /** + * + */ + TInt64 BackupTotalProgressValueL( const CMMCScBkupDataOwnerInfo& aDataOwner ); + + /** + * + */ + void BackupReportFixedProgressForOpL( MMMCScBkupProgressObserver& aProgressManager, TMMCScBkupOwnerDataType aType ); + + public: // RESTORE SIZING API + + /** + * + */ + TInt64 RestoreCombinedDataSizeL( const CMMCScBkupDataOwnerInfo& aOwner ); + + private: // Internal methods + + /** + * + */ + TInt NumberOfDriveOpsRequiredL( const CMMCScBkupDataOwnerInfo& aOwner, TMMCScBkupOwnerDataType aType ); + + /** + * + */ + TInt64 AmountOfPublicDataToBeRestoredL( const CMMCScBkupDataOwnerInfo& aOwner ); + + private: // Member data + + // + const CMMCScBkupDriveAndOperationTypeManager& iDriveAndOperationTypes; + // + TMMCScBkupDriveFilter iDriveFilter; + + }; + + + + +#endif // __RMMCSCBKUPPROGRESSSIZER_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/TMMCScBkupArchiveVector.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/TMMCScBkupArchiveVector.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2005 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: Declaration for TMMCScBkupArchiveVector +* +* +*/ + +#ifndef __TMMCSCBKUPARCHIVEVECTOR_H__ +#define __TMMCSCBKUPARCHIVEVECTOR_H__ + +// System includes +#include +#include + + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(TMMCScBkupArchiveVector) + { + public: + + /** + * C++ default constructor + */ + inline TMMCScBkupArchiveVector() + { Reset(); } + + /** + * C++ default constructor + */ + inline TMMCScBkupArchiveVector( TInt aOffset, TInt aLength ) + : iOffset( aOffset ), iLength( aLength ) + {} + + /** + * C++ copy constructor + */ + inline TMMCScBkupArchiveVector( const TMMCScBkupArchiveVector& aVector ) + : iOffset( aVector.Offset() ), iLength( aVector.Length() ) + {} + + public: + + /** + * + */ + inline TInt Offset() const { return iOffset; } + + /** + * + */ + inline void SetOffset( TInt aOffset ) { iOffset = aOffset; } + + /** + * + */ + inline TInt Length() const { return iLength; } + + /** + * + */ + inline void SetLength( TInt aLength ) { iLength = aLength; } + + /** + * + */ + inline TInt EndOffset() const { return (iOffset + iLength); } + + /** + * + */ + inline void AdjustByDelta( TInt aOffsetDelta ) { iOffset += aOffsetDelta; } + + /** + * + */ + static TInt ExternalizedSize(); + + public: + + /** + * + */ + inline void Reset() { iLength = iOffset = 0; } + + /** + * + */ + void ExternalizeL( RWriteStream& aStream ) const; + + /** + * + */ + void InternalizeL( RReadStream& aStream ); + + private: // Internal enumerations + enum + { + EStreamFormatVersion1 = 1 + }; + + private: // Member data + + /** + * + */ + TInt iOffset; + + /** + * + */ + TInt iLength; + }; + + + +/** +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(TMMCScBkupArchiveDriveAndVector) + { + public: + + /** + * C++ default constructor + */ + inline TMMCScBkupArchiveDriveAndVector() : iDrive( EDriveC ) { } + + /** + * C++ default constructor + */ + inline TMMCScBkupArchiveDriveAndVector( TDriveNumber aDrive, const TMMCScBkupArchiveVector& aVector ) : iDrive( aDrive), iVector( aVector ) { } + + public: + + /** + * Internalize object from stream + */ + void InternalizeL( RReadStream& aStream ); + + /** + * Externalize object to stream + */ + void ExternalizeL( RWriteStream& aStream ) const; + + private: // Internal enumerations + enum + { + EStreamFormatVersion1 = 1 + }; + + public: // Data members + TDriveNumber iDrive; + TMMCScBkupArchiveVector iVector; + }; + + + + +#endif // __TMMCSCBKUPARCHIVEVECTOR_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/TMMCScBkupDriveAndSize.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/TMMCScBkupDriveAndSize.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration for TMMCScBkupDriveAndSize +* +* +*/ + +#ifndef __TMMCSCBKUPDRIVEANDSIZE_H__ +#define __TMMCSCBKUPDRIVEANDSIZE_H__ + +// System includes +#include +#include + + + +/** +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(TMMCScBkupDriveAndSize) + { + public: + + /** + * C++ default constructor + */ + inline TMMCScBkupDriveAndSize() : iDrive( EDriveC ), iSize( 0 ) { } + + /** + * C++ default constructor + */ + inline TMMCScBkupDriveAndSize( TDriveNumber aDrive, TInt aSize ) : iDrive( aDrive), iSize( aSize ) { } + + public: + + /** + * Internalize object from stream + */ + void InternalizeL( RReadStream& aStream ); + + /** + * Externalize object to stream + */ + void ExternalizeL( RWriteStream& aStream ) const; + + public: // API + + /** + * + */ + inline TInt64 Size() const { return iSize; } + + /** + * + */ + inline TDriveNumber Drive() const { return iDrive; } + + /** + * + */ + inline void SetSize( TInt64 aSize ) { iSize = aSize; } + + /** + * + */ + inline void AddToSize( TInt64 aAmount ) { iSize += aAmount; } + + /** + * + */ + inline void SetDrive( TDriveNumber aDrive ) { iDrive = aDrive; } + + private: // Internal enumerations + enum + { + EStreamFormatVersion1 = 1 + //EStreamFormatVersion2 = 2 // If 64-bit handling will be supported in the future. + // That will mean in practice a break in archive file format. + // Change are also needed in TMMCScBkupArchiveVector class + // to support larger than 2 GB files and data in it. + }; + + private: // Data members + TDriveNumber iDrive; + TInt64 iSize; + }; + + + + + +#endif // __TMMCSCBKUPDRIVEANDSIZE_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/TMMCScBkupDriveFilter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/TMMCScBkupDriveFilter.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2005 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: Declaration for TMMCScBkupDriveFilter +* +* +*/ + +#ifndef __TMMCSCBKUPDRIVEFILTER_H__ +#define __TMMCSCBKUPDRIVEFILTER_H__ + +// System includes +#include +#include + +/** +* +* +* @since 3.0 +*/ +NONSHARABLE_CLASS(TMMCScBkupDriveFilter) + { + public: + + /** + * C++ default constructor + */ + inline TMMCScBkupDriveFilter() + { Reset(); } + + /** + * C++ default constructor + */ + inline TMMCScBkupDriveFilter( const TDriveList& aPrimaryList ) + : iPrimaryDriveList( aPrimaryList ), iHaveSecondaryList( EFalse ) + { Reset(); } + + public: // API + + /** + * + */ + void Reset(); + + /** + * + */ + void SetPrimaryDriveFilter( const TDriveList& aDriveList ); + + /** + * + */ + void SetSecondaryDriveFilter( const TDriveList& aDriveList ); + + /** + * + */ + TBool NextValidDrive(TDriveNumber& aDrive); + + /** + * + */ + TDriveNumber CurrentDrive() const; + + private: // Internal methods + + /** + * + */ + TBool FindValidDrive( const TDriveList& aList, TDriveNumber& aDrive, TBool aOneAttemptOnly = EFalse ); + + private: // Member data + + /** + * + */ + TInt iCurrentDrive; + + /** + * + */ + TDriveList iPrimaryDriveList; + + /** + * + */ + TDriveList iSecondaryDriveList; + + /** + * + */ + TBool iHaveSecondaryList; + }; + + + + +#endif // __TMMCSCBKUPDRIVEFILTER_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/inc/TMMCScBkupOwnerDataType.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/inc/TMMCScBkupOwnerDataType.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2005 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: Declaration for TMMCScBkupOwnerDataType +* +* +*/ + +#ifndef __TMMCSCBKUPOWNERDATATYPE_H__ +#define __TMMCSCBKUPOWNERDATATYPE_H__ + +// NB. This file is included inside an HRH file, so do not include +// C++ constructs. + +/** +* DO NOT CHANGE THE ORDER OF THIS ENUMERATION +* +* @since 3.0 +*/ +enum TMMCScBkupOwnerDataType + { + // Relates to all data owners + EMMCScBkupOwnerDataTypeDataOwner = 0, + + // Relates to java data for a particular owner + EMMCScBkupOwnerDataTypeJavaData, + + // Relates to public data for a particular owner + EMMCScBkupOwnerDataTypePublicData, + + // Relates to system data for a particular owner + EMMCScBkupOwnerDataTypeSystemData, + + // Relates to active data for a particular owner + EMMCScBkupOwnerDataTypeActiveData, + + // Relates to passive data for a particular owner + EMMCScBkupOwnerDataTypePassiveData, + + // Always leave this last, don't assign it + // a value. Don't use it either! + EMMCScBkupOwnerDataTypeCount, + + // A generic 'any data type' value. Used by the drive-specific-request & + // data sizer. Not a real SBE data type, hence it appears after + // the last marker. + EMMCScBkupOwnerDataTypeAny + }; + + + +#endif // __TMMCSCBKUPOWNERDATATYPE_H__ + +//End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupArchive.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupArchive.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,364 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CMMCScBkupArchive Implementation +* +* +*/ + +#include "CMMCScBkupArchive.h" + +// System includes +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "MMCScBkupArchiveUtils.h" +#include "CMMCScBkupArchiveHeader.h" +#include "CMMCScBkupArchiveFooter.h" +#include "MMCScBkupPhoneModelUtils.h" +#include "CMMCScBkupArchiveDataManager.h" + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupArchive::CMMCScBkupArchive() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupArchive::CMMCScBkupArchive( RFs& aFsSession, MMMCScBkupProgressObserver& aProgressManager, + MMMCScBkupDriver& aDriver, TBitFlags aCategory ) +: iFsSession( aFsSession ), iProgressManager( aProgressManager ), iDriver( aDriver ), iCategory( aCategory ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchive::~CMMCScBkupArchive() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupArchive::~CMMCScBkupArchive() + { + Close( KErrNone ); + DeleteOldArchive(); + // Must do these last, as we may need to use the file name in order + // to delete any partially created or old archives. + delete iArchiveFileName; + iArchiveFileName = NULL; + + delete iOldArchiveFileName; + iOldArchiveFileName = NULL; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchive::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupArchive* CMMCScBkupArchive::NewL( RFs& aFsSession, MMMCScBkupProgressObserver& aProgressManager, + MMMCScBkupDriver& aDriver, TBitFlags aCategory ) + { + __LOG("CMMCScBkupArchive::NewL() - START"); + CMMCScBkupArchive* self = new(ELeave) CMMCScBkupArchive( aFsSession, aProgressManager, aDriver, aCategory ); + __LOG("CMMCScBkupArchive::NewL() - END"); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchive::OpenForReadingL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchive::OpenForReadingL( const TDesC& aName ) + { + __LOG1("CMMCScBkupArchive::OpenForReadingL() - START - aName: %S", &aName); + + Close( KErrNone ); + iArchiveFileName = aName.AllocL(); + // + const TInt error = iArchiveFile.Open(iFsSession, *iArchiveFileName, EFileShareReadersOnly | EFileStream | EFileRead); + __LOG1("CMMCScBkupArchive::OpenForReadingL() - open error: %d", error); + User::LeaveIfError(error); + // + PrepareObjectsL(); + SetMode(EModeReading); + __LOG1("CMMCScBkupArchive::OpenForReadingL() - END - file handle: 0x%08x", iArchiveFile.SubSessionHandle()); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchive::OpenForWritingL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchive::OpenForWritingL( const TDesC& aName ) + { + __LOG1("CMMCScBkupArchive::OpenForWritingL() - START - aName: %S", &aName); + + Close( KErrNone ); + iArchiveFileName = aName.AllocL(); + + // Name old archive as .old until disk space validation is carried out. + _LIT( KOldSuffix, "old" ); + const TChar dot('.'); + iOldArchiveFileName = HBufC::NewL(aName.Length() + KOldSuffix().Length() + 1); + TPtr temp( iOldArchiveFileName->Des() ); + temp.Copy( aName ); + const TInt location = temp.LocateReverseF( dot ) + 1; + TInt length = temp.Length() - location; + + if( location != KErrNotFound && length <= KOldSuffix().Length() ) + { + temp.Delete( location, length ); + temp.Append( KOldSuffix().Ptr(), length ); + } + else + { + temp.Append( dot ); + temp.Append( KOldSuffix().Ptr(), length ); + } + + // Ensure archive directory and attributes permit writing of file + TInt error = PrepareToOverwrite(aName); + __LOG1("CMMCScBkupArchive::OpenForWritingL() - prepare to over-write error: %d", error); + User::LeaveIfError(error); + + // Open file for writing + error = iArchiveFile.Replace(iFsSession, *iArchiveFileName, EFileShareExclusive | EFileStream | EFileWrite); + __LOG1("CMMCScBkupArchive::OpenForWritingL() - replace error: %d", error); + User::LeaveIfError(error); + // + PrepareObjectsL(); + SetMode(EModeWriting); + __LOG1("CMMCScBkupArchive::OpenForWritingL() - END - file handle: 0x%08x", iArchiveFile.SubSessionHandle()); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchive::RestoreOldArchive() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchive::RestoreOldArchive() + { + Close( KErrCancel ); + TInt err = iFsSession.Rename( *iOldArchiveFileName, *iArchiveFileName ); + + __LOG2("CMMCScBkupArchive::RestoreOldArchive() - %S restore error: %d", iArchiveFileName, err); + } + +// --------------------------------------------------------------------------- +// CMMCScBkupArchive::DeleteOldArchive() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchive::DeleteOldArchive() + { + if( iOldArchiveFileName != NULL ) + { + TInt err = iFsSession.Delete( *iOldArchiveFileName ); + + __LOG2("CMMCScBkupArchive::DeleteOldArchive() - %S delete error: %d", iOldArchiveFileName, err); + } + } + +// --------------------------------------------------------------------------- +// CMMCScBkupArchive::Close() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchive::Close( TInt aError ) + { + __LOG1("CMMCScBkupArchive::Close() - aError: %d", aError); + + delete iHeader; + iHeader = NULL; + delete iFooter; + iFooter = NULL; + delete iDataManager; + iDataManager = NULL; + // + if ( aError != KErrNone && Mode() == EModeWriting ) + { + // Delete the archive if there was an error with the backup operation + __LOG1("CMMCScBkupArchive::Close() - ERROR CREATING BACKUP - aError: %d => archive will be deleted", aError); + + // Ignore error when attempting delete + iArchiveFile.Close(); + (void) iFsSession.Delete( *iArchiveFileName ); + } + + // Close archive. It might have already been closed in an error situation + // but that's okay - it doesn't cause any problems to close it twice. + iArchiveFile.Close(); + + // Ignore error if setting read-only attribute fails, because it is not fatal + iFsSession.SetAtt( *iArchiveFileName, KEntryAttReadOnly, !KEntryAttReadOnly ); + + // Reset mode back to default, ready for next operation + iMode = EModeUninitialised; + + __LOG("CMMCScBkupArchive::Close() - END"); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchive::Header() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupArchiveHeader& CMMCScBkupArchive::Header() const + { + return *iHeader; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchive::Footer() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupArchiveFooter& CMMCScBkupArchive::Footer() const + { + return *iFooter; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchive::ADI() +// +// +// --------------------------------------------------------------------------- +MMMCScBkupArchiveDataInterface& CMMCScBkupArchive::ADI() const + { + return *iDataManager; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchive::PrepareToOverwrite() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupArchive::PrepareToOverwrite( const TDesC& aFile ) + { + __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - START - aFile: %S", &aFile); + TInt err = KErrNone; + + // Try deleting file with temporary name (one we have created earlier, + // but which has potentially remained for some reason). + err = iFsSession.Delete( *iOldArchiveFileName ); + __LOG2("CMMCScBkupArchive::PrepareToOverwrite() - delete %S result: %d", iOldArchiveFileName, err); + // Rename the file for possible later "restoration". + err = iFsSession.Rename( aFile, *iOldArchiveFileName ); + __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - rename existing file: %d", err); + // Reset file flags in order to make sure file can be deleted + err = iFsSession.SetAtt( *iOldArchiveFileName, KEntryAttNormal, !KEntryAttNormal ); + __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - setFileAttNormal: %d", err); + + // Create the full path, if not exists + err = iFsSession.MkDirAll( aFile ); + __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - mkDirAll: %d", err); + + if (err == KErrAlreadyExists || err == KErrNone ) + { + // Set folder hidden, ignore error + err = iFsSession.SetAtt( BaflUtils::DriveAndPathFromFullName( aFile ), KEntryAttHidden, !KEntryAttHidden ); + __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - setFolderHidden: %d", err); + + // Reset file flags in order to make sure file can be deleted + err = iFsSession.SetAtt( aFile, KEntryAttNormal, !KEntryAttNormal ); + __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - setFileAttNormal: %d", err); + + } + // + if ( err == KErrNotFound ) + { + // These errors are ignored + __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - mapped %d to KErrNone -> everything is okay", err); + err = KErrNone; + } + // + __LOG1("CMMCScBkupArchive::PrepareToOverwrite() - END - err: %d", err); + return err; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchive::ValidArchiveForRestoreL() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupArchive::ValidArchiveForRestoreL( RFs& aFsSession, const TDesC& aFileName ) + { + HBufC8* modelInfo = NULL; + TBitFlags archiveFlags( 0 ); + + TVersion archiveVersion; + + // Read the header from the specified archive + MMCScBkupArchiveUtils::ReadPhoneValidityInformationL( aFsSession, aFileName, modelInfo, archiveFlags, archiveVersion ); + CleanupStack::PushL( modelInfo ); + + // Check whether its okay to restore the archive. + const TBool validArchiveForRestore = MMCScBkupPhoneModelUtils::ArchiveRestorePermissableL( *modelInfo, archiveFlags, archiveVersion ); + CleanupStack::PopAndDestroy(modelInfo); + // + return validArchiveForRestore; + } + + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchive::SetMode() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchive::SetMode(TMode aMode) + { + iMode = aMode; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchive::PrepareObjectsL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchive::PrepareObjectsL() + { + __LOG("CMMCScBkupArchive::PrepareObjectsL() - START"); + + __LOG("CMMCScBkupArchive::PrepareObjectsL() - creating data manager..."); + iDataManager = CMMCScBkupArchiveDataManager::NewL( iFsSession, iArchiveFile, iProgressManager ); + + __LOG("CMMCScBkupArchive::PrepareObjectsL() - creating header..."); + iHeader = CMMCScBkupArchiveHeader::NewL( *iDataManager, iDriver ); + + __LOG("CMMCScBkupArchive::PrepareObjectsL() - creating footer..."); + iFooter = CMMCScBkupArchiveFooter::NewL( *iDataManager, iDriver ); + + __LOG("CMMCScBkupArchive::PrepareObjectsL() - END"); + } + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupArchiveDataManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupArchiveDataManager.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,647 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupArchiveDataManager Implementation +* +* +*/ + +#include "CMMCScBkupArchiveDataManager.h" + +// System includes +#include +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "RMMCScBkupArchiveStreams.h" +#include "MMCScBkupOperations.h" + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::CMMCScBkupArchiveDataManager() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupArchiveDataManager::CMMCScBkupArchiveDataManager( RFs& aFsSession, RFile64& aFile, MMMCScBkupProgressObserver& aProgressManager ) +: CActive( CActive::EPriorityIdle ), iFsSession( aFsSession ), iFile( aFile ), iProgressManager( aProgressManager ) + { + __LOG1("CMMCScBkupArchiveDataManager::CMMCScBkupArchiveDataManager() - START - aFile: 0x%08x", aFile.SubSessionHandle() ); + CActiveScheduler::Add(this); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::~CMMCScBkupArchiveDataManager() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupArchiveDataManager::~CMMCScBkupArchiveDataManager() + { + Cancel(); + // + iWriteStream.Close(); + // + delete iCompressor; + delete iDecompressor; + delete iBufferManager; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::ConstructL() + { + TInt64 size = 0; + User::LeaveIfError( iFile.Size( size ) ); + // + iOverallArchiveVectorInfo.SetOffset( 0 ); + iOverallArchiveVectorInfo.SetLength( size ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupArchiveDataManager* CMMCScBkupArchiveDataManager::NewL( RFs& aFsSession, RFile64& aFile, MMMCScBkupProgressObserver& aProgressManager ) + { + CMMCScBkupArchiveDataManager* self = new(ELeave) CMMCScBkupArchiveDataManager( aFsSession, aFile, aProgressManager ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::CurrentOffsetL() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupArchiveDataManager::CurrentOffsetL() const + { + TInt offset = CurrentOffset(); + User::LeaveIfError(offset); + return offset; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::CurrentOffset() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupArchiveDataManager::CurrentOffset() const + { + TInt64 offsetOrError = 0; + TInt error = iFile.Seek( ESeekCurrent, offsetOrError ); + // + if (error != KErrNone) + { + offsetOrError = error; + } + // + return offsetOrError; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::SetCurrentVector() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::SetCurrentVector( const TMMCScBkupArchiveVector& aVector ) + { + iCurrentVectorInfo = aVector; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::ADIFsSession() +// +// +// --------------------------------------------------------------------------- +RFs& CMMCScBkupArchiveDataManager::ADIFsSession() const + { + return iFsSession; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::ADIRawArchiveFile() +// +// +// --------------------------------------------------------------------------- +RFile64& CMMCScBkupArchiveDataManager::ADIRawArchiveFile() const + { + return iFile; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::ADICurrentArchiveVectorInfo() +// +// +// --------------------------------------------------------------------------- +const TMMCScBkupArchiveVector& CMMCScBkupArchiveDataManager::ADICurrentArchiveVectorInfo() const + { + return iCurrentVectorInfo; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::ADIOverallArchiveVectorInfo() +// +// +// --------------------------------------------------------------------------- +const TMMCScBkupArchiveVector& CMMCScBkupArchiveDataManager::ADIOverallArchiveVectorInfo() const + { + return iOverallArchiveVectorInfo; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::ADIWriteStreamUncompressedLC() +// +// +// --------------------------------------------------------------------------- +RWriteStream& CMMCScBkupArchiveDataManager::ADIWriteStreamUncompressedLC( TInt aPos ) + { + __LOG1("CMMCScBkupArchiveDataManager::ADIWriteStreamUncompressedLC() - START - aPos: %d", aPos ); + // + __ASSERT_ALWAYS( !iWriteStream.IsOpen(), User::Invariant() ); + TInt offset = aPos; + if (offset == KMMCScBkupArchiveWriteStreamCurrentPos) + { + offset = CurrentOffsetL(); + __LOG1("CMMCScBkupArchiveDataManager::ADIWriteStreamUncompressedLC() - current offset is: %d", offset ); + } + // + iWriteStream.OpenLC(*this, iFile, offset); + + __LOG("CMMCScBkupArchiveDataManager::ADIWriteStreamUncompressedLC() - END - stream opened and pushed"); + + iCurrentVectorInfo.Reset(); + return iWriteStream; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::ADIReadStreamUncompressedLC() +// +// +// --------------------------------------------------------------------------- +RReadStream& CMMCScBkupArchiveDataManager::ADIReadStreamUncompressedLC( TInt aPos ) + { + __ASSERT_ALWAYS( !iReadStream.IsOpen(), User::Invariant() ); + TInt offset = aPos; + if (offset == KMMCScBkupArchiveReadStreamCurrentPos) + { + offset = CurrentOffsetL(); + } + // + iReadStream.OpenLC(*this, iFile, offset); + iCurrentVectorInfo.Reset(); + return iReadStream; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::ADIWriteL() +// +// +// --------------------------------------------------------------------------- +const TMMCScBkupArchiveVector& CMMCScBkupArchiveDataManager::ADIWriteL( const TDesC8& aData ) + { + const TInt offset = CurrentOffsetL(); + const TInt error = iFile.Write( aData ); + User::LeaveIfError(error); + +#ifdef RD_FILE_MANAGER_BACKUP + CalculateCrc(aData.Ptr(), aData.Length()); +#endif + // + iCurrentVectorInfo.SetOffset( offset ); + iCurrentVectorInfo.SetLength( aData.Length() ); + // + return iCurrentVectorInfo; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::ADIReadL() +// +// +// --------------------------------------------------------------------------- +const TMMCScBkupArchiveVector& CMMCScBkupArchiveDataManager::ADIReadL( TDes8& aSink, const TMMCScBkupArchiveVector& aInfo ) + { + TMMCScBkupArchiveVector readInfo(aInfo); + + // Read straight into aSink. + const TInt maxLength = aSink.MaxLength(); + if (aInfo.Length() > maxLength) + { + readInfo.SetLength( maxLength ); + } + + aSink.Zero(); + const TInt error = iFile.Read( static_cast(readInfo.Offset()), aSink, readInfo.Length() ); + User::LeaveIfError( error ); + // + iCurrentVectorInfo.SetOffset( readInfo.Offset() ); + iCurrentVectorInfo.SetLength( aSink.Length() ); + // + return iCurrentVectorInfo; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::ADIWriteFileL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::ADIWriteFileL( const TDesC& aSourceFileName, TRequestStatus& aStatus ) + { + __LOG1("CMMCScBkupArchiveDataManager::ADIWriteFileL() - START - file: %S", &aSourceFileName); + + if (!iBufferManager || iBufferManager->Type() != CMMCScBkupBufferManagerBase::ETypeFileToArchive) + { + CMMCScBkupBufferManagerBase* bm = + CMMCScBkupBufferManagerBase::NewByTypeL( + CMMCScBkupBufferManagerBase::ETypeFileToArchive, + iProgressManager, + *this, + (TAny*) &aSourceFileName); + // + delete iBufferManager; + iBufferManager = bm; + } + else + { + iBufferManager->InitializeL( (TAny*) &aSourceFileName ); + } + + // Setup our observer & op + SetOperation(EOperationCompressing); + SetObserver(aStatus); + + // Compressing aData to the archive file + EnsureCompressorExistsL(*iBufferManager); + + // Do the compression asynchronously + CompleteSelf(); + + __LOG("CMMCScBkupArchiveDataManager::ADIWriteFileL() - END"); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::ADIReadFileL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::ADIReadFileL( const TDesC& aDestinationFileName, const TMMCScBkupArchiveVector& aInfo, TRequestStatus& aStatus ) + { + __LOG3("CMMCScBkupArchiveDataManager::ADIReadFileL() - START - file: %S, offset: %8d, length: %8d", &aDestinationFileName, aInfo.Offset(), aInfo.Length()); + + if (!iBufferManager || iBufferManager->Type() != CMMCScBkupBufferManagerBase::ETypeArchiveToFile) + { + CMMCScBkupBufferManagerBase* bm = + CMMCScBkupBufferManagerBase::NewByTypeL( + CMMCScBkupBufferManagerBase::ETypeArchiveToFile, + iProgressManager, + *this, + (TAny*) &aDestinationFileName, + (TAny*) &aInfo ); + // + delete iBufferManager; + iBufferManager = bm; + } + else + { + iBufferManager->InitializeL( (TAny*) &aDestinationFileName, (TAny*) &aInfo ); + } + + // Setup our observer & op + SetOperation(EOperationDecompressing); + SetObserver(aStatus); + + // Compressing aData to the archive file + EnsureDecompressorExistsL(*iBufferManager); + + // Do the compression asynchronously + CompleteSelf(); + + __LOG("CMMCScBkupArchiveDataManager::ADIReadFileL() - END"); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::ADIWriteCompressedL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::ADIWriteCompressedL( const TDesC8& aData, TRequestStatus& aStatus ) + { + if (!iBufferManager || iBufferManager->Type() != CMMCScBkupBufferManagerBase::ETypeDescriptorToArchive) + { + CMMCScBkupBufferManagerBase* bm = + CMMCScBkupBufferManagerBase::NewByTypeL( + CMMCScBkupBufferManagerBase::ETypeDescriptorToArchive, + iProgressManager, + *this, + (TAny*) &aData ); + // + delete iBufferManager; + iBufferManager = bm; + } + else + { + iBufferManager->InitializeL( (TAny*) &aData ); + } + + // Setup our observer & op + SetOperation(EOperationCompressing); + SetObserver(aStatus); + + // Compressing aData to the archive file + EnsureCompressorExistsL(*iBufferManager); + + // Do the compression asynchronously + CompleteSelf(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::ADIReadDecompressedL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::ADIReadDecompressedL( TDes8& aSink, const TMMCScBkupArchiveVector& aInfo, TRequestStatus& aStatus ) + { + if (!iBufferManager || iBufferManager->Type() != CMMCScBkupBufferManagerBase::ETypeArchiveToDescriptor) + { + CMMCScBkupBufferManagerBase* bm = + CMMCScBkupBufferManagerBase::NewByTypeL( + CMMCScBkupBufferManagerBase::ETypeArchiveToDescriptor, + iProgressManager, + *this, + (TAny*) &aSink, + (TAny*) &aInfo ); + // + delete iBufferManager; + iBufferManager = bm; + } + else + { + iBufferManager->InitializeL( (TAny*) &aSink, (TAny*) &aInfo ); + } + + // Setup our observer & op + SetOperation(EOperationDecompressing); + SetObserver(aStatus); + + // Compressing aData to the archive file + EnsureDecompressorExistsL(*iBufferManager); + + // Do the compression asynchronously + CompleteSelf(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::ADIAsynchronousCancel() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::ADIAsynchronousCancel() + { + Cancel(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::ADIResetResources() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::ADIResetResources(TMMCScBkupOperationType /* aType */) + { + __LOG("CMMCScBkupArchiveDataManager::ADIResetResources()"); + + delete iCompressor; + iCompressor = NULL; + delete iDecompressor; + iDecompressor = NULL; + delete iBufferManager; + iBufferManager = NULL; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::EnsureCompressorExistsL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::EnsureCompressorExistsL( MEZBufferManager& aBufferManager ) + { + delete iDecompressor; + iDecompressor = NULL; + // + if (iCompressor == NULL) + { + iCompressor = CEZCompressor::NewL( aBufferManager ); + } + else + { + iCompressor->ResetL(aBufferManager); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::EnsureDecompressorExistsL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::EnsureDecompressorExistsL( MEZBufferManager& aBufferManager ) + { + delete iCompressor; + iCompressor = NULL; + // + if (iDecompressor == NULL) + { + iDecompressor = CEZDecompressor::NewL( aBufferManager ); + } + else + { + iDecompressor->ResetL(aBufferManager); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::SetObserver() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::SetObserver( TRequestStatus& aStatus ) + { + __ASSERT_DEBUG(iObserverStatus == NULL, User::Invariant()); + iObserverStatus = &aStatus; + *iObserverStatus = KRequestPending; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::CompleteSelf() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::CompleteSelf( TInt aCompletionCode ) + { + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, aCompletionCode); + } + + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::CompleteObserver(() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::CompleteObserver( TInt aCompletionCode ) + { + __ASSERT_ALWAYS(iObserverStatus != NULL, User::Invariant()); + User::RequestComplete(iObserverStatus, aCompletionCode); + + // Implicitly, we must be finished + SetOperation(EOperationIdle); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::SetOperation() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::SetOperation( TOperation aOperation ) + { + iOperation = aOperation; + } + + +#ifdef RD_FILE_MANAGER_BACKUP +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::CalculateCrc() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::CalculateCrc( const TAny* aPtr,TInt aLength ) + { + if(iCrcCalcActivated) + { +#if defined(__MMCSCBKUPLOGGING_ENABLED__) + TUint32 startTime = User::NTickCount(); +#endif + Mem::Crc32(iCrc, aPtr, aLength); +#if defined(__MMCSCBKUPLOGGING_ENABLED__) + iTotalTickCount += (User::NTickCount() - startTime); + //__LOG5("CMMCScBkupArchiveDataManager::CalculateCrc() - crc %u, addr 0x%08x, len %d, offset %d, ticks in ms %u", + // iCrc, aPtr, aLength, CurrentOffset(), iTotalTickCount); +#endif + } + } +#endif + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::RunL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::RunL() + { + User::LeaveIfError(iStatus.Int()); + TBool moreToDo = EFalse; + // + switch(iOperation) + { + case EOperationIdle: + ASSERT( EFalse ); + break; + case EOperationCompressing: + __LOG("CMMCScBkupArchiveDataManager::RunL() - START - EOperationCompressing"); + moreToDo = iCompressor->DeflateL(); + break; + case EOperationDecompressing: + __LOG("CMMCScBkupArchiveDataManager::RunL() - START - EOperationDecompressing"); + moreToDo = iDecompressor->InflateL(); + break; + } + // + if (moreToDo) + { + CompleteSelf(); + } + else + { + // Update current offset & length info based upon buffer manager indications + const TMMCScBkupArchiveVector& finalInfo = iBufferManager->Info(); + iCurrentVectorInfo = finalInfo; + + // Ensure we set the state back to idle, ready for next operation... + iOperation = EOperationIdle; + + __LOG2("CMMCScBkupArchiveDataManager::RunL() - operation complete - offset: %8d, length: %8d", iCurrentVectorInfo.Offset(), iCurrentVectorInfo.Length()); + CompleteObserver(); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::DoCancel() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveDataManager::DoCancel() + { + __ASSERT_DEBUG(iOperation != EOperationIdle, User::Invariant()); + // + CompleteObserver(KErrCancel); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveDataManager::RunError() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupArchiveDataManager::RunError( TInt aError ) + { + __LOG1("CMMCScBkupArchiveDataManager::RunError() - START - aError: %d", aError); + CompleteObserver(aError); + // + return KErrNone; + } + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupArchiveFooter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupArchiveFooter.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,342 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupArchiveFooter Implementation +* +* +*/ + +#include "CMMCScBkupArchiveFooter.h" + +// User includes +#include "CMMCScBkupIndexPublicDataFiles.h" +#include "CMMCScBkupIndexDataOwners.h" +#include "CMMCScBkupIndexJavaData.h" +#include "CMMCScBkupIndexSystemData.h" +#include "CMMCScBkupIndexActiveData.h" +#include "CMMCScBkupIndexJavaData.h" +#include "CMMCScBkupIndexPassiveData.h" +#include "MMMCScBkupArchiveDataInterface.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "MMCScBkupArchiveUtils.h" +#include "CMMCScBkupDataOwnerCollection.h" + +/** + + UNDERSTANDING ARCHIVE FOOTER + ============================ + + // Indicies are: + // + // EMMCScBkupOwnerDataTypeDataOwner + // EMMCScBkupOwnerDataTypeJavaData + // EMMCScBkupOwnerDataTypePublicData + // EMMCScBkupOwnerDataTypeSystemData + // EMMCScBkupOwnerDataTypeActiveData + // EMMCScBkupOwnerDataTypePassiveData + // + // 6 (index objects) * + // ( 1 byte for object type + TMMCScBkupArchiveVector::ExternalizedSize() ) + // + + // THIS IS THE SIZE OF AN INDIVIDUAL "INDEX RECORD POINTER" + const TInt indexDataSize = 1 // index type + + TMMCScBkupArchiveVector::ExternalizedSize() // vector + + 4 // spare1 + + 4 // spare2 + ; + + // THIS IS THE TOTAL SIZE OF ALL "INDEX RECORD POINTERS" + const TInt sizeOfAllIndicies = + 4 // stream format version + + 4 // spare1 + + 4 // spare2 + + 4 // spare3 + + 4 // spare4 + + 4 // index object count + + ( EMMCScBkupOwnerDataTypeCount * indexDataSize); + + // WE ALSO WRITE THE AMOUNT OF DISK SPACE REQUIRED FOR EACH DRIVE + // IN ORDER TO RESTORE THE ARCHIVE + + (not included here) +*/ + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveFooter::CMMCScBkupArchiveFooter() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupArchiveFooter::CMMCScBkupArchiveFooter( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ) +: iDataInterface( aDataInterface ), iDriver( aDriver ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveFooter::~CMMCScBkupArchiveFooter() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupArchiveFooter::~CMMCScBkupArchiveFooter() + { + iIndicies.Close(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveFooter::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveFooter::ConstructL() + { + CMMCScBkupIndexBase* index = NULL; + // + index = CMMCScBkupIndexDataOwners::NewLC(); + iIndicies.AppendL(index); + CleanupStack::Pop(index); + // + index = CMMCScBkupIndexPublicDataFiles::NewLC(); + iIndicies.AppendL(index); + CleanupStack::Pop(index); + // + index = CMMCScBkupIndexSystemData::NewLC(); + iIndicies.AppendL(index); + CleanupStack::Pop(index); + // + index = CMMCScBkupIndexJavaData::NewLC(); + iIndicies.AppendL(index); + CleanupStack::Pop(index); + // + index = CMMCScBkupIndexActiveData::NewLC(); + iIndicies.AppendL(index); + CleanupStack::Pop(index); + // + index = CMMCScBkupIndexPassiveData::NewLC(); + iIndicies.AppendL(index); + CleanupStack::Pop(index); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveFooter::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupArchiveFooter* CMMCScBkupArchiveFooter::NewL( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ) + { + CMMCScBkupArchiveFooter* self = new(ELeave) CMMCScBkupArchiveFooter( aDataInterface, aDriver ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveFooter::IndexByType() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupIndexBase& CMMCScBkupArchiveFooter::IndexByType( TMMCScBkupOwnerDataType aType ) + { + CMMCScBkupIndexBase* ret = IndexByTypeOrNull( aType ); + __ASSERT_ALWAYS(ret != NULL, User::Invariant()); + return *ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveFooter::IndexByTypeOrNull() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupIndexBase* CMMCScBkupArchiveFooter::IndexByTypeOrNull( TMMCScBkupOwnerDataType aType ) + { + CMMCScBkupIndexBase* ret = NULL; + // + const TInt count = iIndicies.Count(); + for(TInt i=0; iType() == aType) + { + ret = entry; + break; + } + } + // + return ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveFooter::StoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveFooter::StoreL() + { + RWriteStream stream( iDataInterface.ADIWriteStreamUncompressedLC() ); + // + const TInt count = iIndicies.Count(); + __ASSERT_DEBUG( count == EMMCScBkupOwnerDataTypeCount, User::Invariant()); + + // NEW: write index version + stream.WriteInt32L( EStreamFormatVersion1 ); + + // NEW: spare1, spare2, spare3, spare4 + stream.WriteInt32L( 0 ); + stream.WriteInt32L( 0 ); + stream.WriteInt32L( 0 ); + stream.WriteInt32L( 0 ); + + // NEW: write the number of indicies... + stream.WriteInt32L( count ); + + // ...then write each index in turn... + for(TInt i=0; i inMemoryIndexCount ) + { + // Something wrong with file format version info? + User::Leave( KErrCorrupt ); + } + + // Read index offsets + for(TInt i=0; i( stream.ReadInt8L() ); + // + if ( type < 0 || type >= EMMCScBkupOwnerDataTypeCount ) + { + User::Leave( KErrCorrupt ); + } + else + { + // Always read the vector info (in order to keep the stream + // position inline with the externalised representation) + TMMCScBkupArchiveVector vector; + stream >> vector; + + // NEW: Then read spare bytes for each index record + stream.ReadInt32L(); // per-index spare1 + stream.ReadInt32L(); // per-index spare2 + + // But only prepare the index if we have a similar type.. + CMMCScBkupIndexBase* index = IndexByTypeOrNull( type ); + // + if ( index ) + { + index->SetVector( vector ); + } + + } + } + + // NEW: read the amount of disk space required for each drive as + // part of the footer information + CMMCScBkupDataOwnerCollection& dataOwners = iDriver.DrvDataOwners(); + stream >> dataOwners; + + // + CleanupStack::PopAndDestroy(); // stream + } + + + + + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupArchiveHeader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupArchiveHeader.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupArchiveHeader Implementation +* +* +*/ + +#include "CMMCScBkupArchiveHeader.h" + +// User includes +#include "MMCScBkupArchiveUtils.h" + +/** + * NB. See MMCScBkupArchiveUtils.cpp for archive header file format. + */ + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveHeader::CMMCScBkupArchiveHeader() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupArchiveHeader::CMMCScBkupArchiveHeader( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ) +: iDataInterface( aDataInterface ), iDriver( aDriver ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveHeader::~CMMCScBkupArchiveHeader() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupArchiveHeader::~CMMCScBkupArchiveHeader() + { + delete iPhoneModelIdentifier; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveHeader::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveHeader::ConstructL() + { + iPhoneModelIdentifier = KNullDesC8().AllocL(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveHeader::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupArchiveHeader* CMMCScBkupArchiveHeader::NewL( MMMCScBkupArchiveDataInterface& aDataInterface, MMMCScBkupDriver& aDriver ) + { + CMMCScBkupArchiveHeader* self = new(ELeave) CMMCScBkupArchiveHeader( aDataInterface, aDriver ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveHeader::StoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveHeader::StoreL(TBitFlags aCategory) + { + MMCScBkupArchiveUtils::WriteHeaderL( iDataInterface, aCategory ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveHeader::RestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveHeader::RestoreL() + { + MMCScBkupArchiveUtils::ReadHeaderL( iDataInterface, *this ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveHeader::SetPhoneModelIdentifierL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveHeader::SetPhoneModelIdentifierL( const TDesC8& aModel ) + { + HBufC8* model = aModel.AllocL(); + delete iPhoneModelIdentifier; + iPhoneModelIdentifier = model; + } diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupArchiveInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupArchiveInfo.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupArchiveInfo Implementation +* +* +*/ + +#include "CMMCScBkupArchiveInfo.h" + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveInfo::CMMCScBkupArchiveInfo() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupArchiveInfo::CMMCScBkupArchiveInfo() + { + } + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveInfo::~CMMCScBkupArchiveInfo() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupArchiveInfo::~CMMCScBkupArchiveInfo() + { + delete iFileInfo; + iSecureIds.Close(); + iExcludedSecureIds.Close(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveInfo::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveInfo::ConstructL( const TEntry& aEntry ) + { + iFileInfo = CMMCScBkupFileInfo::NewL( aEntry, 0 ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveInfo::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupArchiveInfo* CMMCScBkupArchiveInfo::NewL( const TEntry& aEntry ) + { + CMMCScBkupArchiveInfo* self = NewLC( aEntry ); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveInfo::NewLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupArchiveInfo* CMMCScBkupArchiveInfo::NewLC( const TEntry& aEntry ) + { + CMMCScBkupArchiveInfo* self = new(ELeave) CMMCScBkupArchiveInfo( ); + CleanupStack::PushL(self); + self->ConstructL(aEntry); + return self; + } + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveInfo::SetSIDs() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveInfo::SetSIDs( RArray& aSIDs ) + { + TInt count = aSIDs.Count(); + + for(TInt i = 0; i < count; i++ ) + { + iSecureIds.Append(aSIDs[i]); + } + } + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveInfo::SetExcludedSIDs() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupArchiveInfo::SetExcludedSIDs( RArray& aExcludedSIDs ) + { + TInt count = aExcludedSIDs.Count(); + + for(TInt i = 0; i < count; i++ ) + { + iExcludedSecureIds.Append(aExcludedSIDs[i]); + } + } + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveInfo::SIDs() +// +// +// --------------------------------------------------------------------------- +const RArray& CMMCScBkupArchiveInfo::SIDs( TBitFlags aCategory ) const + { + __ASSERT_ALWAYS(aCategory == iCategory, User::Invariant()); + + return iSecureIds; + } + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveInfo::ExcludeSIDs() +// +// +// --------------------------------------------------------------------------- +const RArray& CMMCScBkupArchiveInfo::ExcludedSIDs( TBitFlags aCategory ) const + { + __ASSERT_ALWAYS(aCategory == iCategory, User::Invariant()); + + return iExcludedSecureIds; + } + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveInfo::Category() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TBitFlags CMMCScBkupArchiveInfo::Category() const + { + return iCategory; + } + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveInfo::FileName() +// +// +// --------------------------------------------------------------------------- +EXPORT_C const TDesC& CMMCScBkupArchiveInfo::FileName() const + { + return iFileInfo->FileName(); + } + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveInfo::DateTime() +// +// +// --------------------------------------------------------------------------- +EXPORT_C const TTime& CMMCScBkupArchiveInfo::DateTime() const + { + return iFileInfo->DateTime(); + } + +// --------------------------------------------------------------------------- +// CMMCScBkupArchiveInfo::Drive() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TDriveNumber CMMCScBkupArchiveInfo::Drive() const + { + return iFileInfo->Drive(); + } diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupBufferManagers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupBufferManagers.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,837 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupBufferManagerBase implementation +* +* +*/ + +#include "CMMCScBkupBufferManagers.h" + +// System includes +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupDataStrategies.h" +#include "MMMCScBkupArchiveDataInterface.h" +#include "MMMCScBkupProgressObserver.h" + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerBase::CMMCScBkupBufferManagerBase() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupBufferManagerBase::CMMCScBkupBufferManagerBase(MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI, TType aType ) +: iType( aType ), iBufferPointer( NULL, 0, 0 ), iProgressManager( aProgressManager ), iADI( aADI ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerBase::~CMMCScBkupBufferManagerBase() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupBufferManagerBase::~CMMCScBkupBufferManagerBase() + { + delete iBuffer; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerBase::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerBase::ConstructL(TInt aBufferSize) + { + HBufC8* buffer = HBufC8::NewL(aBufferSize); + delete iBuffer; + iBuffer = buffer; + iBufferPointer.Set(iBuffer->Des()); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerBase::NewByTypeL() +// +// Factory +// --------------------------------------------------------------------------- +CMMCScBkupBufferManagerBase* CMMCScBkupBufferManagerBase::NewByTypeL(TType aType, MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI, TAny* aParam1, TAny* aParam2) + { + CMMCScBkupBufferManagerBase* ret = NULL; + // + switch(aType) + { + case ETypeDescriptorToArchive: + ret = CMMCScBkupBufferManagerDescriptorToArchive::NewL( aProgressManager, aADI ); + break; + case ETypeFileToArchive: + ret = CMMCScBkupBufferManagerFileToArchive::NewL( aProgressManager, aADI ); + break; + case ETypeArchiveToDescriptor: + ret = CMMCScBkupBufferManagerArchiveToDescriptor::NewL( aProgressManager, aADI ); + break; + case ETypeArchiveToFile: + ret = CMMCScBkupBufferManagerArchiveToFile::NewL( aProgressManager, aADI ); + break; + default: + User::Leave(KErrNotSupported); + break; + } + // + CleanupStack::PushL(ret); + ret->InitializeL(aParam1, aParam2); + CleanupStack::Pop(ret); + // + return ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerBase::WriteToArchiveAndUpdateStatsL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerBase::WriteToArchiveAndUpdateStatsL( const TDesC8& aData ) + { + // Write the data we currently have to file. This reset + const TMMCScBkupArchiveVector& writtenInfo = ADI().ADIWriteL( aData ); + + // Update our stats. We combined what we've already written with + // the amount of data we just wrote. + if ( Info().Offset() == 0 ) + { + // Possibly never updated the offset before... + Info().SetOffset( writtenInfo.Offset() ); + } + // + const TInt existingLength = Info().Length(); + Info().SetLength( existingLength + writtenInfo.Length() ); + } + + + + + + + + + + + + + + + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerDescriptorToArchive::CMMCScBkupBufferManagerDescriptorToArchive() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupBufferManagerDescriptorToArchive::CMMCScBkupBufferManagerDescriptorToArchive( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) +: CMMCScBkupBufferManagerBase( aProgressManager, aADI, ETypeDescriptorToArchive ), iSource( KNullDesC8 ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerDescriptorToArchive::CMMCScBkupBufferManagerDescriptorToArchive() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupBufferManagerDescriptorToArchive* CMMCScBkupBufferManagerDescriptorToArchive::NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) + { + CMMCScBkupBufferManagerDescriptorToArchive* self = new(ELeave) CMMCScBkupBufferManagerDescriptorToArchive( aProgressManager, aADI ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerDescriptorToArchive::InitializeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerDescriptorToArchive::InitializeL(TAny* aParam1, TAny* /*aParam2*/) + { + const TDesC8* pData = reinterpret_cast(aParam1); + iSource.Set(*pData); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerDescriptorToArchive::InitializeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerDescriptorToArchive::InitializeL( CEZZStream& aZStream ) + { + // We use the source object as the input buffer. Therefore the + // dynamic buffer is used as an intermediate storage depot for compressed + // data before it is flushed to disk + aZStream.SetInput( iSource ); + aZStream.SetOutput( WriteBuffer() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerDescriptorToArchive::NeedInputL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerDescriptorToArchive::NeedInputL(CEZZStream& /*aZStream*/) + { + // Nothing to do here - we have provided all our input in one go + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerDescriptorToArchive::NeedOutputL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerDescriptorToArchive::NeedOutputL( CEZZStream& aZStream ) + { + const TPtrC8 output(aZStream.OutputDescriptor()); + WriteToArchiveAndUpdateStatsL( output ); + + // Reset ready for more writing + WriteBuffer().Zero(); + aZStream.SetOutput( WriteBuffer() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerDescriptorToArchive::FinalizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerDescriptorToArchive::FinalizeL( CEZZStream& aZStream ) + { + // Write any remaining data... + const TPtrC8 output(aZStream.OutputDescriptor()); + WriteToArchiveAndUpdateStatsL( output ); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerFileToArchive::CMMCScBkupBufferManagerFileToArchive() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupBufferManagerFileToArchive::CMMCScBkupBufferManagerFileToArchive( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) +: CMMCScBkupBufferManagerBase( aProgressManager, aADI, ETypeDescriptorToArchive ), iOutputPointer( NULL, 0, 0 ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerFileToArchive::~CMMCScBkupBufferManagerFileToArchive() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupBufferManagerFileToArchive::~CMMCScBkupBufferManagerFileToArchive() + { + delete iReadStrategy; + delete iOutput; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerFileToArchive::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerFileToArchive::ConstructL( const TDesC& aFileName ) + { + CMMCScBkupBufferManagerBase::ConstructL(); + // + CMMCScBkupDataStrategy* strategy = CMMCScBkupDataStrategy::ReadStrategyLC(aFileName, ADI().ADIFsSession()); + delete iReadStrategy; + iReadStrategy = strategy; + CleanupStack::Pop(strategy); + // + HBufC8* output = HBufC8::NewL(KScBkupDefaultBufferSize); + delete iOutput; + iOutput = output; + iOutputPointer.Set(iOutput->Des()); + // + iFileName.Set(aFileName); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerFileToArchive::CMMCScBkupBufferManagerFileToArchive() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupBufferManagerFileToArchive* CMMCScBkupBufferManagerFileToArchive::NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) + { + CMMCScBkupBufferManagerFileToArchive* self = new(ELeave) CMMCScBkupBufferManagerFileToArchive( aProgressManager, aADI ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerFileToArchive::InitializeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerFileToArchive::InitializeL(TAny* aParam1, TAny* /*aParam2*/) + { + const TDesC* pFileName = reinterpret_cast(aParam1); + const TPtrC fileName(*pFileName); + ConstructL(fileName); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerFileToArchive::InitializeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerFileToArchive::InitializeL( CEZZStream& aZStream ) + { + // Seed input buffer + TPtr8 pWriteBuffer( WriteBuffer() ); + iReadStrategy->Read( pWriteBuffer ); + aZStream.SetInput( pWriteBuffer ); + + // Progress during a backup is calculated based upon the amount of the + // source file that has been read. + ProgressManager().MMCScBkupHandleProgress( pWriteBuffer.Length() ); + + // Make ready for output + aZStream.SetOutput( iOutputPointer ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerFileToArchive::NeedInputL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerFileToArchive::NeedInputL( CEZZStream& aZStream ) + { + // Read some data from the file + TPtr8 pWriteBuffer( WriteBuffer() ); + iReadStrategy->Read( pWriteBuffer ); + + // Progress during a backup is calculated based upon the amount of the + // source file that has been read. + ProgressManager().MMCScBkupHandleProgress( pWriteBuffer.Length() ); + + aZStream.SetInput( pWriteBuffer ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerFileToArchive::NeedOutputL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerFileToArchive::NeedOutputL( CEZZStream& aZStream ) + { + const TPtrC8 output(aZStream.OutputDescriptor()); + WriteToArchiveAndUpdateStatsL( output ); + + // Reset ready for more writing + iOutputPointer.Zero(); + aZStream.SetOutput( iOutputPointer ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerFileToArchive::FinalizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerFileToArchive::FinalizeL( CEZZStream& aZStream ) + { + const TPtrC8 output(aZStream.OutputDescriptor()); + +#if defined(__MMCSCBKUPLOGGING_ENABLED__) + const TInt compressedSize = output.Size() + Info().Length(); + TEntry entry; + const TInt error = ADI().ADIFsSession().Entry(iFileName, entry); + if (error == KErrNone) + { + const TReal ratio = (TReal) entry.iSize / (TReal) compressedSize; + __LOG4("CMMCScBkupBufferManagerFileToArchive::FinalizeL() - compressing %S - original: %d, compressed: %d, ratio: %f", &iFileName, entry.iSize, compressedSize, ratio); + if (compressedSize > entry.iSize) + { + // We've made this file bigger + __LOG3("CMMCScBkupBufferManagerFileToArchive::FinalizeL() - compressing %S had negative effect - originalSize: %d vs compressed: %d", &iFileName, entry.iSize, compressedSize); + } + } +#endif + + WriteToArchiveAndUpdateStatsL( output ); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToDescriptor::CMMCScBkupBufferManagerArchiveToDescriptor() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupBufferManagerArchiveToDescriptor::CMMCScBkupBufferManagerArchiveToDescriptor( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) +: CMMCScBkupBufferManagerBase( aProgressManager, aADI, ETypeArchiveToDescriptor ), iOutputPointer( NULL, 0, 0 ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToDescriptor::~CMMCScBkupBufferManagerArchiveToDescriptor() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupBufferManagerArchiveToDescriptor::~CMMCScBkupBufferManagerArchiveToDescriptor() + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToDescriptor::CMMCScBkupBufferManagerArchiveToDescriptor() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupBufferManagerArchiveToDescriptor* CMMCScBkupBufferManagerArchiveToDescriptor::NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) + { + CMMCScBkupBufferManagerArchiveToDescriptor* self = new(ELeave) CMMCScBkupBufferManagerArchiveToDescriptor( aProgressManager, aADI ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToDescriptor::InitializeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerArchiveToDescriptor::InitializeL( TAny* aParam1, TAny* aParam2 ) + { + // Setup sink + TDes8* pDataSink = (TDes8*) aParam1; + iOutputPointer.Set( const_cast( pDataSink->Ptr() ), pDataSink->Length(), pDataSink->MaxLength() ); + + // Setup max read info + const TMMCScBkupArchiveVector* readInfo = (const TMMCScBkupArchiveVector*) aParam2; + Info() = *readInfo; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToDescriptor::InitializeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerArchiveToDescriptor::InitializeL( CEZZStream& aZStream ) + { + // Try to read some data + TryToReadMoreSourceDataL(); + + // We use the source object as the input buffer. Therefore the + // dynamic buffer is used as an intermediate storage depot for compressed + // data before it is flushed to disk + aZStream.SetInput( DataView() ); + aZStream.SetOutput( iOutputPointer ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToDescriptor::NeedInputL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerArchiveToDescriptor::NeedInputL(CEZZStream& aZStream) + { + // Try to read some more data + TryToReadMoreSourceDataL(); + aZStream.SetInput( DataView() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToDescriptor::NeedOutputL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerArchiveToDescriptor::NeedOutputL( CEZZStream& /*aZStream*/ ) + { + // Nothing to do here, we've got no more space if the sink is full + ASSERT( EFalse ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToDescriptor::FinalizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerArchiveToDescriptor::FinalizeL( CEZZStream& /*aZStream*/ ) + { + // Nothing to do here, we've writing straight to the client's descriptor + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToDescriptor::TryToReadMoreSourceDataL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerArchiveToDescriptor::TryToReadMoreSourceDataL() + { + if ( Info().Length() > 0 ) + { + // Try to read some source data, but don't read beyond the limits + const TMMCScBkupArchiveVector& readInfoResult = ADI().ADIReadL( WriteBuffer(), Info() ); + + // Update remaining read info so that we know where from and how much data + // to read next time around + const TInt newStartingOffset = readInfoResult.Offset() + readInfoResult.Length(); + const TInt remainingToBeRead = Info().Length() - readInfoResult.Length(); + // + Info().SetOffset( newStartingOffset ); + Info().SetLength( remainingToBeRead ); + // + __LOG1("CMMCScBkupBufferManagerArchiveToDescriptor::TryToReadMoreSourceDataL() - read: %d bytes from archive", readInfoResult.Length()); + // + ProgressManager().MMCScBkupHandleProgress( readInfoResult.Length() ); + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToFile::CMMCScBkupBufferManagerArchiveToFile() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupBufferManagerArchiveToFile::CMMCScBkupBufferManagerArchiveToFile( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) +: CMMCScBkupBufferManagerBase( aProgressManager, aADI, ETypeArchiveToFile ), iOutputPointer( NULL, 0, 0 ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToFile::~CMMCScBkupBufferManagerArchiveToFile() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupBufferManagerArchiveToFile::~CMMCScBkupBufferManagerArchiveToFile() + { + delete iWriteStrategy; + delete iOutput; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToFile::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerArchiveToFile::ConstructL( const TDesC& aFileName ) + { + CMMCScBkupBufferManagerBase::ConstructL(); + + // Create a write strategy that ultimately writes to a temp file in our + // private data cage. When the file has been successfully extracted, + // we then replace the original. -> see FinalizeL() + CMMCScBkupDataStrategy* strategy = CMMCScBkupDataStrategy::WriteStrategyLC( aFileName, ADI().ADIFsSession(), KMMCScBkupUseTempFile ); + delete iWriteStrategy; + iWriteStrategy = strategy; + CleanupStack::Pop( strategy ); + // + HBufC8* output = HBufC8::NewL(KScBkupDefaultBufferSize); + delete iOutput; + iOutput = output; + iOutputPointer.Set(iOutput->Des()); + // + iFileName.Set(aFileName); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToFile::CMMCScBkupBufferManagerArchiveToFile() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupBufferManagerArchiveToFile* CMMCScBkupBufferManagerArchiveToFile::NewL( MMMCScBkupProgressObserver& aProgressManager, MMMCScBkupArchiveDataInterface& aADI ) + { + CMMCScBkupBufferManagerArchiveToFile* self = new(ELeave) CMMCScBkupBufferManagerArchiveToFile( aProgressManager, aADI ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToFile::InitializeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerArchiveToFile::InitializeL(TAny* aParam1, TAny* aParam2) + { + // Param 1 is the destination file name + const TDesC* pFileName = reinterpret_cast(aParam1); + const TPtrC fileName(*pFileName); + ConstructL(fileName); + + // Param 2 defines where we should read archive data from (and how much we should read) + const TMMCScBkupArchiveVector* readInfo = (const TMMCScBkupArchiveVector*) aParam2; + Info() = *readInfo; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToFile::InitializeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerArchiveToFile::InitializeL( CEZZStream& aZStream ) + { + // Try to read some data + TryToReadMoreSourceDataL(); + + // Input comes from the base class buffer. Its effectively the + // data from the archive. + aZStream.SetInput( WriteBuffer() ); + + // Output goes to our secondary buffer - we'll eventually + // write this to the destination file. + aZStream.SetOutput( iOutputPointer ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToFile::NeedInputL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerArchiveToFile::NeedInputL( CEZZStream& aZStream ) + { + // Try to read some more data + TryToReadMoreSourceDataL(); + aZStream.SetInput( DataView() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToFile::NeedOutputL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerArchiveToFile::NeedOutputL( CEZZStream& aZStream ) + { + // Flush output to oure write strategy + const TPtrC8 output(aZStream.OutputDescriptor()); + const TInt error = iWriteStrategy->Write( output ); + User::LeaveIfError( error ); + + // Reset ready for more writing + iOutputPointer.Zero(); + aZStream.SetOutput( iOutputPointer ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToFile::FinalizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerArchiveToFile::FinalizeL( CEZZStream& aZStream ) + { + const TPtrC8 output(aZStream.OutputDescriptor()); + TInt error = iWriteStrategy->Write( output ); + User::LeaveIfError( error ); + + // No errors writing to temp file, try to finalise write strategy - + // essentially this replaces the original file. + error = iWriteStrategy->Finalize(); + User::LeaveIfError( error ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupBufferManagerArchiveToFile::TryToReadMoreSourceDataL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupBufferManagerArchiveToFile::TryToReadMoreSourceDataL() + { + if ( Info().Length() > 0 ) + { + // Try to read some source data, but don't read beyond the limits + const TMMCScBkupArchiveVector& readInfoResult = ADI().ADIReadL( WriteBuffer(), Info() ); + + // Update remaining read info so that we know where from and how much data + // to read next time around + const TInt newStartingOffset = readInfoResult.Offset() + readInfoResult.Length(); + const TInt remainingToBeRead = Info().Length() - readInfoResult.Length(); + // + Info().SetOffset( newStartingOffset ); + Info().SetLength( remainingToBeRead ); + // + __LOG2("CMMCScBkupBufferManagerArchiveToFile::TryToReadMoreSourceDataL() - read: %d bytes from archive when reconstructing: %S", readInfoResult.Length(), &iFileName ); + // + ProgressManager().MMCScBkupHandleProgress( readInfoResult.Length() ); + } + } + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupDataOwnerCollection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupDataOwnerCollection.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,567 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CMMCScBkupDataOwnerCollection implementation +* +* +*/ + +#include "CMMCScBkupDataOwnerCollection.h" + +// User includes +#include "MMCScBkupLogger.h" +#include "TMMCScBkupDriveAndSize.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "MMCScBkupSBEUtils.h" +#include "MMMCScBkupDriver.h" +#include "CMMCScBkupDriveDataSizeManager.h" +#include "RMMCScBkupProgressSizer.h" +#ifdef RD_FILE_MANAGER_BACKUP +#include "CMMCScBkupArchiveInfo.h" +#include "BkupEngine.hrh" +#endif + +// Constants +const TInt KMMCScBkupDataOwnerGranularity = 20; + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::CMMCScBkupDataOwnerCollection() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupDataOwnerCollection::CMMCScBkupDataOwnerCollection( MMMCScBkupDriver& aDriver, TBitFlags aCategory ) +: iDriver( aDriver ), iOwners(KMMCScBkupDataOwnerGranularity), iCategory( aCategory ) + { + } + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::~CMMCScBkupDataOwnerCollection() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupDataOwnerCollection::~CMMCScBkupDataOwnerCollection() + { + Reset(); + iOwners.Close(); + delete iRestoreSizer; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerCollection::ConstructL() + { + // The restore sizer data type is not relevant. It holds + // the combined disk space requirements for all drives + // for all data types. + iRestoreSizer = CMMCScBkupDriveSizer::NewLC( EMMCScBkupOwnerDataTypeAny ); + CleanupStack::Pop( iRestoreSizer ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupDataOwnerCollection* CMMCScBkupDataOwnerCollection::NewL( MMMCScBkupDriver& aDriver, TBitFlags aCategory ) + { + CMMCScBkupDataOwnerCollection* self = new(ELeave) CMMCScBkupDataOwnerCollection( aDriver, aCategory ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::AssignL() +// +// +// --------------------------------------------------------------------------- +#ifdef RD_FILE_MANAGER_BACKUP +TBool CMMCScBkupDataOwnerCollection::AssignL( const CMMCScBkupDataOwnerInfo& dataOwnerInfo ) + { + const CMMCScBkupArchiveInfo& archive = iDriver.DrvParamsBase().ArchiveInfo( Category() ); + const RArray& secureIds = archive.SIDs( Category() ); + const RArray& excludedSecureIds = archive.ExcludedSIDs( Category() ); + TBitFlags flags = archive.SpecialFlags(); + TBitFlags excludedFlags = archive.ExcludedSpecialFlags(); + + // Check whether data owner belongs to this category + if( BelongsToL( dataOwnerInfo, flags, excludedFlags, secureIds, excludedSecureIds) ) + { + iOwners.AppendL(&dataOwnerInfo); + return ETrue; + } + + return EFalse; + } +#else +void CMMCScBkupDataOwnerCollection::AssignL( RDataOwnerInfoArray& aArray ) + { + const TInt count = aArray.Count(); + // + for(TInt i=count-1; i>=0; i--) + { + // Ownership is immediately transferred to the backup owner info object + // so we should remove it from the array prior to passing into NewLC + conn::CDataOwnerInfo* sbDataOwner = aArray[i]; + aArray.Remove(i); // Ensures it won't be deleted twice + // + CMMCScBkupDataOwnerInfo* info = CMMCScBkupDataOwnerInfo::NewLC( sbDataOwner ); + iOwners.AppendL(info); + CleanupStack::Pop(info); + } + } +#endif + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::AppendL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerCollection::AppendL( CMMCScBkupDataOwnerInfo* aNewEntry ) + { + iOwners.AppendL( aNewEntry ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::Count() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupDataOwnerCollection::Count() const + { + return iOwners.Count(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::Owner() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::Owner(TInt aIndex) + { + CMMCScBkupDataOwnerInfo* info = iOwners[aIndex]; + return *info; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::Owner() +// +// +// --------------------------------------------------------------------------- +const CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::Owner(TInt aIndex) const + { + const CMMCScBkupDataOwnerInfo* info = iOwners[aIndex]; + return *info; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::OwnerL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::OwnerL( TSecureId aSID ) + { + TInt index = KErrNotFound; + CMMCScBkupDataOwnerInfo* ret = CMMCScBkupDataOwnerInfo::New( aSID ); + if (ret) + { + TIdentityRelation relation(CMMCScBkupDataOwnerInfo::CompareDataOwnerBySIDL); + index = iOwners.Find( ret, relation ); + delete ret; + ret = NULL; + } + // + if (index >= 0) + { + ret = iOwners[index]; + } + else + { + User::Leave(KErrNotFound); + } + // + return *ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::OwnerL() +// +// +// --------------------------------------------------------------------------- +const CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::OwnerL( TSecureId aSID ) const + { + CMMCScBkupDataOwnerCollection& self = *const_cast(this); + CMMCScBkupDataOwnerInfo& ret = self.OwnerL( aSID ); + return ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::OwnerL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::OwnerL( TUid aPackageId ) + { + CMMCScBkupDataOwnerInfo* ret = NULL; + const TInt count = iOwners.Count(); + // + for(TInt i=0; iOwner().Identifier() ); + if ( packageId == aPackageId ) + { + ret = entry; + } + } + // + if ( !ret ) + { + User::Leave(KErrNotFound); + } + // + return *ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::OwnerL() +// +// +// --------------------------------------------------------------------------- +const CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::OwnerL( TUid aPackageId ) const + { + CMMCScBkupDataOwnerCollection& self = *const_cast(this); + CMMCScBkupDataOwnerInfo& ret = self.OwnerL( aPackageId ); + return ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::OwnerL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::OwnerL( const TDesC& aHash ) + { + CMMCScBkupDataOwnerInfo* ret = NULL; + const TInt count = iOwners.Count(); + // + for(TInt i=0; iOwner().Identifier().DerivedTypeL(); + if ( type == EJavaDerivedType || type == EJavaTransferDerivedType ) + { + // Get hash + HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( entry->Owner().Identifier() ); + const TBool foundMatch = ( *hash == aHash ); + CleanupStack::PopAndDestroy( hash ); + + if ( foundMatch ) + { + ret = entry; + break; + } + } + } + // + if ( !ret ) + { + User::Leave(KErrNotFound); + } + // + return *ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::OwnerL() +// +// +// --------------------------------------------------------------------------- +const CMMCScBkupDataOwnerInfo& CMMCScBkupDataOwnerCollection::OwnerL( const TDesC& aHash ) const + { + CMMCScBkupDataOwnerCollection& self = *const_cast(this); + CMMCScBkupDataOwnerInfo& ret = self.OwnerL( aHash ); + return ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::Remove() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerCollection::Remove( TInt aIndex ) + { + CMMCScBkupDataOwnerInfo* info = iOwners[aIndex]; + delete info; + iOwners.Remove(aIndex); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::Reset() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerCollection::Reset() + { + iOwners.ResetAndDestroy(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::TotalOperationalSizeL() +// +// +// --------------------------------------------------------------------------- +TInt64 CMMCScBkupDataOwnerCollection::TotalOperationalSizeL() const + { + RMMCScBkupProgressSizer sizer( iDriver.DrvParamsBase().DriveAndOperations() ); + TInt64 size = 0; + // + const TInt count = Count(); + for(TInt i=0; i=0; i--) + { + // We check the SBE's common settings (for each Data Owner) to identify + // if a reboot is required. So long as one data owner requires a + // reboot, then we must reset the machine.. hence we break + // out of the loop immediately. + const CMMCScBkupDataOwnerInfo& info = *iOwners[i]; + const CDataOwnerInfo& sbeDataOwnerInfo = info.Owner(); + // + if ( sbeDataOwnerInfo.CommonSettings() & ERequiresReboot ) + { + rebootRequired = ETrue; + break; + } + } + // + return rebootRequired; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::DiskSpaceRequiredForRestore() +// +// +// --------------------------------------------------------------------------- +TInt64 CMMCScBkupDataOwnerCollection::DiskSpaceRequiredForRestore( TDriveNumber aDrive ) const + { + return iRestoreSizer->Size( aDrive ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::CalculateDiskSpaceRequiredForRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerCollection::CalculateDiskSpaceRequiredForRestoreL() + { + iRestoreSizer->Reset(); + // + RArray driveSizes; + CleanupClosePushL( driveSizes ); + // + const TInt count = iOwners.Count(); + for(TInt i=count-1; i>=0; i--) + { + const CMMCScBkupDataOwnerInfo& owner = *iOwners[i]; + __LOG(" "); + __LOG1("CMMCScBkupDataOwnerCollection::CalculateDiskSpaceRequiredForRestoreL() - owner: 0x%08x...", owner.SecureId().iId); + // + owner.OperationalSizesL( driveSizes ); + // + const TInt driveSizesCount = driveSizes.Count(); + for( TInt j=0; jAddToSizeL( entry.Size(), entry.Drive() ); + } + } + // + CleanupStack::PopAndDestroy( &driveSizes ); + +#ifdef __MMCSCBKUPLOGGING_ENABLED__ + __LOG(" "); + __LOG(" "); + __LOG(" "); + __LOG(" "); + __LOG("CMMCScBkupDataOwnerCollection::CalculateDiskSpaceRequiredForRestoreL() - SUMMARY:"); + __LOG(" "); + + for( TInt d = EDriveA; d<=EDriveZ; d++ ) + { + // Get the size of each data type for this drive. + const TDriveNumber drive = static_cast< TDriveNumber >( d ); + const TInt64 size = DiskSpaceRequiredForRestore( drive ); + + if ( size > 0 ) + { + __LOG2("CMMCScBkupDataOwnerCollection::CalculateDiskSpaceRequiredForRestoreL() - %8Ld bytes required for drive: %c:", size, drive + 'A' ); + } + } +#endif + } + +#ifdef RD_FILE_MANAGER_BACKUP +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::BelongsToL() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupDataOwnerCollection::BelongsToL(const CMMCScBkupDataOwnerInfo& aInfo, + TBitFlags aFlags, TBitFlags aExcludedFlags, + const RArray aSecureIds, const RArray aExcludedSecureIds) const + { + // First of all check if data owner has system or java data. If it has and these + // types have been declared as excluded data types, then skip owner in this catecory. + // Public data is more common to data owners together with other data types meaning it + // cannot be a reason to invalidate data owner. System's user data folder (e.g. C:\Data) files + // are being skipped later on in public data backup phase if category is not EBUCatUserFiles + // It would be possible to just skip excluded types per data owner, but it + // might make data owner unstable after restore + + if( ((aExcludedFlags.Value() & EBUCatSpecSystem) && aInfo.HasSystemDataL()) || + ((aExcludedFlags.Value() & EBUCatSpecJava) && aInfo.HasJavaDataL()) || + ((aExcludedFlags.Value() & EBUCatSpecPublic) && aInfo.HasPublicDataL()) ) + { + return EFalse; + } + + // Then check whether all specified and SID not in list of excluded owners + if( (aFlags.Value() & EBUCatSpecAll) ) + { + TBool excluded = EFalse; + + for(TInt i = 0; i < aExcludedSecureIds.Count(); i++) + { + if(aInfo.SecureId().iId == aExcludedSecureIds[i].iId) + { + excluded = ETrue; + break; + } + } + + return !excluded; + } + + // Then check whether special rules apply + if( ((aFlags.Value() & EBUCatSpecSystem) && aInfo.HasSystemDataL()) || + ((aFlags.Value() & EBUCatSpecJava) && aInfo.HasJavaDataL()) || + ((aFlags.Value() & EBUCatSpecPublic) && aInfo.HasPublicDataL()) ) + { + return ETrue; + } + + // Finally check whether SID matches + for(TInt i = 0; i < aSecureIds.Count(); i++) + { + if(aInfo.SecureId().iId == aSecureIds[i].iId) + { + return ETrue; + } + } + + return EFalse; + } +#endif + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::InternalizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerCollection::InternalizeL( RReadStream& aStream ) + { + aStream.ReadInt32L(); // EStreamFormatVersion1 + aStream.ReadInt32L(); // spare1 + aStream.ReadInt32L(); // spare2 + aStream.ReadInt32L(); // spare3 + + CMMCScBkupDriveSizer* restoreSizer = CMMCScBkupDriveSizer::NewLC( aStream ); + delete iRestoreSizer; + iRestoreSizer = restoreSizer; + CleanupStack::Pop( restoreSizer ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerCollection::ExternalizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerCollection::ExternalizeL( RWriteStream& aStream ) const + { + aStream.WriteInt32L( EStreamFormatVersion1 ); + aStream.WriteInt32L( 0 ); // spare1 + aStream.WriteInt32L( 0 ); // spare2 + aStream.WriteInt32L( 0 ); // spare3 + + aStream << *iRestoreSizer; + } + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupDataOwnerInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupDataOwnerInfo.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,560 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupDataOwnerInfo implementation +* +* +*/ + +#include "CMMCScBkupDataOwnerInfo.h" + +// System includes +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "MMCScBkupSBEUtils.h" +#include "MMMCScBkupArchiveDataInterface.h" +#include "CMMCScBkupDriveDataSizeManager.h" + +// Constants +_LIT_SECURE_ID(KMMCScBkupUninitialisedSecureId, 0); + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::CMMCScBkupDataOwnerInfo() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupDataOwnerInfo::CMMCScBkupDataOwnerInfo( CDataOwnerInfo* aOwner ) +: iDataOwner(aOwner), iVersion(EStreamFormatVersionLatest-1) + { + SetStatus(EUnset); + // + iSecureId = KMMCScBkupUninitialisedSecureId; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::~CMMCScBkupDataOwnerInfo() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupDataOwnerInfo::~CMMCScBkupDataOwnerInfo() + { + delete iDataOwner; + delete iOperationalSize; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerInfo::ConstructL() + { + if ( iOperationalSize == NULL ) + { + iOperationalSize = CMMCScBkupDataTypeSizer::NewL(); + } + + // Try and extract the SID if its a package or a SID type + const TSBDerivedType type = iDataOwner->Identifier().DerivedTypeL(); + // + if (type == ESIDDerivedType || type == EPackageDerivedType) + { + iSecureId = MMCScBkupSBEUtils::SecureIdFromGenericL(iDataOwner->Identifier()); + if( iSecureId.iId == KNullUid.iUid && iVersion > EStreamFormatVersion1 ) + { + iSecureId = MMCScBkupSBEUtils::PackageIdFromGenericL(iDataOwner->Identifier()); + } + } + + // The following code sets the completion status to ETrue + // for any irrelevant items associated with a data owner. I.e. if + // a data owner doesn't support active backup, then it sets the completion + // of active backup to ETrue. This makes writing the logic inside the + // active/passive/system backup items a little easier (active in particular) + const TBool hasJavaData = HasJavaDataL(); + const TBool hasActiveData = HasActiveDataL(); + const TBool hasPassiveData = HasPassiveDataL(); + const TBool hasPublicData = HasPublicDataL(); + const TBool hasSystemData = HasSystemDataL(); + + // Update completion statuses (i.e. "what work must be done") + SetCompletionStatus( EMMCScBkupOwnerDataTypeJavaData, !hasJavaData ); + SetCompletionStatus( EMMCScBkupOwnerDataTypeActiveData, !hasActiveData ); + SetCompletionStatus( EMMCScBkupOwnerDataTypePassiveData, !hasPassiveData ); + SetCompletionStatus( EMMCScBkupOwnerDataTypePublicData, !hasPublicData ); + SetCompletionStatus( EMMCScBkupOwnerDataTypeSystemData, !hasSystemData ); + + // Be aware that CMMCScBkupStateRequestSizeOfDataOwner::GetJavaDataSizesL() can + // manipulate the passive data completion status depending on whether the midlet + // has associated data files. + + // If we're logging, then we write out some useful debugging info that shows + // which operations must be performed for each D.O. +#ifdef __MMCSCBKUPLOGGING_ENABLED__ + TBuf<256> drivePrint; + const TDriveList& driveList = iDataOwner->DriveList(); + + for(TInt i=0; iIdentifier() ); + __LOG7("CMMCScBkupDataOwnerInfo::ConstructL() - PubD: %d, ActD: %d, PasD: %d, JavD: %d, SysD: %d, drives: %S, hash: %S", hasPublicData, hasActiveData, hasPassiveData, hasJavaData, hasSystemData, &drivePrint, hash); + CleanupStack::PopAndDestroy( hash ); + } + else + { + __LOG8("CMMCScBkupDataOwnerInfo::ConstructL() - PubD: %d, ActD: %d, PasD: %d, JavD: %d, SysD: %d, drives: %S, SID : 0x%08x %S", hasPublicData, hasActiveData, hasPassiveData, hasJavaData, hasSystemData, &drivePrint, iSecureId.iId, &MMCScBkupLogger::FriendlyNameForSID( iSecureId )); + } +#endif + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::New() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupDataOwnerInfo* CMMCScBkupDataOwnerInfo::New( TSecureId aSecureId ) + { + CMMCScBkupDataOwnerInfo* self = new CMMCScBkupDataOwnerInfo( NULL ); + if (self) + { + self->iSecureId = aSecureId; + } + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::NewLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupDataOwnerInfo* CMMCScBkupDataOwnerInfo::NewLC( CDataOwnerInfo* aOwner ) + { + CleanupStack::PushL(aOwner); + CMMCScBkupDataOwnerInfo* self = new(ELeave) CMMCScBkupDataOwnerInfo( aOwner ); + CleanupStack::Pop(aOwner); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::NewLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupDataOwnerInfo* CMMCScBkupDataOwnerInfo::NewLC( RReadStream& aStream ) + { + CMMCScBkupDataOwnerInfo* self = new(ELeave) CMMCScBkupDataOwnerInfo(); + CleanupStack::PushL(self); + aStream >> *self; + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::Owner() +// +// +// --------------------------------------------------------------------------- +CDataOwnerInfo& CMMCScBkupDataOwnerInfo::Owner() + { + return *iDataOwner; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::Owner() +// +// +// --------------------------------------------------------------------------- +const CDataOwnerInfo& CMMCScBkupDataOwnerInfo::Owner() const + { + return *iDataOwner; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::Status() +// +// +// --------------------------------------------------------------------------- +TDataOwnerStatus CMMCScBkupDataOwnerInfo::Status() const + { + return iStatus; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::SetStatus() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerInfo::SetStatus(TDataOwnerStatus aStatus) + { + iStatus = aStatus; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::AddToOperationalSizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerInfo::AddToOperationalSizeL( TMMCScBkupOwnerDataType aType, TDriveNumber aDrive, TInt64 aSize ) + { + iOperationalSize->AddToSizeL( aType, aSize, aDrive ); + +#if defined(__MMCSCBKUPLOGGING_ENABLED__) + const TInt64 newSize = iOperationalSize->Size( aType, aDrive ); + __LOG5("CMMCScBkupDataOwnerInfo::AddToOperationalSizeL() - [0x%08x] - aSize: %8Ld, newSize: %8Ld, aDrive: %c:, aType: %S", iSecureId.iId, aSize, newSize, aDrive + 'A', &MMCScBkupLogger::DataType( aType ) ); +#endif + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::SetOperationalSizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerInfo::SetOperationalSizeL( TMMCScBkupOwnerDataType aType, TDriveNumber aDrive, TInt64 aSize ) + { + iOperationalSize->Reset( aType, aDrive ); + iOperationalSize->AddToSizeL( aType, aSize, aDrive ); + + __LOG4("CMMCScBkupDataOwnerInfo::SetOperationalSizeL() - [0x%08x] - aSize: %8Ld, aDrive: %c:, aType: %S", iSecureId.iId, aSize, aDrive + 'A', &MMCScBkupLogger::DataType( aType ) ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::ResetOperationalSize() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerInfo::ResetOperationalSize( TMMCScBkupOwnerDataType aType ) + { + iOperationalSize->Reset( aType ); + __LOG2("CMMCScBkupDataOwnerInfo::ResetOperationalSize() - [0x%08x] - aType: %S", iSecureId.iId, &MMCScBkupLogger::DataType( aType ) ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::OperationalSize() +// +// +// --------------------------------------------------------------------------- +TInt64 CMMCScBkupDataOwnerInfo::OperationalSize( TMMCScBkupOwnerDataType aType, TDriveNumber aDrive ) const + { + const TInt64 size = iOperationalSize->Size( aType, aDrive ); + + __LOG4("CMMCScBkupDataOwnerInfo::OperationalSize() - [0x%08x] - size: %8Ld, aDrive: %c:, aType: %S", iSecureId.iId, size, aDrive + 'A', &MMCScBkupLogger::DataType( aType ) ); + + return size; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::OperationalSize() +// +// +// --------------------------------------------------------------------------- +TInt64 CMMCScBkupDataOwnerInfo::OperationalSize( TMMCScBkupOwnerDataType aType ) const + { + const TInt64 size = iOperationalSize->Size( aType ); + + //__LOG3("CMMCScBkupDataOwnerInfo::OperationalSize() - [0x%08x] - size: %8Ld, aType: %S", iSecureId.iId, size, &MMCScBkupLogger::DataType( aType ) ); + + return size; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::OperationalSize() +// +// +// --------------------------------------------------------------------------- +TInt64 CMMCScBkupDataOwnerInfo::OperationalSize( TDriveNumber aDrive ) const + { + const TInt64 size = iOperationalSize->CombinedSize( aDrive ); + + //__LOG3("CMMCScBkupDataOwnerInfo::OperationalSize() - [0x%08x] - size: %8Ld, aDrive: %c:", iSecureId.iId, size, aDrive + 'A' ); + + return size; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::OperationalSizesL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerInfo::OperationalSizesL( RArray& aSizes ) const + { + iOperationalSize->GetSizesL( aSizes ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::SetCompletionStatus() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerInfo::SetCompletionStatus( TMMCScBkupOwnerDataType aType, TBool aCompleted ) + { + iCompletionStatus[aType] = aCompleted; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::CompletionStatus() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupDataOwnerInfo::CompletionStatus( TMMCScBkupOwnerDataType aType ) const + { + return iCompletionStatus[aType]; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::ActiveDataRetryCount() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupDataOwnerInfo::ActiveDataRetryCount() const + { + return iActiveDataRetryCount; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::SetActiveDataRetryCount() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerInfo::SetActiveDataRetryCount(TInt aCount) + { + iActiveDataRetryCount = aCount; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::InternalizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerInfo::InternalizeL(RReadStream& aStream) + { + iVersion = aStream.ReadInt32L(); // EStreamFormatVersionX + aStream.ReadInt32L(); // spare1 + aStream.ReadInt32L(); // spare2 + aStream.ReadInt32L(); // spare3 + + // Secure ID + iSecureId = aStream.ReadInt32L(); + + // Data sizes + CMMCScBkupDataTypeSizer* operationalSize = CMMCScBkupDataTypeSizer::NewLC( aStream ); + delete iOperationalSize; + iOperationalSize = operationalSize; + CleanupStack::Pop( operationalSize ); + + // Read data owner buffer length + TCardinality dataOwnerLength; + aStream >> dataOwnerLength; + + // Internalize the data owner (as raw descriptor) + HBufC8* dataOwnerBuffer = HBufC8::NewLC( dataOwnerLength ); + TPtr8 pDataOwnerBuffer( dataOwnerBuffer->Des() ); + aStream.ReadL( pDataOwnerBuffer, dataOwnerLength ); + // + CDataOwnerInfo* dataOwner = CDataOwnerInfo::NewL( *dataOwnerBuffer ); + delete iDataOwner; + iDataOwner = dataOwner; + CleanupStack::PopAndDestroy( dataOwnerBuffer ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::ExternalizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataOwnerInfo::ExternalizeL(RWriteStream& aStream) const + { + aStream.WriteInt32L( EStreamFormatVersion2 ); + aStream.WriteInt32L( 0 ); // spare1 + aStream.WriteInt32L( 0 ); // spare2 + aStream.WriteInt32L( 0 ); // spare3 + + // Always write secure id + aStream.WriteInt32L( iSecureId ); + + // ... and always write the data sizes + aStream << *iOperationalSize; + + // Externalize the data owner to an HBufC8 + HBufC8* dataOwnerBuffer = iDataOwner->ExternaliseL(); + CleanupStack::PushL( dataOwnerBuffer ); + + // Write leading byte count - helps us when it comes to internalising + const TCardinality dataOwnerLength( dataOwnerBuffer->Length() ); + aStream << dataOwnerLength; + + // Now write the data owner buffer - not using chevrons just in case it + // does funny unicode compression stuff... + aStream.WriteL( *dataOwnerBuffer ); + + CleanupStack::PopAndDestroy(dataOwnerBuffer); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::CompareDataOwnerBySIDL() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupDataOwnerInfo::CompareDataOwnerBySIDL(const CMMCScBkupDataOwnerInfo& aLeft, const CMMCScBkupDataOwnerInfo& aRight) + { + TBool same = EFalse; + + // If we have an owner object, then we first compare the derived types. + // If not, we just directly compare the SIDs + if ( aLeft.iDataOwner && aRight.iDataOwner ) + { + const TSBDerivedType leftType = aLeft.Owner().Identifier().DerivedTypeL(); + const TSBDerivedType rightType = aRight.Owner().Identifier().DerivedTypeL(); + // + same = ((leftType == rightType) || + (leftType == ESIDDerivedType && rightType == EPackageDerivedType) || + (leftType == EPackageDerivedType && rightType == ESIDDerivedType) + ); + } + else if ( aRight.iDataOwner ) + { + // Check that it is not Java data owner in question. Java DOs all have + // secure id 0x0, but it could also be the case for certain package + // data owners (see for KDummyId in SBE implementation). + if( !MMCScBkupSBEUtils::HasJavaDataL( aRight.Owner() ) ) + { + // ..set to ETrue to trip next if-statement + same = ETrue; + } + } + + // Now compare the SID's themselves + if ( same ) + { + same = (aLeft.SecureId() == aRight.SecureId()); + } + // + return same; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::HasJavaDataL() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupDataOwnerInfo::HasJavaDataL() const + { + const TBool hasJavaData = MMCScBkupSBEUtils::HasJavaDataL( *iDataOwner ); + const TInt64 opSize = OperationalSize( EMMCScBkupOwnerDataTypeJavaData ); + // + return hasJavaData || (opSize > 0 ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::HasActiveDataL() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupDataOwnerInfo::HasActiveDataL() const + { + const TBool hasActiveData = MMCScBkupSBEUtils::HasActiveDataL( *iDataOwner ); + const TInt64 opSize = OperationalSize( EMMCScBkupOwnerDataTypeActiveData ); + // + return hasActiveData || (opSize > 0 ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::HasPassiveDataL() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupDataOwnerInfo::HasPassiveDataL() const + { + const TBool hasPassiveData = MMCScBkupSBEUtils::HasPassiveDataL( *iDataOwner ); + const TInt64 opSize = OperationalSize( EMMCScBkupOwnerDataTypePassiveData ); + // + return hasPassiveData || (opSize > 0 ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::HasPublicDataL() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupDataOwnerInfo::HasPublicDataL() const + { + const TBool hasPublicData = MMCScBkupSBEUtils::HasPublicDataL( *iDataOwner ); + const TInt64 opSize = OperationalSize( EMMCScBkupOwnerDataTypePublicData ); + // + return hasPublicData || (opSize > 0 ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataOwnerInfo::HasSystemDataL() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupDataOwnerInfo::HasSystemDataL() const + { + const TBool hasSystemData = MMCScBkupSBEUtils::HasSystemDataL( *iDataOwner ); + const TInt64 opSize = OperationalSize( EMMCScBkupOwnerDataTypeSystemData ); + // + return hasSystemData || (opSize > 0 ); + } + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupDataStrategies.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupDataStrategies.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,542 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupDataStrategy implementation +* +* +*/ + +#include "CMMCScBkupDataStrategies.h" + +// User includes +#include "MMCScBkupConfig.h" +#include "MMCScBkupLogger.h" + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupDataStrategy::CMMCScBkupDataStrategy() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupDataStrategy::CMMCScBkupDataStrategy() + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataStrategy::ReadStrategyLC() +// +// Factory function +// --------------------------------------------------------------------------- +CMMCScBkupDataStrategy* CMMCScBkupDataStrategy::ReadStrategyLC(const TDesC& aName, RFs& aFsSession) + { + // Fetch the size + TEntry entry; + const TInt error = aFsSession.Entry(aName, entry); + User::LeaveIfError(error); + + // Construct + return CMMCScBkupDataStrategy::ReadStrategyLC(aName, aFsSession, 0, entry.iSize); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataStrategy::ReadStrategyLC() +// +// Factory function +// --------------------------------------------------------------------------- +CMMCScBkupDataStrategy* CMMCScBkupDataStrategy::ReadStrategyLC(const TDesC& aName, RFs& aFsSession, TInt aOffset, TInt aLength) + { + CMMCScBkupDataStrategy* ret = NULL; + + // First, try a normal read strategy + TRAPD(err, ret = CMMCScBkupDataFileStrategy::NewForReadingL(aName, aFsSession)); + if (err != KErrNone) + { + // Try the file section read strategy - don't trap this - if it fails + // then this file cannot be read... + ret = CMMCScBkupDataFileSectionReadStrategy::NewL(aName, aFsSession); + } + // + if (ret) + { + ret->SetOffsetAndLength(aOffset, aLength); + } + // + CleanupStack::PushL( ret ); + return ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataStrategy::WriteStrategyLC() +// +// Factory function +// --------------------------------------------------------------------------- +CMMCScBkupDataStrategy* CMMCScBkupDataStrategy::WriteStrategyLC( const TDesC& aName, RFs& aFsSession, TBool aUseTempFile ) + { + CMMCScBkupDataStrategy* ret = CMMCScBkupDataFileStrategy::NewForWritingL( aName, aFsSession, aUseTempFile ); + CleanupStack::PushL(ret); + return ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataStrategy::Write() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupDataStrategy::Write(const TDesC8& /*aSource*/) + { + return KErrNotSupported; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataStrategy::Finalize() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupDataStrategy::Finalize() + { + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataStrategy::SetOffsetAndLength() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataStrategy::SetOffsetAndLength(TInt aStartOffset, TInt aLengthToRead) + { + iOffset = aStartOffset; + iLengthToRead = aLengthToRead; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupDataFileStrategy::CMMCScBkupDataFileStrategy() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupDataFileStrategy::CMMCScBkupDataFileStrategy( RFs& aFsSession, TBool aUseTempFile ) +: iFsSession( aFsSession ), iUseTempFile( aUseTempFile ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataFileStrategy::~CMMCScBkupDataFileStrategy() +// +// C++ destructor. +// --------------------------------------------------------------------------- +CMMCScBkupDataFileStrategy::~CMMCScBkupDataFileStrategy() + { + iFile.Close(); + delete iFileName; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataFileStrategy::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataFileStrategy::ConstructL( const TDesC& aName, TUint aMode ) + { + iFileName = aName.AllocL(); + + // The previous version of this engine would attempt to use the old + // backup & restore API to close this file. + // + // With the new Symbian Secure Backup Architecture, data owners are expected + // to release file locks on public files as soon as they receive + // notification that a backup is beginning. + TInt error = KErrNone; + // + if ( iUseTempFile ) + { + // Ensure path for temporary files exists on same drive where file will eventually + // be stored. This is important, because we estimate available size on target drive + // and so also temporary file size affects whether restore can be carried out. + HBufC* tempPath = HBufC::NewLC( KMaxFileName ); + TPtr pTempPath( tempPath->Des() ); + pTempPath.Zero(); + if(aName.Length()) + { + pTempPath.Append( aName[0] ); + } + else + { + const TDriveUnit driveUnit( KMMCScBkupTempFileDrive ); + const TDriveName drive( driveUnit.Name() ); + pTempPath.Append( drive ); + } + pTempPath.Append( KMMCScBkupTempDir ); + + error = iFsSession.MkDirAll( pTempPath ); + if ( ! (error == KErrNone || error == KErrAlreadyExists) ) + { + User::LeaveIfError( error ); + } + + // Make a temporary file + error = iFile.Temp( iFsSession, pTempPath, iTempFileName, aMode ); + __LOG2("CMMCScBkupDataFileStrategy::ConstructL() - Created temporary file: %S, error code: %d", &iTempFileName, error); + + // Clean up + CleanupStack::PopAndDestroy( tempPath ); + } + else + { + if( aMode & EFileWrite ) + { + error = PrepareToOverwriteFile( iFsSession, *iFileName ); + + if ( error == KErrNone ) + { + error = iFile.Create( iFsSession, *iFileName, aMode ); + __LOG2("CMMCScBkupDataFileStrategy::ConstructL() - Created file %S, error code: %d", iFileName, error); + } + } + else + { + error = iFile.Open( iFsSession, aName, aMode ); + } + } + // + User::LeaveIfError(error); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataFileStrategy::NewForReadingL() +// +// Factory function +// --------------------------------------------------------------------------- +CMMCScBkupDataFileStrategy* CMMCScBkupDataFileStrategy::NewForReadingL( const TDesC& aName, RFs& aFsSession ) + { + const TUint mode = EFileRead | EFileShareReadersOnly | EFileStream; + // + CMMCScBkupDataFileStrategy* self = new(ELeave) CMMCScBkupDataFileStrategy( aFsSession ); + CleanupStack::PushL(self); + self->ConstructL( aName, mode ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataFileStrategy::NewForWritingL() +// +// Factory function +// --------------------------------------------------------------------------- +CMMCScBkupDataFileStrategy* CMMCScBkupDataFileStrategy::NewForWritingL( const TDesC& aName, RFs& aFsSession, TBool aUseTempFile ) + { + const TUint mode = EFileWrite | EFileStream; + // + CMMCScBkupDataFileStrategy* self = new(ELeave) CMMCScBkupDataFileStrategy( aFsSession, aUseTempFile ); + CleanupStack::PushL(self); + self->ConstructL( aName, mode ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataFileStrategy::Read() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupDataFileStrategy::Read(TDes8& aSink) + { + TInt error = KErrNone; + // + aSink.Zero(); + TInt amountToRead = (LengthToRead() - Offset()); + if (amountToRead > aSink.MaxLength()) + { + amountToRead = aSink.MaxLength(); + } + // + if (amountToRead > 0) + { + // Do the read + error = iFile.Read( static_cast(Offset()), aSink, amountToRead ); + if (error == KErrNone) + { + SetOffset( Offset() + aSink.Length() ); + } + } + // + return error; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataFileStrategy::Write() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupDataFileStrategy::Write(const TDesC8& aSource) + { + // Offset writing not supported (no requirement) + const TInt error = iFile.Write( aSource ); + return error; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataFileStrategy::Finalize() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupDataFileStrategy::Finalize() + { + TInt error = KErrNone; + // + if ( iUseTempFile ) + { + // Prepare for over-write + error = PrepareToOverwriteFile( iFsSession, *iFileName ); + // + if ( error == KErrNone ) + { + // Finally, do the rename + error = iFile.Rename( *iFileName ); + __LOG2("CMMCScBkupDataFileStrategy::Finalize() - Renamed temporary file as: %S, error code: %d", iFileName, error); + } + } + + // Whatever the situation, we close the file now + iFile.Close(); + return error; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataFileStrategy::PrepareToOverwriteFile() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupDataFileStrategy::PrepareToOverwriteFile( RFs& aFsSession, const TDesC& aFileName ) + { + TInt err = KErrNone; + + // Create the full path, if not exists + err = aFsSession.MkDirAll( aFileName ); + + if( err == KErrAlreadyExists || !err ) + { + // Reset file flags + err = aFsSession.SetAtt( aFileName, KEntryAttNormal, !KEntryAttNormal ); + } + + if( !err ) + { + // Delete the file + err = aFsSession.Delete( aFileName ); + } + + if( err == KErrNotFound ) + { + // These errors are ignored + err = KErrNone; + } + + return err; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupDataFileSectionReadStrategy::CMMCScBkupDataFileSectionReadStrategy() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupDataFileSectionReadStrategy::CMMCScBkupDataFileSectionReadStrategy(RFs& aFsSession) +: iFsSession(aFsSession) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataFileSectionReadStrategy::~CMMCScBkupDataFileSectionReadStrategy() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupDataFileSectionReadStrategy::~CMMCScBkupDataFileSectionReadStrategy() + { + delete iFileName; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataFileSectionReadStrategy::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataFileSectionReadStrategy::ConstructL(const TDesC& aName) + { + iFileName = aName.AllocL(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataFileSectionReadStrategy::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupDataFileSectionReadStrategy* CMMCScBkupDataFileSectionReadStrategy::NewL(const TDesC& aName, RFs& aFsSession) + { + CMMCScBkupDataFileSectionReadStrategy* self = new(ELeave) CMMCScBkupDataFileSectionReadStrategy(aFsSession); + CleanupStack::PushL(self); + self->ConstructL(aName); + CleanupStack::Pop(self); + return self; + } + + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataFileSectionReadStrategy::Read() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupDataFileSectionReadStrategy::Read(TDes8& aSink) + { + TInt error = KErrNone; + // + aSink.Zero(); + TInt amountToRead = (LengthToRead() - Offset()); + if (amountToRead > aSink.MaxLength()) + { + amountToRead = aSink.MaxLength(); + } + // + if (amountToRead > 0) + { + // Do the read + error = iFsSession.ReadFileSection( *iFileName, Offset(), aSink, amountToRead ); + if (error == KErrNone) + { + SetOffset( Offset() + aSink.Length() ); + } + } + return error; + } + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupDriveAndOperationTypeManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupDriveAndOperationTypeManager.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,218 @@ +/* +* 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: CMMCScBkupDriveAndOperationTypeManager implementation +* +* +*/ + +#include "CMMCScBkupDriveAndOperationTypeManager.h" + +// User includes +#include "MMCScBkupLogger.h" +#ifdef RD_MULTIPLE_DRIVE +#include "BkupEngine.hrh" +#include +#include +#endif // RD_MULTIPLE_DRIVE + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveAndOperationTypeManager::CMMCScBkupDriveAndOperationTypeManager() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupDriveAndOperationTypeManager::CMMCScBkupDriveAndOperationTypeManager() + { + iCalculatedDriveList.SetMax(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveAndOperationTypeManager::CMMCScBkupDriveAndOperationTypeManager() +// +// C++ destructor. +// --------------------------------------------------------------------------- +EXPORT_C CMMCScBkupDriveAndOperationTypeManager::~CMMCScBkupDriveAndOperationTypeManager() + { + iEntries.Close(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveAndOperationTypeManager::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDriveAndOperationTypeManager::ConstructL( BkupDrivesAndOperationList *aDriveList ) + { +#ifdef RD_MULTIPLE_DRIVE + RFs& fs( CCoeEnv::Static()->FsSession() ); + + // Get all user visible drives + TInt numDrives( 0 ); + TDriveList drvList; + User::LeaveIfError( DriveInfo::GetUserVisibleDrives( + fs, drvList, numDrives ) ); + TInt drvListLen( drvList.Length() ); + TMMCScBkupDriveAndOperationType op; + TInt count( aDriveList->Count() ); + + // Get default system drive + TInt sysDrive( 0 ); + User::LeaveIfError( DriveInfo::GetDefaultDrive( + DriveInfo::EDefaultSystem, sysDrive ) ); + + for( TInt i( 0 ); i < count; ++i ) + { + TBkupDrivesAndOperation *drvAndOp = &((*aDriveList)[i]); + TUint drvCategories( drvAndOp->drvCategories() ); + TMMCScBkupOwnerDataType dataType( + static_cast< TMMCScBkupOwnerDataType >( drvAndOp->ownerDataType() ) ); + + if ( drvCategories & EBkupDeviceMemories ) + { + // Default system drive is always backed up when + // device memories are defined + op.SetDrive( static_cast< TDriveNumber >( sysDrive ) ); + op.SetDataType( dataType ); + iEntries.AppendL( op ); + iCalculatedDriveList[ op.Drive() ] = ETrue; + } + + for ( TInt j( 0 ); j < drvListLen; ++j ) + { + if ( sysDrive != j && drvList[ j ] ) + { + // Check for other drives + TBool append( EFalse ); + TUint drvStatus( 0 ); + User::LeaveIfError( DriveInfo::GetDriveStatus( + fs, j, drvStatus ) ); + if ( ( drvCategories & EBkupDeviceMemories ) && + ( drvStatus & DriveInfo::EDriveInternal ) && + !( drvStatus & DriveInfo::EDriveExternallyMountable ) && + !( drvStatus & DriveInfo::EDriveReadOnly ) ) + { + append = ETrue; // Allow additional device memory + } + else if ( ( drvCategories & EBkupInternalMassStorages ) && + ( drvStatus & DriveInfo::EDriveInternal ) && + ( drvStatus & DriveInfo::EDriveExternallyMountable ) ) + { + append = ETrue; // Allow internal mass storage + } + else if ( ( drvCategories & EBkupExternalMassStorages ) && + ( drvStatus & DriveInfo::EDriveRemovable ) ) + { + append = ETrue; // Allow external mass storage + } + if ( append ) + { + op.SetDrive( static_cast< TDriveNumber >( j ) ); + op.SetDataType( dataType ); + iEntries.AppendL( op ); + iCalculatedDriveList[ op.Drive() ] = ETrue; + } + } + } + } +#else // RD_MULTIPLE_DRIVE + TMMCScBkupDriveAndOperationType op; + const TInt count = aReader.ReadInt8(); + // + for( TInt i=0; i( aReader.ReadInt8() ) ); + op.SetDataType( static_cast< TMMCScBkupOwnerDataType >( aReader.ReadInt8() ) ); + // + iEntries.AppendL( op ); + // + iCalculatedDriveList[ op.Drive() ] = ETrue; + } +#endif // RD_MULTIPLE_DRIVE + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveAndOperationTypeManager::NewL() +// +// +// --------------------------------------------------------------------------- +EXPORT_C CMMCScBkupDriveAndOperationTypeManager* CMMCScBkupDriveAndOperationTypeManager::NewL(\ + BkupDrivesAndOperationList *aDriveList ) + { + CMMCScBkupDriveAndOperationTypeManager* self = new(ELeave) CMMCScBkupDriveAndOperationTypeManager(); + CleanupStack::PushL( self ); + self->ConstructL( aDriveList ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveAndOperationTypeManager::Count() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupDriveAndOperationTypeManager::Count() const + { + return iEntries.Count(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveAndOperationTypeManager::At() +// +// +// --------------------------------------------------------------------------- +const TMMCScBkupDriveAndOperationType& CMMCScBkupDriveAndOperationTypeManager::At( TInt aIndex ) const + { + return iEntries[ aIndex ]; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveAndOperationTypeManager::IsDataTypeAllowedToAccessDrive() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupDriveAndOperationTypeManager::IsDataTypeAllowedToAccessDrive( TDriveNumber aDrive, TMMCScBkupOwnerDataType aDataType ) const + { +// __LOG2("CMMCScBkupDriveAndOperationTypeManager::IsDataTypeAllowedToAccessDrive() - START - aDrive: %c, aDataType: %S", aDrive + 'A', &MMCScBkupLogger::DataType( aDataType )); + + TBool allowed = EFalse; + // + const TInt count = iEntries.Count(); + // + for( TInt i=0; iConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSizer::NewLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupDriveSizer* CMMCScBkupDriveSizer::NewLC( RReadStream& aStream ) + { + CMMCScBkupDriveSizer* self = new(ELeave) CMMCScBkupDriveSizer( EMMCScBkupOwnerDataTypeAny ); + CleanupStack::PushL(self); + aStream >> *self; + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSizer::AddToSizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDriveSizer::AddToSizeL( TInt64 aAmount, TDriveNumber aDrive ) + { + TMMCScBkupDriveAndSize* entry = EntryByDrive( aDrive ); + // + if ( entry == NULL ) + { + if ( aAmount > 0 ) + { + TMMCScBkupDriveAndSize newEntry( aDrive, aAmount ); + iEntries.AppendL( newEntry ); + } + } + else + { + entry->AddToSize( aAmount ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSizer::Reset() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDriveSizer::Reset() + { + const TInt count = iEntries.Count(); + for( TInt i=0; iSetSize( 0 ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSizer::Size() +// +// +// --------------------------------------------------------------------------- +TInt64 CMMCScBkupDriveSizer::Size() const + { + TInt64 size = 0; + // + const TInt count = iEntries.Count(); + for( TInt i=0; i( this )->EntryByDrive( aDrive ); + // + if ( entry != NULL ) + { + size = entry->Size(); + } + // + return size; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSizer::InternalizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDriveSizer::InternalizeL(RReadStream& aStream) + { + aStream.ReadInt32L(); // EStreamFormatVersion1 + aStream.ReadInt32L(); // spare1 + aStream.ReadInt32L(); // spare2 + // + iDataType = static_cast< TMMCScBkupOwnerDataType >( aStream.ReadInt8L() ); + const TInt count = aStream.ReadInt8L(); + for( TInt i=0; i> entry; + iEntries.AppendL( entry ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSizer::ExternalizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDriveSizer::ExternalizeL(RWriteStream& aStream) const + { + aStream.WriteInt32L( EStreamFormatVersion1 ); + aStream.WriteInt32L( 0 ); // spare1 + aStream.WriteInt32L( 0 ); // spare2 + // + aStream.WriteInt8L( iDataType ); + + // Work out how many non-zero entries we need to write. + TInt i = 0; + const TInt count = iEntries.Count(); + TInt numberOfExternalisedEntries = 0; + // + for( i=0; i 0 ) + { + ++numberOfExternalisedEntries; + } + } + + // Now really write the entries... + aStream.WriteInt8L( numberOfExternalisedEntries ); + if ( numberOfExternalisedEntries > 0 ) + { + for( i=0; i 0 ) + { + aStream << entry; + } + } + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSizer::EntryByDrive() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupDriveAndSize* CMMCScBkupDriveSizer::EntryByDrive( TDriveNumber aDrive ) + { + TMMCScBkupDriveAndSize* ret = NULL; + // + const TInt count = iEntries.Count(); + for( TInt i=0; iConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataTypeSizer::NewLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupDataTypeSizer* CMMCScBkupDataTypeSizer::NewLC( RReadStream& aStream ) + { + CMMCScBkupDataTypeSizer* self = new(ELeave) CMMCScBkupDataTypeSizer(); + CleanupStack::PushL(self); + aStream >> *self; + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataTypeSizer::AddToSizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataTypeSizer::AddToSizeL( TMMCScBkupOwnerDataType aDataType, TInt64 aAmount, TDriveNumber aDrive ) + { + CMMCScBkupDriveSizer* sizer = SizerByDataType( aDataType ); + ASSERT( sizer != NULL ); + sizer->AddToSizeL( aAmount, aDrive ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataTypeSizer::Reset() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataTypeSizer::Reset( TMMCScBkupOwnerDataType aDataType ) + { + CMMCScBkupDriveSizer* sizer = SizerByDataType( aDataType ); + ASSERT( sizer != NULL ); + sizer->Reset(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataTypeSizer::Reset() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataTypeSizer::Reset( TMMCScBkupOwnerDataType aDataType, TDriveNumber aDrive ) + { + CMMCScBkupDriveSizer* sizer = SizerByDataType( aDataType ); + ASSERT( sizer != NULL ); + sizer->Reset( aDrive ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataTypeSizer::Size() +// +// +// --------------------------------------------------------------------------- +TInt64 CMMCScBkupDataTypeSizer::Size( TMMCScBkupOwnerDataType aDataType ) const + { + CMMCScBkupDriveSizer* sizer = const_cast< CMMCScBkupDataTypeSizer* >( this )->SizerByDataType( aDataType ); + ASSERT( sizer != NULL ); + const TInt64 size = sizer->Size(); + return size; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataTypeSizer::Size() +// +// +// --------------------------------------------------------------------------- +TInt64 CMMCScBkupDataTypeSizer::Size( TMMCScBkupOwnerDataType aDataType, TDriveNumber aDrive ) const + { + CMMCScBkupDriveSizer* sizer = const_cast< CMMCScBkupDataTypeSizer* >( this )->SizerByDataType( aDataType ); + ASSERT( sizer != NULL ); + const TInt64 size = sizer->Size( aDrive ); + return size; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataTypeSizer::GetSizesL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataTypeSizer::GetSizesL( RArray& aSizes ) const + { + aSizes.Reset(); + // + for( TInt d = EDriveA; d<=EDriveZ; d++ ) + { + // Get the size of each data type for this drive. + const TDriveNumber drive = static_cast< TDriveNumber >( d ); + TMMCScBkupDriveAndSize driveAndSize( drive, 0 ); + + const TInt count = iSizers.Count(); + for( TInt i=0; iSize( drive ); + // + driveAndSize.AddToSize( sizeOfDataForDrive ); + } + + // Add the entry if the size is more than 0 + if ( driveAndSize.Size() > 0 ) + { + aSizes.AppendL( driveAndSize ); + } + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataTypeSizer::CombinedSize() +// +// +// --------------------------------------------------------------------------- +TInt64 CMMCScBkupDataTypeSizer::CombinedSize( TDriveNumber aDrive ) const + { + TInt64 size = 0; + // + const TInt count = iSizers.Count(); + for( TInt i=0; iSize( aDrive ); + } + // + return size; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDataTypeSizer::InternalizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDataTypeSizer::InternalizeL(RReadStream& aStream) + { + aStream.ReadInt32L(); // EStreamFormatVersion1 + aStream.ReadInt32L(); // spare1 + aStream.ReadInt32L(); // spare2 + // + const TInt count = aStream.ReadInt8L(); + for( TInt i=0; iDataType() == aDataType ) + { + ret = sizer; + break; + } + } + // + return ret; + } + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupDriveSpecificRequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupDriveSpecificRequest.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,204 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupDriveSpecificRequest implementation +* +* +*/ + +#include "CMMCScBkupDriveSpecificRequest.h" + +// User includes +#include "CMMCScBkupDriveAndOperationTypeManager.h" + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSpecificRequest::CMMCScBkupDriveSpecificRequest() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupDriveSpecificRequest::CMMCScBkupDriveSpecificRequest( const CMMCScBkupDriveAndOperationTypeManager& aDriveAndOperations, TMMCScBkupOwnerDataType aDataType, CActive::TPriority aPriority ) +: CActive(aPriority), iDriveAndOperations(aDriveAndOperations), iDataType( aDataType ) + { + CActiveScheduler::Add(this); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSpecificRequest::~CMMCScBkupDriveSpecificRequest() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupDriveSpecificRequest::~CMMCScBkupDriveSpecificRequest( ) + { + Cancel(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSpecificRequest::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDriveSpecificRequest::ConstructL( ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSpecificRequest::RequestL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDriveSpecificRequest::RequestL( TRequestStatus& aObserver ) + { + // Set to -1 so that when RunL is called, the next drive will be calculated + // as 0 == EDriveA + iCurrentDrive = -1; + iObserver = &aObserver; + *iObserver = KRequestPending; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSpecificRequest::NextValidDrive() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupDriveSpecificRequest::NextValidDrive(TDriveNumber& aDrive) + { + // If we've already reached Z then there isn't any sense in continuing + // as all drives have been processed. + TBool driveAvailable = EFalse; + + // Keep checking drives until we go past Z + while( ++iCurrentDrive <= EDriveZ ) + { + if ( iDriveAndOperations.DriveList()[ iCurrentDrive ] != 0 ) + { + const TDriveNumber drive = static_cast< TDriveNumber >( iCurrentDrive ); + + // Drive is allowable according to master list. + // But is this data type allowed to access that drive? + if ( iDataType == EMMCScBkupOwnerDataTypeAny ) + { + // Found an available drive - data type filtering is not in play... + aDrive = drive; + driveAvailable = ETrue; + break; + } + else if ( iDriveAndOperations.IsDataTypeAllowedToAccessDrive( drive, iDataType ) ) + { + // Found an available drive - this data type is allowed to access that drive... + aDrive = drive; + driveAvailable = ETrue; + break; + } + } + } + // + return driveAvailable; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSpecificRequest::NextValidDrive() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupDriveSpecificRequest::NextValidDrive(TDriveNumber& aDrive, const TDriveList& aCrossCheckList) + { + TDriveNumber drive; + TBool driveAvailable = NextValidDrive(drive); + + while(driveAvailable) + { + // Check if aCrossCheckList also supports the same drive + if (aCrossCheckList[drive] != 0) + { + aDrive = drive; + break; + } + else + { + // Try another drive from our master list + driveAvailable = NextValidDrive(drive); + } + } + // + return driveAvailable; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSpecificRequest::CurrentDrive() +// +// +// --------------------------------------------------------------------------- +TDriveNumber CMMCScBkupDriveSpecificRequest::CurrentDrive() const + { + return static_cast(iCurrentDrive); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSpecificRequest::DoCancel() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDriveSpecificRequest::DoCancel() + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSpecificRequest::RunError() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupDriveSpecificRequest::RunError(TInt aError) + { +#ifdef MMCSCBKUP_USE_BREAKPOINTS + __BREAKPOINT(); +#endif + // + CompleteObserverRequest(aError); + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSpecificRequest::CompleteObserverRequest() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDriveSpecificRequest::CompleteObserverRequest(TInt aCompletionCode) + { + __ASSERT_ALWAYS(iObserver != NULL, User::Invariant()); + User::RequestComplete(iObserver, aCompletionCode); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupDriveSpecificRequest::CompleteSelf() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupDriveSpecificRequest::CompleteSelf(TInt aCompletionCode) + { + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, aCompletionCode); + } + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupEngine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupEngine.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CMMCScBkupEngine implementation +* +* +*/ + +#include "CMMCScBkupEngine.h" + +// User includes +#include "CMMCScBkupEngineImpl.h" + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupEngine::CMMCScBkupEngine() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupEngine::CMMCScBkupEngine() + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngine::~CMMCScBkupEngine() +// +// Destructor. +// --------------------------------------------------------------------------- +EXPORT_C CMMCScBkupEngine::~CMMCScBkupEngine() + { + delete iEngine; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngine::ConstructL() +// +// Second phase constructor +// --------------------------------------------------------------------------- +void CMMCScBkupEngine::ConstructL( RFs& aFsSession ) + { + iEngine = CMMCScBkupEngineImpl::NewL( aFsSession ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngine::NewL() +// +// Static constructor +// --------------------------------------------------------------------------- +EXPORT_C CMMCScBkupEngine* CMMCScBkupEngine::NewL( RFs& aFsSession ) + { + CMMCScBkupEngine* self = new(ELeave) CMMCScBkupEngine(); + CleanupStack::PushL( self ); + self->ConstructL( aFsSession ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngine::StartOperationL() +// +// +// --------------------------------------------------------------------------- +EXPORT_C void CMMCScBkupEngine::StartOperationL(TMMCScBkupOperationType aOperation, MMMCScBkupEngineObserver& aObserver, CMMCScBkupOpParamsBase* aParams) + { + TRAPD(err, iEngine->StartOperationL( aOperation, aObserver, aParams )); + + if(err != KErrNone) + { + TRAP_IGNORE( aObserver.HandleBkupEngineEventL( MMMCScBkupEngineObserver::ECommonOperationError, err) ); + TRAP_IGNORE( aObserver.HandleBkupEngineEventL( MMMCScBkupEngineObserver::ECommonOperationEnded, err) ); + // Call cleanup externally, because engine cannot be yet in active state and resources remain unfreed + iEngine->CleanupL(KErrCancel); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngine::CancelOperation() +// +// +// --------------------------------------------------------------------------- +EXPORT_C void CMMCScBkupEngine::CancelOperation() + { + iEngine->Cancel(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngine::ValidArchiveForRestore() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TBool CMMCScBkupEngine::ValidArchiveForRestore( const TDesC& aFileName ) + { + TBool archiveOkay = EFalse; + // + TRAPD(err, archiveOkay = iEngine->ValidArchiveForRestoreL( aFileName ) ); + if ( err != KErrNone ) + { + archiveOkay = EFalse; + } + // + return archiveOkay; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngine::TotalOperationSizeL() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TInt64 CMMCScBkupEngine::TotalOperationSizeL() const + { + return iEngine->TotalOperationSizeL(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngine::RebootRequired() +// +// NOTE: This method is not used in S60 3.x - Sysap handles the reboot +// --------------------------------------------------------------------------- +EXPORT_C TBool CMMCScBkupEngine::RebootRequired() const + { + return iEngine->RebootRequired(); + } + +EXPORT_C TBool CMMCScBkupEngine::DeleteArchivesL( RPointerArray< CMMCScBkupArchiveInfo >& aArchives ) const + { + return iEngine->DeleteArchivesL( aArchives ); + } +// --------------------------------------------------------------------------- +// CMMCScBkupEngine::ListArchivesL() +// +// Provide a list of archives available on all drives +// --------------------------------------------------------------------------- +EXPORT_C void CMMCScBkupEngine::ListArchivesL( + RPointerArray< CMMCScBkupArchiveInfo >& aArchives, + CMMCScBkupOpParamsBase* aParams, + const TUint32 aDriveAttMatch, + const TInt aDriveMatch ) const + { + return iEngine->ListArchivesL( + aArchives, aParams, aDriveAttMatch, aDriveMatch ); + } diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupEngineImpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupEngineImpl.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,1208 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CMMCScBkupEngineImpl implementation +* +* +*/ + +#include "CMMCScBkupEngineImpl.h" + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupState.h" +#include "MMCScBkupSBEUtils.h" +#include "CMMCScBkupArchive.h" +#include "MMCScBkupOperations.h" +#include "MMCScBkupArchiveUtils.h" +#include "CMMCScBkupStateFactory.h" +#include "MMCScBkupPhoneModelUtils.h" +#include "MMMCScBkupEngineObserver.h" +#include "CMMCScBkupFileListCollection.h" +#include "CMMCScBkupDataOwnerCollection.h" +#include "CMMCScBkupOperationParameters.h" +#include "CMMCScBkupArchiveInfo.h" +#include "BkupEngine.hrh" +#include + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::CMMCScBkupEngineImpl() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupEngineImpl::CMMCScBkupEngineImpl( RFs& aFsSession ) +: CActive( CActive::EPriorityIdle ), + iFsSession(aFsSession), + iCurrentArchive(0), + iTotalProgress(0), + iActiveDataProcessingOngoing(EFalse) + { + CActiveScheduler::Add(this); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::~CMMCScBkupEngineImpl() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupEngineImpl::~CMMCScBkupEngineImpl() + { + Cancel(); + // + TRAP_IGNORE(CleanupL()); + + iArchives.Close(); + iDataOwners.Close(); + iFileLists.Close(); + delete iSBEClient; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::ConstructL() +// +// Second phase constructor +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::ConstructL() + { + __LOG("CMMCScBkupEngineImpl::ConstructL() - START"); + +#ifdef MAKE_SBE_LOGGING_DIRECTORY + _LIT( KSBELoggingDir, "C:\\Logs\\connect\\" ); + iFsSession.MkDirAll( KSBELoggingDir ); +#endif +#ifdef MAKE_MMCSCBKUP_LOGGING_DIRECTORY + iFsSession.MkDirAll( KMMCScBkupLoggingFullPath ); +#endif + + __LOG("CMMCScBkupEngineImpl::ConstructL() - END"); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::NewL() +// +// Static constructor +// --------------------------------------------------------------------------- +CMMCScBkupEngineImpl* CMMCScBkupEngineImpl::NewL( RFs& aFsSession ) + { + CMMCScBkupEngineImpl* self = new(ELeave) CMMCScBkupEngineImpl( aFsSession ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::StartOperationL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::StartOperationL(TMMCScBkupOperationType aOperation, MMMCScBkupEngineObserver& aObserver, CMMCScBkupOpParamsBase* aParams) + { + __ASSERT_DEBUG(DrvOperation() == EMMCScBkupOperationTypeIdle, User::Invariant()); // + + // Setup our observer - we will report progress via this interface + iObserver = &aObserver; + + // Take ownership of the parameters immediately + SetParameters(aParams); + + if(!iSBEClient) + { + __LOG("CMMCScBkupEngineImpl::ConstructL() - creating SBE client..."); + iSBEClient = CSBEClient::NewL(); + } + +#if defined(__MMCSCBKUPLOGGING_ENABLED__) + // Create a logging directory for logging purposes and empty contents + // in order to have the log only from last backup or restore operation + CFileMan* fileMan = CFileMan::NewL( iFsSession ); + CleanupStack::PushL( fileMan ); + TParse* path = new(ELeave) TParse(); + + CleanupStack::PushL(path); + path->Set(KMMCScBkupLoggingFullPathAndName, NULL, NULL); + fileMan->Delete( path->Path(), CFileMan::ERecurse ); // Ignore error + iFsSession.MkDirAll( path->Path() ); + + CleanupStack::PopAndDestroy(2, fileMan ); +#endif + + // Prepare supporting objects + PrepareObjectsL(); + + // Work out what to do... + CreateFactoryL( aOperation ); + // + switch(aOperation) + { + case EMMCScBkupOperationTypeIdle: + __ASSERT_ALWAYS(EFalse, User::Invariant()); + break; + case EMMCScBkupOperationTypeFullBackup: + case EMMCScBkupOperationTypePartialBackup: + PrepareForBackupL( DrvOperation() == EMMCScBkupOperationTypePartialBackup ); + break; + case EMMCScBkupOperationTypeFullRestore: + case EMMCScBkupOperationTypePartialRestore: + PrepareForRestoreL( DrvOperation() == EMMCScBkupOperationTypePartialRestore ); + break; + } + + // Do this last, after everything that can leave has been executed + iOperationType = aOperation; + + // Notify the observer we're starting up + NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationStarting); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::ValidArchiveForRestoreL() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupEngineImpl::ValidArchiveForRestoreL( const TDesC& aFileName ) + { + const TBool valid = CMMCScBkupArchive::ValidArchiveForRestoreL( iFsSession, aFileName ); + return valid; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::TotalOperationSizeL() +// +// +// --------------------------------------------------------------------------- +TInt64 CMMCScBkupEngineImpl::TotalOperationSizeL() const + { + const TInt64 size = iDataOwners[iCurrentArchive]->TotalOperationalSizeL(); + return size; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::RebootRequired() +// +// NOTE: This method is not used in S60 3.x - Sysap handles the reboot +// --------------------------------------------------------------------------- +TBool CMMCScBkupEngineImpl::RebootRequired() const + { + // Criteria for a reboot are: + // + // 1) One or more data owners indicate that a reboot is necessary + // via their backup_registration.xml files. + // + // 2) The current operation is some form of restore (partial or full). + + const TMMCScBkupOperationType currentOp = DrvOperation(); + __LOG1("CMMCScBkupEngineImpl::RebootRequired() - operation type is: %d", currentOp); + + TBool singleDataOwnerNeedsReboot = EFalse; + + for(TInt i = 0; i < iDataOwners.Count(); i++) + { + singleDataOwnerNeedsReboot |= iDataOwners[i]->RebootRequired(); + } + + __LOG1("CMMCScBkupEngineImpl::RebootRequired() - D.O requires reboot?: %d", singleDataOwnerNeedsReboot); + + const TBool rebootRequired = singleDataOwnerNeedsReboot && + ( currentOp == EMMCScBkupOperationTypeFullRestore || + currentOp == EMMCScBkupOperationTypePartialRestore ); + __LOG1("CMMCScBkupEngineImpl::RebootRequired() - final rebootRequired value: %d", rebootRequired); + + // We return the value to the caller - the UI will display appropriate + // UI dialogs and reset the machine as appropriate. + return rebootRequired; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::DrvADI() +// +// +// --------------------------------------------------------------------------- +MMMCScBkupArchiveDataInterface& CMMCScBkupEngineImpl::DrvADI() const + { + return iArchives[iCurrentArchive]->ADI(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::DrvArchive() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupArchive& CMMCScBkupEngineImpl::DrvArchive() const + { + __ASSERT_ALWAYS(iCurrentArchive < iArchives.Count(), User::Invariant()); + + return *iArchives[iCurrentArchive]; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::DrvSecureBackupClient() +// +// +// --------------------------------------------------------------------------- +CSBEClient& CMMCScBkupEngineImpl::DrvSecureBackupClient() const + { + return *iSBEClient; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::DrvOperation() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupOperationType CMMCScBkupEngineImpl::DrvOperation() const + { + return iOperationType; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::DrvParamsBase() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupOpParamsBase& CMMCScBkupEngineImpl::DrvParamsBase() const + { + return *iParameters; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::DrvDataOwners() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupDataOwnerCollection& CMMCScBkupEngineImpl::DrvDataOwners() const + { + __ASSERT_ALWAYS(iCurrentArchive < iDataOwners.Count(), User::Invariant()); + + return *iDataOwners[iCurrentArchive]; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::DrvDataOwnersAll() +// +// +// --------------------------------------------------------------------------- +RPointerArray& CMMCScBkupEngineImpl::DrvDataOwnersAll() + { + return iDataOwners; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::DrvFileList() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupFileListCollection& CMMCScBkupEngineImpl::DrvFileList() const + { + __ASSERT_ALWAYS(iCurrentArchive < iFileLists.Count(), User::Invariant()); + + return *iFileLists[iCurrentArchive]; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::DrvLastCategory() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupEngineImpl::DrvLastCategory() const + { + return ( (iCurrentArchive + 1) == iArchives.Count() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::DrvStoreTotalProgress() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::DrvStoreTotalProgress(TInt64 aProgress) + { + iTotalProgress += aProgress; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::DrvTotalProgress() +// +// +// --------------------------------------------------------------------------- +TInt64 CMMCScBkupEngineImpl::DrvTotalProgress() const + { + return iTotalProgress; + } + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::DrvProgressHandler() +// +// +// --------------------------------------------------------------------------- +MMMCScBkupProgressObserver& CMMCScBkupEngineImpl::DrvProgressHandler() const + { + CMMCScBkupEngineImpl* self = const_cast< CMMCScBkupEngineImpl* > (this); + return *self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::MMCScBkupHandleProgress() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::MMCScBkupHandleProgress( TInt aAmountCompleted ) + { + __ASSERT_ALWAYS( aAmountCompleted >= 0, User::Invariant() ); + if (aAmountCompleted > 0) + { + __LOG1("CMMCScBkupEngineImpl::MMCScBkupHandleProgress() - amount: %d", aAmountCompleted); + iCumulativeProgress += aAmountCompleted; + + // Notify the observer that we've calculated the operational size + NotifyObserver( MMMCScBkupEngineObserver::ECommonProgress, iCumulativeProgress ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::MMCScBkupHandleProgressDomainUnderstood() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::MMCScBkupHandleProgressDomainUnderstood( TInt aTotalProgressAmount ) + { + __LOG1("CMMCScBkupEngineImpl::MMCScBkupHandleProgressDomainUnderstood() - ##### TOTAL PROGRESS AMOUNT IS: %d", aTotalProgressAmount); + + // Notify the observer that we've calculated the operational size + NotifyObserver( MMMCScBkupEngineObserver::ECommonSizeOfTaskUnderstood, aTotalProgressAmount ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::MMCScBkupHandleFreeSpace() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupEngineImpl::MMCScBkupHandleFreeSpace( TInt aPercentualFree ) + { + TInt error(KErrNone); + + TRAP_IGNORE( error = iObserver->HandleBkupEngineEventL( MMMCScBkupEngineObserver::EBackupAnalysingData, aPercentualFree ) ); + + return error; + } + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::MMCScBkupStartBackuping() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::MMCScBkupStartBackuping( TBool aProceed ) + { + __LOG1("CMMCScBkupEngineImpl::MMCScBkupStartBackuping() - Disk space validation done, proceed %d", aProceed); + + if( !aProceed ) + { + // If there is no space to carry out backup, "restore" existing backup file, + // so that it can still be restored. + for(TInt i = 0; i < iArchives.Count(); i++) + { + iArchives[i]->RestoreOldArchive( ); + } + } + else + { + // Clean up existing backup files. + for(TInt i = 0; i < iArchives.Count(); i++) + { + iArchives[i]->DeleteOldArchive( ); + } + } + } + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::RunL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::RunL() + { + __LOG(" "); + __LOG(" "); + if ( !CurrentStateAvailable() ) + { + __LOG2("CMMCScBkupEngineImpl::RunL() - START - iStatus: %d, iCurrentArchive %d", + iStatus.Int(), iCurrentArchive); + } + else + { + __LOG3("CMMCScBkupEngineImpl::RunL() - START - iStatus: %d, state: 0x%08x, iCurrentArchive %d", + iStatus.Int(), CurrentState().StateId().iUid, iCurrentArchive); + } + + User::LeaveIfError(iStatus.Int()); + + // Get the state that just finished - its always the head item + const TBool stateStepAvailable = CurrentStateAvailable(); + __ASSERT_ALWAYS(stateStepAvailable, User::Invariant()); + CMMCScBkupState& currentState = CurrentState(); + + // Store completed state id as we're about to delete the object + // so it won't be available afterwards... + const TMMCScBkupStateId completedState = currentState.StateId(); + + // Identify which state should run next. In effect each state + // defines the overall state machine. This is required since + // some states need to dynamically change which state is executed + // next. A good example is the archive op for active data - when + // one or more active data clients are not ready, then the next + // state should be to requery their readyness. After their + // readyness has been ascertained, then any DO's that have now + // become ready should be archived. This process continues + // until all Active Data owners have provided all their data. + TMMCScBkupStateId nextState; + + __LOG3("CMMCScBkupEngineImpl::RunL() - iActiveDataProcessingOngoing %d, completedState 0x%08x, nextState 0x%08x", + iActiveDataProcessingOngoing, completedState.iUid, currentState.NextStateId().iUid); + + // Identify should we run current state again, i.e. run that state + // for next category. If state does not require processing of same + // state several times, then move on to next state. + if( currentState.CategorySpecific() != CMMCScBkupState::EStateOnce ) + { + // For simplicity let's collect active data for each category in row. + // This means checking data owner status before proceeding to next category. + if( iActiveDataProcessingOngoing ) + { + iActiveDataProcessingOngoing = EFalse; + nextState = currentState.NextStateId(); + } + else + { + if( completedState == KMMCScBkupStateIdArchiveOpActiveData ) + { + if( currentState.NextStateId() == KMMCScBkupStateIdGetDataOwnerStatuses ) + { + // There is still some active data to be processed + iActiveDataProcessingOngoing = ETrue; + nextState = KMMCScBkupStateIdGetDataOwnerStatuses; + } + } + + if( !iActiveDataProcessingOngoing ) + { + if( ++iCurrentArchive < iArchives.Count() ) + { + nextState = completedState; + } + else + { + iCurrentArchive = 0; + nextState = currentState.NextStateId(); + } + } + } + } + else + { + iCurrentArchive = 0; + nextState = currentState.NextStateId(); + } + + if(nextState == completedState && currentState.CategorySpecific() == CMMCScBkupState::EStatePerCategoryCommon) + { + __LOG2("CMMCScBkupEngineImpl::RunL() - object not recreated for state: 0x%08x, iCurrentArchive %d", + nextState.iUid, iCurrentArchive); + } + else + { + // Remove the completed state (destroys 'currentState') + DestroyCurrentState(); + // Identify the next state. Causes RunL to be called when the state + // has finished executing + __LOG2("CMMCScBkupEngineImpl::RunL() - preparing state: 0x%08x, iCurrentArchive %d", + nextState.iUid, iCurrentArchive); + + PrepareNextStateL( nextState ); + } + + if (CurrentStateAvailable()) + { +#if defined(__MMCSCBKUPLOGGING_ENABLED__) + CMMCScBkupState& newState = CurrentState(); + if( newState.CategorySpecific() != CMMCScBkupState::EStateOnce ) + { + __LOG2("CMMCScBkupEngineImpl::RunL() - executing category specific state: 0x%08x for category 0x%x", + nextState.iUid, iArchives[iCurrentArchive]->Category().iFlags); + } + else + { + __LOG1("CMMCScBkupEngineImpl::RunL() - executing non category specific state: 0x%08x", nextState.iUid); + } +#endif + ExecuteStateL(); + } + else + { + if ( iSBEClient ) + { + MMCScBkupSBEUtils::EndBackupOrRestoreL( *iSBEClient ); + } + // Signal we are about to finish, so that bkupchecker can be notified. + NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationPrepareEnded); + // We've finished + CleanupL(); + NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationEnded); + // Remove observer + iObserver = NULL; + } + + __LOG3("CMMCScBkupEngineImpl::RunL() - END - nextState: 0x%08x, isActive: %d, iStatus: %d", nextState.iUid, IsActive(), iStatus.Int()); + __LOG(" "); + __LOG(" "); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::DoCancel() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::DoCancel() + { + __LOG("CMMCScBkupEngineImpl::DoCancel() - START"); + + if (CurrentStateAvailable()) + { + __LOG1("CMMCScBkupEngineImpl::DoCancel() - current state is: 0x%08x", CurrentState().StateId().iUid); + + // Our request should be completed by the state + CurrentState().Cancel(); + } + + // Signal we are about to finish, so that bkupchecker can be notified. + NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationPrepareEnded); + // Cleanup + TRAP_IGNORE( CleanupL( KErrCancel ) ); + + // Ensure observer is informed + NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationError, KErrCancel); + NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationEnded, KErrCancel); + // Remove observer + iObserver = NULL; + + __LOG("CMMCScBkupEngineImpl::DoCancel() - END"); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::RunError() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupEngineImpl::RunError(TInt aError) + { + __LOG1("CMMCScBkupEngineImpl::RunError() - START - aError: %d", aError); + + // Inform observer of error + NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationError, aError); + // Signal we are about to finish, so that bkupchecker can be notified. + NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationPrepareEnded); + // Cleanup + TRAP_IGNORE( CleanupL( aError ) ); + + // Finalize observer + NotifyObserver(MMMCScBkupEngineObserver::ECommonOperationEnded, aError); + // Remove observer + iObserver = NULL; + + // Return KErrNone to stop the scheduler from panicking our thread + + __LOG("CMMCScBkupEngineImpl::RunError() - END"); + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::CompleteOwnRequest() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::CompleteOwnRequest(TInt aCompletionCode, TBool aSetActive) + { + if (aSetActive) + { + SetActive(); + } + // + TRequestStatus* status = &iStatus; + User::RequestComplete(status, aCompletionCode); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::NotifyObserver() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::NotifyObserver( MMMCScBkupEngineObserver::TEvent aEvent, TInt aAssociatedData ) + { + if ( iObserver ) + { + TRAP_IGNORE( iObserver->HandleBkupEngineEventL( aEvent, aAssociatedData ) ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::PrepareForBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::PrepareForBackupL( TBool aPartial ) + { +#ifdef DEBUGGING_DATA_TRANSFER + CleanBackupFilesL(); +#endif + + // Open the archives for writing + for(TInt i = 0; i < iArchives.Count(); i++) + { + const TPtrC pArchiveName( DrvParamsBase().FileName(i) ); + iArchives[i]->OpenForWritingL( pArchiveName ); + } + + // Initialise our state model + if ( !aPartial ) + { + // Starting a FULL BACKUP + PrepareNextStateL( KMMCScBkupStateArchiveOpArchiveHeader ); + ExecuteStateL(); + } + else + { + User::Leave( KErrNotSupported ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::PrepareForRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::PrepareForRestoreL( TBool aPartial ) + { +#ifdef DEBUGGING_DATA_TRANSFER + ClearRestoreFilesL(); +#endif + + // Open the archives for reading + for(TInt i = 0; i < iArchives.Count(); i++) + { + const TPtrC pArchiveName( DrvParamsBase().FileName(i) ); + iArchives[i]->OpenForReadingL( pArchiveName ); + +#ifdef RD_FILE_MANAGER_BACKUP + // Validate archive content is not altered +#if defined(__MMCSCBKUPLOGGING_ENABLED__) + TUint32 startTime = User::NTickCount(); +#endif + TInt validArchiveForRestore = MMCScBkupArchiveUtils::ValidateArchiveCrcsL( iFsSession, pArchiveName ); +#if defined(__MMCSCBKUPLOGGING_ENABLED__) + __LOG2("CMMCScBkupEngineImpl::PrepareForRestoreL - crcs validation result %d, ticks in ms %u", + validArchiveForRestore, User::NTickCount() - startTime); +#endif + if(validArchiveForRestore == EFalse) + { + User::Leave(KErrCorrupt); + } +#endif + } + + // Initialise our state model + if ( !aPartial ) + { + // Starting a FULL RESTORE + PrepareNextStateL( KMMCScBkupStateArchiveOpArchiveHeader ); + ExecuteStateL(); + } + else + { + User::Leave( KErrNotSupported ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::SetParameters() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::SetParameters(CMMCScBkupOpParamsBase* aParameters) + { + __ASSERT_ALWAYS(aParameters != NULL, User::Invariant()); + // + delete iParameters; + iParameters = aParameters; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::CreateFactoryL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::CreateFactoryL(TMMCScBkupOperationType aOperation) + { + __ASSERT_DEBUG(iFactory == NULL, User::Invariant()); + // + CMMCScBkupStateFactory* factory = CMMCScBkupStateFactory::FactoryByOperationTypeLC(aOperation); + delete iFactory; + iFactory = factory; + CleanupStack::Pop( factory ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::CurrentStateAvailable() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupEngineImpl::CurrentStateAvailable() const + { + return (iCurrentState != NULL); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::CurrentStateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupEngineImpl::CurrentStateId() const + { + __ASSERT_ALWAYS(CurrentStateAvailable(), User::Invariant()); + return CurrentState().StateId(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::CurrentState() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupState& CMMCScBkupEngineImpl::CurrentState() + { + return *iCurrentState; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::CurrentState() +// +// +// --------------------------------------------------------------------------- +const CMMCScBkupState& CMMCScBkupEngineImpl::CurrentState() const + { + return *iCurrentState; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::PrepareNextStateL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::PrepareNextStateL( TMMCScBkupStateId aNextState ) + { + if ( aNextState != KMMCScBkupStateIdOperationComplete ) + { + CMMCScBkupState* nextState = iFactory->GetStateLC( aNextState, *this ); + delete iCurrentState; + iCurrentState = nextState; + CleanupStack::Pop( nextState ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::DestroyCurrentState() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::DestroyCurrentState() + { + delete iCurrentState; + iCurrentState = NULL; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::ExecuteStateL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::ExecuteStateL() + { + const TBool stateStepAvailable = CurrentStateAvailable(); + __ASSERT_ALWAYS(stateStepAvailable, User::Invariant()); + // + CMMCScBkupState& currentState = CurrentState(); + // + currentState.ExecuteL(iStatus); + SetActive(); + + // RunL will now be called when the state has completed execution + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::CleanupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::CleanupL( TInt aError ) + { + __LOG1("CMMCScBkupEngineImpl::CleanupL() - START - aError: %d", aError); + + // If SBE died, then recreate + if ( aError == KErrServerTerminated ) + { + __LOG("CMMCScBkupEngineImpl::CleanupL() - assuming SBE panicked - re-creating SBE session..."); + CSBEClient* newSBEClient = CSBEClient::NewL(); + delete iSBEClient; + iSBEClient = newSBEClient; + } + + + __LOG("CMMCScBkupEngineImpl::CleanupL() - destroying current state..."); + DestroyCurrentState(); + + const TBool backupOrRestoreUnderway = MMCScBkupSBEUtils::PhoneIsInBackupOrRestoreModeL(); + __LOG1("CMMCScBkupEngineImpl::CleanupL() - backupOrRestoreUnderway: %d", backupOrRestoreUnderway); + if ( backupOrRestoreUnderway && iSBEClient ) + { + // Must end backup or restore + __LOG("CMMCScBkupEngineImpl::CleanupL() - ending backup or restore..."); + MMCScBkupSBEUtils::EndBackupOrRestoreL( *iSBEClient ); + } + + // Ensure the archive is closed + if ( iArchives.Count() ) + { + __LOG("CMMCScBkupEngineImpl::CleanupL() - closing archives..."); + for(TInt i = 0; i < iArchives.Count(); i++) + { + iArchives[i]->Close( aError ); + } + + __LOG("CMMCScBkupEngineImpl::CleanupL() - reseting archive array..."); + iArchives.ResetAndDestroy(); + } + + // Destroy old parameters + __LOG("CMMCScBkupEngineImpl::CleanupL() - destroying parameters..."); + delete iParameters; + iParameters = NULL; + + // Set back to idle + __LOG("CMMCScBkupEngineImpl::CleanupL() - setting operation status to idle..."); + iOperationType = EMMCScBkupOperationTypeIdle; + + // Dispose of our collections + __LOG("CMMCScBkupEngineImpl::CleanupL() - destroying data owners and file lists..."); + iDataOwners.ResetAndDestroy(); + iFileLists.ResetAndDestroy(); + + // Dispose of state factory + __LOG("CMMCScBkupEngineImpl::CleanupL() - destroying factory..."); + delete iFactory; + iFactory = NULL; + + // Reset progress + iCumulativeProgress = 0; + + // Reduce memory consumption by deleting SBE client. Session will be closed + // and SBE frees reserved (e.g. 128 kB...) memory pool. + if(iSBEClient) + { + __LOG("CMMCScBkupEngineImpl::CleanupL() - deleting SBE client..."); + delete iSBEClient; + iSBEClient = NULL; + } + + __LOG("CMMCScBkupEngineImpl::CleanupL() - END"); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::PrepareObjectsL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::PrepareObjectsL() + { + __LOG("CMMCScBkupEngineImpl::PrepareObjectsL() - creating objects..."); + + iTotalProgress = 0; + iCurrentArchive = 0; + + const RMMCScBkupPointerArray& archives = DrvParamsBase().ArchiveInfos(); + TInt count = archives.Count(); + + if(count == 0) + { + __LOG("CMMCScBkupEngineImpl::PrepareObjectsL() - nothing to be done, leaving..."); + User::Leave(KErrCancel); + } + + for(TInt i = 0; i < count; i++) + { + CMMCScBkupArchive* archive; + archive = CMMCScBkupArchive::NewL( iFsSession, DrvProgressHandler(), *this, archives[i]->Category() ); + CleanupStack::PushL( archive ); + iArchives.AppendL( archive ); + CleanupStack::Pop( archive ); + + CMMCScBkupDataOwnerCollection* dataOwners; + dataOwners = CMMCScBkupDataOwnerCollection::NewL( *this, archives[i]->Category() ); + CleanupStack::PushL( dataOwners ); + iDataOwners.AppendL( dataOwners ); + CleanupStack::Pop( dataOwners ); + + CMMCScBkupFileListCollection* fileList; + fileList = CMMCScBkupFileListCollection::NewL( archives[i]->Category(), iFsSession ); + CleanupStack::PushL( fileList ); + iFileLists.AppendL( fileList ); + CleanupStack::Pop( fileList ); + } + } + +TBool CMMCScBkupEngineImpl::DeleteArchivesL( RPointerArray< CMMCScBkupArchiveInfo >& aArchives ) const + { + TBool ret( ETrue ); + TInt i( 0 ); + TInt err; + while ( i < aArchives.Count() ) + { + CMMCScBkupArchiveInfo* archiveInfo = aArchives[ i ]; + err = iFsSession.SetAtt( archiveInfo->FileName(), KEntryAttNormal, !KEntryAttNormal ); + err = iFsSession.Delete( archiveInfo->FileName() ); + if( err!=KErrNone ) + { + ret = EFalse ; + } + aArchives.Remove( i ); + delete archiveInfo; + } + return ret; + } + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::ListArchivesL() +// +// Provide a list of valid (both content and category do match) archives +// available on all drives' backup folder +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::ListArchivesL( + RPointerArray< CMMCScBkupArchiveInfo >& aArchives, + CMMCScBkupOpParamsBase* aParams, + const TUint32 aDriveAttMatch, + const TInt aDriveMatch ) + { + __LOG("CMMCScBkupEngineImpl::ListArchivesL() - START"); + + for(TInt i = 0; i < KMaxDrives; i++) + { + // Check is drive number allowed + if ( aDriveMatch != KErrNotFound && aDriveMatch != i ) + { + continue; + } + // Check are drive attributes allowed + TBool supported( EFalse ); + TDriveInfo driveInfo; + if ( iFsSession.Drive( driveInfo, i ) == KErrNone ) + { + if ( driveInfo.iDriveAtt & aDriveAttMatch ) + { + supported = ETrue; + } + } + if ( !supported ) + { + continue; + } + + const TDriveUnit driveUnit(i); + const TDriveName driveName(driveUnit.Name()); + CDir* pFiles = NULL; + TFileName path; + path.Append(driveName); + path.Append(KBackUpFolder()); + path.Append(KBackUpFiles()); + + // Scan for all archives + iFsSession.GetDir(path, KEntryAttMatchMask, ESortNone, pFiles); + CleanupStack::PushL(pFiles); + + if(pFiles) + { + TInt count = pFiles->Count(); + for (TInt x = 0; x < count; x++) + { + const TEntry& entryPtr = (*pFiles)[x]; + TEntry entry(entryPtr); + TFileName pathAndFile; + pathAndFile.Append(driveName); + pathAndFile.Append(KBackUpFolder()); + pathAndFile.Append(entry.iName); + + entry.iName = pathAndFile; + + // Read category information from archive + TBitFlags category; + TRAPD(err, category = MMCScBkupArchiveUtils::ReadBkUpCategoryInformationL( iFsSession, pathAndFile )); + + if(err == KErrNone) + { + // Append archive in list when valid + if((category.Value() & aParams->Categories().Value()) && ValidArchiveForRestoreL( pathAndFile )) + { + __LOG2("CMMCScBkupEngineImpl::ListArchivesL() - adding archive %S of category 0x%x", + &pathAndFile, category.Value()); + CMMCScBkupArchiveInfo* archiveInfo = CMMCScBkupArchiveInfo::NewLC( entry ); + // Set category in archive info - can be used for filtering + archiveInfo->SetCategory( category ); + // Move ownership to array + aArchives.AppendL(archiveInfo); + CleanupStack::Pop(archiveInfo); + } + else + { + __LOG3("CMMCScBkupEngineImpl::ListArchivesL() - archive %S of category 0x%x (vs. 0x%x) not included", + &pathAndFile, category.Value(), aParams->Categories().Value()); + } + } + } + } + + CleanupStack::PopAndDestroy(pFiles); + } + + __LOG("CMMCScBkupEngineImpl::ListArchivesL() - END"); + } + + +#ifdef DEBUGGING_DATA_TRANSFER +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::CleanBackupFilesL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::CleanBackupFilesL() + { + CFileMan* fileMan = CFileMan::NewL( iFsSession ); + CleanupStack::PushL( fileMan ); + + // Make directory, ignore error, ugly, functionise later on... + _LIT(KMMCScBkupFormatDes, "%S%S%S%S"); + TFileName cleanPath; + const TDesC& path = PathInfo::MemoryCardRootPath(); + + // + cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataJava, &KMMCScBkupDataTransferDebuggingPathDataBackup); + fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error + iFsSession.MkDirAll( cleanPath ); + cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataSystem, &KMMCScBkupDataTransferDebuggingPathDataBackup); + fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error + iFsSession.MkDirAll( cleanPath ); + cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataPassive, &KMMCScBkupDataTransferDebuggingPathDataBackup); + fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error + iFsSession.MkDirAll( cleanPath ); + cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataActive, &KMMCScBkupDataTransferDebuggingPathDataBackup); + fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error + iFsSession.MkDirAll( cleanPath ); + // + CleanupStack::PopAndDestroy( fileMan ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupEngineImpl::ClearRestoreFilesL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupEngineImpl::ClearRestoreFilesL() + { + CFileMan* fileMan = CFileMan::NewL( iFsSession ); + CleanupStack::PushL( fileMan ); + + // Make directory, ignore error, ugly, functionise later on... + _LIT(KMMCScBkupFormatDes, "%S%S%S%S"); + TFileName cleanPath; + const TDesC& path = PathInfo::MemoryCardRootPath(); + + // + cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataJava, &KMMCScBkupDataTransferDebuggingPathDataRestore); + fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error + iFsSession.MkDirAll( cleanPath ); + cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataSystem, &KMMCScBkupDataTransferDebuggingPathDataRestore); + fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error + iFsSession.MkDirAll( cleanPath ); + cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataPassive, &KMMCScBkupDataTransferDebuggingPathDataRestore); + fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error + iFsSession.MkDirAll( cleanPath ); + cleanPath.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot, &KMMCScBkupDataTransferDebuggingPathDataActive, &KMMCScBkupDataTransferDebuggingPathDataRestore); + fileMan->Delete( cleanPath, CFileMan::ERecurse ); // Ignore error + iFsSession.MkDirAll( cleanPath ); + // + CleanupStack::PopAndDestroy( fileMan ); + } + +#endif + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupFileInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupFileInfo.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupFileInfo implementation +* +* +*/ + +#include "CMMCScBkupFileInfo.h" + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupFileInfo::CMMCScBkupFileInfo() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupFileInfo::CMMCScBkupFileInfo() + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileInfo::CMMCScBkupFileInfo() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupFileInfo::CMMCScBkupFileInfo( const TEntry& aEntry, TSecureId aAssociatedSID ) +: iSecureId(aAssociatedSID) + { + iSize = aEntry.iSize; + iDateTime = aEntry.iModified; + iAttributes = aEntry.iAtt; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileInfo::~CMMCScBkupFileInfo() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupFileInfo::~CMMCScBkupFileInfo() + { + delete iFileName; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileInfo::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupFileInfo::ConstructL( const TEntry& aEntry ) + { + iFileName = aEntry.iName.AllocL(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileInfo::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupFileInfo* CMMCScBkupFileInfo::NewL( const TEntry& aEntry, TSecureId aAssociatedSID ) + { + CMMCScBkupFileInfo* self = NewLC( aEntry, aAssociatedSID ); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileInfo::NewLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupFileInfo* CMMCScBkupFileInfo::NewLC( const TEntry& aEntry, TSecureId aAssociatedSID ) + { + CMMCScBkupFileInfo* self = new(ELeave) CMMCScBkupFileInfo( aEntry, aAssociatedSID ); + CleanupStack::PushL(self); + self->ConstructL(aEntry); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileInfo::NewLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupFileInfo* CMMCScBkupFileInfo::NewLC( RReadStream& aStream ) + { + CMMCScBkupFileInfo* self = new(ELeave) CMMCScBkupFileInfo(); + CleanupStack::PushL(self); + aStream >> *self; + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileInfo::Drive() +// +// +// --------------------------------------------------------------------------- +TDriveNumber CMMCScBkupFileInfo::Drive() const + { + const TDriveUnit driveUnit( FileName() ); + const TDriveNumber drive = static_cast< TDriveNumber > ( driveUnit.operator TInt() ); + // + return drive; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileInfo::InternalizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupFileInfo::InternalizeL(RReadStream& aStream) + { + aStream.ReadInt32L(); // EStreamFormatVersion1 + aStream.ReadInt32L(); // spare1 + aStream.ReadInt32L(); // spare2 + aStream.ReadInt32L(); // spare3 + // + HBufC* fileName = HBufC::NewL(aStream, KMaxFileName); + delete iFileName; + iFileName = fileName; + // + TInt64 intermediateDateTime; + aStream >> intermediateDateTime; + iDateTime = TTime(intermediateDateTime); + // + TUid intermediateSID; + aStream >> intermediateSID; + iSecureId = intermediateSID; + // + iSize = aStream.ReadInt32L(); + iAttributes = aStream.ReadUint32L(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileInfo::ExternalizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupFileInfo::ExternalizeL(RWriteStream& aStream) const + { + aStream.WriteInt32L( EStreamFormatVersion1 ); + aStream.WriteInt32L( 0 ); // spare1 + aStream.WriteInt32L( 0 ); // spare2 + aStream.WriteInt32L( 0 ); // spare3 + // + aStream << *iFileName; + aStream << iDateTime.Int64(); + aStream << iSecureId.operator TUid(); + aStream.WriteInt32L(iSize); + aStream.WriteUint32L(iAttributes); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileInfo::OrderByFileName() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupFileInfo::OrderByFileName(const CMMCScBkupFileInfo& aLeft, const CMMCScBkupFileInfo& aRight) + { + const TPtrC pLeft(aLeft.FileName()); + const TPtrC pRight(aRight.FileName()); + // + const TInt ret = pLeft.Compare(pRight); + // + return ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileInfo::CompareByFileName() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupFileInfo::CompareByFileName(const CMMCScBkupFileInfo& aLeft, const CMMCScBkupFileInfo& aRight) + { + const TPtrC pLeft(aLeft.FileName()); + const TPtrC pRight(aRight.FileName()); + // + const TBool same = (pLeft.Compare(pRight) == 0); + return same; + } + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupFileListCollection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupFileListCollection.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,233 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CMMCScBkupFileListCollection implementation +* +* +*/ + +#include "CMMCScBkupFileListCollection.h" + +#include +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupDataOwnerInfo.h" +#ifdef RD_FILE_MANAGER_BACKUP +#include +#include "BkupEngine.hrh" +#include "pathconfiguration.hrh" +#endif + +// Constants +const TInt KMMCScBkupDataOwnerGranularity = 50; + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupFileListCollection::CMMCScBkupFileListCollection() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupFileListCollection::CMMCScBkupFileListCollection( TBitFlags aCategory, + RFs& aFsSession ) + :iEntries(KMMCScBkupDataOwnerGranularity), + iCategory( aCategory ), + iFsSession( aFsSession ) + { + } + +// --------------------------------------------------------------------------- +// CMMCScBkupFileListCollection::~CMMCScBkupFileListCollection() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupFileListCollection::~CMMCScBkupFileListCollection() + { + Reset(); + iEntries.Close(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileListCollection::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupFileListCollection::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileListCollection::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupFileListCollection* CMMCScBkupFileListCollection::NewL( TBitFlags aCategory, + RFs& aFsSession ) + { + CMMCScBkupFileListCollection* self = new(ELeave) CMMCScBkupFileListCollection( aCategory, aFsSession ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileListCollection::AppendL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupFileListCollection::AppendL( const RArray& aArray, RArray< const CMMCScBkupFileInfo* >& aAddedItems, TSecureId aAssociatedSID ) + { + const TInt count = aArray.Count(); + + __LOG2("CMMCScBkupFileListCollection::AppendL() - Number of files %d to check for category %x", count, Category().Value() ); + + for(TInt i=0; i comparer( CMMCScBkupFileInfo::OrderByFileName ); + const TInt indexIfFound = iEntries.FindInOrder( fileInfo, comparer ); + if (indexIfFound < 0) + { + // Item wasn't found - insert it in sorted order + AppendL( fileInfo ); + CleanupStack::Pop( fileInfo ); + + __LOG1("CMMCScBkupFileListCollection::AppendL() - Adding file %S", &fileInfo->FileName() ); + + // Add a copy to our return array. + aAddedItems.AppendL( fileInfo ); + } + else + { + // Duplicate, discard + __LOG1("CMMCScBkupFileListCollection::AppendL() - Duplicate file %S", &fileInfo->FileName() ); + CleanupStack::PopAndDestroy( fileInfo ); + } + } + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileListCollection::AppendL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupFileListCollection::AppendL( CMMCScBkupFileInfo* aFileInfo ) + { + TLinearOrder comparer( CMMCScBkupFileInfo::OrderByFileName ); + iEntries.InsertInOrderL( aFileInfo, comparer ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileListCollection::Count() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupFileListCollection::Count() const + { + return iEntries.Count(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileListCollection::Entry() +// +// +// --------------------------------------------------------------------------- +const CMMCScBkupFileInfo& CMMCScBkupFileListCollection::Entry(TInt aIndex) const + { + const CMMCScBkupFileInfo& entry = *iEntries[aIndex]; + return entry; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileListCollection::Remove() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupFileListCollection::Remove( TInt aIndex ) + { + CMMCScBkupFileInfo* entry = iEntries[aIndex]; + delete entry; + iEntries.Remove(aIndex); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupFileListCollection::Reset() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupFileListCollection::Reset() + { + iEntries.ResetAndDestroy(); + } + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupIndexActiveData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupIndexActiveData.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupIndexActiveData implementation +* +* +*/ + +#include "CMMCScBkupIndexActiveData.h" + +// User includes +#include "MMMCScBkupArchiveDataInterface.h" + + + /** + * Active Data + * =========== + * + * This is the format of the data written by the + * CMMCScBkupStateArchiveOpActiveData object + * + * E.g.: + * + * ACTIVE DATA for DO 0 + * { + * AD for DO 0, 1st drive + * AD for DO 0, 2nd drive + * AD for DO 0, 'n'th drive + * }, + * ACTIVE DATA for DO 1 + * { + * AD for DO 0, 1st drive - (AD is only on + * AD for DO 0, 2nd drive two drives) + * }, + * ACTIVE DATA for DO n + * { + * AD for DO 0, 1st drive - (AD is only on one drive) + * } + * + * Active Data Index + * ================= + * + * This is the format of the data written by this object. + * The format allows the possibility of a future partial + * restore (hopefully). + * + * + * 4 bytes = count of active data entries + * + * FOR EACH DATA OWNER + * { + * 4 bytes = secure id associated with a active data owner + * 4 bytes = the number of different active data packages + * for this particular active data owner (one for each + * drive that was backed up) + * ENTRY + * { + * 1 byte = Associated TDriveNumber of the active data + * 8 bytes = offset and length of raw data + * } + * } + * + * + **/ + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexActiveData::CMMCScBkupIndexActiveData() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupIndexActiveData::CMMCScBkupIndexActiveData() +: CMMCScBkupIndexWithIdentifier< TSecureId >( EMMCScBkupOwnerDataTypeActiveData ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexActiveData::NewLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupIndexActiveData* CMMCScBkupIndexActiveData::NewLC() + { + CMMCScBkupIndexActiveData* self = new(ELeave) CMMCScBkupIndexActiveData(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupIndexBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupIndexBase.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupIndexBase implementation +* +* +*/ + +#include "CMMCScBkupIndexBase.h" + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexBase::CMMCScBkupIndexBase() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupIndexBase::CMMCScBkupIndexBase( TMMCScBkupOwnerDataType aType ) +: iType(aType) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexBase::~CMMCScBkupIndexBase() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupIndexBase::~CMMCScBkupIndexBase() + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexBase::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupIndexBase::ConstructL() + { + } + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupIndexDataOwners.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupIndexDataOwners.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,210 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupIndexDataOwners implementation +* +* +*/ + +#include "CMMCScBkupIndexDataOwners.h" + +// User includes +#include "MMMCScBkupArchiveDataInterface.h" + +// Constants +const TInt KMMCScBkupDataOwnerIndexGranularity = 50; + + + /** + * Registration Data + * ================= + * + * This is the format of the data written by the + * CMMCScBkupStateGetDataOwners object + * + * + * REG DATA for DO 0 + * { + * RD for DO 0, 1st drive + * RD for DO 0, 2nd drive + * RD for DO 0, 'n'th drive + * }, + * REG DATA for DO 1 + * { + * RD for DO 0, 1st drive + * RD for DO 0, 2nd drive + * RD for DO 0, 'n'th drive + * }, + * REG DATA for DO n + * { + * RD for DO 0, 1st drive + * RD for DO 0, 2nd drive + * RD for DO 0, 'n'th drive + * } + * + * Registration Data Index + * ======================= + * + * This is the format of the data written by this method. + * The format allows the possibility of a future partial + * restore (hopefully). + * + * + * 4 bytes = count of data owners + * + * FOR EACH DATA OWNER + * { + * 4 bytes = secure id of data owner's process + * 4 bytes = the number of different registration data files + * for this particular data owner (one for each drive that + * was backed up) + * ENTRY + * { + * 1 byte = Associated TDriveNumber of the registration data + * n bytes = raw drive data + * } + * } + * + * + **/ + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexDataOwners::CMMCScBkupIndexDataOwners() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupIndexDataOwners::CMMCScBkupIndexDataOwners() +: CMMCScBkupIndexBase( EMMCScBkupOwnerDataTypeDataOwner ), iEntries( KMMCScBkupDataOwnerIndexGranularity ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexDataOwners::~CMMCScBkupIndexDataOwners() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupIndexDataOwners::~CMMCScBkupIndexDataOwners() + { + iEntries.Close(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexDataOwners::NewLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupIndexDataOwners* CMMCScBkupIndexDataOwners::NewLC() + { + CMMCScBkupIndexDataOwners* self = new(ELeave) CMMCScBkupIndexDataOwners(); + CleanupStack::PushL(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexDataOwners::AddIndexRecordL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupIndexDataOwners::AddIndexRecordL( const TMMCScBkupArchiveVector& aInfo ) + { + iEntries.AppendL( aInfo ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexDataOwners::StoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupIndexDataOwners::StoreL(MMMCScBkupDriver& aDriver) + { + MMMCScBkupArchiveDataInterface& archiveDataInterface = aDriver.DrvADI(); + RWriteStream& stream = archiveDataInterface.ADIWriteStreamUncompressedLC(); + // + stream.WriteInt32L( EStreamFormatVersion1 ); + stream.WriteInt32L( 0 ); // spare1 + stream.WriteInt32L( 0 ); // spare2 + stream.WriteInt32L( 0 ); // spare3 + // + const TInt count = iEntries.Count(); + stream.WriteInt32L(count); + // + for(TInt i=0; i> entry; + // + stream.ReadInt32L(); // spare1 + stream.ReadInt32L(); // spare2 + // + iEntries.AppendL( entry ); + } + // + CleanupStack::PopAndDestroy(); // stream + // + const TMMCScBkupArchiveVector& readInfo = archiveDataInterface.ADICurrentArchiveVectorInfo(); + if ( readInfo.Length() > Vector().Length() ) + { + // We've read too much! + User::Leave( KErrCorrupt ); + } + } + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupIndexJavaData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupIndexJavaData.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,402 @@ +/* +* 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: CMMCScBkupIndexJavaDataEntry implementation +* +* +*/ + +#include "CMMCScBkupIndexJavaData.h" + +// User includes +#include "MMMCScBkupArchiveDataInterface.h" +#include "MMCScBkupLogger.h" + + + /** + * Registration Data + * ================= + * + * + * REG DATA for DO 0 + * { + * RD for DO 0, 1st drive + * RD for DO 0, 2nd drive + * RD for DO 0, 'n'th drive + * }, + * REG DATA for DO 1 + * { + * RD for DO 0, 1st drive + * RD for DO 0, 2nd drive + * RD for DO 0, 'n'th drive + * }, + * REG DATA for DO n + * { + * RD for DO 0, 1st drive + * RD for DO 0, 2nd drive + * RD for DO 0, 'n'th drive + * } + * + * Registration Data Index + * ======================= + * + * This is the format of the data written by this object. + * The format allows the possibility of a future partial + * restore (hopefully). + * + * + * 4 bytes = count of registration data entries + * + * FOR EACH DATA OWNER + * { + * 4 bytes = secure id of data owner's process + * 4 bytes = the number of different registration data files + * for this particular data owner (one for each drive that + * was backed up) + * ENTRY + * { + * 1 byte = Associated TDriveNumber of the registration data + * 8 bytes = offset & length of actual registration data + * } + * } + * + **/ + + + + + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexJavaDataEntry::CMMCScBkupIndexJavaDataEntry() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupIndexJavaDataEntry::CMMCScBkupIndexJavaDataEntry() + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexJavaDataEntry::CMMCScBkupIndexJavaDataEntry() +// +// C++ destructor. +// --------------------------------------------------------------------------- +CMMCScBkupIndexJavaDataEntry::~CMMCScBkupIndexJavaDataEntry() + { + delete iHash; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexJavaDataEntry::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupIndexJavaDataEntry::ConstructL() + { + iHash = KNullDesC().AllocL(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexJavaDataEntry::NewLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupIndexJavaDataEntry* CMMCScBkupIndexJavaDataEntry::NewLC() + { + CMMCScBkupIndexJavaDataEntry* self = new(ELeave) CMMCScBkupIndexJavaDataEntry(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexJavaDataEntry::NewLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupIndexJavaDataEntry* CMMCScBkupIndexJavaDataEntry::NewLC( RReadStream& aStream ) + { + CMMCScBkupIndexJavaDataEntry* self = new(ELeave) CMMCScBkupIndexJavaDataEntry(); + CleanupStack::PushL( self ); + aStream >> *self; + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexJavaDataEntry::SetHashL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupIndexJavaDataEntry::SetHashL( const TDesC& aHash ) + { + HBufC* hash = aHash.AllocL(); + delete iHash; + iHash = hash; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexJavaDataEntry::InternalizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupIndexJavaDataEntry::InternalizeL( RReadStream& aStream ) + { + aStream.ReadInt32L(); // EStreamFormatVersion1 + aStream.ReadInt32L(); // spare1 + aStream.ReadInt32L(); // spare2 + aStream.ReadInt32L(); // spare3 + // + HBufC* hash = HBufC::NewL( aStream, KMaxTInt ); + delete iHash; + iHash = hash; + // + aStream >> iMidletInfo; + aStream >> iMidletDataInfo; + iDrive = static_cast< TDriveNumber>( aStream.ReadInt8L() ); + // + __LOG6("CMMCScBkupIndexJavaDataEntry::InternalizeL() - hash: %S, iDrive: %c:, MIDLET[offset: %8d, length: %8d], MIDLETDATA[offset: %8d, length: %8d]", iHash, iDrive + 'A', iMidletInfo.Offset(), iMidletInfo.Length(), iMidletDataInfo.Offset(), iMidletDataInfo.Length() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexJavaDataEntry::ExternalizeL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupIndexJavaDataEntry::ExternalizeL( RWriteStream& aStream ) const + { + aStream.WriteInt32L( EStreamFormatVersion1 ); + aStream.WriteInt32L( 0 ); // spare1 + aStream.WriteInt32L( 0 ); // spare2 + aStream.WriteInt32L( 0 ); // spare3 + // + aStream << Hash(); + aStream << iMidletInfo; + aStream << iMidletDataInfo; + aStream.WriteInt8L( iDrive ); + // + __LOG6("CMMCScBkupIndexJavaDataEntry::ExternalizeL() - hash: %S, iDrive: %c:, MIDLET[offset: %8d, length: %8d], MIDLETDATA[offset: %8d, length: %8d]", iHash, iDrive + 'A', iMidletInfo.Offset(), iMidletInfo.Length(), iMidletDataInfo.Offset(), iMidletDataInfo.Length() ); + } + + + + + + + + + + + + + + + + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexJavaData::CMMCScBkupIndexJavaData() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupIndexJavaData::CMMCScBkupIndexJavaData() +: CMMCScBkupIndexBase( EMMCScBkupOwnerDataTypeJavaData ) + { + } + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexJavaData::~CMMCScBkupIndexJavaData() +// +// C++ destructor. +// --------------------------------------------------------------------------- +CMMCScBkupIndexJavaData::~CMMCScBkupIndexJavaData() + { + iEntries.Close(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexJavaData::NewLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupIndexJavaData* CMMCScBkupIndexJavaData::NewLC() + { + CMMCScBkupIndexJavaData* self = new(ELeave) CMMCScBkupIndexJavaData(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexJavaData::AddIndexRecordL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupIndexJavaData::AddIndexRecordL( const TMMCScBkupArchiveVector& aInfo, const TDesC& aHash, TDriveNumber aDrive, TJavaTransferType aType ) + { + // Check if we already have an entry for this item... + CMMCScBkupIndexJavaDataEntry* entry = EntryByHash( aHash, aDrive ); + + if ( !entry ) + { + __LOG1("CMMCScBkupIndexJavaData::AddIndexRecordL() - making new entry for hash: %S", &aHash); + // + entry = CMMCScBkupIndexJavaDataEntry::NewLC(); + // + entry->SetHashL( aHash ); + entry->SetDrive( aDrive ); + iEntries.AppendL( entry ); + // + CleanupStack::Pop( entry ); + } + else + { + __LOG1("CMMCScBkupIndexJavaData::AddIndexRecordL() - found existing entry for hash: %S", &aHash); + } + + if ( aType == EJavaMIDlet ) + { + entry->SetMidletInfo( aInfo ); + } + else if ( aType == EJavaMIDletData ) + { + entry->SetMidletDataInfo( aInfo ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexJavaData::At() +// +// +// --------------------------------------------------------------------------- +const CMMCScBkupIndexJavaDataEntry& CMMCScBkupIndexJavaData::At( TInt aIndex ) const + { + const CMMCScBkupIndexJavaDataEntry* entry = iEntries[ aIndex ]; + return *entry; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexJavaData::StoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupIndexJavaData::StoreL(MMMCScBkupDriver& aDriver) + { + MMMCScBkupArchiveDataInterface& archiveDataInterface = aDriver.DrvADI(); + RWriteStream stream(archiveDataInterface.ADIWriteStreamUncompressedLC()); + // + stream.WriteInt32L( EStreamFormatVersion1 ); + stream.WriteInt32L( 0 ); // spare1 + stream.WriteInt32L( 0 ); // spare2 + stream.WriteInt32L( 0 ); // spare3 + // + const TInt count = iEntries.Count(); + stream.WriteInt32L(count); + // + for(TInt i=0; i Vector().Length() ) + { + // We've read too much! + User::Leave( KErrCorrupt ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexJavaData::EntryByHash() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupIndexJavaDataEntry* CMMCScBkupIndexJavaData::EntryByHash( const TDesC& aHash, TDriveNumber aDrive ) const + { + CMMCScBkupIndexJavaDataEntry* ret = NULL; + const TInt count = iEntries.Count(); + // + for(TInt i=0; iHash() == aHash && entry->Drive() == aDrive ) + { + ret = entry; + break; + } + } + // + return ret; + } + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupIndexPassiveData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupIndexPassiveData.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupIndexPassiveData implementation +* +* +*/ + +#include "CMMCScBkupIndexPassiveData.h" + +// User includes +#include "MMMCScBkupArchiveDataInterface.h" + + + /** + * Passive Data + * =========== + * + * + * + * Passive Data Index + * ================= + * + * This is the format of the data written by this object. + * The format allows the possibility of a future partial + * restore (hopefully). + * + * + * 4 bytes = count of passive data entries + * + * FOR EACH DATA OWNER + * { + * 4 bytes = secure id associated with a passive data owner + * 4 bytes = the number of different data entries for this + * particular passive data owner (one for each + * drive that was backed up) + * ENTRY + * { + * 1 byte = Associated TDriveNumber of the system data + * 8 bytes = offset and size to passive data + * } + * } + * + * + **/ + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexPassiveData::CMMCScBkupIndexPassiveData() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupIndexPassiveData::CMMCScBkupIndexPassiveData() +: CMMCScBkupIndexWithIdentifier< TSecureId >( EMMCScBkupOwnerDataTypePassiveData ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexPassiveData::NewLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupIndexPassiveData* CMMCScBkupIndexPassiveData::NewLC() + { + CMMCScBkupIndexPassiveData* self = new(ELeave) CMMCScBkupIndexPassiveData(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupIndexPublicDataFiles.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupIndexPublicDataFiles.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,196 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupIndexPublicDataFiles implementation +* +* +*/ + +#include "CMMCScBkupIndexPublicDataFiles.h" + +// User includes +#include "MMMCScBkupArchiveDataInterface.h" +#include "CMMCScBkupFileInfo.h" +#include "CMMCScBkupFileListCollection.h" + + + /** + * Public File Data + * ================ + * + * This is the format of the data written by the + * CMMCScBkupStateArchiveOpPublicDataFiles object + * + * PUB FILE DATA for file 0 + * PUB FILE DATA for file 1 + * PUB FILE DATA for file n + * + * Public File Data Index + * ====================== + * + * This is the format of the data written by this object. + * The format allows the possibility of a future partial + * restore (hopefully). + * + * 4 bytes = count of data owners + * + * FOR EACH PUBLIC FILE + * { + * externalised CMMCScBkupFileInfo object + * externalised TMMCScBkupArchiveVector (offset & compressed size) object + * } + * + **/ + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexPublicDataFiles::CMMCScBkupIndexPublicDataFiles() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupIndexPublicDataFiles::CMMCScBkupIndexPublicDataFiles() +: CMMCScBkupIndexBase( EMMCScBkupOwnerDataTypePublicData ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexPublicDataFiles::~CMMCScBkupIndexPublicDataFiles() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupIndexPublicDataFiles::~CMMCScBkupIndexPublicDataFiles() + { + iEntries.Close(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexPublicDataFiles::NewLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupIndexPublicDataFiles* CMMCScBkupIndexPublicDataFiles::NewLC() + { + CMMCScBkupIndexPublicDataFiles* self = new(ELeave) CMMCScBkupIndexPublicDataFiles(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexPublicDataFiles::AddIndexRecordL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupIndexPublicDataFiles::AddIndexRecordL( const TMMCScBkupArchiveVector& aInfo, const CMMCScBkupFileInfo& aFile ) + { + // Create new entry + TMMCScBkupPublicFileEntry entry( aInfo, aFile ); + + // Add it to our index + iEntries.AppendL( entry ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexPublicDataFiles::At() +// +// +// --------------------------------------------------------------------------- +const CMMCScBkupFileInfo& CMMCScBkupIndexPublicDataFiles::At( TInt aIndex, TMMCScBkupArchiveVector& aInfo ) const + { + const TMMCScBkupPublicFileEntry& entry = iEntries[ aIndex ]; + aInfo = entry.iInfo; + return *entry.iFile; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexPublicDataFiles::StoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupIndexPublicDataFiles::StoreL(MMMCScBkupDriver& aDriver) + { + MMMCScBkupArchiveDataInterface& archiveDataInterface = aDriver.DrvADI(); + RWriteStream stream(archiveDataInterface.ADIWriteStreamUncompressedLC()); + // + const TInt count = iEntries.Count(); + stream.WriteInt32L(count); + // + for(TInt i=0; i> entry.iInfo; + + // And finally add a new record to our index, so client's can + // retrieve the info. + iEntries.AppendL( entry ); + } + // + CleanupStack::PopAndDestroy(); // stream + // + const TMMCScBkupArchiveVector& readInfo = archiveDataInterface.ADICurrentArchiveVectorInfo(); + if ( readInfo.Length() > Vector().Length() ) + { + // We've read too much! + User::Leave( KErrCorrupt ); + } + } + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupIndexSystemData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupIndexSystemData.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupIndexSystemData implementation +* +* +*/ + +#include "CMMCScBkupIndexSystemData.h" + +// User includes +#include "MMMCScBkupArchiveDataInterface.h" + + + /** + * System Data + * =========== + * + * This is the format of the data written by the + * CMMCScBkupStateArchiveOpSystemData object + * + * + * SYSTEM DATA for DO 0 + * { + * SD for DO 0, 1st drive + * SD for DO 0, 2nd drive + * SD for DO 0, 'n'th drive + * }, + * SYSTEM DATA for DO 1 + * { + * SD for DO 0, 1st drive - (System data is only on + * SD for DO 0, 2nd drive two drives) + * }, + * SYSTEM DATA for DO n + * { + * SD for DO 0, 1st drive - (System Data is only on one drive) + * } + * + * System Data Index + * ================= + * + * This is the format of the data written by this object. + * The format allows the possibility of a future partial + * restore (hopefully). + * + * + * 4 bytes = count of system data entries + * + * FOR EACH DATA OWNER + * { + * 4 bytes = package id associated with a system data owner + * 4 bytes = the number of different system data packages + * for this particular system data owner (one for each + * drive that was backed up) + * ENTRY + * { + * 1 byte = Associated TDriveNumber of the system data + * 8 bytes = offset & length of actual registration data + * } + * } + * + * + **/ + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexSystemData::CMMCScBkupIndexSystemData() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupIndexSystemData::CMMCScBkupIndexSystemData() +: CMMCScBkupIndexWithIdentifier< TInt32 >( EMMCScBkupOwnerDataTypeSystemData ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupIndexSystemData::NewLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupIndexSystemData* CMMCScBkupIndexSystemData::NewLC() + { + CMMCScBkupIndexSystemData* self = new(ELeave) CMMCScBkupIndexSystemData(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupIndexWithIdentifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupIndexWithIdentifier.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,20 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupIndexWithIdentifier implementation +* +* +*/ + +#include "CMMCScBkupIndexWithIdentifier.h" + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupOperationParameters.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupOperationParameters.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,499 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupOpParamsBase implementation +* +* +*/ + +#include "CMMCScBkupOperationParameters.h" + +// System includes +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupDriveAndOperationTypeManager.h" +#include "CMMCScBkupArchiveInfo.h" +#include "BkupEngine.hrh" + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBase::CMMCScBkupOpParamsBase() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupOpParamsBase::CMMCScBkupOpParamsBase() + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBase::~CMMCScBkupOpParamsBase() +// +// C++ destructor. +// --------------------------------------------------------------------------- +EXPORT_C CMMCScBkupOpParamsBase::~CMMCScBkupOpParamsBase() + { + delete iDriveAndOperations; + iArchiveInfos.ResetAndDestroy(); + iArchiveInfos.Close(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBase::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupOpParamsBase::ConstructL( BkupDrivesAndOperationList *aDriveList, TBitFlags aCategories ) + { + iCategories = aCategories; + iDriveAndOperations = CMMCScBkupDriveAndOperationTypeManager::NewL( aDriveList ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBase::DriveAndOperations() +// +// +// --------------------------------------------------------------------------- +EXPORT_C const CMMCScBkupDriveAndOperationTypeManager& CMMCScBkupOpParamsBase::DriveAndOperations() const + { + return *iDriveAndOperations; + } + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBase::SetArchiveInfosL() +// +// +// --------------------------------------------------------------------------- +EXPORT_C void CMMCScBkupOpParamsBase::SetArchiveInfosL(RPointerArray& aInfos) + { + iArchiveInfos.ResetAndDestroy(); + + for(TInt i = 0; i < aInfos.Count(); i++) + { + iArchiveInfos.AppendL(aInfos[i]); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBase::ArchiveInfos() +// +// +// --------------------------------------------------------------------------- +RMMCScBkupPointerArray& CMMCScBkupOpParamsBase::ArchiveInfos() + { + return iArchiveInfos; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBase::ArchiveInfo() +// +// +// --------------------------------------------------------------------------- +const CMMCScBkupArchiveInfo& CMMCScBkupOpParamsBase::ArchiveInfo(TBitFlags aCategory) const + { + CMMCScBkupArchiveInfo* archiveInfo = NULL; + + for(TInt i = 0; i < iArchiveInfos.Count(); i++) + { + archiveInfo = iArchiveInfos[i]; + if(archiveInfo->Category() == aCategory) + { + break; + } + } + + return *archiveInfo; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBase::FileName() +// +// +// --------------------------------------------------------------------------- +const TDesC& CMMCScBkupOpParamsBase::FileName(TInt aIndex) const + { + const TDesC* ret = &KNullDesC; + const CMMCScBkupArchiveInfo& archiveInfo = *iArchiveInfos[aIndex]; + + if( archiveInfo.FileName().Length() ) + { + ret = &archiveInfo.FileName(); + } + + return *ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBackupFull::ReadFromResourceL() +// +// Read categories with associated data from resource +// --------------------------------------------------------------------------- +void CMMCScBkupOpParamsBackupFull::ReadFromResourceL( BkupCategoryList *aCategoryList ) + { + TInt count( aCategoryList->Count() ); + + for ( TInt i( 0 ); i < count; i++ ) + { + // Read category + CBkupCategory* bkupCategory = (*aCategoryList)[i]; + CArrayFixFlat* uidsList = bkupCategory->uids(); + CArrayFixFlat* exclude_uidsList = bkupCategory->exclude_uids(); + + + TBitFlags category = static_cast< TBitFlags >( bkupCategory->category() ); + + // Read archive name + const TDriveUnit driveUnit(iDrive); + const TDriveName driveName(driveUnit.Name()); + TFileName name; + TPtrC archiveName( bkupCategory->archive_name()->Des() ); + + name.Append(driveName); + name.Append(KBackUpFolder()); + name.Append(archiveName); + + // Read special flags + TBitFlags flags = static_cast< TBitFlags >( bkupCategory->special_flags() ); + TBitFlags excludedFlags = static_cast< TBitFlags >( + bkupCategory->exclude_special_flags() ); + + // Read SIDs belonging to category + TInt16 subCount = uidsList->Count(); + RArray sids; + CleanupClosePushL( sids ); + + for(TInt j = 0; j < subCount; j++) + { + sids.AppendL(static_cast( (*uidsList)[j] ) ); + } + + // Read excluded SIDs for category + subCount = exclude_uidsList->Count(); + RArray excludeSids; + CleanupClosePushL( excludeSids ); + + for(TInt j = 0; j < subCount; j++) + { + excludeSids.AppendL(static_cast( (*exclude_uidsList)[j] )); + } + + TEntry entry; + entry.iName = name; + CMMCScBkupArchiveInfo* archiveInfo = CMMCScBkupArchiveInfo::NewLC( entry ); + archiveInfo->SetCategory( category ); + archiveInfo->SetSpecialFlags( flags ); + archiveInfo->SetExcludedSpecialFlags( excludedFlags ); + archiveInfo->SetSIDs( sids ); + archiveInfo->SetExcludedSIDs( excludeSids ); + + // If the category is specified, then add it in list of categories to be archived +#ifdef RD_FILE_MANAGER_BACKUP + if( Categories().Value() & category.Value() ) +#else + if( category.Value() == EBUCatAllInOne ) +#endif + { + __LOG1("CMMCScBkupOpParamsBase::ReadFromResourceL() - adding category 0x%x", category.Value()); + RMMCScBkupPointerArray& archives = ArchiveInfos(); + archives.AppendL( archiveInfo ); + CleanupStack::Pop( archiveInfo ); + } + else + { + __LOG1("CMMCScBkupOpParamsBase::ReadFromResourceL() - category 0x%x not included", category.Value()); + CleanupStack::PopAndDestroy( archiveInfo ); + } + + CleanupStack::PopAndDestroy( &excludeSids ); + CleanupStack::PopAndDestroy( &sids ); + } + } + + + + + + + + + + + + + + + + + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBackupFull::CMMCScBkupOpParamsBackupFull() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupOpParamsBackupFull::CMMCScBkupOpParamsBackupFull( TDriveNumber aDrive ) + : iDrive( aDrive ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBackupFull::~CMMCScBkupOpParamsBackupFull() +// +// C++ destructor. +// --------------------------------------------------------------------------- +EXPORT_C CMMCScBkupOpParamsBackupFull::~CMMCScBkupOpParamsBackupFull() + { + } + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBackupFull::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupOpParamsBackupFull::ConstructL( BkupDrivesAndOperationList *aDriveList, + BkupCategoryList *aCategoryList, TBitFlags aCategories ) + { + CMMCScBkupOpParamsBase::ConstructL( aDriveList, aCategories ); + ReadFromResourceL( aCategoryList ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBackupFull::NewL() +// +// +// --------------------------------------------------------------------------- +EXPORT_C CMMCScBkupOpParamsBackupFull* CMMCScBkupOpParamsBackupFull::NewL( + BkupDrivesAndOperationList *aDriveList, + BkupCategoryList *aCategoryList, + TDriveNumber aDrive, TBitFlags aCategories ) + { + CMMCScBkupOpParamsBackupFull* self = new(ELeave) CMMCScBkupOpParamsBackupFull( aDrive ); + CleanupStack::PushL( self ); + self->ConstructL( aDriveList, aCategoryList, aCategories ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBackupFull::AssociatedOpType() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TMMCScBkupOperationType CMMCScBkupOpParamsBackupFull::AssociatedOpType() const + { + return EMMCScBkupOperationTypeFullBackup; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBackupFull::PartType() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TBURPartType CMMCScBkupOpParamsBackupFull::PartType() const + { + return EBURBackupFull; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBackupFull::IncrementType() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TBackupIncType CMMCScBkupOpParamsBackupFull::IncrementType() const + { + return EBackupBase; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBackupFull::PassiveTransferType() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TTransferDataType CMMCScBkupOpParamsBackupFull::PassiveTransferType() const + { + return EPassiveBaseData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBackupFull::ActiveTransferType() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TTransferDataType CMMCScBkupOpParamsBackupFull::ActiveTransferType() const + { + return EActiveBaseData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsBackupFull::PackageTransferType() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TPackageDataType CMMCScBkupOpParamsBackupFull::PackageTransferType() const + { + return ESystemData; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsRestoreFull::CMMCScBkupOpParamsRestoreFull() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupOpParamsRestoreFull::CMMCScBkupOpParamsRestoreFull() + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsRestoreFull::~CMMCScBkupOpParamsRestoreFull() +// +// C++ destructor. +// --------------------------------------------------------------------------- +EXPORT_C CMMCScBkupOpParamsRestoreFull::~CMMCScBkupOpParamsRestoreFull() + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsRestoreFull::NewL() +// +// +// --------------------------------------------------------------------------- +EXPORT_C CMMCScBkupOpParamsRestoreFull* CMMCScBkupOpParamsRestoreFull::NewL( + BkupDrivesAndOperationList *aDriveList, TBitFlags aCategories ) + { + CMMCScBkupOpParamsRestoreFull* self = new(ELeave) CMMCScBkupOpParamsRestoreFull( ); + CleanupStack::PushL( self ); + self->ConstructL( aDriveList, aCategories ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsRestoreFull::AssociatedOpType() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TMMCScBkupOperationType CMMCScBkupOpParamsRestoreFull::AssociatedOpType() const + { + return EMMCScBkupOperationTypeFullRestore; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsRestoreFull::PartType() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TBURPartType CMMCScBkupOpParamsRestoreFull::PartType() const + { + return EBURRestoreFull; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsRestoreFull::IncrementType() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TBackupIncType CMMCScBkupOpParamsRestoreFull::IncrementType() const + { + return EBackupBase; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsRestoreFull::PassiveTransferType() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TTransferDataType CMMCScBkupOpParamsRestoreFull::PassiveTransferType() const + { + return EPassiveBaseData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsRestoreFull::ActiveTransferType() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TTransferDataType CMMCScBkupOpParamsRestoreFull::ActiveTransferType() const + { + return EActiveBaseData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupOpParamsRestoreFull::PackageTransferType() +// +// +// --------------------------------------------------------------------------- +EXPORT_C TPackageDataType CMMCScBkupOpParamsRestoreFull::PackageTransferType() const + { + return ESystemData; + } + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupState.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupState.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,243 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupState implementation +* +* +*/ + +#include "CMMCScBkupState.h" + +// User includes +#include "MMCScBkupLogger.h" + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupState::CMMCScBkupState() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupState::CMMCScBkupState( MMMCScBkupDriver& aDriver, TInt aPriority ) +: CActive( aPriority ), iDriver( aDriver ) + { + CActiveScheduler::Add(this); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupState::~CMMCScBkupState() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupState::~CMMCScBkupState() + { + Cancel(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupState::RunL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupState::RunL() + { + User::LeaveIfError(iStatus.Int()); + // + PerformAsynchronousStateStepL(); + // + if (!IsActive()) + { + // If we've processed all the asynchronous steps, then + // perform the last rights on the state. + // + // If this causes a leave, then we cascade the failure + // to the observer - i.e. the error is treated as fatal. + TRAPD(err, PerformLastRightsL() ); + CompleteObserver( err ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupState::DoCancel() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupState::DoCancel() + { + __LOG3("CMMCScBkupState::DoCancel() - START - state: 0x%08x, IsActive: %d, status: %d", StateId().iUid, IsActive(), iStatus.Int() ); + PerformAsynchronousCancellation(); + CompleteObserver( KErrCancel ); + __LOG3("CMMCScBkupState::DoCancel() - END - state: 0x%08x, IsActive: %d, status: %d", StateId().iUid, IsActive(), iStatus.Int() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupState::RunError() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupState::RunError(TInt aError) + { +#ifdef MMCSCBKUP_USE_BREAKPOINTS + __BREAKPOINT(); +#endif + // + if ( aError == KErrNoMemory || aError == KErrDiskFull || aError == KErrNotReady || aError == KErrServerTerminated || aError == KErrWrite ) + { + __LOGFILE2("CMMCScBkupState::RunError() - **** - FATAL ERROR - state: 0x%08x, aError: %d - Notifying Observer (Engine)", StateId().iUid, aError ); + CompleteObserver( aError ); + } + else + { + __LOGFILE2("CMMCScBkupState::RunError() - **** - ATTEMPT TO HANDLE ERROR - state: 0x%08x, aError: %d...", StateId().iUid, aError ); + + const TBool errorHandled = PerformAsynchronousErrorCleanup( aError ); + + __LOGFILE1("CMMCScBkupState::RunError() - **** - handle error result: %d", errorHandled ); + + // If the cleanup callback didn't set us active again, then + // assume the object didn't perform any recovery. Therefore + // inform our observer about the error and give up. + if (!errorHandled || !IsActive()) + { + CompleteObserver( aError ); + } + } + // + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupState::ExecuteL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupState::ExecuteL(TRequestStatus& aObserver) + { + SetObserver(aObserver); + TRAPD(error, PerformStateInitL()); + + // If the object is active, then it is making use of asynchronous + // functionality, in which case we do nothing. + // + // If the object is not active or the call to PerformStateActionL left, + // then we complete the observer with the result of the trap + if (error != KErrNone || IsActive() == EFalse) + { + if (error == KErrNone) + { + PerformLastRightsL(); + } + // + CompleteObserver(error); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupState::PerformAsynchronousStateStepL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupState::PerformAsynchronousStateStepL() + { + // Derived classes should override this if they implement + // asynchronous behaviour + User::Invariant(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupState::PerformAsynchronousCancellation() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupState::PerformAsynchronousCancellation() + { + // Derived classes are expected to implement this if they have + // resources to free. For calls to CompleteSelf(), no action is needed. + __LOG3("CMMCScBkupState::PerformAsynchronousCancellation() - ERROR - cancellation not implemented for state: 0x%08x, IsActive: %d, status: %d", StateId().iUid, IsActive(), iStatus.Int() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupState::PerformLastRightsL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupState::PerformLastRightsL() + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupState::PerformAsynchronousErrorCleanup() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupState::PerformAsynchronousErrorCleanup( TInt aError ) + { + (void) aError; + __LOGFILE2("CMMCScBkupState::PerformAsynchronousErrorCleanup() - error: %d, state id: 0x%08x", aError, StateId().iUid ); + return EFalse; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupState::CompleteSelf() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupState::CompleteSelf( TInt aCompletionCode ) + { + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, aCompletionCode ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupState::CompleteObserver() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupState::CompleteObserver( TInt aCompletionCode ) + { + __ASSERT_ALWAYS(iObserver != NULL, User::Invariant()); + User::RequestComplete( iObserver, aCompletionCode ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupState::SetObserver() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupState::SetObserver(TRequestStatus& aStatus) + { + __ASSERT_ALWAYS(iObserver == NULL, User::Invariant()); + aStatus = KRequestPending; + iObserver = &aStatus; + } + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpActiveData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpActiveData.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,467 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupStateArchiveOpActiveData implementation +* +* +*/ + +#include "CMMCScBkupStateArchiveOpActiveData.h" + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupDataOwnerCollection.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "MMCScBkupSBEUtils.h" +#include "CMMCScBkupArchive.h" +#include "CMMCScBkupArchiveFooter.h" +#include "CMMCScBkupIndexWithIdentifier.h" +#include "MMMCScBkupArchiveDataInterface.h" + +// Constants +const TInt KMMCScBkupActiveDataOwnerDelayBeforeRetry = 2 * 1000000; // 2 seconds +const TInt KMMCScBkupNumberOfAttemptsToAllowADOToBecomeReady = 4; // corresponds to 8 seconds of waiting + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::CMMCScBkupStateArchiveOpActiveData() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpActiveData::CMMCScBkupStateArchiveOpActiveData( MMMCScBkupDriver& aDriver ) +: CMMCScBkupStateOpAware( aDriver ), iIndexValueCurrent( -1 ) + { + __LOG1("CMMCScBkupStateArchiveOpActiveData::CMMCScBkupStateArchiveOpActiveData() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::~CMMCScBkupStateArchiveOpActiveData() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpActiveData::~CMMCScBkupStateArchiveOpActiveData() + { + Cancel(); + // + iTimer.Close(); + // + delete iBackupTransferObject; + delete iRestoreTransferObject; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpActiveData* CMMCScBkupStateArchiveOpActiveData::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateArchiveOpActiveData* self = new(ELeave) CMMCScBkupStateArchiveOpActiveData( aDriver ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpActiveData::StateId() const + { + return KMMCScBkupStateIdArchiveOpActiveData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::NextStateBackupId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpActiveData::NextStateBackupId( TBool /*aPartial*/ ) const + { + // If we still have unprocessed active data owners remaining, then + // we must + // + // a) check their status again - to see if they are ready, then + // b) process them once again via this method + // + // The 'get data owner statuses' object will trigger us again + // when it has performed an update of all statuses + + // By default, we want to move onto the passive data... + TMMCScBkupStateId nextState = KMMCScBkupStateIdArchiveOpPassiveData; + if (AllDataOwnersHandled() == EFalse) + { + // ... but we've still got at least one data owner who's not yet + // finished preparing their data... so we have to retry + nextState = KMMCScBkupStateIdGetDataOwnerStatuses; + } + // + return nextState; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::NextStateRestoreId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpActiveData::NextStateRestoreId( TBool /*aPartial*/ ) const + { + // If we still have unprocessed active data owners remaining, then + // we must + // + // a) check their status again - to see if they are ready, then + // b) process them once again via this method + // + // The 'get data owner statuses' object will trigger us again + // when it has performed an update of all statuses + + // By default, we want to move onto the passive data... + TMMCScBkupStateId nextState = KMMCScBkupStateIdArchiveOpPublicDataFiles; + if (AllDataOwnersHandled() == EFalse) + { + // ... but we've still got at least one data owner who's not yet + // finished preparing their data... so we have to retry + nextState = KMMCScBkupStateIdGetDataOwnerStatuses; + } + // + return nextState; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::PerformStateInitBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpActiveData::PerformStateInitBackupL( TBool /*aPartial*/ ) + { + __DEBUG_TESTING_SKIP_BACKUP_ACT_DATA; + __LOG("CMMCScBkupStateArchiveOpActiveData::PerformStateInitBackupL() - START"); + + iBackupTransferObject = CMMCScBkupWriteDataTransferRequest< TTransferDataType >::NewL( + Driver(), + *this, + EMMCScBkupOwnerDataTypeActiveData, + ESIDTransferDerivedType, + Driver().DrvParamsBase().ActiveTransferType() + ); + CompleteSelf(); + __LOG("CMMCScBkupStateArchiveOpActiveData::PerformStateInitBackupL() - END"); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::PerformStateInitRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpActiveData::PerformStateInitRestoreL( TBool /*aPartial*/ ) + { + __DEBUG_TESTING_SKIP_RESTORE_ACT_DATA; + __LOG("CMMCScBkupStateArchiveOpActiveData::PerformStateInitRestoreL() - START"); + + iRestoreTransferObject = CMMCScBkupReadDataTransferRequest< TTransferDataType >::NewL( + Driver(), + EMMCScBkupOwnerDataTypeActiveData, + Driver().DrvParamsBase().ActiveTransferType() + ); + + CompleteSelf(); + __LOG("CMMCScBkupStateArchiveOpActiveData::PerformStateInitRestoreL() - END"); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL( TBool /*aPartial*/ ) + { + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + const TInt count = dataOwners.Count(); + __LOG2("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - START - iIndexValueCurrent: %d/%d", iIndexValueCurrent, count); + // + while ( ++iIndexValueCurrent < count ) + { + CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner(iIndexValueCurrent); + + // Has this data owner been processed? + // Is the data owner even ready? + const TBool activeDataAlreadyProcessed = owner.CompletionStatus( EMMCScBkupOwnerDataTypeActiveData ); + const TBool dataOwnerIsReady = ( owner.Status() == EDataOwnerReady || + owner.Status() == EDataOwnerReadyNoImpl ); + const TBool dataHasRealActiveData = ( owner.Status() == EDataOwnerReady ); + // + __LOG5("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - DO: 0x%08x has status: %d, alreadyProcessed: %d, isReady: %d, dataHasRealActiveData: %d", owner.SecureId().iId, owner.Status(), activeDataAlreadyProcessed, dataOwnerIsReady, dataHasRealActiveData); + // + if (!activeDataAlreadyProcessed) + { + __LOG("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - active data has not already been processed..."); + + if (dataOwnerIsReady) + { + __LOG("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - data owner is ready..."); + + if ( dataHasRealActiveData ) + { + __LOG("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - data owner has real active data..."); + + // Try and obtain the active data for this client + __ASSERT_ALWAYS(iBackupTransferObject->IsActive() == EFalse, User::Invariant()); + // + iBackupTransferObject->RequestL( owner, + iStatus, + Driver().DrvParamsBase().DriveAndOperations() ); + SetActive(); + break; // while loop + } + else + { + // The data owner is a hybrid - we shouldn't request data for a data owner that + // doesn't provide an active data interface callback implementation. + __LOG("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - DO is a hybrid - set completion status to ETrue"); + owner.SetCompletionStatus( EMMCScBkupOwnerDataTypeActiveData, ETrue ); + } + } + else + { + // Retry a number of times, but eventually we'll give up + const TInt attemptsSoFar = owner.ActiveDataRetryCount(); + owner.SetActiveDataRetryCount( attemptsSoFar + 1 ); + + if ( attemptsSoFar >= KMMCScBkupNumberOfAttemptsToAllowADOToBecomeReady ) + { + // Give up, this DO is taking too long + owner.SetCompletionStatus( EMMCScBkupOwnerDataTypeActiveData, ETrue ); + __LOG1("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - ADO with SID: 0x%08x has taken too long to prepare, skipping", owner.SecureId().iId); + } + else + { + // DO is not yet ready, we're going to have to check its + // status again in a while... + __LOG1("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepBackupL() - attemptsSoFar %d", attemptsSoFar); + iAtLeastOneDataOwnerIsNotYetReady = ETrue; + } + } + } + } + // + CheckNeedToStartRetryTimerL(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepRestoreL( TBool /*aPartial*/ ) + { + CMMCScBkupIndexBase& indexBase = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeActiveData ); + CMMCScBkupIndexWithIdentifier< TSecureId >& index = static_cast< CMMCScBkupIndexWithIdentifier< TSecureId >& >( indexBase ); + const TInt count = index.Count(); + // + // + while ( ++iIndexValueCurrent < count ) + { + // Get the associated data owner + const CMMCScBkupIndexEntry& entry = index.At( iIndexValueCurrent ); + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + CMMCScBkupDataOwnerInfo& owner = dataOwners.OwnerL( entry.Identifier() ); + + // Has this data owner been processed? + // Is the data owner even ready? + const TBool activeDataAlreadyProcessed = owner.CompletionStatus(EMMCScBkupOwnerDataTypeActiveData); + const TBool dataOwnerIsReady = ( owner.Status() == EDataOwnerReady || + owner.Status() == EDataOwnerReadyNoImpl ); + // + if (!activeDataAlreadyProcessed) + { + if (dataOwnerIsReady) + { + __ASSERT_ALWAYS(iRestoreTransferObject->IsActive() == EFalse, User::Invariant()); + // + const RArray& subEntries = entry.Entries(); + iRestoreTransferObject->RequestL( owner, + iStatus, + subEntries ); + __LOG1("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepRestoreL() - trying to restore ACTIVE DATA for SID: 0x%08x", owner.SecureId().iId ); + // + SetActive(); + break; // while loop + } + else + { + // Retry a number of times, but eventually we'll give up + const TInt attemptsSoFar = owner.ActiveDataRetryCount(); + owner.SetActiveDataRetryCount( attemptsSoFar + 1 ); + + if ( attemptsSoFar >= KMMCScBkupNumberOfAttemptsToAllowADOToBecomeReady ) + { + // Give up, this DO is taking too long + owner.SetCompletionStatus( EMMCScBkupOwnerDataTypeActiveData, ETrue ); + __LOG1("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousStateStepRestoreL() - ADO with SID: 0x%08x has taken too long to prepare, skipping", owner.SecureId().iId); + } + else + { + // DO is not yet ready, we're going to have to check its + // status again in a while... + iAtLeastOneDataOwnerIsNotYetReady = ETrue; + } + } + } + } + // + CheckNeedToStartRetryTimerL(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousErrorCleanupBackup() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousErrorCleanupBackup( TBool /*aPartial*/, TInt aError ) + { + (void) aError; + __LOG1("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousErrorCleanupBackup() - **** - error: %d", aError ); + + // Reset state and move to next item. Treat the current (badly behaving) item + // as completed/processed. + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + if ( iIndexValueCurrent < dataOwners.Count() ) + { + CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); + owner.SetCompletionStatus( EMMCScBkupOwnerDataTypeActiveData, ETrue ); + + __LOGFILE2("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousErrorCleanupBackup() - **** - error: %d, SID: 0x%08x - ACTIVE data skipped for DO", aError, owner.SecureId().iId ); + } + + CompleteSelf(); + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousErrorCleanupRestore() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousErrorCleanupRestore( TBool /*aPartial*/, TInt aError ) + { + (void) aError; + __LOGFILE1("CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousErrorCleanupRestore() - **** - error: %d", aError ); + + CompleteSelf(); + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousCancellation() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpActiveData::PerformAsynchronousCancellation() + { + if (iTimer.Handle() != KNullHandle ) + { + iTimer.Cancel(); + } + if (iBackupTransferObject) + { + iBackupTransferObject->Cancel(); + } + if (iRestoreTransferObject) + { + iRestoreTransferObject->Cancel(); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::PerformLastRightsBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpActiveData::PerformLastRightsBackupL( TBool /*aPartial*/ ) + { + __LOG1("CMMCScBkupStateArchiveOpActiveData::PerformLastRightsBackupL() - iAtLeastOneDataOwnerIsNotYetReady %d", iAtLeastOneDataOwnerIsNotYetReady ); + + if ( AllDataOwnersHandled() ) + { + // Only write the index if we've handled all the active data owners + CMMCScBkupIndexBase& index = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeActiveData ); + index.StoreL(Driver()); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::AddIndexRecordL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpActiveData::AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ) + { + CMMCScBkupIndexBase& indexBase = aFooter.IndexByType( EMMCScBkupOwnerDataTypeActiveData ); + CMMCScBkupIndexWithIdentifier< TSecureId>& index = static_cast< CMMCScBkupIndexWithIdentifier< TSecureId>& >( indexBase ); + // + index.AddIndexRecordL( aInfo, aDrive, aDataOwner.SecureId() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpActiveData::CheckNeedToStartRetryTimerL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpActiveData::CheckNeedToStartRetryTimerL() + { + // We need to delay until the remaining active data owners are ready + const TBool processingDataHandler = IsActive(); + if ( !processingDataHandler && !AllDataOwnersHandled() && iTimer.Handle() == KNullHandle ) + { + // Implicitly, we have at least one DO that's not yet ready, and + // we have processed as many of the ready DO's as is possible on this + // cycle. Let's wait a few seconds to give the DO's a time to finish + // preparing and then try again. See NextStateId() for how this works. + User::LeaveIfError( iTimer.CreateLocal() ); + + __LOG("CMMCScBkupStateArchiveOpActiveData::CheckNeedToStartRetryTimerL() - SetActive"); + SetActive(); + const TTimeIntervalMicroSeconds32 delay(KMMCScBkupActiveDataOwnerDelayBeforeRetry); + iTimer.After( iStatus, delay ); + } + } + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpArchiveFooter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpArchiveFooter.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,174 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupStateArchiveOpArchiveFooter implementation +* +* +*/ + +#include "CMMCScBkupStateArchiveOpArchiveFooter.h" + +// System includes +#include +#include +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupArchive.h" +#include "CMMCScBkupArchiveFooter.h" +#include "CMMCScBkupArchiveHeader.h" + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpArchiveFooter::CMMCScBkupStateArchiveOpArchiveFooter() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpArchiveFooter::CMMCScBkupStateArchiveOpArchiveFooter( MMMCScBkupDriver& aDriver ) +: CMMCScBkupState( aDriver ) + { + __LOG1("CMMCScBkupStateArchiveOpArchiveFooter::CMMCScBkupStateArchiveOpArchiveFooter() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpArchiveFooter::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpArchiveFooter* CMMCScBkupStateArchiveOpArchiveFooter::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateArchiveOpArchiveFooter* self = new(ELeave) CMMCScBkupStateArchiveOpArchiveFooter( aDriver ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpArchiveFooter::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpArchiveFooter::StateId() const + { + return KMMCScBkupStateIdArchiveOpArchiveFooter; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpArchiveFooter::NextStateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpArchiveFooter::NextStateId() const + { + TMMCScBkupStateId nextState = KMMCScBkupStateIdOperationComplete; + // + const TMMCScBkupOperationType type = Driver().DrvOperation(); + switch(type) + { + case EMMCScBkupOperationTypeFullBackup: + nextState = KMMCScBkupStateIdOperationComplete; + break; + case EMMCScBkupOperationTypeFullRestore: + nextState = KMMCScBkupStateIdArchiveOpDataOwners; + break; + default: + ASSERT( EFalse ); + break; + } + // + return nextState; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpArchiveFooter::PerformStateInitL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpArchiveFooter::PerformStateInitL() + { + CompleteSelf(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() + { + CMMCScBkupArchive& archive = Driver().DrvArchive(); + CMMCScBkupArchiveFooter& footer = archive.Footer(); + CMMCScBkupArchiveHeader& header = archive.Header(); + // + const TMMCScBkupOperationType type = Driver().DrvOperation(); + switch(type) + { + case EMMCScBkupOperationTypeFullBackup: + __LOG("CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() - EMMCScBkupOperationTypeFullBackup - storing footer..." ); + footer.StoreL(); + break; + case EMMCScBkupOperationTypeFullRestore: + { + __LOG("CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() - EMMCScBkupOperationTypeFullRestore - restoring footer..." ); + + const TMMCScBkupArchiveVector& archiveVector = Driver().DrvADI().ADIOverallArchiveVectorInfo(); + __LOG1("CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() - overall archive length: %d", archiveVector.Length() ); + + const TInt footerLengthFromHeader = header.FooterLength(); + __LOG1("CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() - footer length (read from header): %d", footerLengthFromHeader ); + + const TInt footerStartingOffset = archiveVector.Length() - footerLengthFromHeader; + __LOG1("CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() - footer starting offset: %d", footerStartingOffset ); + + footer.RestoreL( footerStartingOffset ); + + __LOG("CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() - restoring all indicies"); + + // Restore all indicies + CMMCScBkupIndexBase& indexDataOwner = footer.IndexByType(EMMCScBkupOwnerDataTypeDataOwner); + indexDataOwner.RestoreL( Driver() ); + + CMMCScBkupIndexBase& indexSystem = footer.IndexByType( EMMCScBkupOwnerDataTypeSystemData ); + indexSystem.RestoreL( Driver() ); + + CMMCScBkupIndexBase& indexJava = footer.IndexByType( EMMCScBkupOwnerDataTypeJavaData ); + indexJava.RestoreL( Driver() ); + + CMMCScBkupIndexBase& indexPassive = footer.IndexByType( EMMCScBkupOwnerDataTypePassiveData ); + indexPassive.RestoreL( Driver() ); + + CMMCScBkupIndexBase& indexActive = footer.IndexByType( EMMCScBkupOwnerDataTypeActiveData ); + indexActive.RestoreL( Driver() ); + + CMMCScBkupIndexBase& indexPublic = footer.IndexByType( EMMCScBkupOwnerDataTypePublicData ); + indexPublic.RestoreL( Driver() ); + + __LOG("CMMCScBkupStateArchiveOpArchiveFooter::PerformAsynchronousStateStepL() - all indicies restored"); + + break; + } + default: + User::Leave(KErrNotSupported); + break; + } + } + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpArchiveHeader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpArchiveHeader.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupStateArchiveOpArchiveHeader implementation +* +* +*/ + +#include "CMMCScBkupStateArchiveOpArchiveHeader.h" + +// System includes +#include +#include +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupArchive.h" +#include "CMMCScBkupArchiveHeader.h" + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpArchiveHeader::CMMCScBkupStateArchiveOpArchiveHeader() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpArchiveHeader::CMMCScBkupStateArchiveOpArchiveHeader( MMMCScBkupDriver& aDriver ) +: CMMCScBkupState( aDriver ) + { + __LOG1("CMMCScBkupStateArchiveOpArchiveHeader::CMMCScBkupStateArchiveOpArchiveHeader() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpArchiveHeader::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpArchiveHeader* CMMCScBkupStateArchiveOpArchiveHeader::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateArchiveOpArchiveHeader* self = new(ELeave) CMMCScBkupStateArchiveOpArchiveHeader( aDriver ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpArchiveHeader::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpArchiveHeader::StateId() const + { + return KMMCScBkupStateArchiveOpArchiveHeader; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpArchiveHeader::NextStateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpArchiveHeader::NextStateId() const + { + TMMCScBkupStateId nextState = KMMCScBkupStateIdGetDataOwners; + // + const TMMCScBkupOperationType type = Driver().DrvOperation(); + switch(type) + { + case EMMCScBkupOperationTypeFullBackup: + nextState = KMMCScBkupStateIdGetDataOwners; + break; + case EMMCScBkupOperationTypeFullRestore: + nextState = KMMCScBkupStateIdArchiveOpArchiveFooter; + break; + default: + ASSERT( EFalse ); + break; + } + // + return nextState; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpArchiveHeader::PerformStateInitL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpArchiveHeader::PerformStateInitL() + { + CompleteSelf(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpArchiveHeader::PerformAsynchronousStateStepL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpArchiveHeader::PerformAsynchronousStateStepL() + { + CMMCScBkupArchive& archive = Driver().DrvArchive(); + CMMCScBkupArchiveHeader& header = archive.Header(); + // + const TMMCScBkupOperationType type = Driver().DrvOperation(); + switch(type) + { + case EMMCScBkupOperationTypeFullBackup: + header.StoreL(archive.Category()); +#ifdef RD_FILE_MANAGER_BACKUP + // Activate crc-calculation for payload data. Header crc'd separately + Driver().DrvADI().ADIActivateCrcCalculation(ETrue); +#endif + break; + case EMMCScBkupOperationTypeFullRestore: + header.RestoreL(); + break; + default: + User::Leave(KErrNotSupported); + break; + } + } + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpDataOwners.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpDataOwners.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,272 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CMMCScBkupStateArchiveOpDataOwners implementation +* +* +*/ + +#include "CMMCScBkupStateArchiveOpDataOwners.h" + +// System includes +#include +#include +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupArchive.h" +#include "RMMCScBkupProgressSizer.h" +#include "CMMCScBkupArchiveFooter.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "CMMCScBkupIndexDataOwners.h" +#include "MMMCScBkupProgressObserver.h" +#include "CMMCScBkupDataOwnerCollection.h" +#include "MMMCScBkupArchiveDataInterface.h" + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpDataOwners::CMMCScBkupStateArchiveOpDataOwners() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpDataOwners::CMMCScBkupStateArchiveOpDataOwners( MMMCScBkupDriver& aDriver ) +: CMMCScBkupStateOpAware( aDriver ), iIndexValueCurrent( -1 ) + { + __LOG1("CMMCScBkupStateArchiveOpDataOwners::CMMCScBkupStateArchiveOpDataOwners() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpDataOwners::~CMMCScBkupStateArchiveOpDataOwners() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpDataOwners::~CMMCScBkupStateArchiveOpDataOwners() + { + Cancel(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpDataOwners::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpDataOwners* CMMCScBkupStateArchiveOpDataOwners::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateArchiveOpDataOwners* self = new(ELeave) CMMCScBkupStateArchiveOpDataOwners( aDriver ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpDataOwners::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpDataOwners::StateId() const + { + return KMMCScBkupStateIdArchiveOpDataOwners; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpDataOwners::NextStateBackupId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpDataOwners::NextStateBackupId( TBool /*aPartial*/ ) const + { + return KMMCScBkupStateIdArchiveOpArchiveFooter; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpDataOwners::NextStateRestoreId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpDataOwners::NextStateRestoreId( TBool /*aPartial*/ ) const + { + return KMMCScBkupStateIdValidateDiskSpace; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpDataOwners::PerformStateInitBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpDataOwners::PerformStateInitBackupL( TBool /*aPartial*/ ) + { + // Work is carried out inside asynchronous step + CompleteSelf(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpDataOwners::PerformStateInitRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpDataOwners::PerformStateInitRestoreL( TBool /*aPartial*/ ) + { + // Restore each data owner asynchronously + CompleteSelf(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousStateStepBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousStateStepBackupL( TBool /*aPartial*/ ) + { + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + CMMCScBkupArchiveFooter& footer = Driver().DrvArchive().Footer(); + CMMCScBkupIndexBase& indexBase = footer.IndexByType(EMMCScBkupOwnerDataTypeDataOwner); + CMMCScBkupIndexDataOwners& index = static_cast< CMMCScBkupIndexDataOwners& >( indexBase ); + const TInt count = dataOwners.Count(); + // + if ( ++iIndexValueCurrent < count ) + { + CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); + + // Externalise + MMMCScBkupArchiveDataInterface& archiveDataInterface = ADI(); + RWriteStream stream( archiveDataInterface.ADIWriteStreamUncompressedLC() ); + stream << owner; + stream.CommitL(); + CleanupStack::PopAndDestroy(); // stream + + + // Save the offset of the data owner + const TMMCScBkupArchiveVector& info = archiveDataInterface.ADICurrentArchiveVectorInfo(); + index.AddIndexRecordL( info ); + + // Now move on to the next data owner + CompleteSelf(); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousStateStepRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousStateStepRestoreL( TBool /*aPartial*/ ) + { + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + CMMCScBkupArchiveFooter& footer = Driver().DrvArchive().Footer(); + CMMCScBkupIndexBase& indexBase = footer.IndexByType( EMMCScBkupOwnerDataTypeDataOwner ); + CMMCScBkupIndexDataOwners& index = static_cast< CMMCScBkupIndexDataOwners& >( indexBase ); + const TInt count = index.Count(); + __LOG1( "CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousStateStepRestoreL() - %d data owner index records...", count ); + // + if ( ++iIndexValueCurrent < count ) + { + const TMMCScBkupArchiveVector& entry = index.At( iIndexValueCurrent ); + __LOG3( "CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousStateStepRestoreL() - entry[%03d] at offset: 0x%08x, length: %4d", iIndexValueCurrent, entry.Offset(), entry.Length() ); + + MMMCScBkupArchiveDataInterface& archiveDataInterface = ADI(); + RReadStream stream( archiveDataInterface.ADIReadStreamUncompressedLC( entry.Offset() ) ); + + // Internalize a new entry and add it to the data owner collection + CMMCScBkupDataOwnerInfo* dataOwner = CMMCScBkupDataOwnerInfo::NewLC( stream ); + dataOwners.AppendL( dataOwner ); + CleanupStack::Pop( dataOwner ); + + // Tidy up & check that we didn't read too much - oops + const TMMCScBkupArchiveVector& readInfo = archiveDataInterface.ADICurrentArchiveVectorInfo(); + if ( readInfo.Length() > entry.Length() ) + { + __LOG( "CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousStateStepRestoreL() - ERROR - Read too much data! -> leave with KErrCorrupt" ); + User::Leave( KErrCorrupt ); + } + CleanupStack::PopAndDestroy(); // stream + + // Continue to next entry + CompleteSelf(); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpDataOwners::PerformLastRightsBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpDataOwners::PerformLastRightsBackupL( TBool /*aPartial*/ ) + { + CMMCScBkupIndexBase& index = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeDataOwner ); + index.StoreL( Driver() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpDataOwners::PerformLastRightsRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpDataOwners::PerformLastRightsRestoreL( TBool /*aPartial*/ ) + { + // Calculate restore byte size (for all drives) + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + const TInt64 totalDataRestoreSize = dataOwners.TotalOperationalSizeL(); + + // Inform progress manager + if(Driver().DrvLastCategory()) + { + __LOG2("CMMCScBkupStateArchiveOpDataOwners::PerformLastRightsRestoreL() - report progress understood (%Ld + %Ld)", + totalDataRestoreSize, Driver().DrvTotalProgress()); + Driver().DrvProgressHandler().MMCScBkupHandleProgressDomainUnderstood( totalDataRestoreSize + Driver().DrvTotalProgress()); + } + else + { + __LOG2("CMMCScBkupStateArchiveOpDataOwners::PerformLastRightsRestoreL() - adding progress amount %Ld to existing %Ld)", + totalDataRestoreSize, Driver().DrvTotalProgress()); + Driver().DrvStoreTotalProgress( totalDataRestoreSize ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousErrorCleanupRestore() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousErrorCleanupRestore( TBool /*aPartial*/, TInt aError ) + { + (void) aError; + __LOGFILE1("CMMCScBkupStateArchiveOpDataOwners::PerformAsynchronousErrorCleanupRestore() - **** - error: %d", aError ); + + // Just try to skip the data owner. + CompleteSelf(); + return ETrue; + } + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpJavaData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpJavaData.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,548 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupStateArchiveOpJavaData implementation +* +* +*/ + +#include "CMMCScBkupStateArchiveOpJavaData.h" + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupDataOwnerCollection.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "MMCScBkupSBEUtils.h" +#include "CMMCScBkupArchive.h" +#include "CMMCScBkupArchiveFooter.h" +#include "CMMCScBkupIndexJavaData.h" +#include "MMMCScBkupArchiveDataInterface.h" + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::CMMCScBkupStateArchiveOpJavaData() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpJavaData::CMMCScBkupStateArchiveOpJavaData( MMMCScBkupDriver& aDriver ) +: CMMCScBkupStateOpAware( aDriver ), iIndexValueCurrent( -1 ) + { + __LOG1("CMMCScBkupStateArchiveOpJavaData::CMMCScBkupStateArchiveOpJavaData() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::~CMMCScBkupStateArchiveOpJavaData() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpJavaData::~CMMCScBkupStateArchiveOpJavaData() + { + Cancel(); + // + delete iBackupTransferObjectMidlet; + delete iBackupTransferObjectMidletData; + delete iRestoreTransferObjectMidlet; + delete iRestoreTransferObjectMidletData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpJavaData* CMMCScBkupStateArchiveOpJavaData::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateArchiveOpJavaData* self = new(ELeave) CMMCScBkupStateArchiveOpJavaData( aDriver ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpJavaData::StateId() const + { + return KMMCScBkupStateIdArchiveOpJavaData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::NextStateBackupId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpJavaData::NextStateBackupId( TBool /*aPartial*/ ) const + { + return KMMCScBkupStateIdGetDataOwnerStatuses; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::NextStateRestoreId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpJavaData::NextStateRestoreId( TBool /*aPartial*/ ) const + { + return KMMCScBkupStateIdArchiveOpPassiveData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::PerformStateInitBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpJavaData::PerformStateInitBackupL( TBool /*aPartial*/ ) + { + __LOG("CMMCScBkupStateArchiveOpJavaData::PerformStateInitBackupL() - START" ); + __DEBUG_TESTING_SKIP_BACKUP_JAV_DATA; + + iBackupTransferObjectMidlet = CMMCScBkupWriteDataTransferRequest< TJavaTransferType >::NewL( + Driver(), + *this, + EMMCScBkupOwnerDataTypeJavaData, + EJavaTransferDerivedType, + EJavaMIDlet + ); + + iBackupTransferObjectMidletData = CMMCScBkupWriteDataTransferRequest< TJavaTransferType >::NewL( + Driver(), + *this, + EMMCScBkupOwnerDataTypePassiveData, + EJavaTransferDerivedType, + EJavaMIDletData + ); + + CompleteSelf(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL( TBool /*aPartial*/ ) + { + __LOG("CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL() - START" ); + __DEBUG_TESTING_SKIP_RESTORE_JAV_DATA; + + + iRestoreTransferObjectMidlet = CMMCScBkupReadDataTransferRequest< TJavaTransferType >::NewL( + Driver(), + EMMCScBkupOwnerDataTypeJavaData, + EJavaMIDlet + ); + + iRestoreTransferObjectMidletData = CMMCScBkupReadDataTransferRequest< TJavaTransferType >::NewL( + Driver(), + EMMCScBkupOwnerDataTypePassiveData, + EJavaMIDletData + ); + + CompleteSelf(); + __LOG("CMMCScBkupStateArchiveOpJavaData::PerformStateInitRestoreL() - END" ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL( TBool /*aPartial*/ ) + { + __LOG1("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() - START - iCurrentJavaState: %d", iCurrentJavaState ); + + switch( iCurrentJavaState ) + { + case EJavaStateIdle: + __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() - EJavaStateIdle"); + BackupMidletL(); + break; + case EJavaStateMidlet: + __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() - EJavaStateMidlet"); + BackupMidletDataL(); + break; + case EJavaStateMidletData: + __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() - EJavaStateMidletData"); + iCurrentJavaState = EJavaStateIdle; + CompleteSelf(); + break; + default: + break; + } + + __LOG2("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepBackupL() - END - iCurrentJavaState: %d, IsActive: %d", iCurrentJavaState, IsActive() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL( TBool /*aPartial*/ ) + { + __LOG1("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() - START - iCurrentJavaState: %d", iCurrentJavaState ); + + switch( iCurrentJavaState ) + { + case EJavaStateIdle: + __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() - EJavaStateIdle"); + RestoreMidletL(); + break; + case EJavaStateMidlet: + __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() - EJavaStateMidlet"); + RestoreMidletDataL(); + break; + case EJavaStateMidletData: + __LOG("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() - EJavaStateMidletData"); + iCurrentJavaState = EJavaStateIdle; + CompleteSelf(); + break; + default: + break; + } + + __LOG2("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousStateStepRestoreL() - END - iCurrentJavaState: %d, IsActive: %d", iCurrentJavaState, IsActive() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup( TBool /*aPartial*/, TInt aError ) + { + (void) aError; + __LOG1("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup() - error: %d", aError ); + + // Reset state and move to next item. Treat the current (badly behaving) item + // as completed/processed. + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + if ( iIndexValueCurrent < dataOwners.Count() ) + { + CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); + owner.SetCompletionStatus( EMMCScBkupOwnerDataTypeJavaData, ETrue ); + iCurrentJavaState = EJavaStateIdle; + + __LOGFILE2("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupBackup() - **** - error: %d, SID: 0x%08x - JAVA data skipped for DO", aError, owner.SecureId().iId ); + } + + CompleteSelf(); + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupRestore() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupRestore( TBool /*aPartial*/, TInt aError ) + { + (void) aError; + __LOGFILE1("CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousErrorCleanupRestore() - **** - error: %d", aError ); + + iCurrentJavaState = EJavaStateIdle; + CompleteSelf(); + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousCancellation() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpJavaData::PerformAsynchronousCancellation() + { + if (iBackupTransferObjectMidlet) + { + iBackupTransferObjectMidlet->Cancel(); + } + if (iBackupTransferObjectMidletData) + { + iBackupTransferObjectMidletData->Cancel(); + } + if (iRestoreTransferObjectMidlet) + { + iRestoreTransferObjectMidlet->Cancel(); + } + if (iRestoreTransferObjectMidletData) + { + iRestoreTransferObjectMidletData->Cancel(); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::PerformLastRightsBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpJavaData::PerformLastRightsBackupL( TBool /*aPartial*/ ) + { + CMMCScBkupIndexBase& index = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeJavaData ); + index.StoreL( Driver() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::PerformLastRightsRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpJavaData::PerformLastRightsRestoreL( TBool /*aPartial*/ ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::AddIndexRecordL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpJavaData::AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ) + { + CMMCScBkupIndexBase& indexBase = aFooter.IndexByType( EMMCScBkupOwnerDataTypeJavaData ); + CMMCScBkupIndexJavaData& index = static_cast< CMMCScBkupIndexJavaData& >( indexBase ); + // + TJavaTransferType type = EJavaMIDlet; + HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( aDataOwner.Owner().Identifier() ); + // + if ( iCurrentJavaState == EJavaStateMidlet ) + { + __LOG4("CMMCScBkupStateArchiveOpJavaData::AddIndexRecordL() - hash: %S, aDrive: %c:, offset: %8d, length: %8d, type: EJavaMIDlet", hash, aDrive + 'A', aInfo.Offset(), aInfo.Length() ); + type = EJavaMIDlet; + } + else if ( iCurrentJavaState == EJavaStateMidletData ) + { + __LOG4("CMMCScBkupStateArchiveOpJavaData::AddIndexRecordL() - hash: %S, aDrive: %c:, offset: %8d, length: %8d, type: EJavaMIDletData", hash, aDrive + 'A', aInfo.Offset(), aInfo.Length() ); + type = EJavaMIDletData; + } + // + index.AddIndexRecordL( aInfo, *hash, aDrive, type ); + CleanupStack::PopAndDestroy( hash ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::BackupMidletL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpJavaData::BackupMidletL() + { + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + const TInt count = dataOwners.Count(); + // + while ( ++iIndexValueCurrent < count ) + { + CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); + // + if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypeJavaData ) == EFalse ) + { +#ifdef __MMCSCBKUPLOGGING_ENABLED__ + HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( owner.Owner().Identifier() ); + __LOG1("CMMCScBkupStateArchiveOpJavaData::BackupMidletL() - trying to get midlet for hash: %S", hash ); + CleanupStack::PopAndDestroy( hash ); +#endif + + iBackupTransferObjectMidlet->RequestL( owner, + iStatus, + Driver().DrvParamsBase().DriveAndOperations() ); + SetActive(); + iCurrentJavaState = EJavaStateMidlet; + + break; // while loop + } + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::BackupMidletDataL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpJavaData::BackupMidletDataL() + { + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); + + // We only need to request the midlet's passive data if it has a non-zero + // size. + if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypePassiveData ) == EFalse ) + { + if ( owner.OperationalSize( EMMCScBkupOwnerDataTypePassiveData ) > 0 ) + { +#ifdef __MMCSCBKUPLOGGING_ENABLED__ + HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( owner.Owner().Identifier() ); + __LOG1("CMMCScBkupStateArchiveOpJavaData::BackupMidletDataL() - trying to get midlet data for hash: %S", hash ); + CleanupStack::PopAndDestroy( hash ); +#endif + + iBackupTransferObjectMidletData->RequestL( owner, + iStatus, + Driver().DrvParamsBase().DriveAndOperations() ); + SetActive(); + } + else + { + CompleteSelf(); + } + } + else + { + CompleteSelf(); + } + + iCurrentJavaState = EJavaStateMidletData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() + { + CMMCScBkupIndexBase& indexBase = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeJavaData ); + CMMCScBkupIndexJavaData& index = static_cast< CMMCScBkupIndexJavaData& >( indexBase ); + + const TInt count = index.Count(); + __LOG1("CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() - START - %d data owners...", count ); + // + if ( ++iIndexValueCurrent < count ) + { + __LOG2("CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() - getting java data index record [%03d/%03d]", iIndexValueCurrent, count); + const CMMCScBkupIndexJavaDataEntry& entry = index.At( iIndexValueCurrent ); + + // Get the associated data owner + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + + __LOG1("CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() - trying to get data owner info for hash: %S", &entry.Hash() ); + CMMCScBkupDataOwnerInfo& owner = dataOwners.OwnerL( entry.Hash() ); + + if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypeJavaData ) == EFalse ) + { + // Request all the java data (on all supported drives) for this + // particular data owner + __LOG3("CMMCScBkupStateArchiveOpJavaData::RestoreMidletL() - trying to restore JAVA MIDLET for hash: %S [offset: %8d, length: %8d]", &entry.Hash(), entry.MidletInfo().Offset(), entry.MidletInfo().Length() ); + + // Build restore entry list (will only contain one entry - the + // reader API forces an array interface on us, so let's do ou best + // to please it...) + const TMMCScBkupArchiveDriveAndVector driveAndVector( entry.Drive(), entry.MidletInfo() ); + iRestoreEntries.Reset(); + iRestoreEntries.AppendL( driveAndVector ); + + // Start the asynchronous restore op... + iRestoreTransferObjectMidlet->RequestL( owner, + iStatus, + iRestoreEntries ); + SetActive(); + } + else + { + CompleteSelf(); + } + + iCurrentJavaState = EJavaStateMidlet; + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() + { + CMMCScBkupIndexBase& indexBase = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeJavaData ); + CMMCScBkupIndexJavaData& index = static_cast< CMMCScBkupIndexJavaData& >( indexBase ); + + const TInt count = index.Count(); + __LOG1("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - START - %d data owners...", count ); + // + if ( iIndexValueCurrent < count ) + { + __LOG2("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - getting java data index record [%03d/%03d]", iIndexValueCurrent, count); + const CMMCScBkupIndexJavaDataEntry& entry = index.At( iIndexValueCurrent ); + + if ( entry.HasMidletDataInfo() ) + { + // Get the associated data owner + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + + __LOG1("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - trying to get data owner info for hash: %S", &entry.Hash() ); + CMMCScBkupDataOwnerInfo& owner = dataOwners.OwnerL( entry.Hash() ); + + if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypePassiveData ) == EFalse ) + { + // Request all the java data (on all supported drives) for this + // particular data owner + __LOG3("CMMCScBkupStateArchiveOpJavaData::RestoreMidletDataL() - trying to restore JAVA MIDLET DATA for hash: %S [offset: %8d, length: %8d]", &entry.Hash(), entry.MidletDataInfo().Offset(), entry.MidletDataInfo().Length() ); + + // Build restore entry list (will only contain one entry - the + // reader API forces an array interface on us, so let's do ou best + // to please it...) + const TMMCScBkupArchiveDriveAndVector driveAndVector( entry.Drive(), entry.MidletDataInfo() ); + iRestoreEntries.Reset(); + iRestoreEntries.AppendL( driveAndVector ); + + // Start the asynchronous restore op... + iRestoreTransferObjectMidletData->RequestL( owner, + iStatus, + iRestoreEntries ); + SetActive(); + } + else + { + CompleteSelf(); + } + } + else + { + CompleteSelf(); + } + } + else + { + CompleteSelf(); + } + + iCurrentJavaState = EJavaStateMidletData; + } + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpPassiveData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpPassiveData.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,309 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupStateArchiveOpPassiveData implementation +* +* +*/ + +#include "CMMCScBkupStateArchiveOpPassiveData.h" + +// User includes +#include "MMCScBkupLogger.h" +#include "MMCScBkupSBEUtils.h" +#include "CMMCScBkupArchive.h" +#include "CMMCScBkupArchiveFooter.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "CMMCScBkupDataOwnerCollection.h" +#include "CMMCScBkupIndexWithIdentifier.h" +#include "MMMCScBkupArchiveDataInterface.h" + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPassiveData::CMMCScBkupStateArchiveOpPassiveData() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpPassiveData::CMMCScBkupStateArchiveOpPassiveData( MMMCScBkupDriver& aDriver ) +: CMMCScBkupStateOpAware( aDriver ), iIndexValueCurrent( -1 ) + { + __LOG1("CMMCScBkupStateArchiveOpPassiveData::CMMCScBkupStateArchiveOpPassiveData() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPassiveData::~CMMCScBkupStateArchiveOpPassiveData() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpPassiveData::~CMMCScBkupStateArchiveOpPassiveData() + { + Cancel(); + // + delete iBackupTransferObject; + delete iRestoreTransferObject; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPassiveData::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpPassiveData* CMMCScBkupStateArchiveOpPassiveData::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateArchiveOpPassiveData* self = new(ELeave) CMMCScBkupStateArchiveOpPassiveData( aDriver ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPassiveData::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpPassiveData::StateId() const + { + return KMMCScBkupStateIdArchiveOpPassiveData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPassiveData::NextStateBackupId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpPassiveData::NextStateBackupId( TBool /*aPartial*/ ) const + { + return KMMCScBkupStateIdArchiveOpDataOwners; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPassiveData::NextStateRestoreId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpPassiveData::NextStateRestoreId( TBool /*aPartial*/ ) const + { + return KMMCScBkupStateIdGetDataOwnerStatuses; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPassiveData::PerformStateInitBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPassiveData::PerformStateInitBackupL( TBool /*aPartial*/ ) + { + __DEBUG_TESTING_SKIP_BACKUP_PAS_DATA; + + iBackupTransferObject = CMMCScBkupWriteDataTransferRequest::NewL( + Driver(), + *this, + EMMCScBkupOwnerDataTypePassiveData, + ESIDTransferDerivedType, + Driver().DrvParamsBase().PassiveTransferType() + ); + CompleteSelf(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPassiveData::PerformStateInitRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPassiveData::PerformStateInitRestoreL( TBool /*aPartial*/ ) + { + __DEBUG_TESTING_SKIP_RESTORE_PAS_DATA; + + iRestoreTransferObject = CMMCScBkupReadDataTransferRequest< TTransferDataType >::NewL( + Driver(), + EMMCScBkupOwnerDataTypePassiveData, + Driver().DrvParamsBase().PassiveTransferType() + ); + + CompleteSelf(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousStateStepBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousStateStepBackupL( TBool /*aPartial*/ ) + { + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + const TInt count = dataOwners.Count(); + // + while ( ++iIndexValueCurrent < count ) + { + CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); + // + if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypePassiveData ) == EFalse ) + { + __LOG1("CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousStateStepBackupL() - trying to backup DO 0x%08x", owner.SecureId().iId ); + + // Request all the passive data (on all supported drives) for this + // particular data owner + __ASSERT_ALWAYS( iBackupTransferObject->IsActive() == EFalse, User::Invariant() ); + // + iBackupTransferObject->RequestL( owner, + iStatus, + Driver().DrvParamsBase().DriveAndOperations() ); + SetActive(); + break; // while loop + } + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousStateStepRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousStateStepRestoreL( TBool /*aPartial*/ ) + { + CMMCScBkupIndexBase& indexBase = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypePassiveData ); + CMMCScBkupIndexWithIdentifier< TSecureId>& index = static_cast< CMMCScBkupIndexWithIdentifier& >( indexBase ); + const TInt count = index.Count(); + // + if ( ++iIndexValueCurrent < count ) + { + const CMMCScBkupIndexEntry& entry = index.At( iIndexValueCurrent ); + const RArray& subEntries = entry.Entries(); + + // Get the associated data owner + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + CMMCScBkupDataOwnerInfo& owner = dataOwners.OwnerL( entry.Identifier() ); + + if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypePassiveData ) == EFalse ) + { + __LOG1("CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousStateStepRestoreL() - trying to restore DO 0x%08x", owner.SecureId().iId ); + + + // Request all the registration data (on all supported drives) for this + // particular data owner + __ASSERT_ALWAYS( iRestoreTransferObject->IsActive() == EFalse, User::Invariant() ); + // + __LOG1("CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousStateStepRestoreL() - trying to restore PASSIVE DATA for SID: 0x%08x", owner.SecureId().iId ); + // + iRestoreTransferObject->RequestL( owner, + iStatus, + subEntries ); + SetActive(); + } + else + { + CompleteSelf(); + } + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousErrorCleanupBackup() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousErrorCleanupBackup( TBool /*aPartial*/, TInt aError ) + { + (void) aError; + __LOG1("CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousErrorCleanupBackup() - **** - error: %d", aError ); + + // Reset state and move to next item. Treat the current (badly behaving) item + // as completed/processed. + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + if ( iIndexValueCurrent < dataOwners.Count() ) + { + CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); + owner.SetCompletionStatus( EMMCScBkupOwnerDataTypePassiveData, ETrue ); + + __LOGFILE1("CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousErrorCleanupBackup() - **** - PASSIVE data skipped for SID: 0x%08x", owner.SecureId().iId ); + } + + CompleteSelf(); + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousErrorCleanupRestore() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousErrorCleanupRestore( TBool /*aPartial*/, TInt aError ) + { + (void) aError; + __LOGFILE1("CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousErrorCleanupRestore() - **** - error: %d", aError ); + + CompleteSelf(); + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousCancellation() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPassiveData::PerformAsynchronousCancellation() + { + if (iBackupTransferObject) + { + iBackupTransferObject->Cancel(); + } + if (iRestoreTransferObject) + { + iRestoreTransferObject->Cancel(); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPassiveData::PerformLastRightsBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPassiveData::PerformLastRightsBackupL( TBool /*aPartial*/ ) + { + CMMCScBkupIndexBase& index = Driver().DrvArchive().Footer().IndexByType(EMMCScBkupOwnerDataTypePassiveData); + index.StoreL(Driver()); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPassiveData::AddIndexRecordL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPassiveData::AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ) + { + CMMCScBkupIndexBase& indexBase = aFooter.IndexByType( EMMCScBkupOwnerDataTypePassiveData ); + CMMCScBkupIndexWithIdentifier< TSecureId>& index = static_cast< CMMCScBkupIndexWithIdentifier< TSecureId>& >( indexBase ); + // + index.AddIndexRecordL( aInfo, aDrive, aDataOwner.SecureId() ); + __LOG3("CMMCScBkupStateArchiveOpPassiveData::AddIndexRecordL() - offset: %6d, length: %6d, secureId: 0x%08x", aInfo.Offset(), aInfo.Length(), aDataOwner.SecureId().iId ); + } + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpPublicDataFiles.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpPublicDataFiles.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,442 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupStateArchiveOpPublicDataFiles implementation +* +* +*/ + +#include "CMMCScBkupStateArchiveOpPublicDataFiles.h" + +// System includes +#include +#include +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "MMCScBkupConfig.h" +#include "CMMCScBkupArchive.h" +#include "CMMCScBkupArchiveFooter.h" +#include "CMMCScBkupIndexPublicDataFiles.h" +#include "MMMCScBkupArchiveDataInterface.h" +#include "CMMCScBkupFileInfo.h" +#include "CMMCScBkupFileListCollection.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "CMMCScBkupDataOwnerCollection.h" +#include "MMCScBkupOperations.h" + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::CMMCScBkupStateArchiveOpPublicDataFiles() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpPublicDataFiles::CMMCScBkupStateArchiveOpPublicDataFiles( MMMCScBkupDriver& aDriver ) +: CMMCScBkupStateOpAware( aDriver ), iIndexValueCurrent( -1 ) + { + __LOG1("CMMCScBkupStateArchiveOpPublicDataFiles::CMMCScBkupStateArchiveOpPublicDataFiles() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpPublicDataFiles* CMMCScBkupStateArchiveOpPublicDataFiles::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateArchiveOpPublicDataFiles* self = new(ELeave) CMMCScBkupStateArchiveOpPublicDataFiles( aDriver ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpPublicDataFiles::StateId() const + { + return KMMCScBkupStateIdArchiveOpPublicDataFiles; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::NextStateBackupId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpPublicDataFiles::NextStateBackupId( TBool /*aPartial*/ ) const + { + return KMMCScBkupStateIdArchiveOpSystemData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::NextStateRestoreId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpPublicDataFiles::NextStateRestoreId( TBool /*aPartial*/ ) const + { + return KMMCScBkupStateIdOperationComplete; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::PerformStateInitBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPublicDataFiles::PerformStateInitBackupL( TBool /*aPartial*/ ) + { + __DEBUG_TESTING_SKIP_BACKUP_PUB_DATA; + + CompleteSelf(); + SetState( EStateCommonKickOff ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::PerformStateInitRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPublicDataFiles::PerformStateInitRestoreL( TBool /*aPartial*/ ) + { + __DEBUG_TESTING_SKIP_RESTORE_PUB_DATA; + + CompleteSelf(); + SetState( EStateCommonKickOff ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousStateStepBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousStateStepBackupL( TBool /*aPartial*/ ) + { + const TState justFinishedExecutingState = State(); + // + switch( justFinishedExecutingState ) + { + case EStateCommonKickOff: + CompressingAndWritingFileL(); + break; + case EStateCommonProcessingFile: + AddIndexRecordL(); + break; + case EStateBackupAddIndexRecord: + SetState( EStateCommonKickOff ); + CompleteSelf(); + break; + default: + ASSERT( EFalse ); + break; + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousStateStepRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousStateStepRestoreL( TBool /*aPartial*/ ) + { + const TState justFinishedExecutingState = State(); + // + switch( justFinishedExecutingState ) + { + case EStateCommonKickOff: + DecompressingAndWritingFileL(); + break; + case EStateCommonProcessingFile: + RestoreFileAttributesL(); + break; + case EStateRestoreResetAttributes: + SetState( EStateCommonKickOff ); + CompleteSelf(); + break; + default: + ASSERT( EFalse ); + break; + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupBackup() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupBackup( TBool /*aPartial*/, TInt aError ) + { + (void) aError; + __LOG1("CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupBackup() - **** - error: %d", aError ); + TBool continueProcessing = ETrue; + + // Reset state and move to next item. Treat the current (badly behaving) item + // as completed/processed. + const CMMCScBkupFileListCollection& fileList = Driver().DrvFileList(); + if ( iIndexValueCurrent < fileList.Count() ) + { + const CMMCScBkupFileInfo& fileInfo = fileList.Entry(iIndexValueCurrent); + (void) fileInfo; + + __LOGFILE2("CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupBackup() - **** - error: %d, file: %S - public data skipped", aError, &fileInfo.FileName()); + + // Ensures that asynchronous state step is called again.. + CompleteSelf(); + SetState( EStateCommonKickOff ); + } + + return continueProcessing; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupRestore() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupRestore( TBool /*aPartial*/, TInt aError ) + { + (void) aError; + __LOG1("CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupRestore() - **** - error: %d", aError ); + TBool continueProcessing = ETrue; + + CMMCScBkupArchiveFooter& footer = Driver().DrvArchive().Footer(); + CMMCScBkupIndexPublicDataFiles& index = static_cast( footer.IndexByType( EMMCScBkupOwnerDataTypePublicData ) ); + const TInt count = index.Count(); + // + if ( iIndexValueCurrent < count ) + { + // Get the entry to restore + TMMCScBkupArchiveVector entryInfo; + const CMMCScBkupFileInfo& fileInfo = index.At( iIndexValueCurrent, entryInfo ); + (void) fileInfo; + + __LOGFILE2("CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousErrorCleanupRestore() - **** - error: %d, file: %S - public data skipped", aError, &fileInfo.FileName()); + + // Try to restore the next public file + //SetState( EStateCommonKickOff ); + SetState( EStateCommonProcessingFile ); + CompleteSelf(); + } + + return continueProcessing; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousCancellation() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPublicDataFiles::PerformAsynchronousCancellation() + { + switch( State() ) + { + case EStateCommonProcessingFile: + // Asynchronous request issued to ADI. + Driver().DrvADI().ADIAsynchronousCancel(); + break; + + case EStateCommonKickOff: + case EStateBackupAddIndexRecord: + case EStateRestoreResetAttributes: + // Other states complete this objects own request status => no action + // needed. + break; + + default: + case EStateCommonIdle: + ASSERT( EFalse ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::PerformLastRightsBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPublicDataFiles::PerformLastRightsBackupL( TBool /*aPartial*/ ) + { + CMMCScBkupIndexBase& index = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypePublicData ); + index.StoreL( Driver() ); + + Driver().DrvADI().ADIResetResources(EMMCScBkupOperationTypeFullBackup); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::PerformLastRightsRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPublicDataFiles::PerformLastRightsRestoreL( TBool /*aPartial*/ ) + { + Driver().DrvADI().ADIResetResources(EMMCScBkupOperationTypeFullRestore); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::CompressingAndWritingFileL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPublicDataFiles::CompressingAndWritingFileL() + { + const CMMCScBkupFileListCollection& fileList = Driver().DrvFileList(); + const TInt count = fileList.Count(); + // + if ( ++iIndexValueCurrent < count ) + { + const CMMCScBkupFileInfo& fileInfo = fileList.Entry(iIndexValueCurrent); + + __LOG1("CMMCScBkupStateArchiveOpPublicDataFiles::CompressingAndWritingFileL() - BACKUP - compressing file: %S", &fileInfo.FileName()); + + // Compress the file & externalise it to the archive + Driver().DrvADI().ADIWriteFileL( fileInfo.FileName(), iStatus ); + + // Indicate the state we are in + SetActive(); + SetState( EStateCommonProcessingFile ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::DecompressingAndWritingFileL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPublicDataFiles::DecompressingAndWritingFileL() + { + CMMCScBkupArchiveFooter& footer = Driver().DrvArchive().Footer(); + CMMCScBkupIndexPublicDataFiles& index = static_cast( footer.IndexByType( EMMCScBkupOwnerDataTypePublicData ) ); + const TInt count = index.Count(); + // + if ( ++iIndexValueCurrent < count ) + { + // Get the entry to restore + TMMCScBkupArchiveVector entryInfo; + const CMMCScBkupFileInfo& fileInfo = index.At( iIndexValueCurrent, entryInfo ); + + __LOG3("CMMCScBkupStateArchiveOpPublicDataFiles::DecompressingAndWritingFileL() - RESTORE - decompressing file: %S, offset: %8d, length: %8d", &fileInfo.FileName(), entryInfo.Offset(), entryInfo.Length()); + + // Restore it! + Driver().DrvADI().ADIReadFileL( fileInfo.FileName(), entryInfo, iStatus ); + + // Indicate the state we are in + SetActive(); + SetState( EStateCommonProcessingFile ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::AddIndexRecordL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPublicDataFiles::AddIndexRecordL() + { + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + CMMCScBkupArchiveFooter& footer = Driver().DrvArchive().Footer(); + CMMCScBkupIndexPublicDataFiles& index = static_cast(footer.IndexByType(EMMCScBkupOwnerDataTypePublicData)); + const CMMCScBkupFileListCollection& fileList = Driver().DrvFileList(); + const CMMCScBkupFileInfo& fileInfo = fileList.Entry(iIndexValueCurrent); + + // Save the offset of the data owner + const TMMCScBkupArchiveVector& info = Driver().DrvADI().ADICurrentArchiveVectorInfo(); + index.AddIndexRecordL( info, fileInfo ); + + // And update the file info so that we can know how much compressed + // data must be read during restore. This allows us to report accurate + // progress info. See CMMCScBkupStateRequestListOfPublicFiles::PerformLastRightsL() + // for the point when the public data size is zeroed. + + + + __LOG3("CMMCScBkupStateArchiveOpPublicDataFiles::AddIndexRecordL() - offset: %6d, length: %6d, file: %S", info.Offset(), info.Length(), &fileInfo.FileName()); + + // Indicate the state we are in + SetState( EStateBackupAddIndexRecord ); + CompleteSelf(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpPublicDataFiles::RestoreFileAttributesL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpPublicDataFiles::RestoreFileAttributesL() + { + RFs& fsSession = Driver().DrvADI().ADIFsSession(); + CMMCScBkupArchiveFooter& footer = Driver().DrvArchive().Footer(); + CMMCScBkupIndexPublicDataFiles& index = static_cast( footer.IndexByType( EMMCScBkupOwnerDataTypePublicData ) ); + + // Get the entry who's attributes need restoring + TMMCScBkupArchiveVector entryInfo; + const CMMCScBkupFileInfo& fileInfo = index.At( iIndexValueCurrent, entryInfo ); + + // If file is in Photo Album Thumbnail folder + // or file in videocenter folder and its subfolders + if ( fileInfo.FileName().MatchF( KMMCScBkupMediaGalleryThumbnailFolder ) != KErrNotFound ) + { + // Get folder path length + const TChar backslash('\\'); + const TInt pathlength = fileInfo.FileName().LocateReverseF( backslash ) + 1; + + // Set hidden attribute for Thumbnail folder. + // If folder does not exist, create it + fsSession.SetAtt( fileInfo.FileName().Left( pathlength ), KEntryAttHidden, KEntryAttNormal ); + } + + if ( fileInfo.FileName().MatchF( KMMCScBkupVideoCenterFolder ) != KErrNotFound) + { + // Get folder path length + const TChar backslash('\\'); + const TInt pathlength = fileInfo.FileName().LocateReverseF( backslash ) + 1; + + // Set hidden attribute for the video center's sub folder. + // If foler does not exist, create it + fsSession.SetAtt( fileInfo.FileName().Left( pathlength ), KEntryAttHidden, KEntryAttNormal ); + + //Manually set the videocenter main folder to be hidden + fsSession.SetAtt( KMMCScBkupVideoCenterFolderPath, KEntryAttHidden, KEntryAttNormal ); + } + // Set the original attributes, clear the others + const TInt error = fsSession.SetEntry( fileInfo.FileName(), + fileInfo.DateTime(), + fileInfo.Attributes(), + !fileInfo.Attributes() ); + + (void) error; + + + // Indicate the state we are in + SetState( EStateRestoreResetAttributes ); + CompleteSelf(); + } + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpSystemData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpSystemData.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,367 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupStateArchiveOpSystemData implementation +* +* +*/ + +#include "CMMCScBkupStateArchiveOpSystemData.h" + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupDataOwnerCollection.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "MMCScBkupSBEUtils.h" +#include "CMMCScBkupArchive.h" +#include "CMMCScBkupArchiveFooter.h" +#include "CMMCScBkupIndexWithIdentifier.h" +#include "MMMCScBkupArchiveDataInterface.h" + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::CMMCScBkupStateArchiveOpSystemData() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpSystemData::CMMCScBkupStateArchiveOpSystemData( MMMCScBkupDriver& aDriver ) +: CMMCScBkupStateOpAware( aDriver ), iIndexValueCurrent( -1 ) + { + __LOG1("CMMCScBkupStateArchiveOpSystemData::CMMCScBkupStateArchiveOpSystemData() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::~CMMCScBkupStateArchiveOpSystemData() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpSystemData::~CMMCScBkupStateArchiveOpSystemData() + { + Cancel(); + // + delete iBackupTransferObject; + delete iRestoreTransferObject; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateArchiveOpSystemData* CMMCScBkupStateArchiveOpSystemData::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateArchiveOpSystemData* self = new(ELeave) CMMCScBkupStateArchiveOpSystemData( aDriver ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpSystemData::StateId() const + { + return KMMCScBkupStateIdArchiveOpSystemData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::NextStateBackupId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpSystemData::NextStateBackupId( TBool /*aPartial*/ ) const + { + return KMMCScBkupStateIdArchiveOpJavaData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::NextStateRestoreId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateArchiveOpSystemData::NextStateRestoreId( TBool /*aPartial*/ ) const + { + return KMMCScBkupStateIdArchiveOpJavaData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::PerformStateInitBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpSystemData::PerformStateInitBackupL( TBool /*aPartial*/ ) + { + __DEBUG_TESTING_SKIP_BACKUP_SYS_DATA; + + iBackupTransferObject = CMMCScBkupWriteDataTransferRequest< TPackageDataType >::NewL( + Driver(), + *this, + EMMCScBkupOwnerDataTypeSystemData, + EPackageTransferDerivedType, + ESystemData + ); + CompleteSelf(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::PerformStateInitRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpSystemData::PerformStateInitRestoreL( TBool /*aPartial*/ ) + { + __LOG("CMMCScBkupStateArchiveOpSystemData::PerformStateInitRestoreL() - START" ); + __DEBUG_TESTING_SKIP_RESTORE_SYS_DATA; + + iRestoreTransferObject = CMMCScBkupReadDataTransferRequest< TPackageDataType >::NewL( + Driver(), + EMMCScBkupOwnerDataTypeSystemData, + ESystemData + ); + + CompleteSelf(); + __LOG("CMMCScBkupStateArchiveOpSystemData::PerformStateInitRestoreL() - END" ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepBackupL( TBool /*aPartial*/ ) + { + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + const TInt count = dataOwners.Count(); + // + while ( ++iIndexValueCurrent < count ) + { + CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); + // + if ( owner.CompletionStatus( EMMCScBkupOwnerDataTypeSystemData ) == EFalse ) + { + // Request all the system data (on all supported drives) for this + // particular data owner + __ASSERT_ALWAYS( iBackupTransferObject->IsActive() == EFalse, User::Invariant() ); + iBackupTransferObject->RequestL( owner, + iStatus, + Driver().DrvParamsBase().DriveAndOperations() ); + SetActive(); + break; // while loop + } + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepRestoreL( TBool /*aPartial*/ ) + { + CMMCScBkupIndexBase& indexBase = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeSystemData ); + CMMCScBkupIndexWithIdentifier< TInt32 >& index = static_cast< CMMCScBkupIndexWithIdentifier< TInt32 >& >( indexBase ); + const TInt count = index.Count(); + __LOG1("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepRestoreL() - START - %d data owners...", count ); + // + if ( ++iIndexValueCurrent < count ) + { + __LOG2("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepRestoreL() - getting system data index record [%03d/%03d]", iIndexValueCurrent + 1, count); + const CMMCScBkupIndexEntry< TInt32 >& entry = index.At( iIndexValueCurrent ); + iSecureId = entry.Identifier(); + + __LOG("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepRestoreL() - getting sub-entries for index record..."); + const RArray< TMMCScBkupArchiveDriveAndVector >& subEntries = entry.Entries(); + __LOG1("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousStateStepRestoreL() - got %d sub-entries for index record", subEntries.Count()); +#ifdef __MMCSCBKUPLOGGING_ENABLED__ + for(TInt i=0; iIsActive() == EFalse, User::Invariant() ); + + // Request all the system data (on all supported drives) for this + // particular data owner + iRestoreTransferObject->RequestL( owner, + iStatus, + subEntries ); + SetActive(); + } + else + { + CompleteSelf(); + } + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupBackup() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupBackup( TBool /*aPartial*/, TInt aError ) + { + (void) aError; + __LOG1("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupBackup() - error: %d", aError ); + + // Reset state and move to next item. Treat the current (badly behaving) item + // as completed/processed. + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + if ( iIndexValueCurrent < dataOwners.Count() ) + { + CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iIndexValueCurrent ); + owner.SetCompletionStatus( EMMCScBkupOwnerDataTypeSystemData, ETrue ); + + __LOGFILE2("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupBackup() - **** - error: %d, SID: 0x%08x - system data skipped for DO", aError, owner.SecureId().iId ); + } + + CompleteSelf(); + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupRestore() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupRestore( TBool /*aPartial*/, TInt aError ) + { + (void) aError; + __LOGFILE1("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupRestore() - **** - error: %d", aError ); + + // If system data restore phase returns "not supported", let's treat it as + // such an error, that other data types for this data owner are not + // allowed to restore either. + + if( aError == KErrNotSupported || aError == KErrAlreadyExists ) + { + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + CMMCScBkupDataOwnerInfo* owner = NULL; + TRAPD( err, owner = &dataOwners.OwnerL( iSecureId ) ); + if( err == KErrNone && owner ) + { + owner->SetCompletionStatus( EMMCScBkupOwnerDataTypeJavaData, ETrue ); + owner->SetCompletionStatus( EMMCScBkupOwnerDataTypePublicData, ETrue ); + owner->SetCompletionStatus( EMMCScBkupOwnerDataTypeSystemData, ETrue ); + owner->SetCompletionStatus( EMMCScBkupOwnerDataTypeActiveData, ETrue ); + owner->SetCompletionStatus( EMMCScBkupOwnerDataTypePassiveData, ETrue ); + + __LOGFILE2("CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousErrorCleanupRestore() - **** - error: %d, SID: 0x%08x - all data types skipped for DO", aError, owner->SecureId().iId ); + } + } + + CompleteSelf(); + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousCancellation() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpSystemData::PerformAsynchronousCancellation() + { + if (iBackupTransferObject) + { + iBackupTransferObject->Cancel(); + } + if (iRestoreTransferObject) + { + iRestoreTransferObject->Cancel(); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::PerformLastRightsBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpSystemData::PerformLastRightsBackupL( TBool /*aPartial*/ ) + { + CMMCScBkupIndexBase& index = Driver().DrvArchive().Footer().IndexByType( EMMCScBkupOwnerDataTypeSystemData ); + index.StoreL( Driver() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::PerformLastRightsRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpSystemData::PerformLastRightsRestoreL( TBool /*aPartial*/ ) + { + Driver().DrvSecureBackupClient().AllSystemFilesRestored(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateArchiveOpSystemData::AddIndexRecordL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateArchiveOpSystemData::AddIndexRecordL( CMMCScBkupArchiveFooter& aFooter, CMMCScBkupDataOwnerInfo& aDataOwner, const TMMCScBkupArchiveVector& aInfo, TDriveNumber aDrive ) + { + CMMCScBkupIndexBase& indexBase = aFooter.IndexByType( EMMCScBkupOwnerDataTypeSystemData ); + CMMCScBkupIndexWithIdentifier< TInt32 >& index = static_cast< CMMCScBkupIndexWithIdentifier< TInt32 >& >( indexBase ); + index.AddIndexRecordL( aInfo, aDrive, aDataOwner.SecureId().iId ); + } + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateFactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateFactory.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,332 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupStateFactory implementation +* +* +*/ + +#include "CMMCScBkupStateFactory.h" + +// System includes +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupStateGetDataOwners.h" +#include "CMMCScBkupStateSetPhoneMode.h" +#include "CMMCScBkupStateRequestSizeOfBackupData.h" +#include "CMMCScBkupStateRequestListOfPublicFiles.h" +#include "CMMCScBkupStateGetDataOwnerStatuses.h" +#include "CMMCScBkupStateNotifyAllSnapshotsSupplied.h" +// +#include "CMMCScBkupStateArchiveOpSystemData.h" +#include "CMMCScBkupStateArchiveOpDataOwners.h" +#include "CMMCScBkupStateArchiveOpPublicDataFiles.h" +#include "CMMCScBkupStateArchiveOpActiveData.h" +#include "CMMCScBkupStateArchiveOpJavaData.h" +#include "CMMCScBkupStateArchiveOpPassiveData.h" +#include "CMMCScBkupStateArchiveOpArchiveHeader.h" +#include "CMMCScBkupStateArchiveOpArchiveFooter.h" +#include "CMMCScBkupStateValidateDiskSpace.h" + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateFactory::CMMCScBkupStateFactory() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateFactory::CMMCScBkupStateFactory() + { + } + +// --------------------------------------------------------------------------- +// CMMCScBkupStateFactory::FactoryByOperationTypeLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateFactory* CMMCScBkupStateFactory::FactoryByOperationTypeLC( TMMCScBkupOperationType aOperationType ) + { + CMMCScBkupStateFactory* factory = NULL; + // + switch(aOperationType) + { + case EMMCScBkupOperationTypeFullBackup: + factory = CMMCScBkupStateFactoryBackup::NewL(); + break; + case EMMCScBkupOperationTypeFullRestore: + factory = CMMCScBkupStateFactoryRestore::NewL(); + break; + case EMMCScBkupOperationTypePartialBackup: + case EMMCScBkupOperationTypePartialRestore: + default: + __ASSERT_ALWAYS(EFalse, User::Invariant()); + break; + } + // + CleanupStack::PushL(factory); + return factory; + } + + + + + + + + + + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateFactoryBackup::CMMCScBkupStateFactoryBackup() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateFactoryBackup::CMMCScBkupStateFactoryBackup() + { + } + +// --------------------------------------------------------------------------- +// CMMCScBkupStateFactoryBackup::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateFactoryBackup* CMMCScBkupStateFactoryBackup::NewL() + { + CMMCScBkupStateFactoryBackup* self = new(ELeave) CMMCScBkupStateFactoryBackup(); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateFactoryBackup::GetStateLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupState* CMMCScBkupStateFactoryBackup::GetStateLC( TMMCScBkupStateId aRequiredType, MMMCScBkupDriver& aDriver ) + { + CMMCScBkupState* state = NULL; + // + switch(aRequiredType.iUid) + { + case KMMCScBkupStateIdValueArchiveOpArchiveHeader: + state = CMMCScBkupStateArchiveOpArchiveHeader::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueGetDataOwners: + state = CMMCScBkupStateGetDataOwners::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueSetPhoneMode: + state = CMMCScBkupStateSetPhoneMode::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueNotifyAllSnapshotsSupplied: + state = CMMCScBkupStateNotifyAllSnapshotsSupplied::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueRequestSizeOfBackupData: + state = CMMCScBkupStateRequestSizeOfBackupData::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueArchiveOpDataOwners: + state = CMMCScBkupStateArchiveOpDataOwners::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueRequestListOfPublicFiles: + state = CMMCScBkupStateRequestListOfPublicFiles::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueArchiveOpPublicDataFiles: + state = CMMCScBkupStateArchiveOpPublicDataFiles::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueArchiveOpSystemData: + state = CMMCScBkupStateArchiveOpSystemData::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueArchiveOpJavaData: + state = CMMCScBkupStateArchiveOpJavaData::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueGetDataOwnerStatuses: + state = CMMCScBkupStateGetDataOwnerStatuses::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueArchiveOpActiveData: + state = CMMCScBkupStateArchiveOpActiveData::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueArchiveOpPassiveData: + state = CMMCScBkupStateArchiveOpPassiveData::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueArchiveOpArchiveFooter: + state = CMMCScBkupStateArchiveOpArchiveFooter::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueValidateDiskSpace: + state = CMMCScBkupStateValidateDiskSpace::NewL( aDriver ); + break; + default: + case KMMCScBkupStateIdValueSupplyDataSnapshots: + ASSERT( EFalse ); + User::Leave(KErrNotSupported); + break; + } + // + CleanupStack::PushL(state); + return state; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateFactoryRestore::CMMCScBkupStateFactoryRestore() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateFactoryRestore::CMMCScBkupStateFactoryRestore() + { + } + +// --------------------------------------------------------------------------- +// CMMCScBkupStateFactoryRestore::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateFactoryRestore* CMMCScBkupStateFactoryRestore::NewL() + { + CMMCScBkupStateFactoryRestore* self = new(ELeave) CMMCScBkupStateFactoryRestore(); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateFactoryRestore::GetStateLC() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupState* CMMCScBkupStateFactoryRestore::GetStateLC( TMMCScBkupStateId aRequiredType, MMMCScBkupDriver& aDriver ) + { + CMMCScBkupState* state = NULL; + // + switch(aRequiredType.iUid) + { + case KMMCScBkupStateIdValueArchiveOpArchiveHeader: + state = CMMCScBkupStateArchiveOpArchiveHeader::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueArchiveOpArchiveFooter: + state = CMMCScBkupStateArchiveOpArchiveFooter::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueArchiveOpDataOwners: + state = CMMCScBkupStateArchiveOpDataOwners::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueSetPhoneMode: + state = CMMCScBkupStateSetPhoneMode::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueArchiveOpSystemData: + state = CMMCScBkupStateArchiveOpSystemData::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueNotifyAllSnapshotsSupplied: + state = CMMCScBkupStateNotifyAllSnapshotsSupplied::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueArchiveOpJavaData: + state = CMMCScBkupStateArchiveOpJavaData::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueArchiveOpPassiveData: + state = CMMCScBkupStateArchiveOpPassiveData::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueGetDataOwnerStatuses: + state = CMMCScBkupStateGetDataOwnerStatuses::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueArchiveOpActiveData: + state = CMMCScBkupStateArchiveOpActiveData::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueArchiveOpPublicDataFiles: + state = CMMCScBkupStateArchiveOpPublicDataFiles::NewL( aDriver ); + break; + case KMMCScBkupStateIdValueValidateDiskSpace: + state = CMMCScBkupStateValidateDiskSpace::NewL( aDriver ); + break; + default: + ASSERT( EFalse ); + User::Leave(KErrNotSupported); + break; + } + // + CleanupStack::PushL(state); + return state; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateGetDataOwnerStatuses.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateGetDataOwnerStatuses.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,194 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupStateGetDataOwnerStatuses implementation +* +* +*/ + +#include "CMMCScBkupStateGetDataOwnerStatuses.h" + +// System includes +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "CMMCScBkupDataOwnerCollection.h" + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::CMMCScBkupStateGetDataOwnerStatuses() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateGetDataOwnerStatuses::CMMCScBkupStateGetDataOwnerStatuses( MMMCScBkupDriver& aDriver ) +: CMMCScBkupState( aDriver ) + { + __LOG1("CMMCScBkupStateGetDataOwnerStatuses::CMMCScBkupStateGetDataOwnerStatuses() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::~CMMCScBkupStateGetDataOwnerStatuses() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateGetDataOwnerStatuses::~CMMCScBkupStateGetDataOwnerStatuses() + { + Cancel(); + // + iStatusArray.Close(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateGetDataOwnerStatuses* CMMCScBkupStateGetDataOwnerStatuses::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateGetDataOwnerStatuses* self = new(ELeave) CMMCScBkupStateGetDataOwnerStatuses( aDriver ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateGetDataOwnerStatuses::StateId() const + { + return KMMCScBkupStateIdGetDataOwnerStatuses; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::NextStateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateGetDataOwnerStatuses::NextStateId() const + { + return KMMCScBkupStateIdArchiveOpActiveData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::PerformStateInitL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateGetDataOwnerStatuses::PerformStateInitL() + { + SetState( EPrearingQuery ); + CompleteSelf(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::PerformAsynchronousStateStepL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateGetDataOwnerStatuses::PerformAsynchronousStateStepL() + { + switch( State() ) + { + case EPrearingQuery: + PrepareQueryL(); + break; + case EGettingStatus: + Driver().DrvSecureBackupClient().SIDStatusL( iStatusArray ); + SetState( EProcessingResults ); + CompleteSelf(); + break; + case EProcessingResults: + ProcessStatusResultsL(); + break; + default: + ASSERT( EFalse ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::PrepareQueryL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateGetDataOwnerStatuses::PrepareQueryL() + { + const TDataOwnerStatus KMMCScBkupDefaultOwnerStatus = EUnset; + const TInt KMMCScBkupDefaultOwnerStatusError = 0; + + // Build an array of all of the active data owners that we require + // the statuses for. + CMMCScBkupDataOwnerCollection& ownerCollection = Driver().DrvDataOwners(); + const TInt count = ownerCollection.Count(); + for(TInt i=0; iSetStatus( ownerStatus.iStatus ); + } + } + } + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateGetDataOwners.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateGetDataOwners.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,206 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupStateGetDataOwners implementation +* +* +*/ + +#include "CMMCScBkupStateGetDataOwners.h" + +#include +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupDataOwnerCollection.h" +#include "MMCScBkupSBEUtils.h" + +// Constants +const TInt KMMCScBkupDataOwnerGranularity = 20; + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwners::CMMCScBkupStateGetDataOwners() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateGetDataOwners::CMMCScBkupStateGetDataOwners( MMMCScBkupDriver& aDriver ) +: CMMCScBkupState( aDriver ) + { + __LOG1("CMMCScBkupStateGetDataOwners::CMMCScBkupStateGetDataOwners() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwners::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateGetDataOwners* CMMCScBkupStateGetDataOwners::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateGetDataOwners* self = new(ELeave) CMMCScBkupStateGetDataOwners( aDriver ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwners::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateGetDataOwners::StateId() const + { + return KMMCScBkupStateIdGetDataOwners; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwners::NextStateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateGetDataOwners::NextStateId() const + { + // This is the same for backup & restore + return KMMCScBkupStateIdSetPhoneMode; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwners::PerformStateInitL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateGetDataOwners::PerformStateInitL() + { + // Query asynchronously + CompleteSelf(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() + { + RMMCScBkupPointerArray dataOwners(KMMCScBkupDataOwnerGranularity); + CleanupClosePushL( dataOwners ); + + // Get data owner listing from secure backup engine + Driver().DrvSecureBackupClient().ListOfDataOwnersL(dataOwners); + + // Inform driver of result +#ifdef RD_FILE_MANAGER_BACKUP + RPointerArray& dataOwnerLists = Driver().DrvDataOwnersAll(); + TInt count = dataOwners.Count(); + + // Construct an info array to get introduced for every category + for(TInt i = count-1; i >= 0; i--) + { + // Ownership is immediately transferred to the backup owner info object + // so we should remove it from the array prior to passing into NewLC + conn::CDataOwnerInfo* sbDataOwner = dataOwners[i]; + + dataOwners.Remove( i ); // Ensures it won't be deleted twice + + const TSBDerivedType type = sbDataOwner->Identifier().DerivedTypeL(); + if ( type == EJavaDerivedType || type == EJavaTransferDerivedType ) + { + HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( sbDataOwner->Identifier() ); + __LOG1("CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() - Assigning java owner with hash %S for categories", + hash ); + CleanupStack::PopAndDestroy( hash ); + } + else + { + __LOG1("CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() - Assigning data owner 0x%08x for categories", + MMCScBkupSBEUtils::SecureIdFromGenericL( sbDataOwner->Identifier() ).iId ); + } + + // We have to create copy of original data owner for each category, so we have to externalize it + RPointerArray sbDataOwnerCopies(dataOwnerLists.Count()); + CleanupClosePushL( sbDataOwnerCopies ); + HBufC8* dataOwner = sbDataOwner->ExternaliseL(); + CleanupStack::PushL( dataOwner ); + // Delete original data owner instance + delete sbDataOwner; + + // Create copies for each category (even if they do not eventually end up to those lists) + for(TInt j = 0; j < dataOwnerLists.Count(); j++) + { + conn::CDataOwnerInfo* sbDataOwnerCopy = conn::CDataOwnerInfo::NewL(*dataOwner); + CleanupStack::PushL( sbDataOwnerCopy ); + sbDataOwnerCopies.AppendL(sbDataOwnerCopy); + CleanupStack::Pop( sbDataOwnerCopy ); + } + CleanupStack::PopAndDestroy( dataOwner ); + + // Loop through all lists and assign copied data owners there + for(TInt j = 0; j < dataOwnerLists.Count(); j++) + { + // Again we have to create instances for each category, + // because each has to have own copy of data owner + CMMCScBkupDataOwnerInfo* info = CMMCScBkupDataOwnerInfo::NewLC( sbDataOwnerCopies[j] ); + + if(dataOwnerLists[j]->AssignL( *info )) + { + CleanupStack::Pop( info ); + } + else + { + CleanupStack::PopAndDestroy( info ); + } + } + + CleanupStack::PopAndDestroy( &sbDataOwnerCopies ); + } + +#if defined(__MMCSCBKUPLOGGING_ENABLED__) + __LOG("CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() - Data owners per categories:"); + + for(TInt i = 0; i < dataOwnerLists.Count(); i++) + { + __LOG2("CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() - Category 0x%x contains %d data owners", + dataOwnerLists[i]->Category().iFlags, dataOwnerLists[i]->Count() ); + + for(TInt j = 0; j < dataOwnerLists[i]->Count(); j++) + { + CMMCScBkupDataOwnerInfo* entry = &dataOwnerLists[i]->Owner(j); + + const TSBDerivedType type = entry->Owner().Identifier().DerivedTypeL(); + if ( type == EJavaDerivedType || type == EJavaTransferDerivedType ) + { + HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( entry->Owner().Identifier() ); + __LOG1("CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() - java data owner with hash %S", + hash ); + CleanupStack::PopAndDestroy( hash ); + } + else + { + __LOG1("CMMCScBkupStateGetDataOwners::PerformAsynchronousStateStepL() - data owner 0x%08x", + MMCScBkupSBEUtils::SecureIdFromGenericL( entry->Owner().Identifier() ).iId ); + } + } + } +#endif + +#else // RD_FILE_MANAGER_BACKUP + Driver().DrvDataOwners().AssignL( dataOwners ); +#endif // RD_FILE_MANAGER_BACKUP + + CleanupStack::PopAndDestroy( &dataOwners ); + } diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateNotifyAllSnapshotsSupplied.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateNotifyAllSnapshotsSupplied.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupStateNotifyAllSnapshotsSupplied implementation +* +* +*/ + +#include "CMMCScBkupStateNotifyAllSnapshotsSupplied.h" + +// System includes +#include + +// User includes +#include "MMCScBkupLogger.h" + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateNotifyAllSnapshotsSupplied::CMMCScBkupStateNotifyAllSnapshotsSupplied() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateNotifyAllSnapshotsSupplied::CMMCScBkupStateNotifyAllSnapshotsSupplied( MMMCScBkupDriver& aDriver ) +: CMMCScBkupState( aDriver ) + { + __LOG1("CMMCScBkupStateNotifyAllSnapshotsSupplied::CMMCScBkupStateNotifyAllSnapshotsSupplied() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateNotifyAllSnapshotsSupplied::NewL() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateNotifyAllSnapshotsSupplied* CMMCScBkupStateNotifyAllSnapshotsSupplied::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateNotifyAllSnapshotsSupplied* self = new(ELeave) CMMCScBkupStateNotifyAllSnapshotsSupplied( aDriver); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateNotifyAllSnapshotsSupplied::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateNotifyAllSnapshotsSupplied::StateId() const + { + return KMMCScBkupStateIdNotifyAllSnapshotsSupplied; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateNotifyAllSnapshotsSupplied::NextStateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateNotifyAllSnapshotsSupplied::NextStateId() const + { + TMMCScBkupStateId nextState = KMMCScBkupStateIdRequestSizeOfBackupData; + // + const TMMCScBkupOperationType type = Driver().DrvOperation(); + switch(type) + { + case EMMCScBkupOperationTypeFullBackup: + nextState = KMMCScBkupStateIdRequestSizeOfBackupData; + break; + case EMMCScBkupOperationTypeFullRestore: + nextState = KMMCScBkupStateIdArchiveOpSystemData; + break; + default: + ASSERT( EFalse ); + break; + } + // + return nextState; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateNotifyAllSnapshotsSupplied::PerformStateInitL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateNotifyAllSnapshotsSupplied::PerformStateInitL() + { + Driver().DrvSecureBackupClient().AllSnapshotsSuppliedL(); + } + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateOpAware.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateOpAware.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,275 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupStateOpAware implementation +* +* +*/ + +#include "CMMCScBkupStateOpAware.h" + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateOpAware::CMMCScBkupStateOpAware() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateOpAware::CMMCScBkupStateOpAware( MMMCScBkupDriver& aDriver, TInt aPriority ) +: CMMCScBkupState( aDriver, aPriority ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateOpAware::NextStateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateOpAware::NextStateId() const + { + TMMCScBkupStateId state = KMMCScBkupStateIdOperationComplete; + // + const TMMCScBkupOperationType type = Driver().DrvOperation(); + switch(type) + { + case EMMCScBkupOperationTypeFullBackup: + case EMMCScBkupOperationTypePartialBackup: + state = NextStateBackupId( type == EMMCScBkupOperationTypePartialBackup ); + break; + case EMMCScBkupOperationTypeFullRestore: + case EMMCScBkupOperationTypePartialRestore: + state = NextStateRestoreId( type == EMMCScBkupOperationTypePartialRestore ); + break; + default: + ASSERT( EFalse ); + break; + } + // + return state; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateOpAware::PerformAsynchronousStateStepBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateOpAware::PerformAsynchronousStateStepBackupL( TBool /*aPartial*/ ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateOpAware::PerformAsynchronousStateStepRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateOpAware::PerformAsynchronousStateStepRestoreL( TBool /*aPartial*/ ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateOpAware::PerformAsynchronousCancellationBackup() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateOpAware::PerformAsynchronousCancellationBackup( TBool /*aPartial*/ ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateOpAware::PerformAsynchronousCancellationRestore() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateOpAware::PerformAsynchronousCancellationRestore( TBool /*aPartial*/ ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateOpAware::PerformLastRightsBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateOpAware::PerformLastRightsBackupL( TBool /*aPartial*/ ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateOpAware::PerformLastRightsRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateOpAware::PerformLastRightsRestoreL( TBool /*aPartial*/ ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateOpAware::PerformAsynchronousErrorCleanupBackup() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateOpAware::PerformAsynchronousErrorCleanupBackup( TBool /*aPartial*/, TInt /*aError*/ ) + { + return EFalse; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateOpAware::PerformAsynchronousErrorCleanupRestore() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateOpAware::PerformAsynchronousErrorCleanupRestore( TBool /*aPartial*/, TInt /*aError*/ ) + { + return EFalse; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateOpAware::PerformStateInitL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateOpAware::PerformStateInitL() + { + const TMMCScBkupOperationType type = Driver().DrvOperation(); + switch(type) + { + case EMMCScBkupOperationTypeFullBackup: + case EMMCScBkupOperationTypePartialBackup: + PerformStateInitBackupL( type == EMMCScBkupOperationTypePartialBackup ); + break; + case EMMCScBkupOperationTypeFullRestore: + case EMMCScBkupOperationTypePartialRestore: + PerformStateInitRestoreL( type == EMMCScBkupOperationTypePartialRestore ); + break; + default: + ASSERT( EFalse ); + break; + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateOpAware::PerformAsynchronousStateStepL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateOpAware::PerformAsynchronousStateStepL() + { + const TMMCScBkupOperationType type = Driver().DrvOperation(); + switch(type) + { + case EMMCScBkupOperationTypeFullBackup: + case EMMCScBkupOperationTypePartialBackup: + PerformAsynchronousStateStepBackupL( type == EMMCScBkupOperationTypePartialBackup ); + break; + case EMMCScBkupOperationTypeFullRestore: + case EMMCScBkupOperationTypePartialRestore: + PerformAsynchronousStateStepRestoreL( type == EMMCScBkupOperationTypePartialRestore ); + break; + default: + ASSERT( EFalse ); + break; + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateOpAware::PerformAsynchronousCancellation() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateOpAware::PerformAsynchronousCancellation() + { + const TMMCScBkupOperationType type = Driver().DrvOperation(); + switch(type) + { + case EMMCScBkupOperationTypeFullBackup: + case EMMCScBkupOperationTypePartialBackup: + PerformAsynchronousCancellationBackup( type == EMMCScBkupOperationTypePartialBackup ); + break; + case EMMCScBkupOperationTypeFullRestore: + case EMMCScBkupOperationTypePartialRestore: + PerformAsynchronousCancellationRestore( type == EMMCScBkupOperationTypePartialRestore ); + break; + default: + ASSERT( EFalse ); + break; + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateOpAware::PerformLastRightsL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateOpAware::PerformLastRightsL() + { + const TMMCScBkupOperationType type = Driver().DrvOperation(); + switch(type) + { + case EMMCScBkupOperationTypeFullBackup: + case EMMCScBkupOperationTypePartialBackup: + PerformLastRightsBackupL( type == EMMCScBkupOperationTypePartialBackup ); + break; + case EMMCScBkupOperationTypeFullRestore: + case EMMCScBkupOperationTypePartialRestore: + PerformLastRightsRestoreL( type == EMMCScBkupOperationTypePartialRestore ); + break; + default: + ASSERT( EFalse ); + break; + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateOpAware::PerformAsynchronousErrorCleanup() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateOpAware::PerformAsynchronousErrorCleanup( TInt aError ) + { + TBool handled = EFalse; + // + const TMMCScBkupOperationType type = Driver().DrvOperation(); + switch(type) + { + case EMMCScBkupOperationTypeFullBackup: + case EMMCScBkupOperationTypePartialBackup: + handled = PerformAsynchronousErrorCleanupBackup( type == EMMCScBkupOperationTypePartialBackup, aError ); + break; + case EMMCScBkupOperationTypeFullRestore: + case EMMCScBkupOperationTypePartialRestore: + handled = PerformAsynchronousErrorCleanupRestore( type == EMMCScBkupOperationTypePartialRestore, aError ); + break; + default: + ASSERT( EFalse ); + break; + } + // + return handled; + } + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateRequestListOfPublicFiles.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateRequestListOfPublicFiles.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,447 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupStateRequestListOfPublicFiles implementation +* +* +*/ + +#include "CMMCScBkupStateRequestListOfPublicFiles.h" + +// System includes +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "MMCScBkupSBEUtils.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "RMMCScBkupProgressSizer.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "MMMCScBkupProgressObserver.h" +#include "CMMCScBkupFileListCollection.h" +#include "CMMCScBkupDataOwnerCollection.h" + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestListOfPublicFiles::CMMCScBkupStateRequestListOfPublicFiles() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateRequestListOfPublicFiles::CMMCScBkupStateRequestListOfPublicFiles( MMMCScBkupDriver& aDriver ) +: CMMCScBkupState( aDriver ) + { + __LOG1("CMMCScBkupStateRequestListOfPublicFiles::CMMCScBkupStateRequestListOfPublicFiles() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestListOfPublicFiles::~CMMCScBkupStateRequestListOfPublicFiles() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateRequestListOfPublicFiles::~CMMCScBkupStateRequestListOfPublicFiles() + { + Cancel(); + // + delete iRequestObject; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestListOfPublicFiles::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateRequestListOfPublicFiles::ConstructL() + { + iRequestObject = CMMCScBkupStateRequestSpecificPublicFileInfo::NewL(Driver()); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestListOfPublicFiles::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateRequestListOfPublicFiles* CMMCScBkupStateRequestListOfPublicFiles::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateRequestListOfPublicFiles* self = new(ELeave) CMMCScBkupStateRequestListOfPublicFiles( aDriver ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestListOfPublicFiles::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateRequestListOfPublicFiles::StateId() const + { + return KMMCScBkupStateIdRequestListOfPublicFiles; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestListOfPublicFiles::NextStateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateRequestListOfPublicFiles::NextStateId() const + { + return KMMCScBkupStateIdValidateDiskSpace; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestListOfPublicFiles::PerformStateInitL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateRequestListOfPublicFiles::PerformStateInitL() + { + // Set to -1 so that the first time RunL is called, we start with + // the data owner at index 0. + iCurrentDataOwnerIndex = -1; + CompleteSelf(KErrNone); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousStateStepL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousStateStepL() + { + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + if (++iCurrentDataOwnerIndex < dataOwners.Count()) + { + CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner(iCurrentDataOwnerIndex); + + const TBool hasPublicFiles = (owner.Owner().PassiveSettings() & EHasPublicFiles); + if (hasPublicFiles) + { + // Request all the public files (on all supported drives) for this + // particular data owner + __ASSERT_ALWAYS(iRequestObject->IsActive() == EFalse, User::Invariant()); + // + iRequestObject->RequestL(owner, iStatus); + SetActive(); + } + else + { + // Try next data owner + CompleteSelf(); + } + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousErrorCleanup() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousErrorCleanup(TInt aError) + { + (void) aError; + __LOG1("CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousErrorCleanup() - **** - error: %d", aError ); + + // Cancel requester. Its probably already inactive, but just in case... + PerformAsynchronousCancellation(); + + // Reset state and move to next item. Treat the current (badly behaving) item + // as completed/processed. + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + if ( iCurrentDataOwnerIndex < dataOwners.Count() ) + { + CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iCurrentDataOwnerIndex ); + (void) owner; + __LOGFILE2("CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousErrorCleanup() - **** - error: %d, SID: 0x%08x - PUBLIC data skipped for DO", aError, owner.SecureId().iId ); + + // Ensures that asynchronous state step is called again.. + CompleteSelf(); + } + + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousCancellation() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateRequestListOfPublicFiles::PerformAsynchronousCancellation() + { + if ( iRequestObject ) + { + iRequestObject->Cancel(); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestListOfPublicFiles::PerformLastRightsL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateRequestListOfPublicFiles::PerformLastRightsL() + { + // Now we can calculate the progress + TInt64 totalProgressAmount = 0; + + // Calculate the total progress required for the entire backup operation + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + const TInt count = dataOwners.Count(); + // + RMMCScBkupProgressSizer sizer( Driver().DrvParamsBase().DriveAndOperations() ); + for(TInt i=0; i KMaxTInt ) + { + __LOG1("CMMCScBkupStateRequestListOfPublicFiles::PerformLastRightsL() - leaving with KErrNotSupported due amount of data (%Ld)", + Driver().DrvTotalProgress()); + Driver().DrvProgressHandler().MMCScBkupStartBackuping( EFalse ); + User::Leave( KErrNotSupported ); + } + else + { + Driver().DrvProgressHandler().MMCScBkupHandleProgressDomainUnderstood( Driver().DrvTotalProgress() ); + } + } + else + { + __LOG2("CMMCScBkupStateRequestListOfPublicFiles::PerformLastRightsL() - adding progress amount %Ld to existing %Ld)", + totalProgressAmount, Driver().DrvTotalProgress()); + + if( (totalProgressAmount + Driver().DrvTotalProgress()) > KMaxTInt ) + { + __LOG1("CMMCScBkupStateRequestListOfPublicFiles::PerformLastRightsL() - leaving due amount of data (%Ld)", + totalProgressAmount + Driver().DrvTotalProgress()); + User::Leave(KErrNotSupported); + } + else + { + Driver().DrvStoreTotalProgress( totalProgressAmount ); + } + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSpecificPublicFileInfo::CMMCScBkupStateRequestSpecificPublicFileInfo() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateRequestSpecificPublicFileInfo::CMMCScBkupStateRequestSpecificPublicFileInfo( MMMCScBkupDriver& aDriver ) +: CMMCScBkupDriveSpecificRequest( aDriver.DrvParamsBase().DriveAndOperations(), EMMCScBkupOwnerDataTypePublicData ), iDriver(aDriver) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSpecificPublicFileInfo::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateRequestSpecificPublicFileInfo* CMMCScBkupStateRequestSpecificPublicFileInfo::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateRequestSpecificPublicFileInfo* self = new (ELeave) CMMCScBkupStateRequestSpecificPublicFileInfo(aDriver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSpecificPublicFileInfo::RequestL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateRequestSpecificPublicFileInfo::RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver ) + { + iOwner = &aOwner; + CMMCScBkupDriveSpecificRequest::RequestL( aObserver ); + + // Start the asynchronous request. + CompleteSelf(KErrNone); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() + { + __LOG1("CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() - START - iStatus: %d", iStatus.Int()); + User::LeaveIfError(iStatus.Int()); + // + CDataOwnerInfo& owner = iOwner->Owner(); + const TDriveList& ownerDrives = owner.DriveList(); + TDriveNumber drive = EDriveA; + const TBool driveAvailable = NextValidDrive(drive, ownerDrives); + const TSecureId secureId = iOwner->SecureId(); + + __LOG3("CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() - secureId: 0x%08x, driveAvailable: %d, drive: %c", secureId.iId, driveAvailable, drive + 'A'); + + if (driveAvailable) + { + // This drive needs to be scanned... + TInt err( KErrNone ); + RFileArray files; + CleanupClosePushL(files); + + // Get a copy of the generic data type for which we are + // requesting file listings... + CSBGenericDataType* genericDataType = CSBSecureId::NewL( secureId ); + CleanupStack::PushL( genericDataType ); + TRAP( err, Driver().DrvSecureBackupClient().PublicFileListL( drive, *genericDataType, files ) ); + if( err != KErrNone && err != KErrNotFound ) + { + User::Leave( err ); + } + CleanupStack::PopAndDestroy( genericDataType ); + // Additionally we need to request list of public files registered for packages. + if( MMCScBkupSBEUtils::HasSystemDataL( owner ) ) + { + RFileArray pkgFiles; + CleanupClosePushL( pkgFiles ); + __LOG2("CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() - have %d files before package listing for DO, err %d", files.Count(), err); + TRAP( err, Driver().DrvSecureBackupClient().PublicFileListL( drive, owner.Identifier(), pkgFiles ) ); + __LOG2("CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() - have %d package files for DO, err %d", files.Count(), err); + const TInt pkgCount = pkgFiles.Count(); + for(TInt i = 0; i < pkgCount; i++) + { + files.AppendL( pkgFiles[i] ); + } + CleanupStack::PopAndDestroy( &pkgFiles ); + } + + // Add to the file list + __LOG1("CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() - have %d files for DO", files.Count()); + if (files.Count()) + { + + // We want to be told by the public file collection exactly which files + // it added... We need to do this in order to report progress as accurately + // as possible during the backup operation. + RArray< const CMMCScBkupFileInfo* > addedItems; + CleanupClosePushL(addedItems); + + // Add them to the public data file collection + Driver().DrvFileList().AppendL( files, addedItems, secureId ); + + // For each identified file, update the data owner with the size of public data + const TInt count = addedItems.Count(); + for(TInt i=0; iAddToOperationalSizeL( EMMCScBkupOwnerDataTypePublicData, drive, size ); + } + // + CleanupStack::PopAndDestroy( &addedItems ); + } + // + CleanupStack::PopAndDestroy( &files ); + + // Complete ourself to try the next drive + CompleteSelf( KErrNone ); + } + else + { + CompleteObserverRequest( KErrNone ); + } + + __LOG("CMMCScBkupStateRequestSpecificPublicFileInfo::RunL() - END"); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSpecificPublicFileInfo::DoCancel() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateRequestSpecificPublicFileInfo::DoCancel() + { + } + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateRequestSizeOfBackupData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateRequestSizeOfBackupData.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,515 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupStateRequestSizeOfBackupData implementation +* +* +*/ + +#include "CMMCScBkupStateRequestSizeOfBackupData.h" + +// System includes +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "MMCScBkupSBEUtils.h" +#include "TMMCScBkupOwnerDataType.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "MMMCScBkupProgressObserver.h" +#include "CMMCScBkupDataOwnerCollection.h" +#include "CMMCScBkupDriveAndOperationTypeManager.h" + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfBackupData::CMMCScBkupStateRequestSizeOfBackupData() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateRequestSizeOfBackupData::CMMCScBkupStateRequestSizeOfBackupData( MMMCScBkupDriver& aDriver ) +: CMMCScBkupState( aDriver ) + { + __LOG1("CMMCScBkupStateRequestSizeOfBackupData::CMMCScBkupStateRequestSizeOfBackupData() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfBackupData::~CMMCScBkupStateRequestSizeOfBackupData() +// +// C++ destructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateRequestSizeOfBackupData::~CMMCScBkupStateRequestSizeOfBackupData() + { + Cancel(); + // + delete iRequestObject; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfBackupData::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateRequestSizeOfBackupData::ConstructL() + { + iRequestObject = CMMCScBkupStateRequestSizeOfDataOwner::NewL( Driver() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfBackupData::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateRequestSizeOfBackupData* CMMCScBkupStateRequestSizeOfBackupData::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateRequestSizeOfBackupData* self = new(ELeave) CMMCScBkupStateRequestSizeOfBackupData( aDriver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfBackupData::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateRequestSizeOfBackupData::StateId() const + { + return KMMCScBkupStateIdRequestSizeOfBackupData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfBackupData::NextStateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateRequestSizeOfBackupData::NextStateId() const + { + return KMMCScBkupStateIdRequestListOfPublicFiles; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfBackupData::PerformStateInitL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateRequestSizeOfBackupData::PerformStateInitL() + { + // Set to -1 so that the first time RunL is called, we start with + // the data owner at index 0. + iCurrentDataOwnerIndex = -1; + CompleteSelf(KErrNone); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousStateStepL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousStateStepL() + { + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + const TInt count = dataOwners.Count(); + // + if ( ++iCurrentDataOwnerIndex < dataOwners.Count() ) + { + CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner(iCurrentDataOwnerIndex); + + // Request all the public files (on all supported drives) for this + // particular data owner + __ASSERT_ALWAYS(iRequestObject->IsActive() == EFalse, User::Invariant()); + // + __LOG3("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousStateStepL() - START - owner[%3d/%3d], sid: 0x%08x", iCurrentDataOwnerIndex, count, owner.SecureId().iId); + iRequestObject->RequestL(owner, iStatus); + SetActive(); + } + else + { + __LOG("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousStateStepL() - END"); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup( TInt aError ) + { + (void) aError; + __LOG1("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup() - **** - error: %d", aError ); + TBool continueProcessing = ETrue; + + // Cancel requester. Its probably already inactive, but just in case... + PerformAsynchronousCancellation(); + + // Reset state and move to next item. Treat the current (badly behaving) item + // as completed/processed. + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + if ( iCurrentDataOwnerIndex < dataOwners.Count() ) + { + CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( iCurrentDataOwnerIndex ); + + (void) owner; + __LOGFILE2("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup() - **** - error: %d, SID: 0x%08x - SIZE OF DATA skipped for DO", aError, owner.SecureId().iId ); + + // Ensures that asynchronous state step is called again.. + CompleteSelf(); + } + else + { + continueProcessing = EFalse; + } + // + __LOG1("CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousErrorCleanup() - END - continueProcessing: %d", continueProcessing ); + return continueProcessing; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousCancellation() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateRequestSizeOfBackupData::PerformAsynchronousCancellation() + { + if ( iRequestObject ) + { + iRequestObject->Cancel(); + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfDataOwner::CMMCScBkupStateRequestSizeOfDataOwner() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateRequestSizeOfDataOwner::CMMCScBkupStateRequestSizeOfDataOwner( MMMCScBkupDriver& aDriver ) +: CMMCScBkupDriveSpecificRequest( aDriver.DrvParamsBase().DriveAndOperations(), EMMCScBkupOwnerDataTypeAny ), iDriver(aDriver) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfDataOwner::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateRequestSizeOfDataOwner* CMMCScBkupStateRequestSizeOfDataOwner::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateRequestSizeOfDataOwner* self = new (ELeave) CMMCScBkupStateRequestSizeOfDataOwner(aDriver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfDataOwner::RequestL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateRequestSizeOfDataOwner::RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver ) + { + iOwner = &aOwner; + CMMCScBkupDriveSpecificRequest::RequestL( aObserver ); + + // Start the asynchronous request. + CompleteSelf(KErrNone); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfDataOwner::RunL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateRequestSizeOfDataOwner::RunL() + { + __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::RunL() - START - iStatus: %d, sid: 0x%08x", iStatus.Int(), iOwner->SecureId().iId); + + User::LeaveIfError(iStatus.Int()); + // + TDriveNumber drive = EDriveA; + const TDriveList& ownerDrives = iOwner->Owner().DriveList(); + const TBool driveAvailable = NextValidDrive(drive, ownerDrives); + // + if (driveAvailable) + { + CDataOwnerInfo& owner = iOwner->Owner(); + CSBGenericDataType& identifier = owner.Identifier(); + + // Size any active and passive data + GetActiveAndPassiveDataSizesL( owner, identifier, drive ); + + // Size any system package data + GetSystemDataSizesL( owner, identifier, drive ); + + // Size any java data + GetJavaDataSizesL( owner, identifier, drive ); + + // Complete ourself to try the next drive + CompleteSelf(KErrNone); + __LOG1("CMMCScBkupStateRequestSizeOfDataOwner::RunL() - END - sid: 0x%08x, checking next drive...", iOwner->SecureId().iId); + } + else + { + __LOG1("CMMCScBkupStateRequestSizeOfDataOwner::RunL() - END - sid: 0x%08x, last drive scanned => notifying observer", iOwner->SecureId().iId); + CompleteObserverRequest(KErrNone); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfDataOwner::DoCancel() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateRequestSizeOfDataOwner::DoCancel() + { + CompleteObserverRequest( KErrCancel ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfDataOwner::GetActiveAndPassiveDataSizesL() +// +// +// --------------------------------------------------------------------------- +TUint CMMCScBkupStateRequestSizeOfDataOwner::GetActiveAndPassiveDataSizesL( const CDataOwnerInfo& aOwner, + CSBGenericDataType& /*aIdentifier*/, TDriveNumber aDrive ) + { + // Passive Data + const TBool passiveBURSupported = MMCScBkupSBEUtils::HasPassiveDataL( aOwner ); + const TBool passiveDataTransferAllowedForDrive = DriveAndOperations().IsDataTypeAllowedToAccessDrive( aDrive, EMMCScBkupOwnerDataTypePassiveData ); + __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - passiveBURSupported: %d, passiveDataTransferAllowedForDrive: %d", passiveBURSupported, passiveDataTransferAllowedForDrive ); + + TUint ret = 0; + TUint itemSize = 0; + if ( passiveBURSupported && passiveDataTransferAllowedForDrive ) + { + const TSecureId secureId = iOwner->SecureId(); + const TTransferDataType type = Driver().DrvParamsBase().PassiveTransferType(); + __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - sid: 0x%08x claims PASSIVE Data... type: %d", iOwner->SecureId().iId, type); + + itemSize = GetSIDSpecificSizeL( secureId, aDrive, type ); + iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypePassiveData, aDrive, itemSize ); + ret += itemSize; + __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - sid: 0x%08x, passive size: %8d", secureId.iId, itemSize); + } + + // Active Data + const TBool activeBURSupported = MMCScBkupSBEUtils::HasActiveDataL( aOwner ); + const TBool activeDataTransferAllowedForDrive = DriveAndOperations().IsDataTypeAllowedToAccessDrive( aDrive, EMMCScBkupOwnerDataTypeActiveData ); + __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - activeBURSupported: %d, activeDataTransferAllowedForDrive: %d", activeBURSupported, activeDataTransferAllowedForDrive ); + + if ( activeBURSupported && activeDataTransferAllowedForDrive ) + { + const TSecureId secureId = iOwner->SecureId(); + const TTransferDataType type = Driver().DrvParamsBase().ActiveTransferType(); + __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - sid: 0x%08x claims ACTIVE Data... type: %d", iOwner->SecureId().iId, type); + + + // Technically, we should wait for an active data owner to become ready before we ask + // for its sizing information. If we don't wait, we might receive KErrNotReady back + // from our SBE request. + // + // Currently, the MMC engine doesn't actually make any use of the active data sizing + // info, so we trap (and ignore) the error in this situation. In the future, we will + // have to change the state machine in order to request the active data statuses + // before the sizing can be requested. + itemSize = 0; + TRAPD(err, GetSIDSpecificSizeL( secureId, aDrive, type )); + __LOG3("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - sid: 0x%08x, active size: %8d, fetchError: %d", secureId.iId, itemSize, err); + + if ( err == KErrNone || err == KErrNotReady ) + { + err = KErrNone; + } + else + { + User::LeaveIfError( err ); + } + + iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypeActiveData, aDrive, itemSize ); + ret += itemSize; + __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSizesL() - sid: 0x%08x, active size: %8d", secureId.iId, itemSize); + } + + return ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSpecificSizeL() +// +// +// --------------------------------------------------------------------------- +TUint CMMCScBkupStateRequestSizeOfDataOwner::GetSIDSpecificSizeL( TSecureId aSecureID, TDriveNumber aDrive, TTransferDataType aDataType ) + { + CSBSIDTransferType* transferType = CSBSIDTransferType::NewL( aSecureID, + aDrive, + aDataType + ); + CleanupStack::PushL( transferType ); + const TUint size = Driver().DrvSecureBackupClient().ExpectedDataSizeL( *transferType ); + CleanupStack::PopAndDestroy( transferType ); + return size; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL() +// +// +// --------------------------------------------------------------------------- +TUint CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL( const CDataOwnerInfo& aOwner, CSBGenericDataType& aIdentifier, TDriveNumber aDrive ) + { + TUint size = 0; + // + const TBool systemBURSupported = MMCScBkupSBEUtils::HasSystemDataL( aOwner ); + const TBool systemDataTransferAllowedForDrive = DriveAndOperations().IsDataTypeAllowedToAccessDrive( aDrive, EMMCScBkupOwnerDataTypeSystemData ); + __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL() - systemBURSupported: %d, systemDataTransferAllowedForDrive: %d", systemBURSupported, systemDataTransferAllowedForDrive ); + + if ( systemBURSupported && systemDataTransferAllowedForDrive ) + { + __LOG1("CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL() - sid: 0x%08x claims SYSTEM Data...", iOwner->SecureId().iId); + + // Again we have to create a temporary in order to actually retrieve the info... + CSBPackageId* packageGeneric = static_cast( MMCScBkupSBEUtils::CopyLC( aIdentifier ) ); + const TUid packageId = packageGeneric->PackageIdL(); + // + const TPackageDataType type = Driver().DrvParamsBase().PackageTransferType(); + CSBPackageTransferType* transferType = CSBPackageTransferType::NewL( packageId, + aDrive, + type + ); + CleanupStack::PushL( transferType ); + size = Driver().DrvSecureBackupClient().ExpectedDataSizeL( *transferType ); + __LOG3("CMMCScBkupStateRequestSizeOfDataOwner::GetSystemDataSizesL() - packageId: 0x%08x, sid: 0x%08x, package size: %8d", packageId.iUid, iOwner->SecureId().iId, size); + CleanupStack::PopAndDestroy( transferType ); + // + iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypeSystemData, aDrive, size ); + CleanupStack::PopAndDestroy( packageGeneric ); + } + + return size; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfDataOwner::GetJavaDataSizesL() +// +// +// --------------------------------------------------------------------------- +TUint CMMCScBkupStateRequestSizeOfDataOwner::GetJavaDataSizesL( const CDataOwnerInfo& aOwner, CSBGenericDataType& aIdentifier, TDriveNumber aDrive ) + { + TUint size = 0; + // + const TBool javaBURSupported = MMCScBkupSBEUtils::HasJavaDataL( aOwner ); + const TBool javaDataTransferAllowedForDrive = DriveAndOperations().IsDataTypeAllowedToAccessDrive( aDrive, EMMCScBkupOwnerDataTypeJavaData ); + __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSizesL() - javaBURSupported: %d, javaDataTransferAllowedForDrive: %d", javaBURSupported, javaDataTransferAllowedForDrive ); + + if ( javaBURSupported && javaDataTransferAllowedForDrive ) + { + // Again we have to create a temporary in order to actually retrieve the info... + CSBJavaId* packageGeneric = static_cast(MMCScBkupSBEUtils::CopyLC( aIdentifier )); + const TPtrC pHash(packageGeneric->SuiteHashL()); + __LOG1("CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSizesL() - midlet hash: %S", &pHash ); + + const TUint midletSize = GetJavaSpecificSizeL( pHash, aDrive, EJavaMIDlet); + __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSizesL() - EJavaMIDlet, sid: 0x%08x, size: %8d", iOwner->SecureId().iId, midletSize); + + const TUint midletDataSize = GetJavaSpecificSizeL( pHash, aDrive, EJavaMIDletData); + __LOG2("CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSizesL() - EJavaMIDletData, sid: 0x%08x, size: %8d", iOwner->SecureId().iId, midletDataSize); + + // We put the midlet itself in the special 'java data' category (the 'system data' equivalent for + // java midlets). + iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypeJavaData, aDrive, midletSize ); + + // We put the midlet's data (e.g. any data files that it created) inside + // the 'passive data' bucket. + iOwner->AddToOperationalSizeL( EMMCScBkupOwnerDataTypePassiveData, aDrive, midletDataSize ); + + // Java abuses the passive data slot. We would've initially set passive data's completion status + // to ETrue inside CMMCScBkupDataOwnerInfo::ConstructL() as a result of receiving a Java + // transfer type... but we can reset it back to "not yet completed" if the midlet + // does indeed have some 'passive data'. + iOwner->SetCompletionStatus( EMMCScBkupOwnerDataTypePassiveData, ( midletDataSize == 0 ) ); + + CleanupStack::PopAndDestroy( packageGeneric ); + // + size = midletSize + midletDataSize; + } + + return size; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSpecificSizeL() +// +// +// --------------------------------------------------------------------------- +TUint CMMCScBkupStateRequestSizeOfDataOwner::GetJavaSpecificSizeL( const TDesC& aHash, TDriveNumber aDrive, TJavaTransferType aDataType ) + { + CSBJavaTransferType* transferType = CSBJavaTransferType::NewL( aHash, + aDrive, + aDataType + ); + CleanupStack::PushL( transferType ); + const TUint size = Driver().DrvSecureBackupClient().ExpectedDataSizeL( *transferType ); + CleanupStack::PopAndDestroy( transferType ); + return size; + } diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateSetPhoneMode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateSetPhoneMode.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupStateSetPhoneMode implementation +* +* +*/ + +#include "CMMCScBkupStateSetPhoneMode.h" + +// System includes +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupDriveAndOperationTypeManager.h" + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateSetPhoneMode::CMMCScBkupStateSetPhoneMode() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateSetPhoneMode::CMMCScBkupStateSetPhoneMode( MMMCScBkupDriver& aDriver ) +: CMMCScBkupState( aDriver ) + { + __LOG1("CMMCScBkupStateSetPhoneMode::CMMCScBkupStateSetPhoneMode() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateSetPhoneMode::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateSetPhoneMode* CMMCScBkupStateSetPhoneMode::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateSetPhoneMode* self = new(ELeave) CMMCScBkupStateSetPhoneMode( aDriver); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateSetPhoneMode::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateSetPhoneMode::StateId() const + { + return KMMCScBkupStateIdSetPhoneMode; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateSetPhoneMode::NextStateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateSetPhoneMode::NextStateId() const + { + TMMCScBkupStateId nextState = KMMCScBkupStateIdNotifyAllSnapshotsSupplied; + // + const TMMCScBkupOperationType type = Driver().DrvOperation(); + switch(type) + { + case EMMCScBkupOperationTypeFullBackup: + nextState = KMMCScBkupStateIdNotifyAllSnapshotsSupplied; + break; + case EMMCScBkupOperationTypeFullRestore: + nextState = KMMCScBkupStateIdArchiveOpSystemData; + break; + default: + ASSERT( EFalse ); + break; + } + // + return nextState; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateSetPhoneMode::PerformStateInitL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateSetPhoneMode::PerformStateInitL() + { + __LOG("CMMCScBkupStateSetPhoneMode::PerformStateInitL()" ); + // + const CMMCScBkupOpParamsBase& params = Driver().DrvParamsBase(); + // + Driver().DrvSecureBackupClient().SetBURModeL( params.DriveAndOperations().DriveList(), + params.PartType(), + params.IncrementType(), + iStatus ); + SetActive(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateSetPhoneMode::PerformAsynchronousStateStepL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateSetPhoneMode::PerformAsynchronousStateStepL() + { + __LOG("CMMCScBkupStateSetPhoneMode::PerformAsynchronousStateStepL()" ); + } + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupStateValidateDiskSpace.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateValidateDiskSpace.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,393 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CMMCScBkupStateValidateDiskSpace implementation +* +* +*/ + +#include "CMMCScBkupStateValidateDiskSpace.h" + +// System includes +#include +#include +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupFileInfo.h" +#include "CMMCScBkupArchive.h" +#include "CMMCScBkupArchiveFooter.h" +#include "CMMCScBkupArchiveHeader.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "RMMCScBkupProgressSizer.h" +#include "MMMCScBkupProgressObserver.h" +#include "CMMCScBkupFileListCollection.h" +#include "CMMCScBkupDataOwnerCollection.h" +#include "CMMCScBkupIndexPublicDataFiles.h" +#include "CMMCScBkupDataStrategies.h" +#include "MMCScBkupSBEUtils.h" + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateValidateDiskSpace::~CMMCScBkupStateValidateDiskSpace() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateValidateDiskSpace::~CMMCScBkupStateValidateDiskSpace() + { + iDriveSizes.Close(); + iDriveMaxFileSizes.Close(); + } + +// --------------------------------------------------------------------------- +// CMMCScBkupStateValidateDiskSpace::CMMCScBkupStateValidateDiskSpace() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateValidateDiskSpace::CMMCScBkupStateValidateDiskSpace( MMMCScBkupDriver& aDriver ) +: CMMCScBkupState( aDriver ), iCumulatedSize(0) + { + __LOG1("CMMCScBkupStateValidateDiskSpace::CMMCScBkupStateValidateDiskSpace() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateValidateDiskSpace::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateValidateDiskSpace* CMMCScBkupStateValidateDiskSpace::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateValidateDiskSpace* self = new(ELeave) CMMCScBkupStateValidateDiskSpace( aDriver ); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CMMCScBkupStateValidateDiskSpace::ConstructL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateValidateDiskSpace::ConstructL( ) + { + for( TInt i = EDriveA; i<=EDriveZ; i++ ) + { + const TDriveNumber drive = static_cast< TDriveNumber >( i ); + + // Zero-initialize max. file sizing info arrays + TMMCScBkupDriveAndSize newEntry( drive, 0 ); + iDriveSizes.AppendL( newEntry ); + TMMCScBkupDriveAndSize maxEntry( drive, 0 ); + iDriveMaxFileSizes.AppendL( maxEntry ); + } + } + +// --------------------------------------------------------------------------- +// CMMCScBkupStateValidateDiskSpace::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateValidateDiskSpace::StateId() const + { + return KMMCScBkupStateIdValidateDiskSpace; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateValidateDiskSpace::NextStateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateValidateDiskSpace::NextStateId() const + { + TMMCScBkupStateId nextState = KMMCScBkupStateIdOperationComplete; + // + const TMMCScBkupOperationType type = Driver().DrvOperation(); + switch(type) + { + case EMMCScBkupOperationTypeFullBackup: + nextState = KMMCScBkupStateIdArchiveOpPublicDataFiles; + break; + case EMMCScBkupOperationTypeFullRestore: + nextState = KMMCScBkupStateIdSetPhoneMode; + break; + default: + ASSERT( EFalse ); + break; + } + // + return nextState; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateValidateDiskSpace::PerformStateInitL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateValidateDiskSpace::PerformStateInitL() + { + CompleteSelf(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateValidateDiskSpace::PerformAsynchronousStateStepL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateValidateDiskSpace::PerformAsynchronousStateStepL() + { + const TMMCScBkupOperationType type = Driver().DrvOperation(); + + switch(type) + { + case EMMCScBkupOperationTypeFullBackup: + { + ValidateFreeSpaceBeforeBackupL(); + break; + } + case EMMCScBkupOperationTypeFullRestore: + { + ValidateFreeSpaceBeforeRestoreL(); + break; + } + default: + User::Leave(KErrNotSupported); + break; + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() + { + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + TInt64 uncompressedSize; + + __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - START"); + + // Calculate the total progress required for the entire backup operation + uncompressedSize = dataOwners.TotalOperationalSizeL(); + __LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - Total estimated uncompressed size for archive %Ld", uncompressedSize); + //const TInt ownerCount = dataOwners.Count(); + + //for( TInt i=0; i volInfo.iFree) + { + percentFree = TInt( (volInfo.iFree * 100 ) / iCumulatedSize ); // accurate enough, no rounding + } + + err = Driver().DrvProgressHandler().MMCScBkupHandleFreeSpace( percentFree ); + if( err != KErrNone ) + { + // Error indicates backup creation no more allowed + Driver().DrvProgressHandler().MMCScBkupStartBackuping( EFalse ); + User::Leave( err ); + } + else + { + Driver().DrvProgressHandler().MMCScBkupStartBackuping( ETrue ); + } + } + else + { + __LOG3("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - Cumulated size now %Ld, free size on drive %c is %Ld", + iCumulatedSize, driveNumber + 'A', volInfo.iFree); + } + } + else + { + __LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - Volume info error %d", err); + } + } + + __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - END"); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() + { + CMMCScBkupArchiveFooter& footer = Driver().DrvArchive().Footer(); + CMMCScBkupIndexPublicDataFiles& index = static_cast( footer.IndexByType( EMMCScBkupOwnerDataTypePublicData ) ); + CMMCScBkupDataOwnerCollection& dataOwners = Driver().DrvDataOwners(); + CMMCScBkupFileListCollection& fileList = Driver().DrvFileList(); + TInt indexValueCurrent(0); + + __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - START"); + + const TInt ownerCount = dataOwners.Count(); + + // We can only make a direct comparison for public data + for( TInt i=0; i( i ); + + const TInt64 size = owner.OperationalSize( EMMCScBkupOwnerDataTypePublicData, drive ); + TMMCScBkupDriveAndSize& entry = iDriveSizes[ drive ]; + entry.SetSize(entry.Size() + size); + __LOG4("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - DO: 0x%08x has %Ld bytes for drive %c (total %Ld)", + owner.SecureId().iId, size, entry.Drive() + 'A', entry.Size()); + } + } + } + +#if defined(__MMCSCBKUPLOGGING_ENABLED__) + for( TInt i = EDriveA; i<=EDriveZ; i++ ) + { + TMMCScBkupDriveAndSize& entry = iDriveSizes[ i ]; + __LOG2("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Initially %Ld bytes required on drive %c", + entry.Size(), entry.Drive() + 'A'); + } +#endif + + const TInt count = index.Count(); + + __LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Public files to compare %d", count); + + // Check needed size by comparing archived public files to files in disk - decrease size if matching file found + while( ++indexValueCurrent < count ) + { + // Get the entry to restore + TMMCScBkupArchiveVector entryInfo; + //const CMMCScBkupFileInfo& fileInfo = index.At( indexValueCurrent, entryInfo ); + const CMMCScBkupFileInfo& fileInfo = fileList.Entry(indexValueCurrent); + const TDriveNumber drive = fileInfo.Drive(); + + __LOG2("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Archived file: %S, of size %d", &fileInfo.FileName(), fileInfo.Size()); + + // Check file (if any) size in disk + RFile64 restoreFile; + TInt64 fileSize = 0; + TInt error = restoreFile.Open(ADI().ADIFsSession(), fileInfo.FileName(), EFileShareReadersOnly | EFileRead); + if(error == KErrNone) + { + error = restoreFile.Size(fileSize); + if(error == KErrNone) + { + __LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Found matching file of size %d", fileInfo.Size()); + + // Take into account biggest file already on disk, because reserves that much space temporarily + if(iDriveMaxFileSizes[ drive ].Size() < fileSize && KMMCScBkupUseTempFile) + { + TMMCScBkupDriveAndSize& bigFile = iDriveMaxFileSizes[ drive ]; + bigFile.SetSize(fileSize); + } + } + else + { + fileSize = 0; + __LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Error % requesting file size", error); + } + + restoreFile.Close(); + } + + TMMCScBkupDriveAndSize& entry = iDriveSizes[ drive ]; + entry.SetSize(entry.Size() - fileSize); + + __LOG2("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - %Ld bytes required now on drive %c", entry.Size(), entry.Drive() + 'A'); + } + + __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - No estimation for private and system files"); + + if(Driver().DrvLastCategory()) + { + TVolumeInfo volInfo; + TInt spaceCheck(KErrNone); + + // Let user interrupt restore if necessary in future. Currently if any of drives cannot be restored, we interrupt restore. + for( TInt i = EDriveA; i<=EDriveZ; i++ ) + { + // Check whether data fits into this drive. + const TDriveNumber drive = static_cast< TDriveNumber >( i ); + + TInt err = ADI().ADIFsSession().Volume( volInfo, drive ); + if( err == KErrNone) + { + // Total compressed size. If this exceeds total size of drive, then restore does not succeed for sure. + const TInt64 size = dataOwners.DiskSpaceRequiredForRestore( drive ); + __LOG3("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - drive %c requires %Ld + %Ld for temporary file", + iDriveSizes[ drive ].Drive() + 'A', iDriveSizes[ drive ].Size(), iDriveMaxFileSizes[ drive ].Size()); + + if ( (( iDriveSizes[ drive ].Size() + iDriveMaxFileSizes[ drive ].Size() ) > volInfo.iFree ) || + ( size > volInfo.iSize ) ) + { + __LOG2("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Not enough space (%Ld) on drive %c", + TInt(volInfo.iFree), iDriveSizes[ drive ].Drive() + 'A'); + spaceCheck = KErrDiskFull; + break; + } + } + } + + User::LeaveIfError(spaceCheck); + } + else + { + __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - Checking next category..."); + } + + __LOG("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeRestoreL() - END"); + } + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupTransferReadRequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupTransferReadRequest.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,517 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupReadDataTransferRequestBase implementation +* +* +*/ + +#include "CMMCScBkupTransferReadRequest.h" + +// User includes +#include "MMCScBkupLogger.h" +#include "MMMCScBkupDriver.h" +#include "CMMCScBkupArchive.h" +#include "MMMCScBkupArchiveDataInterface.h" +#include "MMMCScBkupProgressObserver.h" +#include + +// Constants +const TBool KMMCScBkupDontUpdateOpSizes = EFalse; + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupReadDataTransferRequestBase::CMMCScBkupReadDataTransferRequestBase() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupReadDataTransferRequestBase::CMMCScBkupReadDataTransferRequestBase( + MMMCScBkupDriver& aDriver, + TMMCScBkupOwnerDataType aElementType, + TInt aChunkSize, + TInt aPriority ) +: CMMCScBkupTransferRequestBase( aDriver, aElementType, KMMCScBkupDontUpdateOpSizes, aPriority ), + iReadChunkSize( aChunkSize ), + iCurrentIndex( -1 ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupReadDataTransferRequestBase::~CMMCScBkupReadDataTransferRequestBase() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupReadDataTransferRequestBase::~CMMCScBkupReadDataTransferRequestBase() + { + delete iTransferType; + delete iTemporaryTransferSink; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupReadDataTransferRequestBase::RequestL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupReadDataTransferRequestBase::RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver, const RArray& aEntries ) + { +#ifdef __MMCSCBKUPLOGGING_ENABLED__ + if ( ElementType() == EMMCScBkupOwnerDataTypeJavaData ) + { + HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( aOwner.Owner().Identifier() ); + __LOG2("CMMCScBkupReadDataTransferRequestBase::RequestL() - START - reading data from SBE for JavaHash: %S, ElementType: %S", hash, &MMCScBkupLogger::DataType( ElementType() )); + CleanupStack::PopAndDestroy( hash ); + } + else + { + __LOG2("CMMCScBkupReadDataTransferRequestBase::RequestL() - START - reading data from SBE for DO: 0x%08x, ElementType: %S", aOwner.SecureId().iId, &MMCScBkupLogger::DataType( ElementType() )); + } +#endif + + CMMCScBkupTransferRequestBase::RequestL( aOwner, aObserver ); + // + if ( !iTemporaryTransferSink ) + { + iTemporaryTransferSink = HBufC8::NewL( iReadChunkSize ); + } + // + iEntries = &aEntries; + iCurrentIndex = -1; // Increased by one in PrepareForNextEntry + // + TState nextState = EProcessData; + const TBool entryAvailable = PrepareForNextEntry(); + if ( !entryAvailable ) + { + nextState = EFinished; + } + // + SetState( nextState ); + CompleteSelf(); + __LOG1("CMMCScBkupReadDataTransferRequestBase::RequestL() - END - nextState: %d", nextState); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupReadDataTransferRequestBase::ProcessChunkOfDataL() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupReadDataTransferRequestBase::ProcessChunkOfDataL() + { + __ASSERT_ALWAYS( iCurrentIndex >= 0, User::Invariant() ); + + TBool callAgain = EFalse; + + // Do we need to move to the next entry? + TBool entryAvailable = ( iCurrentIndex < iEntries->Count() ); + if ( entryAvailable ) + { + // At least one more entry left to process.. but have we finished + // the current entry? If we've read all the data, then the + // answer is yes... + const TMMCScBkupArchiveDriveAndVector& entry = (*iEntries)[ iCurrentIndex ]; + const TInt endOffset = entry.iVector.EndOffset(); + +#ifdef __MMCSCBKUPLOGGING_ENABLED__ + if ( ElementType() == EMMCScBkupOwnerDataTypeJavaData ) + { + HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( DataOwner().Owner().Identifier() ); + __LOG6("CMMCScBkupReadDataTransferRequestBase::ProcessChunkOfDataL() - START - JavaHash: %S, ElementType: %S, offset: %8d, length: %8d, endOffset: %8d, drive: %c:", hash, &MMCScBkupLogger::DataType( ElementType() ), entry.iVector.Offset(), entry.iVector.Length(), endOffset, entry.iDrive + 'A' ); + CleanupStack::PopAndDestroy( hash ); + } + else + { + __LOG6("CMMCScBkupReadDataTransferRequestBase::ProcessChunkOfDataL() - START - DO: 0x%08x, ElementType: %S, offset: %8d, length: %8d, endOffset: %8d, drive: %c:", DataOwner().SecureId().iId, &MMCScBkupLogger::DataType( ElementType() ), entry.iVector.Offset(), entry.iVector.Length(), endOffset, entry.iDrive + 'A' ); + } +#endif + + // Check bounds + if ( CurrentOffset() < 0 || CurrentOffset() > endOffset ) + { + ASSERT( EFalse ); + User::Leave( KErrCorrupt ); + } + // + if ( iCurrentOffset == endOffset ) + { + // We're done with this entry - move to the next + entryAvailable = PrepareForNextEntry(); + } + } + // + if ( entryAvailable ) + { + // We need to read more archive data in order to transfer this + // entry to the SBE + callAgain = DoProcessChunkOfDataL(); + } + else + { + // No more left to process - we're finished! + SetState( EFinished ); + CompleteSelf(); + } + // + return callAgain; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() + { + __ASSERT_ALWAYS(iTransferChunkPointer != NULL, User::Invariant()); + const CSBGenericDataType& generic = DataOwner().Owner().Identifier(); + + // Prepare the transfer type with a virtual function call... + CSBGenericTransferType* transferType = PrepareTransferTypeL( generic, CurrentDrive(), + DataOwner().Version()); + delete iTransferType; + iTransferType = transferType; + +#ifdef __MMCSCBKUPLOGGING_ENABLED__ + TInt lengthOfDataReadyForTransfer = 0; + if ( iTransferChunkPointer != NULL ) + { + lengthOfDataReadyForTransfer = iTransferChunkPointer->Length(); + } + + if ( iTransferType->DerivedTypeL() == EJavaTransferDerivedType ) + { + HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( DataOwner().Owner().Identifier() ); + __LOG5("CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() - supplying %d bytes of data for has: %S, drive: %c, iTransferChunkPointer addr: 0x%08x, iTransferChunkPointer length: %d", lengthOfDataReadyForTransfer, hash, 'A' + CurrentDrive(), iTransferChunkPointer->Ptr(), iTransferChunkPointer->Length() ); + CleanupStack::PopAndDestroy( hash ); + } + else + { + const TSecureId sid = DataOwner().SecureId(); + __LOG5("CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() - supplying %d bytes of data for sid: 0x%08x, drive: %c, iTransferChunkPointer addr: 0x%08x, iTransferChunkPointer length: %d", lengthOfDataReadyForTransfer, sid.iId, 'A' + CurrentDrive(), iTransferChunkPointer->Ptr(), iTransferChunkPointer->Length() ); + } +#endif + + // + Driver().DrvSecureBackupClient().SupplyDataL( *iTransferType, iFinishedSupplyingData, iStatus ); + SetActive(); + + // Reset + ResetDataTransferCounter(); + iTransferChunkPointer = NULL; // Address is retrieved from global chunk in DoProcessChunkOfDataL + + __LOG("CMMCScBkupReadDataTransferRequestBase::PrepareDataTransferL() - data transmitted, waiting for request completion..."); + + // When the SBE informs us that it has read the data, we'll need to send it the next + // chunk. + SetState( EProcessData ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupReadDataTransferRequestBase::ReadChunkL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupReadDataTransferRequestBase::ReadChunkL( TDes8& aSink, TInt aLength ) + { + const TInt endOffset = CurrentReadInfo().EndOffset(); + __LOG4("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - START - aLength: %d, endOffset: %d, iCurrentOffset: %d, sinkLength: %d", aLength, endOffset, iCurrentOffset, aSink.Length()); + // + if ( iCurrentOffset >= 0 && iCurrentOffset <= endOffset ) + { + if ( aLength > 0 ) + { + MMMCScBkupArchiveDataInterface& archiveDataInterface = Driver().DrvADI(); + + // We read based upon the current offset and the specified length + TPtr8 sink( iTemporaryTransferSink->Des() ); + const TMMCScBkupArchiveVector readRequest( iCurrentOffset, aLength ); + const TMMCScBkupArchiveVector& readResult = archiveDataInterface.ADIReadL( sink, readRequest ); + __LOG2("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - read result - offset: %d, length: %d", readResult.Offset(), readResult.Length()); + + // Update offset + iCurrentOffset += readResult.Length(); + aSink.Append( sink ); + __LOG2("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - new offset (iCurrentOffset): %d, sink Length: %d", iCurrentOffset, aSink.Length()); + +#ifdef DEBUGGING_DATA_TRANSFER + TRAP_IGNORE( DumpTransferDataL( archiveDataInterface.ADIFsSession(), sink) ); +#endif + + if ( iCurrentOffset > CurrentReadInfo().EndOffset() ) + { + __LOG("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - Fatal Error - read went beyond archive entry boundary!"); + ASSERT( EFalse ); + User::Leave( KErrCorrupt ); + } + else + { + __LOG("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - read was okay - updating stats & reporting progress..."); + + // We managed to read the data okay, so let's update our stats + DataTransferred( readResult.Length() ); + + // ... and also update progress + Driver().DrvProgressHandler().MMCScBkupHandleProgress( readResult.Length() ); + } + } + } + else + { + __LOG("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - Fatal Error - current offset out of bounds!"); + ASSERT( EFalse ); + User::Leave( KErrCorrupt ); + } + + __LOG("CMMCScBkupReadDataTransferRequestBase::ReadChunkL() - END"); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() + { + MMMCScBkupDriver& driver = Driver(); + const TInt startingOffset = CurrentOffset(); + const TInt finalOffset = CurrentReadInfo().EndOffset(); + + // Calculate how much data is remaining + const TInt amountOfDataStillToBeRead = finalOffset - startingOffset; + + __LOG4("CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() - START - startingOffset: 0x%08x, finalOffset: 0x%08x, amountToBeRead: %8d, iFinishedSupplyingData: %d", + startingOffset, finalOffset, amountOfDataStillToBeRead, iFinishedSupplyingData); + + // Get a handle to the received data - but only if we don't already + // have a handle to it! Calling this method resets whatever is already + // in the transfer chunk - hence we must only call it once (at the beginning + // of a multi-chunked transfer) + if ( iTransferChunkPointer == NULL ) + { + iTransferChunkPointer = &driver.DrvSecureBackupClient().TransferDataAddressL(); + } + + // How much space is available? + const TInt spaceAvailable = iTransferChunkPointer->MaxLength() - iTransferChunkPointer->Length(); + const TInt amountToRead = Min( spaceAvailable, Min( iReadChunkSize, amountOfDataStillToBeRead ) ); + __LOG2("CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() - xfer space available: %8d, amountToRead: %8d", spaceAvailable, amountToRead); + + // Do the read + ReadChunkL( *iTransferChunkPointer, amountToRead ); + + // Was this the last time we needed to perform a read? + const TBool lastReadFromArchive = ( CurrentOffset() == finalOffset ); + __LOG1("CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() - read data okay - lastReadFromArchive: %d", lastReadFromArchive); + + // Check to see if the data sink chunk is full. If so then we need to let + // the SBE process what we've prepared so far, then we'll fill it with more + // data. + iFinishedSupplyingData = lastReadFromArchive; + TBool moreToBeRead = !lastReadFromArchive; + if ( !iFinishedSupplyingData && iTransferChunkPointer->Length() == iTransferChunkPointer->MaxLength() ) + { + // Also cope with the boundary condition that the sink is full + // but we've also just given it the last byte anyway. In which case, + // we don't need to request a repeat transfer. This is actually + // all the data in one go. + moreToBeRead = EFalse; + } + // + __LOG1("CMMCScBkupReadDataTransferRequestBase::DoProcessChunkOfDataL() - END - more to read: %d", moreToBeRead); + return moreToBeRead; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupReadDataTransferRequestBase::PrepareForNextEntry() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupReadDataTransferRequestBase::PrepareForNextEntry() + { + TBool anotherEntryAvailable = EFalse; + + // Update our starting offset + iFinishedSupplyingData = EFalse; + iCurrentOffset = -1; + // + if ( ++iCurrentIndex < iEntries->Count() ) + { + const TMMCScBkupArchiveVector& currentReadInfo = CurrentReadInfo(); + iCurrentOffset = currentReadInfo.Offset(); + + __LOG3("CMMCScBkupReadDataTransferRequestBase::PrepareForNextEntry() - offset: %6d, length: %6d, drive: %c:", currentReadInfo.Offset(), currentReadInfo.Length(), 'A' + CurrentDrive() ); + + anotherEntryAvailable = ETrue; + } + // + return anotherEntryAvailable; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupReadDataTransferRequestBase::CurrentDrive() +// +// +// --------------------------------------------------------------------------- +TDriveNumber CMMCScBkupReadDataTransferRequestBase::CurrentDrive() const + { + return CurrentEntry().iDrive; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupReadDataTransferRequestBase::CurrentReadInfo() +// +// +// --------------------------------------------------------------------------- +const TMMCScBkupArchiveVector& CMMCScBkupReadDataTransferRequestBase::CurrentReadInfo() const + { + return CurrentEntry().iVector; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupReadDataTransferRequestBase::CurrentEntry() +// +// +// --------------------------------------------------------------------------- +const TMMCScBkupArchiveDriveAndVector& CMMCScBkupReadDataTransferRequestBase::CurrentEntry() const + { + __ASSERT_ALWAYS( iCurrentIndex >= 0 && iCurrentIndex < iEntries->Count(), User::Invariant() ); + + // Get the next entry + const TMMCScBkupArchiveDriveAndVector& entry = (*iEntries)[ iCurrentIndex ]; + return entry; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupReadDataTransferRequestBase::RunError() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupReadDataTransferRequestBase::RunError( TInt aError ) + { +#if defined(__MMCSCBKUPLOGGING_ENABLED__) + const TSecureId sid = DataOwner().SecureId(); + __LOGFILE3("CMMCScBkupReadDataTransferRequestBase::RunError() - **** - aError: %d, sid: 0x%08x, drive: %c", aError, sid.iId, 'A' + CurrentDrive() ); +#endif + + TInt ret = KErrNone; + + if ( aError == KErrNotFound ) + { + // KErrNotFound is treated as non-fatal. + const TBool entryAvailable = PrepareForNextEntry(); + + // Try the next entry (if any) + TState nextState = EProcessData; + if ( entryAvailable ) + { + __LOGFILE("CMMCScBkupReadDataTransferRequestBase::RunError() - **** - another drive available for same DO - trying the next drive..."); + nextState = EProcessData; + } + else + { + // Done + __LOGFILE("CMMCScBkupReadDataTransferRequestBase::RunError() - **** - no drives let for same DO..."); + nextState = EFinished; + } + + SetState( nextState ); + CompleteSelf(); + } + else + { + // Everything else is fatal + __LOGFILE1( "CMMCScBkupReadDataTransferRequestBase::RunError() - **** - FATAL ERROR (%d)", aError ); + ret = CMMCScBkupTransferRequestBase::RunError( aError ); + } + // + return ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupReadDataTransferRequestBase::DumpTransferDataL() +// +// +// --------------------------------------------------------------------------- +#ifdef DEBUGGING_DATA_TRANSFER +void CMMCScBkupReadDataTransferRequestBase::DumpTransferDataL( RFs& aFsSession, const TDesC8& aData ) const + { + TPtrC subDirectory( KNullDesC ); + // + switch( ElementType() ) + { + case EMMCScBkupOwnerDataTypeJavaData: + subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataJava); + break; + case EMMCScBkupOwnerDataTypeSystemData: + subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataSystem); + break; + case EMMCScBkupOwnerDataTypePassiveData: + subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataPassive); + break; + case EMMCScBkupOwnerDataTypeActiveData: + subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataActive); + break; + default: + User::Leave( KErrNotSupported ); + break; + } + // + const TSecureId secureId = DataOwner().SecureId(); + _LIT(KMMCScBkupFormatDes, "%S%S"); + TFileName transferDumpFileName; + const TDesC& path = PathInfo::MemoryCardRootPath(); + transferDumpFileName.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot); + + transferDumpFileName.Append( subDirectory ); + transferDumpFileName.Append( KMMCScBkupDataTransferDebuggingPathDataRestore ); + transferDumpFileName.AppendFormat( KMMCScBkupDataTransferDebuggingFileName, secureId.iId, 'a' + CurrentDrive() ); + // + RFile64 file; + TInt error = KErrNone; + TEntry entry; + if ( aFsSession.Entry( transferDumpFileName, entry ) == KErrNone ) + { + // Already exists - append data + error = file.Open( aFsSession, transferDumpFileName, EFileWrite | EFileStream | EFileShareExclusive ); + } + else + { + entry.iSize = 0; + error = file.Create( aFsSession, transferDumpFileName, EFileWrite | EFileStream | EFileShareExclusive ); + } + // + User::LeaveIfError( error ); + CleanupClosePushL( file ); + error = file.Write( entry.iSize, aData ); + CleanupStack::PopAndDestroy( &file ); + } +#endif + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupTransferRequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupTransferRequest.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,271 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupTransferRequestBase implementation +* +* +*/ + +#include "CMMCScBkupTransferRequest.h" + +// User includes +#include "MMCScBkupLogger.h" +#include "MMMCScBkupDriver.h" +#include "CMMCScBkupArchive.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "MMMCScBkupArchiveDataInterface.h" + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupTransferRequestBase::CMMCScBkupTransferRequestBase() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupTransferRequestBase::CMMCScBkupTransferRequestBase( MMMCScBkupDriver& aDriver, TMMCScBkupOwnerDataType aElementType, TBool aUpdateOperationalSizes, TInt aPriority ) +: CActive( aPriority ), iDriver( aDriver ), iElementType( aElementType ), iUpdateOperationalSizes( aUpdateOperationalSizes ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupTransferRequestBase::~CMMCScBkupTransferRequestBase() +// +// C++ destructor. +// --------------------------------------------------------------------------- +CMMCScBkupTransferRequestBase::~CMMCScBkupTransferRequestBase() + { + Cancel(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupTransferRequestBase::RequestL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupTransferRequestBase::RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver ) + { + __ASSERT_ALWAYS( !IsActive(), User::Invariant() ); + // + iDataOwner = &aOwner; + SetObserver( aObserver ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupTransferRequestBase::SingleDriveTransferCompleteL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupTransferRequestBase::SingleDriveTransferCompleteL() + { + if ( iUpdateOperationalSizes ) + { + const TDriveNumber drive = CurrentDrive(); + const TInt amount = AmountOfDataTransferred(); + __LOG3("CMMCScBkupTransferRequestBase::SingleDriveTransferCompleteL() - drive: %c:, amount: %8d, elementType: %S", drive + 'A', amount, &MMCScBkupLogger::DataType( ElementType() ) ); + // + ASSERT( drive >= EDriveA && drive <= EDriveZ ); + } + + ResetDataTransferCounter(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupTransferRequestBase::TransferCompleteL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupTransferRequestBase::TransferCompleteL() + { + DataOwner().SetCompletionStatus( iElementType, ETrue ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupTransferRequestBase::CompleteSelf() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupTransferRequestBase::CompleteSelf( TInt aCompletionCode ) + { + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, aCompletionCode); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupTransferRequestBase::SetObserver() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupTransferRequestBase::SetObserver( TRequestStatus& aObserver ) + { + __ASSERT_DEBUG( iObserver == NULL, User::Invariant() ); + iObserver = &aObserver; + aObserver = KRequestPending; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupTransferRequestBase::CompleteObserverRequest() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupTransferRequestBase::CompleteObserverRequest( TInt aCompletionCode ) + { + __LOG1("CMMCScBkupTransferRequestBase::CompleteObserverRequest() - aCompletionCode: %d", aCompletionCode); + __ASSERT_ALWAYS(iObserver != NULL, User::Invariant()); + User::RequestComplete(iObserver, aCompletionCode); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupTransferRequestBase::RunL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupTransferRequestBase::RunL() + { + __LOG2("CMMCScBkupTransferRequestBase::RunL() - START - iStatus: %d, iState: %d", iStatus.Int(), iState); + + User::LeaveIfError( iStatus.Int() ); + // + switch( State() ) + { + case ETransferData: + __LOG("CMMCScBkupTransferRequestBase::RunL() - ETransferData"); + PrepareDataTransferL(); + break; + + case EProcessData: + __LOG("CMMCScBkupTransferRequestBase::RunL() - EProcessData"); + ProcessDataChunkL(); + break; + + case EFinished: + // Inform any interested derived classes + __LOG("CMMCScBkupTransferRequestBase::RunL() - EFinished - transfer complete...."); + TransferCompleteL(); + + // Notify observer + __LOG("CMMCScBkupTransferRequestBase::RunL() - EFinished - complete observer..."); + CompleteObserverRequest( KErrNone ); + break; + + default: + case EIdle: + __LOG("CMMCScBkupTransferRequestBase::RunL() - EIdle - User::Invariant()"); + ASSERT( EFalse ); + break; + } + + __LOG2("CMMCScBkupTransferRequestBase::RunL() - END - iStatus: %d, iState: %d", iStatus.Int(), iState); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupTransferRequestBase::DoCancel() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupTransferRequestBase::DoCancel() + { + CompleteObserverRequest( KErrCancel ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupTransferRequestBase::RunError() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupTransferRequestBase::RunError( TInt aError ) + { + if ( aError != KErrNone ) + { + __LOGFILE1("CMMCScBkupTransferRequestBase::RunError() - **** - ERROR (%d) -> complete observer with error code", aError); + } + // + CompleteObserverRequest( aError ); + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupTransferRequestBase::ProcessDataChunkL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupTransferRequestBase::ProcessDataChunkL() + { + __LOG("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - START"); + + // Now call virtual function to do the processing + const TBool requiresMoreChunkProcessing = ProcessChunkOfDataL(); + __LOG1("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - requiresMoreChunkProcessing: %d", requiresMoreChunkProcessing); + // + TState nextState = EProcessData; + if ( !requiresMoreChunkProcessing ) + { + __LOG("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - did not require more processing... "); + SingleDriveTransferCompleteL(); + // + nextState = ETransferData; + __LOG("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - nextState is: ETransferData"); + } + else + { + __LOG("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - nextState is: EProcessData"); + } + + // Must check IsActive(), since CMMCScBkupReadDataTransferRequestBase::ProcessChunkOfDataL() + // changes state and set's active within the ProcessChunkOfDataL callback + if ( !IsActive() ) + { + __LOG("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - not active - completing self and changing state!"); + SetState( nextState ); + CompleteSelf(); + } + else + { + __LOG1("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - already active - state is: %d", State()); + } + + __LOG("CMMCScBkupTransferRequestBase::ProcessDataChunkL() - END"); + } + + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/CMMCScBkupTransferWriteRequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/CMMCScBkupTransferWriteRequest.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,491 @@ +/* +* Copyright (c) 2005 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: CMMCScBkupWriteDataTransferRequestBase implementation +* +* +*/ + +#include "CMMCScBkupTransferWriteRequest.h" + +// User includes +#include "MMCScBkupLogger.h" +#include "MMMCScBkupDriver.h" +#include "CMMCScBkupArchive.h" +#include "MMCScBkupSBEUtils.h" +#include "RMMCScBkupProgressSizer.h" +#include "MMMCScBkupProgressObserver.h" +#include "MMMCScBkupArchiveDataInterface.h" +#include "CMMCScBkupDriveAndOperationTypeManager.h" +#include + + + +#ifdef __MMCSCBKUP_DATA_LOGGING_ENABLED__ + +static void __DebugDump( const TDesC& aFmt, const TUint8* aAddress, const TUint8* aDisplayStartAddress, TInt aLength, TInt aMaxLength) + { + const TInt maxLen = aMaxLength; + TInt len = aLength; + const TUint8* pDataAddr = aAddress; + + TBuf<81> out; + TBuf<20> ascii; + TInt offset = 0; + const TUint8* a = pDataAddr; + const TUint8* displayAddress = aDisplayStartAddress; + // + while(len>0) + { + out.Zero(); + ascii.Zero(); + out.AppendNumFixedWidth((TUint) displayAddress, EHex, 8); + out.Append(_L(": ")); + + TUint b; + for (b=0; b<16; b++) + { + TUint8 c = ' '; + if ((pDataAddr + offset + b) < pDataAddr + maxLen) + { + c = *(pDataAddr + offset + b); + out.AppendNumFixedWidth(c, EHex, 2); + } + else + { + out.Append(_L(" ")); + } + out.Append(' '); + if (c<=0x20 || c>=0x7f || c=='%') + c=0x2e; + ascii.Append(TChar(c)); + } + out.Append(ascii); + out.ZeroTerminate(); + + RDebug::Print(aFmt, &out); + + displayAddress += 16; + a += 16; + offset += 16; + len -= 16; + } + } + +#endif + + + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupWriteDataTransferRequestBase::CMMCScBkupWriteDataTransferRequestBase() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupWriteDataTransferRequestBase::CMMCScBkupWriteDataTransferRequestBase( + MMMCScBkupDriver& aDriver, + MMMCScBkupIndexHandler& aIndexHandler, + TMMCScBkupOwnerDataType aElementType, + TSBDerivedType aExpectedTransferType, + TInt aPriority ) + +: CMMCScBkupTransferRequestBase( aDriver, aElementType, aPriority ), + iIndexHandler( aIndexHandler ), + iExpectedTransferType( aExpectedTransferType ) + { + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupWriteDataTransferRequestBase::~CMMCScBkupWriteDataTransferRequestBase() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupWriteDataTransferRequestBase::~CMMCScBkupWriteDataTransferRequestBase() + { + delete iTransferType; + if ( iStreamIsOpen ) + { + iStream.Close(); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupWriteDataTransferRequestBase::RequestL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupWriteDataTransferRequestBase::RequestL( CMMCScBkupDataOwnerInfo& aOwner, TRequestStatus& aObserver, const CMMCScBkupDriveAndOperationTypeManager& aDriveAndOperations ) + { +#ifdef __MMCSCBKUPLOGGING_ENABLED__ + if ( ElementType() == EMMCScBkupOwnerDataTypeJavaData ) + { + HBufC* hash = MMCScBkupSBEUtils::JavaHashFromGenericLC( aOwner.Owner().Identifier() ); + __LOG2("CMMCScBkupWriteDataTransferRequestBase::RequestL() - START - reading data from SBE for JavaHash: %S, ElementType: %S", hash, &MMCScBkupLogger::DataType( ElementType() )); + CleanupStack::PopAndDestroy( hash ); + } + else + { + __LOG2("CMMCScBkupWriteDataTransferRequestBase::RequestL() - START - reading data from SBE for DO: 0x%08x, ElementType: %S", aOwner.SecureId().iId, &MMCScBkupLogger::DataType( ElementType() )); + } +#endif + + iDriveAndOperations = &aDriveAndOperations; + CMMCScBkupTransferRequestBase::RequestL( aOwner, aObserver ); + // + iDriveFilter.Reset(); + iDriveFilter.SetPrimaryDriveFilter( iDriveAndOperations->DriveList() ); + iDriveFilter.SetSecondaryDriveFilter( aOwner.Owner().DriveList() ); + + // Set us going + SetState( ETransferData ); + CompleteSelf(); + __LOG("CMMCScBkupWriteDataTransferRequestBase::RequestL() - END"); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() +// +// +// --------------------------------------------------------------------------- +TBool CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() + { + MMMCScBkupDriver& driver = Driver(); + MMMCScBkupArchiveDataInterface& archiveDataInterface = driver.DrvADI(); + + // Get a handle to the received data + TBool finished = EFalse; + CSBGenericTransferType* receivedTransferInfo = NULL; + const TPtrC8& pData = driver.DrvSecureBackupClient().TransferDataInfoL( receivedTransferInfo, finished ); + iAdditionalTransferRequired = !finished; + + __LOG4("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - received: %d bytes from SBE for SID: 0x%08x, Drive: %c:, ElementType: %S", pData.Length(), DataOwner().SecureId().iId, 'A' + CurrentDrive(), &MMCScBkupLogger::DataType( ElementType() ) ); + + // Validate the data + CleanupStack::PushL( receivedTransferInfo ); + ValidateTransferInfoL( receivedTransferInfo ); + CleanupStack::PopAndDestroy( receivedTransferInfo ); + + // If we've never written any registration data before, then we must + // request a write stream at the current archive write pos... + if ( pData.Length() && !iStreamIsOpen ) + { + __LOG("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - stream isnt open - opening now..." ); + + iStream = archiveDataInterface.ADIWriteStreamUncompressedLC(); + CleanupStack::Pop(); // iWriteStream - gets closed in dtor in case of leave + iStreamIsOpen = ETrue; + } + + // Write the data - assumes stream already open if this is not the + // first time that we've received data for this drive... + // + // We don't use the externalisation operators, as we want to write + // only the data (no leading byte count etc). + if ( pData.Length() ) + { + __LOG1("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - got %d bytes of data...", pData.Length() ); + +#ifdef __MMCSCBKUP_DATA_LOGGING_ENABLED__ + _LIT(KDumpFormat, "SBEData - %S - "); + __DebugDump( KDumpFormat, pData.Ptr(), pData.Ptr(), pData.Length(), pData.Length() ); +#endif + + // Write the data to the stream + __LOG1("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - writing %d bytes to stream...", pData.Length() ); + iStream.WriteL(pData); + __LOG("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - data written OK"); + + // Update our stats. We overwrite any earlier estimate from the SBE + // with the actual values that we ultimately end up writing to the + // archive. This allows us to provide a more accurate restore progress + // experience. + DataTransferred( pData.Length() ); + +#ifdef DEBUGGING_DATA_TRANSFER + TRAP_IGNORE( DumpTransferDataL( archiveDataInterface.ADIFsSession(), pData ) ); +#endif + } + + // If we've received everything we can commit & close the stream + if ( finished ) + { + __LOG("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - finished..."); + + // Implicitly, if the stream is open then we have written some + // data to the archive. Therefore we only add an index record + // when the stream is open. + if ( iStreamIsOpen ) + { + __LOG("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - Committing stream..."); + iStream.CommitL(); + + __LOG("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - Closing stream..."); + iStream.Close(); + iStreamIsOpen = EFalse; + + // Must store the position, as we're going to also write an index at + // the end of this whole process. + __LOG("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - Adding index record..."); + CMMCScBkupArchiveFooter& footer = driver.DrvArchive().Footer(); + const TMMCScBkupArchiveVector& info = archiveDataInterface.ADICurrentArchiveVectorInfo(); + + // If we actually wrote something to the archive, then add an index record. + if (info.Length()) + { + iIndexHandler.AddIndexRecordL( footer, DataOwner(), info, CurrentDrive() ); + } + } + } + + // Not yet supporting chunked transfer + __LOG("CMMCScBkupWriteDataTransferRequestBase::ProcessChunkOfDataL() - END"); + return EFalse; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() + { + // If we must make a repeat transfer request, then we don't yet + // move to the next drive. + if ( iAdditionalTransferRequired ) + { + // Must ask for more of the same data, so no need + // to rebuild transfer info - we just reuse it + RequestDataTransferL(); + } + else + { + // Can move to the next drive + TDriveNumber drive = EDriveA; + const TBool driveAvailable = iDriveFilter.NextValidDrive( drive ); + __LOG1("CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() - current drive: %c", drive + 'A'); + __LOG1("CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() - driveAvailable: %d", driveAvailable); + + if ( driveAvailable ) + { + const TBool dataTransferAllowableForDrive = iDriveAndOperations->IsDataTypeAllowedToAccessDrive( drive, ElementType() ); + __LOG1("CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() - dataTransferAllowableForDrive: %d", dataTransferAllowableForDrive); + + if ( dataTransferAllowableForDrive ) + { + __LOG1("CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() - making transfer request for drive: %c", drive + 'A'); + + // Update the current drive + SetCurrentDrive( drive ); + + // Make virtual function call to make transfer object + const CSBGenericDataType& generic = DataOwner().Owner().Identifier(); + CSBGenericTransferType* transferType = PrepareTransferTypeL( generic, CurrentDrive(), DataOwner().Version() ); + delete iTransferType; + iTransferType = transferType; + + // We have a transfer packet, so now request data + RequestDataTransferL(); + } + else + { + // Couldn't process this drive, let's try to find another drive. + // This means we don't change state this time. + __LOG("CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() - not allowed to back up this drive... trying next one..."); + CompleteSelf( KErrNone ); + } + } + else + { + // No more drives left, we've finished! + __LOG("CMMCScBkupWriteDataTransferRequestBase::PrepareDataTransferL() - no more drives to process - we are finished!"); + SetState( EFinished ); + CompleteSelf(); + } + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupWriteDataTransferRequestBase::CurrentDrive() +// +// +// --------------------------------------------------------------------------- +TDriveNumber CMMCScBkupWriteDataTransferRequestBase::CurrentDrive() const + { + return iCurrentDrive; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupWriteDataTransferRequestBase::ValidateTransferInfoL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupWriteDataTransferRequestBase::ValidateTransferInfoL( CSBGenericTransferType* aInfo ) + { + if ( !aInfo ) + { + User::Leave( KErrCorrupt ); + } + + // Check the type is as expected + const TSBDerivedType type = aInfo->DerivedTypeL(); + if ( type != iExpectedTransferType ) + { + __LOG2("CMMCScBkupWriteDataTransferRequestBase::ValidateTransferInfoL() - ERROR - types don not match! type: %d vs expected: %d", type, iExpectedTransferType ); + User::Leave( KErrNotSupported ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupWriteDataTransferRequestBase::RequestDataTransferL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupWriteDataTransferRequestBase::RequestDataTransferL() + { + __LOG3("CMMCScBkupWriteDataTransferRequestBase::RequestDataTransferL() - requesting data from SBE for SID: 0x%08x, Drive: %c:, ElementType: %S", DataOwner().SecureId().iId, 'A' + CurrentDrive(), &MMCScBkupLogger::DataType( ElementType() ) ); + + CSBEClient& sbeClient = Driver().DrvSecureBackupClient(); + sbeClient.RequestDataL( *iTransferType, iStatus ); + SetActive(); + SetState( EProcessData ); + + // Report the progress + RMMCScBkupProgressSizer progressSizer( Driver().DrvParamsBase().DriveAndOperations() ); + progressSizer.BackupReportFixedProgressForOpL( Driver().DrvProgressHandler(), ElementType() ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupWriteDataTransferRequestBase::RunError() +// +// +// --------------------------------------------------------------------------- +TInt CMMCScBkupWriteDataTransferRequestBase::RunError( TInt aError ) + { +#if defined(__MMCSCBKUPLOGGING_ENABLED__) + const TSecureId sid = DataOwner().SecureId(); + __LOGFILE3("CMMCScBkupWriteDataTransferRequestBase::RunError() - **** - aError: %d, sid: 0x%08x, drive: %c", aError, sid.iId, 'A' + CurrentDrive() ); +#endif + + TInt ret = KErrNone; + + // Make sure we close the stream (if we had it open) + if ( iStreamIsOpen ) + { + iStream.Close(); + iStreamIsOpen = EFalse; + } + + // Now notify the observer or silently try again (depends on type of error) + if ( aError == KErrNotFound ) + { + __LOGFILE1("CMMCScBkupWriteDataTransferRequestBase::RunError() - **** - non fatal error (%d) so trying the next drive...", aError); + + // Try the next drive - if none is available, it will complete the + // observer as if nothing went wrong. + iAdditionalTransferRequired = EFalse; + SetState( ETransferData ); + CompleteSelf(); + } + else + { + __LOGFILE1("CMMCScBkupWriteDataTransferRequestBase::RunError() - **** - FATAL ERROR (%d)", aError); + ret = CMMCScBkupTransferRequestBase::RunError( aError ); + } + // + return ret; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupWriteDataTransferRequestBase::DumpTransferDataL() +// +// +// --------------------------------------------------------------------------- +#ifdef DEBUGGING_DATA_TRANSFER +void CMMCScBkupWriteDataTransferRequestBase::DumpTransferDataL( RFs& aFsSession, const TDesC8& aData ) const + { + TPtrC subDirectory( KNullDesC ); + // + switch( ElementType() ) + { + case EMMCScBkupOwnerDataTypeJavaData: + subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataJava); + break; + case EMMCScBkupOwnerDataTypeSystemData: + subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataSystem); + break; + case EMMCScBkupOwnerDataTypePassiveData: + subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataPassive); + break; + case EMMCScBkupOwnerDataTypeActiveData: + subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataActive); + break; + default: + User::Leave( KErrNotSupported ); + break; + } + // + const TSecureId secureId = DataOwner().SecureId(); + _LIT(KMMCScBkupFormatDes, "%S%S"); + TFileName transferDumpFileName; + const TDesC& path = PathInfo::MemoryCardRootPath(); + transferDumpFileName.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot); + + transferDumpFileName.Append( subDirectory ); + transferDumpFileName.Append( KMMCScBkupDataTransferDebuggingPathDataBackup ); + transferDumpFileName.AppendFormat( KMMCScBkupDataTransferDebuggingFileName, secureId.iId, 'a' + CurrentDrive() ); + // + RFile64 file; + TInt error = KErrNone; + TEntry entry; + if ( aFsSession.Entry( transferDumpFileName, entry ) == KErrNone ) + { + // Already exists - append data + error = file.Open( aFsSession, transferDumpFileName, EFileWrite | EFileStream | EFileShareExclusive ); + } + else + { + entry.iSize = 0; + error = file.Create( aFsSession, transferDumpFileName, EFileWrite | EFileStream | EFileShareExclusive ); + } + // + User::LeaveIfError( error ); + CleanupClosePushL( file ); + error = file.Write( entry.iSize, aData ); + CleanupStack::PopAndDestroy( &file ); + } +#endif + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/MMCScBkupArchiveUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/MMCScBkupArchiveUtils.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,709 @@ +/* +* Copyright (c) 2005 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: MMCScBkupArchiveUtils implementation +* +* +*/ + +#include "MMCScBkupArchiveUtils.h" + +// System includes +#include +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "MMCScBkupDllUids.h" +#include "MMCScBkupPhoneModelUtils.h" +#include "CMMCScBkupArchiveFooter.h" +#include "CMMCScBkupArchiveHeader.h" +#include "MMMCScBkupArchiveDataInterface.h" +#include "MMCScBkupArchiveFlags.h" + +// Constants +const TInt8 KMMCScBkupArchiveFileFormatVersionMajor = 1; +#ifdef RD_FILE_MANAGER_BACKUP +const TInt8 KMMCScBkupArchiveFileFormatVersionMinor = 1; +#else +const TInt8 KMMCScBkupArchiveFileFormatVersionMinor = 0; +#endif +const TInt16 KMMCScBkupArchiveFileFormatVersionBuild = 1; +const TUid KMMCScBkupArchiveFileFormatUid1 = { KMMCAppEngUID3 }; +const TUid KMMCScBkupArchiveFileFormatUid2 = { 0 }; +const TUid KMMCScBkupArchiveFileFormatUid3 = { 0x0BACCCCC }; // FIX + + /** + * Fixed Header + * ============ + * + * 12 bytes = 3 uids + * 4 bytes = 1 uid crc checksum + * + * ARCHIVE FILE FORMAT VERSION + * { + * 1 byte = version major + * 1 byte = version minor + * 2 bytes = version build + * } + * + * 4 bytes = size of footer in bytes - this is always the same + * fixed length, hence we can write the size here. + * The value can then be used to work from the back of the + * archive to the starting position of the footer (where + * most of the juicy info is). + * + * 4 bytes = archive flags + * + * 4 bytes = archive payload CRC (activated when RD_FILE_MANAGER_BACKUP) + * + * 4 bytes = archive category + * + * 4 bytes = archive header CRC (activated when RD_FILE_MANAGER_BACKUP) + * + * KMMCScSpareByteCount bytes = spare padding + * + * 1 byte = phone model version string length + * n bytes = phone model version string + * + * + * + * Note that we deliberately do not use the streaming chevrons + * as we then risk the problem of running the string through + * a unicode compressor first. + */ + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::ArchiveUidType() +// +// +// --------------------------------------------------------------------------- +void MMCScBkupArchiveUtils::ArchiveUidType(TUidType& aType) + { + aType = TUidType( KMMCScBkupArchiveFileFormatUid1, + KMMCScBkupArchiveFileFormatUid2, + KMMCScBkupArchiveFileFormatUid3 ); + } + + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::ArchiveCheckedUid() +// +// +// --------------------------------------------------------------------------- +void MMCScBkupArchiveUtils::ArchiveCheckedUid(TCheckedUid& aCheckedUids) + { + TUidType uidType; + ArchiveUidType( uidType ); + aCheckedUids.Set( uidType ); + } + + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::PhoneModelFromArchiveLC() +// +// +// --------------------------------------------------------------------------- +HBufC8* MMCScBkupArchiveUtils::PhoneModelFromArchiveLC( MMMCScBkupArchiveDataInterface& aADI ) + { + const TInt phoneModelOffset = OffsetOfModelInformation(); + // + RReadStream stream( aADI.ADIReadStreamUncompressedLC( phoneModelOffset ) ); + HBufC8* modelInfo = PhoneModelFromArchiveLC( stream); + CleanupStack::PopAndDestroy(); // stream + // + return modelInfo; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::ReadPhoneValidityInformationL() +// +// +// --------------------------------------------------------------------------- +void MMCScBkupArchiveUtils::ReadPhoneValidityInformationL( RFs& aFsSession, const TDesC& aFileName, HBufC8*& aPhoneModelData, TBitFlags& aArchiveFlags, TVersion& aArchiveVersion ) + { + __ASSERT_DEBUG( aPhoneModelData == NULL, User::Invariant() ); + // + RFile64 file; + TInt error = file.Open( aFsSession, aFileName, EFileShareReadersOnly | EFileStream | EFileRead ); + User::LeaveIfError( error ); + CleanupClosePushL(file); + + // First, read the archive flags + aArchiveFlags = ReadArchiveFlagsL( file ); + + // Read version + ReadArchiveVersionL( file, aArchiveVersion ); + + // Then, create a stream interface to the file + const TInt phoneModelOffset = OffsetOfModelInformation(); + RFileReadStream stream( file, phoneModelOffset ); + CleanupStack::Pop( &file ); + CleanupClosePushL( stream ); // stream takes ownership of the file now + // + HBufC8* modelInfo = PhoneModelFromArchiveLC( stream ); + + // Unfortunately we have to juggle the cleanup stack + CleanupStack::Pop( modelInfo ); + CleanupStack::PopAndDestroy( &stream ); // also closes the file + + // Done + aPhoneModelData = modelInfo; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::ArchiveRunTimeFileFormatVersion() +// +// +// --------------------------------------------------------------------------- +TVersion MMCScBkupArchiveUtils::ArchiveRunTimeFileFormatVersion() + { + return TVersion( KMMCScBkupArchiveFileFormatVersionMajor, + KMMCScBkupArchiveFileFormatVersionMinor, + KMMCScBkupArchiveFileFormatVersionBuild ); + } + + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::WriteHeaderL() +// +// +// --------------------------------------------------------------------------- +const TMMCScBkupArchiveVector& MMCScBkupArchiveUtils::WriteHeaderL( MMMCScBkupArchiveDataInterface& aADI, + TBitFlags aCategory ) + { + __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - START"); + RWriteStream stream( aADI.ADIWriteStreamUncompressedLC() ); + + // 16 bytes = uids + *uid* checksum + __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [16] write uids + checksum"); + TCheckedUid checkedUid; + ArchiveCheckedUid( checkedUid ); + const TPtrC8 pUidAndCRC( checkedUid.Des() ); + stream.WriteL( pUidAndCRC ); + + // 4 bytes = file format version + __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [ 4] write version"); + const TVersion version( ArchiveRunTimeFileFormatVersion() ); + stream.WriteInt8L( version.iMajor ); + stream.WriteInt8L( version.iMinor ); + stream.WriteInt16L( version.iBuild ); + + // 4 bytes = Footer length - starts life as length of 0, and + // is then written to again later on after the footer has + // been exteranlised. + __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [ 4] write size of footer (starts life as 0)"); + const TInt footerLength = 0; + stream.WriteInt32L( footerLength ); + + // 4 bytes = Archive flags + __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [ 4] archive flags (archive starts life invalid)"); + const TUint32 defaultArchiveFlags = DefaultArchiveFlags(); + stream.WriteUint32L( defaultArchiveFlags ); + + // 4 bytes = Initial payload CRC value, this will be updated with the final + // CRC once the entire archive has been prepared. + __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [ 4] archive payload CRC"); + const TUint32 initialPayloadCRC = 0; + stream.WriteUint32L( initialPayloadCRC ); + + __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [ 4] archive category"); + stream.WriteUint32L( aCategory.iFlags ); + + // 4 bytes = Initial header CRC value, this will be updated with the final + // CRC once the entire archive has been prepared. + __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [ 4] archive header CRC"); + const TUint32 initialHeaderCRC = 0; + stream.WriteUint32L( initialHeaderCRC ); + + // KMMCScSpareByteCount = padding, for future use + __LOG1("MMCScBkupArchiveUtils::WriteHeaderL() - [%d] padding/spare data", KMMCScSpareByteCount); + for(TInt i = 0; i < KMMCScSpareByteCount/sizeof(TInt32); i++) + { + stream.WriteInt32L( 0 ); + } + + // 1 byte = Phone model version string length + __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [ 1] phone model length"); + HBufC8* phoneModelString = MMCScBkupPhoneModelUtils::CurrentPhoneModelLC(); + stream.WriteInt8L( phoneModelString->Length() ); + + // Then the version string itself + __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - [??] phone model string"); + stream.WriteL( *phoneModelString ); + + // Tidy up + __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - committing stream..."); + stream.CommitL(); + __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - destroying stream..."); + CleanupStack::PopAndDestroy( 2 ); // phoneModelString and stream + + __LOG("MMCScBkupArchiveUtils::WriteHeaderL() - END"); + return aADI.ADICurrentArchiveVectorInfo(); + } + + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::ReadHeaderL() +// +// +// --------------------------------------------------------------------------- +const TMMCScBkupArchiveVector& MMCScBkupArchiveUtils::ReadHeaderL( MMMCScBkupArchiveDataInterface& aADI, CMMCScBkupArchiveHeader& aHeader ) + { + __LOG("MMCScBkupArchiveUtils::ReadHeaderL() - START"); + RReadStream stream( aADI.ADIReadStreamUncompressedLC() ); + + // 16 bytes = uids + *uid* checksum + TBuf8<16> uidBuffer; + stream.ReadL( uidBuffer, uidBuffer.MaxLength() ); + + // Create a UID type objjec + TCheckedUid checkedUid( uidBuffer ); + const TUidType uids( checkedUid.UidType()) ; + __LOG3("MMCScBkupArchiveUtils::ReadHeaderL() - uids: 0x%08x/0x%08x/0x%08x", uids[0], uids[1], uids[2] ); + if ( uids[0] == KNullUid && uids[1] == KNullUid && uids[2] == KNullUid ) + { + // Apparently, TCheckedUid sets the uids to 0 when the CRC doesn't match + // the value read from the file. + User::Leave( KErrNotSupported ); + } + aHeader.SetCheckedUid( checkedUid ); + + // 4 bytes = file format version + TVersion version; + version.iMajor = stream.ReadInt8L(); + version.iMinor = stream.ReadInt8L(); + version.iBuild = stream.ReadInt16L(); + aHeader.SetVersion( version ); + __LOG3("MMCScBkupArchiveUtils::ReadHeaderL() - version: %3d.%3d.%6d", version.iMajor, version.iMinor, version.iBuild ); + + // 4 bytes = Length of footer + const TInt footerLength = stream.ReadInt32L(); + aHeader.SetFooterLength( footerLength ); + __LOG1("MMCScBkupArchiveUtils::ReadHeaderL() - footerLength: %d", footerLength); + + // 4 bytes = Archive flags + const TUint32 archiveFlags = stream.ReadUint32L(); + aHeader.SetArchiveFlags( archiveFlags ); + __LOG1("MMCScBkupArchiveUtils::ReadHeaderL() - archiveFlags: %d", archiveFlags); + + // 4 bytes = Archive payload CRC + const TUint32 payloadCRC = stream.ReadUint32L(); + __LOG1("MMCScBkupArchiveUtils::ReadHeaderL() - archive payload CRC: %d", payloadCRC); + + // 4 bytes = Archive Category + const TUint32 archiveCategory = stream.ReadUint32L(); + __LOG1("MMCScBkupArchiveUtils::ReadHeaderL() - archiveCategory: %d", archiveCategory); + + // 4 bytes = Archive header CRC + const TUint32 headerCRC = stream.ReadUint32L(); + __LOG1("MMCScBkupArchiveUtils::ReadHeaderL() - archive header CRC: %d", headerCRC); + + // KMMCScSpareByteCount of padding (spare) data. Skip for now + for(TInt i = 0; i < KMMCScSpareByteCount/sizeof(TInt32); i++) + { + (void) stream.ReadInt32L(); + } + + // Then the version string itself - which is handled through a separate method: + HBufC8* phoneModel = PhoneModelFromArchiveLC( stream ); + aHeader.SetPhoneModelIdentifierL( *phoneModel ); + CleanupStack::PopAndDestroy( phoneModel ); + + // Clean up + CleanupStack::PopAndDestroy(); // stream + + __LOG("MMCScBkupArchiveUtils::ReadHeaderL() - END"); + return aADI.ADICurrentArchiveVectorInfo(); + } + + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::OffsetOfModelInformation() +// +// +// --------------------------------------------------------------------------- +TInt MMCScBkupArchiveUtils::OffsetOfModelInformation() + { + return EArchiveOffsetPhoneModelStringLength; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::PhoneModelFromArchiveLC() +// +// +// --------------------------------------------------------------------------- +HBufC8* MMCScBkupArchiveUtils::PhoneModelFromArchiveLC( RReadStream& aStream ) + { + const TInt length = aStream.ReadInt8L(); + + // Validate against preconditions + const TInt maxLength = MMCScBkupPhoneModelUtils::MaximumPhoneModelIdentifierLength(); + if ( length > maxLength || length < 0 ) + { + User::Leave( KErrCorrupt ); + } + + // Now try to read the model identifier + HBufC8* model = HBufC8::NewLC( length ); + TPtr8 pModel( model->Des() ); + aStream.ReadL( pModel, length ); + + // All done + return model; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::DefaultArchiveFlags() +// +// +// --------------------------------------------------------------------------- +TUint32 MMCScBkupArchiveUtils::DefaultArchiveFlags() + { + return EMMCScBkupArchiveFlagsDefault; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::SetArchiveContentAsValidL() +// +// +// --------------------------------------------------------------------------- +void MMCScBkupArchiveUtils::SetArchiveContentAsValidL( RFile64& aArchive ) + { + TInt error = KErrNone; + + // Calculate the offset to the archive flags: + const TUint archiveFlagsFileOffset = EArchiveOffsetArchiveFlags; + + // Flags are four bytes. Read the existing raw flag data + TBuf8< KMMCScArchiveFlagsByteCount > flagData; + error = aArchive.Read( static_cast( archiveFlagsFileOffset ), flagData ); + User::LeaveIfError( error ); + + // Interpret the flag data as real flags + RDesReadStream readStream( flagData ); + CleanupClosePushL( readStream ); + TUint32 archiveFlags = readStream.ReadUint32L(); + CleanupStack::PopAndDestroy( &readStream ); + + // Twiddle the "archive is complete/valid" bits + archiveFlags |= EMMCScBkupArchiveFlagsContentValid; + + // Write the flags back out the descriptor + flagData.Zero(); + RDesWriteStream writeStream( flagData ); + CleanupClosePushL( writeStream ); + writeStream.WriteUint32L( archiveFlags ); + writeStream.CommitL(); + CleanupStack::PopAndDestroy( &writeStream ); + + // Then write them to the file itself + error = aArchive.Write( static_cast( archiveFlagsFileOffset ), flagData ); + User::LeaveIfError( error ); + } + + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::SetFooterLengthL() +// +// +// --------------------------------------------------------------------------- +void MMCScBkupArchiveUtils::SetFooterLengthL( RFile64& aArchive, TInt aLength ) + { + TInt error = KErrNone; + + // Calculate the offset to the footer length: + const TUint archiveFooterLengthOffset = EArchiveOffsetFooterLength; + + // Prepare externalized representation of length + TBuf8< KMMCScArchiveFooterLengthByteCount > footerLengthData; + RDesWriteStream writeStream( footerLengthData ); + CleanupClosePushL( writeStream ); + writeStream.WriteInt32L( aLength ); + writeStream.CommitL(); + CleanupStack::PopAndDestroy( &writeStream ); + + // Then write them to the file itself + error = aArchive.Write( static_cast( archiveFooterLengthOffset ), footerLengthData ); + User::LeaveIfError( error ); + } + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::ReadBkUpCategoryInformationL() +// +// +// --------------------------------------------------------------------------- +TBitFlags MMCScBkupArchiveUtils::ReadBkUpCategoryInformationL( RFs& aFsSession, const TDesC& aFileName ) + { + RFile64 file; + TInt error = file.Open( aFsSession, aFileName, EFileShareReadersOnly | EFileStream | EFileRead ); + User::LeaveIfError( error ); + CleanupClosePushL(file); + + // Then, create a stream interface to the file + RFileReadStream stream( file, EArchiveOffsetArchiveCategory ); + CleanupStack::Pop( &file ); + CleanupClosePushL( stream ); // stream takes ownership of the file now + // + TUint category = stream.ReadUint32L(); + + CleanupStack::PopAndDestroy( &stream ); // also closes the file + + TBitFlags ret; + ret.SetValue( category ); + + return ret; + } + + +#ifdef RD_FILE_MANAGER_BACKUP +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::SetArchiveCrcsL() +// +// +// --------------------------------------------------------------------------- +void MMCScBkupArchiveUtils::SetArchiveCrcsL( RFile64& aArchive, TUint32 aCrc ) + { + TInt error = KErrNone; + + // Payload crc + SetArchiveCrcL( aArchive, aCrc, EArchiveOffsetArchivePayloadCRC ); + + // Calculate and write header crc also to the file + TBuf8< KMMCScArchivePhoneModelStringLength > length; + TUint32 modelLength; + TUint32 headerCrc = 0; + + error = aArchive.Read( static_cast( EArchiveOffsetPhoneModelStringLength ), length ); + User::LeaveIfError(error); + RDesReadStream readStream( length ); + CleanupClosePushL( readStream ); + modelLength = readStream.ReadUint8L(); + CleanupStack::PopAndDestroy( &readStream ); + + CalculateCrcFromArchive( headerCrc, aArchive, 0, EArchiveOffsetArchiveHeaderCRC); + CalculateCrcFromArchive( headerCrc, aArchive, EArchiveOffsetArchiveHeaderCRC + KMMCScArchiveCrcByteCount, + KMMCScSpareByteCount + KMMCScArchivePhoneModelStringLength + modelLength); + SetArchiveCrcL( aArchive, headerCrc, EArchiveOffsetArchiveHeaderCRC ); + } + + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::ValidateArchiveCrcsL() +// +// +// --------------------------------------------------------------------------- +TBool MMCScBkupArchiveUtils::ValidateArchiveCrcsL( RFs& aFsSession, const TDesC& aFileName ) + { + TBool validCrc = EFalse; + + RFile64 file; + TInt64 size; + + TInt error = file.Open( aFsSession, aFileName, EFileShareReadersOnly | EFileRead ); + + if ( error == KErrNone && file.Size(size) == KErrNone) + { + TBuf8< KMMCScArchiveFlagsByteCount > headerCrc; + TBuf8< KMMCScArchiveFlagsByteCount > payloadCrc; + TBuf8< KMMCScArchivePhoneModelStringLength > length; + TUint32 archivedHeaderCrc, calculatedHeaderCrc; + TUint32 archivedPayloadCrc, calculatedPayloadCrc; + TUint32 modelLength; + + // Read crcs from header + error = file.Read( static_cast( EArchiveOffsetArchiveHeaderCRC ), headerCrc ); + User::LeaveIfError(error); + error = file.Read( static_cast( EArchiveOffsetArchivePayloadCRC ), payloadCrc ); + User::LeaveIfError(error); + error = file.Read( static_cast( EArchiveOffsetPhoneModelStringLength ), length ); + User::LeaveIfError(error); + CleanupClosePushL( file ); + + RDesReadStream readStream( headerCrc ); + CleanupClosePushL( readStream ); + archivedHeaderCrc = readStream.ReadUint32L(); + readStream.Close(); + readStream.Open(payloadCrc); + archivedPayloadCrc = readStream.ReadUint32L(); + readStream.Close(); + readStream.Open(length); + modelLength = readStream.ReadUint8L(); + CleanupStack::PopAndDestroy( &readStream ); + + // Calculate crc from header in two parts + calculatedHeaderCrc = 0; + CalculateCrcFromArchive( calculatedHeaderCrc, file, 0, EArchiveOffsetArchiveHeaderCRC); + CalculateCrcFromArchive( calculatedHeaderCrc, file, EArchiveOffsetArchiveHeaderCRC + KMMCScArchiveCrcByteCount, + KMMCScSpareByteCount + KMMCScArchivePhoneModelStringLength + modelLength); + + // Calculate crc from payload and footer + TInt payloadSize = size - (EArchiveOffsetPhoneModelString + modelLength); + calculatedPayloadCrc = 0; + CalculateCrcFromArchive( calculatedPayloadCrc, file, EArchiveOffsetPhoneModelString + modelLength, payloadSize); + + if(archivedPayloadCrc == calculatedPayloadCrc && archivedHeaderCrc == calculatedHeaderCrc) + { + validCrc = ETrue; + } + else + { + __LOG4("MMCScBkupArchiveUtils::ValidateArchiveCrcsL() - crc mismatch: %u vs. %u - %u vs. %u", + archivedPayloadCrc, calculatedPayloadCrc, archivedHeaderCrc, calculatedHeaderCrc); + } + + CleanupStack::PopAndDestroy( &file ); + } + + return validCrc; + } +#endif // RD_FILE_MANAGER_BACKUP + + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::ReadArchiveFlagsL() +// +// +// --------------------------------------------------------------------------- +TBitFlags MMCScBkupArchiveUtils::ReadArchiveFlagsL( RFile64& aArchive ) + { + TInt error = KErrNone; + + // Calculate the offset to the archive flags: + const TUint archiveFlagsFileOffset = EArchiveOffsetArchiveFlags; + + // Flags are four bytes. Read the existing raw flag data + TBuf8< KMMCScArchiveFlagsByteCount > flagData; + error = aArchive.Read( static_cast( archiveFlagsFileOffset ), flagData ); + User::LeaveIfError( error ); + + // Interpret the flag data as real flags + RDesReadStream readStream( flagData ); + CleanupClosePushL( readStream ); + TUint32 archiveFlags = readStream.ReadUint32L(); + CleanupStack::PopAndDestroy( &readStream ); + + // Done + TBitFlags ret; + ret.SetValue( archiveFlags ); + return ret; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::ReadArchiveVersionL() +// +// +// --------------------------------------------------------------------------- +void MMCScBkupArchiveUtils::ReadArchiveVersionL( RFile64& aArchive, TVersion& aVersion ) + { + TInt error = KErrNone; + + // Calculate the offset to the archive flags: + const TUint archiveVersionFileOffset = EArchiveOffsetFileFormatVersion; + + // Flags are four bytes. Read the existing raw flag data + TBuf8< KMMCScArchiveVersionByteCount > versionData; + error = aArchive.Read( static_cast( archiveVersionFileOffset ), versionData ); + User::LeaveIfError( error ); + + // Interpret the flag data as real flags + RDesReadStream readStream( versionData ); + CleanupClosePushL( readStream ); + aVersion.iMajor = readStream.ReadInt8L(); + aVersion.iMinor = readStream.ReadInt8L(); + aVersion.iBuild = readStream.ReadInt16L(); + CleanupStack::PopAndDestroy( &readStream ); + } + + +#ifdef RD_FILE_MANAGER_BACKUP +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::SetArchiveCrcL() +// +// +// --------------------------------------------------------------------------- +void MMCScBkupArchiveUtils::SetArchiveCrcL( RFile64& aArchive, TUint32 aCrc, TUint aOffset ) + { + TInt error = KErrNone; + + // Prepare externalized representation of crc + TBuf8< KMMCScArchiveCrcByteCount > crcData; + RDesWriteStream writeStream( crcData ); + CleanupClosePushL( writeStream ); + writeStream.WriteInt32L( aCrc ); + writeStream.CommitL(); + CleanupStack::PopAndDestroy( &writeStream ); + + // Then write crc to the file itself + error = aArchive.Write( static_cast( aOffset ), crcData ); + User::LeaveIfError( error ); + } + + +// --------------------------------------------------------------------------- +// MMCScBkupArchiveUtils::CalculateCrcFromArchive() +// +// +// --------------------------------------------------------------------------- +void MMCScBkupArchiveUtils::CalculateCrcFromArchive( TUint32& aCrc, RFile64& aArchive, TUint32 aOffset, TUint32 aLength ) + { + const TInt KBigBufSize=0x10000; + const TInt KMediumBufSize=0x8000; + const TInt KSmallBufSize=0x1000; + + // Allocate as large buffer as possible for crc validation, because + // need to read file content in chunks for crc calculation. + HBufC8* bufPtr = HBufC8::New(KBigBufSize); + + if ( bufPtr == NULL ) + bufPtr = HBufC8::New(KMediumBufSize); + if ( bufPtr == NULL ) + bufPtr = HBufC8::New(KSmallBufSize); + + if ( bufPtr != NULL) + { + TPtr8 copyBuf = bufPtr->Des(); + TInt64 pos = aOffset; + TInt size = aLength; + + // Loop through archive file skipping archive crc + while(size) + { + TInt s; + + s = Min( size, copyBuf.MaxSize() ); + + TInt error = aArchive.Read( pos, copyBuf, s ); + + if ( error == KErrNone && copyBuf.Length() != s ) + break; + + pos += s; + size -= s; + Mem::Crc32(aCrc, copyBuf.Ptr(), copyBuf.Length()); + } + + delete bufPtr; + } + } +#endif // RD_FILE_MANAGER_BACKUP + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/MMCScBkupLogger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/MMCScBkupLogger.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,251 @@ +/* +* Copyright (c) 2005 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: MMCScBkupLogger implementation +* +* +*/ + +#include "MMCScBkupLogger.h" + +// System includes +#include +#include +#include + +#if defined(__MMCSCBKUPLOGGING_ENABLED__) + +// Constants +const TInt KMMCScBkupLoggingMaxLogTextLength = 1024; +const TInt KMMCScBkupLoggingMaxLogSize = 10240; + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// MMCScBkupLogger::LogRaw() +// +// +// --------------------------------------------------------------------------- +void MMCScBkupLogger::LogRaw( const TDesC& aData ) + { +#if defined(__MMCSCBKUPLOGGING_MODE_FILE__) + + _LIT( KMMCScBkupLoggingDir, "FMBkup" ); + _LIT( KMMCScBkupLoggingFileName, "FMBkup.txt" ); + + ///////////// + // FLOGGER + ///////////// + RFileLogger::Write( KMMCScBkupLoggingDir, KMMCScBkupLoggingFileName, EFileLoggingModeAppend, aData ); + +#elif defined(__MMCSCBKUPLOGGING_MODE_RDEBUG__) + + ///////////// + // RDEBUG + ///////////// + _LIT( KLogComponentName, "[MMC] "); + HBufC* printBuf = HBufC::New( aData.Length() + KLogComponentName().Length() ); + if ( printBuf ) + { + TPtr pBuf( printBuf->Des() ); + pBuf.Append( KLogComponentName ); + pBuf.Append( aData ); + RDebug::Print( *printBuf ); + delete printBuf; + } + else + { + RDebug::Print( aData ); + } + +#endif + } + + +// --------------------------------------------------------------------------- +// MMCScBkupLogger::Log() +// +// +// --------------------------------------------------------------------------- +void MMCScBkupLogger::Log( TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START( list, aFmt ); + + HBufC* buf = HBufC::New( KMMCScBkupLoggingMaxLogTextLength ); + if ( buf ) + { + TPtr pBuf( buf->Des() ); + pBuf.FormatList(aFmt, list); + LogRaw( *buf ); + delete buf; + } + } + + +// --------------------------------------------------------------------------- +// MMCScBkupLogger::DataType() +// +// +// --------------------------------------------------------------------------- +const TDesC& MMCScBkupLogger::DataType( TMMCScBkupOwnerDataType aType ) + { + switch( aType ) + { + case EMMCScBkupOwnerDataTypeDataOwner: + { + _LIT(KRet, "EMMCScBkupOwnerDataTypeDataOwner"); + return KRet; + } + case EMMCScBkupOwnerDataTypeJavaData: + { + _LIT(KRet, "EMMCScBkupOwnerDataTypeJavaData"); + return KRet; + } + case EMMCScBkupOwnerDataTypePublicData: + { + _LIT(KRet, "EMMCScBkupOwnerDataTypePublicData"); + return KRet; + } + case EMMCScBkupOwnerDataTypeSystemData: + { + _LIT(KRet, "EMMCScBkupOwnerDataTypeSystemData"); + return KRet; + } + case EMMCScBkupOwnerDataTypeActiveData: + { + _LIT(KRet, "EMMCScBkupOwnerDataTypeActiveData"); + return KRet; + } + case EMMCScBkupOwnerDataTypePassiveData: + { + _LIT(KRet, "EMMCScBkupOwnerDataTypePassiveData"); + return KRet; + } + case EMMCScBkupOwnerDataTypeAny: + { + _LIT(KRet, "EMMCScBkupOwnerDataTypeAny"); + return KRet; + } + default: + break; + } + + _LIT(KRet, "UNKNOWN!"); + return KRet; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupLogger::FriendlyNameForSID() +// +// +// --------------------------------------------------------------------------- +const TDesC& MMCScBkupLogger::FriendlyNameForSID( TSecureId aSID ) + { + switch( aSID.iId ) + { + case 0x10202be9: + { + _LIT(KRet, "[CentRep]"); + return KRet; + } + case 0x10008d38: + { + _LIT(KRet, "[FavouritesSrv]"); + return KRet; + } + case 0x101f51f2: + { + _LIT(KRet, "[RightsServer]"); + return KRet; + } + case 0x101f7993: + { + _LIT(KRet, "[VpnManager]"); + return KRet; + } + case 0x101fd288: + { + _LIT(KRet, "[EventMediator]"); + return KRet; + } + default: + break; + } + + _LIT(KRet, ""); + return KRet; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupLogger::LogFile() +// +// +// --------------------------------------------------------------------------- +void MMCScBkupLogger::LogFile( TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START( list, aFmt ); + + HBufC* buf = HBufC::New( KMMCScBkupLoggingMaxLogTextLength ); + if ( buf ) + { + TPtr pBuf( buf->Des() ); + pBuf.FormatList(aFmt, list); +#ifdef _DEBUG + LogRaw( *buf ); +#endif + RFile64 file; + RFs& fsSession(CCoeEnv::Static()->FsSession()); + TEntry entry; + TInt error; + + if ( fsSession.Entry( KMMCScBkupLoggingFullPathAndName, entry ) == KErrNone ) + { + error = file.Open( fsSession, KMMCScBkupLoggingFullPathAndName, EFileWrite | EFileShareExclusive ); + } + else + { + entry.iSize = 0; + error = file.Create( fsSession, KMMCScBkupLoggingFullPathAndName, EFileWrite | EFileShareExclusive ); + } + + if(error == KErrNone) + { + TInt64 size = 0; + + error = file.Size( size ); + if(error == KErrNone && size < KMMCScBkupLoggingMaxLogSize) + { + HBufC8* buf8 = HBufC8::New( KMMCScBkupLoggingMaxLogTextLength ); + if(buf8) + { + const TText8 KLineFeed( '\n' ); + TPtr8 data( buf8->Des() ); + + data.Copy(buf->Des()); + data.Append(KLineFeed); + file.Write(static_cast(entry.iSize), data); + delete buf8; + } + } + } + file.Close(); + delete buf; + } + } + +#endif + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/MMCScBkupPhoneModelUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/MMCScBkupPhoneModelUtils.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2005 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: MMCScBkupPhoneModelUtils implementation +* +* +*/ + +#include "MMCScBkupPhoneModelUtils.h" + +// User includes +#include "MMCScBkupArchiveFlags.h" +#include "MMCScBkupArchiveUtils.h" + +// System includes +#include + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// MMCScBkupPhoneModelUtils::CurrentPhoneModelLC() +// +// +// --------------------------------------------------------------------------- +HBufC8* MMCScBkupPhoneModelUtils::CurrentPhoneModelLC() + { + HBufC8* ret = HBufC8::NewLC( MaximumPhoneModelIdentifierLength() ); + // + TBuf version; + const TInt thirdLine(3); + const TInt err = SysUtil::GetSWVersion( version); + + if ( err == KErrNone ) + { + // Assume syntax Vxx.xx\ndd-mm-yy\nNHL-vvv\n(c) + // Extract model version from third line + for(TInt i(0); i < thirdLine; i++) + { + TInt cutPos = version.Locate( '\n' ); + + if( cutPos == KErrNotFound ) + { + break; + } + else if(i < ( thirdLine - 1 ) ) + { + version.Delete( 0, cutPos + 1 ); + } + else + { + cutPos = version.Locate( '\n' ); + if( cutPos != KErrNotFound ) + { + version.Delete( cutPos, (version.Length() - cutPos) ); + } + ret->Des().Copy( version ); + } + } + } + + // Implicit requirement - should always be the case though + __ASSERT_ALWAYS( ret->Length() <= 255, User::Invariant()); + return ret; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupPhoneModelUtils::MaximumPhoneModelIdentifierLength() +// +// +// --------------------------------------------------------------------------- +TInt MMCScBkupPhoneModelUtils::MaximumPhoneModelIdentifierLength() + { + return KSysUtilVersionTextLength; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupPhoneModelUtils::ArchiveRestorePermissableL() +// +// +// --------------------------------------------------------------------------- +TBool MMCScBkupPhoneModelUtils::ArchiveRestorePermissableL( const TDesC8& aPhoneModelData, TBitFlags aArchiveFlags, const TVersion& aArchiveVersion ) + { + TBool restoreOkay = EFalse; + + // Check version first + restoreOkay = ( aArchiveVersion.iMajor >= KMMCScBkupArchiveFileFormatFirstRestorableMajorVersion ); + + // Check flags next + if ( restoreOkay ) + { + restoreOkay = ( aArchiveFlags.Value() & EMMCScBkupArchiveFlagsContentValid ); + + // Only check model if the flags were alright + if ( restoreOkay ) + { + HBufC8* currentData = CurrentPhoneModelLC(); + restoreOkay = ( aPhoneModelData.Compare( *currentData ) == 0 ); + CleanupStack::PopAndDestroy( currentData ); + } + } + + // Done + return restoreOkay; + } + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/MMCScBkupSBEUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/MMCScBkupSBEUtils.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,523 @@ +/* +* Copyright (c) 2005 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: MMCScBkupSBEUtils implementation +* +* +*/ + +#include "MMCScBkupSBEUtils.h" + +// System includes +#include +#include +#include "CMMCScBkupDataOwnerInfo.h" + +// Namespaces +using namespace conn; + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// MMCScBkupSBEUtils::SecureIdFromGenericL() +// +// +// --------------------------------------------------------------------------- +TSecureId MMCScBkupSBEUtils::SecureIdFromGenericL(const CSBGenericDataType& aGeneric) + { + TSecureId ret = 0; + CSBGenericDataType* nonConstOriginal = const_cast(&aGeneric); + const TSBDerivedType type = aGeneric.DerivedTypeL(); + // + switch(type) + { + case ESIDDerivedType: + { + CSBSecureId* temp = CSBSecureId::NewL( nonConstOriginal ); + CleanupStack::PushL( temp ); + ret = temp->SecureIdL(); + CleanupStack::PopAndDestroy( temp ); + break; + } + case ESIDTransferDerivedType: + { + // First make a generic transfer type object... + CSBGenericTransferType* transferTypeTemp = CSBGenericTransferType::NewL( nonConstOriginal->Externalise() ); + CleanupStack::PushL(transferTypeTemp); + + // Now make instance transfer type + CSBSIDTransferType* temp = CSBSIDTransferType::NewL( transferTypeTemp ); + CleanupStack::PushL(temp); + + // Now get the result + ret = temp->SecureIdL(); + + // Tidy up + CleanupStack::PopAndDestroy(2, transferTypeTemp); + break; + } + case EPackageDerivedType: + { + CSBPackageId* temp = CSBPackageId::NewL( nonConstOriginal ); + CleanupStack::PushL( temp ); + ret = temp->SecureIdL(); + CleanupStack::PopAndDestroy( temp ); + break; + } + case EPackageTransferDerivedType: + case EJavaDerivedType: + case EJavaTransferDerivedType: + default: + __BREAKPOINT(); + User::Leave(KErrNotSupported); + break; + } + // + return ret; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupSBEUtils::PackageIdFromGenericL() +// +// +// --------------------------------------------------------------------------- +TUid MMCScBkupSBEUtils::PackageIdFromGenericL(const CSBGenericDataType& aGeneric) + { + TUid ret = KNullUid; + CSBGenericDataType* nonConstOriginal = const_cast(&aGeneric); + const TSBDerivedType type = aGeneric.DerivedTypeL(); + // + switch(type) + { + case EPackageDerivedType: + { + CSBPackageId* temp = CSBPackageId::NewL( nonConstOriginal ); + CleanupStack::PushL(temp); + ret = temp->PackageIdL(); + CleanupStack::PopAndDestroy(temp); + break; + } + case EPackageTransferDerivedType: + { + // First make a generic transfer type object... + CSBGenericTransferType* transferTypeTemp = CSBGenericTransferType::NewL( nonConstOriginal->Externalise() ); + CleanupStack::PushL(transferTypeTemp); + + // Now make instance transfer type + CSBPackageTransferType* temp = CSBPackageTransferType::NewL( transferTypeTemp ); + CleanupStack::PushL(temp); + + // Now get the result + ret = temp->PackageIdL(); + + // Tidy up + CleanupStack::PopAndDestroy(2, transferTypeTemp); + break; + } + case ESIDDerivedType: + case ESIDTransferDerivedType: + case EJavaDerivedType: + case EJavaTransferDerivedType: + default: + __BREAKPOINT(); + User::Leave(KErrNotSupported); + break; + } + // + return ret; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupSBEUtils::JavaHashFromGenericLC() +// +// +// --------------------------------------------------------------------------- +HBufC* MMCScBkupSBEUtils::JavaHashFromGenericLC(const CSBGenericDataType& aGeneric) + { + HBufC* ret = NULL; + CSBGenericDataType* nonConstOriginal = const_cast(&aGeneric); + const TSBDerivedType type = aGeneric.DerivedTypeL(); + // + switch(type) + { + case EJavaDerivedType: + { + CSBJavaId* temp = CSBJavaId::NewL( nonConstOriginal ); + CleanupStack::PushL(temp); + ret = temp->SuiteHashL().AllocL(); + CleanupStack::PopAndDestroy(temp); + CleanupStack::PushL( ret ); + break; + } + case EJavaTransferDerivedType: + { + // First make a generic transfer type object... + CSBGenericTransferType* transferTypeTemp = CSBGenericTransferType::NewL( nonConstOriginal->Externalise() ); + CleanupStack::PushL(transferTypeTemp); + + // Now make a instance transfer type + CSBJavaTransferType* temp = CSBJavaTransferType::NewL( transferTypeTemp ); + CleanupStack::PushL(temp); + + // Now get the result + ret = temp->SuiteHashL().AllocL(); + + // Tidy up + CleanupStack::PopAndDestroy(2, transferTypeTemp); + CleanupStack::PushL( ret ); + break; + } + case ESIDDerivedType: + case ESIDTransferDerivedType: + case EPackageDerivedType: + case EPackageTransferDerivedType: + default: + __BREAKPOINT(); + User::Leave(KErrNotSupported); + break; + } + // + if ( ret == NULL ) + { + ret = KNullDesC().AllocLC(); + } + // + return ret; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupSBEUtils::CopyLC() +// +// +// --------------------------------------------------------------------------- +CSBGenericDataType* MMCScBkupSBEUtils::CopyLC(const CSBGenericDataType& aToBeCopied) + { + CSBGenericDataType* ret = NULL; + + // Have to do this through poor implementation of SBE API + CSBGenericDataType* nonConstOriginal = const_cast(&aToBeCopied); + // + const TSBDerivedType type = nonConstOriginal->DerivedTypeL(); + switch(type) + { + case ESIDDerivedType: + ret = CSBSecureId::NewL(nonConstOriginal); + break; + case EPackageDerivedType: + ret = CSBPackageId::NewL(nonConstOriginal); + break; + case EJavaDerivedType: + ret = CSBJavaId::NewL(nonConstOriginal); + break; + case ESIDTransferDerivedType: + case EPackageTransferDerivedType: + case EJavaTransferDerivedType: + { + // Must first create a generic transfer type object... sigh... + CSBGenericTransferType* transferType = CSBGenericTransferType::NewL( nonConstOriginal->Externalise() ); + CleanupStack::PushL( transferType ); + if ( ESIDTransferDerivedType == type ) + { + ret = CSBSIDTransferType::NewL( transferType ); + } + else if ( EPackageTransferDerivedType == type ) + { + ret = CSBPackageTransferType::NewL( transferType ); + } + // Type is EJavaTransferDerivedType + else + { + ret = CSBJavaTransferType::NewL( transferType ); + } + CleanupStack::PopAndDestroy( transferType ); + } + default: + break; + } + // + if (!ret) + { + __BREAKPOINT(); + User::Leave(KErrNotSupported); + } + CleanupStack::PushL(ret); + return ret; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupSBEUtils::TransferTypeLC() +// +// +// --------------------------------------------------------------------------- +CSBGenericTransferType* MMCScBkupSBEUtils::TransferTypeLC( const CSBGenericDataType& aDT, TDriveNumber aDrive, + TTransferDataType aTransferType, TInt aVersion ) + { + CSBGenericTransferType* ret = NULL; + + // Have to do this through poor implementation of SBE API + CSBGenericDataType* nonConstOriginal = const_cast< CSBGenericDataType* >( &aDT ); + // + const TSBDerivedType type = nonConstOriginal->DerivedTypeL(); + switch( type ) + { + case ESIDDerivedType: + case ESIDTransferDerivedType: + { + const TSecureId secureId = SecureIdFromGenericL( aDT ); + ret = CSBSIDTransferType::NewL( secureId, aDrive, aTransferType ); + break; + } + + case EPackageDerivedType: + { + TSecureId secureId = SecureIdFromGenericL( aDT ); + if( secureId.iId == KNullUid.iUid && aVersion > CMMCScBkupDataOwnerInfo::EStreamFormatVersionFirst ) + { + secureId = MMCScBkupSBEUtils::PackageIdFromGenericL( aDT ); + } + ret = CSBSIDTransferType::NewL( secureId, aDrive, aTransferType ); + break; + } + + default: + case EPackageTransferDerivedType: + case EJavaDerivedType: + case EJavaTransferDerivedType: + __BREAKPOINT(); + User::Leave( KErrNotSupported ); + break; + } + // + CleanupStack::PushL( ret ); + return ret; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupSBEUtils::TransferTypeLC() +// +// +// --------------------------------------------------------------------------- +CSBGenericTransferType* MMCScBkupSBEUtils::TransferTypeLC(const CSBGenericDataType& aDT, TDriveNumber aDrive, + TPackageDataType aDataType, TInt /*aVersion*/) + { + CSBGenericTransferType* ret = NULL; + + // Have to do this through poor implementation of SBE API + CSBGenericDataType* nonConstOriginal = const_cast(&aDT); + // + const TSBDerivedType type = nonConstOriginal->DerivedTypeL(); + switch(type) + { + case EPackageDerivedType: + case EPackageTransferDerivedType: + { + const TUid packageId = PackageIdFromGenericL(aDT); + ret = CSBPackageTransferType::NewL(packageId, aDrive, aDataType); + break; + } + + default: + case ESIDDerivedType: + case ESIDTransferDerivedType: + case EJavaDerivedType: + case EJavaTransferDerivedType: + __BREAKPOINT(); + User::Leave(KErrNotSupported); + break; + } + // + CleanupStack::PushL(ret); + return ret; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupSBEUtils::TransferTypeLC() +// +// +// --------------------------------------------------------------------------- +CSBGenericTransferType* MMCScBkupSBEUtils::TransferTypeLC(const CSBGenericDataType& aDT, TDriveNumber aDrive, + TJavaTransferType aDataType, TInt /*aVersion*/) + { + CSBGenericTransferType* ret = NULL; + + // Have to do this through poor implementation of SBE API + CSBGenericDataType* nonConstOriginal = const_cast(&aDT); + // + const TSBDerivedType type = nonConstOriginal->DerivedTypeL(); + switch(type) + { + case EJavaDerivedType: + case EJavaTransferDerivedType: + { + HBufC* hash = JavaHashFromGenericLC( aDT ); + ret = CSBJavaTransferType::NewL( *hash, aDrive, aDataType ); + CleanupStack::PopAndDestroy( hash ); + break; + } + + default: + case ESIDDerivedType: + case ESIDTransferDerivedType: + case EPackageDerivedType: + case EPackageTransferDerivedType: + __BREAKPOINT(); + User::Leave(KErrNotSupported); + break; + } + // + CleanupStack::PushL(ret); + return ret; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupSBEUtils::PhoneIsInBackupOrRestoreModeL() +// +// +// --------------------------------------------------------------------------- +TBool MMCScBkupSBEUtils::PhoneIsInBackupOrRestoreModeL() + { + TBool backupInProgress = EFalse; + // + TInt value = 0; + const TInt error = RProperty::Get( KUidSystemCategory, KUidBackupRestoreKey, value ); + User::LeaveIfError( error ); + // + const TBURPartType partType = static_cast< TBURPartType >( value & KBURPartTypeMask ); + if (value != 0) + { + switch(partType) + { + case EBURUnset: + case EBURNormal: + break; + case EBURBackupFull: + case EBURBackupPartial: + case EBURRestoreFull: + case EBURRestorePartial: + backupInProgress = ETrue; + break; + } + } + // + return backupInProgress; + } + + +// --------------------------------------------------------------------------- +// MMCScBkupSBEUtils::EndBackupOrRestoreL() +// +// +// --------------------------------------------------------------------------- +void MMCScBkupSBEUtils::EndBackupOrRestoreL( CSBEClient& aSBEClient ) + { + TDriveList nullDriveList; + aSBEClient.SetBURModeL( nullDriveList, EBURNormal, ENoBackup); + } + + +// --------------------------------------------------------------------------- +// MMCScBkupSBEUtils::HasSystemDataL() +// +// +// --------------------------------------------------------------------------- +TBool MMCScBkupSBEUtils::HasSystemDataL( const CDataOwnerInfo& aDataOwner ) + { + const TSBDerivedType type = aDataOwner.Identifier().DerivedTypeL(); + const TBool systemDataType = ( type == EPackageDerivedType || + type == EPackageTransferDerivedType ); + const TBool hasSystemData = ( aDataOwner.CommonSettings() & EHasSystemFiles ); + // + return ( systemDataType && hasSystemData ); + } + + +// --------------------------------------------------------------------------- +// MMCScBkupSBEUtils::HasJavaDataL() +// +// +// --------------------------------------------------------------------------- +TBool MMCScBkupSBEUtils::HasJavaDataL( const CDataOwnerInfo& aDataOwner ) + { + const TSBDerivedType type = aDataOwner.Identifier().DerivedTypeL(); + const TBool javaDataType = ( type == EJavaDerivedType || + type == EJavaTransferDerivedType ); + const TBool hasSystemData = ( aDataOwner.CommonSettings() & EHasSystemFiles ); + + // Java abuses the "has system files flag" - this has been confirmed + // with Symbian. + return ( javaDataType && hasSystemData ); + } + + +// --------------------------------------------------------------------------- +// MMCScBkupSBEUtils::HasPassiveDataL() +// +// +// --------------------------------------------------------------------------- +TBool MMCScBkupSBEUtils::HasPassiveDataL( const CDataOwnerInfo& aDataOwner ) + { + const TSBDerivedType type = aDataOwner.Identifier().DerivedTypeL(); + const TBool passiveDataType = ( type == ESIDDerivedType || + type == ESIDTransferDerivedType || + type == EPackageDerivedType || + type == EPackageTransferDerivedType ); + const TBool hasPassiveData = ( aDataOwner.CommonSettings() & EPassiveBUR ); + // + return ( passiveDataType && hasPassiveData ); + } + + +// --------------------------------------------------------------------------- +// MMCScBkupSBEUtils::HasActiveDataL() +// +// +// --------------------------------------------------------------------------- +TBool MMCScBkupSBEUtils::HasActiveDataL( const CDataOwnerInfo& aDataOwner ) + { + const TSBDerivedType type = aDataOwner.Identifier().DerivedTypeL(); + const TBool activeDataType = ( type == ESIDDerivedType || + type == ESIDTransferDerivedType || + type == EPackageDerivedType || + type == EPackageTransferDerivedType ); + const TBool hasActiveData = ( aDataOwner.CommonSettings() & EActiveBUR ); + // + return ( activeDataType && hasActiveData ); + } + + +// --------------------------------------------------------------------------- +// MMCScBkupSBEUtils::HasPublicDataL() +// +// +// --------------------------------------------------------------------------- +TBool MMCScBkupSBEUtils::HasPublicDataL( const CDataOwnerInfo& aDataOwner ) + { + const TSBDerivedType type = aDataOwner.Identifier().DerivedTypeL(); + const TBool publicDataType = ( type == ESIDDerivedType || + type == ESIDTransferDerivedType || + type == EPackageDerivedType || + type == EPackageTransferDerivedType ); + const TBool hasPublicData = ( aDataOwner.PassiveSettings() & EHasPublicFiles ); + // + return ( hasPublicData && publicDataType ); + } + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/RMMCScBkupArchiveStreams.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/RMMCScBkupArchiveStreams.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,256 @@ +/* +* Copyright (c) 2005 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: RMMCScBkupArchiveReadStream implementation +* +* +*/ + +#include "RMMCScBkupArchiveStreams.h" + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupArchiveDataManager.h" + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// RMMCScBkupArchiveBuf::RMMCScBkupArchiveBuf() +// +// +// --------------------------------------------------------------------------- +RMMCScBkupArchiveBuf::RMMCScBkupArchiveBuf() +: iADM(NULL) + { + } + + +// --------------------------------------------------------------------------- +// RMMCScBkupArchiveBuf::AttachL() +// +// +// --------------------------------------------------------------------------- +void RMMCScBkupArchiveBuf::AttachL( CMMCScBkupArchiveDataManager& aADM, RFile64& aFile, TInt aPos, TBool aForWrite ) + { + //__LOG3("RMMCScBkupArchiveBuf::AttachL() - START - aFile: 0x%08x, aPos: %d, aForWrite: %d", aFile.SubSessionHandle(), aPos, aForWrite); + + // Prevent RFileBuf from resetting our file handle + RFile64 file(aFile); + RFileBuf::Attach(file, aPos); + + // We save the attach pos so that we can update the ADM with the final + // length of data that was read or written... + iInfo.Reset(); + iInfo.SetOffset(aPos); + + iWriteMode = aForWrite; + iADM = &aADM; + + //__LOG("RMMCScBkupArchiveBuf::AttachL() - END"); + } + + +// --------------------------------------------------------------------------- +// RMMCScBkupArchiveBuf::Close() +// +// +// --------------------------------------------------------------------------- +EXPORT_C void RMMCScBkupArchiveBuf::Close() + { + //__LOG1("RMMCScBkupArchiveBuf::Close() - START - File: 0x%08x", File().SubSessionHandle()); + + TRAP_IGNORE(DoSynchL()); + Detach(); + Reset(); + + //__LOG1("RMMCScBkupArchiveBuf::Close() - END - File: 0x%08x", File().SubSessionHandle()); + } + + +// --------------------------------------------------------------------------- +// RMMCScBkupArchiveBuf::IsOpen() +// +// +// --------------------------------------------------------------------------- +TBool RMMCScBkupArchiveBuf::IsOpen() const + { + return (File().SubSessionHandle() != KNullHandle); + } + + +// --------------------------------------------------------------------------- +// RMMCScBkupArchiveBuf::DoRelease() +// +// +// --------------------------------------------------------------------------- +void RMMCScBkupArchiveBuf::DoRelease() + { + //__LOG1("RMMCScBkupArchiveBuf::DoRelease() - START - File: 0x%08x", File().SubSessionHandle()); + + TRAP_IGNORE( UpdateInfoL() ); + Detach(); + RFileBuf::DoRelease(); + + //__LOG1("RMMCScBkupArchiveBuf::DoRelease() - END - File: 0x%08x", File().SubSessionHandle()); + } + + +// --------------------------------------------------------------------------- +// RMMCScBkupArchiveBuf::DoSynchL() +// +// +// --------------------------------------------------------------------------- +void RMMCScBkupArchiveBuf::DoSynchL() + { + //__LOG1("RMMCScBkupArchiveBuf::DoSynchL() - START - File: 0x%08x", File().SubSessionHandle()); + + RFileBuf::DoSynchL(); + UpdateInfoL(); + + //__LOG1("RMMCScBkupArchiveBuf::DoSynchL() - END - File: 0x%08x", File().SubSessionHandle()); + } + + +#ifdef RD_FILE_MANAGER_BACKUP +// --------------------------------------------------------------------------- +// RMMCScBkupArchiveBuf::DoWriteL() +// +// +// --------------------------------------------------------------------------- +void RMMCScBkupArchiveBuf::DoWriteL(const TAny* aPtr,TInt aLength) + { + iADM->CalculateCrc(aPtr, aLength); + RFileBuf::DoWriteL(aPtr, aLength); + } +#endif + + +// --------------------------------------------------------------------------- +// RMMCScBkupArchiveBuf::UpdateInfoL() +// +// +// --------------------------------------------------------------------------- +void RMMCScBkupArchiveBuf::UpdateInfoL() + { + //__LOG1("RMMCScBkupArchiveBuf::UpdateInfoL() - START - File: 0x%08x", File().SubSessionHandle()); + + // Update our stats + if ( iADM && File().SubSessionHandle() != KNullHandle ) + { + TStreamPos pos; + if ( iWriteMode ) + { + pos = TellL( MStreamBuf::EWrite ); + //__LOG("RMMCScBkupArchiveBuf::UpdateInfoL() - write mode..."); + } + else + { + pos = TellL( MStreamBuf::ERead ); + //__LOG("RMMCScBkupArchiveBuf::UpdateInfoL() - read mode..."); + } + // + const TInt currentOffset = pos.Offset(); + const TInt length = currentOffset - iInfo.Offset(); + + //__LOG1("RMMCScBkupArchiveBuf::UpdateInfoL() - currentOffset: %8d", currentOffset); + //__LOG1("RMMCScBkupArchiveBuf::UpdateInfoL() - length: %8d", length); + iInfo.SetLength( length ); + + // Inform ADM of final info + iADM->SetCurrentVector( iInfo ); + } + + //__LOG1("RMMCScBkupArchiveBuf::UpdateInfoL() - END - File: 0x%08x", File().SubSessionHandle()); + } + + + + + + + + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// RMMCScBkupArchiveReadStream::OpenLC() +// +// +// --------------------------------------------------------------------------- +void RMMCScBkupArchiveReadStream::OpenLC( CMMCScBkupArchiveDataManager& aADM, RFile64& aArchiveFile, TInt aPos ) + { + CleanupClosePushL( *this ); + // + iSource.AttachL( aADM, aArchiveFile, aPos, EFalse ); + RReadStream::Attach( &iSource ); + } + + +// --------------------------------------------------------------------------- +// RMMCScBkupArchiveReadStream::IsOpen() +// +// +// --------------------------------------------------------------------------- +TBool RMMCScBkupArchiveReadStream::IsOpen() const + { + return iSource.IsOpen(); + } + + + + + + + + + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// RMMCScBkupArchiveWriteStream::OpenLC() +// +// +// --------------------------------------------------------------------------- +void RMMCScBkupArchiveWriteStream::OpenLC( CMMCScBkupArchiveDataManager& aADM, RFile64& aArchiveFile, TInt aPos ) + { + CleanupClosePushL( *this ); + // + iSink.AttachL( aADM, aArchiveFile, aPos, ETrue ); + RWriteStream::Attach( &iSink ); + } + + +// --------------------------------------------------------------------------- +// RMMCScBkupArchiveWriteStream::IsOpen() +// +// +// --------------------------------------------------------------------------- +TBool RMMCScBkupArchiveWriteStream::IsOpen() const + { + return iSink.IsOpen(); + } + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/RMMCScBkupProgressSizer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/RMMCScBkupProgressSizer.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,250 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: RMMCScBkupProgressSizer implementation +* +* +*/ + +#include "RMMCScBkupProgressSizer.h" + +// User includes +#include "MMCScBkupLogger.h" +#include "MMCScBkupSBEUtils.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "MMMCScBkupProgressObserver.h" +#include "CMMCScBkupDriveAndOperationTypeManager.h" + +// Constants +const TInt KMMCScBkupWeightingFactor = 10000; + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// RMMCScBkupProgressSizer::RMMCScBkupProgressSizer() +// +// C++ constructor. +// --------------------------------------------------------------------------- +RMMCScBkupProgressSizer::RMMCScBkupProgressSizer( const CMMCScBkupDriveAndOperationTypeManager& aDriveAndOperationTypes ) +: iDriveAndOperationTypes( aDriveAndOperationTypes ), iDriveFilter( aDriveAndOperationTypes.DriveList() ) + { + } + + +// --------------------------------------------------------------------------- +// RMMCScBkupProgressSizer::BackupTotalProgressValueL() +// +// Calculate the total amount of progress steps that a particular data owner +// requires. This method can only be called after all of the sizing info +// has been obtained from the SBE +// --------------------------------------------------------------------------- +TInt64 RMMCScBkupProgressSizer::BackupTotalProgressValueL( const CMMCScBkupDataOwnerInfo& aDataOwner ) + { + __LOG(" "); + __LOG1("RMMCScBkupProgressSizer::BackupTotalProgressValueL() - START - DO: 0x%08x", aDataOwner.SecureId().iId); + TInt64 totalStepCount = 0; + + ////////////////////////////////////////////////////////////////////// + // THESE ELEMENTS HAVE PSEUDO-PROGRESS - that is, the report a fixed + // number of progress nibbles per operation. For example: + // + // TYPE DRIVE PROGRESS + // ======================================= + // ACTIVE (C:) 1 x 2000 + // PASSIVE (C:) 1 x 2000 + // SYSTEM (C:, E:) 2 x 2000 + // JAVA (C:) 1 x 2000 + // PUBLIC (C: = 12k) 12 x 1024 + // ---------------------------------------- + // total 10000 + (12 x 1024) + // + ////////////////////////////////////////////////////////////////////// + + const CDataOwnerInfo& sbeDataOwner = aDataOwner.Owner(); + + // Passive data + if ( MMCScBkupSBEUtils::HasPassiveDataL( sbeDataOwner ) ) + { + const TInt opsCount = NumberOfDriveOpsRequiredL( aDataOwner, EMMCScBkupOwnerDataTypePassiveData ); + __LOG2("RMMCScBkupProgressSizer::BackupTotalProgressValueL() - passive - %d of progress (%d ops)", opsCount * KMMCScBkupWeightingFactor, opsCount); + totalStepCount += ( opsCount * KMMCScBkupWeightingFactor ); + } + + // Active data + if ( MMCScBkupSBEUtils::HasActiveDataL( sbeDataOwner ) ) + { + const TInt opsCount = NumberOfDriveOpsRequiredL( aDataOwner, EMMCScBkupOwnerDataTypeActiveData ); + __LOG2("RMMCScBkupProgressSizer::BackupTotalProgressValueL() - active - %d of progress (%d ops)", opsCount * KMMCScBkupWeightingFactor, opsCount); + totalStepCount += ( opsCount * KMMCScBkupWeightingFactor ); + } + + // System data + if ( MMCScBkupSBEUtils::HasSystemDataL( sbeDataOwner ) ) + { + const TInt opsCount = NumberOfDriveOpsRequiredL( aDataOwner, EMMCScBkupOwnerDataTypeSystemData ); + __LOG2("RMMCScBkupProgressSizer::BackupTotalProgressValueL() - system - %d of progress (%d ops)", opsCount * KMMCScBkupWeightingFactor, opsCount); + totalStepCount += ( opsCount * KMMCScBkupWeightingFactor ); + } + + // Java data + if ( MMCScBkupSBEUtils::HasJavaDataL( sbeDataOwner ) ) + { + const TInt opsCount = NumberOfDriveOpsRequiredL( aDataOwner, EMMCScBkupOwnerDataTypeJavaData ); + __LOG2("RMMCScBkupProgressSizer::BackupTotalProgressValueL() - java - %d of progress (%d ops)", opsCount * KMMCScBkupWeightingFactor, opsCount); + totalStepCount += ( opsCount * KMMCScBkupWeightingFactor ); + } + + + /////////////////////////////////// + // PUBLIC REPORTS ACTUAL SIZING + /////////////////////////////////// + + // Public data + if ( MMCScBkupSBEUtils::HasPublicDataL( sbeDataOwner ) ) + { + const TInt64 size = AmountOfPublicDataToBeRestoredL( aDataOwner ); + __LOG1("RMMCScBkupProgressSizer::BackupTotalProgressValueL() - public - %Ld of progress", size); + totalStepCount += size; + } + + // + __LOG2("RMMCScBkupProgressSizer::BackupTotalProgressValueL() - END - DO: 0x%08x, totalStepCount: %8Ld", aDataOwner.SecureId().iId, totalStepCount); + return totalStepCount; + } + + +// --------------------------------------------------------------------------- +// RMMCScBkupProgressSizer::BackupReportFixedProgressForOpL() +// +// +// --------------------------------------------------------------------------- +void RMMCScBkupProgressSizer::BackupReportFixedProgressForOpL( MMMCScBkupProgressObserver& aProgressManager, TMMCScBkupOwnerDataType aType ) + { + switch( aType ) + { + case EMMCScBkupOwnerDataTypeSystemData: + case EMMCScBkupOwnerDataTypeActiveData: + case EMMCScBkupOwnerDataTypePassiveData: + case EMMCScBkupOwnerDataTypeJavaData: + __LOG2("RMMCScBkupProgressSizer::BackupReportFixedProgressForOpL() - aType: %d, amount: %d ", aType, KMMCScBkupWeightingFactor ); + aProgressManager.MMCScBkupHandleProgress( KMMCScBkupWeightingFactor ); + break; + default: + case EMMCScBkupOwnerDataTypeDataOwner: + case EMMCScBkupOwnerDataTypePublicData: + ASSERT( EFalse ); + break; + } + } + + +// --------------------------------------------------------------------------- +// RMMCScBkupProgressSizer::RestoreCombinedDataSizeL() +// +// +// --------------------------------------------------------------------------- +TInt64 RMMCScBkupProgressSizer::RestoreCombinedDataSizeL( const CMMCScBkupDataOwnerInfo& aOwner ) + { + TInt64 size = 0; + // + iDriveFilter.Reset(); + iDriveFilter.SetSecondaryDriveFilter( aOwner.Owner().DriveList() ); + // + TDriveNumber drive = EDriveA; + while ( iDriveFilter.NextValidDrive( drive ) ) + { + for( TInt i=0; i ( i ); + const TBool allowedForDrive = iDriveAndOperationTypes.IsDataTypeAllowedToAccessDrive( drive, dataType ); + // + if ( allowedForDrive ) + { + // Get the amount of data for this drive + size += aOwner.OperationalSize( dataType, drive ); + } + } + } + // + return size; + } + + + + + + + + + + + +// --------------------------------------------------------------------------- +// RMMCScBkupProgressSizer::NumberOfDriveOpsRequiredL() +// +// +// --------------------------------------------------------------------------- +TInt RMMCScBkupProgressSizer::NumberOfDriveOpsRequiredL( const CMMCScBkupDataOwnerInfo& aOwner, TMMCScBkupOwnerDataType aType ) + { + TInt count = 0; + // + iDriveFilter.Reset(); + iDriveFilter.SetSecondaryDriveFilter( aOwner.Owner().DriveList() ); + // + TDriveNumber drive = EDriveA; + while ( iDriveFilter.NextValidDrive( drive ) ) + { + const TBool allowedForDrive = iDriveAndOperationTypes.IsDataTypeAllowedToAccessDrive( drive, aType ); + // + if ( allowedForDrive ) + { + ++count; + } + } + // + return count; + } + + +// --------------------------------------------------------------------------- +// RMMCScBkupProgressSizer::AmountOfPublicDataToBeRestoredL() +// +// +// --------------------------------------------------------------------------- +TInt64 RMMCScBkupProgressSizer::AmountOfPublicDataToBeRestoredL( const CMMCScBkupDataOwnerInfo& aOwner ) + { + TInt64 size = 0; + // + iDriveFilter.Reset(); + iDriveFilter.SetSecondaryDriveFilter( aOwner.Owner().DriveList() ); + // + TDriveNumber drive = EDriveA; + while ( iDriveFilter.NextValidDrive( drive ) ) + { + const TBool allowedForDrive = iDriveAndOperationTypes.IsDataTypeAllowedToAccessDrive( drive, EMMCScBkupOwnerDataTypePublicData ); + // + if ( allowedForDrive ) + { + // Get the amount of data for this drive + size += aOwner.OperationalSize( EMMCScBkupOwnerDataTypePublicData, drive ); + } + } + // + return size; + } + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/TMMCScBkupArchiveVector.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/TMMCScBkupArchiveVector.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2005 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: TMMCScBkupArchiveVector implementation +* +* +*/ + +#include "TMMCScBkupArchiveVector.h" + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// TMMCScBkupArchiveVector::ExternalizedSize() +// +// +// --------------------------------------------------------------------------- + +TInt TMMCScBkupArchiveVector::ExternalizedSize() + { + return 20; // 4 bytes for offset, 4 bytes for length, 4 bytes stream version, 4 bytes spare1, 4 bytes spare2 + } + + +// --------------------------------------------------------------------------- +// TMMCScBkupArchiveVector::ExternalizeL() +// +// +// --------------------------------------------------------------------------- + +void TMMCScBkupArchiveVector::ExternalizeL(RWriteStream& aStream) const + { + aStream.WriteInt32L( EStreamFormatVersion1 ); + aStream.WriteInt32L( Offset() ); + aStream.WriteInt32L( Length() ); + aStream.WriteInt32L( 0 ); // Spare1 + aStream.WriteInt32L( 0 ); // Spare2 + } + +// --------------------------------------------------------------------------- +// TMMCScBkupArchiveVector::InternalizeL() +// +// +// --------------------------------------------------------------------------- + +void TMMCScBkupArchiveVector::InternalizeL(RReadStream& aStream) + { + aStream.ReadInt32L(); // stream format version + iOffset = aStream.ReadInt32L(); + iLength = aStream.ReadInt32L(); + aStream.ReadInt32L(); // Spare1 + aStream.ReadInt32L(); // Spare2 + // + if (iOffset < 0 || iLength < 0) + { + User::Leave(KErrCorrupt); + } + } + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// TMMCScBkupArchiveDriveAndVector::InternalizeL() +// +// +// --------------------------------------------------------------------------- +void TMMCScBkupArchiveDriveAndVector::InternalizeL( RReadStream& aStream ) + { + aStream.ReadInt32L(); // EStreamFormatVersion1 + aStream.ReadInt32L(); // spare1 + aStream.ReadInt32L(); // spare2 + aStream.ReadInt32L(); // spare3 + // + iDrive = static_cast( aStream.ReadUint8L() ); + aStream >> iVector; + } + + +// --------------------------------------------------------------------------- +// TMMCScBkupArchiveDriveAndVector::ExternalizeL() +// +// +// --------------------------------------------------------------------------- +void TMMCScBkupArchiveDriveAndVector::ExternalizeL( RWriteStream& aStream ) const + { + aStream.WriteInt32L( EStreamFormatVersion1 ); + aStream.WriteInt32L( 0 ); // spare1 + aStream.WriteInt32L( 0 ); // spare2 + aStream.WriteInt32L( 0 ); // spare3 + // + aStream.WriteUint8L( iDrive ); + aStream << iVector; + } + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/TMMCScBkupDriveAndSize.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/TMMCScBkupDriveAndSize.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TMMCScBkupDriveAndSize implementation +* +* +*/ + +#include "TMMCScBkupDriveAndSize.h" + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// TMMCScBkupDriveAndSize::InternalizeL() +// +// +// --------------------------------------------------------------------------- +void TMMCScBkupDriveAndSize::InternalizeL( RReadStream& aStream ) + { + aStream.ReadInt32L(); // EStreamFormatVersion1 + aStream.ReadInt32L(); // spare1 + aStream.ReadInt32L(); // spare2 + // + iDrive = static_cast( aStream.ReadUint8L() ); + + iSize = aStream.ReadInt32L(); + // If 64-bit handling will be supported in the future. + // That will mean in practice a break in archive file format. + /* + if ( format == EStreamFormatVersion1 ) + { + iSize = aStream.ReadInt32L(); + } + else + { + iSize = aStream.ReadReal64L(); + } + */ + } + + +// --------------------------------------------------------------------------- +// TMMCScBkupDriveAndSize::ExternalizeL() +// +// +// --------------------------------------------------------------------------- +void TMMCScBkupDriveAndSize::ExternalizeL( RWriteStream& aStream ) const + { + aStream.WriteInt32L( EStreamFormatVersion1 ); + aStream.WriteInt32L( 0 ); // spare1 + aStream.WriteInt32L( 0 ); // spare2 + // + aStream.WriteUint8L( iDrive ); + aStream.WriteInt32L( iSize ); + //aStream.WriteReal64L( iSize ); // If 64-bit handling will be supported in the future. + // That will mean in practice a break in archive file format. + } + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupengine/src/TMMCScBkupDriveFilter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupengine/src/TMMCScBkupDriveFilter.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2005 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: TMMCScBkupDriveFilter implementation +* +* +*/ + +#include "TMMCScBkupDriveFilter.h" + +// Constants +const TInt KMMCScBkupInitialDriveIndex = -1; + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// TMMCScBkupDriveFilter::Reset() +// +// +// --------------------------------------------------------------------------- +void TMMCScBkupDriveFilter::Reset() + { + iCurrentDrive = KMMCScBkupInitialDriveIndex; + } + + +// --------------------------------------------------------------------------- +// TMMCScBkupDriveFilter::SetPrimaryDriveFilter() +// +// +// --------------------------------------------------------------------------- +void TMMCScBkupDriveFilter::SetPrimaryDriveFilter( const TDriveList& aDriveList ) + { + iPrimaryDriveList = aDriveList; + } + + +// --------------------------------------------------------------------------- +// TMMCScBkupDriveFilter::SetSecondaryDriveFilter() +// +// +// --------------------------------------------------------------------------- +void TMMCScBkupDriveFilter::SetSecondaryDriveFilter( const TDriveList& aDriveList ) + { + iSecondaryDriveList = aDriveList; + iHaveSecondaryList = ETrue; + } + + +// --------------------------------------------------------------------------- +// TMMCScBkupDriveFilter::NextValidDrive() +// +// +// --------------------------------------------------------------------------- +TBool TMMCScBkupDriveFilter::NextValidDrive( TDriveNumber& aDrive ) + { + // Always move to the next drive before checking its availability. + // FindValidDrive takes care of ensuring the value falls within A-Z + // range. + ++iCurrentDrive; + + // Do we have an available primary drive? + TBool driveAvailable = EFalse; + while( iCurrentDrive >= EDriveA && iCurrentDrive <= EDriveZ ) + { + TDriveNumber drive; + driveAvailable = FindValidDrive( iPrimaryDriveList, drive ); + if ( driveAvailable && iHaveSecondaryList ) + { + // Verify against secondary drive list also... + const TBool makeOnlyOneDirectAttempt = ETrue; + driveAvailable = FindValidDrive( iSecondaryDriveList, drive, makeOnlyOneDirectAttempt ); + } + else if (!driveAvailable) + { + // No more primary drives left, so we're done here. + break; + } + + // Did we find a match on (just) the primary drive, or then + // the primary and secondary drive lists combined? + if (driveAvailable) + { + // Yes, match found - we're finished here. + aDrive = drive; + break; + } + else + { + // Try to search for the next drive that matches both the + // primary and secondary lists (if supported) + ++iCurrentDrive; + } + } + // + return driveAvailable; + } + + +// --------------------------------------------------------------------------- +// TMMCScBkupDriveFilter::CurrentDrive() +// +// +// --------------------------------------------------------------------------- +TDriveNumber TMMCScBkupDriveFilter::CurrentDrive() const + { + return static_cast< TDriveNumber >( iCurrentDrive ); + } + + +// --------------------------------------------------------------------------- +// TMMCScBkupDriveFilter::FindValidDrive() +// +// +// --------------------------------------------------------------------------- +TBool TMMCScBkupDriveFilter::FindValidDrive( const TDriveList& aList, TDriveNumber& aDrive, TBool aOneAttemptOnly ) + { + // If we've already reached Z then there isn't any sense in continuing + // as all drives have been processed. + TBool driveAvailable = EFalse; + + // Keep checking drives until we go past Z + while( iCurrentDrive >= EDriveA && iCurrentDrive <= EDriveZ ) + { + if ( aList[ iCurrentDrive ] != 0 ) + { + // Found an available drive + aDrive = static_cast< TDriveNumber >( iCurrentDrive ); + driveAvailable = ETrue; + break; + } + else if ( aOneAttemptOnly ) + { + break; + } + + // Try next drive + ++iCurrentDrive; + } + // + return driveAvailable; + } + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/bwins/fmbkupenginewrapperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/bwins/fmbkupenginewrapperu.def Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,69 @@ +EXPORTS + ??0FmRestoreSettings@@QAE@AAVFmBkupEngine@@@Z @ 1 NONAME ; FmRestoreSettings::FmRestoreSettings(class FmBkupEngine &) + ?tr@FmBkupEngine@@SA?AVQString@@PBD0@Z @ 2 NONAME ; class QString FmBkupEngine::tr(char const *, char const *) + ?getStaticMetaObject@FmBkupEngine@@SAABUQMetaObject@@XZ @ 3 NONAME ; struct QMetaObject const & FmBkupEngine::getStaticMetaObject(void) + ?trUtf8@FmBkupEngine@@SA?AVQString@@PBD0H@Z @ 4 NONAME ; class QString FmBkupEngine::trUtf8(char const *, char const *, int) + ?error@FmBkupEngine@@QBEHXZ @ 5 NONAME ; int FmBkupEngine::error(void) const + ?availableTargetDrive@FmBackupSettings@@QBE?AVQString@@XZ @ 6 NONAME ; class QString FmBackupSettings::availableTargetDrive(void) const + ?GetSelectionL@FmRestoreSettings@@QBEXAAV?$QList@VFmRestoreInfo@@@@@Z @ 7 NONAME ; void FmRestoreSettings::GetSelectionL(class QList &) const + ?content@FmBackupSettings@@QBEIXZ @ 8 NONAME ; unsigned int FmBackupSettings::content(void) const + ?getBackupDriveList@FmBkupEngine@@QAEXAAVQStringList@@@Z @ 9 NONAME ; void FmBkupEngine::getBackupDriveList(class QStringList &) + ?resetAndDestoryRestoreEntry@FmRestoreSettings@@AAEXXZ @ 10 NONAME ; void FmRestoreSettings::resetAndDestoryRestoreEntry(void) + ?targetDriveToString@FmBackupSettings@@QAE?AVQString@@ABV2@@Z @ 11 NONAME ; class QString FmBackupSettings::targetDriveToString(class QString const &) + ?setScheduling@FmBackupSettings@@QAEXW4TFileManagerBackupSchedule@1@@Z @ 12 NONAME ; void FmBackupSettings::setScheduling(enum FmBackupSettings::TFileManagerBackupSchedule) + ?notifyFinish@FmBkupEngine@@IAEXH@Z @ 13 NONAME ; void FmBkupEngine::notifyFinish(int) + ?qt_metacast@FmBkupEngine@@UAEPAXPBD@Z @ 14 NONAME ; void * FmBkupEngine::qt_metacast(char const *) + ??0FmBackupSettings@@QAE@PAVFmBkupEngine@@@Z @ 15 NONAME ; FmBackupSettings::FmBackupSettings(class FmBkupEngine *) + ?SetSelection@FmRestoreSettings@@QAEXAB_K@Z @ 16 NONAME ; void FmRestoreSettings::SetSelection(unsigned long long const &) + ?startBackup@FmBkupEngine@@QAE_NV?$QList@PAVFmBkupDrivesAndOperation@@@@V?$QList@PAVFmBkupBackupCategory@@@@VQString@@I@Z @ 17 NONAME ; bool FmBkupEngine::startBackup(class QList, class QList, class QString, unsigned int) + ?notifyMemoryLow@FmBkupEngine@@IAEXHAAH@Z @ 18 NONAME ; void FmBkupEngine::notifyMemoryLow(int, int &) + ?CreateEntry@FmRestoreSettings@@AAEPAVFmRestoreEntry@@ABVFmRestoreInfo@@@Z @ 19 NONAME ; class FmRestoreEntry * FmRestoreSettings::CreateEntry(class FmRestoreInfo const &) + ?startRestore@FmBkupEngine@@QAE_NV?$QList@PAVFmBkupDrivesAndOperation@@@@@Z @ 20 NONAME ; bool FmBkupEngine::startRestore(class QList) + ?resetAndDestoryBackupEntry@FmBackupSettings@@AAEXXZ @ 21 NONAME ; void FmBackupSettings::resetAndDestoryBackupEntry(void) + ?weekdayToString@FmBackupSettings@@SA?AVQString@@W4TFileManagerBackupWeekday@1@@Z @ 22 NONAME ; class QString FmBackupSettings::weekdayToString(enum FmBackupSettings::TFileManagerBackupWeekday) + ?tr@FmBkupEngine@@SA?AVQString@@PBD0H@Z @ 23 NONAME ; class QString FmBkupEngine::tr(char const *, char const *, int) + ?contentToString@FmBackupSettings@@SA?AVQString@@I@Z @ 24 NONAME ; class QString FmBackupSettings::contentToString(unsigned int) + ?RestoreSettingsL@FmBkupEngine@@QAEPAVFmRestoreSettings@@XZ @ 25 NONAME ; class FmRestoreSettings * FmBkupEngine::RestoreSettingsL(void) + ?createBackupDateEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 26 NONAME ; class FmBackupEntry * FmBackupSettings::createBackupDateEntry(void) + ?GetRestoreInfoArray@FmBkupEngine@@QAEXAAV?$QList@PAVFmBkupDrivesAndOperation@@@@AAV?$QList@VFmRestoreInfo@@@@ABVQString@@@Z @ 27 NONAME ; void FmBkupEngine::GetRestoreInfoArray(class QList &, class QList &, class QString const &) + ?time@FmBackupSettings@@QBEABVQTime@@XZ @ 28 NONAME ; class QTime const & FmBackupSettings::time(void) const + ?createWeekdayEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 29 NONAME ; class FmBackupEntry * FmBackupSettings::createWeekdayEntry(void) + ?cancelBackup@FmBkupEngine@@QAEXXZ @ 30 NONAME ; void FmBkupEngine::cancelBackup(void) + ?notifyUpdate@FmBkupEngine@@IAEXH@Z @ 31 NONAME ; void FmBkupEngine::notifyUpdate(int) + ?save@FmBackupSettings@@QAEXXZ @ 32 NONAME ; void FmBackupSettings::save(void) + ??_EFmBkupEngine@@UAE@I@Z @ 33 NONAME ; FmBkupEngine::~FmBkupEngine(unsigned int) + ?restoreEntryList@FmRestoreSettings@@QAE?AV?$QList@PAVFmRestoreEntry@@@@XZ @ 34 NONAME ; class QList FmRestoreSettings::restoreEntryList(void) + ?createTimeEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 35 NONAME ; class FmBackupEntry * FmBackupSettings::createTimeEntry(void) + ?weekday@FmBackupSettings@@QBE?AW4TFileManagerBackupWeekday@1@XZ @ 36 NONAME ; enum FmBackupSettings::TFileManagerBackupWeekday FmBackupSettings::weekday(void) const + ?deleteBackup@FmBkupEngine@@QAEHV?$QList@PAVFmBkupDrivesAndOperation@@@@@Z @ 37 NONAME ; int FmBkupEngine::deleteBackup(class QList) + ??1FmBackupSettings@@QAE@XZ @ 38 NONAME ; FmBackupSettings::~FmBackupSettings(void) + ?setTime@FmBackupSettings@@QAEXABVQTime@@@Z @ 39 NONAME ; void FmBackupSettings::setTime(class QTime const &) + ?backupEntryList@FmBackupSettings@@QAE?AV?$QList@PAVFmBackupEntry@@@@XZ @ 40 NONAME ; class QList FmBackupSettings::backupEntryList(void) + ?contentsSelected@FmBackupSettings@@ABEHXZ @ 41 NONAME ; int FmBackupSettings::contentsSelected(void) const + ?refreshList@FmBackupSettings@@AAEXXZ @ 42 NONAME ; void FmBackupSettings::refreshList(void) + ?trUtf8@FmBkupEngine@@SA?AVQString@@PBD0@Z @ 43 NONAME ; class QString FmBkupEngine::trUtf8(char const *, char const *) + ?CreateEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@ABVQString@@0W4TSettingType@2@@Z @ 44 NONAME ; class FmBackupEntry * FmBackupSettings::CreateEntry(class QString const &, class QString const &, enum FmBackupEntry::TSettingType) + ?targetDrive@FmBackupSettings@@QBE?AVQString@@XZ @ 45 NONAME ; class QString FmBackupSettings::targetDrive(void) const + ??0FmBkupEngine@@QAE@PAVQObject@@@Z @ 46 NONAME ; FmBkupEngine::FmBkupEngine(class QObject *) + ?notifyPreparing@FmBkupEngine@@IAEX_N@Z @ 47 NONAME ; void FmBkupEngine::notifyPreparing(bool) + ?load@FmRestoreSettings@@QAEXV?$QList@PAVFmBkupDrivesAndOperation@@@@@Z @ 48 NONAME ; void FmRestoreSettings::load(class QList) + ?setWeekday@FmBackupSettings@@QAEXW4TFileManagerBackupWeekday@1@@Z @ 49 NONAME ; void FmBackupSettings::setWeekday(enum FmBackupSettings::TFileManagerBackupWeekday) + ??1FmRestoreSettings@@QAE@XZ @ 50 NONAME ; FmRestoreSettings::~FmRestoreSettings(void) + ?createContentsEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 51 NONAME ; class FmBackupEntry * FmBackupSettings::createContentsEntry(void) + ?notifyBackupFilesExist@FmBkupEngine@@IAEXAA_N@Z @ 52 NONAME ; void FmBkupEngine::notifyBackupFilesExist(bool &) + ?updateBackupDate@FmBackupSettings@@QAEXXZ @ 53 NONAME ; void FmBackupSettings::updateBackupDate(void) + ?createSchedulingEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 54 NONAME ; class FmBackupEntry * FmBackupSettings::createSchedulingEntry(void) + ?metaObject@FmBkupEngine@@UBEPBUQMetaObject@@XZ @ 55 NONAME ; struct QMetaObject const * FmBkupEngine::metaObject(void) const + ?createTargetDriveEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 56 NONAME ; class FmBackupEntry * FmBackupSettings::createTargetDriveEntry(void) + ?load@FmBackupSettings@@QAEXXZ @ 57 NONAME ; void FmBackupSettings::load(void) + ??1FmBkupEngine@@UAE@XZ @ 58 NONAME ; FmBkupEngine::~FmBkupEngine(void) + ?BackupSettingsL@FmBkupEngine@@QAEPAVFmBackupSettings@@XZ @ 59 NONAME ; class FmBackupSettings * FmBkupEngine::BackupSettingsL(void) + ?setContent@FmBackupSettings@@QAEXI@Z @ 60 NONAME ; void FmBackupSettings::setContent(unsigned int) + ?schedulingToString@FmBackupSettings@@QAE?AVQString@@W4TFileManagerBackupSchedule@1@@Z @ 61 NONAME ; class QString FmBackupSettings::schedulingToString(enum FmBackupSettings::TFileManagerBackupSchedule) + ?setTargetDrive@FmBackupSettings@@QAEXABVQString@@@Z @ 62 NONAME ; void FmBackupSettings::setTargetDrive(class QString const &) + ?staticMetaObject@FmBkupEngine@@2UQMetaObject@@B @ 63 NONAME ; struct QMetaObject const FmBkupEngine::staticMetaObject + ?refreshList@FmRestoreSettings@@AAEXAAV?$QList@PAVFmBkupDrivesAndOperation@@@@@Z @ 64 NONAME ; void FmRestoreSettings::refreshList(class QList &) + ?notifyStart@FmBkupEngine@@IAEX_NH@Z @ 65 NONAME ; void FmBkupEngine::notifyStart(bool, int) + ?scheduling@FmBackupSettings@@QBE?AW4TFileManagerBackupSchedule@1@XZ @ 66 NONAME ; enum FmBackupSettings::TFileManagerBackupSchedule FmBackupSettings::scheduling(void) const + ?qt_metacall@FmBkupEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 67 NONAME ; int FmBkupEngine::qt_metacall(enum QMetaObject::Call, int, void * *) + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/eabi/fmbkupenginewrapperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/eabi/fmbkupenginewrapperu.def Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,73 @@ +EXPORTS + _ZN12FmBkupEngine11notifyStartEbi @ 1 NONAME + _ZN12FmBkupEngine11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME + _ZN12FmBkupEngine11qt_metacastEPKc @ 3 NONAME + _ZN12FmBkupEngine11startBackupE5QListIP24FmBkupDrivesAndOperationES0_IP20FmBkupBackupCategoryE7QStringj @ 4 NONAME + _ZN12FmBkupEngine12cancelBackupEv @ 5 NONAME + _ZN12FmBkupEngine12deleteBackupE5QListIP24FmBkupDrivesAndOperationE @ 6 NONAME + _ZN12FmBkupEngine12notifyFinishEi @ 7 NONAME + _ZN12FmBkupEngine12notifyUpdateEi @ 8 NONAME + _ZN12FmBkupEngine12startRestoreE5QListIP24FmBkupDrivesAndOperationE @ 9 NONAME + _ZN12FmBkupEngine15BackupSettingsLEv @ 10 NONAME + _ZN12FmBkupEngine15notifyMemoryLowEiRi @ 11 NONAME + _ZN12FmBkupEngine15notifyPreparingEb @ 12 NONAME + _ZN12FmBkupEngine16RestoreSettingsLEv @ 13 NONAME + _ZN12FmBkupEngine16staticMetaObjectE @ 14 NONAME DATA 16 + _ZN12FmBkupEngine18getBackupDriveListER11QStringList @ 15 NONAME + _ZN12FmBkupEngine19GetRestoreInfoArrayER5QListIP24FmBkupDrivesAndOperationERS0_I13FmRestoreInfoERK7QString @ 16 NONAME + _ZN12FmBkupEngine19getStaticMetaObjectEv @ 17 NONAME + _ZN12FmBkupEngine22notifyBackupFilesExistERb @ 18 NONAME + _ZN12FmBkupEngineC1EP7QObject @ 19 NONAME + _ZN12FmBkupEngineC2EP7QObject @ 20 NONAME + _ZN12FmBkupEngineD0Ev @ 21 NONAME + _ZN12FmBkupEngineD1Ev @ 22 NONAME + _ZN12FmBkupEngineD2Ev @ 23 NONAME + _ZN16FmBackupSettings10setContentEj @ 24 NONAME + _ZN16FmBackupSettings10setWeekdayENS_25TFileManagerBackupWeekdayE @ 25 NONAME + _ZN16FmBackupSettings11CreateEntryERK7QStringS2_N13FmBackupEntry12TSettingTypeE @ 26 NONAME + _ZN16FmBackupSettings11refreshListEv @ 27 NONAME + _ZN16FmBackupSettings13setSchedulingENS_26TFileManagerBackupScheduleE @ 28 NONAME + _ZN16FmBackupSettings14setTargetDriveERK7QString @ 29 NONAME + _ZN16FmBackupSettings15backupEntryListEv @ 30 NONAME + _ZN16FmBackupSettings15contentToStringEj @ 31 NONAME + _ZN16FmBackupSettings15createTimeEntryEv @ 32 NONAME + _ZN16FmBackupSettings15weekdayToStringENS_25TFileManagerBackupWeekdayE @ 33 NONAME + _ZN16FmBackupSettings16updateBackupDateEv @ 34 NONAME + _ZN16FmBackupSettings18createWeekdayEntryEv @ 35 NONAME + _ZN16FmBackupSettings18schedulingToStringENS_26TFileManagerBackupScheduleE @ 36 NONAME + _ZN16FmBackupSettings19createContentsEntryEv @ 37 NONAME + _ZN16FmBackupSettings19targetDriveToStringERK7QString @ 38 NONAME + _ZN16FmBackupSettings21createBackupDateEntryEv @ 39 NONAME + _ZN16FmBackupSettings21createSchedulingEntryEv @ 40 NONAME + _ZN16FmBackupSettings22createTargetDriveEntryEv @ 41 NONAME + _ZN16FmBackupSettings26resetAndDestoryBackupEntryEv @ 42 NONAME + _ZN16FmBackupSettings4loadEv @ 43 NONAME + _ZN16FmBackupSettings4saveEv @ 44 NONAME + _ZN16FmBackupSettings7setTimeERK5QTime @ 45 NONAME + _ZN16FmBackupSettingsC1EP12FmBkupEngine @ 46 NONAME + _ZN16FmBackupSettingsC2EP12FmBkupEngine @ 47 NONAME + _ZN16FmBackupSettingsD1Ev @ 48 NONAME + _ZN16FmBackupSettingsD2Ev @ 49 NONAME + _ZN17FmRestoreSettings11CreateEntryERK13FmRestoreInfo @ 50 NONAME + _ZN17FmRestoreSettings11refreshListER5QListIP24FmBkupDrivesAndOperationE @ 51 NONAME + _ZN17FmRestoreSettings12SetSelectionERKy @ 52 NONAME + _ZN17FmRestoreSettings16restoreEntryListEv @ 53 NONAME + _ZN17FmRestoreSettings27resetAndDestoryRestoreEntryEv @ 54 NONAME + _ZN17FmRestoreSettings4loadE5QListIP24FmBkupDrivesAndOperationE @ 55 NONAME + _ZN17FmRestoreSettingsC1ER12FmBkupEngine @ 56 NONAME + _ZN17FmRestoreSettingsC2ER12FmBkupEngine @ 57 NONAME + _ZN17FmRestoreSettingsD1Ev @ 58 NONAME + _ZN17FmRestoreSettingsD2Ev @ 59 NONAME + _ZNK12FmBkupEngine10metaObjectEv @ 60 NONAME + _ZNK12FmBkupEngine5errorEv @ 61 NONAME + _ZNK16FmBackupSettings10schedulingEv @ 62 NONAME + _ZNK16FmBackupSettings11targetDriveEv @ 63 NONAME + _ZNK16FmBackupSettings16contentsSelectedEv @ 64 NONAME + _ZNK16FmBackupSettings20availableTargetDriveEv @ 65 NONAME + _ZNK16FmBackupSettings4timeEv @ 66 NONAME + _ZNK16FmBackupSettings7contentEv @ 67 NONAME + _ZNK16FmBackupSettings7weekdayEv @ 68 NONAME + _ZNK17FmRestoreSettings13GetSelectionLER5QListI13FmRestoreInfoE @ 69 NONAME + _ZTI12FmBkupEngine @ 70 NONAME + _ZTV12FmBkupEngine @ 71 NONAME + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/fmbkupenginewrapper.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/fmbkupenginewrapper.pri Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,46 @@ +# +# 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: FmBkupEngineWrapper project - source files +# + +INCLUDEPATH += ./inc +INCLUDEPATH += ../common +win32:INCLUDEPATH += ./private/win32 +symbian { + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + INCLUDEPATH += /epoc32/include/connect + INCLUDEPATH += ./private/symbian + INCLUDEPATH += ../fmbkupengine/inc +} + +HEADERS += inc/fmbkupengine.h \ + inc/fmbkupcommon.h \ + inc/fmbackupsettings.h \ + inc/fmrestoresettings.h \ + + +SOURCES += src/fmbkupengine.cpp \ + src/fmbackupsettings.cpp \ + src/fmrestoresettings.cpp \ + +win32 { + HEADERS += private/win32/fmbkupengine_p.h + SOURCES += private/win32/fmbkupengine_p.cpp +} + +symbian { + HEADERS += inc/FileManagerPrivateCRKeys.h \ + private/symbian/fmbkupengine_p.h + SOURCES += private/symbian/fmbkupengine_p.cpp +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/fmbkupenginewrapper.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/fmbkupenginewrapper.pro Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,41 @@ +# +# 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: The project file of FmBkupEngineWrapper +# + +CONFIG += hb +TARGET = +TEMPLATE = lib +QT = core +DEFINES += FMBKUPENGINE_LIBRARY + +include ( ../common.pri ) +include ( ../inc/commoninc.pri ) +include ( fmbkupenginewrapper.pri ) + +symbian { + TARGET.UID3 = 0x2002BCC1 + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.CAPABILITY = CAP_GENERAL_DLL DiskAdmin AllFiles PowerMgmt + TARGET.VID = VID_DEFAULT + LIBS += -lfmbkupengine + LIBS += -lefsrv + LIBS += -lavkon + LIBS += -leikctl + LIBS += -leikcore + LIBS += -lcone + LIBS += -lsysutil + LIBS += -lplatformenv +} + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/inc/filemanagerprivatecrkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/inc/filemanagerprivatecrkeys.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,100 @@ +/* + * 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: + * The header file of the backup const configuration + */ + + +#ifndef FILEMANAGERPRIVATECRKEYS_H +#define FILEMANAGERPRIVATECRKEYS_H + + +/** File manager repository uid */ +const TUid KCRUidFileManagerSettings = { 0x1020506B }; + +/** Defines the backup content */ +const TUint32 KFileManagerBackupContent = 0x1; + +/** Defines the backup scheduling mode */ +const TUint32 KFileManagerBackupScheduling = 0x2; + +/** Contains the possible values of KFileManagerBackupScheduling key. */ +enum TFileManagerBackupSchedule + { + EFileManagerBackupScheduleNone = 0, + EFileManagerBackupScheduleDaily, + EFileManagerBackupScheduleWeekly + }; + +/** Defines the scheduled backup weekday. See day definitions from TDay. + * Negative value means the first day of the week. + */ +const TUint32 KFileManagerBackupDay = 0x3; + +/** Defines the scheduled backup time in minutes starting from 00:00 midnight */ +const TUint32 KFileManagerBackupTime = 0x4; + +/** Defines the backup target path as string */ +const TUint32 KFileManagerBackupTargetPath = 0x5; + +/** Defines the status of the last scheduled backup */ +const TUint32 KFileManagerLastSchBackupStatus = 0x6; + +/** Contains the possible values of KFileManagerLastSchBackupStatus key. */ +enum TFileManagerSchBackupStatus + { + EFileManagerSchBackupStatusOk = 0, + EFileManagerSchBackupStatusFailed, + EFileManagerSchBackupStatusStarting, + EFileManagerSchBackupStatusInProgress, + EFileManagerSchBackupStatusCanceled + }; + +/** Defines file manager local variation configuration */ +const TUint32 KFileManagerFeatures = 0x7; + +/** Contains the possible bitmask values of KFileManagerFeatures key. */ +enum TFileManagerFeatures + { + EFileManagerFeatureBackupAllowAllDrives = 0x1, + EFileManagerFeatureNotUsedAnymore = 0x2, + EFileManagerFeatureRightLeftNaviSupported = 0x4, + EFileManagerFeatureScheduledBackupDisabled = 0x8 + }; + +/** Defines the file manager application to be launched for the AIW service. +The value of this key is an application UID or zero. */ +const TUint32 KFileManagerAppUidForAiwService = 0x8; + +/** Defines default volume name for non user nameable mass storage. +The default name will be used after format only if the stored volume name is undefined +for the drive. The name is visible only in Windows Explorer during USB mass storage mode and +in 3rd party File Manager(s). */ +const TUint32 KFileManagerDefaultInternalMassStorageVolumeName = 0x9; + +/** Defines a store for keeping existing non user nameable mass storage volume name over +format operation. The data is stored in binary as TFileManagerVolumeNameStore. */ +const TUint32 KFileManagerStoredInternalMassStorageVolumeName = 0xA; + +enum TFileManagerBkupStatusType + { + EFileManagerBkupStatusUnset = 0x00000000, + EFileManagerBkupStatusBackup = 0x00000001, + EFileManagerBkupStatusRestore = 0x00000002 + }; + +#endif // FILEMANAGERPRIVATECRKEYS_H + +// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/inc/fmbackupsettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/inc/fmbackupsettings.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,358 @@ +/* + * 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: + * The header file of the backup seetings of file manager + */ +#ifndef FMBACKUPSETTINGS_H +#define FMBACKUPSETTINGS_H + +#include "fmbkupengine_global.h" + +#include +#include +#include + +#include + +class FmBkupEngine; + +// CLASS DECLARATION +/** + * This class is used for storing backup entry which used in backup view + * Each row in backup view is a single entry + * + */ +class FmBackupEntry +{ +public: + /** Backup setting type */ + enum TSettingType + { + ENone = 0, + EContents, + EScheduling, + EWeekday, + ETime, + ETarget, + EBackupdate + }; + +public: + FmBackupEntry( const QString& title, const QString& tips, const TSettingType type ) : + mTitle( title ), mTips( tips ), mType( type ) + { + } + ~FmBackupEntry( void ) + { + } + + FmBackupEntry( const FmBackupEntry &other ) + { + mTitle = other.mTitle; + mTips = other.mTips; + mType = other.mType; + } + + FmBackupEntry &operator =( const FmBackupEntry &other ) + { + if( this == &other ){ + return *this; + } + + mTitle = other.mTitle; + mTips = other.mTips; + mType = other.mType; + return *this; + } + + QString title() + { + return mTitle; + } + + QString tips() + { + return mTips; + } + + FmBackupEntry::TSettingType type() + { + return mType; + } + + +private: + /** + * first label for item in backup view + */ + QString mTitle; + + /** + * second label for item in backup view + */ + QString mTips; + + /** + * type for item in backup view + */ + TSettingType mType; +}; + +// CLASS DECLARATION +/** + * This class is used for storing backup settings + * + */ +class FMBKUPENGINE_EXPORT FmBackupSettings +{ +public: + enum TFileManagerBackupContentMask + { + EFileManagerBackupContentAll = 0x1, + EFileManagerBackupContentSettings = 0x2, + EFileManagerBackupContentMessages = 0x4, + EFileManagerBackupContentContacts = 0x8, + EFileManagerBackupContentCalendar = 0x10, + EFileManagerBackupContentBookmarks = 0x20, + EFileManagerBackupContentUserFiles = 0x40, + EFileManagerBackupContentFirst = 0x2, + EFileManagerBackupContentLast = 0x40 + }; + + /** Contains the possible values of KFileManagerBackupScheduling key. */ + enum TFileManagerBackupSchedule + { + EFileManagerBackupScheduleNever = 0, + EFileManagerBackupScheduleDaily, + EFileManagerBackupScheduleWeekly + }; + + /** Contains the possible values of KFileManagerBackupScheduling key. */ + enum TFileManagerBackupWeekday + { + EFileManagerBackupWeekdayMonday = 0, + EFileManagerBackupWeekdayTuesday, + EFileManagerBackupWeekdayWednesday, + EFileManagerBackupWeekdayThursday, + EFileManagerBackupWeekdayFriday, + EFileManagerBackupWeekdaySaturday, + EFileManagerBackupWeekdaySunday, + }; + +public: + explicit FmBackupSettings( FmBkupEngine *aFmBkupEngine ); + ~FmBackupSettings( void ); + + + /** + * Sets backup contents + * @param aContent Content bitmask + */ + void setContent( const quint32 aContent ); + + /** + * Sets backup scheduling + * @param aScheduling Scheduling type + */ + void setScheduling( const TFileManagerBackupSchedule aScheduling ); + + /** + * Sets backup weekday + * @param weekday Backup weekday + */ + void setWeekday( const TFileManagerBackupWeekday weekday ); + + /** + * Sets backup time + * @param aTime Time from 00:00 + */ + void setTime( const QTime& aTime ); + + /** + * Sets backup target drive + * @param aDrive Target drive (See TDriveNumber) + */ + void setTargetDrive( const QString& aDrive ); + + /** + * Gets backup contents + * @return Content bitmask + * @see TFileManagerBackupContentMask + */ + quint32 content() const; + + /** + * Gets backup scheduling + * @return Scheduling type + */ + FmBackupSettings::TFileManagerBackupSchedule scheduling() const; + + /** + * Gets backup weekday + * @return Backup weekday + */ + FmBackupSettings::TFileManagerBackupWeekday weekday() const; + + /** + * Gets backup time + * @return Backup time + */ + const QTime& time() const; + + /** + * Gets backup target drive + * @return Backup time + */ + QString targetDrive() const; + + /** + * Gets available backup target drive + * if targetDrive exist, return targetDrive + * otherwise return other first available backup drive + * @return Available backup target drive, empty QString for null + */ + QString availableTargetDrive() const; + + /** + * Loads saved backup settings + */ + void load(); + + /** + * Saves backup settings + */ + void save(); + + /** + * get backup entry list + * @return backup entry list + */ + QList< FmBackupEntry* > backupEntryList(); + + /** + * Gets String from single content bit + * @param aContent content bit + * @return Textid + */ + static QString contentToString( const quint32 content ); + + + /** + * Gets String from weekday + * @param weekday + * @return string + */ + static QString weekdayToString( const TFileManagerBackupWeekday weekday ); + + /** + * Gets String from scheduling + * @param scheduling + * @return string + */ + QString schedulingToString( const TFileManagerBackupSchedule scheduling ); + /** + * Gets String from targetDrive + * @param targetDrive drive name string + * @return string + */ + QString targetDriveToString( const QString& targetDrive ); + + /** + * Updates the backup date + */ + void updateBackupDate(); +private: + /** + * Gets the count of contents selected + */ + int contentsSelected() const; + + FmBackupEntry* CreateEntry( const QString& title, const QString& tips, const FmBackupEntry::TSettingType type ); + + /////////////////////////////////////////////////////////////////////// + /** + * Creates backup setting entry from all contents bit + */ + FmBackupEntry* createContentsEntry(); + + /** + * Creates backup setting entry from scheduling + */ + FmBackupEntry* createSchedulingEntry(); + + /** + * Creates backup setting entry from weekday + */ + FmBackupEntry* createWeekdayEntry(); + + /** + * Creates backup setting entry from time + */ + FmBackupEntry* createTimeEntry(); + + /** + * Creates backup setting entry from time + */ + FmBackupEntry* createTargetDriveEntry(); + + /** + * Creates backup date entry + */ + FmBackupEntry* createBackupDateEntry(); + + void refreshList(); + void resetAndDestoryBackupEntry(); +private: + /** + * Content bitmask + * @see TFileManagerBackupContentMask + */ + quint32 mContent; + + /** + * Scheduling type + */ + TFileManagerBackupSchedule mScheduling; + + /** + * Scheduled backup weekday + */ + TFileManagerBackupWeekday mWeekday; + + /** + * Scheduled backup time from 00:00 + */ + QTime mTime; + + /** + * Backup target drive + */ + QString mTargetDrive; + + /** + * Backup date + */ + QDate mDate; + + /** + * Backup setting list items + */ + QList< FmBackupEntry* > mBackupEntryList; + + + FmBkupEngine *mBkupEngine; +}; + +#endif //FMBACKUPSETTINGS_H diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/inc/fmbkupcommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/inc/fmbkupcommon.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,404 @@ +/* + * 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: + * The header file of the backup common class + */ + +#ifndef FMBKUPCOMMON_H +#define FMBKUPCOMMON_H + + +//#define KFileManagerUID3 0x101F84EB + +namespace FmBkupEngineCommon +{ + +enum TFileManagerBackupContentMask + { + EFileManagerBackupContentAll = 0x1, + EFileManagerBackupContentSettings = 0x2, + EFileManagerBackupContentMessages = 0x4, + EFileManagerBackupContentContacts = 0x8, + EFileManagerBackupContentCalendar = 0x10, + EFileManagerBackupContentBookmarks = 0x20, + EFileManagerBackupContentUserFiles = 0x40, + EFileManagerBackupContentFirst = 0x2, + EFileManagerBackupContentLast = 0x40 + }; + + + // Partial backup categories bitmask values + enum MAEngineBackupCategories + { + EBUCatSettings = 0x1, + EBUCatMessages = 0x2, + EBUCatContacts = 0x4, + EBUCatCalendar = 0x8, + EBUCatBookmarks = 0x10, + EBUCatUserFiles = 0x20, + EBUCatAllInOne = 0x8000000, + EBUCatAllSeparately = 0x7FFFFFF + // Set as 0xFFFFFFF (EBUCatAllInOne+EBUCatAllSeparately) if archive containing + // data from all data owners needs to be created. + }; + + // Bitmask values for special ruling of which category data owner belongs to + enum MAEngineBackupCatSpecFlag + { + EBUCatSpecNone = 0x0, + EBUCatSpecSystem = 0x1, + EBUCatSpecJava = 0x2, + EBUCatSpecPublic = 0x4, + EBUCatSpecAll = 0x8 + }; + + // Defines drive caterories for multiple drives to setup backup sources and restore targets + enum MAEngineBackupDriveType + { + EBkupDeviceMemories = 0x1, + EBkupInternalMassStorages = 0x2, + EBkupExternalMassStorages = 0x4 + }; + + enum TMMCScBkupOwnerDataType + { + // Relates to all data owners + EMMCScBkupOwnerDataTypeDataOwner = 0, + + // Relates to java data for a particular owner + EMMCScBkupOwnerDataTypeJavaData, + + // Relates to public data for a particular owner + EMMCScBkupOwnerDataTypePublicData, + + // Relates to system data for a particular owner + EMMCScBkupOwnerDataTypeSystemData, + + // Relates to active data for a particular owner + EMMCScBkupOwnerDataTypeActiveData, + + // Relates to passive data for a particular owner + EMMCScBkupOwnerDataTypePassiveData, + + // Always leave this last, don't assign it + // a value. Don't use it either! + EMMCScBkupOwnerDataTypeCount, + + // A generic 'any data type' value. Used by the drive-specific-request & + // data sizer. Not a real SBE data type, hence it appears after + // the last marker. + EMMCScBkupOwnerDataTypeAny + }; + + const QString const_Bkup_EBUCatSettings ( "EBUCatSettings" ); + const QString const_Bkup_EBUCatMessages ( "EBUCatMessages" ); + const QString const_Bkup_EBUCatContacts ( "EBUCatContacts" ); + const QString const_Bkup_EBUCatCalendar ( "EBUCatCalendar" ); + const QString const_Bkup_EBUCatBookmarks ( "EBUCatBookmarks" ); + const QString const_Bkup_EBUCatUserFiles ( "EBUCatUserFiles" ); + const QString const_Bkup_EBUCatAllInOne ( "EBUCatAllInOne" ); + const QString const_Bkup_EBUCatAllSeparately( "EBUCatAllSeparately" ); + + const QString const_bkup_EBUCatSpecNone ( "EBUCatSpecNone" ); + const QString const_bkup_EBUCatSpecSystem ( "EBUCatSpecSystem" ); + const QString const_bkup_EBUCatSpecJava ( "EBUCatSpecJava" ); + const QString const_bkup_EBUCatSpecPublic ( "EBUCatSpecPublic" ); + const QString const_bkup_EBUCatSpecAll ( "EBUCatSpecAll" ); + + const QString const_bkup_EBkupDeviceMemories( + "EBkupDeviceMemories" + ); + const QString const_bkup_EBkupInternalMassStorages( + "EBkupInternalMassStorages" + ); + const QString const_bkup_EBkupExternalMassStorages( + "EBkupExternalMassStorages" + ); + + const QString const_bkup_EMMCScBkupOwnerDataTypeDataOwner( + "EMMCScBkupOwnerDataTypeDataOwner" + ); + const QString const_bkup_EMMCScBkupOwnerDataTypeJavaData( + "EMMCScBkupOwnerDataTypeJavaData" + ); + const QString const_bkup_EMMCScBkupOwnerDataTypePublicData( + "EMMCScBkupOwnerDataTypePublicData" + ); + const QString const_bkup_EMMCScBkupOwnerDataTypeSystemData( + "EMMCScBkupOwnerDataTypeSystemData" + ); + const QString const_bkup_EMMCScBkupOwnerDataTypeActiveData( + "EMMCScBkupOwnerDataTypeActiveData" + ); + const QString const_bkup_EMMCScBkupOwnerDataTypePassiveData( + "EMMCScBkupOwnerDataTypePassiveData" + ); + +} + +class ConfigStringConverter +{ +public: + static unsigned int drivesAndOperations_DriveToUInt( bool* ok, QString paramString ) + { + unsigned int ret = 0; + *ok = false; + if ( paramString.contains( + FmBkupEngineCommon::const_bkup_EBkupDeviceMemories, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBkupDeviceMemories; + } + if ( paramString.contains( + FmBkupEngineCommon::const_bkup_EBkupInternalMassStorages, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBkupInternalMassStorages; + } + if ( paramString.contains( + FmBkupEngineCommon::const_bkup_EBkupExternalMassStorages, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBkupExternalMassStorages; + } + return ret; + } + + static unsigned int drivesAndOperations_TypeToUInt( + bool* ok, QString paramString ) + { + unsigned int ret = 0; + *ok = false; + if ( paramString.contains( + FmBkupEngineCommon::const_bkup_EMMCScBkupOwnerDataTypeDataOwner, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EMMCScBkupOwnerDataTypeDataOwner; + } + if ( paramString.contains( + FmBkupEngineCommon::const_bkup_EMMCScBkupOwnerDataTypeJavaData, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EMMCScBkupOwnerDataTypeJavaData; + } + if ( paramString.contains( + FmBkupEngineCommon::const_bkup_EMMCScBkupOwnerDataTypePublicData, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EMMCScBkupOwnerDataTypePublicData; + } + if ( paramString.contains( + FmBkupEngineCommon::const_bkup_EMMCScBkupOwnerDataTypeSystemData, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EMMCScBkupOwnerDataTypeSystemData; + } + if ( paramString.contains( + FmBkupEngineCommon::const_bkup_EMMCScBkupOwnerDataTypeActiveData, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EMMCScBkupOwnerDataTypeActiveData; + } + if ( paramString.contains( + FmBkupEngineCommon::const_bkup_EMMCScBkupOwnerDataTypePassiveData, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EMMCScBkupOwnerDataTypePassiveData; + } + return ret; + } + + static unsigned int backupCategory_CategoryToUInt( + bool* ok, QString paramString ) + { + unsigned int ret = 0; + *ok = false; + if ( paramString.contains( + FmBkupEngineCommon::const_Bkup_EBUCatSettings, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBUCatSettings; + } + if ( paramString.contains( + FmBkupEngineCommon::const_Bkup_EBUCatMessages, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBUCatMessages; + } + if ( paramString.contains( + FmBkupEngineCommon::const_Bkup_EBUCatContacts, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBUCatContacts; + } + if ( paramString.contains( + FmBkupEngineCommon::const_Bkup_EBUCatCalendar, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBUCatCalendar; + } + if ( paramString.contains( + FmBkupEngineCommon::const_Bkup_EBUCatBookmarks, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBUCatBookmarks; + } + if ( paramString.contains( + FmBkupEngineCommon::const_Bkup_EBUCatUserFiles, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBUCatUserFiles; + } + if ( paramString.contains( + FmBkupEngineCommon::const_Bkup_EBUCatAllInOne, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBUCatAllInOne; + } + if ( paramString.contains( + FmBkupEngineCommon::const_Bkup_EBUCatAllSeparately, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBUCatAllSeparately; + } + return ret; + } + + static unsigned int backupCategory_Special_flagsToUInt( + bool* ok, QString paramString ) + { + unsigned int ret = 0; + *ok = false; + if ( paramString.contains( + FmBkupEngineCommon::const_bkup_EBUCatSpecNone, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBUCatSpecNone; + } + if ( paramString.contains( + FmBkupEngineCommon::const_bkup_EBUCatSpecSystem, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBUCatSpecSystem; + } + if ( paramString.contains( + FmBkupEngineCommon::const_bkup_EBUCatSpecJava, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBUCatSpecJava; + } + if ( paramString.contains( + FmBkupEngineCommon::const_bkup_EBUCatSpecPublic, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBUCatSpecPublic; + } + if ( paramString.contains( + FmBkupEngineCommon::const_bkup_EBUCatSpecAll, + Qt::CaseInsensitive ) ){ + *ok = true; + ret |= FmBkupEngineCommon::EBUCatSpecAll; + } + return ret; + } +}; +class FmBkupDrivesAndOperation +{ +public: + FmBkupDrivesAndOperation(){} + FmBkupDrivesAndOperation( unsigned int drvCategories, unsigned int ownerDataType ); + FmBkupDrivesAndOperation( const FmBkupDrivesAndOperation &other ) + { + mDrvCategories = other.mDrvCategories; + mOwnerDataType = other.mOwnerDataType; + } + + void setDrvCategories( unsigned int drvCategories ){ mDrvCategories = drvCategories; } + void setOwnerDataType( unsigned int ownerDataType ){ mOwnerDataType = ownerDataType; } + + unsigned int drvCategories(){ return mDrvCategories; } + unsigned int ownerDataType(){ return mOwnerDataType; } +private: + unsigned int mDrvCategories; + unsigned int mOwnerDataType; +}; + +class FmBkupBackupCategory +{ +public: + FmBkupBackupCategory(){} + FmBkupBackupCategory( const FmBkupBackupCategory &other ) + { + mCategory = other.mCategory; + mArchive_name = other.mArchive_name; + mSpecial_flags = other.mSpecial_flags; + mExclude_special_flags = other.mExclude_special_flags; + mUids = other.mUids; + mExclude_uids = other.mExclude_uids; + } + ~FmBkupBackupCategory() + { + mUids.clear(); + mExclude_uids.clear(); + } + + void setCategory( unsigned int category ) + { + mCategory = category; + } + + void setArchive_name( QString archive_name ) + { + mArchive_name = archive_name; + } + + void setSpecial_flags( unsigned int special_flags ) + { + mSpecial_flags = special_flags; + } + + void setExclude_special_flags( unsigned int exclude_special_flags ) + { + mExclude_special_flags = exclude_special_flags; + } + + void addUids( unsigned int uid ) + { + mUids.append( uid); + } + + void addExclude_uids( unsigned int exclude_uid ) + { + mExclude_uids.append( exclude_uid ); + } + + unsigned int category() { return mCategory; } + QString archive_name() { return mArchive_name; } + unsigned int special_flags() { return mSpecial_flags; } + unsigned int exclude_special_flags() { return mExclude_special_flags; } + QList *uids() { return &mUids; } + QList *exclude_uids() { return &mExclude_uids; } + +private: + unsigned int mCategory; + QString mArchive_name; + unsigned int mSpecial_flags; + unsigned int mExclude_special_flags; + QList mUids; + QList mExclude_uids; +}; + + +#endif //FMBKUPCOMMON_H diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/inc/fmbkupengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/inc/fmbkupengine.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,109 @@ +/* + * 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: + * The header file of the backup engine from bkup engine wrapper + */ + + +#ifndef FMBKUPENGINE_H +#define FMBKUPENGINE_H + +// INCLUDES +#include +#include +#include "fmbkupengine_global.h" + +#include "fmdefine.h" + +// FORWARD DECLARATIONS +class FmBkupEnginePrivate; + + +class FmBkupDrivesAndOperation; +class FmBkupBackupCategory; +class FmRestoreInfo; + +class FmBackupSettings; +class FmRestoreSettings; + +// CLASS DECLARATION +class FMBKUPENGINE_EXPORT FmBkupEngine : public QObject +{ +Q_OBJECT +public: + + enum MAEngineBackupCategories + { + EBUCatSettings = 0x1, + EBUCatMessages = 0x2, + EBUCatContacts = 0x4, + EBUCatCalendar = 0x8, + EBUCatBookmarks = 0x10, + EBUCatUserFiles = 0x20, + EBUCatAllInOne = 0x8000000, + EBUCatAllSeparately = 0x7FFFFFF + // Set as 0xFFFFFFF (EBUCatAllInOne+EBUCatAllSeparately) if archive containing + // data from all data owners needs to be created. + }; + + + enum Process{ + ProcessNone = 0, + ProcessBackup, + ProcessRestore + }; + + FmBkupEngine(QObject* parent = 0); + ~FmBkupEngine(); + + + bool startBackup( QList drivesAndOperationList, + QList backupCategoryList, + QString drive, quint32 content); + + void cancelBackup(); + + bool startRestore( QList drivesAndOperationList ); + int deleteBackup( QList drivesAndOperationList ); + int error() const; + + FmBackupSettings* BackupSettingsL(); + FmRestoreSettings* RestoreSettingsL(); + + void GetRestoreInfoArray( QList &drivesAndOperationList, + QList< FmRestoreInfo > &restoreInfoList, + const QString& aDrive ); + + void getBackupDriveList( QStringList &driveList ); + +signals: + void notifyPreparing( bool cancelable ); + void notifyStart( bool cancelable, int totalCount ); + void notifyUpdate( int count ); + void notifyFinish( int err ); + void notifyMemoryLow( int memoryValue, int &userError ); + void notifyBackupFilesExist( bool &isContinue ); + +private: + friend class FmBkupEnginePrivate; + FmBkupEnginePrivate* d; + + FmBackupSettings *iBackupSettings; + FmRestoreSettings *iRestoreSettings; +}; + +#endif /*FMBKUPENGINE_H*/ + +// End of file diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/inc/fmbkupengine_global.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/inc/fmbkupengine_global.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,34 @@ +/* + * 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: + * The header file of the backup engine wrapper export MACRO + */ + +#ifndef FMBKUPENGINE_GLOBAL_H +#define FMBKUPENGINE_GLOBAL_H + +#include + +#if defined(FMBKUPENGINE_LIBRARY) +# define FMBKUPENGINE_EXPORT Q_DECL_EXPORT +#else +# if defined(FMBKUPENGINE_NO_LIBRARY) +# define FMBKUPENGINE_EXPORT +# else +# define FMBKUPENGINE_EXPORT Q_DECL_IMPORT +# endif +#endif + +#endif // FMBKUPENGINE_GLOBAL_H diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/inc/fmrestoresettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/inc/fmrestoresettings.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,186 @@ +/* + * 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: + * The header file of the restore settings of file manager + */ + +#ifndef FMRESTORESETTINGS_H +#define FMRESTORESETTINGS_H + +#include "fmbkupengine_global.h" + +#include +#include +#include + +class FmBkupDrivesAndOperation; +class FmBkupEngine; +// CLASS DECLARATION +/** + * This class is used for storing restore info + */ +class FmRestoreInfo +{ +public: + FmRestoreInfo( const quint32 content, const QDateTime &dateTime, const QString &drive ) : + mContent( content ), mDateTime ( dateTime ), mDrive ( drive ) + { + } + ~FmRestoreInfo( void ) + { + } + + quint32 content() const + { + return mContent; + } + + QDateTime dateTime() const + { + return mDateTime; + } + QString drive() const + { + return mDrive; + } + + FmRestoreInfo( const FmRestoreInfo &other ) + { + mContent = other.mContent; + mDateTime = other.mDateTime; + mDrive = other.mDrive; + } + + FmRestoreInfo &operator =( const FmRestoreInfo &other ) + { + if( this == &other ){ + return *this; + } + + mContent = other.mContent; + mDateTime = other.mDateTime; + mDrive = other.mDrive; + return *this; + } + +private: + quint32 mContent; /// single content mask id + QDateTime mDateTime; + QString mDrive; +}; + +// CLASS DECLARATION +/** + * This class is used for storing restore entry which used in restore view + * Each row in restore view is a single entry + */ +class FmRestoreEntry +{ +public: + FmRestoreEntry( const QString& text, const FmRestoreInfo& info ) : + mText( text ), mRestoreInfo( info ) + { + } + ~FmRestoreEntry( void ) + { + } + + FmRestoreEntry( const FmRestoreEntry &other ) : mRestoreInfo( other.mRestoreInfo ), mText( other.mText ) + { + } + + FmRestoreEntry &operator =( const FmRestoreEntry &other ) + { + if( this == &other ){ + return *this; + } + + mText = other.mText; + mRestoreInfo = other.mRestoreInfo; + return *this; + } + + QString text() const + { + return mText; + } + + FmRestoreInfo restoreInfo() const + { + return mRestoreInfo; + } + +private: + QString mText; /// display text + FmRestoreInfo mRestoreInfo; /// info +}; + +// CLASS DECLARATION +/** + * This class is used for storing resore settings which used in restore view + */ +class FMBKUPENGINE_EXPORT FmRestoreSettings +{ +public: + +public: + explicit FmRestoreSettings( FmBkupEngine& ); + ~FmRestoreSettings( void ); + + /* + * load and refresh data to entry list + */ + void load( QList drivesAndOperationList ); + + /** + * get restore entry list, please invoke load() first. + * @return restore entry list + */ + QList< FmRestoreEntry* > restoreEntryList(); + + void GetSelectionL( QList< FmRestoreInfo >& infoArray ) const; + void SetSelection( const quint64& aSelection ); + +private: + /** + * create restore entry that will be used in restore view. + */ + FmRestoreEntry* CreateEntry( const FmRestoreInfo &info ); + + /** + * delete memory in the entry list + */ + void resetAndDestoryRestoreEntry(); + + /* + * refresh data to entry list + */ + void refreshList( QList &drivesAndOperationList ); + +private: + /** + * Restore selection + */ + quint32 iSelection; + + /** + * Restore setting list items + */ + QList< FmRestoreEntry* > mRestoreEntryList; + + FmBkupEngine& mEngine; +}; + +#endif //FMRESTORESETTINGS_H diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,839 @@ +/* + * 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: + * The source file of the backup engine implement for symbian + */ + +#include "fmbkupengine_p.h" + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef RD_MULTIPLE_DRIVE +#include +#endif // RD_MULTIPLE_DRIVE +#include +#include +#include "CMMCScBkupEngine.h" +#include "MMCScBkupOperations.h" +#include "CMMCScBkupArchiveInfo.h" +#include "filemanagerprivatecrkeys.h" + +#include +#include + +#include "fmcommon.h" + +#include + +/* +#include "cfilemanageritemproperties.h" +#include "cfilemanagerbackupsettings.h" +#include "filemanagerprivatecrkeys.h" +#include "bkupengine.hrh" +#include "filemanagerdebug.h" +#include "cfilemanagercommondefinitions.h" +#include "filemanageruid.h" +#include "filemanagerprivatepskeys.h" +*/ + +const TInt KFmgrSystemDrive = EDriveC; + +FmBkupEnginePrivate::FmBkupEnginePrivate(FmBkupEngine* bkupEngine): q(bkupEngine), + iError( KErrNone ) +{ + iDrvAndOpList = new ( ELeave ) CArrayFixFlat ( 10 ) ; + iBkupCategoryList = new RPointerArray ( 10 ); + iFs.Connect(); + iBkupEngine = CMMCScBkupEngine::NewL( iFs ); +} + +FmBkupEnginePrivate::~FmBkupEnginePrivate() +{ + delete iDrvAndOpList; + + iBkupCategoryList->ResetAndDestroy(); + delete iBkupCategoryList; + + delete iBkupEngine; + iFs.Close(); +} + +TUint32 FmBkupEnginePrivate::FmgrToBkupMask( + const TUint32 aFmrgMask ) + { + TUint32 ret( 0 ); + + for( TInt i( 0 ); i < KMaskLookupLen; ++i ) + { + if ( ( aFmrgMask & FmBkupEngineCommon::EFileManagerBackupContentAll ) || + ( aFmrgMask & KMaskLookup[ i ].iFmgrMask ) ) + { + ret |= KMaskLookup[ i ].iBkupMask; + } + } + return ret; + } + +bool FmBkupEnginePrivate::startBackup(QList drivesAndOperationList, + QList backupCategoryList, + QString drive, quint32 content) +{ + FM_LOG( "FmBkupEnginePrivate::startBackup_with drive: " + drive + + "_number:" + QString::number(DriverNameToNumber( drive ))); + if( drive.isEmpty() ) { + iError = KErrPathNotFound; + FM_LOG( "FmBkupEnginePrivate::startBackup_with return with KErrPathNotFound because drive is empty" ); + return false; + } + QStringList backupableDriveList; + getBackupDriveList( backupableDriveList ); + if( !backupableDriveList.contains( drive, Qt::CaseInsensitive ) ) { + iError = KErrPathNotFound; + FM_LOG( "FmBkupEnginePrivate::startBackup_with return with KErrPathNotFound because drive is not available" ); + return false; + } + QString logString; + logString = "startBackup"; + FM_LOG( logString ); + iDrvAndOpList->Reset(); + iBkupCategoryList->ResetAndDestroy(); + + logString = "startBackup_driveroperation count:" + QString::number(drivesAndOperationList.count()); + FM_LOG( logString ); + + for( QList::iterator it = drivesAndOperationList.begin(); + it != drivesAndOperationList.end(); ++it ) { + FmBkupDrivesAndOperation* fmDrvAndOp = *it; + TBkupDrivesAndOperation drvAndOp; + drvAndOp.setOwnerDataType( fmDrvAndOp->ownerDataType() ); + drvAndOp.setDrvCategories( fmDrvAndOp->drvCategories() ); + iDrvAndOpList->AppendL( drvAndOp ); + } + + logString = "startBackup_backupCategoryList count:" + QString::number(backupCategoryList.count()); + FM_LOG( logString ); + + + for( QList::iterator it = backupCategoryList.begin(); + it != backupCategoryList.end(); ++it ) { + FmBkupBackupCategory* fmbkupCategory = *it; + CBkupCategory* category = CBkupCategory::NewL(); + + category->setCategory( fmbkupCategory->category() ); + + HBufC *archiveName = HBufC::NewL( fmbkupCategory->archive_name().length() ); + *archiveName = fmbkupCategory->archive_name().utf16(); + category->setArchive_name( *archiveName ); + delete archiveName; + + category->setSpecial_flags( fmbkupCategory->special_flags() ); + category->setExclude_special_flags( fmbkupCategory->exclude_special_flags() ); + + for( QList::const_iterator it = fmbkupCategory->uids()->begin(); + it != fmbkupCategory->uids()->end(); ++it ) { + unsigned int value = *it; + category->addUids( value ); + } + + + for( QList::const_iterator it = fmbkupCategory->exclude_uids()->begin(); + it != fmbkupCategory->exclude_uids()->end(); ++it ) { + unsigned int value = *it; //( *ex_uidsList )[i]; + category->addExclude_uids( value ); + } + + + iBkupCategoryList->AppendL( category ); + } + + TUint32 bkupContent( FmgrToBkupMask( content ) ); + //TUint32 bkupContent = 63; + + logString = "startBackup_new param"; + FM_LOG( logString ); + + CMMCScBkupOpParamsBackupFull* params = + CMMCScBkupOpParamsBackupFull::NewL( + iDrvAndOpList, + iBkupCategoryList, + TDriveNumber( DriverNameToNumber( drive ) ), + bkupContent ); + + mProcess = FmBkupEngine::ProcessBackup; + + + logString = "startBackup_param ok"; + FM_LOG( logString ); + + CCoeEnv* coeEnv = CCoeEnv::Static(); + CEikonEnv* eikonEnv = (STATIC_CAST(CEikonEnv*,coeEnv)); + eikonEnv->SetSystem(ETrue); + + logString = "startBackup_StartOperationL"; + FM_LOG( logString ); + + QList< FmRestoreInfo > restoreInfoList; + GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, drive ); + + for ( TInt i( 0 ); i < restoreInfoList.count(); ++i ) + { + bool toContinue = false; + FmRestoreInfo &info = restoreInfoList[ i ]; + TUint32 existContent( FmgrToBkupMask( info.content() ) ); + if ( bkupContent & existContent ) + { + notifyBackupFilesExistInternal( toContinue ); + if (!toContinue) + { + iError = KErrAlreadyExists; + return false; + } + else + { + break; + } + } + } + + + TRAPD( err, iBkupEngine->StartOperationL( + EMMCScBkupOperationTypeFullBackup, *this, params ) ); + + logString = "startBackup_end with error:" + QString::number(err) ; + FM_LOG( logString ); + return (err == KErrNone); +} + +void FmBkupEnginePrivate::cancelBackup() +{ + QString logString = "cancelBackup"; + FM_LOG(logString); + switch( mProcess ) + { + case FmBkupEngine::ProcessBackup: // FALLTHROUGH + case FmBkupEngine::ProcessRestore: + { +// PublishBurStatus( EFileManagerBkupStatusUnset ); + iBkupEngine->CancelOperation(); + break; + } + default: + { + break; + } + } +} + + +void FmBkupEnginePrivate::notifyPreparingInternal() +{ + iError = KErrNone; + bool cancelable = false; + switch( mProcess ) + { + case FmBkupEngine::ProcessBackup: + cancelable = false; + break; + case FmBkupEngine::ProcessRestore: + cancelable = false; + break; + case FmBkupEngine::ProcessNone: + default: + Q_ASSERT( false ); + } + + emit notifyPreparing( cancelable ); +} + +void FmBkupEnginePrivate::notifyStartInternal( int aTotalCount ) +{ + iError = KErrNone; + + bool cancelable = false; + switch( mProcess ) + { + case FmBkupEngine::ProcessBackup: + cancelable = true; + break; + case FmBkupEngine::ProcessRestore: + cancelable = false; + break; + case FmBkupEngine::ProcessNone: + default: + Q_ASSERT( false ); + } + emit notifyStart( cancelable, aTotalCount ); +} + + +void FmBkupEnginePrivate::notifyUpdateInternal( int aCount ) + { + emit notifyUpdate( aCount ); + } + +void FmBkupEnginePrivate::notifyFinishInternal() + { +// iEngine.ClearDriveInfo(); +// PublishBurStatus( EFileManagerBkupStatusUnset ); + /* CCoeEnv* coeEnv = CCoeEnv::Static(); + iEikonEnv->SetSystem( EFalse); + */ + CCoeEnv* coeEnv = CCoeEnv::Static(); + CEikonEnv* eikonEnv = (STATIC_CAST(CEikonEnv*,coeEnv)); + eikonEnv->SetSystem(EFalse); + mProcess = FmBkupEngine::ProcessNone; + emit notifyFinish( error() ); + } + + +void FmBkupEnginePrivate::notifyMemoryLowInternal( int memoryValue, int &userError ) + { + emit notifyMemoryLow( memoryValue, userError ); + } + +void FmBkupEnginePrivate::notifyBackupFilesExistInternal( bool &isContinue ) + { + emit notifyBackupFilesExist( isContinue ); + } + +TInt FmBkupEnginePrivate::HandleBkupEngineEventL( + MMMCScBkupEngineObserver::TEvent aEvent, TInt aAssociatedData ) + { + QString logString; + TInt ret( KErrNone ); + switch( aEvent ) + { + case MMMCScBkupEngineObserver::ECommonOperationStarting: + { + logString = "ECommonOperationStarting"; + + iFinalValue = KMaxTInt; +// notifyStartInternal( KMaxTInt ); + notifyPreparingInternal(); + break; + } + case MMMCScBkupEngineObserver::ECommonSizeOfTaskUnderstood: + { + logString = "ECommonSizeOfTaskUnderstood"; + iFinalValue = aAssociatedData; + notifyStartInternal( aAssociatedData ); + break; + } + case MMMCScBkupEngineObserver::ECommonOperationPrepareEnded: + { + logString = "ECommonOperationPrepareEnded"; +// PublishBurStatus( EFileManagerBkupStatusUnset ); + // In order to show finished dialog prior SysAp's note, + // notify observer already at prepare-ended state. + if( mProcess == FmBkupEngine::ProcessRestore ) + { + if ( iFinalValue ) + { + notifyUpdateInternal( iFinalValue ); + } + notifyFinishInternal(); + } + break; + } + case MMMCScBkupEngineObserver::ECommonOperationEnded: + { + logString = "ECommonOperationEnded"; +// PublishBurStatus( EFileManagerBkupStatusUnset ); + if( mProcess != FmBkupEngine::ProcessRestore && mProcess != FmBkupEngine::ProcessNone ) + { + if ( iFinalValue ) + { + notifyUpdateInternal( iFinalValue ); + } + notifyFinishInternal(); + } + break; + } + case MMMCScBkupEngineObserver::ECommonOperationError: + { + logString = "ECommonOperationError"; + iError = aAssociatedData; + break; + } + case MMMCScBkupEngineObserver::ECommonProgress: + { + logString = "ECommonProgress:" + QString::number( aAssociatedData ); + notifyUpdateInternal( aAssociatedData ); + break; + } + case MMMCScBkupEngineObserver::EBackupAnalysingData: + { + logString = "EBackupAnalysingData:" + QString::number( aAssociatedData ); + if ( mProcess == FmBkupEngine::ProcessBackup ) + { + int userError = FmErrNone; + notifyMemoryLowInternal( aAssociatedData, userError ); + switch( userError ) + { + case FmErrDiskFull: + ret = KErrDiskFull; + break; + case FmErrCancel: + ret = KErrCancel; + break; + default: + break; + } + } + break; + } + default: + { + logString = "default"; + break; + } + } + FM_LOG( logString ); + return ret; + } + +int FmBkupEnginePrivate::error() +{ + FM_LOG( "FmBkupEnginePrivate::error:" + QString::number( iError ) ); + switch (iError) + { + case KErrNone: + return FmErrNone; + case KErrNotFound: + return FmErrNotFound; + case KErrDiskFull: + return FmErrDiskFull; + case KErrAlreadyExists: + return FmErrAlreadyExists; + case KErrCancel: + return FmErrCancel; + case KErrPathNotFound: + return FmErrPathNotFound; + case KErrLocked: + return FmErrLocked; + case KErrCorrupt: + return FmErrCorrupt; + case KErrNotReady: + return FmErrNotReady; + case KErrDisMounted: + return FmErrDisMounted; + default: + return FmErrUnKnown; + } +} + + + + + +int FmBkupEnginePrivate::deleteBackup( QList drivesAndOperationList ) +{ + iError = FmErrNone; + + QList< FmRestoreInfo > selection; + FmRestoreSettings& rstSettings( *( q->RestoreSettingsL() ) ); + rstSettings.GetSelectionL( selection ); + + iBkupCategoryList->ResetAndDestroy(); + for( QList::iterator it = drivesAndOperationList.begin(); + it != drivesAndOperationList.end(); ++it ) + { + FmBkupDrivesAndOperation* fmDrvAndOp = *it; + TBkupDrivesAndOperation drvAndOp; + drvAndOp.setOwnerDataType( fmDrvAndOp->ownerDataType() ); + drvAndOp.setDrvCategories( fmDrvAndOp->drvCategories() ); + iDrvAndOpList->AppendL( drvAndOp ); + } + //////// + + CMMCScBkupOpParamsRestoreFull* params = + CMMCScBkupOpParamsRestoreFull::NewL( + iDrvAndOpList, FmBkupEngine::EBUCatAllSeparately ); + CleanupStack::PushL( params ); + + // Get list of all archives + RPointerArray< CMMCScBkupArchiveInfo > archives; + TCleanupItem cleanupItem( ResetAndDestroyArchives, &archives ); + CleanupStack::PushL( cleanupItem ); + iBkupEngine->ListArchivesL( + archives, + params, + AllowedDriveAttMatchMask()); + + TInt i( 0 ); + while ( i < archives.Count() ) + { + TBool remove( ETrue ); + + // Compare archives category and drive + CMMCScBkupArchiveInfo* archiveInfo = archives[ i ]; + TUint32 fmgrContent( + BkupToFmgrMask( archiveInfo->Category().iFlags ) ); + TInt drive( archiveInfo->Drive() ); + + TInt count( selection.count() ); + for( TInt j( 0 ); j < count; ++j ) + { + const FmRestoreInfo& info( selection[ j ] ); + if ( ( drive == DriverNameToNumber( info.drive() ) ) && ( fmgrContent & info.content() ) ) + { + // Found user selected archive + // Do not check this archive again + selection.removeAt( j ); + remove = EFalse; + break; + } + } + if ( remove ) + { + // Remove non selected archive + archives.Remove( i ); + delete archiveInfo; + } + else + { + // Move to next archive + ++i; + } + } + + iBkupEngine->DeleteArchivesL( archives ); + + CleanupStack::Pop( &archives ); + archives.Close(); + CleanupStack::PopAndDestroy( params ); + + return iError; +} + + +bool FmBkupEnginePrivate::StartRestoreL( QList drivesAndOperationList ) + { + TBool diskFull( SysUtil::DiskSpaceBelowCriticalLevelL( + &iFs, 0, KFmgrSystemDrive ) ); + if ( diskFull ) + { + mProcess = FmBkupEngine::ProcessRestore; + notifyStartInternal( KMaxTInt ); + iError = KErrDiskFull; + notifyFinishInternal(); + mProcess = FmBkupEngine::ProcessNone; + return false; + } +/////// + iDrvAndOpList->Reset(); + iBkupCategoryList->ResetAndDestroy(); + + for( QList::iterator it = drivesAndOperationList.begin(); + it != drivesAndOperationList.end(); ++it ) + { + FmBkupDrivesAndOperation* fmDrvAndOp = *it; + TBkupDrivesAndOperation drvAndOp; + drvAndOp.setOwnerDataType( fmDrvAndOp->ownerDataType() ); + drvAndOp.setDrvCategories( fmDrvAndOp->drvCategories() ); + iDrvAndOpList->AppendL( drvAndOp ); + } + //////// + + // Create restore params - ownership is transferred to + // secure backup engine + +#ifdef RD_FILE_MANAGER_BACKUP + + CMMCScBkupOpParamsRestoreFull* params = + CMMCScBkupOpParamsRestoreFull::NewL( + iDrvAndOpList, + FmBkupEngine::EBUCatAllSeparately ); +// CleanupStack::PopAndDestroy(); // driveReader + CleanupStack::PushL( params ); + + // Get list of all archives + RPointerArray< CMMCScBkupArchiveInfo > archives; + TCleanupItem cleanupItem( ResetAndDestroyArchives, &archives ); + CleanupStack::PushL( cleanupItem ); + iBkupEngine->ListArchivesL( + archives, + params, + AllowedDriveAttMatchMask() ); + + // Get user set restore selection + QList< FmRestoreInfo > selection; +// CleanupClosePushL( selection ); + FmRestoreSettings& rstSettings( *( q->RestoreSettingsL() ) ); + rstSettings.GetSelectionL( selection ); + + // Remove non user selected archives + TInt i( 0 ); + while ( i < archives.Count() ) + { + TBool remove( ETrue ); + + // Compare archives category and drive + CMMCScBkupArchiveInfo* archiveInfo = archives[ i ]; + TUint32 fmgrContent( + BkupToFmgrMask( archiveInfo->Category().iFlags ) ); + TInt drive( archiveInfo->Drive() ); + + TInt count( selection.count() ); + for( TInt j( 0 ); j < count; ++j ) + { + const FmRestoreInfo& info( selection[ j ] ); + if ( ( drive == DriverNameToNumber( info.drive() ) ) && ( fmgrContent & info.content() ) ) + { + // Found user selected archive + // Do not check this archive again + selection.removeAt( j ); + remove = EFalse; + break; + } + } + if ( remove ) + { + // Remove non selected archive + archives.Remove( i ); + delete archiveInfo; + } + else + { + // Move to next archive + ++i; + } + } + +// CleanupStack::PopAndDestroy( &selection ); + params->SetArchiveInfosL( archives ); + CleanupStack::Pop( &archives ); + archives.Close(); + CleanupStack::Pop( params ); + +#else // RD_FILE_MANAGER_BACKUP + + CMMCScBkupOpParamsRestoreFull* params = + CMMCScBkupOpParamsRestoreFull::NewL( driveReader, EBUCatAllInOne ); + CleanupStack::PopAndDestroy(); // driveReader + + FmBackupSettings& bkupSettings( *( q->BackupSettingsL() ) ); + // Get list of all archives + RPointerArray< CMMCScBkupArchiveInfo > archives; + TCleanupItem cleanupItem( ResetAndDestroyArchives, &archives ); + CleanupStack::PushL( cleanupItem ); + iBkupEngine->ListArchivesL( + archives, + params, + bkupSettings.AllowedDriveAttMatchMask() ); + params->SetArchiveInfosL( archives ); + CleanupStack::Pop( &archives ); + +#endif // RD_FILE_MANAGER_BACKUP + + // Start the process - engine owns the parameters immediately + mProcess = FmBkupEngine::ProcessRestore; + PublishBurStatus( EFileManagerBkupStatusRestore ); + + CCoeEnv* coeEnv = CCoeEnv::Static(); + CEikonEnv* eikonEnv = (STATIC_CAST(CEikonEnv*,coeEnv)); + eikonEnv->SetSystem(ETrue); + + TRAPD( err, iBkupEngine->StartOperationL( + EMMCScBkupOperationTypeFullRestore, *this, params ) ); + if ( err != KErrNone ) + { + PublishBurStatus( EFileManagerBkupStatusUnset ); + mProcess = FmBkupEngine::ProcessNone; + User::Leave( err ); + } + return true; + } + +void FmBkupEnginePrivate::GetRestoreInfoArray( QList drivesAndOperationList, + QList< FmRestoreInfo > &restoreInfoList, + const QString& aDrive ) + { + int targetDrive = DriverNameToNumber( aDrive ); + + restoreInfoList.clear(); + + /////// + iDrvAndOpList->Reset(); + iBkupCategoryList->ResetAndDestroy(); + + for( QList::iterator it = drivesAndOperationList.begin(); + it != drivesAndOperationList.end(); ++it ) + { + FmBkupDrivesAndOperation* fmDrvAndOp = *it; + TBkupDrivesAndOperation drvAndOp; + drvAndOp.setOwnerDataType( fmDrvAndOp->ownerDataType() ); + drvAndOp.setDrvCategories( fmDrvAndOp->drvCategories() ); + iDrvAndOpList->AppendL( drvAndOp ); + } + //////// + + CMMCScBkupOpParamsRestoreFull* params = + CMMCScBkupOpParamsRestoreFull::NewL( + iDrvAndOpList, FmBkupEngine::EBUCatAllSeparately ); + CleanupStack::PushL( params ); + + // Get list of all archives + RPointerArray< CMMCScBkupArchiveInfo > archives; + TCleanupItem cleanupItem( ResetAndDestroyArchives, &archives ); + CleanupStack::PushL( cleanupItem ); + iBkupEngine->ListArchivesL( + archives, + params, + AllowedDriveAttMatchMask(), + targetDrive ); + + // Fill restore info + TInt count( archives.Count() ); +// restoreInfoList.ReserveL( count ); + + for( TInt i( 0 ); i < count; ++i ) + { + // Content + CMMCScBkupArchiveInfo& archiveInfo( *archives[ i ] ); + + TUint32 iContent = BkupToFmgrMask( archiveInfo.Category().iFlags ); + TTime iTime = archiveInfo.DateTime(); + TInt iDrive = archiveInfo.Drive(); + TDateTime iDateTime = iTime.DateTime(); + + int h = iDateTime.Hour(); + int m = iDateTime.Minute(); + int s = iDateTime.Second(); + int year = iDateTime.Year(); + int month = iDateTime.Month() + 1; + int day = iDateTime.Day()+1; + QTime time( h, m, s); + QDate date( year, month, day ); + + QDateTime dateTime( date, time ); + dateTime = dateTime.toLocalTime(); + + FmRestoreInfo restoreInfo( iContent, dateTime, NumberToDriverName( iDrive ) ); + restoreInfoList.append( restoreInfo ); + } + + CleanupStack::PopAndDestroy( &archives ); + CleanupStack::PopAndDestroy( params ); + } + +TUint32 FmBkupEnginePrivate::BkupToFmgrMask( + const TUint32 aBkupMask ) + { + TUint32 ret( 0 ); + + for( TInt i( 0 ); i < KMaskLookupLen; ++i ) + { + if ( aBkupMask & KMaskLookup[ i ].iBkupMask ) + { + ret |= KMaskLookup[ i ].iFmgrMask; + } + } + return ret; + } + +void FmBkupEnginePrivate::ResetAndDestroyArchives( TAny* aPtr ) + { + RPointerArray< CMMCScBkupArchiveInfo >* archive = + static_cast< RPointerArray< CMMCScBkupArchiveInfo >* >( aPtr ); + archive->ResetAndDestroy(); + archive->Close(); + } + +TUint32 FmBkupEnginePrivate::AllowedDriveAttMatchMask() const + { + return KDriveAttRemovable;//KDriveAttRemovable; + } + +TInt FmBkupEnginePrivate::DriverNameToNumber( QString driverName ) + { + if( driverName.isEmpty() ) { + return KErrNotFound; + } + TInt drive = 0; + drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA; + return drive; + } +QString FmBkupEnginePrivate::NumberToDriverName( TInt driver ) + { + QChar driverChar( driver - EDriveA + 'A' ); + QString driverName = QString( driverChar ) + ':'; + return driverName; + } + +void FmBkupEnginePrivate::getBackupDriveList( QStringList &driveList ) + { + TUint32 driveAttMask( AllowedDriveAttMatchMask() ); + RFs fs; + fs.Connect(); + for ( TInt i( 0 ); i < KMaxDrives; ++i ) + { + TDriveInfo driveInfo; + if ( fs.Drive( driveInfo, i ) == KErrNone ) + { + // Do not allow backup for internal drives + TUint driveStatus( 0 ); + DriveInfo::GetDriveStatus( fs, i, driveStatus ); + if ( driveStatus & DriveInfo::EDriveInternal ) + { + continue; + } + if ( driveInfo.iDriveAtt & driveAttMask ) + { + driveList.append( NumberToDriverName( i ) ); + } + } + } + fs.Close(); + } + +// ----------------------------------------------------------------------------- +// CFileManagerEngine::PublishBurStatus() +// +// ----------------------------------------------------------------------------- +// +void FmBkupEnginePrivate::PublishBurStatus( TInt aType ) + { + Q_UNUSED( aType ); + /* + _LIT_SECURITY_POLICY_S0( KFileManagerBkupWritePolicy, KFileManagerUID3 ); + _LIT_SECURITY_POLICY_PASS( KFileManagerBkupReadPolicy ); + + TInt err( RProperty::Set( + KPSUidFileManagerStatus, KFileManagerBkupStatus, aType ) ); + if ( err != KErrNone ) + { + err = RProperty::Define( + KPSUidFileManagerStatus, KFileManagerBkupStatus, + RProperty::EInt, KFileManagerBkupReadPolicy, + KFileManagerBkupWritePolicy ); + if ( err == KErrNone || err == KErrAlreadyExists ) + { + err = RProperty::Set( + KPSUidFileManagerStatus, KFileManagerBkupStatus, aType ); + } + } + LOG_IF_ERROR1( + err, "FileManagerRemovableDriveHandler::PublishBurStatus-err=%d", err ) + */ + } diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * + * Description: + * The header file of the backup engine implement for symbian + */ + +#ifndef FMBKUPENGINEPRIVATE_H +#define FMBKUPENGINEPRIVATE_H + +// INCLUDES +#include +#include "CMMCScBkupOperationParameters.h" +#include "fmbkupengine.h" +#include "fmbkupcommon.h" + +#include "fmbackupsettings.h" +#include "fmrestoresettings.h" + +#include "MMMCScBkupEngineObserver.h" +#include + +#include +#include + +class CMMCScBkupEngine; + +NONSHARABLE_CLASS(TMaskLookup) + { + public: + TUint32 iBkupMask; + TUint32 iFmgrMask; + }; + +const TMaskLookup KMaskLookup[] = { + { FmBkupEngineCommon::EBUCatSettings, FmBkupEngineCommon::EFileManagerBackupContentSettings }, + { FmBkupEngineCommon::EBUCatMessages, FmBkupEngineCommon::EFileManagerBackupContentMessages }, + { FmBkupEngineCommon::EBUCatContacts, FmBkupEngineCommon::EFileManagerBackupContentContacts }, + { FmBkupEngineCommon::EBUCatCalendar, FmBkupEngineCommon::EFileManagerBackupContentCalendar }, + { FmBkupEngineCommon::EBUCatBookmarks, FmBkupEngineCommon::EFileManagerBackupContentBookmarks }, + { FmBkupEngineCommon::EBUCatUserFiles, FmBkupEngineCommon::EFileManagerBackupContentUserFiles } +}; +const TUint32 KMaskLookupLen = + sizeof( KMaskLookup ) / sizeof( KMaskLookup[ 0 ] ); + +// CLASS DECLARATION +class FmBkupEnginePrivate: public QObject, public MMMCScBkupEngineObserver +{ +Q_OBJECT +public: + FmBkupEnginePrivate(FmBkupEngine* bkupEngine); + ~FmBkupEnginePrivate(); + + bool startBackup( QList drivesAndOperationList, + QList backupCategoryList, + QString drive, quint32 content); + + void cancelBackup(); + int deleteBackup( QList drivesAndOperationList ); + + + TUint32 FmgrToBkupMask( const TUint32 aFmrgMask ); + int error(); + + // + bool StartRestoreL( QList drivesAndOperationList ); + void GetRestoreInfoArray( QList drivesAndOperationList, + QList< FmRestoreInfo > &restoreInfoList, + const QString& aDrive ); + + void getBackupDriveList( QStringList &driveList ); + +signals: + void notifyPreparing( bool cancelable ); + void notifyStart( bool cancelable, int totalCount ); + void notifyUpdate( int totalCount ); + void notifyFinish( int err ); + void notifyMemoryLow( int memoryValue, int &userError ); + void notifyBackupFilesExist( bool &isContinue ); +private: + void notifyPreparingInternal(); + void notifyStartInternal( int aTotalCount ); + void notifyUpdateInternal( int aCount ); + void notifyFinishInternal(); + void notifyMemoryLowInternal( int memoryValue, int &userError ); + void notifyBackupFilesExistInternal( bool &isContinue ); + +private: // From MMMCScBkupEngineObserver + TInt HandleBkupEngineEventL( + MMMCScBkupEngineObserver::TEvent aEvent, TInt aAssociatedData ); + + static void ResetAndDestroyArchives( TAny* aPtr ); + TUint32 BkupToFmgrMask( const TUint32 aBkupMask ); + TUint32 AllowedDriveAttMatchMask() const; + TInt DriverNameToNumber( QString driverName ); + QString NumberToDriverName( TInt driver ); + void PublishBurStatus( TInt aType ); + +private: + FmBkupEngine* q; + + BkupDrivesAndOperationList *iDrvAndOpList; + BkupCategoryList *iBkupCategoryList; + + CMMCScBkupEngine* iBkupEngine; + + RFs iFs; + + + FmBkupEngine::Process mProcess; + int iError; + int iFinalValue; +}; + +#endif /*FMBKUPENGINEPRIVATE_H*/ + +// End of file diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,433 @@ +/* + * 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: + * The source file of the backup engine implement for win32 + */ + +#include "FmBkupEngine_p.h" +#include + +#include "fmbkupcommon.h" +#include "fmbackupsettings.h" +#include "fmrestoresettings.h" +#include "fmdefine.h" + +#include + +FmBkupEnginePrivate::FmBkupEnginePrivate(FmBkupEngine* bkupEngine): q(bkupEngine), mError( FmErrNone ) +{ + mBkupThread = new FmBkupThread( this ); + + connect( mBkupThread, SIGNAL( notifyPreparing( bool ) ), this, SLOT( onNotifyPreparing( bool ) ) ); + connect( mBkupThread, SIGNAL( notifyStart( bool, int ) ), this, SLOT( onNotifyStart( bool, int ) ) ); + connect( mBkupThread, SIGNAL( notifyUpdate(int) ), this, SLOT( onNotifyUpdate(int) ) ); + connect( mBkupThread, SIGNAL( notifyFinish(int) ), + this, SLOT( onNotifyFinish(int) ) ); + connect( mBkupThread, SIGNAL( notifyMemoryLow(int, int& ) ), this, SLOT( onNotifyMemoryLow(int, int&) ) ); +} + +FmBkupEnginePrivate::~FmBkupEnginePrivate() +{ + +} + +void FmBkupEnginePrivate::onNotifyPreparing( bool cancelable ) +{ + emit notifyPreparing( cancelable ); +} +void FmBkupEnginePrivate::onNotifyStart( bool cancelable, int totalCount ) +{ + emit notifyStart( cancelable, totalCount ); +} +void FmBkupEnginePrivate::onNotifyUpdate( int count ) +{ + emit notifyUpdate( count ); +} +void FmBkupEnginePrivate::onNotifyFinish( int err ) +{ + emit notifyFinish( err ); +} +void FmBkupEnginePrivate::onNotifyMemoryLow( int memoryValue, int &userError ) +{ + emit notifyMemoryLow( memoryValue, userError ); +} + +bool FmBkupEnginePrivate::startBackup( QList drivesAndOperationList, +QList backupCategoryList,QString drive, quint32 content ) +{ + mError = mBkupThread->asyncBackup( drivesAndOperationList, backupCategoryList, drive, content ); + return ( mError == FmErrNone ); +} + +void FmBkupEnginePrivate::cancelBackup() +{ + mBkupThread->stop(); +} + +int FmBkupEnginePrivate::deleteBackup( QList drivesAndOperationList ) +{ + mError = FmErrNone; + + selection.clear(); + FmRestoreSettings& rstSettings( *( q->RestoreSettingsL() ) ); + rstSettings.GetSelectionL( selection ); + QSettings settings("Nokia", "FileManager"); + foreach( FmRestoreInfo restoreInfo, selection ) { + switch( restoreInfo.content() ) + { + case FmBkupEngineCommon::EFileManagerBackupContentSettings: + settings.beginGroup("BackupSettings"); + settings.remove( QString( "" ) ); + settings.endGroup(); + break; + case FmBkupEngineCommon::EFileManagerBackupContentMessages: + settings.beginGroup("BackupMessages"); + settings.remove( QString( "" ) ); + settings.endGroup(); + break; + case FmBkupEngineCommon::EFileManagerBackupContentContacts: + settings.beginGroup("BackupContacts"); + settings.remove( QString( "" ) ); + settings.endGroup(); + break; + case FmBkupEngineCommon::EFileManagerBackupContentCalendar: + settings.beginGroup("BackupCalendar"); + settings.remove( QString( "" ) ); + settings.endGroup(); + break; + case FmBkupEngineCommon::EFileManagerBackupContentBookmarks: + settings.beginGroup("BackupBookmarks"); + settings.remove( QString( "" ) ); + settings.endGroup(); + break; + case FmBkupEngineCommon::EFileManagerBackupContentUserFiles: + settings.beginGroup("BackupUserFiles"); + settings.remove( QString( "" ) ); + settings.endGroup(); + break; + default: + break; + } + } + + + + return mError; +} + +// TUint32 FmgrToBkupMask( const TUint32 aFmrgMask ); +int FmBkupEnginePrivate::error() +{ + return mError; + +} + +// +bool FmBkupEnginePrivate::StartRestoreL( QList drivesAndOperationList ) +{ + selection.clear(); + FmRestoreSettings& rstSettings( *( q->RestoreSettingsL() ) ); + rstSettings.GetSelectionL( selection ); + + mError = mBkupThread->asyncRestore( drivesAndOperationList,selection ); + return ( mError == FmErrNone ); + +} + + +void FmBkupEnginePrivate::GetRestoreInfoArray( QList drivesAndOperationList, + QList< FmRestoreInfo > &restoreInfoList, + const QString& aDrive ) +{ + restoreInfoList.clear(); + QString debugString; + QSettings settings("Nokia", "FileManager"); + QDateTime dateTime; + + settings.beginGroup("BackupSettings"); + quint32 content = (settings.value("content", 0).toUInt()); + debugString = settings.value( "dateTime").toString(); + dateTime.setTime_t( settings.value( "dateTime" ).toUInt() ); + QString drive = settings.value( "drive" ).toString(); + settings.endGroup(); + if( content != 0 && ( drive.contains( aDrive, Qt::CaseInsensitive ) || aDrive.isEmpty() ) ) + { + FmRestoreInfo restoreInfo( content, dateTime, drive ); + restoreInfoList.push_back( restoreInfo ); + } + + settings.beginGroup("BackupMessages"); + content = (settings.value("content", 0).toUInt()); + dateTime.setTime_t( settings.value( "dateTime" ).toUInt() ); + drive = settings.value( "drive" ).toString(); + settings.endGroup(); + if( content != 0 && ( drive.contains( aDrive, Qt::CaseInsensitive ) || aDrive.isEmpty() ) ) + { + FmRestoreInfo restoreInfo( content, dateTime, drive ); + restoreInfoList.push_back( restoreInfo ); + } + + settings.beginGroup("BackupContacts"); + content = (settings.value("content", 0).toUInt()); + dateTime.setTime_t( settings.value( "dateTime" ).toUInt() ); + drive = settings.value( "drive" ).toString(); + settings.endGroup(); + if( content != 0 && ( drive.contains( aDrive, Qt::CaseInsensitive ) || aDrive.isEmpty() ) ) + { + FmRestoreInfo restoreInfo( content, dateTime, drive ); + restoreInfoList.push_back( restoreInfo ); + } + + settings.beginGroup("BackupCalendar"); + content = (settings.value("content", 0).toUInt()); + dateTime.setTime_t( settings.value( "dateTime" ).toUInt() ); + drive = settings.value( "drive" ).toString(); + settings.endGroup(); + if( content != 0 && ( drive.contains( aDrive, Qt::CaseInsensitive ) || aDrive.isEmpty() ) ) + { + FmRestoreInfo restoreInfo( content, dateTime, drive ); + restoreInfoList.push_back( restoreInfo ); + } + + settings.beginGroup("BackupBookmarks"); + content = (settings.value("content", 0).toUInt()); + dateTime.setTime_t( settings.value( "dateTime" ).toUInt() ); + drive = settings.value( "drive" ).toString(); + settings.endGroup(); + if( content != 0 && ( drive.contains( aDrive, Qt::CaseInsensitive ) || aDrive.isEmpty() ) ) + { + FmRestoreInfo restoreInfo( content, dateTime, drive ); + restoreInfoList.push_back( restoreInfo ); + } + + settings.beginGroup("BackupUserFiles"); + content = (settings.value("content", 0).toUInt()); + dateTime.setTime_t( settings.value( "dateTime" ).toUInt() ); + drive = settings.value( "drive" ).toString(); + settings.endGroup(); + if( content != 0 && ( drive.contains( aDrive, Qt::CaseInsensitive ) || aDrive.isEmpty() ) ) + { + FmRestoreInfo restoreInfo( content, dateTime, drive ); + restoreInfoList.push_back( restoreInfo ); + } + +} + + + + +FmBkupThread::FmBkupThread( QObject *parent ) : QThread( parent ), mRunType( RunTypeNone ), mStop( false ) +{ +} + +FmBkupThread::~FmBkupThread() +{ + +} + +int FmBkupThread::asyncBackup( QList drivesAndOperationList, +QList backupCategoryList,QString drive, quint32 content ) +{ + if( this->isRunning() ){ + return FmErrAlreadyStarted; + } + + if( drivesAndOperationList.count() == 0 || backupCategoryList.count() == 0 ){ + return FmErrWrongParam; + } + + mRunType = RunTypeBackup; + mDrivesAndOperationList.clear(); + mBackupCategoryList.clear(); + + foreach( FmBkupDrivesAndOperation* driversAndOperation , drivesAndOperationList ) { + mDrivesAndOperationList.push_back( driversAndOperation ); + } + foreach( FmBkupBackupCategory* backupCategory , backupCategoryList ) { + mBackupCategoryList.push_back( backupCategory ); + } + + mDrive = drive; + mContent = content; + start(); + return FmErrNone; +} +int FmBkupThread::asyncRestore( QList drivesAndOperationList, QList< FmRestoreInfo > selection ) +{ + if( this->isRunning() ) { + return FmErrAlreadyStarted; + } + + if( drivesAndOperationList.count() == 0 ){ + return FmErrWrongParam; + } + + mRunType = RunTypeRestore; + mDrivesAndOperationList.clear(); + foreach( FmBkupDrivesAndOperation* driversAndOperation , drivesAndOperationList ) { + mDrivesAndOperationList.push_back( driversAndOperation ); + } + + foreach( FmRestoreInfo info , selection ) { + mSelection.push_back( info ); + } + start(); + return FmErrNone; +} + + + +void FmBkupThread::stop() +{ + mStop = true; +} + + + + +void FmBkupThread::run() +{ + mStop = false; + + + if( mRunType == RunTypeBackup ) + { + emit notifyPreparing( true ); + this->sleep( 1 ); + emit notifyStart( true, 6 ); + + QSettings settings("Nokia", "FileManager"); + + if( mContent && FmBkupEngineCommon::EFileManagerBackupContentSettings ) { + settings.beginGroup("BackupSettings"); + settings.setValue( "content", FmBkupEngineCommon::EFileManagerBackupContentSettings ); + settings.setValue( "dateTime", QDateTime::currentDateTime().toTime_t() ); + settings.setValue( "drive", mDrive ); + settings.endGroup(); + this->msleep( 500 ); + emit notifyUpdate( 1 ); + if( mStop ) { + emit notifyFinish( FmErrCancel ); + return; + } + } + if( mContent && FmBkupEngineCommon::EFileManagerBackupContentMessages ) { + settings.beginGroup("BackupMessages"); + settings.setValue( "content", FmBkupEngineCommon::EFileManagerBackupContentMessages ); + settings.setValue( "dateTime", QDateTime::currentDateTime().toTime_t() ); + settings.setValue( "drive", mDrive ); + settings.endGroup(); + this->msleep( 500 ); + emit notifyUpdate( 2 ); + if( mStop ) { + emit notifyFinish( FmErrCancel ); + return; + } + } + if ( mContent && FmBkupEngineCommon::EFileManagerBackupContentContacts ) { + settings.beginGroup("BackupContacts"); + settings.setValue( "content", FmBkupEngineCommon::EFileManagerBackupContentContacts ); + settings.setValue( "dateTime", QDateTime::currentDateTime().toTime_t() ); + settings.setValue( "drive", mDrive ); + settings.endGroup(); + this->msleep( 500 ); + emit notifyUpdate( 3 ); + if( mStop ) { + emit notifyFinish( FmErrCancel ); + return; + } + } + if ( mContent && FmBkupEngineCommon::EFileManagerBackupContentCalendar ) { + settings.beginGroup("BackupCalendar"); + settings.setValue( "content", FmBkupEngineCommon::EFileManagerBackupContentCalendar ); + settings.setValue( "dateTime", QDateTime::currentDateTime().toTime_t() ); + settings.setValue( "drive", mDrive ); + settings.endGroup(); + this->msleep( 500 ); + emit notifyUpdate( 4 ); + if( mStop ) { + emit notifyFinish( FmErrCancel ); + return; + } + } + if ( mContent && FmBkupEngineCommon::EFileManagerBackupContentBookmarks ) { + settings.beginGroup("BackupBookmarks"); + settings.setValue( "content", FmBkupEngineCommon::EFileManagerBackupContentBookmarks ); + settings.setValue( "dateTime", QDateTime::currentDateTime().toTime_t() ); + settings.setValue( "drive", mDrive ); + settings.endGroup(); + this->msleep( 500 ); + emit notifyUpdate( 5 ); + if( mStop ) { + emit notifyFinish( FmErrCancel ); + return; + } + } + if ( mContent && FmBkupEngineCommon::EFileManagerBackupContentUserFiles ) { + settings.beginGroup("BackupUserFiles"); + settings.setValue( "content", FmBkupEngineCommon::EFileManagerBackupContentUserFiles ); + settings.setValue( "dateTime", QDateTime::currentDateTime().toTime_t() ); + settings.setValue( "drive", mDrive ); + settings.endGroup(); + emit notifyUpdate( 6 ); + if( mStop ) { + emit notifyFinish( FmErrCancel ); + return; + } + } + } else if( mRunType == RunTypeRestore ) + { + + emit notifyPreparing( false ); + this->sleep( 1 ); + emit notifyStart( false, 6 ); + this->msleep( 500 ); + emit notifyUpdate( 1 ); + this->msleep( 500 ); + emit notifyUpdate( 2 ); + this->msleep( 500 ); + emit notifyUpdate( 3 ); + this->msleep( 500 ); + emit notifyUpdate( 4 ); + this->msleep( 500 ); + emit notifyUpdate( 5 ); + this->msleep( 500 ); + emit notifyUpdate( 6 ); + this->msleep( 500 ); + } + + emit notifyFinish( FmErrNone ); +} + + +int FmBkupEnginePrivate::DriverNameToNumber( QString driverName ) +{ + int drive = 0; + drive = driverName[0].toUpper().toAscii() - 'A' + 0/*EDriveA*/; + return drive; +} +QString FmBkupEnginePrivate::NumberToDriverName( int driver ) +{ + QChar driverChar( driver - 0/*EDriveA*/ + 'A' ); + QString driverName = QString( driverChar ) + ':'; + return driverName; +} + +void FmBkupEnginePrivate::getBackupDriveList( QStringList &driveList ) + { + driveList.append("E:/"); + driveList.append("F:/"); + } + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,140 @@ +/* + * 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: + * The header file of the backup engine implement for win32 + */ + +#ifndef FMBKUPENGINEPRIVATE_H +#define FMBKUPENGINEPRIVATE_H + +// INCLUDES +#include "fmbkupengine.h" + +// FORWARD DECLARATIONS + + + +#include +#include + +#include + +class FmBkupThread; + + +// CLASS DECLARATION +class FmBkupEnginePrivate : public QObject +{ +Q_OBJECT +public: + FmBkupEnginePrivate(FmBkupEngine* bkupEngine); + ~FmBkupEnginePrivate(); + + bool startBackup( QList drivesAndOperationList, + QList backupCategoryList, + QString drive, quint32 content); + + void cancelBackup(); + int deleteBackup( QList drivesAndOperationList ); + +// TUint32 FmgrToBkupMask( const TUint32 aFmrgMask ); + int error(); + + // + bool StartRestoreL( QList drivesAndOperationList ); + void GetRestoreInfoArray( QList drivesAndOperationList, + QList< FmRestoreInfo > &restoreInfoList, + const QString& aDrive ); + void getBackupDriveList( QStringList &driveList ); +private: + int DriverNameToNumber( QString driverName ); + QString NumberToDriverName( int driver ); + +// TBool HasMultipleBackupTargets(); + +signals: + void notifyPreparing( bool cancelable ); + void notifyStart( bool cancelable, int totalCount ); + void notifyUpdate( int count ); + void notifyFinish( int err ); + void notifyMemoryLow( int memoryValue, int &userError ); + + // win32 source code is used to simulator backup action. + // add this signal in win32 to avoid warning when run test case + // though it is not used in win32 source code currently + void notifyBackupFilesExist( bool &isContinue ); + +public slots: + void onNotifyPreparing( bool cancelable ); + void onNotifyStart( bool cancelable, int totalCount ); + void onNotifyUpdate( int count ); + void onNotifyFinish( int err ); + void onNotifyMemoryLow( int memoryValue, int &userError ); + +private: + int mError; + FmBkupEngine* q; + FmBkupThread* mBkupThread; + + QList< FmRestoreInfo > selection; +}; + + + +class FmBkupThread : public QThread +{ + Q_OBJECT +public: + enum RunType + { + RunTypeNone, + RunTypeBackup, + RunTypeRestore + }; + + FmBkupThread( QObject *parent ); + ~FmBkupThread(); + + int asyncBackup( QList drivesAndOperationList, +QList backupCategoryList,QString drive, quint32 content ); + int asyncRestore( QList drivesAndOperationList, QList< FmRestoreInfo > selection ); + void stop(); + +signals: + void notifyPreparing( bool cancelable ); + void notifyStart( bool cancelable, int totalCount ); + void notifyUpdate( int totalCount ); + void notifyFinish( int err ); + void notifyMemoryLow( int memoryValue, int &userError ); + +protected: + void run(); + +private: + volatile bool mStop; + RunType mRunType; + + QList mDrivesAndOperationList; + QList mBackupCategoryList; + QString mDrive; + quint32 mContent; + QList< FmRestoreInfo > mSelection; + +}; + + +#endif /*FMBKUPENGINEPRIVATE_H*/ + +// End of file diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/src/fmbackupsettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/src/fmbackupsettings.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,389 @@ +/* + * 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: + * The source file of the backup settings of file manager + */ + +#include "fmbackupsettings.h" +#include "fmbkupengine.h" +#include "fmcommon.h" + +#include +#include +#include +#include + +#include + +FmBackupSettings::FmBackupSettings( FmBkupEngine *aFmBkupEngine ) : mBkupEngine( aFmBkupEngine ) +{ + +} + +FmBackupSettings::~FmBackupSettings( void ) +{ + resetAndDestoryBackupEntry(); +} + +void FmBackupSettings::setContent( const quint32 aContent ) +{ + mContent = aContent; + save(); +} + +void FmBackupSettings::setScheduling( const TFileManagerBackupSchedule aScheduling ) +{ + mScheduling = aScheduling; + save(); +} + +void FmBackupSettings::setWeekday( const TFileManagerBackupWeekday weekday ) +{ + mWeekday = weekday; + save(); +} + +void FmBackupSettings::setTime( const QTime &aTime ) +{ + mTime = aTime; + save(); +} + +void FmBackupSettings::setTargetDrive( const QString &aDrive ) +{ + mTargetDrive = aDrive; + save(); +} + +quint32 FmBackupSettings::content() const +{ + return mContent; +} + +FmBackupSettings::TFileManagerBackupSchedule FmBackupSettings::scheduling() const +{ + return mScheduling; +} + +FmBackupSettings::TFileManagerBackupWeekday FmBackupSettings::weekday() const +{ + return mWeekday; +} + +const QTime& FmBackupSettings::time() const +{ + return mTime; +} + +QString FmBackupSettings::targetDrive() const +{ + return mTargetDrive; +} + +QString FmBackupSettings::availableTargetDrive() const +{ + QString targetDrive; + QStringList driveList; + mBkupEngine->getBackupDriveList( driveList ); + if( !driveList.isEmpty() ) { + if( driveList.contains( mTargetDrive ) ) { + targetDrive = mTargetDrive; + } else { + targetDrive = driveList.first(); + } + } + return targetDrive; +} + +int FmBackupSettings::contentsSelected() const +{ + int ret( 0 ); + // Count selected only + quint32 mask( mContent ); + while ( mask ){ + if ( mask & 1 ){ + ++ret; + } + mask >>= 1; + } + return ret; +} + +FmBackupEntry* FmBackupSettings::CreateEntry( const QString &title, const QString &tips, const FmBackupEntry::TSettingType type ) +{ + FmBackupEntry *entry = new FmBackupEntry( title, tips, type ); + return entry; +} + +FmBackupEntry* FmBackupSettings::createContentsEntry() +{ + QString title; + QString tips; + + title = hbTrId( "Backup Contents" ); + + int selected( contentsSelected() ); + if ( !( mContent & EFileManagerBackupContentAll ) && selected > 1 ){ + // create text as " 5 selected" + tips = QString( QString::number(selected) + " selected" ); + } + else + { + // create single content name + tips = contentToString( mContent ); + } + + return CreateEntry( title, tips, FmBackupEntry::EContents ); +} + +FmBackupEntry* FmBackupSettings::createSchedulingEntry() +{ + QString title; + QString tips; + + title = hbTrId( "Backup scheduling" ); + tips = schedulingToString( mScheduling ); + + return CreateEntry( title, tips, FmBackupEntry::EScheduling ); +} + +FmBackupEntry* FmBackupSettings::createWeekdayEntry() +{ + QString title; + QString tips; + + title = hbTrId( "Weekday" ); + tips = weekdayToString( mWeekday ); + + return CreateEntry( title, tips, FmBackupEntry::EWeekday ); +} + +FmBackupEntry* FmBackupSettings::createTimeEntry() +{ + QString title; + QString tips; + + title = hbTrId( "Time" ); + tips = mTime.toString( "hh:mm" ); + + return CreateEntry( title, tips, FmBackupEntry::ETime ); +} + +FmBackupEntry* FmBackupSettings::createTargetDriveEntry() +{ + QString title; + QString tips; + + title = hbTrId( "Backup destination" ); + tips = targetDriveToString( mTargetDrive ); + + return CreateEntry( title, tips, FmBackupEntry::ETarget ); +} + +FmBackupEntry* FmBackupSettings::createBackupDateEntry() +{ + QString tips; + if( mDate.isNull() ) + { + tips = hbTrId( "No previous backups created"); + } + else + { + tips = hbTrId( "Backup Created " ) + mDate.toString( "dd.MM.yyyy" ); + } + return CreateEntry( QString(""), tips, FmBackupEntry::EBackupdate); +} +QString FmBackupSettings::contentToString( const quint32 content ) +{ + QString ret( hbTrId( "All" ) ); + + if ( content & EFileManagerBackupContentAll ){ + ret = hbTrId( "All" ); + } + else if ( content & EFileManagerBackupContentSettings ){ + ret = hbTrId( "Settings" ); + } + else if ( content & EFileManagerBackupContentMessages ){ + ret = hbTrId( "Messages" ); + } + else if ( content & EFileManagerBackupContentContacts ){ + ret = hbTrId( "Contacts" ); + } + else if ( content & EFileManagerBackupContentCalendar ){ + ret = hbTrId( "Calendar" ); + } + else if ( content & EFileManagerBackupContentBookmarks ){ + ret = hbTrId( "Bookmarks" ); + } + else if ( content & EFileManagerBackupContentUserFiles ){ + ret = hbTrId( "Files" ); + } + return ret; +} + +QString FmBackupSettings::weekdayToString( const TFileManagerBackupWeekday weekday ) +{ + QString ret = ""; + switch (weekday) + { + case EFileManagerBackupWeekdayMonday: + ret = hbTrId( "Monday" ); + break; + case EFileManagerBackupWeekdayTuesday: + ret = hbTrId( "Tuesday" ); + break; + case EFileManagerBackupWeekdayWednesday: + ret = hbTrId( "Wednesday" ); + break; + case EFileManagerBackupWeekdayThursday: + ret = hbTrId( "Thursday" ); + break; + case EFileManagerBackupWeekdayFriday: + ret = hbTrId( "Friday" ); + break; + case EFileManagerBackupWeekdaySaturday: + ret = hbTrId( "Saturday" ); + break; + case EFileManagerBackupWeekdaySunday: + ret = hbTrId( "Sunday" ); + break; + } + return ret; +} + + +QString FmBackupSettings::schedulingToString( const TFileManagerBackupSchedule scheduling ) +{ + QString ret = ""; + switch (scheduling) + { + case EFileManagerBackupScheduleNever: + ret = hbTrId( "Never" ); + break; + case EFileManagerBackupScheduleDaily: + ret = hbTrId ("Daily" ); + break; + case EFileManagerBackupScheduleWeekly: + ret = hbTrId( "Weekly" ); + break; + } + return ret; +} + +QString FmBackupSettings::targetDriveToString( const QString &targetDrive ) +{ + //TODO: Get Volume Name and append to return value + return targetDrive; +} + +QList< FmBackupEntry* > FmBackupSettings::backupEntryList() +{ + return mBackupEntryList; +} + +void FmBackupSettings::refreshList() +{ + resetAndDestoryBackupEntry(); + FmBackupEntry* entry = 0; + + entry = createContentsEntry(); + mBackupEntryList.push_back( entry ); + + entry = createSchedulingEntry(); + mBackupEntryList.push_back( entry ); + + if ( mScheduling == EFileManagerBackupScheduleWeekly ) + { + entry = createWeekdayEntry(); + mBackupEntryList.push_back( entry ); + } + + if ( mScheduling == EFileManagerBackupScheduleWeekly || + mScheduling == EFileManagerBackupScheduleDaily ) + { + entry = createTimeEntry(); + mBackupEntryList.push_back( entry ); + } + + QStringList driveList; + mBkupEngine->getBackupDriveList( driveList ); + + if( driveList.count() > 1 ) { + entry = createTargetDriveEntry(); + mBackupEntryList.push_back( entry ); + } + + entry = createBackupDateEntry(); + mBackupEntryList.push_back( entry ); +} + +void FmBackupSettings::resetAndDestoryBackupEntry() +{ + for( QList< FmBackupEntry* >::iterator it = mBackupEntryList.begin(); + it!= mBackupEntryList.end(); ++it ){ + delete *it; + } + mBackupEntryList.clear(); +} + + + +// load and save + +void FmBackupSettings::load() +{ + + QStringList driveList; + mBkupEngine->getBackupDriveList( driveList ); + QString defaultDrive( driveList.first() ); + + QDate date; + QSettings settings("Nokia", "FileManager"); + + settings.beginGroup("BackupConfigure"); + + mContent = (settings.value("content", 1).toUInt()); // All for default value + mScheduling = (TFileManagerBackupSchedule)(settings.value("scheduling", EFileManagerBackupScheduleNever ).toInt()); // Never schedule for default value + mWeekday = (TFileManagerBackupWeekday)(settings.value("weekday", EFileManagerBackupWeekdayMonday ).toInt()); // monday for default value + mTime = (settings.value("time", QTime::currentTime() ).toTime()); // empty for default + mTargetDrive = (settings.value("targetDrive", defaultDrive ) ).toString(); // C for default + mDate = (settings.value("backupDate", date)).toDate(); + settings.endGroup(); + refreshList(); +} + + +void FmBackupSettings::save() +{ + + QSettings settings( "Nokia", "FileManager" ); + settings.beginGroup( "BackupConfigure" ); + + settings.setValue( "content", mContent ); + settings.setValue( "scheduling", mScheduling ); + settings.setValue( "weekday", mWeekday ); + settings.setValue( "time", mTime.toString() ); + settings.setValue( "targetDrive", mTargetDrive ); + settings.setValue( "backupDate", mDate.toString( Qt::ISODate ) ); + settings.endGroup(); + + refreshList(); +} + +void FmBackupSettings::updateBackupDate() +{ + mDate.setDate( QDate::currentDate().year(), QDate::currentDate().month(), QDate::currentDate().day() ); + save(); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/src/fmbkupengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/src/fmbkupengine.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * + * Description: + * The source file of the backup engine from backup engine wrapper + */ + +#include "fmbkupengine.h" +#include "fmbkupengine_p.h" + +#include "fmbackupsettings.h" +#include "fmrestoresettings.h" + +#include +FmBkupEngine::FmBkupEngine(QObject* parent): + QObject(parent), d(new FmBkupEnginePrivate(this)), iBackupSettings( 0 ), iRestoreSettings( 0 ) +{ + connect( d, SIGNAL( notifyPreparing( bool ) ), this, SIGNAL( notifyPreparing( bool ) ) ); + connect( d, SIGNAL( notifyStart( bool, int ) ), this, SIGNAL( notifyStart( bool, int ) ) ); + connect( d, SIGNAL( notifyUpdate(int) ), this, SIGNAL( notifyUpdate(int) ) ); + connect( d, SIGNAL( notifyFinish(int) ), + this, SIGNAL( notifyFinish(int) ), Qt::DirectConnection ); + connect( d, SIGNAL( notifyMemoryLow(int, int& ) ), this, SIGNAL( notifyMemoryLow(int, int&) ) ); + connect( d, SIGNAL( notifyBackupFilesExist( bool& )), this, SIGNAL( notifyBackupFilesExist( bool&) ) ); +} + + +FmBkupEngine::~FmBkupEngine() +{ + delete d; + if( iBackupSettings ) { + delete iBackupSettings; + } + if( iRestoreSettings ) { + delete iRestoreSettings; + } +} + +bool FmBkupEngine::startBackup( QList drivesAndOperationList, + QList backupCategoryList, + QString drive, quint32 content) +{ + return d->startBackup( drivesAndOperationList, backupCategoryList, drive, content ); +} +void FmBkupEngine::cancelBackup() +{ + d->cancelBackup(); +} +bool FmBkupEngine::startRestore( QList drivesAndOperationList ) +{ + return d->StartRestoreL( drivesAndOperationList ); +} + + +int FmBkupEngine::error() const +{ + return d->error(); +} + +FmBackupSettings *FmBkupEngine::BackupSettingsL() +{ + if ( !iBackupSettings ) + { + iBackupSettings = new FmBackupSettings( this ); + } + return iBackupSettings; +} + +FmRestoreSettings *FmBkupEngine::RestoreSettingsL() +{ + if ( !iRestoreSettings ) + { + iRestoreSettings = new FmRestoreSettings( *this ); + } + return iRestoreSettings; +} + +void FmBkupEngine::GetRestoreInfoArray( QList &drivesAndOperationList, + QList< FmRestoreInfo > &restoreInfoList, + const QString& aDrive ) +{ + d->GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, aDrive ); +} + +int FmBkupEngine::deleteBackup( QList drivesAndOperationList ) +{ + return d->deleteBackup( drivesAndOperationList ); +} + + +void FmBkupEngine::getBackupDriveList( QStringList &driveList ) +{ + d->getBackupDriveList( driveList ); +} + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmbkupenginewrapper/src/fmrestoresettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmbkupenginewrapper/src/fmrestoresettings.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,115 @@ +/* + * 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: + * The source file of the restore settings of file manager + */ + +#include "fmrestoresettings.h" +#include "fmbackupsettings.h" +#include "fmbkupengine.h" +#include "fmbkupcommon.h" + +#include +#include +#include + +FmRestoreSettings::FmRestoreSettings( FmBkupEngine& engine ) : mEngine( engine ) +{ + +} + +FmRestoreSettings::~FmRestoreSettings() +{ + resetAndDestoryRestoreEntry(); +} + +void FmRestoreSettings::load( QList drivesAndOperationList ) +{ + refreshList( drivesAndOperationList ); +} + +QList< FmRestoreEntry* > FmRestoreSettings::restoreEntryList() +{ + return mRestoreEntryList; +} + +void FmRestoreSettings::resetAndDestoryRestoreEntry() +{ + for( QList< FmRestoreEntry* >::iterator it = mRestoreEntryList.begin(); + it!= mRestoreEntryList.end(); ++it ){ + delete *it; + } + mRestoreEntryList.clear(); +} + +void FmRestoreSettings::refreshList( QList &drivesAndOperationList ) +{ + resetAndDestoryRestoreEntry(); + + QList< FmRestoreInfo > restoreInfoList; + + QString targetDrive = mEngine.BackupSettingsL()->availableTargetDrive(); + mEngine.GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, targetDrive ); + + + // fetch info list from engine, and then init the entry list for display + + int count( restoreInfoList.count() ); + quint32 mask( FmBkupEngineCommon::EFileManagerBackupContentFirst); + while ( mask <= FmBkupEngineCommon::EFileManagerBackupContentLast ) + { + for ( int i( 0 ); i < count; ++i ) + { + FmRestoreInfo& info( restoreInfoList[ i ] ); + if ( info.content() & mask ) + { + FmRestoreEntry* entry = CreateEntry( info ); + mRestoreEntryList.push_back( entry ); + } + } + mask <<= 1; + } +} + + +FmRestoreEntry *FmRestoreSettings::CreateEntry( const FmRestoreInfo &info ) +{ + QString text = FmBackupSettings::contentToString( info.content() ); + + FmRestoreEntry *entry = new FmRestoreEntry( text, info ); + return entry; +} + +void FmRestoreSettings::SetSelection( + const quint64& aSelection ) + { + iSelection = aSelection; + } + +void FmRestoreSettings::GetSelectionL( + QList< FmRestoreInfo >& infoArray ) const +{ + infoArray.clear(); + + int count( mRestoreEntryList.count() ); + + for ( int i( 0 ); i < count; ++i ) + { + if ( ( ( ( quint64 ) 1 ) << i ) & iSelection ) + { + infoArray.append( mRestoreEntryList[ i ]->restoreInfo() ); + } + } +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/bwins/fmfiledialogu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/bwins/fmfiledialogu.def Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,25 @@ +EXPORTS + ??_EFmFileDialog@@UAE@I@Z @ 1 NONAME ; FmFileDialog::~FmFileDialog(unsigned int) + ?qt_metacall@FmFileDialog@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 2 NONAME ; int FmFileDialog::qt_metacall(enum QMetaObject::Call, int, void * *) + ??1FmFileDialog@@EAE@XZ @ 3 NONAME ; FmFileDialog::~FmFileDialog(void) + ?tr@FmFileDialog@@SA?AVQString@@PBD0H@Z @ 4 NONAME ; class QString FmFileDialog::tr(char const *, char const *, int) + ?getOpenFileName@FmFileDialog@@SA?AVQString@@PAVHbWidget@@ABV2@1ABVQStringList@@V?$QFlags@W4Option@FmFileDialog@@@@@Z @ 5 NONAME ; class QString FmFileDialog::getOpenFileName(class HbWidget *, class QString const &, class QString const &, class QStringList const &, class QFlags) + ??0FmFileDialog@@AAE@PAVQGraphicsItem@@@Z @ 6 NONAME ; FmFileDialog::FmFileDialog(class QGraphicsItem *) + ?tr@FmFileDialog@@SA?AVQString@@PBD0@Z @ 7 NONAME ; class QString FmFileDialog::tr(char const *, char const *) + ?getStaticMetaObject@FmFileDialog@@SAABUQMetaObject@@XZ @ 8 NONAME ; struct QMetaObject const & FmFileDialog::getStaticMetaObject(void) + ?d_func@FmFileDialog@@ABEPBVFmFileDialogPrivate@@XZ @ 9 NONAME ; class FmFileDialogPrivate const * FmFileDialog::d_func(void) const + ?exec@FmFileDialog@@AAE_NXZ @ 10 NONAME ; bool FmFileDialog::exec(void) + ?trUtf8@FmFileDialog@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString FmFileDialog::trUtf8(char const *, char const *) + ?trUtf8@FmFileDialog@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString FmFileDialog::trUtf8(char const *, char const *, int) + ?metaObject@FmFileDialog@@UBEPBUQMetaObject@@XZ @ 13 NONAME ; struct QMetaObject const * FmFileDialog::metaObject(void) const + ?staticMetaObject@FmFileDialog@@2UQMetaObject@@B @ 14 NONAME ; struct QMetaObject const FmFileDialog::staticMetaObject + ?getSaveFileName@FmFileDialog@@SA?AVQString@@PAVHbWidget@@ABV2@1ABVQStringList@@V?$QFlags@W4Option@FmFileDialog@@@@@Z @ 15 NONAME ; class QString FmFileDialog::getSaveFileName(class HbWidget *, class QString const &, class QString const &, class QStringList const &, class QFlags) + ?d_func@FmFileDialog@@AAEPAVFmFileDialogPrivate@@XZ @ 16 NONAME ; class FmFileDialogPrivate * FmFileDialog::d_func(void) + ?getExistingDirectory@FmFileDialog@@SA?AVQString@@PAVHbWidget@@ABV2@1ABVQStringList@@V?$QFlags@W4Option@FmFileDialog@@@@@Z @ 17 NONAME ; class QString FmFileDialog::getExistingDirectory(class HbWidget *, class QString const &, class QString const &, class QStringList const &, class QFlags) + ?qt_metacast@FmFileDialog@@UAEPAXPBD@Z @ 18 NONAME ; void * FmFileDialog::qt_metacast(char const *) + ?dialogClosed@FmFileDialog@@AAEXPAVHbAction@@@Z @ 19 NONAME ; void FmFileDialog::dialogClosed(class HbAction *) + ?setSecondaryAction@FmFileDialog@@AAEXPAVHbAction@@@Z @ 20 NONAME ; void FmFileDialog::setSecondaryAction(class HbAction *) + ?secondaryAction@FmFileDialog@@ABEPAVHbAction@@XZ @ 21 NONAME ; class HbAction * FmFileDialog::secondaryAction(void) const + ?setPrimaryAction@FmFileDialog@@AAEXPAVHbAction@@@Z @ 22 NONAME ; void FmFileDialog::setPrimaryAction(class HbAction *) + ?primaryAction@FmFileDialog@@ABEPAVHbAction@@XZ @ 23 NONAME ; class HbAction * FmFileDialog::primaryAction(void) const + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/eabi/fmfiledialogu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/eabi/fmfiledialogu.def Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,27 @@ +EXPORTS + _ZN12FmFileDialog11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME + _ZN12FmFileDialog11qt_metacastEPKc @ 2 NONAME + _ZN12FmFileDialog15getOpenFileNameEP8HbWidgetRK7QStringS4_RK11QStringList6QFlagsINS_6OptionEE @ 3 NONAME + _ZN12FmFileDialog15getSaveFileNameEP8HbWidgetRK7QStringS4_RK11QStringList6QFlagsINS_6OptionEE @ 4 NONAME + _ZN12FmFileDialog16staticMetaObjectE @ 5 NONAME DATA 16 + _ZN12FmFileDialog19getStaticMetaObjectEv @ 6 NONAME + _ZN12FmFileDialog20getExistingDirectoryEP8HbWidgetRK7QStringS4_RK11QStringList6QFlagsINS_6OptionEE @ 7 NONAME + _ZN12FmFileDialog4execEv @ 8 NONAME + _ZN12FmFileDialogC1EP13QGraphicsItem @ 9 NONAME + _ZN12FmFileDialogC2EP13QGraphicsItem @ 10 NONAME + _ZN12FmFileDialogD0Ev @ 11 NONAME + _ZN12FmFileDialogD1Ev @ 12 NONAME + _ZN12FmFileDialogD2Ev @ 13 NONAME + _ZNK12FmFileDialog10metaObjectEv @ 14 NONAME + _ZTI12FmFileDialog @ 15 NONAME + _ZTV12FmFileDialog @ 16 NONAME + _ZThn16_N12FmFileDialogD0Ev @ 17 NONAME + _ZThn16_N12FmFileDialogD1Ev @ 18 NONAME + _ZThn8_N12FmFileDialogD0Ev @ 19 NONAME + _ZThn8_N12FmFileDialogD1Ev @ 20 NONAME + _ZN12FmFileDialog12dialogClosedEP8HbAction @ 21 NONAME + _ZN12FmFileDialog16setPrimaryActionEP8HbAction @ 22 NONAME + _ZN12FmFileDialog18setSecondaryActionEP8HbAction @ 23 NONAME + _ZNK12FmFileDialog13primaryActionEv @ 24 NONAME + _ZNK12FmFileDialog15secondaryActionEv @ 25 NONAME + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/fmfiledialog.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/fmfiledialog.pri Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,22 @@ +# +# 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: FmFileDialog project - source files +# + +HEADERS += ./src/fmfiledialog_p.h \ + ./src/fmfilewidget.h + +SOURCES += ./src/fmfiledialog.cpp \ + ./src/fmfiledialog_p.cpp \ + ./src/fmfilewidget.cpp diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/fmfiledialog.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/fmfiledialog.pro Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,43 @@ +# 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: +# The project file of FmFileDialog + +TARGET = +CONFIG += hb +TEMPLATE = lib +DEFINES += FMFILEDIALOG_LIBRARY +RESOURCES += fmfiledialog.qrc +include ( ../common.pri ) +include ( ../inc/commoninc.pri ) +include ( ../inc/commonutils.pri ) +include ( ../../filemanager_plat/inc/filemanager_plat.pri ) +include ( fmfiledialog.pri ) +symbian { + LIBS += -lplatformenv \ + -lapmime \ + -lxqservice \ + -lxqutils \ + -lshareui \ + -lefsrv \ + -lapgrfx \ + -lcone \ + -lsysutil + + TARGET.UID3 = 0x2002BCC3 + + # export headers to app + EXPORT_PLATFORM_HEADERS += \ + ../../filemanager_plat/inc/fmglobal.h \ + ../../filemanager_plat/inc/fmfiledialog.h + + headers.sources = $$EXPORT_PLATFORM_HEADERS + for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$APP_LAYER_PLATFORM_EXPORT_PATH($$basename(header))" +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/fmfiledialog.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/fmfiledialog.qrc Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,11 @@ + + + image/qtg_indi_status_back.svg + image/qgn_prop_mmc_locked.svg + image/qgn_prop_mmc_memc.svg + image/qgn_prop_fmgr_mmc_no_sub.svg + image/qgn_prop_phone_memc.svg + image/qgn_prop_usb_memc.svg + image/qgn_prop_fmgr_ms.svg + + \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/image/qgn_prop_fmgr_mmc_no_sub.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/image/qgn_prop_fmgr_mmc_no_sub.svg Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/image/qgn_prop_fmgr_ms.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/image/qgn_prop_fmgr_ms.svg Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/image/qgn_prop_mmc_locked.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/image/qgn_prop_mmc_locked.svg Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/image/qgn_prop_mmc_memc.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/image/qgn_prop_mmc_memc.svg Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/image/qgn_prop_phone_memc.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/image/qgn_prop_phone_memc.svg Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/image/qgn_prop_usb_memc.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/image/qgn_prop_usb_memc.svg Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/image/qtg_indi_status_back.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/image/qtg_indi_status_back.svg Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,17 @@ + + + +]> + + + + + + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/src/fmfiledialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/src/fmfiledialog.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,206 @@ +/* +* 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: +* The source file of the file dialog +* +*/ + +#include "fmfiledialog.h" +#include "fmfiledialog_p.h" +#include "fmfilewidget.h" +#include "fmlogger.h" +#include "fmutils.h" +#include "fmdrivemodel.h" +#include "fmcommon.h" + +#include "hbwidget.h" +#include "hblabel.h" +#include "hbaction.h" +#include "hbpushbutton.h" +#include "hblineedit.h" + +#include +#include + +FmFileDialog::FmFileDialog( QGraphicsItem *parent ) : + HbDialog( parent ), d_ptr( new FmFileDialogPrivate( this ) ) +{ +} + +FmFileDialog::~FmFileDialog() +{ + delete d_ptr; +} + +QString FmFileDialog::getExistingDirectory( HbWidget *parent, + const QString &title, + const QString &dir, + const QStringList &nameFilters, + Options options ) +{ + + QString ret; + + FmFileDialogPrivate::FmFileDialogArgs args; + args.mDialogMode = FmFileDialogPrivate::GetDirMode; + args.mTitle = title; + args.mDirectory = dir; + if( options & DisplayAllDirs ) { + args.mDirFilters = QDir::AllDirs | QDir::NoDotAndDotDot; + } else { + args.mDirFilters = QDir::Dirs | QDir::NoDotAndDotDot; + } + args.mNameFilters = nameFilters; + args.mOptions = options; + + FmFileDialog dialog( parent ); + dialog.d_ptr->init( args ); + if( dialog.exec() ) { + ret = FmUtils::formatPath( dialog.d_ptr->currentPath() ); + } + return ret; +} + +QString FmFileDialog::getOpenFileName( HbWidget *parent, + const QString &title, + const QString &dir, + const QStringList &nameFilters, + Options options ) +{ + + QString ret; + + FmFileDialogPrivate::FmFileDialogArgs args; + args.mDialogMode = FmFileDialogPrivate::GetFileMode; + args.mTitle = title; + args.mDirectory = dir; + if( options & DisplayAllDirs ) { + args.mDirFilters = QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Files; + } else { + args.mDirFilters = QDir::Dirs | QDir::NoDotAndDotDot | QDir::Files; + } + args.mNameFilters = nameFilters; + args.mOptions = options; + + FmFileDialog dialog( parent ); + dialog.d_ptr->init( args ); + if( dialog.exec() ) { + ret = FmUtils::formatPath( dialog.d_ptr->currentPath() ) + + dialog.d_ptr->selectedFile(); + } + return ret; +} + + +QString FmFileDialog::getSaveFileName( HbWidget * parent, + const QString &title, + const QString &dir, + const QStringList &nameFilters, + Options options ) +{ + QString ret; + + FmFileDialogPrivate::FmFileDialogArgs args; + args.mDialogMode = FmFileDialogPrivate::SaveFileMode; + args.mTitle = title; + args.mDirectory = dir; + if( options & DisplayAllDirs ) { + args.mDirFilters = QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Files; + } else { + args.mDirFilters = QDir::Dirs | QDir::NoDotAndDotDot | QDir::Files; + } + args.mNameFilters = nameFilters; + args.mOptions = options; + + FmFileDialog dialog( parent ); + dialog.d_ptr->init( args ); + if( dialog.exec() ) { + ret = FmUtils::formatPath( dialog.d_ptr->currentPath() ) + + dialog.d_ptr->selectedFile(); + } + return ret; +} + + + +bool FmFileDialog::exec() +{ + HbDialog::open( this, SLOT(dialogClosed(HbAction*)) ); + d_ptr->eventLoop().exec(); + + if ( d_ptr->isOkAction( d_ptr->retAction() ) ) { + return true; + } else { + return false ; + } +} + +void FmFileDialog::dialogClosed(HbAction *action) +{ + d_ptr->setRetAction( action ); + d_ptr->eventLoop().exit(); +} + + +HbAction *FmFileDialog::primaryAction() const +{ + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() > 0) { + return (HbAction *)(actionList.at(0)); + } else { + return 0; + } + +} + +void FmFileDialog::setPrimaryAction( HbAction *action ) +{ + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() == 0) { + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 1) { + actionList.clear(); + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 2) { + actionList.removeAt(0); + actionList.insert(0, action); + } +} + +HbAction *FmFileDialog::secondaryAction() const +{ + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() > 1) { + return (HbAction *)(actionList.at(1)); + } else { + return 0; + } +} + +void FmFileDialog::setSecondaryAction( HbAction *action ) +{ + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() == 0) { + QGraphicsWidget::addAction(new HbAction(hbTrId("Ok"))); + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 1) { + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 2) { + actionList.removeAt(1); + actionList.insert(1, action); + } + +} + diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/src/fmfiledialog_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/src/fmfiledialog_p.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,388 @@ +/* +* 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: +* The source file of the file dialog implement +* +*/ + +#include "fmfiledialog_p.h" +#include "fmfilewidget.h" +#include "fmcommon.h" + +#include "hbfontspec.h" +#include +#include +#include +#include +#include + +#define backButtonIcon ":image/qtg_indi_status_back.svg" + +/*! + constructor +*/ +FmFileDialogPrivate::FmFileDialogPrivate( FmFileDialog *fileDialog ) : + mFileDialog( fileDialog ), + mHeadingWidget( 0 ), + mCurrentPathLabel( 0 ), + mUpButton( 0 ), + mTitleLabel( 0 ), + mContentWidget( 0 ), + mContentLayout( 0 ), + mFileWidget( 0 ), + mOkAction( 0 ), + mCancelAction( 0 ), + mFileNameTitleLabel( 0 ), + mFileNameLineEdit( 0 ) +{ + } + +/*! + destructor +*/ +FmFileDialogPrivate::~FmFileDialogPrivate() +{ + +} + +/*! + init + \param directory . +*/ +void FmFileDialogPrivate::init( const FmFileDialogArgs &args ) +{ + mArgs = args; + setProperties(); + createHeadingWidget(); + createContentWidget(); + createBottomWidget(); + + if( !mFileDialog->primaryAction() && !mFileDialog->secondaryAction() ) { + createAndSetActions(mFileDialog->tr("Ok"),mFileDialog->tr("Cancel")); + } + + makeConnections(); + setRootPath( mArgs.mDirectory ); + mFileWidget->setModelFilter( mArgs.mDirFilters ); + mFileWidget->setNameFilters( mArgs.mNameFilters ); +} + +/*! + createAndSetActions + + \param primaryActionText + secondaryActionText +*/ +void FmFileDialogPrivate::createAndSetActions(const QString & primaryActionText, + const QString & secondaryActionText) +{ + // Create action for ok button and assign it to the primary action of popup + mOkAction = new HbAction( primaryActionText, mFileDialog ); + mOkAction->setObjectName( "okAction" ); + Q_ASSERT( mOkAction ); + mFileDialog->setPrimaryAction( mOkAction ); + + // Create action for cancel button and assign it to the secondary action of popup + mCancelAction = new HbAction( secondaryActionText, mFileDialog ); + mCancelAction->setObjectName( "cancelAction" ); + Q_ASSERT( mCancelAction ); + mFileDialog->setSecondaryAction( mCancelAction ); +} + +/*! + setProperties + sets the properties of the file dialog like timeout, + Dismiss policy,modal etc. +*/ +void FmFileDialogPrivate::setProperties() +{ + // set the file dialog as Modal. + mFileDialog->setModal(true); + + // no dismiss for File dialog. + mFileDialog->setDismissPolicy( HbPopup::NoDismiss ); + + // File dialog will not time out. + mFileDialog->setTimeout( HbPopup::NoTimeout ); +} + +/*! + makeConnections +*/ +void FmFileDialogPrivate::makeConnections() +{ + mFileDialog->connect( mUpButton,SIGNAL( clicked() ), + mFileDialog, SLOT( _q_handleUpButton() ) ); + + if( mFileNameLineEdit ) { + mFileDialog->connect( mFileNameLineEdit, SIGNAL( textChanged( QString ) ), + mFileDialog, SLOT( _q_handleTextChanged( QString ) ) ); + } + + mFileDialog->connect( mFileWidget, SIGNAL( pathChanged( QString ) ), + mFileDialog, SLOT( _q_handlePathChanged( QString ) ) ); + + mFileDialog->connect( mFileWidget, SIGNAL( fileActivated( QString ) ), + mFileDialog, SLOT( _q_handleFileActivated( QString ) ) ); +} + +/*! + creates the heading wiget elements that include + a label for showing the current path and a push button for + going to the parent directory. +*/ +void FmFileDialogPrivate::createHeadingWidget() +{ + mHeadingWidget = new HbWidget( mFileDialog ); + mHeadingWidget->setObjectName( "headingWidget" ); + + QGraphicsLinearLayout *headingLayout = new QGraphicsLinearLayout; + headingLayout->setOrientation(Qt::Horizontal); + mHeadingWidget->setLayout(headingLayout); + + + QGraphicsLinearLayout *titleLayout = new QGraphicsLinearLayout; + titleLayout->setOrientation(Qt::Vertical); + + mTitleLabel = new HbLabel(); + mTitleLabel->setObjectName( "titleLabel" ); + if( mArgs.mTitle.isEmpty() ){ + mTitleLabel->setPlainText( QString( FmPlaceholderString ) ); + } else { + mTitleLabel->setPlainText( mArgs.mTitle ); + } + + mCurrentPathLabel = new HbLabel( QString( FmPlaceholderString ) ); + mCurrentPathLabel->setObjectName( "currentPathLabel" ); + mCurrentPathLabel->setElideMode(Qt::ElideRight); + + mUpButton = new HbPushButton; + mUpButton->setObjectName( "upButton" ); + mUpButton->setIcon(HbIcon(backButtonIcon)); + + titleLayout->addItem( mTitleLabel ); + titleLayout->setAlignment( mTitleLabel, Qt::AlignLeft); + + titleLayout->addItem( mCurrentPathLabel ); + titleLayout->setAlignment( mCurrentPathLabel, Qt::AlignLeft); + + headingLayout->addItem(titleLayout); + headingLayout->addItem( mUpButton ) ; + headingLayout->setAlignment(mUpButton,Qt::AlignRight); + + mFileDialog->setHeadingWidget( mHeadingWidget ); +} + +/*! + Creates the content widget. It includes the listview and model. + +*/ + +void FmFileDialogPrivate::createContentWidget() +{ + mContentWidget = new HbWidget( mFileDialog ); + mContentWidget->setObjectName( "contentWidget" ); + + mContentLayout = new QGraphicsLinearLayout; + mContentLayout->setOrientation(Qt::Vertical); + + mContentWidget->setLayout( mContentLayout ); + + mFileWidget = new FmFileWidget( mContentWidget ); + mFileWidget->setObjectName( "fileWidget" ); + mContentLayout->addItem( mFileWidget ); + + mFileDialog->setContentWidget( mContentWidget ); +} + +/*! + Creates the content widget. It includes the listview and model. + +*/ + +void FmFileDialogPrivate::createBottomWidget() +{ + if( mArgs.mDialogMode == GetDirMode ) { + return; + } + HbWidget *bottomWidget = new HbWidget( mContentWidget ); + bottomWidget->setObjectName( "bottomWidget" ); + mContentLayout->addItem( bottomWidget ); + + QGraphicsLinearLayout *bottomLayout = new QGraphicsLinearLayout; + bottomLayout->setOrientation( Qt::Horizontal ); + + mFileNameTitleLabel = new HbLabel( mFileDialog->tr( "file name:" ), bottomWidget ); + mFileNameTitleLabel->setObjectName( "fileNameTitleLabel" ); + bottomLayout->addItem( mFileNameTitleLabel ); + + mFileNameLineEdit = new HbLineEdit( bottomWidget ); + mFileNameLineEdit->setObjectName( "fileNameLineEdit" ); + bottomLayout->addItem( mFileNameLineEdit ); + + bottomWidget->setLayout( bottomLayout ); + +} + +void FmFileDialogPrivate::checkUpButton() +{ + QString currentPath = mFileWidget->currentPath().absoluteFilePath(); + bool isPreventDirUp = mArgs.mOptions & FmFileDialog::PreventDirUp; + + if( mFileWidget->currentViewType() == FmFileWidget::DirView ) { + if( isPreventDirUp && + mArgs.mDirectory.contains( currentPath, Qt::CaseInsensitive ) ) { + // disable up when client lock top leve folder + mUpButton->setEnabled( false ); + } else { + mUpButton->setEnabled( true ); + } + } else { + // disable up button when at drive view + mUpButton->setEnabled( false ); + } +} + +void FmFileDialogPrivate::checkBottomFileWidget() +{ + switch( mArgs.mDialogMode ) + { + case GetDirMode: + break; + case GetFileMode: + if( mFileNameLineEdit ){ + mFileNameLineEdit->setReadOnly( true ); + } + break; + case SaveFileMode: + if( mFileNameLineEdit ){ + if( mFileWidget->currentPath().absoluteFilePath().isEmpty() ) { + mFileNameLineEdit->setReadOnly( true ); + } else { + mFileNameLineEdit->setReadOnly( false ); + } + } + break; + } +} + +void FmFileDialogPrivate::checkActions() +{ + switch( mArgs.mDialogMode ) + { + case GetDirMode: + if( mFileWidget->currentPath().absoluteFilePath().isEmpty() ) { + mOkAction->setDisabled( true ); + } else { + mOkAction->setDisabled( false ); + } + break; + case GetFileMode: + case SaveFileMode: + if( mFileWidget->currentPath().absoluteFilePath().isEmpty() || + ( mFileNameLineEdit && mFileNameLineEdit->text().isEmpty() ) ) { + mOkAction->setDisabled( true ); + } else { + mOkAction->setDisabled( false ); + } + break; + default: + Q_ASSERT( false ); + } +} + +void FmFileDialogPrivate::_q_handleUpButton() +{ + bool isPreventDirUp = mArgs.mOptions & FmFileDialog::PreventDirUp; + QString currentPath = mFileWidget->currentPath().absoluteFilePath(); + if( isPreventDirUp && + mArgs.mDirectory.contains( currentPath, Qt::CaseInsensitive ) ) { + return; + } else { + mFileWidget->cdUp(); + } +} + +void FmFileDialogPrivate::_q_handleTextChanged(const QString &text) +{ + Q_UNUSED( text ); + checkActions(); +} + +void FmFileDialogPrivate::_q_handlePathChanged( const QString &path ) +{ + if( path.isEmpty() ) { + mCurrentPathLabel->setPlainText( QString( FmPlaceholderString ) ); + } else { + mCurrentPathLabel->setPlainText( path ); + } + + if( mFileNameLineEdit && mArgs.mDialogMode == GetFileMode ) { + mFileNameLineEdit->setText( QString() ); + } + + checkUpButton(); + checkBottomFileWidget(); + checkActions(); +} + +void FmFileDialogPrivate::_q_handleFileActivated( const QString &path ) +{ + if( mFileNameLineEdit ) { + mFileNameLineEdit->setText( path ); + } + checkActions(); +} + +QString FmFileDialogPrivate::currentPath() const +{ + return mFileWidget->currentPath().absoluteFilePath(); +} + +QString FmFileDialogPrivate::selectedFile() const +{ + return mFileNameLineEdit->text(); +} + +void FmFileDialogPrivate::setRootPath( const QString &pathName ) +{ + mFileWidget->setRootPath( pathName ); +} + +bool FmFileDialogPrivate::isOkAction( HbAction *action ) +{ + if( mOkAction == action ) { + return true; + } + + return false; +} + +void FmFileDialogPrivate::setRetAction( HbAction *action ) +{ + mRetAction = action; +} + +HbAction *FmFileDialogPrivate::retAction() +{ + return mRetAction; +} + +QEventLoop &FmFileDialogPrivate::eventLoop() +{ + return mEventLoop; +} + +#include "moc_fmfiledialog.cpp" diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/src/fmfiledialog_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/src/fmfiledialog_p.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,125 @@ +/* +* 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: +* The header file of the file dialog implement +* +*/ + +#ifndef FMFILEDIALOG_P_H +#define FMFILEDIALOG_P_H + +#include "fmfiledialog.h" + +#include +#include + +class HbPushButton; +class FmFileWidget; +class HbLineEdit; +class HbLabel; +class HbWidget; +class HbLabel; +class HbPushButton; +class QGraphicsLinearLayout; + +class FmFileDialogPrivate +{ +public: + enum DialogCode { + Accepted, + Canceled + }; + + enum DialogMode { + GetDirMode, + GetFileMode, + SaveFileMode + }; + + struct FmFileDialogArgs + { + FmFileDialogPrivate::DialogMode mDialogMode; + QString mTitle; + QString mDirectory; + QDir::Filters mDirFilters; + QStringList mNameFilters; + FmFileDialog::Options mOptions; + }; + + FmFileDialogPrivate( FmFileDialog *fileDialog ); + ~FmFileDialogPrivate(); + + void init( const FmFileDialogArgs &args ); + + QString currentPath() const; + QString selectedFile() const; + bool isOkAction( HbAction *action ); + + void setRetAction( HbAction *action ); + HbAction *retAction(); + QEventLoop &eventLoop(); + +protected: + void createAndSetActions(const QString & primaryActionText,const QString & secondaryActionText); + void createContentWidget(); + void createHeadingWidget(); + void populateContentWidget(const QString & directory); + void createBottomWidget(); + void setProperties(); + void makeConnections(); + + void initBottomFileWidget(); + void checkUpButton(); + void checkBottomFileWidget(); + void checkActions(); + + void setTitle( const QString &str ); + void setRootPath( const QString &pathName ); + +public: + void _q_handleUpButton(); + void _q_handleTextChanged(const QString &text); + void _q_handlePathChanged( const QString &path ); + void _q_handleFileActivated( const QString &path ); + +private: + FmFileDialog *mFileDialog; + + HbWidget *mHeadingWidget; + HbLabel *mCurrentPathLabel; + HbPushButton *mUpButton; + HbLabel *mTitleLabel; + HbWidget *mContentWidget; + QGraphicsLinearLayout *mContentLayout; + FmFileWidget *mFileWidget; + + HbAction *mOkAction; + HbAction *mCancelAction; + + QString mDirectory; + QString mTitleValue; + QStringList mFilterList; + + HbLabel *mFileNameTitleLabel; + HbLineEdit *mFileNameLineEdit; + + QString mCaptionHead; + FmFileDialogArgs mArgs; + + HbAction *mRetAction; + QEventLoop mEventLoop; +}; + +#endif // FMFILEDIALOG_P_H diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/src/fmfilewidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/src/fmfilewidget.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,251 @@ +/* +* 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: +* The source file of the file widget +* +*/ +#include "fmfilewidget.h" +#include "fmutils.h" +#include "fmdrivemodel.h" +#include "fmdrivewatcher.h" +#include "fmcommon.h" +#include "fmfileiconprovider.h" + +#include "hbstyle.h" +#include "hbabstractitemview.h" +#include + +#include +#include +#include +#include +#include + + + + +FmFileWidget::FmFileWidget( HbWidget *parent ) : + HbWidget( parent ), mCurrentModel( 0 ) +{ + init(); +} +FmFileWidget::~FmFileWidget() +{ + setModel( 0 ); + delete mFileSystemModel; + delete mFileIconProvider; + delete mDriveModel; + + mDriveWatcher->cancelWatch(); + delete mDriveWatcher; + mDriveWatcher = 0; +} + +QFileInfo FmFileWidget::currentPath() const +{ + QModelIndex index( mListView->rootIndex() ); + if( !index.isValid() ) { + return QFileInfo(); + } + if( mCurrentModel == mFileSystemModel ) { + return mFileSystemModel->fileInfo( index ); + } else { + return QFileInfo(); + } +} + +void FmFileWidget::setRootPath( const QString &pathName ) +{ + FM_LOG( "FmFileWidget::setRootPath start" ); + // If path is empty or can not access, set model as DriveModel + // Otherwise set model as FileSystemModel, means it will return to drive view if error occur. + if( ( pathName.isEmpty() ) || ( FmErrNone != FmUtils::isPathAccessabel( pathName ) ) ) { + FM_LOG( "FmFileWidget::setRootPath set drive model" ); + setModel( mDriveModel ); + FM_LOG( "FmFileWidget::setRootPath set drive model end" ); + emit pathChanged( QString() ); + } else { + FM_LOG( "FmFileWidget::setRootPath set dir model end" ); + setModel( mFileSystemModel ); + FM_LOG( "FmFileWidget::setRootPath set dir model end" ); + mListView->setRootIndex( mFileSystemModel->setRootPath( pathName ) ); + FM_LOG( "FmFileWidget::setRootPath set rootIndex" ); + emit pathChanged( pathName ); + } + FM_LOG( "FmFileWidget::setRootPath end" ); +} +void FmFileWidget::on_list_activated( const QModelIndex &index ) + { + mActivatedModelIndex = index; + emit listActivated(); + } + +void FmFileWidget::on_listActivated() +{ + FM_LOG("FmFileWidget::on_list_activated start" ); + if( mCurrentModel == mDriveModel ) { + //If current model is DriveModel, open drive and set path + QString driveName = mDriveModel->driveName( mActivatedModelIndex ); + QString checkedPath = FmUtils::checkDriveToFolderFilter( driveName ); + if( checkedPath.isEmpty() ) { + FM_LOG("FmFileWidget::on_list_activated end becaise checkedpath empty" ); + return; + } + + FM_LOG("FmFileWidget::on_list_activated setModel dir start" ); + setModel( mFileSystemModel ); + FM_LOG("FmFileWidget::on_list_activated setModel dir end" ); + setRootPath( checkedPath ); + FM_LOG("FmFileWidget::on_list_activated setRootIndex" ); + emit pathChanged( checkedPath ); + FM_LOG("FmFileWidget::on_list_activated finish emit pathChanged" ); + } + else if( mCurrentModel == mFileSystemModel ) { + //If current model is FileSystemModel, open path or emit file activate signal. + if ( mFileSystemModel->isDir( mActivatedModelIndex ) ) { + FM_LOG("FmFileWidget::on_list_activated start changeRootIndex" ); + changeRootIndex( mActivatedModelIndex ); + FM_LOG("FmFileWidget::on_list_activated finish changeRootIndex" ); + } else { + QFileInfo fileInfo( mFileSystemModel->filePath( mActivatedModelIndex ) ); + if( fileInfo.isFile() ) { + emit fileActivated( fileInfo.fileName() ); + FM_LOG("FmFileWidget::on_list_activated finish emit fileActivated" ); + } + } + } else { + Q_ASSERT( false ); + } + FM_LOG("FmFileWidget::on_list_activated end" ); +} + +void FmFileWidget::setModelFilter( QDir::Filters filters ) +{ + mFileSystemModel->setFilter( filters ); +} + +void FmFileWidget::setNameFilters( const QStringList &nameFilters ) +{ + mFileSystemModel->setNameFilters( nameFilters ); +} + +void FmFileWidget::changeRootIndex( const QModelIndex &index ) +{ + FM_LOG("FmFileWidget::changeRootIndex start" ); + if( mCurrentModel != mFileSystemModel ) { + FM_LOG("FmFileWidget::changeRootIndex end because model not equal mFileSystemModel" ); + return; + } + + mFileSystemModel->fetchMore(index); + QString filePath = mFileSystemModel->fileInfo( index ).absoluteFilePath(); + // pathChanged signal will be emitted in setRootPath + setRootPath( filePath ); + FM_LOG("FmFileWidget::changeRootIndex end" ); +} + +void FmFileWidget::init() +{ + mLayout = new QGraphicsLinearLayout( this ); + mLayout->setOrientation( Qt::Vertical ); + setLayout( mLayout ); + + mListView = new HbListView( this ); + mListView->setObjectName( "list" ); + mLayout->addItem( mListView ); + + mDriveModel = new FmDriveModel( this, + FmDriveModel::FillWithVolume | FmDriveModel::FillWithDefaultVolume | FmDriveModel::HideUnAvailableDrive ); + + qDebug( QTime::currentTime().toString().toUtf8().data() ); + mFileSystemModel = new QFileSystemModel( this ); + mFileIconProvider = new FmFileIconProvider(); + mFileSystemModel->setIconProvider( mFileIconProvider ); + qDebug("constructed mFileSystemModel"); + + qDebug( QTime::currentTime().toString().toUtf8().data() ); + setModel( mDriveModel ); + qDebug("setmodel"); + qDebug( QTime::currentTime().toString().toUtf8().data() ); + + mDriveWatcher = new FmDriveWatcher( this ); + mDriveWatcher->setObjectName( "driveWatcher" ); + mDriveWatcher->startWatch(); + +// QMetaObject::connectSlotsByName( this ); + connect( mListView, SIGNAL( activated( QModelIndex ) ), + this, SLOT( on_list_activated( QModelIndex ) ) ); + connect( this, SIGNAL( listActivated() ), + this, SLOT( on_listActivated() ), Qt::QueuedConnection ); + + connect( mDriveWatcher, SIGNAL( driveAddedOrChanged() ), + this, SLOT( on_driveWatcher_driveAddedOrChanged() ) ); + + +} + +void FmFileWidget::setModel( QAbstractItemModel *model ) +{ + mListView->setModel( model ); + mCurrentModel = model; +} + +FmFileWidget::ViewType FmFileWidget::currentViewType() +{ + ViewType viewType = DriveView; + if( mCurrentModel == mDriveModel ) { + viewType = DriveView; + } else if( mCurrentModel == mFileSystemModel ) { + viewType = DirView; + } else { + Q_ASSERT( false ); + } + return viewType; +} + + +bool FmFileWidget::cdUp() +{ + QString path( FmUtils::checkFolderToDriveFilter( currentPath().absoluteFilePath() ) ); + QFileInfo fileInfo( path ); + QString cdUpPath; + // path length>3 means current path is a sub folder, then get up level path and navigate to it + // Otherwise means current path is a top level drive path, Should navigate to drive view. So setRootPath with empty path string. + if( path.length() > 3 ) { + cdUpPath = fileInfo.dir().absolutePath(); + } + setRootPath( FmUtils::fillPathWithSplash( cdUpPath ) ); + return true; +} + +void FmFileWidget::on_driveWatcher_driveAddedOrChanged() +{ + FM_LOG( QString( "FmFileDialog_FmFileWidget::on_driveWatcher_driveAddedOrChanged start" ) ); + mDriveModel->refresh(); + if( currentViewType() == DriveView ) { + setModel( 0 ); + setModel( mDriveModel ); + emit pathChanged( QString() ); + } else if( currentViewType() == DirView ) { + if( FmErrNone != FmUtils::isPathAccessabel( currentPath().absoluteFilePath() ) ) { + // path not available, set model to drive + FM_LOG( QString( "FmFileDialog_FmFileWidget::on_driveWatcher_driveAddedOrChanged path not availeable, set drivemodel:" + + currentPath().absoluteFilePath() ) ); + setModel( mDriveModel ); + emit pathChanged( QString() ); + } + } + FM_LOG( QString( "FmFileDialog_FmFileWidget::on_driveWatcher_driveAddedOrChanged end" ) ); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/fmfiledialog/src/fmfilewidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/src/fmfilewidget.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,85 @@ +/* +* 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: +* The header file of the file widget +* +*/ +#ifndef FMFILEWIDGET_H +#define FMFILEWIDGET_H + +#include "hbwidget.h" +#include +#include +#include + +class QFileSystemModel; +class FmDriveModel; +class FmDriveWatcher; +class HbListView; +class QGraphicsLinearLayout; + +class FmFileIconProvider; + +class FmFileWidget : public HbWidget +{ +Q_OBJECT +public: + enum ViewType{ + DirView, + DriveView + }; + + explicit FmFileWidget( HbWidget *parent = 0 ); + ~FmFileWidget(); + + QFileInfo currentPath() const; + + void setModelFilter( QDir::Filters filters ); + void setNameFilters( const QStringList &nameFilters ); + void setRootPath( const QString &pathName ); + + FmFileWidget::ViewType currentViewType(); + bool cdUp(); +signals: + void pathChanged( const QString &path ); + void fileActivated( const QString &path ); + void listActivated(); + +private slots: + void on_list_activated( const QModelIndex &index ); + void on_listActivated(); + void on_driveWatcher_driveAddedOrChanged(); + +private: + void init(); + void changeRootIndex( const QModelIndex &index ); + void setModel( QAbstractItemModel *model ); + +private: + HbListView *mListView; + QGraphicsLinearLayout *mLayout; + QFileSystemModel *mFileSystemModel; + FmDriveModel *mDriveModel; + + QAbstractItemModel *mCurrentModel; + FmDriveWatcher *mDriveWatcher; + + QModelIndex mActivatedModelIndex; + + FmFileIconProvider *mFileIconProvider; + +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/commoninc.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/commoninc.pri Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,22 @@ +# +# 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: +# + +INTERNAL_HEADERS += $$PWD/fmcommon.h \ + $$PWD/fmlogger.h \ + $$PWD/fmdefine.h + +HEADERS += $$INTERNAL_HEADERS + diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/commonutils.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/commonutils.pri Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,51 @@ +# +# 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: +# + +INTERNAL_HEADERS += $$PWD/fmutils.h \ + $$PWD/fmdrivemodel.h \ + $$PWD/fmfileiconprovider.h \ + $$PWD/fmdrivewatcher/fmdrivewatcher.h \ + $$PWD/fmfiletyperecognizer.h + +INTERNAL_SOURCES += $$PWD/fmdrivemodel.cpp \ + $$PWD/fmfileiconprovider.cpp \ + $$PWD/fmdrivewatcher/fmdrivewatcher.cpp \ + $$PWD/fmfiletyperecognizer.cpp \ + $$PWD/fmutils.cpp + +symbian { + INTERNAL_HEADERS += $$PWD/fms60utils.h \ + $$PWD/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.h \ + $$PWD/fmdrivewatcher/private/symbian/fmdriveevent.h + + INTERNAL_SOURCES += $$PWD/fmutils_s60.cpp \ + $$PWD/fms60utils.cpp \ + $$PWD/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.cpp \ + $$PWD/fmdrivewatcher/private/symbian/fmdriveevent.cpp +} +win32 { + INCLUDEPATH += $$PWD/fmdrivewatcher/ + INCLUDEPATH += $$PWD/fmdrivewatcher/private/win32/ + + INTERNAL_HEADERS += $$PWD/fmdrivewatcher/private/win32/fmdrivewatcherprivate.h + + INTERNAL_SOURCES += $$PWD/fmutils_win.cpp \ + $$PWD/fmdrivewatcher/private/win32/fmdrivewatcherprivate.cpp + +} + +HEADERS += $$INTERNAL_HEADERS +SOURCES += $$INTERNAL_SOURCES \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmcommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmcommon.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,32 @@ +/* +* 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: +* The header file of the file manager +*/ + +#ifndef FMCOMMON_H +#define FMCOMMON_H + +// MACRO for enable actions for change orientation +// #define FM_CHANGE_ORIENT_ENABLE + +// MACRO for enable debug log +// #define _DEBUG_LOG_ENABLE_ + + +#include "fmlogger.h" +#include "fmdefine.h" + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmdefine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdefine.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,92 @@ +/* +* 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 FMDEFINE_H +#define FMDEFINE_H + +// define for filemanager error +#define FmErrNone 0 // No Error +#define FmErrNotFound -1 // General error for things requested is not found +#define FmErrGeneral -2 // General error +#define FmErrAlreadyExists -3 // General for already existed. for example if unlock a drive but it has already been unlocked +#define FmErrAccessDenied -4 // General for Access is denied, for example, format a drive but access is denied. +#define FmErrCannotRemove -5 // General error for can not performance remove +#define FmErrCannotCopy -6 // General error for can not performance copy +#define FmErrDiskFull -7 // Error for disk is full +#define FmErrFileUsed -8 // Error for file is in use +#define FmErrFolderUsed -9 // Error for folder is in use +#define FmErrTypeFormatFailed -10 // Error reported when format failed +#define FmErrTypeFormatFailedUsed -11 // Error reported when user try to format a drive but it is in use +#define FmErrAlreadyStarted -12 // General error for operation is already started +#define FmErrCancel -13 // General error for operation canceled +#define FmErrWrongParam -14 // General error for wrong parameter +#define FmErrUnKnown -15 // Unknown error +#define FmErrIsNotFileOrFolder -16 // Error for a path which is not a fild or folder. +#define FmErrCannotMakeDir -17 // Error for can not create directory. +#define FmErrSrcPathDoNotExist -18 // Error for source path is not exist. +#define FmErrDestPathDoNotExist -19 // Error for destination path is not exist. +#define FmErrCopyDestToSubFolderInSrc -20 // If user try to copy a folder to its sub folder, error will occur +#define FmErrMoveDestToSubFolderInSrc -21 // If user try to move a folder to its sub folder, error will occur +#define FmErrNotSupported -22 // feature not supported, for example, lock an drive which can not be locked +#define FmErrNotReady -23 // Error when drive is not ready( means drive is not present ) +#define FmErrInUse -24 // Error for drive is in use. +#define FmErrPermissionDenied -25 // Permission Denied +#define FmErrBadName -26 // Bad Drive or file/folder name, currently used when rename drive +#define FmErrPathNotFound -27 // Error for path is not found +#define FmErrRemoveDefaultFolder -28 // Error when user try to remove default folder, such as C:/data/images... +#define FmErrLocked -29 // Disk is locked +#define FmErrCorrupt -30 // Disk is corrupt +#define FmErrDisMounted -31 // e.g. If disk dis mounted while backuping. +#define FmErrDriveNotAvailable -32 // e.g. if user want to access MMC but it is not available +#define FmErrPathDenied -33 // if user want to access path but it is denied, e.g c:/private +#define FmErrDriveDenied -34 // if user want to access drive but it is denied, e.g D:/ +#define FmErrPathNotExist -35 // path not existed. + +#define FmEstimateUpperLimit 90 // available mem/backup size*100%=90%, User selectable continuation +#define FmEstimateLowerLimit 10 // available mem/backup size*100%=10%, Backup will be interrupted + +#define FmPlaceholderString " " // Placeholder for HbLabel because layout will be wrong when HbLabel is empty + +#define Drive_C ( QString( "C:" ) + QDir::separator() ) +#define Drive_D ( QString( "D:" ) + QDir::separator() ) +#define Drive_Z ( QString( "Z:" ) + QDir::separator() ) +#define Folder_C_Data ( QString( "C:" ) + QDir::separator() + QString( "Data" ) + QDir::separator() ) + +// define contact data path for view details. +#define FmViewDetail_Contacts ( "\\private\\10003a73\\SQLite__Contacts.cdb" ) + +#define FmMaxLengthofDriveName 11 +#define FmMaxLengthofDrivePassword 8 + +// used to match un-zeroLength string, empty character such as space is acceptable +#define Regex_ValidUnZeroLength QString( "^.+$" ) + +// used to match un-empty string, and is not totally empty characters. +#define Regex_ValidUnEmpty QString( "^.*[^\\s].*$" ) + +// this is regexp for valid file/folder name: no \/:*?"<>| and is not totally empty characters. +// file name can not end with "." , but it is not include in this RegExp. It should be checked in Regex_ValidNotEndWithDot +// this expression is composed by two expressions: +// ^.*[^\\s].*$ used to match un-empty string and is not totally empty characters. +// [^\\\\/:*?\"<>|] used to math valid file/folder name +// merge the two regex together: +// valid file/folder name and is not totally empty. +#define Regex_ValidFileFolderName QString( "^[^\\\\/:*?\"<>|]*[^\\\\/:*?\"<>|\\s][^\\\\/:*?\"<>|]*$" ) + +// is not end with dot( trim blank characters in the end first ) +#define Regex_ValidNotEndWithDot QString( "^.*[^\\.\\s][\\s]*$" ) + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmdrivemodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivemodel.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "fmdrivemodel.h" +#include "fmfileiconprovider.h" +#include "fmutils.h" + +#include +#include + +#include + +FmDriveModel::FmDriveModel( QObject *parent, Options options, + FmDriveListProvider *driveListProvider ) : + QAbstractListModel( parent ), mOptions( options ), mDriveListProvider( driveListProvider ) +{ + mIconProvider = new FmFileIconProvider(); + refresh(); +} + +FmDriveModel::~FmDriveModel() +{ + delete mIconProvider; +} + +void FmDriveModel::refresh() +{ + emit layoutAboutToBeChanged(); + mDriveList.clear(); + + // if mDriveListProvider existed, use it to fetch drive list + // otherwise use FmUtils::getDriveList to fetch drive list. + if( mDriveListProvider ) { + mDriveListProvider->getDriveList( mDriveList ); + } else { + if( mOptions & HideUnAvailableDrive ) { + FM_LOG( QString( "FmDriveModel::refresh HideUnAvailableDrive_true" ) ); + FmUtils::getDriveList( mDriveList, true ); + } else { + FM_LOG( QString( "FmDriveModel::refresh HideUnAvailableDrive_false" ) ); + FmUtils::getDriveList( mDriveList, false ); + } + } + + emit layoutChanged(); + for( int i=0; iicon( QFileInfo( path ) ); + } + } + + if (index.column() == 1 && role == Qt::TextAlignmentRole) { + return Qt::AlignRight; + } + + return QVariant(); +} + + +QVariant FmDriveModel::headerData( int section, Qt::Orientation orientation, int role ) const +{ + if (orientation == Qt::Horizontal) { + if (role != Qt::DisplayRole) + return QVariant(); + + switch (section) { + case 0: return hbTrId("Name"); + case 1: return hbTrId("Size"); + case 2: return hbTrId("Type"); + case 3: return hbTrId("Date Modified"); + default: return QVariant(); + } + } + + return QAbstractItemModel::headerData( section, orientation, role ); +} + +bool FmDriveModel::indexValid( const QModelIndex &index ) const +{ + if( !(&index) ) + return false; + return true; +} + +QString FmDriveModel::driveName( const QModelIndex &index ) const +{ + QString data; + if (index.row() >= 0 && index.row() < mDriveList.size()) { + int row = index.row(); + QString diskName = mDriveList[ row ]; + data = diskName; + } + return data; +} + +QVariant FmDriveModel::displayString( const QModelIndex &index ) const +{ + QStringList data; + if (index.row() >= 0 && index.row() < mDriveList.size()) { + int row = index.row(); + QString diskName = mDriveList[ row ]; + + if( mOptions & FillWithVolume ) { + data << FmUtils::fillDriveVolume( diskName, mOptions & FillWithDefaultVolume ); + } else { + data << FmUtils::removePathSplash( diskName ); + } + diskName = FmUtils::fillPathWithSplash( diskName ); + FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName ); + if ( mOptions & FillWithTotalSize ) { + if( driverInfo.driveState() & FmDriverInfo::EDriveAvailable ) { + data << QString( hbTrId ( "Size: " ) + FmUtils::formatStorageSize( driverInfo.size() ) ); + } else if( driverInfo.driveState() & FmDriverInfo::EDriveLocked ) { + data << QString( hbTrId ( "Locked" ) ); + } else if( driverInfo.driveState() & FmDriverInfo::EDriveCorrupted ) { + data << QString( hbTrId ( "Corrupted" ) ); + } else if( driverInfo.driveState() & FmDriverInfo::EDriveNotPresent ) { + data << QString( hbTrId ( "Not Ready" ) ); + } + } + if ( mOptions & FillWithFreeSize ) { + if( driverInfo.driveState() & FmDriverInfo::EDriveAvailable ) { + data << QString( hbTrId ( "Free: " ) + FmUtils::formatStorageSize( driverInfo.freeSize() ) ); + } else if( ( driverInfo.driveState() & FmDriverInfo::EDriveLocked ) || + ( driverInfo.driveState() & FmDriverInfo::EDriveCorrupted ) || + ( driverInfo.driveState() & FmDriverInfo::EDriveNotPresent )) { + data << QString( QString(" ") ); + } + } + } + return data; +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmdrivemodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivemodel.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,88 @@ +/* +* 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 FMDRIVEMODEL_H +#define FMDRIVEMODEL_H + +#include +#include +#include + +class FmFileIconProvider; + +/*! + \class FmDriveListProvider + \brief The class FmDriveListProvider provide drive list which is used in FmDriveModel + */ +class FmDriveListProvider +{ +public: + FmDriveListProvider() + { + } + + virtual ~FmDriveListProvider() + { + } + + /*! + implement this function to provide drive list. + */ + virtual void getDriveList( QStringList &driveList ) = 0; +}; + +class FmDriveModel : public QAbstractListModel +{ +Q_OBJECT +public: + enum Option + { + FillWithVolume = 0x00000001, // add volume behind disname + FillWithDefaultVolume = 0x00000002, // add default diskname while enable FillWithVolume and volume is empty + HideUnAvailableDrive = 0x00000004, // for example: drive F when no MMC card inserted. + FillWithTotalSize = 0x00000008, // show the drive's total size. + FillWithFreeSize = 0x00000010 //show the drive's free size. + }; + Q_DECLARE_FLAGS(Options, Option) + + explicit FmDriveModel( QObject *parent = 0, Options options = 0, + FmDriveListProvider *driveListProvider = 0 ); + virtual ~FmDriveModel(); + + void refresh(); + int rowCount( const QModelIndex &parent = QModelIndex() ) const; + int columnCount( const QModelIndex &parent = QModelIndex() ) const; + QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; + QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; + bool indexValid( const QModelIndex &index ) const; + QString driveName( const QModelIndex &index ) const; + QVariant displayString( const QModelIndex &index ) const; + +private: + QStringList mFindResult; + FmFileIconProvider *mIconProvider; + QStringList mDriveList; + Options mOptions; + + // DriveListProvider will ignore HideUnAvailableDrive option. + // DriveListProvide can be set by others to provide special drive list + FmDriveListProvider *mDriveListProvider; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(FmDriveModel::Options) + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmdrivewatcher/fmdrivewatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/fmdrivewatcher.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* +* Description: +* The source file of drive watcher +*/ + +#include "fmdrivewatcher.h" + +#include "fmdrivewatcherprivate.h" + +FmDriveWatcher::FmDriveWatcher( QObject *parent ) : QObject( parent ) +{ + d = new FmDriveWatcherPrivate( this ); + connect( d, SIGNAL(driveAddedOrChanged()), this, SLOT( onDriveAddedOrChanged() )); +} + +FmDriveWatcher::~FmDriveWatcher() +{ + delete d; +} + + +void FmDriveWatcher::startWatch() +{ + d->startWatch(); +} +void FmDriveWatcher::cancelWatch() +{ + d->cancelWatch(); +} + +void FmDriveWatcher::onDriveAddedOrChanged() +{ + emit driveAddedOrChanged(); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmdrivewatcher/fmdrivewatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/fmdrivewatcher.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,44 @@ +/* +* 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: +* The header file of drive watcher +*/ + +#ifndef FMDRIVEWATCHER_H +#define FMDRIVEWATCHER_H + +#include + +class FmDriveWatcherPrivate; + +class FmDriveWatcher : public QObject +{ +Q_OBJECT +public: + FmDriveWatcher( QObject *parent = 0 ); + virtual ~FmDriveWatcher(); + void startWatch(); + void cancelWatch(); + +signals: + void driveAddedOrChanged(); +private slots: + void onDriveAddedOrChanged(); +private: + FmDriveWatcherPrivate *d; +}; + + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmdrivewatcher/private/symbian/fmdriveevent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/private/symbian/fmdriveevent.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,150 @@ +/* +* 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: +* The source file of drive event watcher +*/ + + +// INCLUDE FILES +#include "fmdriveevent.h" +#include +#include "fmcommon.h" + +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CFileManagerFileSystemEvent::CFileManagerFileSystemEvent +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// + +CFmDriveEvent::CFmDriveEvent( + RFs& aFs, + MFmDriveEventObserver *aObserver ) : + CActive( CActive::EPriorityLow ), + iFs( aFs ), + iObserver( aObserver ) + { + } + +// ----------------------------------------------------------------------------- +// CFmDriveEvent::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CFmDriveEvent::ConstructL() + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CFmDriveEvent::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CFmDriveEvent* CFmDriveEvent::NewL( + RFs& aFs, + MFmDriveEventObserver *aObserver ) + { + CFmDriveEvent* self = + new( ELeave ) CFmDriveEvent( + aFs, + aObserver ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ------------------------------------------------------------------------------ +// CFmDriveEvent::~CFmDriveEvent +// +// ------------------------------------------------------------------------------ +CFmDriveEvent::~CFmDriveEvent() + { + Cancel(); + } + +// ----------------------------------------------------------------------------- +// CFmDriveEvent::RunError +// From CActive. Called when error occurred in asynchronous request +// Notifies the observer +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CFmDriveEvent::RunError( TInt /*aError*/ ) + { + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CFmDriveEvent::DoCancel +// From CActive. Called when asynchronous request is canceled +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CFmDriveEvent::DoCancel() + { + iFs.NotifyChangeCancel( iStatus ); + } + +// ------------------------------------------------------------------------------ +// CFmDriveEvent::Setup +// +// ------------------------------------------------------------------------------ +// +void CFmDriveEvent::Setup() + { + FM_LOG( QString( "CFmDriveEvent::Setup start" ) ); + if( IsActive() ) + { + return; + } + + iFs.NotifyChange( ENotifyDisk, iStatus ); + SetActive(); + FM_LOG( QString( "CFmDriveEvent::Setup end" ) ); + } + +// ----------------------------------------------------------------------------- +// CFmDriveEvent::RunL +// From CActive. Called when asynchronous request is completed. +// Notifies the observer +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CFmDriveEvent::RunL() + { + if( iStatus == KErrNone ){ + if( iObserver ){ + iObserver->OnDriveAddedOrChangedL(); + } + + Setup(); + } + + /* + CAknInformationNote* informationNote; + informationNote = new ( ELeave ) CAknInformationNote; + informationNote->ExecuteLD( _L( "driveChanged!")); + */ + } + +// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmdrivewatcher/private/symbian/fmdriveevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/private/symbian/fmdriveevent.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* +* Description: +* The header file of drive event watcher +*/ + +#ifndef CFMDRIVEEVENT_H +#define CFMDRIVEEVENT_H + + +// INCLUDES +#include +#include + +class MFmDriveEventObserver + { + public: + virtual void OnDriveAddedOrChangedL() = 0; + }; +// CLASS DECLARATION + +/** +* This class listens file system events +* +* @lib FileManagerEngine.lib +* @since 2.0 +*/ +NONSHARABLE_CLASS(CFmDriveEvent) : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CFmDriveEvent* NewL( RFs& aFs, MFmDriveEventObserver* aObserver ); + + /** + * Destructor. + */ + virtual ~CFmDriveEvent(); + + public: + + /** + * Sets file system event + * @since 2.0 + */ + void Setup(); + + protected: // Functions from base classes + + /** + * From CActive Called when asynchronous request has completed + * @since 2.0 + */ + void RunL(); + + /** + * From CActive Called when asynchronous request has failed + * @since 2.0 + */ + TInt RunError( TInt aError ); + + /** + * From CActive Called when asynchronous request was cancelled + * @since 2.0 + */ + void DoCancel(); + + private: + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * C++ default constructor. + */ + CFmDriveEvent( RFs& aFs, MFmDriveEventObserver* aObserver ); + + private: // Data + // Ref: Reference to opened File System session + RFs& iFs; + + // Ref: This object is called when RunL occurs + MFmDriveEventObserver *iObserver; + }; + +#endif // CFMDRIVEEVENT_H + +// End of File diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,53 @@ +/* +* 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: +* The source file of drive event watcher private +*/ + +#include "fmdrivewatcherprivate.h" + +#include "fmdrivewatcher.h" +#include "fmcommon.h" + +FmDriveWatcherPrivate::FmDriveWatcherPrivate( FmDriveWatcher *driveWatcher ) : + q( driveWatcher ) +{ + fs.Connect(); + mDriveEvent = CFmDriveEvent::NewL( fs, this ); +} + +FmDriveWatcherPrivate::~FmDriveWatcherPrivate() +{ + fs.Close(); + delete mDriveEvent; +} + + +void FmDriveWatcherPrivate::startWatch() +{ + mDriveEvent->Setup(); +} + +void FmDriveWatcherPrivate::cancelWatch() +{ + mDriveEvent->Cancel(); +} + +void FmDriveWatcherPrivate::OnDriveAddedOrChangedL() +{ + FM_LOG( QString( "FmDriveWatcherPrivate::OnDriveAddedOrChangedL start" ) ); + emit driveAddedOrChanged(); + FM_LOG( QString( "FmDriveWatcherPrivate::OnDriveAddedOrChangedL end" ) ); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,53 @@ +/* +* 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: +* The header file of drive event watcher private +*/ + +#ifndef FMDRIVEWATCHERPRIVATE_H +#define FMDRIVEWATCHERPRIVATE_H + +#include + +#include "fmdriveevent.h" + +#include + +class FmDriveWatcher; + +class FmDriveWatcherPrivate : public QObject, public MFmDriveEventObserver +{ +Q_OBJECT +public: + FmDriveWatcherPrivate( FmDriveWatcher *driveWatcher ); + virtual ~FmDriveWatcherPrivate(); + + void startWatch(); + void cancelWatch(); + + void onDriveAdded(); + void onDriveRemoved(); + + void OnDriveAddedOrChangedL(); +signals: + void driveAddedOrChanged(); + +private: + FmDriveWatcher *q; + CFmDriveEvent *mDriveEvent; + RFs fs; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmdrivewatcher/private/win32/fmdrivewatcherprivate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/private/win32/fmdrivewatcherprivate.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,50 @@ +/* +* 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: +* The source file of drive event watcher private +*/ + +#include "fmdrivewatcherprivate.h" + +#include "fmdrivewatcher.h" + +FmDriveWatcherPrivate::FmDriveWatcherPrivate( FmDriveWatcher *driveWatcher ) : + q( driveWatcher ) +{ +} + +FmDriveWatcherPrivate::~FmDriveWatcherPrivate() +{ +} + + +void FmDriveWatcherPrivate::startWatch() +{ + +} + +void FmDriveWatcherPrivate::cancelWatch() +{ + +} + +void FmDriveWatcherPrivate::onDriveAdded() +{ + +} +void FmDriveWatcherPrivate::onDriveRemoved() +{ + +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmdrivewatcher/private/win32/fmdrivewatcherprivate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/private/win32/fmdrivewatcherprivate.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,46 @@ +/* +* 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: +* The header file of drive event watcher private +*/ + +#ifndef FMDRIVEWATCHERPRIVATE_H +#define FMDRIVEWATCHERPRIVATE_H + +#include + +class FmDriveWatcher; + +class FmDriveWatcherPrivate : public QObject +{ +Q_OBJECT +public: + FmDriveWatcherPrivate( FmDriveWatcher *driveWatcher ); + virtual ~FmDriveWatcherPrivate(); + + void startWatch(); + void cancelWatch(); + + void onDriveAdded(); + void onDriveRemoved(); + +signals: + void driveAddedOrChanged(); + +private: + FmDriveWatcher *q; +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmfileiconprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmfileiconprovider.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,174 @@ +/* +* 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: filemanager file icon provider source file +* +*/ + +#include "fmfileiconprovider.h" +#include "fmfiletyperecognizer.h" +#include "fmutils.h" + +#include +#include + +#include "hbicon.h" + +//#define mmcIcon ":image/qgn_prop_mmc_memc.svg" +//#define mmcNoneIcon ":image/qgn_prop_fmgr_mmc_no_sub.svg" +//#define mmcLockedIcon ":image/qgn_prop_mmc_locked.svg" +//#define phoneMemoryIcon ":image/qgn_prop_phone_memc.svg" +//#define usbMemoryIcon ":image/qgn_prop_usb_memc.svg" +//#define massMemoryIcon ":image/qgn_prop_fmgr_ms.svg" + +#define phoneMemoryIcon "qtg_large_mobile" +#define massMemoryIcon "qtg_large_mass_storage" +#define mmcIcon "qtg_large_mmc" +#define mmcNoneIcon "qtg_large_mmc_removed" +#define usbMemoryIcon "qtg_large_usb_memory" + +//TODO: UI_Update: mmcl locked icon have not provided in icon spec +// Just use original custom-defined icon +#define mmcLockedIcon ":image/qgn_prop_mmc_locked.svg" + + +#define folderIcon "qtg_large_folder" + +#define imageIcon "qtg_large_photos" +#define videoIcon "qtg_large_video" +#define toneIcon "qtg_large_tone" +#define playlistIcon "qtg_large_playlist" +#define textIcon "qtg_large_text" +#define sisxIcon "qtg_large_sisx" +#define javaIcon "qtg_large_java" +#define flashIcon "qtg_large_flash" +#define widgetIcon "qtg_large_widget" +#define weblinkIcon "qtg_large_web_link" +#define queryIcon "qtg_large_query" + +FmFileIconProvider::FmFileIconProvider() +{ + mFileTypeRecognizer = new FmFileTypeRecognizer(); +} + +FmFileIconProvider::~FmFileIconProvider() +{ + delete mFileTypeRecognizer; +} + +QIcon FmFileIconProvider::icon(const QFileInfo &info) const +{ + QIcon retIcon; + + QString filePath( info.absoluteFilePath() ); + FmFileTypeRecognizer::FileType fileType = mFileTypeRecognizer->getType( filePath ); + switch( fileType ) + { + case FmFileTypeRecognizer::FileTypeDrive: + { + FmDriverInfo driveInfo = FmUtils::queryDriverInfo( filePath ); + switch ( driveInfo.driveType() ) + { + case FmDriverInfo::EDriveTypeMassStorage: + retIcon = HbIcon( massMemoryIcon ).qicon(); + break; + case FmDriverInfo::EDriveTypeUsbMemory: + retIcon = HbIcon( usbMemoryIcon ).qicon(); + break; + case FmDriverInfo::EDriveTypeMemoryCard: + if( !( driveInfo.driveState() & FmDriverInfo::EDriveNotPresent ) ) { + retIcon = HbIcon( mmcIcon ).qicon(); + } else { + retIcon = HbIcon( mmcNoneIcon ).qicon(); + } + break; + case FmDriverInfo::EDriveTypePhoneMemory: + retIcon = HbIcon( phoneMemoryIcon ).qicon(); + break; + case FmDriverInfo::EDriveTypeNotExist: // drive not exist, let QFileIconProvider to judge icon + default: // filemanger do not provide icon for other drive types, let QFileIconProvider to judge icon + break; + } + break; + } + case FmFileTypeRecognizer::FileTypeFolder: + { + retIcon = HbIcon( folderIcon ).qicon(); + break; + } + case FmFileTypeRecognizer::FileTypeImage: + { + retIcon = HbIcon( imageIcon ).qicon(); + break; + } + case FmFileTypeRecognizer::FileTypeVideo: + { + retIcon = HbIcon( videoIcon ).qicon(); + break; + } + case FmFileTypeRecognizer::FileTypeTone: + { + retIcon = HbIcon( toneIcon ).qicon(); + break; + } + case FmFileTypeRecognizer::FileTypePlaylist: + { + retIcon = HbIcon( playlistIcon ).qicon(); + break; + } + case FmFileTypeRecognizer::FileTypeText: + { + retIcon = HbIcon( textIcon ).qicon(); + break; + } + case FmFileTypeRecognizer::FileTypeSisx: + { + retIcon = HbIcon( sisxIcon ).qicon(); + break; + } + case FmFileTypeRecognizer::FileTypeJava: + { + retIcon = HbIcon( javaIcon ).qicon(); + break; + } + case FmFileTypeRecognizer::FileTypeFlash: + { + retIcon = HbIcon( flashIcon ).qicon(); + break; + } + case FmFileTypeRecognizer::FileTypeWidget: + { + retIcon = HbIcon( widgetIcon ).qicon(); + break; + } + case FmFileTypeRecognizer::FileTypeWebLink: + { + retIcon = HbIcon( weblinkIcon ).qicon(); + break; + } + case FmFileTypeRecognizer::FileTypeUnKnown: + { + // currently filemanger icon doc is not unified with icon name. + // for example, qtg_small_unknown qtg_large_query both means for unknown type + // but the two icon name is not the same. + retIcon = HbIcon( queryIcon ).qicon(); + break; + } + } + + // if cannot get icon, return icon from QFileIconProvider + if( retIcon.isNull() ) { + retIcon = QFileIconProvider::icon( info ); + } + return retIcon; +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmfileiconprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmfileiconprovider.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,40 @@ +/* +* 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: +* The header file of file icon provider of filemanager +*/ + +#ifndef FMFILEICONPROVIDER_H +#define FMFILEICONPROVIDER_H + +#include + +class FmFileTypeRecognizer; + +class FmFileIconProvider : public QFileIconProvider +{ +public: + FmFileIconProvider(); + virtual ~FmFileIconProvider(); + + // from QFileIconProvider + virtual QIcon icon(const QFileInfo &info) const; + +private: + + FmFileTypeRecognizer *mFileTypeRecognizer; + +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmfiletyperecognizer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmfiletyperecognizer.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,109 @@ +/* + * 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: + * The source file of the file type recognizer + */ + +#include "fmfiletyperecognizer.h" +#include "fmutils.h" +#include +#include + +FmFileTypeRecognizer::FmFileTypeRecognizer() +{ + mFileExtensionMap.insert( QString( "bmp" ), FileTypeImage ); + mFileExtensionMap.insert( QString( "gif" ), FileTypeImage ); + mFileExtensionMap.insert( QString( "jpe" ), FileTypeImage ); + mFileExtensionMap.insert( QString( "jpeg" ),FileTypeImage ); + mFileExtensionMap.insert( QString( "jpg" ), FileTypeImage ); + mFileExtensionMap.insert( QString( "ota" ), FileTypeImage ); + mFileExtensionMap.insert( QString( "png" ), FileTypeImage ); + mFileExtensionMap.insert( QString( "tif" ), FileTypeImage ); + mFileExtensionMap.insert( QString( "tiff" ),FileTypeImage ); + mFileExtensionMap.insert( QString( "wbmp" ),FileTypeImage ); + mFileExtensionMap.insert( QString( "wmf" ), FileTypeImage ); + mFileExtensionMap.insert( QString( "jp2" ), FileTypeImage ); + mFileExtensionMap.insert( QString( "jpg2" ),FileTypeImage ); + mFileExtensionMap.insert( QString( "jp3" ), FileTypeImage ); + mFileExtensionMap.insert( QString( "ico" ), FileTypeImage ); + mFileExtensionMap.insert( QString( "vcf" ), FileTypeImage ); + + mFileExtensionMap.insert( QString( "3gp" ), FileTypeVideo ); + mFileExtensionMap.insert( QString( "mp4" ), FileTypeVideo ); + mFileExtensionMap.insert( QString( "nim" ), FileTypeVideo ); + mFileExtensionMap.insert( QString( "rm" ), FileTypeVideo ); + mFileExtensionMap.insert( QString( "rv" ), FileTypeVideo ); + mFileExtensionMap.insert( QString( "wmv" ), FileTypeVideo ); + mFileExtensionMap.insert( QString( "3g2" ), FileTypeVideo ); + mFileExtensionMap.insert( QString( "rmvb" ),FileTypeVideo ); + mFileExtensionMap.insert( QString( "mkv" ), FileTypeVideo ); + + + mFileExtensionMap.insert( QString( "aac" ), FileTypeTone ); + mFileExtensionMap.insert( QString( "amr" ), FileTypeTone ); + mFileExtensionMap.insert( QString( "au" ), FileTypeTone ); + mFileExtensionMap.insert( QString( "awb" ), FileTypeTone ); + mFileExtensionMap.insert( QString( "mid" ), FileTypeTone ); + mFileExtensionMap.insert( QString( "mp3" ), FileTypeTone ); + mFileExtensionMap.insert( QString( "ra" ), FileTypeTone ); + mFileExtensionMap.insert( QString( "rmf" ), FileTypeTone ); + mFileExtensionMap.insert( QString( "rng" ), FileTypeTone ); + mFileExtensionMap.insert( QString( "snd" ), FileTypeTone ); + mFileExtensionMap.insert( QString( "wav" ), FileTypeTone ); + mFileExtensionMap.insert( QString( "wve" ), FileTypeTone ); + mFileExtensionMap.insert( QString( "wma" ), FileTypeTone ); + mFileExtensionMap.insert( QString( "m4a" ), FileTypeTone ); + mFileExtensionMap.insert( QString( "ott" ), FileTypeTone ); + mFileExtensionMap.insert( QString( "mxmf" ),FileTypeTone ); + + mFileExtensionMap.insert( QString( "doc" ), FileTypeText ); + mFileExtensionMap.insert( QString( "pdf" ), FileTypeText ); + mFileExtensionMap.insert( QString( "pps" ), FileTypeText ); + mFileExtensionMap.insert( QString( "ppt" ), FileTypeText ); + mFileExtensionMap.insert( QString( "txt" ), FileTypeText ); + mFileExtensionMap.insert( QString( "xls" ), FileTypeText ); + + mFileExtensionMap.insert( QString( "sis" ), FileTypeSisx ); + mFileExtensionMap.insert( QString( "sisx" ),FileTypeSisx ); + + mFileExtensionMap.insert( QString( "jad" ), FileTypeJava ); + mFileExtensionMap.insert( QString( "jar" ), FileTypeJava ); + + mFileExtensionMap.insert( QString( "swf" ), FileTypeFlash ); + + // have not handle FileTypePlaylist + // have not handle FileTypeWidget + // have not handle FileTypeWebLink +} + +FmFileTypeRecognizer::~FmFileTypeRecognizer() +{ + +} + +FmFileTypeRecognizer::FileType FmFileTypeRecognizer::getType( const QString& path ) const +{ + if( FmUtils::isDrive( path ) ) { + return FileTypeDrive; + } + + QFileInfo fileInfo(path); + if( fileInfo.isDir() ) { + return FileTypeFolder; + } + + //if can not find key, return default value: FileTypeUnKnown + return mFileExtensionMap.value( fileInfo.suffix().toLower(), FileTypeUnKnown ); +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmfiletyperecognizer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmfiletyperecognizer.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,67 @@ +/* + * 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: + * The header file of the file type recognizer + */ + +#ifndef FMFILETYPERECOGNIZER_H +#define FMFILETYPERECOGNIZER_H + +#include "fmcommon.h" +#include +#include +#include +#include + +/*! + \class FmFileTypeRecognizer + \brief The class FmFileTypeRecognizer used to recognize file type by path. + */ +class FmFileTypeRecognizer +{ +public: + enum FileType{ + FileTypeDrive, + FileTypeFolder, + FileTypeImage, + FileTypeVideo, + FileTypeTone, + FileTypePlaylist, + FileTypeText, + FileTypeSisx, + FileTypeJava, + FileTypeFlash, + FileTypeWidget, + FileTypeWebLink, + FileTypeUnKnown + }; + + +public: + FmFileTypeRecognizer(); + virtual ~FmFileTypeRecognizer(); + + /*! + Recognize file type, currently only judge file by its extension name. + */ + FmFileTypeRecognizer::FileType getType( const QString& path ) const ; + +private: + // used to store single extension name, FileType pare. + QMap mFileExtensionMap; +}; + +#endif /* FMFILETYPERECOGNIZER_H */ + diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmlogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmlogger.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,56 @@ +/* + * 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: + * The header file of logger + */ +#ifndef FMLOGGER_H +#define FMLOGGER_H + +#define FMLOG_PATH QString( "C:\\data\\fileman.txt" ) + +#include +#include +#include +#include + +#ifdef _DEBUG_LOG_ENABLE_ + #define FM_LOG(str) FmLogger::log( str ); +#else + #define FM_LOG(str) +#endif + +class FmLogger +{ +public: + + static bool log( const QString &log ) + { +#ifdef _DEBUG_LOG_ENABLE_ + QString logStr( QDateTime::currentDateTime().toString("hh:mm:ss:zzz") + " " + log + "\r\n" ); + QFile file( FMLOG_PATH ); + if ( !file.open( QIODevice::WriteOnly | QIODevice::Append ) ) + { + return false; + } + QTextStream out( &file ); + out << logStr; +#else + Q_UNUSED( log ); +#endif + return true; + } +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fms60utils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fms60utils.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,31 @@ +/* +* 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: +* The source file of the file manager s60 utilities +*/ + + +#include "fms60utils.h" + +void FmS60Utils::ConvertCharsToPwd(TDesC& aWord, TDes8& aConverted) +{ + aConverted.FillZ(aConverted.MaxLength()); + aConverted.Zero(); + + if (aWord.Length()) + { + aConverted.Copy( (TUint8*)(&aWord[0]), aWord.Size() ); + } +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fms60utils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fms60utils.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,31 @@ +/* +* 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: +* The header file of the file manager s60 utilities +*/ + +#ifndef FMS60UTILS_H +#define FMS60UTILS_H + +#include "fmcommon.h" +#include + +class FmS60Utils +{ +public: + static void ConvertCharsToPwd( TDesC& aWord, TDes8& aConverted ); +}; + +#endif diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmutils.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,412 @@ +/* +* 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: +* Zhiqiang Yang +* +* Description: +* The source file of the file manager utilities +*/ + +#include "fmutils.h" + +#include +#include + +#include + +/*! + Used to get drive type for convenience. +*/ +FmDriverInfo::DriveType FmDriverInfo::driveType() +{ + FmDriverInfo::DriveType driveType; + if( mDriveState & FmDriverInfo::EDriveRemovable ) { + // if drive is removable, it may be mass, usb, or remote drive + if( mDriveState & FmDriverInfo::EDriveMassStorage ) { + driveType = FmDriverInfo::EDriveTypeMassStorage; + } else if( mDriveState & FmDriverInfo::EDriveUsbMemory ) { + driveType = FmDriverInfo::EDriveTypeUsbMemory; + } else if( mDriveState & FmDriverInfo::EDriveRemote ){ + driveType = FmDriverInfo::EDriveTypeRemote; + } else { + driveType = FmDriverInfo::EDriveTypeMemoryCard; + } + } else if( mDriveState & FmDriverInfo::EDriveRom ) { + driveType = FmDriverInfo::EDriveTypeRom; + } else if( mDriveState & FmDriverInfo::EDriveRam ) { + driveType = FmDriverInfo::EDriveTypeRam; + } else { + // if drive type is not recognized in previous condition, + // it should be an un-existed drive or phone memory + if( mDriveState & EDriveNotPresent ){ + // if come here, means 2 conditions: + // 1 this drive is not exist( FmUtils::queryDriverInfo will give EDriveNotPresent to mDriveState ) + // 2 un-mounted removable drive + // removable drive filted in previous condifiton. So, give EDriveTypeNotExist + driveType = FmDriverInfo::EDriveTypeNotExist; + } else { + // drive is existed, only remain the type of EDriveTypePhoneMemory + driveType = FmDriverInfo::EDriveTypePhoneMemory; + } + } + + return driveType; +} + +/*! + return drive name for \a path +*/ +QString FmUtils::getDriveNameFromPath( const QString &path ) +{ + // fillPathWithSplash make sure path length will be at least 3 if it is not empty. + QString checkedPath( fillPathWithSplash( path ) ); + if( checkedPath.length() < 3 ) { + return QString(); + } + return checkedPath.left( 3 ); +} + +/*! + return drive letter for \a path +*/ +QString FmUtils::getDriveLetterFromPath( const QString &path ) +{ + if( path.length() <2 ) { + return QString(); + } + return path.left( 1 ); +} + +/*! + return formatted string for size. +*/ +QString FmUtils::formatStorageSize( quint64 size ) +{ + if ( size < 1000 ) { + return QString::number( size ) + " B"; + } else if ( size < 1000 * 1000 ) { + return QString::number( size / 1024.0, 'f', 2 ) + " KB"; + } else if ( size < 1000 * 1000 * 1000 ) { + return QString::number( size / (1024.0 * 1024.0), 'f', 1 ) + " MB"; + } else { + return QString::number( size / ( 1024.0 * 1024.0 * 1024.0 ), 'f', 1 ) + " GB"; + } +} + +/*! + Judge if a path is drive path, not a folder or a file. + For example, true for C:\ while false for C:\data +*/ +bool FmUtils::isDrive( const QString &path ) +{ + bool ret( false ); + if( path.length() <= 3 && path.length() >=2 ) { + ret = true; + } + + return ret; +} + +/*! + All "/" and "\" in \a path will be changed to QDir::separator + \sa fillPathWithSplash, fillPathWithSplash will append QDir::separator in the end +*/ +QString FmUtils::formatPath( const QString &path ) +{ + QString formatPath; + if( path.isEmpty() ) { + return formatPath; + } + + foreach( const QChar &ch, path ) { + if( ch == QChar('\\') || ch == QChar('/') ) { + formatPath.append( QDir::separator() ); + } else { + formatPath.append( ch ); + } + } + + return formatPath; +} + +/*! + Fill splash in the end of \a filePath. And all "/" and "\" will be changed to QDir::separator + Please do not call this function if path is a file. + Use \a formatPath instead, \a formatPath will not append QDir::separator in the end. + \sa formatPath only changed "/" and "\" to QDir::separator +*/ +QString FmUtils::fillPathWithSplash( const QString &filePath ) +{ + QString newFilePath; + if( filePath.isEmpty() ) { + return newFilePath; + } + + newFilePath = formatPath( filePath ); + + if( newFilePath.right( 1 )!= QDir::separator() ){ + newFilePath.append( QDir::separator() ); + } + return newFilePath; +} + +/*! + Remove splash in the end of \a filePath. +*/ +QString FmUtils::removePathSplash( const QString &filePath ) +{ + QString newFilePath( filePath ); + if( filePath.right( 1 ) == QChar( '/' ) || filePath.right(1) == QString( "\\" ) ) { + newFilePath = filePath.left( filePath.length() - 1 ); + } + return newFilePath; +} + +/*! + fill \a driveList of drives can be shown in driveListView +*/ +void FmUtils::getDriveList( QStringList &driveList, bool isHideUnAvailableDrive ) +{ + if( isHideUnAvailableDrive ) { + FM_LOG( QString( "getDriveList HideUnAvailableDrive_true" ) ); + } else { + FM_LOG( QString( "getDriveList HideUnAvailableDrive_false" ) ); + } + QFileInfoList infoList = QDir::drives(); + + foreach( const QFileInfo &fileInfo, infoList ) { + QString driveName = fileInfo.absolutePath(); + if( checkDriveAccessFilter( driveName ) ) { + if( !isHideUnAvailableDrive ) { + driveList.append( driveName ); + } + else if ( isDriveAvailable( driveName ) ) { + driveList.append( driveName ); + } + } + } + return; +} + +/*! + return the combined string of drive name and volume( e.g. C: Phone memory for C drive) + \a driveName the drive name. + If set \a isFillWithDefaultVolume true, fill result with default volume if drive volume is empty. +*/ +QString FmUtils::fillDriveVolume( QString driveName, bool isFillWithDefaultVolume ) +{ + QString ret; + if( driveName.isEmpty() ) { + return ret; + } + QString tempDriveName = fillPathWithSplash( driveName ); + + QString checkedDriveName( removePathSplash( driveName ) ); + + FmDriverInfo driverInfo = FmUtils::queryDriverInfo( tempDriveName ); + QString volumeName = driverInfo.volumeName(); + + if( volumeName.isEmpty() && isFillWithDefaultVolume ){ + switch ( driverInfo.driveType() ) + { + case FmDriverInfo::EDriveTypeMassStorage: + ret = hbTrId( "txt_fmgr_dblist_1_mass_storage" ).arg( checkedDriveName ); + break; + case FmDriverInfo::EDriveTypeUsbMemory: + ret = hbTrId( "txt_fmgr_dblist_1_usb_memory" ).arg( checkedDriveName ); + break; + case FmDriverInfo::EDriveTypeMemoryCard: + ret = hbTrId( "txt_fmgr_dblist_1_memory_card" ).arg( checkedDriveName ); + break; + case FmDriverInfo::EDriveTypePhoneMemory: + ret = hbTrId( "txt_fmgr_dblist_1_device_memory" ).arg( checkedDriveName ); + break; + case FmDriverInfo::EDriveTypeNotExist:// no such drive + default:// do not need get volume for other drive types, e.g. Ram, Rom + break; + } + } + + if( ret.isEmpty() ) { + // ret is not got. fill ret as default method + // txt_fmgr_dblist_1_2 is not correct, can not use. + ret = hbTrId( "%1 %2" ).arg( checkedDriveName ).arg( volumeName ); + } + return ret; +} + +/*! + return the default volume for drive + \a driveName the drive. + \sa getVolumeNameWithDefaultNameIfNull +*/ +QString FmUtils::getDefaultVolumeName( const QString &driveName ) +{ + QString defaultVolumeName; + FmDriverInfo driverInfo = FmUtils::queryDriverInfo( driveName ); + + switch ( driverInfo.driveType() ) + { + case FmDriverInfo::EDriveTypeMassStorage: + defaultVolumeName = hbTrId("Mass storage"); + break; + case FmDriverInfo::EDriveTypeUsbMemory: + defaultVolumeName = hbTrId("USB memory"); + break; + case FmDriverInfo::EDriveTypeMemoryCard: + defaultVolumeName = hbTrId("Memory card"); + break; + case FmDriverInfo::EDriveTypePhoneMemory: + defaultVolumeName = hbTrId("Device memory"); + break; + case FmDriverInfo::EDriveTypeNotExist:// no such drive, break and return empty string + default:// do not have default volume for other drive types, e.g. Ram, Rom + break; + } + return defaultVolumeName; +} + +/*! + get the volume name of the drive, if it is null, then return the default name. + \a driveName the drive letter. + \a defaultName whether it is the default name. + return the volume name. +*/ +QString FmUtils::getVolumeNameWithDefaultNameIfNull( const QString &driveName, bool &defaultName ) +{ + // do not re-use FmUtils::getDefaultVolumeName to save one time for call FmUtils::queryDriverInfo + FmDriverInfo driverInfo = FmUtils::queryDriverInfo( driveName ); + + QString volumeName = driverInfo.volumeName(); + //save the volume status, whether it is default name + defaultName = false; + //volume name may be null if not set, it will be set at least for one time in the following while cycling. + if ( volumeName.isEmpty() ) { + switch ( driverInfo.driveType() ) + { + case FmDriverInfo::EDriveTypeMassStorage: + volumeName = hbTrId("Mass storage"); + break; + case FmDriverInfo::EDriveTypeUsbMemory: + volumeName = hbTrId("USB memory"); + break; + case FmDriverInfo::EDriveTypeMemoryCard: + volumeName = hbTrId("Memory card"); + break; + case FmDriverInfo::EDriveTypePhoneMemory: + volumeName = hbTrId("Device memory"); + break; + case FmDriverInfo::EDriveTypeNotExist:// no such drive + default:// do not need get volume for other drive types, e.g. Ram, Rom + break; + } + if( !volumeName.isEmpty() ) { + defaultName = true; + } + } + return volumeName; +} + +/*! + Check if two path are the same. +*/ +bool FmUtils::isPathEqual( const QString &pathFst, const QString &pathLast ) +{ + QString fst( fillPathWithSplash( pathFst ) ); + QString last( fillPathWithSplash( pathLast ) ); + if( fst.compare( last, Qt::CaseInsensitive ) == 0 ) { + return true; + } + return false; +} + +/*! + Check if a name is illegal for folder/file naming rule. +*/ +bool FmUtils::checkFolderFileName( const QString& name ) +{ + // trim space firest, because there may be some spaces after "." , it is also not valid + QString trimmedName( name.trimmed() ); + if( trimmedName.isEmpty() ) { + return false; + } + if( trimmedName.endsWith( QChar('.'), Qt::CaseInsensitive ) ) { + return false; + } + if( trimmedName.contains( QChar('\\'), Qt::CaseInsensitive ) || + trimmedName.contains( QChar('/'), Qt::CaseInsensitive ) || + trimmedName.contains( QChar(':'), Qt::CaseInsensitive ) || + trimmedName.contains( QChar('*'), Qt::CaseInsensitive ) || + trimmedName.contains( QChar('?'), Qt::CaseInsensitive ) || + trimmedName.contains( QChar('\"'), Qt::CaseInsensitive ) || + trimmedName.contains( QChar('<'), Qt::CaseInsensitive ) || + trimmedName.contains( QChar('>'), Qt::CaseInsensitive ) || + trimmedName.contains( QChar('|'), Qt::CaseInsensitive ) ){ + return false; + } + // use original name to exam max size of file name + if( name.length() > getMaxFileNameLength() ) { + return false; + } + return true; +} + +/*! + check file or folder path is illegal or not. + \a fileName file/folder name, used to check illegal characters + \a path file/folder path, used to check if path is available to use. + \a errString if return false, errString will be set for error note. + return true for not illegal and false for illegal path. +*/ +bool FmUtils::checkNewFolderOrFile( const QString &fileName, const QString &path, QString &errString ) +{ + // first check if fileName is valid, then check if path length is valid, and check if file/foler is existed at last + QFileInfo fileInfo( path ); + bool ret( true ); + if (!FmUtils::checkFolderFileName( fileName ) ) { + errString = hbTrId( "Invalid file or folder name!" ); + ret = false; + } else if( !FmUtils::checkMaxPathLength( path ) ) { + errString = hbTrId( "the path you specified is too long!" ); + ret = false; + } else if (fileInfo.exists()) { + errString = hbTrId( "%1 already exist!" ).arg( fileInfo.fileName() ); + ret = false; + } + return ret; +} + +/*! + Check if \a dest is sub level path of \a src + Used to check True/False when copy a folder to itself or its subfolder + For example, c:\data\test is sub path of c:\data. + But c:\data123\test is not sub path of c:\data. + So after got right part of path, the first char must be \ or / +*/ +bool FmUtils::isSubLevelPath( const QString &src, const QString &dest ) +{ + FM_LOG("FmUtils::isSubFolder: src=" + src + " dest=" + dest); + QString checkedSrc( FmUtils::fillPathWithSplash( src ) ); + QString checkedDest( FmUtils::fillPathWithSplash( dest ) ); + + if( checkedDest.contains( checkedSrc, Qt::CaseInsensitive) && + checkedDest.length() > checkedSrc.length() ) { + // for example c:\data\ vs c:\data\123\ + FM_LOG("FmUtils::isSubFolder: true"); + return true; + } + // for example c:\data\ vs c:\data\ + // for example c:\data\ vs c:\data123\ + + FM_LOG("FmUtils::isSubFolder: false"); + return false; +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmutils.h Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,211 @@ +/* +* 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: +* Zhiqiang Yang +* +* Description: +* The header file of the file manager utilities +*/ + +#ifndef FMUTILS_H +#define FMUTILS_H + +#include "fmcommon.h" + +#include + +/*! + \class FmDriverInfo + \brief The class FmDriverInfo provide drive info data + */ +class FmDriverInfo +{ +public: + /*! + Used to get drive status for convenience. + /sa DriveType is used to get drive type. + */ + enum driveState + { + EDriveNotPresent = 0x1, // true when Drive have not inserted, for example, MMC Card + EDriveAvailable = 0x2, // false when drive is locked or corrupted, for example MMC Card + EDriveLocked = 0x4, + EDriveCorrupted = 0x8, + EDriveWriteProtected = 0x10, + EDriveRemovable = 0x20, + EDriveRom = 0x40, + EDriveFormattable = 0x80, + EDriveFormatted = 0x100, + EDriveLockable = 0x200, + EDrivePasswordProtected = 0x400, + EDriveBackupped = 0x800, + EDriveConnected = 0x1000, + EDriveEjectable = 0x2000, + EDriveInUse = 0x4000, + EDriveMassStorage = 0x8000, + EDriveRam = 0x10000, + EDriveUsbMemory = 0x20000, + EDriveRemote = 0x40000, + }; + + /*! + Used to get drive type for convenience. + */ + enum DriveType + { + EDriveTypeNotExist = -1, // specified drive is not existed in device + EDriveTypeRom, + EDriveTypeRam, + EDriveTypePhoneMemory, + EDriveTypeMassStorage, + EDriveTypeMemoryCard, + EDriveTypeUsbMemory, + EDriveTypeRemote, + }; + + Q_DECLARE_FLAGS( DriveState, driveState ) + + FmDriverInfo( quint64 s, quint64 f, const QString &n, const QString &vN, const quint32 driveState ) : + mSize( s ), mFreeSize( f ), mName( n ), mVolumeName( vN ), mDriveState( driveState ) {} + FmDriverInfo( const FmDriverInfo &other ) + { + *this = other; + } + + FmDriverInfo &operator= ( const FmDriverInfo &rhs ) + { + this->mSize = rhs.mSize; + this->mFreeSize = rhs.mFreeSize; + this->mName = rhs.mName; + this->mVolumeName = rhs.mVolumeName; + this->mDriveState = rhs.mDriveState; + return *this; + } + + /*! + Total size for drive + */ + quint64 size() const { return mSize; } + + /*! + Free size for drive + */ + quint64 freeSize() const { return mFreeSize; } + + /*! + path for drive + */ + QString name() const { return mName; } + + /*! + volume for drive + */ + QString volumeName() const { return mVolumeName; } + + /*! + status for drive + */ + DriveState driveState() const { return mDriveState; } + + /*! + drive type + */ + DriveType driveType(); + +private: + quint64 mSize; + quint64 mFreeSize; + QString mName; + QString mVolumeName; + DriveState mDriveState; + DriveType mDriveType; +}; +Q_DECLARE_OPERATORS_FOR_FLAGS( FmDriverInfo::DriveState ) + +/*! + \class FmUtils + \brief The class FmUtils provide util functions + This class is implemented by three parts: + fmutils.cpp for Qt Based functions + fmutils_s60.cpp is symbian implement version for platform based functions + fmutils_win.cpp is win32 implement version for platform based functions( a simple wrapper ) + */ +class FmUtils +{ +public: + ////////////////////////////////////////////////////////////////// + // + static QString getDriveNameFromPath( const QString &path ); + static QString getDriveLetterFromPath( const QString &path ); + static QString formatStorageSize( quint64 size ); + static bool isDrive( const QString &path ); + static QString formatPath( const QString &path ); + static QString fillPathWithSplash( const QString &filePath ); + static QString removePathSplash( const QString &filePath ); + static void getDriveList( QStringList &driveList, bool isHideUnAvailableDrive ); + static QString fillDriveVolume( QString driveName, bool isFillWithDefaultVolume ); + static QString getDefaultVolumeName( const QString &driveName ); + static QString getVolumeNameWithDefaultNameIfNull( const QString &diskName, bool &defaultName ); + static bool isPathEqual( const QString &pathFst, const QString &pathLast ); + static bool checkFolderFileName( const QString& name ); + static bool checkNewFolderOrFile( const QString& fileName, const QString &path, QString &errString ); + static bool isSubLevelPath( const QString &src, const QString &dest ); + // + ////////////////////////////////////////////////////////////////// + + + ////////////////////////////////////////////////////////////////// + // + static FmDriverInfo queryDriverInfo( const QString &driverName ); + + // password related functions + static int removeDrivePwd( const QString &driverName, const QString &Pwd ); + static int unlockDrive( const QString &driverName, const QString &Pwd ); + static int checkDrivePwd( const QString &driverName, const QString &pwd); + static int setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd); + static void emptyPwd( QString &pwd ); + + // external drive related functions + static int renameDrive( const QString &driverName, const QString &newVolumeName); + static int ejectDrive( const QString &driverName ); + + // drive security related functions + static bool checkDriveAccessFilter( const QString &driveName ); + static QString checkDriveToFolderFilter( const QString &path ); + static QString checkFolderToDriveFilter( const QString &path ); + static int isPathAccessabel( const QString &path ); + static bool isDriveAvailable( const QString &path ); + + // system default folder related functions + static bool isDefaultFolder( const QString &folderPath ); + static void createDefaultFolders( const QString &driverName ); + static QString localize( const QString &path ); + + // copy move related functions + static int setFileAttributes( const QString &srcFile, const QString &desFile ); + static bool hasEnoughSpace( const QString &targetDrive, qint64 size ); + static int moveInsideDrive( const QString &source, const QString &target ); + + // other fucntions + static int launchFile( const QString &filePath ); + static void sendFiles( QStringList &filePathList ); + static QString getBurConfigPath( QString appPath ); + static QString getFileType( const QString &filePath ); + static bool isDriveC( const QString &driverName ); + static int getMaxFileNameLength(); + static bool checkMaxPathLength( const QString& path ); + // + ////////////////////////////////////////////////////////////////// +}; + +#endif + diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmutils_s60.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmutils_s60.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,859 @@ +/* +* 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: +* Zhiqiang Yang +* +* Description: +* The source file of the file manager utilities on Symbian +*/ + + +#include "fmutils.h" +#include "fmcommon.h" +#include "fms60utils.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#define BURCONFIGFILE "z:/private/2002BCC0/burconfig.xml" + +/*! + query drive info and status for \a driveName + return \a FmDriverInfo +*/ +FmDriverInfo FmUtils::queryDriverInfo( const QString &driveName ) +{ + if( driveName.isEmpty() ) { + return FmDriverInfo( 0, 0, driveName, QString(), FmDriverInfo::EDriveNotPresent ); + } + CCoeEnv *env = CCoeEnv::Static(); + RFs& fs = env->FsSession(); + + TVolumeInfo volumeInfo; + TInt drive = 0; + drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; + + quint32 state( 0 ); + + int volumeInfoErr( KErrNone ); + int driveInfoErr( KErrNone ); + int errorCode( KErrNone ); + volumeInfoErr = fs.Volume( volumeInfo, drive ); + errorCode = volumeInfoErr; + QString volumeName( (QChar*)( volumeInfo.iName.Des().Ptr() ), volumeInfo.iName.Length() ); + + TDriveInfo driveInfo; + if( volumeInfoErr == KErrNone ) { + driveInfo = volumeInfo.iDrive; + } else { + driveInfoErr = fs.Drive( driveInfo, drive ); + if( driveInfoErr != KErrNone ) { + errorCode = driveInfoErr; + } + } + + if( volumeInfoErr == KErrNone || driveInfoErr == KErrNone ) { + //TDriveInfo driveInfo = volumeInfo.iDrive; + + quint32 drvStatus( 0 ); + int err = DriveInfo::GetDriveStatus( fs, drive, drvStatus ); + if( err == KErrNone ) { + + if ( ( drvStatus & DriveInfo::EDriveInternal ) && + ( drvStatus & DriveInfo::EDriveExternallyMountable ) ){ + // Handle mass storage bits here + state |= FmDriverInfo::EDriveMassStorage | FmDriverInfo::EDriveRemovable; + } + + if ( drvStatus & DriveInfo::EDriveUsbMemory ) + { + state |= FmDriverInfo::EDriveUsbMemory; + } + + if ( drvStatus & DriveInfo::EDriveRemote ) + { + state |= FmDriverInfo::EDriveRemote; + } + + if ( drvStatus & DriveInfo::EDriveRom ){ + state |= FmDriverInfo::EDriveRom; + } + + if ( drvStatus & DriveInfo::EDriveRam ){ + state |= FmDriverInfo::EDriveRam; + } + + if ( driveInfo.iMediaAtt & KMediaAttFormattable ){ + state |= FmDriverInfo::EDriveFormattable; + } + if ( driveInfo.iMediaAtt & KMediaAttWriteProtected ){ + state |= FmDriverInfo::EDriveWriteProtected; + } + if ( driveInfo.iMediaAtt & KMediaAttHasPassword ){ + state |= FmDriverInfo::EDrivePasswordProtected; + } + if ( driveInfo.iMediaAtt & KMediaAttLocked ){ + state |= FmDriverInfo::EDriveLocked; + } + + if ( driveInfo.iDriveAtt & KDriveAttRemovable ){ + state |= FmDriverInfo::EDriveRemovable; + + if ( drvStatus & DriveInfo::EDriveSwEjectable ){ + state |= FmDriverInfo::EDriveEjectable; + } + } + + if( driveInfo.iType == EMediaNotPresent ){ + state |= FmDriverInfo::EDriveNotPresent; + } + } + // If memory card is not ready but type is present, + // then check if it is reserved. + if( err == KErrNone && volumeInfoErr == KErrNotReady && + driveInfo.iType != EMediaNotPresent ) + { + // Check USB file transfer state + TInt prop( ECoreAppUIsUSBFileTransferUninitialized ); + RProperty::Get( + KPSUidCoreApplicationUIs, + KCoreAppUIsUSBFileTransfer, prop ); + if ( prop == ECoreAppUIsUSBFileTransferActive ) + { + errorCode = KErrInUse; // Reserved for file transfer + } + } + if( err!= KErrNone ) + { + errorCode = err; + } + } + + // handle error code + // volumeInfoErr will occur while drive is lock,corrupted... + // driveInfoErr can not be promoted for locked, corrupted drive. + // so we can not use driveInfoErr to justify EDriveAvailable + switch( errorCode ) + { + case KErrNone: + // this drive could be used as it is not be locked, or corrupt. + state |= FmDriverInfo::EDriveAvailable; + break; + case KErrLocked: + state |= FmDriverInfo::EDriveLocked; + break; + case KErrCorrupt: + state |= FmDriverInfo::EDriveCorrupted; + break; + case KErrInUse: + state |= FmDriverInfo::EDriveInUse; + break; + default: // other errors + state |= FmDriverInfo::EDriveNotPresent; + break; + } + QString logString ( "FmUtils::queryDriverInfo_" + driveName + + "_volumeInfoErr:" + QString::number( volumeInfoErr ) + + "_driveInfoErr:" + QString::number( driveInfoErr ) + + "_errorCode:" + QString::number( errorCode ) + + "_driveSatus:" + QString::number( state ) ); + FM_LOG( logString ); + return FmDriverInfo( volumeInfo.iSize, volumeInfo.iFree, driveName, volumeName, state ); +} + +/*! + remove drive password for \a driveName + \a Pwd is original password. +*/ +int FmUtils::removeDrivePwd( const QString &driveName, const QString &Pwd ) +{ + if( driveName.isEmpty() || Pwd.length() > FmMaxLengthofDrivePassword ) { + return FmErrWrongParam; + } + QString logString = "Drive name:" + driveName; + FM_LOG( logString ); + logString = "Password:" + Pwd; + FM_LOG( logString ); + + CCoeEnv *env = CCoeEnv::Static(); + RFs& fs = env->FsSession(); + + TInt drive = 0; + + drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; + + HBufC* password16 = XQConversions::qStringToS60Desc( Pwd ); + TMediaPassword password; + TPtr ptrPassword16( password16->Des() ); + FmS60Utils::ConvertCharsToPwd( ptrPassword16, password ); + + int err( fs.ClearPassword( drive, password ) ); + + logString = "Drive:" + QString::number( drive ); + FM_LOG( logString ); + + logString = "Clear password error:" + QString::number( err ); + FM_LOG( logString ); + + delete password16; + + if( err == KErrNone ){ + return FmErrNone; + } + else if( err == KErrAccessDenied ){ + return FmErrAccessDenied; + } + else{ + return FmErrUnKnown; + } +} + +/*! + Unlock drive \a driveName with provided password \a Pwd +*/ +int FmUtils::unlockDrive( const QString &driveName, const QString &Pwd ) +{ + if( driveName.isEmpty() || Pwd.length() > FmMaxLengthofDrivePassword ) { + return FmErrWrongParam; + } + QString logString = "Drive name:" + driveName; + FM_LOG( logString ); + logString = "Password:" + Pwd; + FM_LOG( logString ); + + CCoeEnv *env = CCoeEnv::Static(); + RFs& fs = env->FsSession(); + + TInt drive = 0; + drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; + + HBufC* password16 = XQConversions::qStringToS60Desc( Pwd ); + TMediaPassword password; + TPtr ptrPassword16( password16->Des() ); + FmS60Utils::ConvertCharsToPwd( ptrPassword16, password ); + + int err( fs.UnlockDrive( drive, password, ETrue) ); + + logString = "Drive:" + QString::number( drive ); + FM_LOG( logString ); + logString = "Unlock drive error:" + QString::number( err ); + FM_LOG( logString ); + + delete password16; + + if( err == KErrNone ){ + return FmErrNone; + } + else if( err == KErrAccessDenied ){ + return FmErrAccessDenied; + } + else if( err == KErrAlreadyExists ){ + return FmErrAlreadyExists; + } + else if( err == KErrNotSupported ){ + return FmErrNotSupported; + } + else{ + return FmErrUnKnown; + } +} + +/*! + Check if \a pwd is the right password for drive \a driveName +*/ +int FmUtils::checkDrivePwd( const QString &driveName, const QString &pwd ) +{ + if( driveName.isEmpty() || pwd.length() > FmMaxLengthofDrivePassword ) { + return FmErrWrongParam; + } + QString logString = "checkDrivePwd Drive name:" + driveName; + logString += " password:" + pwd; + FM_LOG( logString ); + + return setDrivePwd( driveName, pwd, pwd ); +} + +/*! + Set new password \a newPwd for drive \a driveName. \a oldPwd is old password +*/ +int FmUtils::setDrivePwd( const QString &driveName, const QString &oldPwd, const QString &newPwd) +{ + if( driveName.isEmpty() || + oldPwd.length() > FmMaxLengthofDrivePassword || newPwd.length() > FmMaxLengthofDrivePassword ) { + return FmErrWrongParam; + } + QString logString = "setDrivePwd Drive name:" + driveName ; + logString += " Old password:" + oldPwd; + logString += " New password:" + newPwd; + FM_LOG( logString ); + + CCoeEnv *env = CCoeEnv::Static(); + RFs& fs = env->FsSession(); + + TInt drive = 0; + drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; + + HBufC* newPassword16 = XQConversions::qStringToS60Desc( newPwd); + HBufC* oldPassword16 = XQConversions::qStringToS60Desc( oldPwd ); + + TMediaPassword oldPassword; + TMediaPassword newPassword; + + TPtr ptrNewPassword16( newPassword16->Des() ); + TPtr ptrOldPassword16( oldPassword16->Des() ); + + FmS60Utils::ConvertCharsToPwd( ptrNewPassword16, newPassword ); + FmS60Utils::ConvertCharsToPwd( ptrOldPassword16, oldPassword ); + + int err( fs.LockDrive( drive, oldPassword, newPassword, ETrue ) ); + + logString = "Drive:" + QString::number( drive ); + FM_LOG( logString ); + logString = "Password set error:" + QString::number( err ); + FM_LOG( logString ); + + delete newPassword16; + delete oldPassword16; + if( err == KErrNone ){ + return FmErrNone; + } + else if( err == KErrNotSupported ){ + return FmErrNotSupported; + } + else{ + return FmErrUnKnown; + } +} + +/*! + Set \a pwd as empty password +*/ +void FmUtils::emptyPwd( QString &pwd ) +{ + TBuf< FmMaxLengthofDrivePassword > nullPwd; + nullPwd.FillZ( nullPwd.MaxLength() ); + nullPwd.Zero(); + pwd = XQConversions::s60DescToQString( nullPwd ); +} + +/*! + Set drive volume for drive \a driveName +*/ +int FmUtils::renameDrive( const QString &driveName, const QString &newVolumeName) +{ + if( driveName.isEmpty() ) { + return FmErrWrongParam; + } + foreach( const QChar &ch, newVolumeName ) + { + bool a = ch.isSpace(); + bool b = ch.isLetterOrNumber(); + // If not alphadigit or space, return error + if( !ch.isLetterOrNumber() && !ch.isSpace() ) + { + return FmErrBadName; + } + } + + CCoeEnv *env = CCoeEnv::Static(); + RFs& fs = env->FsSession(); + + TInt drive = 0; + drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; + + TPtr newName ( ( XQConversions::qStringToS60Desc( newVolumeName ) )->Des() ); + + int err( fs.SetVolumeLabel( newName, drive )); + + QString logString = "Rename error:" + QString::number( err ); + FM_LOG( logString ); + + if( err == KErrNone ){ + return FmErrNone; + } + else if( err == KErrNotReady ){ + return FmErrNotReady; + } + else{ + return FmErrUnKnown; + } +} + +/*! + Eject drive \a driveName +*/ +int FmUtils::ejectDrive( const QString &driveName ) +{ + if( driveName.isEmpty() ) { + return FmErrWrongParam; + } + QString logString = "FmUtils::ejectDrive start"; + FM_LOG( logString ); + + TInt drive = 0; + drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; + + const int KDriveShift = 16; + + // Let SysAp handle eject + RProperty::Set( + KPSUidCoreApplicationUIs, + KCoreAppUIsMmcRemovedWithoutEject, + ECoreAppUIsEjectCommandUsedToDrive | ( drive << KDriveShift ) + ); + return FmErrNone; +} + +/*! + Check if drive \a driveName is accessable for user +*/ +bool FmUtils::checkDriveAccessFilter( const QString &driveName ) +{ + if( driveName.isEmpty() ) { + return false; + } + FmDriverInfo driveInfo = queryDriverInfo( driveName ); + if( ( driveInfo.driveState()& FmDriverInfo::EDriveRam ) || + ( driveInfo.driveState()& FmDriverInfo::EDriveRom ) ) { + return false; + } + return true; +} + +/*! + This function should be called to adjust path if user goto a drive. + data folder will be append to C:\ becuase user could only view C:\data instead C:\ +*/ +QString FmUtils::checkDriveToFolderFilter( const QString &path ) +{ + QString checkedPath = fillPathWithSplash( path ); + if( checkedPath.compare( Drive_C, Qt::CaseInsensitive ) == 0 ) { + checkedPath += QString( "data" ) + QDir::separator(); + return checkedPath; + } + return path; + +} + +/*! + This function should be called to adjust path if user back to up level path. + If user is at C:\data then path level should be returned as C:\ + Becuase C:\data is root path for C drive +*/ +QString FmUtils::checkFolderToDriveFilter( const QString &path ) +{ + QString logString; + logString = QString( "checkFolderToDriveFilter: " ) + path; + FM_LOG( logString ); + QString checkedPath = fillPathWithSplash( path ); + + logString = QString( "checkFolderToDriveFilter_fillPathWithSplash: " ) + checkedPath; + FM_LOG( logString ); + + if( checkedPath.compare( Folder_C_Data, Qt::CaseInsensitive ) == 0 ) { + FM_LOG( QString( " change from c:/data/ to C:/" ) ); + return Drive_C; + } + return path; + +} + +/*! + Check if \a path is accessable for user +*/ +int FmUtils::isPathAccessabel( const QString &path ) +{ + // Used to check if path is accessable, very important feature + // and will return filemanager error. + FM_LOG( QString( "isPathAccessabel:" ) + path ); + if( path.isEmpty() ) { + return FmErrPathNotExist; + } + + // used to filter locked/ejected/corrupted drive + // check if drive is available, no matter if it is a drive, a folder, or a file. + if( !isDriveAvailable( path ) ) { + FM_LOG( QString( "isPathAccessabel false: path is drive and not available" ) ); + return FmErrDriveNotAvailable; + } + + QFileInfo fileInfo( path ); + + if( fileInfo.absoluteFilePath().contains( Drive_C, Qt::CaseInsensitive ) && + !fileInfo.absoluteFilePath().contains( Folder_C_Data, Qt::CaseInsensitive ) ) { + FM_LOG( QString( "isPathAccessabel false: path contain C and not in data folder" ) ); + return FmErrPathDenied; + } + if( !checkDriveAccessFilter( FmUtils::getDriveNameFromPath( fileInfo.absoluteFilePath() ) ) ){ + return FmErrDriveDenied; + } + if( !fileInfo.exists() ) { + FM_LOG( QString( "isPathAccessabel false: path not exist" ) ); + return FmErrPathNotExist; + } + FM_LOG( QString( "isPathAccessabel FmErrNone" ) ); + return FmErrNone; +} + +/*! + Check if drive related to \a path is available. + This function should not check if path is available. Only responsible for checking drive + When MMC is not inserted, also return false +*/ +bool FmUtils::isDriveAvailable( const QString &path ) +{ + FM_LOG( QString( "isDriveAvailable:" ) + path ); + if( path.isEmpty() ) { + return false; + } + FmDriverInfo::DriveState driveState = queryDriverInfo( path ).driveState(); + if( ( driveState & FmDriverInfo::EDriveAvailable ) ) { + FM_LOG( QString( "isDriveAvailable true" ) ); + return true; + } + FM_LOG( QString( "isDriveAvailable false" ) ); + return false; +} + +/*! + Check if \a folderPath is default folder for system +*/ +bool FmUtils::isDefaultFolder( const QString &folderPath ) +{ + HBufC *path = XQConversions::qStringToS60Desc( folderPath ); + TPtrC desFolderPath( path->Des() ); + + bool ret( true ); + TInt pathType( PathInfo::PathType( desFolderPath ) ); + switch( pathType ){ + case PathInfo::ENotSystemPath:{ + QString locString( localize( folderPath ) ); + if ( locString.isEmpty() ){ + ret = false; + break; + } + ret = true; + break; + } + case PathInfo::EPhoneMemoryRootPath: // FALL THROUGH + case PathInfo::EMemoryCardRootPath: // FALL THROUGH + case PathInfo::ERomRootPath:{ + ret = false; + break; + } + // Accept other folders + default:{ + ret = true; + break; + } + } + delete path; + return ret; +} + +/*! + Create system default folders for drive \a driveName. + Default folders should be created after format a drive. +*/ +void FmUtils::createDefaultFolders( const QString &driveName ) +{ + if( driveName.isEmpty() ) { + return; + } + int err; + + TInt drive = 0; + drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; + + RFs fs; + err = fs.Connect(); + + if( err != KErrNone ){ + return; + } + + quint32 drvStatus( 0 ); + err = DriveInfo::GetDriveStatus( fs, drive, drvStatus ); + if ( !( drvStatus & DriveInfo::EDriveUserVisible ) || + ( drvStatus & ( DriveInfo::EDriveRemote | + DriveInfo::EDriveReadOnly | + DriveInfo::EDriveUsbMemory ) ) ){ + return; + } + + TEntry entry; + CDesCArray* array = PathInfo::GetListOfPathsLC( drive ); + + TInt count( array->MdcaCount() ); + for ( TInt i( 0 ); i < count; ++i ) + { + TPtrC fullPath( array->MdcaPoint( i ) ); + TBool allow( ETrue ); + + if ( drvStatus & DriveInfo::EDriveRemovable ) + { + // Filter few folder types from physically removable memory cards + TInt pathType( PathInfo::PathType( fullPath ) ); + switch( pathType ) + { + case PathInfo::EGamesPath: // FALL THROUGH + case PathInfo::EInstallsPath: // FALL THROUGH + case PathInfo::EGsmPicturesPath: // FALL THROUGH + case PathInfo::EMmsBackgroundImagesPath: // FALL THROUGH + case PathInfo::EPresenceLogosPath: + { + allow = EFalse; + } + default: + { + break; + } + } + } + + if ( allow ){ + fs.MkDirAll( fullPath ); // Ignore error + + if ( fs.Entry( fullPath, entry ) == KErrNone ){ + if( entry.IsHidden() ){ + // If setting fails, File Manager can still go on + fs.SetEntry( + fullPath, entry.iModified, 0, KEntryAttHidden ); + } + } + } + } + CleanupStack::PopAndDestroy( array ); +} + +/*! + In Symbian system, default folders will be localized. + So localize is used to check if a path is a default folder + \sa isDefaultFolder +*/ +QString FmUtils::localize( const QString &path ) +{ + // HbDirectoryNameLocalizer can not recognize path with \ in the end + QString locPath( removePathSplash( path ) ); + + HbDirectoryNameLocalizer localizer; + return localizer.translate( locPath ); +} + +/*! + set the \a desFile attributes as the same with \a srcFile +*/ +int FmUtils::setFileAttributes( const QString &srcFile, const QString &desFile ) +{ + RFs fsSession; + User::LeaveIfError( fsSession.Connect() ); + CleanupClosePushL( fsSession ); + RFile64 src; + RFile64 des; + HBufC *buf1 = XQConversions::qStringToS60Desc( removePathSplash( formatPath( srcFile ) ) ); + HBufC *buf2 = XQConversions::qStringToS60Desc( removePathSplash( formatPath( desFile ) ) ); + User::LeaveIfError( src.Open( fsSession, *buf1, EFileRead | EFileShareReadersOnly ) ); + User::LeaveIfError( des.Open( fsSession, *buf2, EFileWrite | EFileShareExclusive ) ); + TTime mod; + int err = src.Modified( mod );; + if ( err == FmErrNone ) { + err = des.SetModified( mod ); + } + TUint att( 0 ); + if ( err == FmErrNone ) { + err = src.Att( att ); + } + if ( err == FmErrNone ) { + des.SetAtt( att, ( ~att ) & KEntryAttMaskSupported ); + } + src.Close(); + des.Close(); + fsSession.Close(); + CleanupStack::PopAndDestroy(); // fsSession + return err; +} + +/*! + judge whether there is enough space on \a targetDrive for \a size. + return true if has, false if not. +*/ +bool FmUtils::hasEnoughSpace( const QString &targetDrive, qint64 size ) +{ + RFs fsSession; + QT_TRAP_THROWING( fsSession.Connect() ); + CleanupClosePushL( fsSession ); + TInt dstDrv(0); + HBufC* hbuf = XQConversions::qStringToS60Desc( targetDrive ); + QT_TRAP_THROWING( RFs::CharToDrive( hbuf->operator [](0), dstDrv ) ); + bool ret = !SysUtil::DiskSpaceBelowCriticalLevelL( &fsSession, size , dstDrv ); + CleanupStack::PopAndDestroy(); // fsSession + return ret; + +} + +/*! + move one file insice the same drive, from \a source to \a target. + return KErrNone if successful, otherwise one of the other system-wide error codes. +*/ +int FmUtils::moveInsideDrive( const QString &source, const QString &target ) +{ + RFs fsSession; + QT_TRAP_THROWING( fsSession.Connect() ); + CleanupClosePushL( fsSession ); + HBufC* oldName = XQConversions::qStringToS60Desc( source ); + HBufC* newName = XQConversions::qStringToS60Desc( target ); + int ret = fsSession.Rename( *oldName, *newName ); + CleanupStack::PopAndDestroy(); // fsSession + return ret; +} + +/*! + Launch a file with associated application. +*/ +int FmUtils::launchFile( const QString &filePath ) + +{ + QFile file( filePath ); + if( !file.exists() ) { + return false; + } + + XQApplicationManager mAiwMgr; + XQAiwRequest *request = mAiwMgr.create(file); + if ( request == 0 ) { + // No handlers for the URI + return FmErrUnKnown; + } + + // Set function parameters + QList args; + args << file.fileName(); + request->setArguments(args); + + // Send the request + bool res = request->send(); + if (!res) + { + // Request failed. + int error = request->lastError(); + + delete request; + return FmErrUnKnown; + } + + delete request; + return FmErrNone; +} + +/*! + Send files( \a filePathList ) with share ui. +*/ +void FmUtils::sendFiles( QStringList &filePathList ) +{ + ShareUi shareui; + shareui.send( filePathList, false ); +} + +/*! + return path for backup restore config file. + Currently \a appPath is not used. +*/ +QString FmUtils::getBurConfigPath( QString appPath ) +{ + Q_UNUSED( appPath ); + QString path( BURCONFIGFILE ); + return path; +} + +/*! + return MetaData string for \a filePath +*/ +QString FmUtils::getFileType( const QString &filePath ) +{ + RApaLsSession apaSession; + TDataType dataType; + TUid appUid; + + TBuf<128> mimeTypeBuf; + + int err = apaSession.Connect(); + + if ( err == KErrNone ){ + err = apaSession.AppForDocument( XQConversions::qStringToS60Desc( filePath )->Des(), + appUid, dataType ); + + if( err == KErrNone ){ + mimeTypeBuf.Copy(dataType.Des8()); + } + } + + apaSession.Close(); + return XQConversions::s60DescToQString( mimeTypeBuf ); +} + +/*! + Check if drive \a driveName is drive C +*/ +bool FmUtils::isDriveC( const QString &driveName ) +{ + if( driveName.isEmpty() ) { + return false; + } + TInt drive = 0; + drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; + if( drive == EDriveC ){ + return true; + } + else{ + return false; + } + +} + +/*! + return max file name length +*/ +int FmUtils::getMaxFileNameLength() +{ + return KMaxFileName; +} + +/*! + Check if length of \a path is exceed max path length. +*/ +bool FmUtils::checkMaxPathLength( const QString& path ) +{ + if( path.length() > KMaxPath ) { + return false; + } + return true; +} diff -r 95243422089a -r 491b3ed49290 filemanager/src/inc/fmutils_win.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmutils_win.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,253 @@ +/* +* 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: +* Zhiqiang Yang +* +* Description: +* The source file of the file manager utilities on windows +*/ + +#include "fmutils.h" + +#include + +#include +#include +#include +#include +#include + +#include + +#define BURCONFIGFILE "burconfig.xml" +const int KMaxFileName=0x100; +const int KMaxPath=0x100; + +FmDriverInfo FmUtils::queryDriverInfo( const QString &driveName ) +{ + quint64 size = 0; + quint64 freeSize = 0; + QString drive = driveName; + + drive.replace( '/', "\\" ); + if ( drive.right(1) != "\\" ) { + drive.append( "\\" ); + } + GetDiskFreeSpaceEx( (LPCWSTR)drive.constData(), + (PULARGE_INTEGER)&freeSize, + (PULARGE_INTEGER)&size, + 0 ); + + TCHAR volumeName[MAX_PATH + 1] = { 0 }; + GetVolumeInformation( (LPCWSTR)drive.constData(), + &volumeName[0], + MAX_PATH + 1, + 0, + 0, + 0, + 0, + 0 ); + + quint32 state( 0 ); + quint32 drvStatus = GetDriveType( (LPCWSTR)drive.constData() ); + if ( drvStatus == DRIVE_REMOVABLE ) { + state |= FmDriverInfo::EDriveRemovable; + } + + if( !(state&FmDriverInfo::EDriveNotPresent) && !(state&FmDriverInfo::EDriveLocked) && + !(state&FmDriverInfo::EDriveCorrupted) ) { + state |= FmDriverInfo::EDriveAvailable; + } + return FmDriverInfo( size, freeSize, driveName, QString::fromWCharArray( &volumeName[0] ), state ); +} + +int FmUtils::removeDrivePwd( const QString &driveName, const QString &Pwd ) +{ + Q_UNUSED( driveName ); + Q_UNUSED( Pwd ); + return 0; +} + +int FmUtils::unlockDrive( const QString &driveName, const QString &Pwd ) +{ + Q_UNUSED( driveName ); + Q_UNUSED( Pwd ); + return 0; +} + +int FmUtils::checkDrivePwd( const QString &driveName, const QString &pwd) +{ + Q_UNUSED( driveName ); + Q_UNUSED( pwd ); + return 0; +} + +int FmUtils::setDrivePwd( const QString &driveName, const QString &oldPwd, const QString &newPwd) +{ + Q_UNUSED( driveName ); + Q_UNUSED( oldPwd ); + Q_UNUSED( newPwd ); + return 0; +} + +void FmUtils::emptyPwd( QString &pwd ) +{ + Q_UNUSED( pwd ); +} + +int FmUtils::renameDrive( const QString &driveName, const QString &newVolumeName) +{ + Q_UNUSED( driveName ); + foreach( const QChar &ch, newVolumeName ) + { + // If not alphadigit or space, return error + if( !ch.isLetterOrNumber() && !ch.isSpace() ) + { + return FmErrBadName; + } + } + return 0; +} + +int FmUtils::ejectDrive( const QString &driveName ) +{ + Q_UNUSED( driveName ); + return FmErrNone; +} + +bool FmUtils::checkDriveAccessFilter( const QString &driveName ) +{ + Q_UNUSED( driveName ); + return true; +} + +QString FmUtils::checkDriveToFolderFilter( const QString &path ) +{ + Q_UNUSED( path ); + return path; + +} + +QString FmUtils::checkFolderToDriveFilter( const QString &path ) +{ + Q_UNUSED( path ); + return path; + +} + +int FmUtils::isPathAccessabel( const QString &path ) +{ + Q_UNUSED( path ); + return FmErrNone; +} + +bool FmUtils::isDriveAvailable( const QString &path ) +{ + Q_UNUSED( path ); + return true; +} + +bool FmUtils::isDefaultFolder( const QString &folderPath ) +{ + Q_UNUSED( folderPath ); + return false; +} + +void FmUtils::createDefaultFolders( const QString &driveName ) +{ + Q_UNUSED( driveName ); +} + +/*! + set the \a desFile attributes as the same with \a srcFile +*/ +int FmUtils::setFileAttributes( const QString &srcFile, const QString &desFile ) +{ + Q_UNUSED( srcFile ); + Q_UNUSED( desFile ); + return FmErrNone; +} + +/*! + judge whether there is enough space on \a targetDrive for \a size. + return true if has, false if not. +*/ +bool FmUtils::hasEnoughSpace( const QString &targetDrive, qint64 size ) +{ + Q_UNUSED( targetDrive ); + Q_UNUSED( size ); + return true; +} + +/*! + move one file insice the same drive, from \a source to \a target. + return KErrNone if successful, otherwise one of the other system-wide error codes. +*/ +int FmUtils::moveInsideDrive( const QString &source, const QString &target ) +{ + Q_UNUSED( source ); + Q_UNUSED( target ); + return FmErrNone; +} + +int FmUtils::launchFile( const QString &filePath ) +{ + if( QDesktopServices::openUrl( QUrl::fromLocalFile( filePath ) ) ) { + return FmErrNone; + } else { + return FmErrGeneral; + } +} + +void FmUtils::sendFiles( QStringList &filePathList ) +{ + Q_UNUSED( filePathList ); +} + +QString FmUtils::getBurConfigPath( QString appPath ) +{ + QFileInfo fileInfo( appPath ); + QString testString = fileInfo.absolutePath(); + QString path = fillPathWithSplash( fileInfo.absolutePath() ); + path = path + QString( "src/filemanager/" ); + path = path + QString( BURCONFIGFILE ); + return path; +} + +QString FmUtils::getFileType( const QString &filePath ) +{ + Q_UNUSED( filePath ); + return QString( "" ); +} + +bool FmUtils::isDriveC( const QString &driveName ) +{ + if( driveName.contains(Drive_C,Qt::CaseInsensitive) ){ + return true; + } + else{ + return false; + } +} + +int FmUtils::getMaxFileNameLength() +{ + return KMaxFileName; +} + +bool FmUtils::checkMaxPathLength( const QString& path ) +{ + if( path.length() > KMaxPath ) { + return false; + } + return true; +} diff -r 95243422089a -r 491b3ed49290 filemanager/tsrc/tsrc.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/tsrc/tsrc.pro Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,26 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = subdirs +SUBDIRS = unit/unit_backuprestoresettings + +CONFIG += ordered +#CONFIG += symbian_test +test.depends = first +test.CONFIG += recursive +autotest.depends = first +autotest.CONFIG += recursive +QMAKE_EXTRA_TARGETS += test autotest diff -r 95243422089a -r 491b3ed49290 filemanager/tsrc/unit/unit_backuprestoresettings/runtest.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/tsrc/unit/unit_backuprestoresettings/runtest.bat Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,19 @@ +@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 + +\epoc32\RELEASE\WINSCW\udeb\unit_backuprestoresettings.exe -xml -o c:\unit_backuprestoresettings.xml +copy \epoc32\winscw\c\unit_backuprestoresettings.xml +del \epoc32\winscw\c\unit_backuprestoresettings.xml \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filemanager/tsrc/unit/unit_backuprestoresettings/src/unit_backuprestoresettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/tsrc/unit/unit_backuprestoresettings/src/unit_backuprestoresettings.cpp Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,358 @@ +/* +* 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: This class is test case for backupsettings and restoresettings +* +*/ + +#include + +#include "fmbackupsettings.h" +#include "fmrestoresettings.h" +#include "fmbkupengine.h" +#include + +#include +#include +#include + +class TestSettings: public QObject +{ + Q_OBJECT + +private slots: + // init test strings those are used to verify string fetch feature of FmBackupSettings. + void initTestCase(); + + void testTestSettingsContentAll(); + void testTestSettingsContentOne(); + void testTestSettingsContentTwo(); + + void testContentToString(); + void testContentToString_data(); + + void testSchedulingToString(); + void testSchedulingToString_data(); + + void testWeekdayToString(); + void testWeekdayToString_data(); + + void testFmBackupEntry(); + + void testFmRestoreInfo(); + void testFmRestoreEntry(); + + void cleanupTestCase(); // Finalize test data + +private: + FmBackupSettings *settings; + QString mFileManagerBackupWeekdayMonday; + QString mFileManagerBackupWeekdayTuesday; + QString mFileManagerBackupWeekdayWednesday; + QString mFileManagerBackupWeekdayThursday; + QString mFileManagerBackupWeekdayFirday; + QString mFileManagerBackupWeekdaySaturday; + QString mFileManagerBackupWeekdaySunday; + + QString mFileManagerBackupScheduleNever; + QString mFileManagerBackupScheduleDaily; + QString mFileManagerBackupScheduleWeekly; + + QString mFileManagerBackupSettingsTitleContents; + QString mFileManagerBackupSettingsTitleScheduling; + QString mFileManagerBackupSettingsTitleWeekday; + QString mFileManagerBackupSettingsTitleTime; + QString mFileManagerBackupSettingsTitleTargetDrive; + + QString mFileManagerBackupSettingsContentAll; + QString mFileManagerBackupSettingsContentSettings; + QString mFileManagerBackupSettingsContentMessages; + QString mFileManagerBackupSettingsContentContacts; + QString mFileManagerBackupSettingsContentCalendar; + QString mFileManagerBackupSettingsContentBookmarks; + QString mFileManagerBackupSettingsContentUserFiles; +}; + +void TestSettings::initTestCase() +{ + // install translator + QTranslator translator; + QString lang = QLocale::system().name(); + QString path = "z:/resource/qt/translations/"; + translator.load( path + "filemanager_" + lang ); + QCoreApplication::installTranslator(&translator); + + // init localized string + mFileManagerBackupWeekdayMonday = hbTrId( "Monday" ); + mFileManagerBackupWeekdayTuesday = hbTrId( "Tuesday" ); + mFileManagerBackupWeekdayWednesday = hbTrId( "Wednesday" ); + mFileManagerBackupWeekdayThursday = hbTrId( "Thursday" ); + mFileManagerBackupWeekdayFirday = hbTrId( "Friday" ); + mFileManagerBackupWeekdaySaturday = hbTrId( "Saturday" ); + mFileManagerBackupWeekdaySunday = hbTrId( "Sunday" ); + + mFileManagerBackupScheduleNever = hbTrId( "Never" ); + mFileManagerBackupScheduleDaily = hbTrId( "Daily" ); + mFileManagerBackupScheduleWeekly = hbTrId( "Weekly" ); + + mFileManagerBackupSettingsTitleContents = hbTrId( "Backup Contents" ); + mFileManagerBackupSettingsTitleScheduling = hbTrId( "Backup scheduling" ); + mFileManagerBackupSettingsTitleWeekday = hbTrId( "Weekday" ); + mFileManagerBackupSettingsTitleTime = hbTrId( "Time" ); + mFileManagerBackupSettingsTitleTargetDrive = hbTrId( "Backup destination" ); + + mFileManagerBackupSettingsContentAll = hbTrId( "All" ); + mFileManagerBackupSettingsContentSettings = hbTrId( "Settings" ); + mFileManagerBackupSettingsContentMessages = hbTrId( "Messages" ); + mFileManagerBackupSettingsContentContacts = hbTrId( "Contacts" ); + mFileManagerBackupSettingsContentCalendar = hbTrId( "Calendar" ); + mFileManagerBackupSettingsContentBookmarks = hbTrId( "Bookmarks" ); + mFileManagerBackupSettingsContentUserFiles = hbTrId( "Files" ); +} + +void TestSettings::cleanupTestCase() +{ + QCoreApplication::processEvents(); +} + +void TestSettings::testTestSettingsContentAll() +{ + FmBkupEngine *backupEngine = new FmBkupEngine( this ); + settings = new FmBackupSettings( backupEngine ); + QTime time = QTime::currentTime(); + settings->setContent(FmBackupSettings::EFileManagerBackupContentAll); + settings->setScheduling(FmBackupSettings::EFileManagerBackupScheduleWeekly); + settings->setWeekday(FmBackupSettings::EFileManagerBackupWeekdayMonday); + settings->setTime(time); + settings->setTargetDrive("C:"); + + settings->save(); + delete settings; + + + settings = new FmBackupSettings( backupEngine ); + settings->load(); + + QVERIFY(settings->content() == FmBackupSettings::EFileManagerBackupContentAll); + QVERIFY(settings->scheduling() == FmBackupSettings::EFileManagerBackupScheduleWeekly); + QVERIFY(settings->weekday() == FmBackupSettings::EFileManagerBackupWeekdayMonday); + QVERIFY( settings->time().toString() == time.toString() ); + QVERIFY(settings->targetDrive() == "C:"); + + QList< FmBackupEntry* > backupEntryList = settings->backupEntryList(); + + for( int i = 0; i< backupEntryList.count(); i++ ) + { + FmBackupEntry* entry = backupEntryList[i]; + switch( entry->type() ) + { + case FmBackupEntry::EContents: + { + QVERIFY( entry->title() == mFileManagerBackupSettingsTitleContents ); + break; + } + case FmBackupEntry::EScheduling: + { + QVERIFY( entry->title() == mFileManagerBackupSettingsTitleScheduling ); + break; + } + case FmBackupEntry::EWeekday: + { + QVERIFY( entry->title() == mFileManagerBackupSettingsTitleWeekday ); + break; + } + case FmBackupEntry::ETime: + { + QVERIFY( entry->title() == mFileManagerBackupSettingsTitleTime ); + break; + } + case FmBackupEntry::ETarget: + { + QVERIFY( entry->title() == mFileManagerBackupSettingsTitleTargetDrive ); + break; + } + + } + qDebug( entry->title().toUtf8().data() ); + qDebug( entry->tips().toUtf8().data() ); + } + delete backupEngine; +} + + +void TestSettings::testTestSettingsContentOne() +{ + FmBkupEngine *backupEngine = new FmBkupEngine( this ); + settings = new FmBackupSettings( backupEngine ); + QTime time = QTime::currentTime(); + settings->setContent(FmBackupSettings::EFileManagerBackupContentSettings | + FmBackupSettings::EFileManagerBackupContentMessages); + settings->setScheduling(FmBackupSettings::EFileManagerBackupScheduleWeekly); + settings->setWeekday(FmBackupSettings::EFileManagerBackupWeekdayWednesday); + settings->setTime(time); + settings->setTargetDrive("E:"); + + settings->save(); + delete settings; + + settings = new FmBackupSettings( backupEngine ); + settings->load(); + + QVERIFY(settings->content() == quint32(FmBackupSettings::EFileManagerBackupContentSettings | + FmBackupSettings::EFileManagerBackupContentMessages)); + QVERIFY(settings->scheduling() == FmBackupSettings::EFileManagerBackupScheduleWeekly); + QVERIFY(settings->weekday() == FmBackupSettings::EFileManagerBackupWeekdayWednesday); + QVERIFY( settings->time().toString() == time.toString() ); + QVERIFY(settings->targetDrive() == "E:"); + delete backupEngine; +} + +void TestSettings::testTestSettingsContentTwo() +{ + FmBkupEngine *backupEngine = new FmBkupEngine( this ); + settings = new FmBackupSettings( backupEngine ); + QTime time = QTime::currentTime(); + settings->setContent(FmBackupSettings::EFileManagerBackupContentSettings | + FmBackupSettings::EFileManagerBackupContentMessages); + settings->setScheduling(FmBackupSettings::EFileManagerBackupScheduleWeekly); + settings->setWeekday(FmBackupSettings::EFileManagerBackupWeekdayWednesday); + settings->setTime(time); + settings->setTargetDrive("E:"); + + settings->save(); + delete settings; + + settings = new FmBackupSettings( backupEngine ); + settings->load(); + + QVERIFY(settings->content() == quint32( FmBackupSettings::EFileManagerBackupContentSettings | + FmBackupSettings::EFileManagerBackupContentMessages ) ); + QVERIFY(settings->scheduling() == FmBackupSettings::EFileManagerBackupScheduleWeekly); + QVERIFY(settings->weekday() == FmBackupSettings::EFileManagerBackupWeekdayWednesday); + QVERIFY( settings->time().toString() == time.toString() ); + QVERIFY(settings->targetDrive() == "E:"); + delete backupEngine; +} + +void TestSettings::testContentToString() +{ + QFETCH(quint32, param); + QFETCH(QString, value); + + QCOMPARE(FmBackupSettings::contentToString( param ), value); +} + +void TestSettings::testContentToString_data() +{ + QTest::addColumn("param"); + QTest::addColumn("value"); + + QTest::newRow("contentToString_0") << (quint32)FmBackupSettings::EFileManagerBackupContentAll << mFileManagerBackupSettingsContentAll; + QTest::newRow("contentToString_1") << (quint32)FmBackupSettings::EFileManagerBackupContentSettings << mFileManagerBackupSettingsContentSettings; + QTest::newRow("contentToString_2") << (quint32)FmBackupSettings::EFileManagerBackupContentMessages << mFileManagerBackupSettingsContentMessages; + QTest::newRow("contentToString_3") << (quint32)FmBackupSettings::EFileManagerBackupContentContacts << mFileManagerBackupSettingsContentContacts; + QTest::newRow("contentToString_4") << (quint32)FmBackupSettings::EFileManagerBackupContentCalendar << mFileManagerBackupSettingsContentCalendar; + QTest::newRow("contentToString_5") << (quint32)FmBackupSettings::EFileManagerBackupContentBookmarks << mFileManagerBackupSettingsContentBookmarks; + QTest::newRow("contentToString_6") << (quint32)FmBackupSettings::EFileManagerBackupContentUserFiles << mFileManagerBackupSettingsContentUserFiles; +} + +void TestSettings::testSchedulingToString() +{ + QFETCH(int, param); + QFETCH(QString, value); + FmBkupEngine *backupEngine = new FmBkupEngine( this ); + settings = new FmBackupSettings( backupEngine ); + QCOMPARE(settings->schedulingToString( (FmBackupSettings::TFileManagerBackupSchedule)param ), value); +} + +void TestSettings::testSchedulingToString_data() +{ + QTest::addColumn("param"); + QTest::addColumn("value"); + + QTest::newRow("schedulingToString_0") << (int)FmBackupSettings::EFileManagerBackupScheduleNever << mFileManagerBackupScheduleNever; + QTest::newRow("schedulingToString_1") << (int)FmBackupSettings::EFileManagerBackupScheduleDaily << mFileManagerBackupScheduleDaily; + QTest::newRow("schedulingToString_2") << (int)FmBackupSettings::EFileManagerBackupScheduleWeekly << mFileManagerBackupScheduleWeekly; +} + +void TestSettings::testWeekdayToString() +{ + QFETCH(int, param); + QFETCH(QString, value); + + QCOMPARE(FmBackupSettings::weekdayToString( (FmBackupSettings::TFileManagerBackupWeekday)param ), value); +} + +void TestSettings::testWeekdayToString_data() +{ + + QTest::addColumn("param"); + QTest::addColumn("value"); + + QTest::newRow("weekdayToString_0") << (int)FmBackupSettings::EFileManagerBackupWeekdayMonday << mFileManagerBackupWeekdayMonday; + QTest::newRow("weekdayToString_1") << (int)FmBackupSettings::EFileManagerBackupWeekdayTuesday << mFileManagerBackupWeekdayTuesday; + QTest::newRow("weekdayToString_2") << (int)FmBackupSettings::EFileManagerBackupWeekdayWednesday << mFileManagerBackupWeekdayWednesday; + QTest::newRow("weekdayToString_3") << (int)FmBackupSettings::EFileManagerBackupWeekdayThursday << mFileManagerBackupWeekdayThursday; + QTest::newRow("weekdayToString_4") << (int)FmBackupSettings::EFileManagerBackupWeekdayFriday << mFileManagerBackupWeekdayFirday; + QTest::newRow("weekdayToString_5") << (int)FmBackupSettings::EFileManagerBackupWeekdaySaturday << mFileManagerBackupWeekdaySaturday; + QTest::newRow("weekdayToString_6") << (int)FmBackupSettings::EFileManagerBackupWeekdaySunday << mFileManagerBackupWeekdaySunday; +} + + +void TestSettings::testFmBackupEntry() +{ + FmBackupEntry backupEntry( "title","tips", FmBackupEntry::EContents ); + QVERIFY( backupEntry.title() == "title" ); + QVERIFY( backupEntry.tips() == "tips" ); + QVERIFY( backupEntry.type() == FmBackupEntry::EContents ); + + FmBackupEntry backupEntryCopy( backupEntry ); + QVERIFY( backupEntryCopy.title() == "title" ); + QVERIFY( backupEntryCopy.tips() == "tips" ); + QVERIFY( backupEntryCopy.type() == FmBackupEntry::EContents ); + +} + +void TestSettings::testFmRestoreInfo() +{ + QDateTime dateTime = QDateTime::currentDateTime(); + FmRestoreInfo restoreInfo((quint32)FmBackupSettings::EFileManagerBackupContentSettings, dateTime, "E:" ); + QVERIFY( restoreInfo.content() == (quint32)FmBackupSettings::EFileManagerBackupContentSettings ); + QVERIFY( restoreInfo.dateTime().toString() == dateTime.toString() ); + QVERIFY( restoreInfo.drive() == "E:" ); + + FmRestoreInfo restoreInfoCopy( restoreInfo ); + QVERIFY( restoreInfoCopy.content() == restoreInfo.content() ); + QVERIFY( restoreInfoCopy.dateTime().toString() == restoreInfo.dateTime().toString() ); + QVERIFY( restoreInfoCopy.drive() == restoreInfo.drive() ); + + FmRestoreInfo restoreInfoNext = restoreInfo; + QVERIFY( restoreInfoNext.content() == restoreInfo.content() ); + QVERIFY( restoreInfoNext.dateTime().toString() == restoreInfo.dateTime().toString() ); + QVERIFY( restoreInfoNext.drive() == restoreInfo.drive() ); +} + +void TestSettings::testFmRestoreEntry() +{ + QDateTime dateTime = QDateTime::currentDateTime(); + FmRestoreInfo restoreInfo((quint32)FmBackupSettings::EFileManagerBackupContentSettings, dateTime, "E:" ); + + FmRestoreEntry restoreEntry( "displayText", restoreInfo ); + QVERIFY( restoreEntry.text() == "displayText"); + QVERIFY( restoreEntry.restoreInfo().content() == (quint32)FmBackupSettings::EFileManagerBackupContentSettings ); + QVERIFY( restoreEntry.restoreInfo().dateTime().toString() == dateTime.toString() ); + QVERIFY( restoreEntry.restoreInfo().drive() == "E:" ); +} + +QTEST_MAIN(TestSettings) +#include "unit_backuprestoresettings.moc" diff -r 95243422089a -r 491b3ed49290 filemanager/tsrc/unit/unit_backuprestoresettings/unit_backuprestoresettings.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/tsrc/unit/unit_backuprestoresettings/unit_backuprestoresettings.pro Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,45 @@ +# +# 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: +# + +QT += testlib +CONFIG += qtestlib +CONFIG += symbian_test +CONFIG += hb +TEMPLATE = app +TARGET = +include ( ../../../src/inc/commoninc.pri ) +include ( ../../../src/common.pri ) +DEPENDPATH += . +INCLUDEPATH += . +INCLUDEPATH += ../../../src/fmbkupenginewrapper/inc +INCLUDEPATH += ../../../src/inc +TARGET.CAPABILITY = ALL -TCB +# Input +SOURCES += src/unit_backuprestoresettings.cpp +LIBS += -lfmbkupenginewrapper + +unix { + test.commands = /epoc32/RELEASE/WINSCW/udeb/unit_backuprestoresettings.exe + autotest.commands = /epoc32/RELEASE/WINSCW/udeb/unit_backuprestoresettings.exe -xml -o c:/unit_backuprestoresettings.xml +} else:win32 { + test.CONFIG += recursive + autotest.CONFIG += recursive + build_pass { + test.commands =/epoc32/RELEASE/WINSCW/udeb/unit_backuprestoresettings.exe + autotest.commands =/epoc32/RELEASE/WINSCW/udeb/unit_backuprestoresettings -xml -o c:/unit_backuprestoresettings.xml + } +} +QMAKE_EXTRA_TARGETS += test autotest \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 files_plat/group/bld.inf --- a/files_plat/group/bld.inf Thu Aug 19 09:42:45 2010 +0300 +++ /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: Includes all the Domain API specific bld.inf files, which -* export files. -* -*/ - - - -#include "../memory_scan_popup_ui_api/group/bld.inf" diff -r 95243422089a -r 491b3ed49290 files_plat/memory_scan_popup_ui_api/group/bld.inf --- a/files_plat/memory_scan_popup_ui_api/group/bld.inf Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2006-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: File that exports the files belonging to -: Memory Scan Popup UI API -* -*/ - - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -../inc/CMemStatePopup.h APP_LAYER_PLATFORM_EXPORT_PATH(cmemstatepopup.h) -../inc/MSPUtil.h APP_LAYER_PLATFORM_EXPORT_PATH(msputil.h) diff -r 95243422089a -r 491b3ed49290 files_plat/memory_scan_popup_ui_api/inc/CMemStatePopup.h --- a/files_plat/memory_scan_popup_ui_api/inc/CMemStatePopup.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +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: -* Memory State Popup. -* -* -*/ - - -#ifndef __CMEMORYSTATEPOPUP_H__ -#define __CMEMORYSTATEPOPUP_H__ - -// SYSTEM INCLUDES -#include - -// USER INCLUDES -#include "msputil.h" - -// CONSTANTS -const TText KRightToLeftMark = 0x200F; - -// CLASS DEFINITION -class CMemStatePopup : public CBase - { - public: - // Destructor - virtual ~CMemStatePopup( ); - - private: - // C++ constructors - CMemStatePopup( ); - - public: - /** - * Launches the memory scan popup - * @param aDrive The drive to be scanned - * @param aTitle Title of the popup - */ - IMPORT_C static void RunLD( TDriveNumber aDrive, TDesC& aTitle ); - - /** - * Get an instance of CMSPUtil class, containing the unit text array - * @param aUtil Reference to a CMSPUtil pointer, - * updated to point to the instance created - */ - IMPORT_C static void GetUtilL( CMSPUtil*& aUtil ); - - private: - // Not implemented - CMemStatePopup( const CMemStatePopup& ); - CMemStatePopup& operator=( CMemStatePopup& ); - - private: - }; - -#endif // __CMEMORYSTATEPOPUP_H__ - -// End of File diff -r 95243422089a -r 491b3ed49290 files_plat/memory_scan_popup_ui_api/inc/MSPUtil.h --- a/files_plat/memory_scan_popup_ui_api/inc/MSPUtil.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2002 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 class for Memory State Popup. -* -* -*/ - - -#ifndef __CMSPUTIL_H__ -#define __CMSPUTIL_H__ - -// INCLUDES -#include -#include - - -// CLASS DEFINITION - -class CMSPUtil : public CBase - { - public: - /** - * Static constructor. - * @param aArray Array of unit texts. - * @return Pointer to an instance of CMSPUtil. - */ - static CMSPUtil* NewL( CDesCArrayFlat* aArray ); - - /** - * Virtual D'tor. - */ - virtual ~CMSPUtil( ); - - protected: - /** - * Default c'tor, protected to prevent using directly. - */ - CMSPUtil( ); - - public: - /** - * Type of unit. - */ - enum TUnitType - { - EByte = 0, - EKiloByte, - EMegaByte, - EGigaByte, - ETeraByte - }; - - public: - /** - * Solves the correct unit for given data size. - * @param aNumber Amount of data to be solved, changed accordingly. - * @return Unit text descriptor. - */ - IMPORT_C TPtrC SolveUnitAndSize( TInt64& aNumber ); - - private: - /** - * Solves the correct unit for given data size, used internally. - * @param aNumber Amount of data to be solved, changed accordingly. - * @param aUnit Unit text index in unit array. - */ - void SolveUnitAndSize( TInt64& aNumber, TInt& aUnit ); - - private: - CDesCArrayFlat* iUnitArray; - }; - -#endif // __CMSPUTIL_H__ diff -r 95243422089a -r 491b3ed49290 files_plat/memory_scan_popup_ui_api/memory_scan_popup_ui_api.metaxml --- a/files_plat/memory_scan_popup_ui_api/memory_scan_popup_ui_api.metaxml Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ - - - Memory Scan Popup UI API - An interface for showing a pop-up dialog about the memory status of the user data area or memory card. - c++ - filesystemuis - - - - - - - - - no - no - - diff -r 95243422089a -r 491b3ed49290 filesystemuis/group/bld.inf --- a/filesystemuis/group/bld.inf Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +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: bld for filesystemuis -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -PRJ_MMPFILES - -#include "../memscaneng/group/bld.inf" -#include "../memstatepopup/group/bld.inf" - - -PRJ_TESTMMPFILES - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/bwins/MemScanClientU.DEF --- a/filesystemuis/memscaneng/bwins/MemScanClientU.DEF Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -EXPORTS - ??0RMemScanClient@@QAE@XZ @ 1 NONAME ; RMemScanClient::RMemScanClient(void) - ?Close@RMemScanClient@@QAEXXZ @ 2 NONAME ; void RMemScanClient::Close(void) - ?Connect@RMemScanClient@@QAEHXZ @ 3 NONAME ; int RMemScanClient::Connect(void) - ?DataGroupsL@RMemScanClient@@QBEPAVCDesC16Array@@XZ @ 4 NONAME ; class CDesC16Array * RMemScanClient::DataGroupsL(void) const - ?RequestScanEvents@RMemScanClient@@QAEXAAHAAVTRequestStatus@@@Z @ 5 NONAME ; void RMemScanClient::RequestScanEvents(int &, class TRequestStatus &) - ?RequestScanEventsCancel@RMemScanClient@@QAEXXZ @ 6 NONAME ; void RMemScanClient::RequestScanEventsCancel(void) - ?Scan@RMemScanClient@@QAEHW4TDriveNumber@@@Z @ 7 NONAME ; int RMemScanClient::Scan(enum TDriveNumber) - ?ScanInProgress@RMemScanClient@@QBEHXZ @ 8 NONAME ; int RMemScanClient::ScanInProgress(void) const - ?ScanResultL@RMemScanClient@@QBEPAV?$CArrayFix@_J@@XZ @ 9 NONAME ; class CArrayFix * RMemScanClient::ScanResultL(void) const - diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/bwins/msengu.def --- a/filesystemuis/memscaneng/bwins/msengu.def Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -EXPORTS - ??1CMseng@@UAE@XZ @ 1 NONAME ; CMseng::~CMseng(void) - ?CancelL@CMseng@@QAEXXZ @ 2 NONAME ; void CMseng::CancelL(void) - ?DataGroupsL@CMseng@@QBEPAVCDesC16Array@@XZ @ 3 NONAME ; class CDesC16Array * CMseng::DataGroupsL(void) const - ?DiskInfoL@CMseng@@QBEXAA_J0W4TDriveNumber@@@Z @ 4 NONAME ; void CMseng::DiskInfoL(long long &, long long &, enum TDriveNumber) const - ?MemInfoL@CMseng@@SAXAA_J0@Z @ 5 NONAME ; void CMseng::MemInfoL(long long &, long long &) - ?NewL@CMseng@@SAPAV1@AAVMMsengUIHandler@@@Z @ 6 NONAME ; class CMseng * CMseng::NewL(class MMsengUIHandler &) - ?ScanInProgress@CMseng@@QBEHXZ @ 7 NONAME ; int CMseng::ScanInProgress(void) const - ?ScanL@CMseng@@QAEXW4TDriveNumber@@@Z @ 8 NONAME ; void CMseng::ScanL(enum TDriveNumber) - ?ScanResultL@CMseng@@QBEPAV?$CArrayFix@_J@@XZ @ 9 NONAME ; class CArrayFix * CMseng::ScanResultL(void) const - diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/clientinc/memscanclient.h --- a/filesystemuis/memscaneng/clientinc/memscanclient.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +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: Memory Scan Client -* -*/ - - -#ifndef __MEMSCANCLIENT_H__ -#define __MEMSCANCLIENT_H__ - -#include -#include // TDriveNumber -#include // Descriptor arrays - -#include "memscanclientserver.h" - -// --------------------------------------------------------------------------- -// Client -// --------------------------------------------------------------------------- - -class RMemScanClient : public RSessionBase - { -public: - IMPORT_C RMemScanClient(); - IMPORT_C TInt Connect(); - IMPORT_C void Close(); - -public: // API - IMPORT_C TInt Scan(const TDriveNumber aDrive); - IMPORT_C CDesCArray* DataGroupsL() const; - IMPORT_C void RequestScanEvents( TInt& aError, TRequestStatus& aRequestStatus ); - IMPORT_C void RequestScanEventsCancel(); - IMPORT_C TBool ScanInProgress( ) const; - IMPORT_C CArrayFix* ScanResultL() const; - -private: - TPtr8 iScanEventPackagePointer; - }; - - -#endif //__MEMSCANCLIENT_H__ diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/clientsrc/memscanclient.cpp --- a/filesystemuis/memscaneng/clientsrc/memscanclient.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,260 +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: Memory Scan Client -* -*/ - - - -// SYSTEM INCLUDES -#include -#include // RBufReadStream - -// USER INCLUDES -#include "memscanclient.h" -#include "memscanutils.h" // traces - - -// Standard server startup code -// -static TInt StartServer() - { - TRACES( RDebug::Print(_L("MemScanClient: Starting server...")) ); - - RProcess server; - TInt r=server.Create(KMemScanServImg,KNullDesC); - - if (r!=KErrNone) - { - TRACES( RDebug::Print(_L("MemScanClient: server start failed %d"),r) ); - return r; - } - TRequestStatus stat; - server.Rendezvous(stat); - if (stat!=KRequestPending) - server.Kill(0); // abort startup - else - server.Resume(); // logon OK - start the server - TRACES( RDebug::Print(_L("MemScanClient: Started")) ); - User::WaitForRequest(stat); // wait for start or death - // we can't use the 'exit reason' if the server panicked as this - // is the panic 'reason' and may be '0' which cannot be distinguished - // from KErrNone - r=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int(); - server.Close(); - return r; - } - -EXPORT_C RMemScanClient::RMemScanClient() -: iScanEventPackagePointer( NULL, 0, 0 ) - { - } - - -// This is the standard retry pattern for server connection -EXPORT_C TInt RMemScanClient::Connect() - { - TVersion version(KMemScanServMajor, KMemScanServMinor, KMemScanServBuild); - TInt retry=2; - for (;;) - { - TInt r=CreateSession(KMemScanServName, version, 1); - if (r!=KErrNotFound && r!=KErrServerTerminated) - return r; - if (--retry==0) - return r; - r=StartServer(); - if (r!=KErrNone && r!=KErrAlreadyExists) - return r; - } - } - -EXPORT_C void RMemScanClient::Close() - { - RSessionBase::Close(); //basecall - } - - -// *************************************************************************** -// Client Server functions -// *************************************************************************** - - -// --------------------------------------------------------------------------- -// RMemScanClient::DataGroupsL() -// -// --------------------------------------------------------------------------- -EXPORT_C CDesCArray* RMemScanClient::DataGroupsL() const - { - // Ask server to externalize the data group array to buffer - // and to provide size of buffer - TPckgBuf bufferSize; - User::LeaveIfError(SendReceive( EMemScanPrepareDataGroups, TIpcArgs(&bufferSize) )); - - // Create a buffer of sufficient size in order to fetch the - // buffer from the server - CBufBase* buffer = CBufFlat::NewL( bufferSize() ); //buffer granularity - CleanupStack::PushL( buffer ); - buffer->ResizeL( bufferSize() ); //buffer size - - // Now fetch the transfer buffer from the server - TPtr8 pBuffer(buffer->Ptr(0)); - User::LeaveIfError(SendReceive( EMemScanGetDataGroups, TIpcArgs(&pBuffer) )); - - // *** Start internalizing the buffer *** - - RBufReadStream stream(*buffer); - CleanupClosePushL(stream); - - // Read the number of data groups from the beginning of the stream - const TInt count = stream.ReadInt32L(); - - // Create the array for the data group names with appropriate granularity - CDesCArray* dataGroupNameArray = new (ELeave) CDesCArrayFlat(count); - CleanupStack::PushL( dataGroupNameArray ); - - - // Read each group name to array - for(TInt i=0; iAppendL( *group ); - CleanupStack::PopAndDestroy( group ); - } - - // *** Internalizing done *** - - CleanupStack::Pop( dataGroupNameArray ); - CleanupStack::PopAndDestroy( &stream ); - CleanupStack::PopAndDestroy( buffer ); - - - return dataGroupNameArray; - } - - -// --------------------------------------------------------------------------- -// RMemScanClient::ScanResultL() -// -// --------------------------------------------------------------------------- -EXPORT_C CArrayFix* RMemScanClient::ScanResultL() const - { - // Ask server to externalize the scan result array to buffer - // and to provide size of buffer - TPckgBuf bufferSize; - User::LeaveIfError(SendReceive(EMemScanPrepareScanResults, TIpcArgs( &bufferSize ))); - - // Create a buffer of sufficient size in order to fetch the - // buffer from the server - CBufBase* buffer = CBufFlat::NewL( bufferSize() ); //buffer granularity - CleanupStack::PushL( buffer ); - buffer->ResizeL( bufferSize() ); //buffer size - - // Now fetch the transfer buffer from the server - TPtr8 pBuffer(buffer->Ptr(0)); - TIpcArgs args(&pBuffer); - User::LeaveIfError(SendReceive( EMemScanGetScanResults, args )); - - // *** Start internalizing the buffer *** - - RBufReadStream stream(*buffer); - CleanupClosePushL(stream); - - // Read the number of results from the beginning of the stream - const TInt count = stream.ReadInt32L(); - - // Create the result array with such granularity - // that reallocations do not happen - CArrayFix* resultArray = new (ELeave) CArrayFixFlat(count); - CleanupStack::PushL(resultArray); - - - // Read scan results for each data group and write them to result array - for(TInt i=0; i> result; - resultArray->AppendL(result); - } - - // *** Internalizing done *** - - CleanupStack::Pop( resultArray ); - CleanupStack::PopAndDestroy( &stream ); - CleanupStack::PopAndDestroy( buffer ); - - - return resultArray; - } - -// --------------------------------------------------------------------------- -// RMemScanClient::Scan() -// -// --------------------------------------------------------------------------- -EXPORT_C TInt RMemScanClient::Scan(TDriveNumber aDrive) - { - TInt err = SendReceive( EMemScanStartScan, TIpcArgs( aDrive ) ); - return err; - } - - -// --------------------------------------------------------------------------- -// RMemScanClient::RequestScanEvents() -// -// --------------------------------------------------------------------------- -EXPORT_C void RMemScanClient::RequestScanEvents( TInt& aError, TRequestStatus& aRequestStatus ) - { - iScanEventPackagePointer.Set( (TUint8*) &aError, sizeof(TInt), sizeof(TInt) ); - - TIpcArgs args( &iScanEventPackagePointer ); - SendReceive( EMemScanRequestScanEvents, args, aRequestStatus ); - } - - -// --------------------------------------------------------------------------- -// RMemScanClient::RequestScanEventsCancel() -// -// --------------------------------------------------------------------------- -EXPORT_C void RMemScanClient::RequestScanEventsCancel() - { - // There is nothing client can do if cancelling went wrong, - // so we don't return any error - SendReceive( EMemScanRequestScanEventsCancel ); - } - - -// --------------------------------------------------------------------------- -// RMemScanClient::ScanInProgress() -// -// --------------------------------------------------------------------------- -EXPORT_C TBool RMemScanClient::ScanInProgress() const - { - TBool result = EFalse; - TInt err = SendReceive(EMemScanInProgress); - if( err < 0 ) - { - result = EFalse; - } - else - { - result = static_cast (err); - } - return result; - } - - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/data/mseng.rss --- a/filesystemuis/memscaneng/data/mseng.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,830 +0,0 @@ -/* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This file contains all the resources for the module. -* -*/ - - -#include "mseng.hrh" -#include "mseng.rh" -#include -#include -#include - -NAME MENG - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF { buf="mseng"; } - -/** -* The directories that are scanned on internal drive (C:). -*/ -RESOURCE DIRECTORYARRAY c_directories - { - directories= - { - text_phone_memory_root_path - }; - } - -/** -* The directories that are scanned on removable drive. -*/ -RESOURCE DIRECTORYARRAY e_directories - { - directories= - { - text_memory_card_root_path - }; - } - -/** -* The directories that are recursively NOT scanned on internal drive, -* even if they are subdirectories of a root directory -*/ -RESOURCE DIRECTORYARRAY c_excluded_directories - { - directories= - { - // Not really needed since this is not under scanning root dir, - // but BAFL panics if the array is left empty... - "?:\\private\\", - "?:\\resource\\", - "?:\\sys\\", - "?:\\system\\" - }; - } - -/** -* The directories that are recursively NOT scanned on removable drive. -* These directories will be set to hidden. -*/ -RESOURCE DIRECTORYARRAY e_excluded_directories - { - directories= - { - "?:\\private\\", - "?:\\resource\\", - "?:\\sys\\", - "?:\\system\\" - }; - } - -/** -* The files on internal drive (C:) that are not scanned by uid or ext, -* for example because they are located outside the -* normally scanned filesystem part (directoryarray). -*/ -RESOURCE EXTRADATAFILES c_extradatafiles - { - extradatafile= - { - EXTRADATAFILE - { - datagroup=EGroupDocuments; - filepath="?:\\private\\100012a5\\DBS_101F8878_Notepad.dat"; - // Note: Documents created outside Notepad - // are scanned separately by extensions. - }, - - EXTRADATAFILE - { - datagroup=EGroupCalendar; - filepath="?:\\private\\10003a5b\\calendar"; - }, - EXTRADATAFILE - { - datagroup=EGroupContacts; - filepath="?:\\private\\10003a73\\SQLite__Contacts.cdb"; - } - }; - } - -/** -* The files on E drive that are not scanned by uid or ext, -* for example because they are located outside the -* normally scanned filesystem part (directoryarray). -*/ -RESOURCE EXTRADATAFILES e_extradatafiles - { - extradatafile= - { - // No current database files on E drive - }; - } - -/** -* Another special case are the directories on internal (C:) drive, where all files, -* regardless of their type, belong to the same data group. -*/ -RESOURCE SPECIAL_DATADIRS c_special_datadirs - { - special_datadir= - { - SPECIAL_DATADIR - { - datagroup=EGroupMessages; - path="?:\\private\\1000484b\\Mail2\\"; - excludeddatafiles= - { - "Index", - "00100000", - "00001000" - }; - }, - SPECIAL_DATADIR - { - datagroup=EGroupMidpJava; - path="?:\\private\\102033E6\\apps\\"; - // Note: Midlets outside private dirs are scanned by extensions - excludeddatafiles= - { - }; - }, - SPECIAL_DATADIR - { - datagroup=EGroupNativeApps; - path="?:\\private\\10202dce\\"; - // Note: Sis-packages outside private dirs are scanned by extensions - excludeddatafiles= - { - "preInstalledAppsCache.dat" - }; - } - }; - } - -/** -* Another special case are the directories on removable drive, where all -* files regardless of their type, belong to the same data group. -*/ -RESOURCE SPECIAL_DATADIRS e_special_datadirs - { - special_datadir= - { - SPECIAL_DATADIR - { - datagroup=EGroupContacts; - path=text_memory_card_contacts_path; - excludeddatafiles= - { - }; - }, - SPECIAL_DATADIR - { - datagroup=EGroupMessages; - path="?:\\private\\1000484b\\Mail2\\"; - excludeddatafiles= - { - "Index", - "00100000", - "00001000" - }; - }, - SPECIAL_DATADIR - { - datagroup=EGroupMidpJava; - path="?:\\private\\102033E6\\apps\\"; - // Note: Midlets outside private dirs are scanned by extensions - excludeddatafiles= - { - }; - }, - SPECIAL_DATADIR - { - datagroup=EGroupNativeApps; - path="?:\\private\\10202dce\\"; - // Note: Sis-packages outside private dirs are scanned by extensions - excludeddatafiles= - { - "preInstalledAppsCache.dat" - }; - } - }; - } - -/** -* The resources for UIDs. -* This array creates the mapping between TUidTypes enumeration -* and the actual application UIDs. -* Take care that all UIDs from TUidTypes are handled here. -* -* These MUST be in the same order as in enum TUidTypes! -* Otherwise will panic on construction. -* -*/ -RESOURCE UIDARRAY uidarray - { - uidtypeelements= - { - UIDTYPEELEMENT - { - uidtype=EUidMsgTypeMultimedia; - uid=0x100058E1; // from mmsconst.h - }, - UIDTYPEELEMENT - { - uidtype=EUidMsgTypeSMTP; - uid=0x10001028; // from miutset.h - }, - UIDTYPEELEMENT - { - uidtype=EUidMsgTypePOP3; - uid=0x10001029; // from miutset.h - }, - UIDTYPEELEMENT - { - uidtype=EUidMsgTypeIMAP4; - uid=0x1000102A; // from miutset.h - }, - UIDTYPEELEMENT - { - uidtype=EUidMsgTypeSMS; - uid=0x1000102C; // from miutset.h - }, - UIDTYPEELEMENT - { - uidtype=EUidMsgTypeFax; - uid=0x1000102B; // from miutset.h - }, - UIDTYPEELEMENT - { - uidtype=EUidMsgTypeIr; - uid=0x100053A4; // from irobutil.h - }, - UIDTYPEELEMENT - { - uidtype=EUidMsgTypeBt; - uid=0x10009ED5; // from btmsgtypeuid.h - }, - UIDTYPEELEMENT - { - uidtype=EUidTest1; - uid=0x0123456A; // TEST - }, - UIDTYPEELEMENT - { - uidtype=EUidTest2; - uid=0x0123456B; // TEST - } - }; - } - -/** -* The resources for filename extensions. -* This array creates the mapping between TExtTypes enumeration -* and the actual filename extensions. -* Take care that all extensions from TExtTypes are handled here. -* -* These MUST be in the same order as in enum TExtTypes! -* Otherwise will panic on construction. -* -*/ -RESOURCE EXTARRAY extarray - { - exttypeelements= - { - - // ---------- Image types ---------- - - EXTTYPEELEMENT - { - exttype=EExtBmp; - extension="*.bmp"; - }, - EXTTYPEELEMENT - { - exttype=EExtGif; - extension="*.gif"; - }, - EXTTYPEELEMENT - { - exttype=EExtJpe; - extension="*.jpe"; - }, - EXTTYPEELEMENT - { - exttype=EExtJpeg; - extension="*.jpeg"; - }, - EXTTYPEELEMENT - { - exttype=EExtJpg; - extension="*.jpg"; - }, - EXTTYPEELEMENT - { - exttype=EExtOta; - extension="*.ota"; - }, - EXTTYPEELEMENT - { - exttype=EExtPng; - extension="*.png"; - }, - EXTTYPEELEMENT - { - exttype=EExtTif; - extension="*.tif"; - }, - EXTTYPEELEMENT - { - exttype=EExtTiff; - extension="*.tiff"; - }, - EXTTYPEELEMENT - { - exttype=EExtWbmp; - extension="*.wbmp"; - }, - EXTTYPEELEMENT - { - exttype=EExtWmf; - extension="*.wmf"; - }, - EXTTYPEELEMENT - { - exttype=EExtJp2; - extension="*.jp2"; - }, - EXTTYPEELEMENT - { - exttype=EExtJpg2; - extension="*.jpg2"; - }, - EXTTYPEELEMENT - { - exttype=EExtJp3; - extension="*.jp3"; - }, - EXTTYPEELEMENT - { - exttype=EExtIco; - extension="*.ico"; - }, - EXTTYPEELEMENT - { - exttype=EExtVcf; - extension="*.vcf"; - }, - - // ---------- Sound types ---------- - - EXTTYPEELEMENT - { - exttype=EExtAac; - extension="*.aac"; - }, - EXTTYPEELEMENT - { - exttype=EExtAmr; - extension="*.amr"; - }, - EXTTYPEELEMENT - { - exttype=EExtAu; - extension="*.au"; - }, - EXTTYPEELEMENT - { - exttype=EExtAwb; - extension="*.awb"; - }, - EXTTYPEELEMENT - { - exttype=EExtMid; - extension="*.mid"; - }, - EXTTYPEELEMENT - { - exttype=EExtMp3; - extension="*.mp3"; - }, - EXTTYPEELEMENT - { - exttype=EExtRa; - extension="*.ra"; - }, - EXTTYPEELEMENT - { - exttype=EExtRmf; - extension="*.rmf"; - }, - EXTTYPEELEMENT - { - exttype=EExtRng; - extension="*.rng"; - }, - EXTTYPEELEMENT - { - exttype=EExtSnd; - extension="*.snd"; - }, - EXTTYPEELEMENT - { - exttype=EExtWav; - extension="*.wav"; - }, - EXTTYPEELEMENT - { - exttype=EExtWve; - extension="*.wve"; - }, - EXTTYPEELEMENT - { - exttype=EExtWma; - extension="*.wma"; - }, - EXTTYPEELEMENT - { - exttype=EExtM4a; - extension="*.m4a"; - }, - EXTTYPEELEMENT - { - exttype=EExtOtt; - extension="*.ott"; - }, - EXTTYPEELEMENT - { - exttype=EExtMxmf; - extension="*.mxmf"; - }, - EXTTYPEELEMENT - { - exttype=EExtMka; - extension="*.mka"; - }, - - // ---------- Java file types ----- - - EXTTYPEELEMENT - { - exttype=EExtJad; - extension="*.jad"; - }, - EXTTYPEELEMENT - { - exttype=EExtJar; - extension="*.jar"; - }, - - // ---------- Native file types ----- - - EXTTYPEELEMENT - { - exttype=EExtSis; - extension="*.sis"; - }, - EXTTYPEELEMENT - { - exttype=EExtSisx; - extension="*.sisx"; - }, - - // ---------- Video types ---------- - - EXTTYPEELEMENT - { - exttype=EExt3gp; - extension="*.3gp"; - }, - EXTTYPEELEMENT - { - exttype=EExtMp4; - extension="*.mp4"; - }, - EXTTYPEELEMENT - { - exttype=EExtNim; - extension="*.nim"; - }, - EXTTYPEELEMENT - { - exttype=EExtRm; - extension="*.rm"; - }, - EXTTYPEELEMENT - { - exttype=EExtRv; - extension="*.rv"; - }, - EXTTYPEELEMENT - { - exttype=EExtWmv; - extension="*.wmv"; - }, - EXTTYPEELEMENT - { - exttype=EExt3g2; - extension="*.3g2"; - }, - EXTTYPEELEMENT - { - exttype=EExtRmvb; - extension="*.rmvb"; - }, - EXTTYPEELEMENT - { - exttype=EExtMkv; - extension="*.mkv"; - }, - EXTTYPEELEMENT - { - exttype=EExtAvi; - extension="*.avi"; - }, - // ---------- Document types ---------- - - EXTTYPEELEMENT - { - exttype=EExtDoc; - extension="*.doc"; - }, - EXTTYPEELEMENT - { - exttype=EExtPdf; - extension="*.pdf"; - }, - EXTTYPEELEMENT - { - exttype=EExtPps; - extension="*.pps"; - }, - EXTTYPEELEMENT - { - exttype=EExtPpt; - extension="*.ppt"; - }, - EXTTYPEELEMENT - { - exttype=EExtTxt; - extension="*.txt"; - }, - EXTTYPEELEMENT - { - exttype=EExtXls; - extension="*.xls"; - }, - - // ---------- Calendar types ---------- - - EXTTYPEELEMENT - { - exttype=EExtVcs; - extension="*.vcs"; - } - }; - } - -/** -* The data group names. -* This array creates the mapping between TDataGroups enumeration -* and the localized strings that are displayed to the user. -* Take care that all groups from TDataGroups are handled here. -* The localized strings are in the localization file mseng.loc. -* -* These MUST be in the same order as in enum TDataGroups! -* Otherwise mseng will panic on construction. -* -*/ -RESOURCE DATAGROUPNAMEARRAY datagroupnamearray - { - datagroupnameelements= - { - DATAGROUPNAMEELEMENT - { - grouptype=EGroupAllDeviceData; - groupname=qtn_swins_ls1_memory_all; - }, - DATAGROUPNAMEELEMENT - { - grouptype=EGroupFreeMemory; - groupname=qtn_swins_ls1_memory_free; - }, - DATAGROUPNAMEELEMENT - { - grouptype=EGroupCalendar; - groupname=qtn_swins_ls1_memory_calendar; - }, - DATAGROUPNAMEELEMENT - { - grouptype=EGroupContacts; - groupname=qtn_swins_ls1_memory_contacts; - }, - DATAGROUPNAMEELEMENT - { - grouptype=EGroupMessages; - groupname=qtn_swins_ls1_memory_msgs; - }, - DATAGROUPNAMEELEMENT - { - grouptype=EGroupImages; - groupname=qtn_swins_ls1_memory_imgs; - }, - DATAGROUPNAMEELEMENT - { - grouptype=EGroupSoundFiles; - groupname=qtn_swins_ls1_memory_souds; - }, - DATAGROUPNAMEELEMENT - { - grouptype=EGroupVideos; - groupname=qtn_swins_ls1_memory_videos; - }, - DATAGROUPNAMEELEMENT - { - grouptype=EGroupDocuments; - groupname=qtn_swins_ls1_memory_docs; - }, - DATAGROUPNAMEELEMENT - { - grouptype=EGroupMidpJava; - groupname=qtn_swins_ls1_memory_midpjava; - }, - DATAGROUPNAMEELEMENT - { - grouptype=EGroupNativeApps; - groupname=qtn_swins_ls1_memory_sis; - }, - DATAGROUPNAMEELEMENT - { - grouptype=EGroupOthers; - groupname=qtn_swins_ls1_memory_others; - } - }; - } - -/** -* List of UIDs belonging to each data group. -* -* This array includes for, each data group -* (enum TDataGroups), the list of UIDs (enum TUidTypes) -* belonging to that data group. -*/ -RESOURCE DATAGROUPUIDARRAY datagroupuidarray - { - datagroupuids= - { - DATAGROUPUIDS - { - datagroup=EGroupMessages; - uids= - { - EUidMsgTypeMultimedia, - EUidMsgTypeSMTP, - EUidMsgTypePOP3, - EUidMsgTypeIMAP4, - EUidMsgTypeSMS, - EUidMsgTypeFax, - EUidMsgTypeIr, - EUidMsgTypeBt - }; - }, - DATAGROUPUIDS - { - datagroup=EGroupDocuments; - uids= - { - EUidTest1, - EUidTest2 - }; - } - }; - } - -/** -* List of extension belonging to each data group. -* -* This array includes for, each data group -* (enum TDataGroups),the list of filename extensions -* (enum TExtTypes) belonging to that data group. -*/ -RESOURCE DATAGROUPEXTARRAY datagroupextarray - { - datagroupexts= - { - DATAGROUPEXTS - { - datagroup=EGroupImages; - exts= - { - EExtBmp, - EExtGif, - EExtJpe, - EExtJpeg, - EExtJpg, - EExtOta, - EExtPng, - EExtTif, - EExtTiff, - EExtWbmp, - EExtWmf, - EExtJp2, - EExtJpg2, - EExtJp3, - EExtIco, - EExtVcf - }; - }, - DATAGROUPEXTS - { - datagroup=EGroupSoundFiles; - exts= - { - EExtAac, - EExtAmr, - EExtAu, - EExtAwb, - EExtMid, - EExtMp3, - EExtRa, - EExtRmf, - EExtRng, - EExtSnd, - EExtWav, - EExtWve, - EExtWma, - EExtM4a, - EExtOtt, - EExtMxmf, - EExtMka - }; - }, - DATAGROUPEXTS - { - // Note: Midlet installation folder scanned separately. - datagroup=EGroupMidpJava; - exts= - { - EExtJad, - EExtJar - }; - }, - DATAGROUPEXTS - { - // Note: Sis pre-installation folder and registry scanned separately. - datagroup=EGroupNativeApps; - exts= - { - EExtSis, - EExtSisx - }; - }, - DATAGROUPEXTS - { - datagroup=EGroupVideos; - exts= - { - EExt3gp, - EExtMp4, - EExtNim, - EExtRm, - EExtRv, - EExtWmv, - EExt3g2, - EExtRmvb, - EExtMkv, - EExtAvi - }; - }, - DATAGROUPEXTS - { - // Note: Notepad database scanned separately. - datagroup=EGroupDocuments; - exts= - { - EExtDoc, - EExtPdf, - EExtPps, - EExtPpt, - EExtTxt, - EExtXls - }; - }, - DATAGROUPEXTS - { - // Note: Calendar private-folder scanned separately. - datagroup=EGroupCalendar; - exts= - { - EExtVcs - }; - } - }; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/eabi/MemScanClientU.DEF --- a/filesystemuis/memscaneng/eabi/MemScanClientU.DEF Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -EXPORTS - _ZN14RMemScanClient17RequestScanEventsERiR14TRequestStatus @ 1 NONAME - _ZN14RMemScanClient23RequestScanEventsCancelEv @ 2 NONAME - _ZN14RMemScanClient4ScanE12TDriveNumber @ 3 NONAME - _ZN14RMemScanClient5CloseEv @ 4 NONAME - _ZN14RMemScanClient7ConnectEv @ 5 NONAME - _ZN14RMemScanClientC1Ev @ 6 NONAME - _ZN14RMemScanClientC2Ev @ 7 NONAME - _ZNK14RMemScanClient11DataGroupsLEv @ 8 NONAME - _ZNK14RMemScanClient11ScanResultLEv @ 9 NONAME - _ZNK14RMemScanClient14ScanInProgressEv @ 10 NONAME - diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/eabi/msengU.DEF --- a/filesystemuis/memscaneng/eabi/msengU.DEF Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -EXPORTS - _ZN6CMseng4NewLER15MMsengUIHandler @ 1 NONAME - _ZN6CMseng5ScanLE12TDriveNumber @ 2 NONAME - _ZN6CMseng7CancelLEv @ 3 NONAME - _ZN6CMseng8MemInfoLERxS0_ @ 4 NONAME - _ZN6CMsengD0Ev @ 5 NONAME - _ZN6CMsengD1Ev @ 6 NONAME - _ZN6CMsengD2Ev @ 7 NONAME - _ZNK6CMseng11DataGroupsLEv @ 8 NONAME - _ZNK6CMseng11ScanResultLEv @ 9 NONAME - _ZNK6CMseng14ScanInProgressEv @ 10 NONAME - _ZNK6CMseng9DiskInfoLERxS0_12TDriveNumber @ 11 NONAME - _ZTI13CMsengScanner @ 12 NONAME ; ## - _ZTI15CMsengInfoArray @ 13 NONAME ; ## - _ZTI17CMsengFileScanner @ 14 NONAME ; ## - _ZTI17CMsengScannerBase @ 15 NONAME ; ## - _ZTI20CMsengFileExtScanner @ 16 NONAME ; ## - _ZTI20CMsengFindAllScanner @ 17 NONAME ; ## - _ZTI22CMsengDirectoryScanner @ 18 NONAME ; ## - _ZTI6CMseng @ 19 NONAME ; ## - _ZTV13CMsengScanner @ 20 NONAME ; ## - _ZTV15CMsengInfoArray @ 21 NONAME ; ## - _ZTV17CMsengFileScanner @ 22 NONAME ; ## - _ZTV17CMsengScannerBase @ 23 NONAME ; ## - _ZTV20CMsengFileExtScanner @ 24 NONAME ; ## - _ZTV20CMsengFindAllScanner @ 25 NONAME ; ## - _ZTV22CMsengDirectoryScanner @ 26 NONAME ; ## - _ZTV6CMseng @ 27 NONAME ; ## - diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/group/bld.inf --- a/filesystemuis/memscaneng/group/bld.inf Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +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: -* This file provides the information required for building the -* whole of a memscaneng. -* -*/ - - -#include - -PRJ_PLATFORMS - DEFAULT - - -PRJ_EXPORTS - ../clientinc/memscanclient.h |../../inc/memscanclient.h - ../serverinc/memscanclientserver.h |../../inc/memscanclientserver.h - ../serverinc/msenguihandler.h |../../inc/msenguihandler.h - ../rom/Mseng.iby CORE_APP_LAYER_IBY_EXPORT_PATH(Mseng.iby ) - ../rom/MsengResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(MsengResources.iby ) - ../loc/mseng.loc APP_LAYER_LOC_EXPORT_PATH(mseng.loc) - -PRJ_MMPFILES - memscanserv.mmp - memscanclient.mmp - - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/group/memscanclient.mmp --- a/filesystemuis/memscaneng/group/memscanclient.mmp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +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: -* This is project specification file for the Memory Scan Client. -* -*/ - - -#include - -TARGET memscanclient.dll -TARGETTYPE dll -UID 0x1000008D 0x102073FD -VENDORID VID_DEFAULT - -CAPABILITY CAP_GENERAL_DLL - -SOURCEPATH ../clientsrc -SOURCE memscanclient.cpp - -USERINCLUDE . ../clientinc ../serverinc -APP_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY estor.lib -LIBRARY bafl.lib // Descriptor arrays - - - - -// End of File - - - diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/group/memscanserv.mmp --- a/filesystemuis/memscaneng/group/memscanserv.mmp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +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: Project definition file for project memscaneng -* -*/ - - - -#include -#include - -TARGET memscanserv.exe -TARGETTYPE exe -UID 0x100039CE 0x102073FC -VENDORID VID_DEFAULT -CAPABILITY CAP_SERVER AllFiles - -SOURCEPATH ../serversrc -SOURCE memscanserv.cpp -SOURCE mseng.cpp -SOURCE msengscanner.cpp -SOURCE msenginfoarray.cpp -SOURCE msengscannerbase.cpp -SOURCE msengdirectoryscanner.cpp -SOURCE msengfilescanner.cpp -SOURCE msengfileextscanner.cpp -SOURCE msengfindallscanner.cpp -SOURCE msengregistryscanner.cpp -SOURCE msengsisxinfo.cpp - -START RESOURCE ../data/mseng.rss -TARGETPATH RESOURCE_FILES_DIR -HEADER -LANGUAGE_IDS -END - -USERINCLUDE . ../serverinc - -APP_LAYER_SYSTEMINCLUDE -//SYSTEMINCLUDE /epoc32/include/swi - -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY estor.lib -LIBRARY bafl.lib // Resource files -LIBRARY sisregistryclient.lib -LIBRARY platformenv.lib -//Uncomment this line to show the RDebug::Print() -// MACRO __SHOW_RDEBUG_PRINT_ - -// End of File - diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/loc/mseng.loc --- a/filesystemuis/memscaneng/loc/mseng.loc Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* -* Copyright (c) 2002 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: -* This file contains the localised strings for memscaneng -* -* -*/ - - -// LOCALISATION STRINGS - -// d: Name for data group consisting of calendar and entries. -// l: list_single_heading_pane_t1_cp2 -// -#define qtn_swins_ls1_memory_calendar "Calendar data" - -// d: Name for data group consisting of phonebook entries. -// l: list_single_heading_pane_t1_cp2 -// -#define qtn_swins_ls1_memory_contacts "Contacts data" - -// d: Name for data group consisting of notepad documents and -// d: plain text files, ms word documents (?) etc. -// l: list_single_heading_pane_t1_cp2 -// -#define qtn_swins_ls1_memory_docs "Documents" - -// d: Name for data group consisting of messages (SMS, MMS, e-mail, fax) -// l: list_single_heading_pane_t1_cp2 -// -#define qtn_swins_ls1_memory_msgs "Messages" - -// d: Name for data group consisting of all image files. -// l: list_single_heading_pane_t1_cp2 -// -#define qtn_swins_ls1_memory_imgs "Images" - -// d: Name for data group consisting of all sound files. -// l: list_single_heading_pane_t1_cp2 -// -#define qtn_swins_ls1_memory_souds "Sound files" - -// d: Name for data group consisting of Java environment -// d: and installed Midlets. -// l: list_single_heading_pane_t1_cp2 -// -#define qtn_swins_ls1_memory_midpjava "MIDP programs" - -// d: all_device_data == total_memory - free_memory -// l: list_single_heading_pane_t1_cp2 -// -#define qtn_swins_ls1_memory_all "All device data" - -// d: Amount of free memory available in the device. -// l: list_single_heading_pane_t1_cp2 -// -#define qtn_swins_ls1_memory_free "Free memory" - -// d: Name for data group consisting of all video files. -// l: list_single_heading_pane_t1_cp2 -// -#define qtn_swins_ls1_memory_videos "Videos" - -//d: Name for data group consisting of SIS applications -//l: list_single_heading_pane_t1_cp2 -//w: -//r:3.2 -// -#define qtn_swins_ls1_memory_sis "SIS programs" - -//d: Name for data group consisting of other files -//l: list_single_heading_pane_t1_cp2 -//w: -//r:3.2 -// -#define qtn_swins_ls1_memory_others "Other files" - - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/rom/Mseng.iby --- a/filesystemuis/memscaneng/rom/Mseng.iby Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +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: Image description file for project memscaneng -* -*/ - - -#ifndef __MSENG_IBY__ -#define __MSENG_IBY__ - -// Memory Scan Engine, Server and Client - -file=ABI_DIR\BUILD_DIR\MemScanServ.exe PROGRAMS_DIR\MemScanServ.exe -file=ABI_DIR\BUILD_DIR\MemScanClient.dll SHARED_LIB_DIR\MemScanClient.dll - -#endif diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/rom/MsengResources.iby --- a/filesystemuis/memscaneng/rom/MsengResources.iby Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +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: Image description file for project memscaneng -* -*/ - - -#ifndef __MSENG_RESOURCES_IBY__ -#define __MSENG_RESOURCES_IBY__ - -//Resource file(s) for Memory Scan Engine - -data=DATAZ_\RESOURCE_FILES_DIR\mseng.rsc RESOURCE_FILES_DIR\mseng.rsc - -#endif diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/memscanclientserver.h --- a/filesystemuis/memscaneng/serverinc/memscanclientserver.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +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: Memory Scan Client/Server definitions -* -*/ - - - -#ifndef __MEMSCANCLIENTSERVER_H__ -#define __MEMSCANCLIENTSERVER_H__ - - -_LIT(KMemScanServName,"memscanserv"); -_LIT(KMemScanServImg,"memscanserv"); // EXE name -_LIT(KMemScanServerPanicCategory, "MemScanServer"); - -const TUid KMemScanServUid3={0x10207386}; - -const TInt KMemScanServMajor = 1; -const TInt KMemScanServMinor = 0; -const TInt KMemScanServBuild = 0; - -const TInt KMesArg0 = 0; - -// Language specific buffer size is assumed to vary between 80-150 -const TInt KMemScanServTransferBufferExpandSize = 50; - -enum TMemScanEvent - { - EMemScanEventScanningStarted = 0, - EMemScanEventScanningFinished, - EMemScanEventScanningError - }; - -// when modifying these, notice the server's policy -enum TMemScanServMessages - { - EMemScanStartScan, - EMemScanPrepareDataGroups, - EMemScanGetDataGroups, - EMemScanInProgress, - EMemScanRequestScanEvents, - EMemScanRequestScanEventsCancel, - EMemScanPrepareScanResults, - EMemScanGetScanResults - }; - -enum TMemScanServerClientPanic - { - EMemScanServerPanicRequestedScanEventsTwice = 0, - }; - -#endif// __MEMSCANCLIENTSERVER_H__ diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/memscanserv.h --- a/filesystemuis/memscaneng/serverinc/memscanserv.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,192 +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: Memory Scan Server -* -*/ - - -#ifndef __MEMSCANSERV_H__ -#define __MEMSCANSERV_H__ - -// SYSTEM INCLUDES -#include - -// USER INCLUDES -#include "memscanclientserver.h" -#include "msenguihandler.h" -#include "mseng.h" - - - -// -------------------------------------------------------------------------- -// Server's policy here -// -------------------------------------------------------------------------- - -//Total number of ranges -const TUint KMemScanServRangeCount = 2; - -//Definition of the ranges of IPC numbers -const TInt KMemScanServRanges[KMemScanServRangeCount] = - { - 0, // ECapabilityReadUserData - /* - 0 EMemScanStartScan, - 1 EMemScanPrepareDataGroups, - 2 EMemScanGetDataGroups, - 3 EMemScanInProgress, - 4 EMemScanRequestScanEvents, - 5 EMemScanRequestScanEventsCancel, - 6 EMemScanPrepareScanResults, - 7 EMemScanGetScanResults - */ - - 8 // ENotSupported - Non implemented function end of range check - }; - -//Policy to implement for each of the above ranges -const TUint8 KMemScanServElementsIndex[KMemScanServRangeCount] = - { - 0, // 0th range: Policy 0 in Elements - CPolicyServer::ENotSupported // 1st range: Out of range IPC - }; - -//Specific capability checks -const CPolicyServer::TPolicyElement KMemScanServElements[] = - { - // Policy 0: Fail call if ReadUserData not present - {_INIT_SECURITY_POLICY_C1(ECapabilityReadUserData), CPolicyServer::EFailClient} - }; - -//Package all the above together into a policy -const CPolicyServer::TPolicy KMemScanServPolicy = - { - CPolicyServer::EAlwaysPass, // All connect attempts should pass - KMemScanServRangeCount, // Number of ranges - KMemScanServRanges, // Ranges array - KMemScanServElementsIndex, // Elements<->Ranges index - KMemScanServElements, // Array of elements - }; - - - -// -------------------------------------------------------------------------- -// Server's panic codes here -// -------------------------------------------------------------------------- -enum TMemScanServPanic - { - EPanicGeneral, - EPanicIllegalFunction - }; - -void PanicClient(const RMessagePtr2& aMessage,TMemScanServPanic aPanic); - - -// -------------------------------------------------------------------------- -// Auto shutdown class (standard pattern) -// -------------------------------------------------------------------------- -class CShutdown : public CTimer - { - enum TMemScanShutdown - { - EMemScanServShutdownDelay=0x200000 - }; -public: - inline CShutdown(); - inline void ConstructL(); - inline void Start(); -private: - void RunL(); - }; - -// -------------------------------------------------------------------------- -// Server -// -------------------------------------------------------------------------- - -class CMemScanServ : public CPolicyServer - { -public: - static CServer2* NewLC(); - void AddSession(); - void DropSession(); -private: - CMemScanServ(); - void ConstructL(); - CSession2* NewSessionL( const TVersion& aVersion, - const RMessage2& aMessage) const; - -private: - TInt iSessionCount; - CShutdown iShutdown; - }; - - - -// -------------------------------------------------------------------------- -// Event object -// -------------------------------------------------------------------------- -struct TMemScanEventPackage - { - TMemScanEvent iEvent; - TInt iError; - }; - - -// -------------------------------------------------------------------------- -// Session -// -------------------------------------------------------------------------- -class CMemScanServSession : public CSession2, public MMsengUIHandler - { -public: - CMemScanServSession(); - void CreateL(); - private: - ~CMemScanServSession(); - inline CMemScanServ& Server(); - void ServiceL(const RMessage2& aMessage); - void ServiceError(const RMessage2& aMessage,TInt aError); - - -private: // Client <-> server functions - void MemScanL(const RMessage2& aMessage); - void RequestScanEventsL(const RMessage2& aMessage); - void RequestScanEventsCancel(const RMessage2& aMessage); - void ScanInProgress(const RMessage2& aMessage); - void PrepareDataGroupsL(const RMessage2& aMessage); - void GetDataGroupsL(const RMessage2& aMessage); - void PrepareScanResultsL(const RMessage2& aMessage); - void GetScanResultsL(const RMessage2& aMessage); - -private: // Internal utility functions - void SendEventToClientL( TMemScanEvent aEventType, TInt aError=KErrNone ); - void AddNewEventToBufferL( TMemScanEvent aEventType, TInt aError); - TBool IsEventReady() const; - void DeliverOldestEventToClientL(); - -private: //From MMsengUIHandler - void StartL(); - void QuitL(TInt aReason); - void ErrorL(TInt aError); - -private: // Member variables - CMseng* iMseng; - RMessagePtr2 iScanEventMessage; - RArray< TMemScanEventPackage > iEventBuffer; - CBufBase* iTransferBuffer; - }; - - - -#endif // __MEMSCANSERV_H__ - -// End of File \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/memscanutils.h --- a/filesystemuis/memscaneng/serverinc/memscanutils.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +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: Memory Scan Utils -* -*/ - - -#ifndef __MEMSCANUTILS_H__ -#define __MEMSCANUTILS_H__ - - -// Macro for printing debug traces without ifdefs -#ifdef _DEBUG -#define TRACES(x) x -#else -#define TRACES(x) -#endif - - -#endif // __MEMSCANUTILS_H__ - -// End of File \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/mseng.h --- a/filesystemuis/memscaneng/serverinc/mseng.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,201 +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: -* The actual "engine". -* -*/ - - -#ifndef CMSENG_H -#define CMSENG_H - - -// SYSTEM INCLUDES -#include -#include // descriptor arrays -#include // enum TDriveNumber -#include -#include // CResourceFile -#include // RResourceReader - - -// USER INCLUDES -#include "msenguihandler.h" - - -// FORWARD DECLARATIOS -class CMsengScanner; -class RFs; -class MMsengUIHandler; - - -// CONSTANTS - -// Resource file path -_LIT(KMsengRscFilePath,"Z:mseng.rsc"); - - -// DATA TYPES - -/** -* Type definition to handle arrays of integers -* more conveniently -*/ -typedef CArrayFixFlat CIntArray; - - -// CLASS DECLARATION - -/** -* The actual "engine". -* This is the class which the UI instantiates. -*/ -class CMseng :public CBase - { - public: // Constructors and destructor - /** - * Two-phased constructor. - * @param aUIHandler Reference to a class implementing MMsengUIHandler interface - */ - IMPORT_C static CMseng* NewL(MMsengUIHandler& aUIHandler); - /** - * Destructor. - */ - IMPORT_C ~CMseng(); - - public: // New functions - - /** - * Get the data groups. - * @return CDesCArray* containing the names of the data groups. - */ - IMPORT_C CDesCArray* DataGroupsL() const; - - /** - * Get the scan result. This array contains exacly one - * integer per data group. - * @return Array of integers. - */ - IMPORT_C CArrayFix* ScanResultL() const; - - /** - * Is there scanning going on? - * @return ETrue if there is scanning going on, otherwise EFalse. - */ - IMPORT_C TBool ScanInProgress() const; - - /** - * Get the amount of total and free space on a disk - * @param aTotal Amount of total space in bytes in substituted here. - * @param aFree Amount of free space in bytes in substituted here. - * @param aVolume Disk identifier, e.g. 'C' - */ - IMPORT_C void DiskInfoL(TInt64& aTotal, TInt64& aFree, const TDriveNumber aVolume) const; - - /** - * Get the amount of total and free RAM. - * @param aTotal Amount of total RAM in bytes in substituted here. - * @param aTotal Amount of free RAM in bytes in substituted here. - */ - IMPORT_C static void MemInfoL(TInt64& aTotal, TInt64& aFree); - - /** - * Start scanning memory. - * This means starting the actual work of the engine. Starts scanning, - * which runs until finished. - * - * The scanning is only supported for drives C and E, otherwise - * leave occurs with error KErrNotSupported. - * - * NOTE: the support for scanning E drive is not properly tested. - * It is assumed to have the same directory structure than in C. - * - * @param aDrive the drive to be scanned - */ - IMPORT_C void ScanL(TDriveNumber aDrive); - - /** - * Cancel ongoing scanning operation. - */ - IMPORT_C void Cancel(); - - /** - * Check whether internal drive. - * @param aDrv Drive to be checked. - * @return ETrue if internal drive, otherwise EFalse. - */ - static TBool IsInternalDrive( RFs& aFs, const TInt aDrv ); - - /** - * Check whether removable drive. - * @param aDrv Drive to be checked. - * @return ETrue if internal drive, otherwise EFalse. - */ - static TBool IsRemovableDrive( RFs& aFs, const TInt aDrv ); - - /** - * Check whether mass storage drive. - * @param aDrv Drive to be checked. - * @return ETrue if mass storage drive, otherwise EFalse. - */ - static TBool IsMassStorageDrive( RFs& aFs, const TInt aDrv ); - - private: - - /** - * C++ default constructor is prohibited. - */ - CMseng(MMsengUIHandler& aUIHandler); - - /** - * By default Symbian OS constructor is private. - * - * Initialize iResultArray by reading the the data group - * names from resource file and setting all result values to zero. - * Initialize iDataGroupUidArray and iDataGroupExtArray - * from resource file. - */ - void ConstructL(); - - - // Prohibit copy constructor if not deriving from CBase. - CMseng( const CMseng& ); - // Prohibit assigment operator if not deriving from CBase. - CMseng& operator= ( const CMseng& ); - - - private: // Data members - - MMsengUIHandler& iUIHandler; - CMsengScanner* iScanner; - - // Number of data groups - TInt iNumberOfDataGroups; - - // These arrays are needed to when calculating the result. - // They are indexed using values from enum TDataGroups. - // This creates the mapping between data groups and the - // UIDs and extensions belonging to a particular data group - CArrayPtrFlat* iDataGroupUidArray; - CArrayPtrFlat* iDataGroupExtArray; - - RFs iFsSession; - CResourceFile* iResFile; - mutable TInt64 iFreeMemory; - - }; - -#endif // CMSENG_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/mseng.hrh --- a/filesystemuis/memscaneng/serverinc/mseng.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -/* -* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This file contains configuration data for Memory scan Engine -* -* -*/ - - -#ifndef MSENG_HRH -#define MSENG_HRH - -// INCLUDES -#include - -// CONSTANTS - -// Folders to scan: -// All root folders are listed in mseng.rss -// All of their subfolders are also scanned. - -// DATA TYPES - -/** -* The UID types scanned. Not currently used, but may be needed. -* -* The UID:s matching TUidTypes enumeration are -* in the resource file mseng.rss -* Care must be taken that every UID type has -* corresponding resource struct in mseng.rss -*/ -enum TUidTypes - { - EUidMsgTypeMultimedia = 0, - EUidMsgTypeSMTP, - EUidMsgTypePOP3, - EUidMsgTypeIMAP4, - EUidMsgTypeSMS, - EUidMsgTypeFax, - EUidMsgTypeIr, - EUidMsgTypeBt, - EUidTest1, - EUidTest2 - }; - - -/** -* The filename extension types scanned. -* -* The strings matching TExtTypes enumeration are -* in the resource file mseng.rss -* Care must be taken that every extension type -* has corresponding resource struct in mseng.rss -*/ -enum TExtTypes - { - // Image types - EExtBmp = 0, - EExtGif, - EExtJpe, - EExtJpeg, - EExtJpg, - EExtOta, - EExtPng, - EExtTif, - EExtTiff, - EExtWbmp, - EExtWmf, - EExtJp2, - EExtJpg2, - EExtJp3, - EExtIco, - EExtVcf, - // Sound types - EExtAac, - EExtAmr, - EExtAu, - EExtAwb, - EExtMid, - EExtMp3, - EExtRa, - EExtRmf, - EExtRng, - EExtSnd, - EExtWav, - EExtWve, - EExtWma, - EExtM4a, - EExtOtt, - EExtMxmf, - EExtMka, - // Java file types - EExtJad, - EExtJar, - // Native installation file types - EExtSis, - EExtSisx, - // Video types - EExt3gp, - EExtMp4, - EExtNim, - EExtRm, - EExtRv, - EExtWmv, - EExt3g2, - EExtRmvb, - EExtMkv, - EExtAvi, - // Document types - EExtDoc, - EExtPdf, - EExtPps, - EExtPpt, - EExtTxt, - EExtXls, - // Calendar types - EExtVcs - }; - -/** -* The data groups. (These are what is displayed to the user). -* -* The strings matching TExtTypes enumeration are -* in the resource file mseng.rss -* Care must be taken that every extension type -* has corresponding resource in mseng.rss -* -* The names are shown to the user in the order -* as enumerated here. -*/ -enum TDataGroups - { - EGroupAllDeviceData = 0, - EGroupFreeMemory, - EGroupCalendar, - EGroupContacts, - EGroupMessages, - EGroupImages, - EGroupSoundFiles, - EGroupVideos, - EGroupDocuments, - EGroupMidpJava, - EGroupNativeApps, - EGroupOthers - }; - -#endif // MSENG.HRH - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/mseng.rh --- a/filesystemuis/memscaneng/serverinc/mseng.rh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,211 +0,0 @@ -/* -* Copyright (c) 2002 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: -* This file contains declarations for resources of memscaneng. -* The file can be included only in resource file. -* -* -*/ - - -// INCLUDES -#include "mseng.hrh" - -// STRUCTURE DEFINITIONS - - -// --------------------------------------------------------- -// DIRECTORYARRAY -// -// The directories that are scanned (array of dir paths) -// --------------------------------------------------------- -// -STRUCT DIRECTORYARRAY - { - LTEXT directories[]; - } - -// --------------------------------------------------------- -// UIDTYPEELEMENT -// -// This struct maps one UID type from enum TUidTypes -// to the value of the UID. -// --------------------------------------------------------- -// -STRUCT UIDTYPEELEMENT - { - BYTE uidtype; - LONG uid; - } - -// --------------------------------------------------------- -// UIDARRAY -// -// This array contain all the used UID type elements. -// --------------------------------------------------------- -// -STRUCT UIDARRAY - { - STRUCT uidtypeelements[]; - } - -// --------------------------------------------------------- -// EXTTYPEELEMENT -// -// This struct maps one extension type from enum TExtTypes -// to the string representing the extension -// --------------------------------------------------------- -// -STRUCT EXTTYPEELEMENT - { - BYTE exttype; - LTEXT extension; - } - -// --------------------------------------------------------- -// EXTARRAY -// -// This array contain all the extension type elements used. -// --------------------------------------------------------- -// -STRUCT EXTARRAY - { - STRUCT exttypeelements[]; - } - -// --------------------------------------------------------- -// DATAGROUPNAMEELEMENT -// -// This struct maps one data group from enum TDataGroups -// to the actual string representing the name of -// the data group -// --------------------------------------------------------- -// -STRUCT DATAGROUPNAMEELEMENT - { - BYTE grouptype; - LTEXT groupname; - } - -// --------------------------------------------------------- -// DATAGROUPNAMEARRAY -// -// This array contains all data group names -// --------------------------------------------------------- -// -STRUCT DATAGROUPNAMEARRAY - { - STRUCT datagroupnameelements[]; - } - -// --------------------------------------------------------- -// DATAGROUPUIDS -// -// List of UIDs belonging to a data group. -// --------------------------------------------------------- -// -STRUCT DATAGROUPUIDS - { - BYTE datagroup; - BYTE uids[]; - } - -// --------------------------------------------------------- -// DATAGROUPUIDARRAY -// -// This array includes for, each data group, -// (enum TDataGroups), the list of UIDs (enum TUidTypes) -// belonging to that data group. -// --------------------------------------------------------- -// -STRUCT DATAGROUPUIDARRAY - { - STRUCT datagroupuids[]; - } - -// --------------------------------------------------------- -// DATAGROUPEXTS -// -// List of extension belonging to a data group. -// --------------------------------------------------------- -// -STRUCT DATAGROUPEXTS - { - BYTE datagroup; - BYTE exts[]; - } - -// --------------------------------------------------------- -// DATAGROUPEXTARRAY -// -// This array includes for, each data group, -// (enum TDataGroups), the list of extension -// (enum TExtTypes) belonging to that data group. -// --------------------------------------------------------- -// -STRUCT DATAGROUPEXTARRAY - { - STRUCT datagroupexts[]; - } - -// --------------------------------------------------------- -// EXTRADATAFILE -// -// Specific file that is scanned separately from -// normal uid or ext scanning. -// --------------------------------------------------------- -// -STRUCT EXTRADATAFILE - { - BYTE datagroup; - LTEXT filepath; - } - -// --------------------------------------------------------- -// EXTRADATAFILES -// -// Specific files that is scanned separately from -// normal uid or ext scanning. -// --------------------------------------------------------- -// -STRUCT EXTRADATAFILES - { - STRUCT extradatafile[]; - } - -// --------------------------------------------------------- -// SPECIAL_DATADIR -// -// A directory, where all files belong to the same -// data group. -// --------------------------------------------------------- -STRUCT SPECIAL_DATADIR - { - BYTE datagroup; - LTEXT path; - LTEXT excludeddatafiles[]; - } - -// --------------------------------------------------------- -// SPECIAL_DATADIRS -// -// This array of above defined special directories. -// -// --------------------------------------------------------- -STRUCT SPECIAL_DATADIRS - { - STRUCT special_datadir[]; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/msengdirectoryscanner.h --- a/filesystemuis/memscaneng/serverinc/msengdirectoryscanner.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Scan directories. -* -*/ - - -#ifndef MSENGDIRECTORYSCANNER_H -#define MSENGDIRECTORYSCANNER_H - -// USER INCLUDES -#include "msengscannerbase.h" - - -// CLASS DECLARATION - -/** -* This class identifies all subdirectories based upon a given root path -*/ -class CMsengDirectoryScanner : public CMsengScannerBase - { - public: // Constructors and destructor - - /** - * C++ default constructor. - */ - CMsengDirectoryScanner(MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, RFs& aFsSession); - - /** - * Destructor. - */ - ~CMsengDirectoryScanner(); - - /** - * - */ - enum TScanDirectoryResult - { - EContinueToNextDirectory = 0, - EContinueProcessingCurrentDirectory - }; - - public: // New functions - - /** - * Start the scan operation. - */ - void ScanL(const CDesCArray& aRootDirs); - - protected: // From CMsengScannerBase - - /** - * Do one incremental scanning step - */ - virtual TStepResult PerformStepL(); - - protected: // New framework - - /** - * This is called when one directory needs scanning - */ - virtual TScanDirectoryResult ScanDirectoryL(const TDesC& aDirectory, RFs& aFsSession) = 0; - - /** - * Use this function to add a new directory to the list of - * directories which require scanning - */ - void AppendDirectoryL(const TDesC& aDirectory); - - private: - - /** - * - */ - enum TState - { - EExpandingRootDirs = 0, - EParsingExpandedList, - EScanningSubDirs - }; - - private: - - /** - * - */ - TState iState; - - /** - * - */ - TInt iCurrentIndex; - - /** - * - */ - CDirScan* iScanner; - - /** - * - */ - TInt iNumberOfRootDirectories; - - /** - * - */ - CDesCArray* iDirectoryList; - }; - -#endif // MSENGDIRECTORYSCANNER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/msengfileextscanner.h --- a/filesystemuis/memscaneng/serverinc/msengfileextscanner.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +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: -* Scanner class used to scan file system by filename extensions. -* -*/ - - -#ifndef MSENGFILEEXTSCANNER_H -#define MSENGFILEEXTSCANNER_H - -// INCLUDES -#include "msengfilescanner.h" - -// CLASS DECLARATION - -/** -* Scanner class used to scan file system by filename extension. -*/ -class CMsengFileExtScanner : public CMsengFileScanner - { - public: // Constructors and destructor - - /** - * constructor - */ - static CMsengFileExtScanner* NewL( - MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, - RFs& aFsSession); - - /** - * Destructor. - */ - ~CMsengFileExtScanner(); - - public: // New functions - - /** - * - */ - virtual CDir* FindFilesL(const TDesC& aDirectory, TBool& aMoveToNextDirectory); - - /** - * - */ - virtual TLocationResponse HandleLocatedEntryL(const TDesC& aFullFileNameAndPath, - const TEntry& aEntry); - - private: - - /** - * C++ default constructor. - */ - CMsengFileExtScanner( - MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, - RFs& aFsSession); - - private: - - // Prohibit copy constructor if not deriving from CBase. - CMsengFileExtScanner( const CMsengFileExtScanner& ); - // Prohibit assigment operator if not deriving from CBase. - CMsengFileExtScanner& operator= ( const CMsengFileExtScanner& ); - - /** - * - */ - TInt iCurrentExtensionIndex; - - /** - * - */ - TBool iMoveToNextDirectory; - }; - -#endif // MSENGFILEEXTSCANNER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/msengfilescanner.h --- a/filesystemuis/memscaneng/serverinc/msengfilescanner.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +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: -* Scan files. -* -*/ - - -#ifndef MSENGFILESCANNER_H -#define MSENGFILESCANNER_H - -// USER INCLUDES -#include "msengdirectoryscanner.h" - -// CLASS DECLARATION - -/** -* This class identifies all files in a given directory based upon a -* directory specification. -*/ -class CMsengFileScanner : public CMsengDirectoryScanner - { - public: // Constructors and destructor - - /** - * C++ default constructor. - */ - CMsengFileScanner(MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, RFs& aFsSession); - - - /** - * Destructor. - */ - ~CMsengFileScanner(); - - public: - - /** - * - */ - enum TLocationResponse - { - EEntryWasProcessed = 0, - EEntryWasDiscarded - }; - - protected: // From CMsengDirectoryScanner - - /** - * Scan this directory for files matching a subclass' criteria - */ - virtual TScanDirectoryResult ScanDirectoryL(const TDesC& aDirectory, RFs& aFsSession); - - /** - * Ask the subclass to populate a CDir object with a list of files matching - * chosen criteria - */ - virtual CDir* FindFilesL(const TDesC& aDirectory, TBool& aMoveToNextDirectory) = 0; - - /** - * Inform the subclass of a matching entry - */ - virtual TLocationResponse HandleLocatedEntryL(const TDesC& aFullFileNameAndPath, - const TEntry& aEntry) = 0; - }; - -#endif // MSENGFILESCANNER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/msengfindallscanner.h --- a/filesystemuis/memscaneng/serverinc/msengfindallscanner.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +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: -* Scanner class used to scan file system by filename extension -* -* -*/ - - -#ifndef MSENGFINDALLSCANNER_H -#define MSENGFINDALLSCANNER_H - -// INCLUDES -#include "msengfilescanner.h" - -// CLASS DECLARATION - -/** -* Scanner class used to scan file system by filename extension. -*/ -class CMsengFindAllScanner : public CMsengFileScanner - { - public: // Constructors and destructor - - /** - * constructor - */ - static CMsengFindAllScanner* NewL( - MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, - RFs& aFsSession); - - - /** - * Destructor. - */ - ~CMsengFindAllScanner(); - - public: // New functions - - /** - * - */ - virtual CDir* FindFilesL(const TDesC& aDirectory, TBool& aMoveToNextDirectory); - - /** - * - */ - virtual TLocationResponse HandleLocatedEntryL(const TDesC& aFullFileNameAndPath, - const TEntry& aEntry); - - private: - - /** - * C++ default constructor. - */ - CMsengFindAllScanner( - MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, - RFs& aFsSession); - - private: - - // Prohibit copy constructor if not deriving from CBase. - CMsengFindAllScanner( const CMsengFindAllScanner& ); - // Prohibit assigment operator if not deriving from CBase. - CMsengFindAllScanner& operator= ( const CMsengFindAllScanner& ); - }; - -#endif // MSENGFINDALLSCANNER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/msenginfoarray.h --- a/filesystemuis/memscaneng/serverinc/msenginfoarray.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,214 +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: -* An utility class to handle the UIDs and filename extensions used to -* identify data types. It is also used to store the results per data type. -* -*/ - - -#ifndef CMSENGINFOARRAY_H -#define CMSENGINFOARRAY_H - -// INCLUDES -#include -#include - -// FORWARD DECLARATIONS -class CResourceFile; -class RResourceReader; - - -// CLASS DECLARATION - -/** -* An utility class to handle the UIDs and filename extensions -* used to identify data types. It is also used to store -* the results per data type -*/ -class CMsengInfoArray : public CBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CMsengInfoArray* NewL(TDriveNumber aDrive, - TInt aNumberOfDataGroups, - RFs& aFsSession, - CResourceFile& aResFile); - - /** - * Destructor. - */ - ~CMsengInfoArray(); - - public: // New functions - - /** - * Get the scan results per UID. - * @return Pointer to the array of scan results per UID. - */ - inline CArrayFix* UidResults() const; - - /** - * Get the scan results per filename extension. - * @return Pointer to the array of scan results per extension. - */ - inline CArrayFix* ExtResults() const; - - /** - * Get the scan results per data group. - * @return Pointer to the array of scan results per group. - */ - inline CArrayFix* GroupResults() const; - - /** - * Get UIDs to be scanned for. - * @return Pointer to the array of UIDs. - */ - inline const CArrayFix& Uids() const; - - /** - * Get the extensions to be scanned for. - * @return Pointer to the array of filename extensions. - */ - inline const CDesCArray& Exts() const; - - /** - * Get the directories to be scanned. - * @return Pointer to the array of directory paths. - */ - inline const CDesCArray& Dirs() const; - - /** - * Get the special data directories to be scanned. - * @return Pointer to the array data dir - data group pairs. - */ - inline const CDesCArray& DataDirs() const; - - /** - * - * - */ - inline const CArrayFix& DataDirGroups() const; - - /** - * Get the files excluded from directory to be scanned. - */ - inline const CArrayPtrFlat& DataDirExcludedFiles() const; - - /** - * Get the drive that is currently scanned - * @return Drive current drive - */ - inline const TDriveNumber CurrentDrive() const; - - /** - * Add new file size to the result array. - * @param aUid The file UID type in question - * @param aSize Size of the file - */ - inline void AddSizeByUidL(TInt aUid, TInt64 aSize); - - /** - * Add new file size to the result array. - * @param aExt Filename extension type in question - * @param aSize Size of the file - */ - inline void AddSizeByExtL(TInt aExt, TInt64 aSize); - - /** - * Add scan result af a specific data group. - * @param aGroupIndex Data group in question - * @param aSize Size of the file - */ - inline void AddSizeByGroupL(TInt aGroupIndex, TInt64 aSize); - - /** - * Query if the directory is in the list of directories to be - * excluded from scanning, or is a subdirectory of one - * @param aDirectory Path of the directory - * @return TBool - */ - TBool IsExcludedDir(const TDesC& aDirectory) const; - - /** - * This function is otherwise similar to BaflUtils::FolderExists, but - * it also ETrue for drive root (e.g. "c:\") - * @param aFs File server session - * @param aDirectory Path of the directory - */ - TBool FolderExists(RFs& aFs, const TDesC& aPath); - - /** - * Query if the directory is in the list of directories to be - * excluded from scanning, or is a subdirectory of one - * @param aDirectory Path of the directory - * @return TBool - */ - TBool IsSpecialDir(const TDesC& aDirectory) const; - - - private: - - /** - * C++ default constructor is prohibited. - */ - CMsengInfoArray(TDriveNumber aDrive); - - /** - * By default Symbian OS constructor is private. - */ - void ConstructL(TInt aNumberOfDataGroups, RFs& aFsSession, CResourceFile& aResFile); - - // Prohibit copy constructor if not deriving from CBase. - CMsengInfoArray( const CMsengInfoArray& ); - // Prohibit assigment operator if not deriving from CBase. - CMsengInfoArray& operator= ( const CMsengInfoArray& ); - - private: // Data - // Root directories for scanning - CDesCArray* iDirArray; - - // Directories that are excluded from the normal scan - CDesCArray* iExcludedDirArray; - - // Directories scanned as a whole excluding listed files - CDesCArray* iDataDirArray; - CArrayFix* iDataDirGroupArray; - CArrayPtrFlat* iDataDirExclArray; - - // The drive that is currently scanned - TDriveNumber iCurrentScannedDrive; - - // The following arrays are indexed using values from enumerations - // TUidTypes and TExtTypes - - // Results are inserted into these arrays - CArrayFix* iUidResultArray; - CArrayFix* iExtResultArray; - CArrayFix* iGroupResultArray; - - // UIDs and extensions, which are searched, - // are in these two arrays - CArrayFix* iUidArray; - CDesCArray* iExtArray; - }; - -#include "msenginfoarray.inl" - -#endif // CMSENGINFOARRAY_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/msenginfoarray.inl --- a/filesystemuis/memscaneng/serverinc/msenginfoarray.inl Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* -* Copyright (c) 2002 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 definition for CMsengInfoArray -* -* -*/ - - -inline CArrayFix* CMsengInfoArray::UidResults() const - { - return iUidResultArray; - } - -inline CArrayFix* CMsengInfoArray::ExtResults() const - { - return iExtResultArray; - } - -inline CArrayFix* CMsengInfoArray::GroupResults() const - { - return iGroupResultArray; - } - -inline const CArrayFix& CMsengInfoArray::Uids() const - { - return *iUidArray; - } - -inline const CDesCArray& CMsengInfoArray::Exts() const - { - return *iExtArray; - } - -inline const CDesCArray& CMsengInfoArray::Dirs() const - { - return *iDirArray; - } - -inline const CDesCArray& CMsengInfoArray::DataDirs() const - { - return *iDataDirArray; - } - -inline const CArrayFix& CMsengInfoArray::DataDirGroups() const - { - return *iDataDirGroupArray; - } - -inline const CArrayPtrFlat& CMsengInfoArray::DataDirExcludedFiles() const - { - return *iDataDirExclArray; - } - -inline const TDriveNumber CMsengInfoArray::CurrentDrive() const - { - return iCurrentScannedDrive; - } - -inline void CMsengInfoArray::AddSizeByUidL(TInt aUid, TInt64 aSize) - { - // The array must have been initialized to contain zeros! - (*iUidResultArray)[aUid] += aSize; - } - -inline void CMsengInfoArray::AddSizeByExtL(TInt aExt, TInt64 aSize) - { - // The array must have been initialized to contain zeros! - (*iExtResultArray)[aExt] += aSize; - } - -inline void CMsengInfoArray::AddSizeByGroupL(TInt aGroupIndex, TInt64 aSize) - { - // The array must have been initialized to contain zeros! - (*iGroupResultArray)[aGroupIndex] += aSize; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/msengregistryscanner.h --- a/filesystemuis/memscaneng/serverinc/msengregistryscanner.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +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: Memory scan engine registry scanning -* -*/ - - -#ifndef MSENGREGISTRYSCANNER_H -#define MSENGREGISTRYSCANNER_H - -// USER INCLUDES -#include "msengscannerbase.h" - - -// CLASS DECLARATION - -/** -* This class represents a registry scanner. -* -* @since 3.2 -*/ -class CMsengRegistryScanner : public CMsengScannerBase - { - public: // Constructors and destructor - - /** - * Constructor. - * - * @param aDrive - Drive to be scanned. - */ - static CMsengRegistryScanner* NewL( TDriveNumber aDrive, MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, RFs& aFsSession); - - /** - * Destructor. - */ - ~CMsengRegistryScanner(); - - public: // New functions - - /** - * Starts the scan operation. - * @since S60 3.2 - */ - void Scan(); - - protected: // Functions from base classes - - /** - * From CMsengScannerBase - * Do one incremental scanning step - * - * @since S60 3.2 - */ - virtual TStepResult PerformStepL(); - - - private: - - CMsengRegistryScanner(TDriveNumber aDrive, MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, RFs& aFsSession); - - void ScanSisRegistryL(); - - private: // Internal enumerations - - /** - * - */ - enum TRegistryType - { - ERegistrySisx, - ERegistryLast - }; - - private: // Data - - TRegistryType iType; - TDriveNumber iDrive; - }; - -#endif // MSENGREGISTRYSCANNER - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/msengscanner.h --- a/filesystemuis/memscaneng/serverinc/msengscanner.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +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: -* CMsengScanner is the class that mostly controls the operation -* of Memory Scan Engine. It CMsengScannerBase-derived active objects -* to perform scanning operations. -* -*/ - - -#ifndef CMSENGSCANNER_H -#define CMSENGSCANNER_H - -// SYSTEM INCLUDES -#include // CResourceFile -#include // RResourceReader - -// USER INCLUDES -#include "msengscanobserver.h" -#include "msenginfoarray.h" - - -// FORWARD DECLARATIONS -class MMsengUIHandler; -class CMsengFileExtScanner; -class CMsengFindAllScanner; -class CMsengRegistryScanner; - - -// CLASS DECLARATION - -/** -* CMsengScanner controls the scanning operation. -*/ -class CMsengScanner : public CBase, public MMsengScannerObserver - { - public: // Constructors and destructor - - /** - * C++ default constructor. - */ - CMsengScanner(MMsengUIHandler& aUIHandler, CResourceFile& aResFile); - - /** - * Destructor. - */ - virtual ~CMsengScanner(); - - public: // New functions - - /** - * - */ - void Cancel(); - - /** - * - */ - TBool HaveActiveScanners() const; - - /** - * Start scanning (creates a new thread). - * @param aDrive the drive which is scanned - * @paran aNumberOfDataGroups - * @return KErrInUse if the scanning is already going on; - * KErrNone otherwise - */ - TInt ScanL(TDriveNumber aDrive, TInt aNumberOfDataGroups, RFs& FsSession); - - /** - * Get scan results per UID. - * @return Pointer to an array containing results per UID. - */ - inline const CArrayFix* UidResults() const; - - /** - * Get scan results per filename extension. - * @return Pointer to an array containing results per ext. - */ - inline const CArrayFix* ExtResults() const; - - /** - * Get scan results per data group. - * @return Pointer to an array containing results per group. - */ - inline const CArrayFix* GroupResults() const; - - /** - * - */ - inline const TDriveNumber CurrentDrive() const; - - public: // From MMsengScannerObserver - - /** - * - * @param aEvent event that is handled - */ - void HandleScannerEventL(TScannerEvent aEvent, - const CMsengScannerBase& aScanner, TInt aError=KErrNone); - - private: - - /** - * Do some simple scanning before actual work. - * @param aDrive the drive to be scanned - * @param aFsSession reference to file server session - */ - void PreScanL(TDriveNumber aDrive, RFs& aFsSession); - - // Prohibit copy constructor if not deriving from CBase. - CMsengScanner( const CMsengScanner& ); - // Prohibit assigment operator if not deriving from CBase. - CMsengScanner& operator= ( const CMsengScanner& ); - - private: // Data - - // External objects - MMsengUIHandler& iUIHandler; - CMsengInfoArray* iScanArray; - CResourceFile& iResFile; - - // Owned objects - CMsengFileExtScanner* iFileExtScanner; - CMsengFindAllScanner* iFindAllScanner; - CMsengRegistryScanner* iRegistryScanner; - }; - -#include "msengscanner.inl" - -#endif // CMSENGSCANNER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/msengscanner.inl --- a/filesystemuis/memscaneng/serverinc/msengscanner.inl Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2002 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 definition for CMsengScanner -* -* -*/ - - -inline const CArrayFix* CMsengScanner::UidResults() const - { - return iScanArray->UidResults(); - } - -inline const CArrayFix* CMsengScanner::ExtResults() const - { - return iScanArray->ExtResults(); - } - -inline const CArrayFix* CMsengScanner::GroupResults() const - { - return iScanArray->GroupResults(); - } - -inline const TDriveNumber CMsengScanner::CurrentDrive() const - { - return iScanArray->CurrentDrive(); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/msengscannerbase.h --- a/filesystemuis/memscaneng/serverinc/msengscannerbase.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +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: -* Base class for scanner classes. -* -* -*/ - - -#ifndef MSENGSCANNERBASE_H -#define MSENGSCANNERBASE_H - - - - -// USER INCLUDES -#include "mseng.hrh" -#include "msenginfoarray.h" -#include "msengscanobserver.h" - - - -// CONSTANTS -const TInt KDirectoryListGranularity = 10; - -// CLASS DECLARATION - -/** -* Base class for scanner classes. -* -*/ -class CMsengScannerBase : public CActive - { - public: // Constructors and destructor - - /** - * - */ - enum TStepResult - { - ECompleteRequest = 0, - ERequestIssuedInternally, - EScanComplete - }; - - /** - * C++ default constructor. - */ - CMsengScannerBase(MMsengScannerObserver& aObserver, - CMsengInfoArray& aInfoArray, RFs& aFsSession); - - /** - * Destructor. - */ - virtual ~CMsengScannerBase(); - - protected: // Internal functions - - /** - * Do one incremental scanning step - */ - virtual TStepResult PerformStepL() = 0; - - /** - * Complete this active object's request and set it active again - */ - void CompleteRequest(TInt aCode = KErrNone); - - /** - * Add new value in bytes to the amount of data found with this UID. - * @param aUid The UID type. - * @param aSize The size of the file with this UID. - */ - inline void AddSizeByUidL(TUidTypes aUid, TInt64 aSize); - - /** - * Add new value in bytes to the amount of data found with this UID. - * @param aUid The UID type. - * @param aSize The size of the file with this UID. - */ - inline void AddSizeByExtL(TExtTypes aExt, TInt64 aSize); - - /** - * Query if the directory is in the list of directories to be - * excluded from scanning, or is a subdirectory of one. - * @param aDirectory Path of the directory - */ - inline TBool IsExcludedDir(const TDesC& aDirectory); - - /** - * Query if the directory is in the list of directories to be - * excluded from scanning, or is a subdirectory of one. - * @param aDirectory Path of the directory - */ - inline TBool IsSpecialDir(const TDesC& aDirectory); - - /** - * Access the file server session - */ - inline RFs& FsSession(); - - /** - * Access the information array - */ - inline CMsengInfoArray& InfoArray(); - - /** - * Access the observer of this scanner - */ - inline MMsengScannerObserver& ScannerObserver(); - - private: // from CActive - - /** - * - */ - virtual void RunL(); - - /** - * - */ - virtual void DoCancel(); - - /** - * - */ - virtual TInt RunError(TInt aError); - - private: - - // Prohibit copy constructor if not deriving from CBase. - CMsengScannerBase( const CMsengScannerBase& ); - // Prohibit assigment operator if not deriving from CBase. - CMsengScannerBase& operator= ( const CMsengScannerBase& ); - - - private: - - MMsengScannerObserver& iObserver; - CMsengInfoArray& iInfoArray; - RFs& iFsSession; - }; - -#include "msengscannerbase.inl" - -#endif // CMSENGSCANNERBASE_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/msengscannerbase.inl --- a/filesystemuis/memscaneng/serverinc/msengscannerbase.inl Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2002 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 definition for CMsengScannerBase -* -* -*/ - - -inline void CMsengScannerBase::AddSizeByUidL(TUidTypes aUid, TInt64 aSize) - { - iInfoArray.AddSizeByUidL(aUid, aSize); - } - -inline void CMsengScannerBase::AddSizeByExtL(TExtTypes aExt, TInt64 aSize) - { - iInfoArray.AddSizeByExtL(aExt, aSize); - } - -inline TBool CMsengScannerBase::IsExcludedDir(const TDesC& aDirectory) - { - return iInfoArray.IsExcludedDir(aDirectory); - } - -inline TBool CMsengScannerBase::IsSpecialDir(const TDesC& aDirectory) - { - return iInfoArray.IsSpecialDir(aDirectory); - } - -inline RFs& CMsengScannerBase::FsSession() - { - return iFsSession; - } - -inline CMsengInfoArray& CMsengScannerBase::InfoArray() - { - return iInfoArray; - } -inline MMsengScannerObserver& CMsengScannerBase::ScannerObserver() - { - return iObserver; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/msengscanobserver.h --- a/filesystemuis/memscaneng/serverinc/msengscanobserver.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2002 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: -* An interface class used by the scanning thread to send -* events to the CMsengScanner instance that created the thread. -* -*/ - - -#ifndef MSENGSCANOBSERVER_H -#define MSENGSCANOBSERVER_H - -// CLASS REFERENCED -class CMsengScannerBase; - -// CLASS DECLARATION - -/** -* -*/ -class MMsengScannerObserver - { - public: - - /** - * - */ - enum TScannerEvent - { - EScannerEventScanComplete = 0, - EScannerEventScanError - }; - - public: - - /** - * - */ - virtual void HandleScannerEventL( - TScannerEvent aEvent, const CMsengScannerBase& aScanner, TInt aRrror=KErrNone) = 0; - }; - -#endif // MSENGSCANOBSERVER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/msengsisxinfo.h --- a/filesystemuis/memscaneng/serverinc/msengsisxinfo.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +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: Memory scanning engine registry scanning -* -*/ - - -#ifndef MSENGSISXINFO_H -#define MSENGSISXINFO_H - -// CLASS DECLARATION - -/** -* This class represents a sis registry entry. -* -* @since 3.2 -*/ -class CMsengSisxInfo : public CBase - { - public: // Constructors and destructor - - /** - * Constructor. - * - * @param aEntry - Sis registry entry. - * @param aDrive - Drive we are interested in - */ - static CMsengSisxInfo* NewL( Swi::RSisRegistryEntry& aEntry, TDriveNumber aDrive ); - - - /** - * Destructor. - */ - virtual ~CMsengSisxInfo(); - - public: // New functions - - - public: // Functions from base classes - - /** - * From CAppMngrAppInfo, Get location of the application. - * - * @since 3.2 - * @return Application location. - */ - TBool RequestedLocation() const; - - - private: - - /** - * 2nd phase constructor. - * - * @since 3.2 - * @param aEntry - Sis registry entry. - * @param aDrive - Drive scanning is requested for. - */ - void ConstructL( Swi::RSisRegistryEntry& aEntry, TDriveNumber aDrive ); - - private: // Data - HBufC* iFileName; // Own - RPointerArray iFiles; - - TBool iRequestedLocation; - TUid iUid; - }; - -#endif // MSENGSISXINFO_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serverinc/msenguihandler.h --- a/filesystemuis/memscaneng/serverinc/msenguihandler.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +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: -* A pure virtual interface class used by the UI to handle events from -* the Memory Scan Engine. -* -*/ - - -#ifndef MMSENGUIHANDLER_H -#define MMSENGUIHANDLER_H - -// INCLUDES -#include -#include - -// FORWARD DECLARATIONS -class CMsengInfoArray; - -// CONSTANTS - -// CLASS DECLARATION - -/** -* An interface class used by the engine to send information to the calling class. -*/ -class MMsengUIHandler - { - public: // New functions - - /** - * The engine tells that it has successfully initialized itself and - * started the scanning operation. - */ - virtual void StartL()=0; - - /** - * The last method called when the scanning is either finished or canceled. - * @param aReason The quit reason, can be KErrNone or KErrCancel. - */ - virtual void QuitL(TInt aReason)=0; - - /** - * The engine notifies the calling class if some error has happened - * @param aError Error code. - */ - virtual void ErrorL(TInt aError)=0; - }; - -#endif // MMSENGUIHANDLER_H - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serversrc/memscanserv.cpp --- a/filesystemuis/memscaneng/serversrc/memscanserv.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,621 +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: Memory Scan Server -* -*/ - - - -// SYSTEM INCLUDES -#include -#include // RBufWriteStream - -// USER INCLUDES -#include "memscanserv.h" -#include "memscanutils.h" // traces - - -// --------------------------------------------------------------------------- -// Server startup code -// --------------------------------------------------------------------------- - -// Perform all server initialisation, in particular creation of the -// scheduler and server and then run the scheduler -// -static void RunServerL() - { - // naming the server thread after the server helps to debug panics - User::LeaveIfError(User::RenameThread(KMemScanServName)); - - // create and install the active scheduler we need - CActiveScheduler* scheduler=new(ELeave) CActiveScheduler; - CleanupStack::PushL(scheduler); - CActiveScheduler::Install(scheduler); - // create the server (leave it on the cleanup stack) - CMemScanServ::NewLC(); - // Initialisation complete, now signal the client - - RProcess::Rendezvous(KErrNone); - - // Ready to run - TRACES( RDebug::Print(_L("MemScanServ: server fully running")) ); - CActiveScheduler::Start(); - // Cleanup the server and scheduler - CleanupStack::PopAndDestroy(2, scheduler); - } - -// Server process entry-point -TInt E32Main() - { - __UHEAP_MARK; - TRACES( RDebug::Print(_L("MemScanServ: E32Main")) ); - CTrapCleanup* cleanup=CTrapCleanup::New(); - TInt r=KErrNoMemory; - if (cleanup) - { - TRAP(r,RunServerL()); - delete cleanup; - } - __UHEAP_MARKEND; - return r; - } - -// RMessagePtr2::Panic() also completes the message. This is: -// (a) important for efficient cleanup within the kernel -// (b) a problem if the message is completed a second time -void PanicClient(const RMessagePtr2& aMessage,TMemScanServPanic aPanic) - { - _LIT(KPanic,"MemScanServ"); - aMessage.Panic(KPanic,aPanic); - } - - -// --------------------------------------------------------------------------- -// CShutDown -// --------------------------------------------------------------------------- -inline CShutdown::CShutdown() - :CTimer(-1) - { - CActiveScheduler::Add(this); - } - -inline void CShutdown::ConstructL() - { - CTimer::ConstructL(); - } - -inline void CShutdown::Start() - { - TRACES( RDebug::Print(_L("MemScanServ: starting shutdown timeout")) ); - After(EMemScanServShutdownDelay); - } - -void CShutdown::RunL() - { - TRACES( RDebug::Print(_L("MemScanServ: server timeout ... closing")) ); - CActiveScheduler::Stop(); - } - -// --------------------------------------------------------------------------- -// CMemScanServ -// --------------------------------------------------------------------------- -inline CMemScanServ::CMemScanServ() - :CPolicyServer(0, KMemScanServPolicy, ESharableSessions) - { - } - -CServer2* CMemScanServ::NewLC() - { - TRACES( RDebug::Print(_L("MemScanServ: CMemScanServ::NewLC")) ); - CMemScanServ* self=new(ELeave) CMemScanServ; - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - -// 2nd phase construction - ensure the timer and server objects are running -void CMemScanServ::ConstructL() - { - StartL(KMemScanServName); - iShutdown.ConstructL(); - // ensure the server still exits even if the 1st client fails to connect - if( !iShutdown.IsActive() ) - { - iShutdown.Start(); - } - } - - -// Create a new client session. -CSession2* CMemScanServ::NewSessionL(const TVersion& aVersion, const RMessage2&) const - { - TRACES( RDebug::Print(_L("MemScanServ: CMemScanServ::NewSessionL")) ); - - // Client-Server version check - TVersion version(KMemScanServMajor, KMemScanServMinor, KMemScanServBuild); - if( !User::QueryVersionSupported( version, aVersion ) ) - { - User::Leave( KErrNotSupported ); - } - - return new (ELeave) CMemScanServSession(); - } - -// A new session is being created -// Cancel the shutdown timer if it was running -void CMemScanServ::AddSession() - { - TRACES( RDebug::Print(_L("MemScanServ: CMemScanServ::AddSession")) ); - ++iSessionCount; - iShutdown.Cancel(); - } - -// A session is being destroyed -// Start the shutdown timer if it is the last session. -void CMemScanServ::DropSession() - { - TRACES( RDebug::Print(_L("MemScanServ: CMemScanServ::DropSession")) ); - if (--iSessionCount==0) - { - if( !iShutdown.IsActive() ) - { - iShutdown.Start(); - } - } - } - - -// --------------------------------------------------------------------------- -// CMemScanServSession -// --------------------------------------------------------------------------- -inline CMemScanServSession::CMemScanServSession() - { - TRACES( RDebug::Print(_L("MemScanServer: CMemScanServSession::CMemScanServSession")); ) - } - -inline CMemScanServ& CMemScanServSession::Server() - { - return *static_cast(const_cast(CSession2::Server())); - } - -// 2nd phase construct for sessions - called by the CServer framework -void CMemScanServSession::CreateL() - { - TRACES( RDebug::Print(_L("MemScanServ: CMemScanServSession::CreateL")); ) - Server().AddSession(); - - // Create a transfer buffer - iTransferBuffer = CBufFlat::NewL(KMemScanServTransferBufferExpandSize); - } - -CMemScanServSession::~CMemScanServSession() - { - TRACES( RDebug::Print(_L("MemScanServ: CMemScanServSession::~CMemScanServSession")); ) - - - delete iTransferBuffer; - delete iMseng; - - - iEventBuffer.Close(); - Server().DropSession(); - } - - -// Handle a client request. -// Leaving is handled by CMemScanServSession::ServiceError() which reports -// the error code to the client -void CMemScanServSession::ServiceL(const RMessage2& aMessage) - { - TRACES( RDebug::Print(_L("MemScanServ: CMemScanServSession::ServiceL; %d"),aMessage.Function()); ) - switch (aMessage.Function()) - { - case EMemScanPrepareDataGroups: - { - PrepareDataGroupsL( aMessage ); - break; - } - case EMemScanGetDataGroups: - { - GetDataGroupsL( aMessage ); - break; - } - case EMemScanStartScan: - { - MemScanL( aMessage ); - break; - } - case EMemScanPrepareScanResults: - { - PrepareScanResultsL( aMessage ); - break; - } - case EMemScanGetScanResults: - { - GetScanResultsL( aMessage ); - break; - } - case EMemScanRequestScanEvents: - { - RequestScanEventsL( aMessage ); - break; - } - case EMemScanRequestScanEventsCancel: - { - RequestScanEventsCancel( aMessage ); - break; - } - case EMemScanInProgress: - { - ScanInProgress( aMessage ); - break; - } - - default: - { - TRACES( RDebug::Print(_L("MemScanServ: CMemScanServSession::ServiceL; %d"),aMessage.Function()); ) - PanicClient(aMessage,EPanicIllegalFunction); - break; - } - - } - } - -// Handle an error from CMemScanServSession::ServiceL() -void CMemScanServSession::ServiceError(const RMessage2& aMessage,TInt aError) - { - TRACES( RDebug::Print(_L("MemScanServ: CMemScanServSession::ServiceError %d"),aError); ) - CSession2::ServiceError(aMessage,aError); - } - - -// *************************************************************************** -// Internal utility functions -// *************************************************************************** - - -// --------------------------------------------------------------------------- -// CMemScanServSession::PrepareDataGroupsL() -// -// --------------------------------------------------------------------------- -void CMemScanServSession::PrepareDataGroupsL(const RMessage2& aMessage) - { - // Create scan engine if it does not exist - if(!iMseng) - { - iMseng = CMseng::NewL(*this); - } - - // Get data group name array - CDesCArray* dataGroupArray = iMseng->DataGroupsL(); - CleanupStack::PushL(dataGroupArray); - - - // *** Start externalizing the data group array to transfer buffer - - // Clear the buffer - iTransferBuffer->Reset(); - - // Set buffer for the stream - RBufWriteStream stream(*iTransferBuffer); - CleanupClosePushL(stream); - - // Write number of fields in array to stream - TInt count = dataGroupArray->MdcaCount(); - stream.WriteInt32L(count); - - // Write each field in array to stream - for(TInt i=0; iMdcaPoint(i).Length(); - stream.WriteInt32L(length); // writes datagroup name length to stream - const TPtrC group = dataGroupArray->MdcaPoint(i); - stream << group; // writes one datagroup to stream - } - - stream.CommitL(); - CleanupStack::PopAndDestroy(&stream); - CleanupStack::PopAndDestroy(dataGroupArray); - - // *** externalizing done - - - // Write the size of transfer buffer back to client - TPckgBuf size(iTransferBuffer->Size()); - aMessage.WriteL(0, size); - - // complete the message - aMessage.Complete( KErrNone ); - } - - -// --------------------------------------------------------------------------- -// CMemScanServSession::GetDataGroupsL() -// -// --------------------------------------------------------------------------- -void CMemScanServSession::GetDataGroupsL(const RMessage2& aMessage) - { - // Get the prepared data groups - aMessage.WriteL( KMesArg0, iTransferBuffer->Ptr(0)); - - aMessage.Complete( KErrNone ); - } - -// --------------------------------------------------------------------------- -// CMemScanServSession::PrepareScanResultsL() -// -// --------------------------------------------------------------------------- -void CMemScanServSession::PrepareScanResultsL(const RMessage2& aMessage) - { - // Get scan results from server - CArrayFix* resultArray = iMseng->ScanResultL(); - CleanupStack::PushL(resultArray); - - // *** Start externalizing the result array to transfer buffer - - // Clear the buffer - iTransferBuffer->Reset(); - - // Set buffer for the stream - RBufWriteStream stream(*iTransferBuffer); - CleanupClosePushL(stream); - - // Write number of fields in array to stream - TInt count = resultArray->Count(); - stream.WriteInt32L(count); - - // Write each field in array to stream - for(TInt i=0; iAt(i); - stream << result; // writes one data result to stream - } - - stream.CommitL(); - CleanupStack::PopAndDestroy(&stream); - CleanupStack::PopAndDestroy(resultArray); - - // *** externalizing done - - - // Write the size of transfer buffer back to client - TPckgBuf size(iTransferBuffer->Size()); - aMessage.WriteL(0, size); - - - aMessage.Complete( KErrNone ); - } - - -// --------------------------------------------------------------------------- -// CMemScanServSession::GetScanResultsL() -// -// --------------------------------------------------------------------------- -void CMemScanServSession::GetScanResultsL(const RMessage2& aMessage) - { - // Get the prepared scan results - aMessage.WriteL( KMesArg0, iTransferBuffer->Ptr(0)); - - aMessage.Complete( KErrNone ); - } - - -// --------------------------------------------------------------------------- -// CMemScanServSession::MemScanL() -// -// --------------------------------------------------------------------------- -void CMemScanServSession::MemScanL(const RMessage2& aMessage) - { - TRACES( RDebug::Print(_L("MemScanServ: CMemScanServSession::ScanL")); ) - - // Get the first integer parameter of message - TDriveNumber drive = TDriveNumber(aMessage.Int0()); - - iMseng->ScanL( drive ); - aMessage.Complete( KErrNone ); - } - - -// --------------------------------------------------------------------------- -// CMemScanServSession::RequestScanEventsL() -// -// --------------------------------------------------------------------------- -void CMemScanServSession::RequestScanEventsL(const RMessage2& aMessage) - { - if ( iScanEventMessage.IsNull() ) - { - // We want check that the client hasn't requested scan events - // twice in a row. The client is only allowed to have one - // scan event request outstanding at any given time. - // - // Since the iScanEventMessage was null (i.e. its not been - // initialised) then its safe to store the client's message - // for completion later on when the scan engine has a real event. - - // Save the clients message for later until we receive an - // event callback from the scan engine. - iScanEventMessage = aMessage; - - // If we have at least one event ready to send to the client, then - // we deliver it to the client immediately. This could be possible - // if the client is slow to process an earlier event. - const TBool haveAtLeastOneEventPending = IsEventReady(); - if ( haveAtLeastOneEventPending ) - { - // We must deliver the oldest event to the client. - DeliverOldestEventToClientL(); // this will complete aMessage immediately. - } - } - else - { - // The client has already asked for scan events as we still - // have an existing (valid) iScanEventMessage object. - // - // This would imply a programming error in the client code - // so we punish the client by panicking it. - aMessage.Panic( KMemScanServerPanicCategory, EMemScanServerPanicRequestedScanEventsTwice ); - } - } - - -// --------------------------------------------------------------------------- -// CMemScanServSession::RequestScanEventsCancel() -// -// --------------------------------------------------------------------------- -void CMemScanServSession::RequestScanEventsCancel(const RMessage2& aMessage) - { - // We only are able to cancel a client request if the client actually - // requested something. - // We can check whether a request is pending by using the IsNull method - // on our outstanding request object ("iScanEventMessage"). - if ( iScanEventMessage.IsNull() == EFalse ) - { - // The client has made a request, and we need to cancel it. - iScanEventMessage.Complete( KErrCancel ); - } - - - // If the client wants to cancel events, we should also empty - // the event buffer. - iEventBuffer.Reset(); - - aMessage.Complete( KErrNone ); - } - - -// --------------------------------------------------------------------------- -// CMemScanServSession::ScanInProgress() -// -// --------------------------------------------------------------------------- -void CMemScanServSession::ScanInProgress(const RMessage2& aMessage) - { - TBool scanInProgress = iMseng->ScanInProgress(); - aMessage.Complete(static_cast (scanInProgress)); - } - - - -// From MMsengUIHandler: -// =========================================================================== - -// --------------------------------------------------------------------------- -// CMemScanServSession::StartL() -// --------------------------------------------------------------------------- -void CMemScanServSession::StartL() - { - SendEventToClientL( EMemScanEventScanningStarted ); - } - -// --------------------------------------------------------------------------- -// CMemScanServSession::QuitL() -// --------------------------------------------------------------------------- -void CMemScanServSession::QuitL(TInt aReason) - { - SendEventToClientL( EMemScanEventScanningFinished, aReason ); - } - -// --------------------------------------------------------------------------- -// CMemScanServSession::Error() -// --------------------------------------------------------------------------- -void CMemScanServSession::ErrorL(TInt aError) - { - SendEventToClientL( EMemScanEventScanningError, aError ); - } - -// =========================================================================== - - - - -// --------------------------------------------------------------------------- -// CMemScanServSession::SendEventToClientL() -// -// --------------------------------------------------------------------------- -void CMemScanServSession::SendEventToClientL( TMemScanEvent aEventType, - TInt aError ) - { - // We need to tell the client about the event that has taken place. - // The client event API expects to receive the event type, i.e. what - // kind of "thing" just happened, and also any associated error value - // (e.g. "Nothing went wrong" or, "we ran out of memory"). - - AddNewEventToBufferL( aEventType, aError ); - DeliverOldestEventToClientL(); - } - -// --------------------------------------------------------------------------- -// CMemScanServSession::AddNewEventToBufferL() -// -// --------------------------------------------------------------------------- -void CMemScanServSession::AddNewEventToBufferL( TMemScanEvent aEventType, - TInt aError ) - { - TMemScanEventPackage event; - event.iEvent = aEventType; - event.iError = aError; - - // Add the event to the event buffer. We will send this event to the - // client when the client is ready to accept it. - iEventBuffer.AppendL( event ); - } - -// --------------------------------------------------------------------------- -// CMemScanServSession::IsEventReady() -// -// --------------------------------------------------------------------------- -TBool CMemScanServSession::IsEventReady() const - { - // Returns whether we have at least one event in the buffer ready to send - // to the client. - const TInt count = iEventBuffer.Count(); - return ( count > 0 ); - } - - -// --------------------------------------------------------------------------- -// CMemScanServSession::DeliverOldestEventToClientL() -// -// --------------------------------------------------------------------------- -void CMemScanServSession::DeliverOldestEventToClientL() - { - // Fetch the oldest event from the buffer and deliver it - // to the client. - if ( iScanEventMessage.IsNull() == EFalse && IsEventReady() ) - { - // This next block of code converts the error number to look like - // a descriptor, since this is the only way of writing to the - // client's address space. - // - // We check that the client actually requested scan events before - // we try and write to its address space. If we don't do this - // then the kernel will panic our code with KERN-SVR 0 - // ("you're trying to use a null message object") - const TMemScanEventPackage& event = iEventBuffer[ 0 ]; - - TPckgC associatedErrorAsDescriptor( event.iError ); - iScanEventMessage.WriteL( 0, associatedErrorAsDescriptor ); - - // Now that we have written the error value, its safe to complete - // the clients asynchronous request which will end up calling - // the client's RunL method. - iScanEventMessage.Complete( event.iEvent ); - - // We've delivered the oldest event to the client, so now - // its safe to discard it. - iEventBuffer.Remove( 0 ); - } - } - - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serversrc/mseng.cpp --- a/filesystemuis/memscaneng/serversrc/mseng.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,589 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* The actual "engine". -* -* -*/ - - -// INCLUDE FILES - - -// SYSTEM INCLUDES -#include -#include -#include - -// USER INCLUDES -#include "mseng.h" -#include "mseng.hrh" -#include "msengscanner.h" - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMseng::CMseng() -// -// C++ default constructor. Can NOT contain any code, that might leave. -// --------------------------------------------------------------------------- - - - -CMseng::CMseng( MMsengUIHandler& aUIHandler ) : - iUIHandler(aUIHandler), - iFreeMemory(0) - { - } - -// --------------------------------------------------------------------------- -// CMseng::NewL() -// -// Two-phased constructor. -// --------------------------------------------------------------------------- - -EXPORT_C CMseng* CMseng::NewL(MMsengUIHandler& aUIHandler) - { - CMseng* self = new (ELeave) CMseng(aUIHandler); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// --------------------------------------------------------------------------- -// CMseng::ConstructL() -// -// Symbian OS default constructor can leave. -// --------------------------------------------------------------------------- - -void CMseng::ConstructL() - { - #ifdef __SHOW_RDEBUG_PRINT_ - RDebug::Print(_L("** CMseng::ConstructL()... starting **")); - #endif // __SHOW_RDEBUG_PRINT_ - - // Connect to File Server - User::LeaveIfError(iFsSession.Connect()); - - // Open the resource file - TParse* fp = new(ELeave) TParse(); - fp->Set(KMsengRscFilePath, &KDC_RESOURCE_FILES_DIR, NULL); - TFileName fileName( fp->FullName() ); - delete fp; - - - BaflUtils::NearestLanguageFile( iFsSession, fileName ); - // - TEntry entry; - User::LeaveIfError( iFsSession.Entry( fileName, entry ) ); - // if file does not exist, leaves with KErrNotFound - - iResFile = CResourceFile::NewL( iFsSession, fileName, 0, entry.FileSize() ); - - iResFile->ConfirmSignatureL(); - - - ///////////////////////////////////////////////////////// - //create data structures and initialize them from resource file - - TInt index = -1; // index used in for-loops - TInt subindex = -1; // index used in for-loops inside another for-loop - TInt length = -1; // length of resource array being read - TInt sublength = -1; // length of sub-array inside array resource - - RResourceReader theReader; - theReader.OpenLC( iResFile, DATAGROUPNAMEARRAY ); - - - //the first WORD contains the number of elements in the resource - iNumberOfDataGroups = theReader.ReadInt16L(); - - CleanupStack::PopAndDestroy( &theReader ); - - - - ///////////////////////////////////////////////////////// - // Read the resource containing the data needed to create - // mapping between data groups and UIDs - // - theReader.OpenLC( iResFile, DATAGROUPUIDARRAY ); - - //the first WORD contains the number of elements in the resource - length = theReader.ReadInt16L(); - - - // Create array with such granularity that reallocation is unnecessary - // initialize array to contain null pointers - iDataGroupUidArray = new (ELeave) CArrayPtrFlat(iNumberOfDataGroups); - for(index=0; indexAppendL(NULL); - } - TInt groupindex; // value from enum TDataGroups - // Read the array resource - for(index=0; indexCount() ) - { - iDataGroupUidArray->At(groupindex) = subarray; - } - - // Read the subarray resource - for(subindex=0; subindexCount() ) - { - iDataGroupUidArray->At(groupindex)->InsertL(subindex,uidtype); - } - } - CleanupStack::Pop( subarray ); - } - CleanupStack::PopAndDestroy( &theReader ); - - ///////////////////////////////////////////////////////// - // Read the resource containing the data needed to create - // mapping between data groups and extensions - // - theReader.OpenLC( iResFile, DATAGROUPEXTARRAY ); - - //the first WORD contains the number of elements in the resource - length = theReader.ReadInt16L(); - // Create array with such granularity that reallocation is unnecessary - // Initialize it to contain null pointers, since some cells can leave empty - iDataGroupExtArray = new (ELeave) CArrayPtrFlat(iNumberOfDataGroups); - for(index=0; indexAppendL(NULL); - } - // Read the array resource - for(index=0; indexCount() ) - { - iDataGroupExtArray->At(groupindex) = subarray; - } - - // Read the subarray resource - for(subindex=0; subindexCount() ) - { - iDataGroupExtArray->At(groupindex)->InsertL(subindex,exttype); - } - } - CleanupStack::Pop( subarray ); - } - - CleanupStack::PopAndDestroy( &theReader ); - - //instantiate scanner - iScanner = new (ELeave) CMsengScanner(iUIHandler, *iResFile); - } - - -// --------------------------------------------------------------------------- -// CMseng::~CMseng() -// -// Destructor. -// --------------------------------------------------------------------------- - -EXPORT_C CMseng::~CMseng() - { -#ifdef __SHOW_RDEBUG_PRINT_ - RDebug::Print(_L("** CMseng::~CMseng(). Finished. **")); -#endif // __SHOW_RDEBUG_PRINT_ - - delete iScanner; - - // Pointer arrays: elements must be deleted before deleting array - if(iDataGroupUidArray) - { - iDataGroupUidArray->ResetAndDestroy(); - } - delete iDataGroupUidArray; - - - if(iDataGroupExtArray) - { - iDataGroupExtArray->ResetAndDestroy(); - } - delete iDataGroupExtArray; - - - delete iResFile; - - iFsSession.Close(); - } - - - -// --------------------------------------------------------------------------- -// CMseng::DataGroupsL() -// -// Get a descriptor array containing the names of the data groups. -// --------------------------------------------------------------------------- - -EXPORT_C CDesCArray* CMseng::DataGroupsL() const - { -#ifdef __SHOW_RDEBUG_PRINT_ - RDebug::Print(_L("CMseng::GetDataGroupsL() called.")); -#endif // __SHOW_RDEBUG_PRINT_ - - - // Create the array for the data group names with appropriate granularity - CDesCArray* dataGroupNameArray = new (ELeave) CDesCArrayFlat(iNumberOfDataGroups); - CleanupStack::PushL(dataGroupNameArray); - - // Read the resource containing data group names - // and put them to resultArray - - RResourceReader theReader; - theReader.OpenLC( iResFile, DATAGROUPNAMEARRAY ); - - - // The first WORD contains the number of elements in the resource - // (actually this is already in iNumberOfDataGroups) - - TInt length = theReader.ReadInt16L(); - __ASSERT_DEBUG(iNumberOfDataGroups == length, User::Panic(_L("CMseng::DataGroupsL"), KErrGeneral)); - - // Read the data group names from resource file and insert to array - TInt groupindex; // value from enum TDataGroups - for(TInt index=0; indexInsertL(groupindex, name); - } - CleanupStack::PopAndDestroy( &theReader ); - - // Return the array of data groups - CleanupStack::Pop( dataGroupNameArray ); - -#ifdef __SHOW_RDEBUG_PRINT_ -// print the data group array - RDebug::Print(_L("Printing the Data Groups:")); - for(TInt k = 0; k < dataGroupNameArray->Count(); k++) - { - HBufC* groupName = dataGroupNameArray->MdcaPoint(k).AllocL(); - RDebug::Print( _L(" %d: %S"), k, groupName); - delete groupName; - } -#endif // __SHOW_RDEBUG_PRINT_ - - return dataGroupNameArray; - - } - -// --------------------------------------------------------------------------- -// CMseng::ScanResultL() -// -// Returns an array of scan results -// --------------------------------------------------------------------------- - -EXPORT_C CArrayFix* CMseng::ScanResultL() const - { -#ifdef __SHOW_RDEBUG_PRINT_ - RDebug::Print(_L("CMseng::ScanResultL() called. Starting to calculate result...")); -#endif // __SHOW_RDEBUG_PRINT_ - - // Create the result array (with such granularity that reallocations do not happen) - CArrayFix* resultArray = new (ELeave) CArrayFixFlat(iNumberOfDataGroups); - CleanupStack::PushL(resultArray); - - // Get result arrays from scanner - const CArrayFix* extResultArray = iScanner->ExtResults(); - const CArrayFix* uidResultArray = iScanner->UidResults(); - const CArrayFix* groupResultArray = iScanner->GroupResults(); - - // Initialize the result array from the array of initial result - for (TInt i = 0; i < iNumberOfDataGroups; i++) - { - if( i < groupResultArray->Count() ) - { - resultArray->AppendL(groupResultArray->At(i)); - } - } - - //Calculate the results and put them to the array - - // Find results for each data group - for(TInt groupindex = 0; groupindex < iNumberOfDataGroups; groupindex++) - { - // For one data group, the UIDs belonging to this group are listed in - // iDataGroupExtArray. For each of these UIDs, add the result to the total result. - - // If the examined data group does not have associated UIDs, - // iDataGroupUidArray->At(groupindex) is a NULL pointer. - if(iDataGroupUidArray->At(groupindex)) - { - TInt count = iDataGroupUidArray->At(groupindex)->Count(); - for(TInt uidindex = 0; uidindex < count; uidindex++) - { - resultArray->At(groupindex) += - uidResultArray->At( iDataGroupUidArray->At(groupindex)->At(uidindex) ); - } - } - - // The extension results are collected in a similar manner - - // If the examined data group does not have associated UIDs, - // iDataGroupUidArray->At(groupindex) is a NULL pointer - if(iDataGroupExtArray->At(groupindex)) - { - TInt count = iDataGroupExtArray->At(groupindex)->Count(); - for(TInt extindex = 0; extindex < count; extindex++) - { - resultArray->At(groupindex) += - extResultArray->At( iDataGroupExtArray->At(groupindex)->At(extindex) ); - } - } - } - // Calculate "Free memory" and "All device data" - TInt64 totalMemory; - TInt64 freeMemory; - DiskInfoL(totalMemory, freeMemory, iScanner->CurrentDrive()); -#ifdef __SHOW_RDEBUG_PRINT_ - RDebug::Print(_L("CMseng::ScanresultL(): iFreeMemory %d, freeMemory %d"), (TUint32)iFreeMemory, (TUint32)freeMemory); -#endif - // For some reason there is sometimes 16 kB difference in free memory when scanning started - // vs. scanning ended (16 kB more at the end of scanning) and latter one is incorrect. - // That is why free memory detected in the beginning of scanning taken into account. - if(iFreeMemory) - { - freeMemory = iFreeMemory; - } - else - { - iFreeMemory = freeMemory; - } - - // "Free memory" is the memory currently available - resultArray->At(EGroupFreeMemory) = freeMemory; - // "All Device Data" is all memory used - resultArray->At(EGroupAllDeviceData) = (totalMemory - freeMemory); - - // Calculate how much files not falling to any predefined category consume - TInt64 others( 0 ); - for( TInt i = EGroupCalendar; i < iNumberOfDataGroups; i++ ) - { - others += resultArray->At( i ); - } - - // This should never happen, but just in case check that negative count is not established. - if( resultArray->At(EGroupAllDeviceData) - others < 0 ) - { - resultArray->At( EGroupOthers ) = 0; - } - else - { - resultArray->At( EGroupOthers ) = resultArray->At(EGroupAllDeviceData) - others; - } - -// write the result array to log file -#ifdef __SHOW_RDEBUG_PRINT_ - RDebug::Print(_L("CMseng::ScanresultL(): current result array -")); - // note that the log macros cannot handle TInt64 - for(TInt k = 0; k < resultArray->Count(); k++) - { - const TInt KMaxChars = 32; - TBuf num; - num.Num(resultArray->At(k)); - RDebug::Print(num); - } -#endif // __SHOW_RDEBUG_PRINT_ - - CleanupStack::Pop( resultArray ); - return resultArray; - } - -// --------------------------------------------------------------------------- -// CMseng::ScanInProgress() -// -// Return ETrue if there is scanning going on, otherwise EFalse. -// --------------------------------------------------------------------------- -// -EXPORT_C TBool CMseng::ScanInProgress() const - { - if(iScanner) - { - return iScanner->HaveActiveScanners(); - } - else - { - return EFalse; - } - } - -// --------------------------------------------------------------------------- -// CMseng::DiskInfoL -// -// Retrieves information about disk usage. -// --------------------------------------------------------------------------- -// -EXPORT_C void CMseng::DiskInfoL(TInt64& aTotal, TInt64& aFree, const TDriveNumber aVolume) const - { - - TVolumeInfo vinfo; - User::LeaveIfError(iFsSession.Volume(vinfo, aVolume)); - aTotal = TInt64(vinfo.iSize); - aFree = TInt64(vinfo.iFree); - - } - -// --------------------------------------------------------------------------- -// CMseng::MemInfoL -// -// Retrieves information about RAM usage. -// --------------------------------------------------------------------------- -// -EXPORT_C void CMseng::MemInfoL(TInt64& aTotal, TInt64& aFree) - { - TMemoryInfoV1Buf membuf; - User::LeaveIfError(UserHal::MemoryInfo(membuf)); - TMemoryInfoV1 minfo = membuf(); - aTotal = minfo.iTotalRamInBytes; - aFree = minfo.iFreeRamInBytes; - } - -// --------------------------------------------------------------------------- -// CMseng::ScanL() -// -// First scan the specific data files. -// Then scan directories that are scanned for the -// size of all files. Then call scanner's ScanL. -// --------------------------------------------------------------------------- -// -EXPORT_C void CMseng::ScanL(TDriveNumber aDrive) - { - __ASSERT_ALWAYS( (CMseng::IsInternalDrive(iFsSession, aDrive) - || CMseng::IsRemovableDrive(iFsSession, aDrive)), User::Leave(KErrNotSupported) ); - - // Scanning started. - iUIHandler.StartL(); - - // Start scanning memory, check that not already doing it - TInt err = iScanner->ScanL(aDrive, iNumberOfDataGroups, iFsSession); - if(err != KErrNone) // can be only KErrNone or KErrInUse - { - iUIHandler.ErrorL(KErrInUse); - } - } - -// --------------------------------------------------------------------------- -// CMseng::Cancel() -// -// --------------------------------------------------------------------------- -// -EXPORT_C void CMseng::Cancel() - { -#ifdef __SHOW_RDEBUG_PRINT_ - RDebug::Print(_L("CMseng::Cancel() called. canceling scanning...")); -#endif // __SHOW_RDEBUG_PRINT_ - - iScanner->Cancel(); - } - -// ----------------------------------------------------------------------------- -// CMseng::IsInternalDrive -// ----------------------------------------------------------------------------- -// -TBool CMseng::IsInternalDrive( RFs& aFs, TInt aDrv ) - { - TDriveInfo drvInfo; - if ( aFs.Drive( drvInfo, aDrv ) == KErrNone ) - { - if ( !( drvInfo.iDriveAtt & KDriveAttInternal ) && - drvInfo.iDriveAtt & ( KDriveAttRemovable | KDriveAttRemote ) ) - { - return EFalse; - } - } - else - { - return EFalse; - } - return ETrue; - } - -// ----------------------------------------------------------------------------- -// CMseng::IsRemovableDrive -// ----------------------------------------------------------------------------- -// -TBool CMseng::IsRemovableDrive( RFs& aFs, TInt aDrv ) - { - TDriveInfo drvInfo; - if ( aFs.Drive( drvInfo, aDrv ) == KErrNone ) - { - if ( !( drvInfo.iDriveAtt & KDriveAttRemovable ) ) - { - return EFalse; - } - } - else - { - return EFalse; - } - return ETrue; - } - -// ----------------------------------------------------------------------------- -// CMseng::IsMassStorageDrive -// ----------------------------------------------------------------------------- -// -TBool CMseng::IsMassStorageDrive( RFs& aFs, TInt aDrv ) - { - - TUint drvStatus( 0 ); - TInt err( DriveInfo::GetDriveStatus( aFs, aDrv, drvStatus ) ); - if ( err != KErrNone ) - { - return EFalse; - } - - if ( ( drvStatus & DriveInfo::EDriveInternal ) && - ( drvStatus & DriveInfo::EDriveExternallyMountable ) ) - { - return ETrue; - } - return EFalse; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serversrc/msengdirectoryscanner.cpp --- a/filesystemuis/memscaneng/serversrc/msengdirectoryscanner.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,230 +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: -* Scan directories -* -*/ - - -// SYSTEM INCLUDES -#include - -// USER INCLUDES -#include "msengdirectoryscanner.h" - - -// CONSTANTS -_LIT(KMsengPathDelimiter, "\\"); - - -// ================= MEMBER FUNCTIONS ======================================== - -// --------------------------------------------------------------------------- -// CMsengDirectoryScanner::CMsengDirectoryScanner() -// -// Default C++ constructor -// --------------------------------------------------------------------------- -CMsengDirectoryScanner::CMsengDirectoryScanner( - MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, - RFs& aFsSession ) -: CMsengScannerBase(aObserver, aScanArray, aFsSession) - { - } - - -// --------------------------------------------------------------------------- -// CMsengDirectoryScanner::~CMsengDirectoryScanner() -// -// Destructor -// --------------------------------------------------------------------------- -CMsengDirectoryScanner::~CMsengDirectoryScanner() - { - delete iDirectoryList; - delete iScanner; - } - - - - - - - -// --------------------------------------------------------------------------- -// CMsengDirectoryScanner::ScanL() -// -// -// --------------------------------------------------------------------------- -void CMsengDirectoryScanner::ScanL(const CDesCArray& aRootDirs) - { - if (iDirectoryList) - { - iDirectoryList->Reset(); - } - else - { - iDirectoryList = new(ELeave) CDesCArraySeg(KDirectoryListGranularity); - } - if (!iScanner) - { - iScanner = CDirScan::NewL(FsSession()); - } - // Copy existing directories over - const TInt count = iNumberOfRootDirectories = aRootDirs.Count(); - for(TInt i=0; iAppendL(aRootDirs[i]); -#ifdef __SHOW_RDEBUG_PRINT_ - TPtrC dir = aRootDirs[i]; - RDebug::Print(_L("Root directory: %S"), &dir); -#endif // __SHOW_RDEBUG_PRINT_ - } - else - { - iNumberOfRootDirectories--; - } - } - - // Start the scan going - CompleteRequest(); - } - - -// --------------------------------------------------------------------------- -// CMsengDirectoryScanner::PerformStepL() -// -// -// --------------------------------------------------------------------------- -CMsengScannerBase::TStepResult CMsengDirectoryScanner::PerformStepL() - { - TStepResult result = ECompleteRequest; - RFs& fsSession = FsSession(); - - // Expand the root directories to a full list of - // subdirectories - if (iState == EExpandingRootDirs) - { - if (iCurrentIndex >= iNumberOfRootDirectories) - { - // Finished scanning for the subdirectories. - // Reset the current index so that we pass all the directories - // (including the root paths) to the subclasses. - iCurrentIndex = 0; - iState = EScanningSubDirs; - } - else - { - const TPtrC pFolder(iDirectoryList->MdcaPoint(iCurrentIndex++)); - - // Do the recursive scanning: First set scan data. - iScanner->SetScanDataL( - pFolder, - KEntryAttDir|KEntryAttMatchExclusive, - ESortNone, - CDirScan::EScanDownTree - ); - - // Add all the located subdirectories to the array - iState = EParsingExpandedList; - } - } - else if (iState == EParsingExpandedList) - { - CDir* list = NULL; - iScanner->NextL(list); - - if (list) - { - CleanupStack::PushL(list); - - const TPtrC pFullPath(iScanner->FullPath()); - TFileName file; - - const TInt count = list->Count(); - for(TInt i=0; iCount()) - { - const TPtrC pFolder(iDirectoryList->MdcaPoint(iCurrentIndex)); - const TScanDirectoryResult scanDirectoryResult = - ScanDirectoryL(pFolder, fsSession); - - // Check whether we continue with this directory next time - if (scanDirectoryResult == EContinueToNextDirectory) - { - iCurrentIndex++; - } - } - else - { - // All directories scanned now - result = EScanComplete; - } - } - - // Return the response back to the base scanner - return result; - } - - -// --------------------------------------------------------------------------- -// CMsengDirectoryScanner::AppendDirectoryL() -// -// -// --------------------------------------------------------------------------- -void CMsengDirectoryScanner::AppendDirectoryL(const TDesC& aDirectory) - { - // Append the directory to the directory list, - // unless it is listed as excluded directory - if( IsSpecialDir(aDirectory) || !IsExcludedDir(aDirectory) ) - { - iDirectoryList->AppendL(aDirectory); - } - else - { -#ifdef __SHOW_RDEBUG_PRINT_ - RDebug::Print(_L("Dir is excluded! %S"), &aDirectory); -#endif // __SHOW_RDEBUG_PRINT_ - } - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serversrc/msengfileextscanner.cpp --- a/filesystemuis/memscaneng/serversrc/msengfileextscanner.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,208 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Scanner class used to scan file system by filename extensions. -* -*/ - - -// USER INCLUDES -#include "msengfileextscanner.h" -#include "msenguihandler.h" - - -// ================= MEMBER FUNCTIONS ======================================== - -// --------------------------------------------------------------------------- -// CMsengFileExtScanner::CMsengFileExtScanner() -// -// C++ default constructor. Can NOT contain any code, that might leave. -// --------------------------------------------------------------------------- -CMsengFileExtScanner::CMsengFileExtScanner(MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, - RFs& aFsSession) -: CMsengFileScanner(aObserver, aScanArray, aFsSession), iMoveToNextDirectory(ETrue) - { - } - -// --------------------------------------------------------------------------- -// CMsengFileExtScanner::NewL() -// -// Two-phased constructor -// --------------------------------------------------------------------------- -CMsengFileExtScanner* CMsengFileExtScanner::NewL(MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, - RFs& aFsSession) - { - CMsengFileExtScanner* self = - new (ELeave) CMsengFileExtScanner(aObserver, aScanArray, aFsSession); - return self; - } - -// --------------------------------------------------------------------------- -// CMsengFileExtScanner::~CMsengFileExtScanner() -// -// Destructor -// --------------------------------------------------------------------------- -CMsengFileExtScanner::~CMsengFileExtScanner() - { - } - - - - -// --------------------------------------------------------------------------- -// CMsengFileExtScanner::FindFilesL() -// -// --------------------------------------------------------------------------- -// -CDir* CMsengFileExtScanner::FindFilesL(const TDesC& aDirectory, TBool& aMoveToNextDirectory) - { - - // iMoveToNextDirectory is true only when starting to handle the - // current directory. Reset iCurrentExtensionIndex. - if(iMoveToNextDirectory) - { - iCurrentExtensionIndex = -1; - iMoveToNextDirectory = EFalse; -#ifdef __SHOW_RDEBUG_PRINT_ - RDebug::Print(_L("Entering directory:")); - RDebug::Print(_L("%S"), &aDirectory); -#endif // __SHOW_RDEBUG_PRINT_ - } - - // This function performs a search for each file in the directory by extension. - iCurrentExtensionIndex++; - const TPtrC pCurrentExtension(InfoArray().Exts()[iCurrentExtensionIndex]); - -#ifdef __SHOW_RDEBUG_PRINT_ - RDebug::Print(_L("Searching files with extension %d"), iCurrentExtensionIndex); -#endif // __SHOW_RDEBUG_PRINT_ - - // Get a list of results for this directory - CDir* results = NULL; - TParse parse; - TInt error; - - const TInt pathlength = pCurrentExtension.Length() + aDirectory.Length(); - if ( pathlength > KMaxFileName ) - { - error = KErrNotFound; -#ifdef __SHOW_RDEBUG_PRINT_ - RDebug::Print(_L("Path too long, files with extension %d do not fit to directory"), - iCurrentExtensionIndex); -#endif // __SHOW_RDEBUG_PRINT_ - } - - else - { - FsSession().Parse(pCurrentExtension, aDirectory, parse); - error = FsSession().GetDir(parse.FullName(), KEntryAttMaskSupported|KEntryAttAllowUid, - ESortNone, results); - } - - if (error == KErrNotFound) - { - results = NULL; - } - - // Should we move onto searching the next directory - // Yes, if this was the last extension. - const TInt extensionCount = InfoArray().Exts().Count(); - iMoveToNextDirectory = (iCurrentExtensionIndex >= extensionCount-1); - aMoveToNextDirectory = iMoveToNextDirectory; - - // Return populated (or potentially NULL) list. - return results; - } - -// --------------------------------------------------------------------------- -// CMsengFileExtScanner::HandleLocatedEntryL() -// -// -// --------------------------------------------------------------------------- -// -CMsengFileScanner::TLocationResponse CMsengFileExtScanner::HandleLocatedEntryL( - const TDesC& aFullFileNameAndPath, const TEntry& aEntry) - { - TLocationResponse response = EEntryWasDiscarded; - const TInt KUidLocation = 2; - TUid fileUid = aEntry[KUidLocation]; - - if ( fileUid == KNullUid ) - { - // Check whether extension found in special data dir - TBool addSize( ETrue ); - TInt dataDirCount = InfoArray().DataDirs().Count(); - for(TInt i=0; i < dataDirCount; i++) - { - TPtrC dataDirPath = InfoArray().DataDirs().MdcaPoint(i); - - if(aFullFileNameAndPath.Length() >= dataDirPath.Length()) - { - TFileName currentPath; - currentPath.Copy(aFullFileNameAndPath.Left(dataDirPath.Length())); - - // Compare whether folder matches - if(!currentPath.CompareF(dataDirPath)) - { - addSize = EFalse; - break; - } - } - } - - if( addSize ) - { - // Add size of object - InfoArray().AddSizeByExtL(iCurrentExtensionIndex, aEntry.FileSize() ); - -#ifdef __SHOW_RDEBUG_PRINT_ - const TInt pathlength = aFullFileNameAndPath.Length(); - - if ( pathlength < KMaxFileName ) - { - RDebug::Print(_L("File: %S, extension number: %d, size: %d"), - &aFullFileNameAndPath, iCurrentExtensionIndex, aEntry.FileSize()); - } - else - { - RDebug::Print(_L("File: see next line, extension number: %d, size: %d"), - iCurrentExtensionIndex, aEntry.FileSize() ); - RDebug::Print(_L("Can not print %d characters long file name"), pathlength ); - } -#endif // __SHOW_RDEBUG_PRINT_ - - // We processed this one - response = EEntryWasProcessed; - } - } - else - { -#ifdef __SHOW_RDEBUG_PRINT_ - RDebug::Print(_L("Handling file: %S, file Uid: 0x%x"), - &aFullFileNameAndPath, fileUid.iUid); -#endif // __SHOW_RDEBUG_PRINT_ - - // Make sure other than native applications are not calculated - if( iCurrentExtensionIndex == EExtSis || iCurrentExtensionIndex == EExtSisx ) - { - InfoArray().AddSizeByExtL(iCurrentExtensionIndex, aEntry.FileSize() ); - } - } - - return response; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serversrc/msengfilescanner.cpp --- a/filesystemuis/memscaneng/serversrc/msengfilescanner.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +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: -* Scanner class used to scan file system by file UID. -* -*/ - - -// USER INCLUDES -#include "msengfilescanner.h" - - - -// ================= MEMBER FUNCTIONS ======================================== - -// --------------------------------------------------------------------------- -// CMsengFileScanner::CMsengFileScanner() -// -// Constructor -// --------------------------------------------------------------------------- -CMsengFileScanner::CMsengFileScanner(MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, - RFs& aFsSession) -: CMsengDirectoryScanner(aObserver, aScanArray, aFsSession) - { - } - -// --------------------------------------------------------------------------- -// CMsengFileScanner::~CMsengFileScanner() -// -// Destructor -// --------------------------------------------------------------------------- - -CMsengFileScanner::~CMsengFileScanner() - { - } - -// --------------------------------------------------------------------------- -// CMsengFileScanner::ScanDirectoryL() -// -// -// --------------------------------------------------------------------------- -CMsengDirectoryScanner::TScanDirectoryResult CMsengFileScanner::ScanDirectoryL - (const TDesC& aDirectory, RFs& /*aFsSession*/) - { - TBool moveToNextDirectory = ETrue; - CDir* results = FindFilesL(aDirectory, moveToNextDirectory); - if (results) - { - CleanupStack::PushL(results); - - // Go through all files in the list and tell subclass - TFileName file; - const TInt count = results->Count(); - for(TInt i=0; i - -// USER INCLUDES -#include "msengfindallscanner.h" -#include "msenguihandler.h" -#include "memscanutils.h" - - -// ================= MEMBER FUNCTIONS ======================================== - -// --------------------------------------------------------------------------- -// CMsengFindAllScanner::CMsengFindAllScanner() -// -// C++ default constructor. Can NOT contain any code, that might leave. -// --------------------------------------------------------------------------- -CMsengFindAllScanner::CMsengFindAllScanner(MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, - RFs& aFsSession) -: CMsengFileScanner(aObserver, aScanArray, aFsSession) - { - } - - -// --------------------------------------------------------------------------- -// CMsengFindAllScanner::NewL() -// -// Two-phased constructor -// --------------------------------------------------------------------------- -CMsengFindAllScanner* CMsengFindAllScanner::NewL( - MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, - RFs& aFsSession) - { - CMsengFindAllScanner* self = new (ELeave) CMsengFindAllScanner(aObserver, - aScanArray, aFsSession); - return self; - } - -// --------------------------------------------------------------------------- -// CMsengFindAllScanner::~CMsengFindAllScanner() -// -// Destructor -// --------------------------------------------------------------------------- -CMsengFindAllScanner::~CMsengFindAllScanner() - { - } - -// --------------------------------------------------------------------------- -// CMsengFindAllScanner::FindFilesL() -// -// -// --------------------------------------------------------------------------- -CDir* CMsengFindAllScanner::FindFilesL(const TDesC& aDirectory, TBool& aMoveToNextDirectory) - { - TRACES( RDebug::Print(_L("CMsengFindAllScanner::FindFilesL(%S)"), &aDirectory) ); - - // Get a list of results for this directory - CDir* results; - const TInt error = FsSession().GetDir(aDirectory, - KEntryAttMaskSupported|KEntryAttAllowUid, ESortNone, results); - if (error == KErrNotFound) - { - results = NULL; - } - - // Always move onto searching the next directory - aMoveToNextDirectory = ETrue; - - // Return populated (or potentially NULL) list. - return results; - } - -// --------------------------------------------------------------------------- -// CMsengFindAllScanner::HandleLocatedEntryL() -// -// -// --------------------------------------------------------------------------- -CMsengFileScanner::TLocationResponse CMsengFindAllScanner::HandleLocatedEntryL( - const TDesC& aFullFileNameAndPath, const TEntry& aEntry) - { - // Figure out the data group by comparing the start of the path - - TInt dataDirCount = InfoArray().DataDirs().Count(); - for(TInt i=0; i < dataDirCount; i++) - { - TPtrC dataDirPath = InfoArray().DataDirs().MdcaPoint(i); - if(aFullFileNameAndPath.Length() >= dataDirPath.Length()) - { - TFileName currentPath; - currentPath.Copy(aFullFileNameAndPath.Left(dataDirPath.Length())); - - // Compare whether folder matches - if(!currentPath.Compare(dataDirPath)) - { - TBool isExcluded = EFalse; - TInt fileLength = aFullFileNameAndPath.Length() - dataDirPath.Length(); - TInt excludedFiles = 0; - if(InfoArray().DataDirExcludedFiles().Count()) - { - excludedFiles = InfoArray().DataDirExcludedFiles().At(i)->MdcaCount(); - } - - currentPath.Copy(aFullFileNameAndPath.Right(fileLength)); - - TRACES( RDebug::Print(_L("Check file %S"), ¤tPath) ); - - for(TInt j=0; j < excludedFiles; j++) - { - TRACES - ( - TPtrC file = InfoArray().DataDirExcludedFiles().At(i)->MdcaPoint(j); - RDebug::Print(_L("Comparing to excluded file %S"), &file); - ); - - if(!currentPath.Compare( - InfoArray().DataDirExcludedFiles().At(i)->MdcaPoint(j))) - { - isExcluded = ETrue; - break; - } - } - - if(!isExcluded) - { - // Add size of object when file is not in list of excluded files - if(InfoArray().DataDirGroups().Count()) - { - TInt group = InfoArray().DataDirGroups().At(i); - InfoArray().AddSizeByGroupL(group, aEntry.FileSize()); - - TRACES - ( - RDebug::Print(_L("File %S belongs to group: %d"), - &aFullFileNameAndPath, group) - ); - } - } - } - } - } - - // We processed this one - return EEntryWasProcessed; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serversrc/msenginfoarray.cpp --- a/filesystemuis/memscaneng/serversrc/msenginfoarray.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,390 +0,0 @@ -/* -* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* An utility class to handle the UIDs and filename extensions used to -* identify data types. It is also used to store the results per data type. -* -*/ - - - -// SYSTEM INCLUDES -#include -#include -#include // RResourceFile - -// USER INCLUDES -#include "msenginfoarray.h" -#include "mseng.h" // KMsengRscFilePath - - - -// ================= MEMBER FUNCTIONS ======================= - - -// --------------------------------------------------------------------------- -// CMsengInfoArray::CMsengInfoArray() -// -// C++ default constructor is prohibited -// --------------------------------------------------------------------------- -CMsengInfoArray::CMsengInfoArray(TDriveNumber aDrive) -: iCurrentScannedDrive(aDrive) - { - } - -// --------------------------------------------------------------------------- -// CMsengInfoArray::NewL() -// -// Two-phased constructor. -// --------------------------------------------------------------------------- -CMsengInfoArray* CMsengInfoArray::NewL(TDriveNumber aDrive, - TInt aNumberOfDataGroups, - RFs& aFsSession, - CResourceFile& aResFile) - { - CMsengInfoArray* self = new (ELeave) CMsengInfoArray(aDrive); - - CleanupStack::PushL( self ); - self->ConstructL(aNumberOfDataGroups, aFsSession, aResFile); - CleanupStack::Pop( self ); - - return self; - } - - -// --------------------------------------------------------------------------- -// CMsengInfoArray::ConstructL() -// -// Symbian OS default constructor can leave. -// --------------------------------------------------------------------------- -void CMsengInfoArray::ConstructL(TInt aNumberOfDataGroups, - RFs& aFsSession, - CResourceFile& aResFile) - { - // Create data structures and initialize them - // using values from enumerations TUidTypes and TExtTypes - // and data from the resource file mseng.rss - - TInt index = -1; // index used in for-loops - TInt length = -1; // length of resource array being read - - RResourceReader theReader; - - theReader.OpenLC( &aResFile, UIDARRAY ); - - //the first WORD contains the number of elements in the resource - length = theReader.ReadInt16L(); - - // Create the array with appropriate granularity - iUidResultArray = new (ELeave) CArrayFixFlat(length); - - // Initialize the array to contain zeros - for(index=0; indexInsertL(index, 0); - } - - // Next, create the array for the actual UIDs - // and read them from the resource file - iUidArray = new (ELeave) CArrayFixFlat(length); - for(index=0; indexInsertL(typeindex, uid); - } - CleanupStack::PopAndDestroy(&theReader); - - // Read extarray in a similar way - theReader.OpenLC( &aResFile, EXTARRAY ); - - - //the first WORD contains the number of elements in the resource - length = theReader.ReadInt16L(); - - // Create the array with appropriate granularity - iExtResultArray = new (ELeave) CArrayFixFlat(length); - // Initialize the array to contain zeros - for(index=0; indexInsertL(index, 0); - } - // Next, create the array for the actual extensions - // and read them from the resource file - iExtArray = new (ELeave) CDesCArrayFlat(length); - for(index=0; indexInsertL(typeindex, ext); - } - CleanupStack::PopAndDestroy( &theReader ); - - // Create the array for results per group - iGroupResultArray = new (ELeave) CArrayFixFlat(aNumberOfDataGroups); - // Initialize the array to contain zeros - for(index=0; indexInsertL(index, 0); - } - - // The directories to be scanned. Depends of which drive is scanned, - // and the directories that are scanned as a whole (and excluded in the normal scan) - _LIT(KPanic,"MSENG"); - __ASSERT_ALWAYS((CMseng::IsInternalDrive(aFsSession, iCurrentScannedDrive) - || CMseng::IsRemovableDrive(aFsSession, iCurrentScannedDrive)), - User::Panic(KPanic, KErrNotSupported)); - - if( CMseng::IsInternalDrive(aFsSession, iCurrentScannedDrive) - && !CMseng::IsMassStorageDrive( aFsSession, iCurrentScannedDrive ) ) - { - theReader.OpenLC( &aResFile, C_DIRECTORIES ); - iDirArray = theReader.ReadDesCArrayL(); - CleanupStack::PopAndDestroy( &theReader ); - // - theReader.OpenLC( &aResFile, C_EXCLUDED_DIRECTORIES ); - iExcludedDirArray = theReader.ReadDesCArrayL(); - CleanupStack::PopAndDestroy( &theReader ); - // - theReader.OpenLC( &aResFile, C_SPECIAL_DATADIRS ); - // reading later... - - } - else // other drives except Phone Memory should be scanned from root folder. - { - theReader.OpenLC( &aResFile, E_DIRECTORIES ); - iDirArray = theReader.ReadDesCArrayL(); - CleanupStack::PopAndDestroy( &theReader ); - // - theReader.OpenLC( &aResFile, E_EXCLUDED_DIRECTORIES ); - iExcludedDirArray = theReader.ReadDesCArrayL(); - CleanupStack::PopAndDestroy( &theReader ); - // - theReader.OpenLC( &aResFile, E_SPECIAL_DATADIRS ); - // reading later... - - } - - // Apply correct drive letter in directory array names - TInt dirCount = iDirArray->Count(); - for (TInt i=0; iMdcaPoint(i).AllocLC(); - TPtr ptrName = dirName->Des(); - TBuf<1> drive; - TChar ch; - - if ( RFs::DriveToChar( iCurrentScannedDrive, ch ) == KErrNone ) - { - drive.Append(ch); - ptrName.Replace(0, drive.Length(), drive); - } - iDirArray->Delete(i); - iDirArray->InsertL(i, ptrName); - CleanupStack::PopAndDestroy(dirName); - } - - // Apply correct drive letter in excluded directory array names - TInt exDirCount = iExcludedDirArray->Count(); - for (TInt i=0; iMdcaPoint(i).AllocLC(); - TPtr ptrName = dirName->Des(); - TBuf<1> drive; - TChar ch; - - if ( RFs::DriveToChar( iCurrentScannedDrive, ch ) == KErrNone ) - { - drive.Append(ch); - ptrName.Replace(0, drive.Length(), drive); - } - iExcludedDirArray->Delete(i); - iExcludedDirArray->InsertL(i, ptrName); - CleanupStack::PopAndDestroy(dirName); - } - - //the first WORD contains the number of elements in the resource - length = theReader.ReadInt16L(); - - // Create the arrays for special data dirs - iDataDirArray = new (ELeave) CDesCArrayFlat(length); - iDataDirGroupArray = new (ELeave) CArrayFixFlat(length); - iDataDirExclArray = new (ELeave) CArrayPtrFlat(length); - - // Read the array resource - for(TInt i=0; iDes(); - TBuf<1> drive; - TBool driveValid = EFalse; - - if ( RFs::DriveToChar( iCurrentScannedDrive, ch ) == KErrNone ) - { - driveValid = ETrue; - drive.Append(ch); - ptrName.Replace(0, drive.Length(), drive); - } - - // Next WORD contains the number of excluded files - TInt lengthExcl = theReader.ReadInt16L(); - TBool folderExists = EFalse; - - // Add directory to the list to be scanned - if(driveValid && BaflUtils::FolderExists(aFsSession, ptrName)) - { - folderExists = ETrue; - iDataDirArray->AppendL(ptrName); - iDataDirGroupArray->AppendL(groupindex); - iDataDirExclArray->AppendL(NULL); - - CDesCArray* subarray = new (ELeave) CDesCArrayFlat( Max(lengthExcl, 1) ); - const TInt dirCount = iDataDirExclArray->Count(); - iDataDirExclArray->At(dirCount-1) = subarray; - } - - for(TInt j=0; jCount(); - iDataDirExclArray->At(dirCount-1)->AppendL( nameExcl ); - } - } - - // If there was an error, we can assume it was because - // the folder does not exist, and ignore the error. - CleanupStack::PopAndDestroy( name ); - } - CleanupStack::PopAndDestroy( &theReader ); - -#ifdef __SHOW_RDEBUG_PRINT_ - RDebug::Print(_L("CMsengInfoArray constructed. Printing current configuration.\n Extensions:")); - for(TInt j=0; j < Exts().Count(); j++) - { - HBufC* ext = Exts().MdcaPoint(j).AllocL(); - RDebug::Print(_L(" %d: %S"), j, ext); - delete ext; - } - RDebug::Print(_L(" UIDs:")); - for(TInt k=0; k < Uids().Count(); k++) - { - TUidName uid; - uid = Uids().At(k).Name(); - RDebug::Print(_L(" %d: %S"), k, &uid); - } -#endif // __SHOW_RDEBUG_PRINT_ - } - -// --------------------------------------------------------------------------- -// CMsengInfoArray::~CMsengInfoArray() -// -// Destructor -// --------------------------------------------------------------------------- -CMsengInfoArray::~CMsengInfoArray() - { - // delete data structures - delete iUidResultArray; - delete iExtResultArray; - delete iGroupResultArray; - delete iUidArray; - delete iExtArray; - delete iDirArray; - delete iExcludedDirArray; - delete iDataDirArray; - delete iDataDirGroupArray; - if(iDataDirExclArray) - { - iDataDirExclArray->ResetAndDestroy(); - } - delete iDataDirExclArray; - } - -// --------------------------------------------------------------------------- -// CMsengInfoArray::IsExcludedDir() -// -// -// --------------------------------------------------------------------------- -TBool CMsengInfoArray::IsExcludedDir(const TDesC& aDirectory) const - { - TInt count = iExcludedDirArray->Count(); - for(TInt i=0; iMdcaPoint(i)) == 0) - { - return ETrue; - } - } - - return EFalse; - } - -// --------------------------------------------------------------------------- -// CMsengInfoArray::FolderExists() -// -// -// --------------------------------------------------------------------------- -TBool CMsengInfoArray::FolderExists(RFs& aFs, const TDesC& aPath) - { - TBool result = EFalse; - - if(BaflUtils::FolderExists(aFs, aPath)) - { - result = ETrue; - } - // BaflUtils::FolderExists return KErrBadName, if called with - // only drive letter (like "c:\") - else - { - TChar driveLetter; - if( RFs::DriveToChar(CurrentDrive(), driveLetter) == KErrNone) - { - TBuf<1> driveName; - driveName.Append(driveLetter); - TInt cmp = aPath.CompareF(BaflUtils::RootFolderPath(driveName)); - result = (cmp == 0); - } - } - - return result; - } - -// --------------------------------------------------------------------------- -// CMsengInfoArray::IsSpecialDir() -// -// -// --------------------------------------------------------------------------- -TBool CMsengInfoArray::IsSpecialDir(const TDesC& aDirectory) const - { - TInt count = iDataDirArray->Count(); - for(TInt i=0; iMdcaPoint(i)) == 0) - { - return ETrue; - } - } - - return EFalse; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serversrc/msengregistryscanner.cpp --- a/filesystemuis/memscaneng/serversrc/msengregistryscanner.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +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: Memory scan engine registry scanning -* -*/ - - -// SYSTEM INCLUDES -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -// USER INCLUDES -#include "msengregistryscanner.h" -#include "msengsisxinfo.h" -#include "memscanutils.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// --------------------------------------------------------------------------- -// CMsengRegistryScanner::CMsengRegistryScanner() -// -// Default C++ constructor -// --------------------------------------------------------------------------- -CMsengRegistryScanner::CMsengRegistryScanner( - TDriveNumber aDrive, - MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, - RFs& aFsSession) - : CMsengScannerBase(aObserver, aScanArray, aFsSession), - iType( ERegistrySisx ), - iDrive( aDrive ) - { - } - -// --------------------------------------------------------------------------- -// CMsengRegistryScanner::NewL() -// -// Two-phased constructor -// --------------------------------------------------------------------------- -CMsengRegistryScanner* CMsengRegistryScanner::NewL( - TDriveNumber aDrive, - MMsengScannerObserver& aObserver, - CMsengInfoArray& aScanArray, - RFs& aFsSession) - { - CMsengRegistryScanner* self = new (ELeave) CMsengRegistryScanner(aDrive, - aObserver, aScanArray, aFsSession); - - return self; - } - - -// --------------------------------------------------------------------------- -// CMsengRegistryScanner::~CMsengRegistryScanner() -// -// Destructor -// --------------------------------------------------------------------------- -CMsengRegistryScanner::~CMsengRegistryScanner() - { - } - -// --------------------------------------------------------------------------- -// CMsengRegistryScanner::Scan() -// -// -// --------------------------------------------------------------------------- -void CMsengRegistryScanner::Scan() - { - // Start the scan going - CompleteRequest(); - } - - -// --------------------------------------------------------------------------- -// CMsengRegistryScanner::PerformStepL() -// -// -// --------------------------------------------------------------------------- -CMsengScannerBase::TStepResult CMsengRegistryScanner::PerformStepL() - { - TStepResult result = ECompleteRequest; - - // Scan requested registry - switch( iType ) - { - case ERegistrySisx: - { - ScanSisRegistryL( ); - iType = ERegistryLast; - break; - } - case ERegistryLast: - default: - { - // That's all we had to do - result = EScanComplete; - break; - } - } - - // Return the response back to the base scanner - return result; - } - - -// --------------------------------------------------------------------------- -// CMsengRegistryScanner::ScanSisRegistryL() -// -// -// --------------------------------------------------------------------------- -void CMsengRegistryScanner::ScanSisRegistryL() - { - Swi::RSisRegistrySession regSession; - CleanupClosePushL(regSession); - User::LeaveIfError( regSession.Connect() ); - - RArray uids; - CleanupClosePushL(uids); - regSession.InstalledUidsL( uids ); - - RPointerArray augmentations; - - TInt64 totalSize(0); - - for ( TInt index(0); index < uids.Count(); index++ ) - { - Swi::RSisRegistryEntry entry; - CleanupClosePushL(entry); - User::LeaveIfError( entry.Open( regSession, uids[index] ) ); - - //All packages are from installed packages - CMsengSisxInfo* appObj = CMsengSisxInfo::NewL( entry, iDrive ); - CleanupStack::PushL( appObj ); - TInt64 baseSize( 0 ); - baseSize = entry.SizeL(); - - TRACES - ( - RDebug::Print(_L("ScanSisRegistryL, IsPresent, %d"), TInt( entry.IsPresentL())); - RDebug::Print(_L("ScanSisRegistryL, IsInRom, %d"), TInt( entry.IsInRomL())); - ); - - // Only show if not in rom - if ( !entry.IsInRomL() && entry.IsPresentL() && appObj->RequestedLocation() ) - { - // Get possible augmentations - entry.AugmentationsL( augmentations ); - for ( TInt i( 0 ); i < augmentations.Count(); i++ ) - { - Swi::RSisRegistryEntry augmentation; - CleanupClosePushL( augmentation ); - augmentation.OpenL( regSession, *augmentations[i] ); - // Only show if not in rom - if ( !augmentation.IsInRomL() && augmentation.IsPresentL() ) - { - // Append the size to the total size - baseSize += augmentation.SizeL(); - } - CleanupStack::PopAndDestroy( &augmentation ); - } - totalSize += baseSize; - } - - augmentations.ResetAndDestroy(); - - CleanupStack::PopAndDestroy( appObj ); - CleanupStack::PopAndDestroy( &entry ); - } - - InfoArray().AddSizeByGroupL(EGroupNativeApps, totalSize); - - CleanupStack::PopAndDestroy(&uids); - CleanupStack::PopAndDestroy(®Session); - } - -// End of File - diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serversrc/msengscanner.cpp --- a/filesystemuis/memscaneng/serversrc/msengscanner.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +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: -* This is the class that is in control most of the time. -* It instantiates CMsengScannerBase derived scanner classes -* to do the job. -* -*/ - - -// SYSTEM INCLUDES -#include -#include - -// USER INCLUDES -#include "msengscanner.h" -#include "msengfileextscanner.h" -#include "msengfindallscanner.h" -#include "msengregistryscanner.h" -#include "msenguihandler.h" -#include "mseng.h" - - -// LOCAL CONSTANTS AND MACROS -#ifdef _DEBUG -_LIT(KClassName, "CMsengScanner"); -#endif - -// ================= MEMBER FUNCTIONS ======================================== - -// --------------------------------------------------------------------------- -// CMsengScanner::CMsengScanner() -// -// C++ default constructor. Can NOT contain any code, that might leave. -// --------------------------------------------------------------------------- -CMsengScanner::CMsengScanner(MMsengUIHandler& aUIHandler, CResourceFile& aResFile) : -iUIHandler(aUIHandler), iResFile(aResFile) - { - } - -// --------------------------------------------------------------------------- -// CMsengScanner::~CMsengScanner() -// -// Destructor -// --------------------------------------------------------------------------- -CMsengScanner::~CMsengScanner() - { - delete iScanArray; - delete iFileExtScanner; - delete iFindAllScanner; - delete iRegistryScanner; - } - - - -// --------------------------------------------------------------------------- -// CMsengScanner::Cancel() -// -// --------------------------------------------------------------------------- -// -void CMsengScanner::Cancel() - { - iFileExtScanner->Cancel(); - iFindAllScanner->Cancel(); - iRegistryScanner->Cancel(); - TRAP_IGNORE( iUIHandler.QuitL(KErrCancel) ); - } - -// --------------------------------------------------------------------------- -// CMsengScanner::HaveActiveScanners() -// -// --------------------------------------------------------------------------- -// -TBool CMsengScanner::HaveActiveScanners() const - { - const TBool isActive = - (iFileExtScanner && iFileExtScanner->IsActive()) - || (iFindAllScanner && iFindAllScanner->IsActive()) - || (iRegistryScanner && iRegistryScanner->IsActive()) - ; - return isActive; - } - -// --------------------------------------------------------------------------- -// CMsengScanner::ScanL() -// -// --------------------------------------------------------------------------- -// -TInt CMsengScanner::ScanL(TDriveNumber aDrive, TInt aNumberOfDataGroups, RFs& aFsSession) - { - if(HaveActiveScanners()) - { - return KErrInUse; - } - - // Create data structures; delete the old ones - CMsengInfoArray* infoArray = CMsengInfoArray::NewL( aDrive, - aNumberOfDataGroups, - aFsSession, iResFile ); - - delete iScanArray; - iScanArray = infoArray; - - // Do some scanning tasks not include in ScanL - PreScanL(aDrive, aFsSession); - - // Start the scan by filename extension - iFileExtScanner = CMsengFileExtScanner::NewL(*this, *iScanArray, aFsSession); - iFileExtScanner->ScanL(iScanArray->Dirs()); - - // Start scanning data dirs (including messages) - iFindAllScanner = CMsengFindAllScanner::NewL(*this, *iScanArray, aFsSession); - iFindAllScanner->ScanL(iScanArray->DataDirs()); - - // Start the scan from registries - iRegistryScanner = CMsengRegistryScanner::NewL( aDrive, *this, *iScanArray, aFsSession ); - iRegistryScanner->Scan(); - - return KErrNone; - } - -// --------------------------------------------------------------------------- -// MsengScanner::HandleScannerEventL() -// -// Handle the events from scanning -// --------------------------------------------------------------------------- -// -void CMsengScanner::HandleScannerEventL(TScannerEvent aEvent, - const CMsengScannerBase& /*aScanner*/, - TInt aError) - { -#ifdef __SHOW_RDEBUG_PRINT_ - RDebug::Print(_L("CMsengScanner::HandleScannerEventL() called with event: %d"), aEvent); -#endif // __SHOW_RDEBUG_PRINT_ - - switch(aEvent) - { - case MMsengScannerObserver::EScannerEventScanComplete: - // This scanner object has finished all of its scanning. - // If all the others are finished too, - // then we tell the UI that scanning is complete. - if (!HaveActiveScanners()) - { - iUIHandler.QuitL(KErrNone); - } - break; - - case MMsengScannerObserver::EScannerEventScanError: - // An error has happened - iUIHandler.ErrorL(aError); - break; - - default: - // should never happen - __ASSERT_DEBUG(EFalse,User::Panic(KClassName, KErrGeneral)); - break; - } - } - -// --------------------------------------------------------------------------- -// CMsengScanner::PreScanL() -// -// --------------------------------------------------------------------------- -// -void CMsengScanner::PreScanL(TDriveNumber aDrive, RFs& aFsSession) - { - // Before actual scanning, check the sizes of the few extra - // data files that are not scanned in normal way. - - RResourceReader theReader; - - TBool somethingToDo = EFalse; - if( CMseng::IsInternalDrive( aFsSession, aDrive ) - && !CMseng::IsMassStorageDrive( aFsSession, aDrive ) ) - { - theReader.OpenLC( &iResFile, C_EXTRADATAFILES ); - somethingToDo = ETrue; - } - else - { - theReader.OpenLC( &iResFile, E_EXTRADATAFILES ); - somethingToDo = ETrue; - } - - if(somethingToDo) - { - //the first WORD contains the number of elements in the resource - const TInt length = theReader.ReadInt16L(); - - // Read the array resource, - TInt groupindex; // value from enum TDataGroups - for(TInt i=0; iDes(); - TBuf<1> drive; - drive.Append(ch); - ptrName.Replace(0, drive.Length(), drive); - - // check the size of the file whose path was in the resource. - TEntry file; - TInt err = aFsSession.Entry(ptrName, file); - if (err == KErrNone) - { - TInt64 size = file.FileSize(); - iScanArray->AddSizeByGroupL(groupindex, size); - } - - CleanupStack::PopAndDestroy(name); - } - } - } - CleanupStack::PopAndDestroy(&theReader); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serversrc/msengscannerbase.cpp --- a/filesystemuis/memscaneng/serversrc/msengscannerbase.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +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: -* Virtual base class for the scanner classes. -* -*/ - - - -// USER INCLUDES -#include "msengscannerbase.h" - - -// ========================= MEMBER FUNCTIONS ================================ - -// --------------------------------------------------------------------------- -// CMsengScannerBase::CMsengScannerBase() -// -// C++ default constructor. Can NOT contain any code, that might leave. -// --------------------------------------------------------------------------- -CMsengScannerBase::CMsengScannerBase(MMsengScannerObserver& aObserver, - CMsengInfoArray& aInfoArray, - RFs& aFsSession - ) -: CActive(CActive::EPriorityStandard), iObserver(aObserver), - iInfoArray(aInfoArray), iFsSession(aFsSession) - { - CActiveScheduler::Add(this); - } - -// --------------------------------------------------------------------------- -// CMsengScannerBase::~CMsengScannerBase() -// -// Destructor -// --------------------------------------------------------------------------- -CMsengScannerBase::~CMsengScannerBase() - { - Cancel(); - } - - - - -// --------------------------------------------------------------------------- -// CMsengScannerBase::CompleteRequest() -// -// -// --------------------------------------------------------------------------- -void CMsengScannerBase::CompleteRequest(TInt aCode) - { - if (!IsActive()) - { - TRequestStatus* status = &iStatus; - User::RequestComplete(status, aCode); - SetActive(); - } - } - -// --------------------------------------------------------------------------- -// CMsengScannerBase::RunL() -// -// -// --------------------------------------------------------------------------- -void CMsengScannerBase::RunL() - { - // Do one scanning step - const TStepResult result = PerformStepL(); - - switch(result) - { - case ECompleteRequest: - { - CompleteRequest(); - break; - } - - case EScanComplete: - { - iObserver.HandleScannerEventL( - MMsengScannerObserver::EScannerEventScanComplete, *this); - break; - } - - case ERequestIssuedInternally: - default: - { - // Not used, but maybe needed for messaging if some asynchronous - // service is used which completes iStatus by itself. - break; - } - } - } - -// --------------------------------------------------------------------------- -// CMsengScannerBase::DoCancel() -// -// -// --------------------------------------------------------------------------- -void CMsengScannerBase::DoCancel() - { - // Nothing to do here - } - - -// --------------------------------------------------------------------------- -// CMsengScannerBase::RunError() -// -// -// --------------------------------------------------------------------------- -TInt CMsengScannerBase::RunError(TInt aError) - { - // Implementation for EScannerEventScanError cannot leave at the moment, - // but lets trap if implementation changes - TRAP_IGNORE(iObserver.HandleScannerEventL( - MMsengScannerObserver::EScannerEventScanError, *this, aError)); - return KErrNone; - } - - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memscaneng/serversrc/msengsisxinfo.cpp --- a/filesystemuis/memscaneng/serversrc/msengsisxinfo.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +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: Utility class for accessing sis-registry -* -*/ - - -// SYSTEM INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// USER INCLUDES -#include "msengsisxinfo.h" -#include "memscanutils.h" - -// constants -_LIT( KDriveC, "C"); -_LIT( KDriveZ, "Z"); - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CMsengSisxInfo::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CMsengSisxInfo::ConstructL( Swi::RSisRegistryEntry& aEntry, TDriveNumber aDrive ) - { - TInt err; - TChar driveLetter; - RFs::DriveToChar(aDrive, driveLetter); - driveLetter.UpperCase(); - const TInt KDriveLength = 1; - TBuf driveName; - driveName.Append(driveLetter); - - TRAP(err, aEntry.FilesL(iFiles)); - - // Get the name of the app - HBufC* packageName = aEntry.PackageNameL(); - CleanupStack::PushL( packageName ); - TParse parse; - - parse.SetNoWild( *packageName, NULL, NULL ); - iFileName = parse.Name().AllocL(); - CleanupStack::PopAndDestroy(packageName); - TPtr tmpPtr2 = iFileName->Des(); - TRACES( RDebug::Print( _L("CMsengSisxInfo::ConstructL - %S"), &tmpPtr2 ); ); - - // Get Location - TChar selectedDrive( aEntry.SelectedDriveL() ); - selectedDrive.UpperCase(); - iRequestedLocation = EFalse; - - if( selectedDrive == driveLetter ) - { - // Phone memory - iRequestedLocation = ETrue; - } - else - { - // Check the disk from files - // if all have C, the software is installed to phone - // else it is installed to memory card - TInt count = iFiles.Count(); - - TInt allFilesInCZ = 0; - for ( TInt index = 0; index < count; index++ ) - { - TPtrC firstChar = iFiles[index]->Des().Left(1); - TRACES( RDebug::Print( _L("Checking location of %S"), iFiles[index]); ); - - if ( ( firstChar.CompareF( KDriveC ) == KErrNone ) || - ( firstChar.CompareF( KDriveZ ) == KErrNone ) ) - { - allFilesInCZ++; - } - } - - if ( allFilesInCZ == count && (driveName.CompareF( KDriveC ) == KErrNone ) ) - { - // Phone memory - iRequestedLocation = ETrue; - } - } - - TRACES( RDebug::Print( _L("Requested location %d"), iRequestedLocation); ); - } - - -// ----------------------------------------------------------------------------- -// CMsengSisxInfo::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CMsengSisxInfo* CMsengSisxInfo::NewL( Swi::RSisRegistryEntry& aEntry, - TDriveNumber aDrive ) - { - CMsengSisxInfo* self = new ( ELeave ) CMsengSisxInfo( ); - CleanupStack::PushL( self ); - self->ConstructL( aEntry, aDrive ); - CleanupStack::Pop( self ); - return self; - } - - -// ----------------------------------------------------------------------------- -// CMsengSisxInfo::~CMsengSisxInfo -// Destructor. -// ----------------------------------------------------------------------------- -CMsengSisxInfo::~CMsengSisxInfo() - { - delete iFileName; - iFiles.ResetAndDestroy(); - iFiles.Close(); - } - - -// ----------------------------------------------------------------------------- -// CAppMngrSisxInfo::RequestedLocation -// Get location of the application. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TBool CMsengSisxInfo::RequestedLocation() const - { - return iRequestedLocation; - } - - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memstatepopup/BWINS/MEMSTATEPOPUPU.DEF --- a/filesystemuis/memstatepopup/BWINS/MEMSTATEPOPUPU.DEF Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - ?GetUtilL@CMemStatePopup@@SAXAAPAVCMSPUtil@@@Z @ 1 NONAME ; void CMemStatePopup::GetUtilL(class CMSPUtil * &) - ?RunLD@CMemStatePopup@@SAXW4TDriveNumber@@AAVTDesC16@@@Z @ 2 NONAME ; void CMemStatePopup::RunLD(enum TDriveNumber, class TDesC16 &) - ?SolveUnitAndSize@CMSPUtil@@QAE?AVTPtrC16@@AA_J@Z @ 3 NONAME ; class TPtrC16 CMSPUtil::SolveUnitAndSize(long long &) - diff -r 95243422089a -r 491b3ed49290 filesystemuis/memstatepopup/EABI/MemStatePopupU.DEF --- a/filesystemuis/memstatepopup/EABI/MemStatePopupU.DEF Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -EXPORTS - _ZN14CMemStatePopup5RunLDE12TDriveNumberR7TDesC16 @ 1 NONAME - _ZN14CMemStatePopup8GetUtilLERP8CMSPUtil @ 2 NONAME - _ZN8CMSPUtil16SolveUnitAndSizeERx @ 3 NONAME - _ZTI14CMemStatePopup @ 4 NONAME ; ## - _ZTI8CMSPUtil @ 5 NONAME ; ## - _ZTV14CMemStatePopup @ 6 NONAME ; ## - _ZTV8CMSPUtil @ 7 NONAME ; ## - diff -r 95243422089a -r 491b3ed49290 filesystemuis/memstatepopup/group/MemStatePopup.mmp --- a/filesystemuis/memstatepopup/group/MemStatePopup.mmp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +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: -* This is project specification file for the Memory State Popup. -* -* -*/ - - -#include -#include - -TARGET memstatepopup.dll -TARGETTYPE dll -UID 0x1000008d 0x101F4672 -VENDORID VID_DEFAULT -CAPABILITY CAP_GENERAL_DLL - -START RESOURCE ../group/MemStatePopup.rss -TARGETPATH RESOURCE_FILES_DIR -HEADER -LANGUAGE_IDS -END - -SOURCEPATH ../src - -SOURCE CMemStatePopup.cpp -SOURCE cmemstatepopupimpl.cpp -SOURCE MSPUtil.cpp -SOURCE cmemscaneventreceiver.cpp - - -USERINCLUDE ../group ../inc - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE ../../inc - -LIBRARY euser.lib -LIBRARY bafl.lib -LIBRARY cone.lib -LIBRARY avkon.lib -LIBRARY eikcoctl.lib -LIBRARY commonengine.lib -LIBRARY efsrv.lib -LIBRARY memscanclient.lib - - -// End of File - diff -r 95243422089a -r 491b3ed49290 filesystemuis/memstatepopup/group/MemStatePopup.rss --- a/filesystemuis/memstatepopup/group/MemStatePopup.rss Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2005 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: -* Resources for memory state popup -* -*/ - - -#include -#include - -#include -#include -#include -#include - -#include - - -// RESOURCE IDENTIFIER -NAME MSTP // 4 letter ID - -// COMPULSORY SIGNATURE -RESOURCE RSS_SIGNATURE { } - -// MEMORY SCAN WAIT NOTE -RESOURCE DIALOG r_memstate_wait_note - { - flags = EAknWaitNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control= AVKON_NOTE - { - layout = EWaitLayout; - singular_label = qtn_swins_note_mem_wait; - imagefile = AVKON_ICON_FILE; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation =R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - - -RESOURCE TBUF r_unit_formatter - { - buf = qtn_swins_lsh2_format; - } - -RESOURCE ARRAY r_array_units - { - items = - { - LBUF { txt = qtn_swins_lsh2_plain_byte; }, - LBUF { txt = qtn_swins_lsh2_plain_kilobyte; }, - LBUF { txt = qtn_swins_lsh2_plain_megabyte; }, - LBUF { txt = qtn_swins_lsh2_plain_gigabyte; } - }; - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memstatepopup/group/bld.inf --- a/filesystemuis/memstatepopup/group/bld.inf Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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: Build information file for project memscaneng -* -*/ - - -#include - -PRJ_EXPORTS - ../rom/MemStatePopup.iby CORE_APP_LAYER_IBY_EXPORT_PATH(MemStatePopup.iby ) - ../rom/MemStatePopupResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(MemStatePopupResources.iby) - ../loc/MemStatePopup.loc APP_LAYER_LOC_EXPORT_PATH(memstatepopup.loc) - -PRJ_PLATFORMS - DEFAULT - -PRJ_MMPFILES - MemStatePopup.mmp diff -r 95243422089a -r 491b3ed49290 filesystemuis/memstatepopup/inc/MSPPanic.hrh --- a/filesystemuis/memstatepopup/inc/MSPPanic.hrh Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2002 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: -* MemStatePopup Panics. -* -*/ - - - -#ifndef __MSPPANIC_HRH__ -#define __MSPPANIC_HRH__ - -_LIT( KPanicMSP, "MemoryStatePopup" ); - -// UI panics -enum MSPPanic - { - EInvalidParameter - }; - -#endif // __MAUIPANIC_HRH__ - -// End of File - diff -r 95243422089a -r 491b3ed49290 filesystemuis/memstatepopup/inc/cmemscaneventreceiver.h --- a/filesystemuis/memstatepopup/inc/cmemscaneventreceiver.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +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: -* Memory Scan Event Receiver -* -* -*/ - -#ifndef CMEMSCANEVENTRECEIVER_H -#define CMEMSCANEVENTRECEIVER_H - -// SYSTEM INCLUDES -#include -#include -#include - - -class MMsengUIHandler; - - -NONSHARABLE_CLASS(CMemScanEventReceiver) : public CActive - { - public: - static CMemScanEventReceiver* NewL( MMsengUIHandler& aUIHandler ); - ~CMemScanEventReceiver(); - - private: - CMemScanEventReceiver( MMsengUIHandler& aUIHandler ); - void ConstructL(); - - public: // API - CDesCArray* DataGroupsL() const; - CArrayFix* ScanResultL() const; - TBool ScanInProgress() const; - TInt ScanL(TDriveNumber aDrive); - - private: // From CActive - void RunL(); - void DoCancel(); - TInt RunError( TInt aError ); - - private: // Internal functions - void RegisterForScanEvents(); - - private: // Data members - MMsengUIHandler& iUIHandler; - RMemScanClient iScanClient; - TInt iEventError; - }; - - -#endif // CMEMSCANEVENTRECEIVER_H \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 filesystemuis/memstatepopup/inc/cmemstatepopupimpl.h --- a/filesystemuis/memstatepopup/inc/cmemstatepopupimpl.h Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +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: Memory state popup implementation -* -*/ - - -#ifndef __CMEMORYSTATEPOPUPIMPL_H__ -#define __CMEMORYSTATEPOPUPIMPL_H__ - -// SYSTEM INCLUDES -#include -#include -#include -#include - -// FORWARD DECLARATIONS -class CAknPopupList; -class CAknSingleHeadingPopupMenuStyleListBox; -class CMemScanEventReceiver; -class CMSPUtil; - -// CLASS DEFINITION -NONSHARABLE_CLASS(CMemStatePopupImpl) : - public CActive, - public MMsengUIHandler, - public MProgressDialogCallback - { - public: - // Destructor - virtual ~CMemStatePopupImpl( ); - - private: - // Second phase - void ConstructL( ); - - // C++ constructors - CMemStatePopupImpl( TDriveNumber aDrive, const TDesC& aTitle ); - CMemStatePopupImpl( ); - - public: - /** - * Launches the memory scan popup - * @param aDrive The drive to be scanned - * @param aTitle Title of the popup - */ - static void RunLD( TDriveNumber aDrive, const TDesC& aTitle ); - - /** - * Get an instance of CMSPUtil class, containing the unit text array - * @param aUtil Reference to a CMSPUtil pointer, - * updated to point to the instance created - */ - static void GetUtilL( CMSPUtil*& aUtil ); - - public: - // From MMsengUIHandler - void StartL( ); - void QuitL( TInt /*aReason*/ ); - void ErrorL( TInt aError ); - - // From MProgressDialogCallback - virtual void DialogDismissedL( TInt /*aButtonId*/ ); - - private: - - // From CActive - void RunL(); - void DoCancel(); - - /** - * Starts observing drive dismounts. - */ - void StartObserver( ); - - /** - * Construct popup and ready it for use. - */ - void ConstructPopupL( ); - - /** - * Shows wait dialog and start scanning. - */ - void ExecuteL( ); - - /** - * Refresh the data shown in listbox. - */ - void RefreshL( ); - - /** - * Set the results to zero. - */ - void NullifyResults( ); - - /** - * Opens the resource and reads unit array from it. - */ - void OpenResourceAndReadArrayL( ); - - private: - // Not implemented - CMemStatePopupImpl( const CMemStatePopupImpl& ); - CMemStatePopupImpl& operator=( CMemStatePopupImpl& ); - - private: - /** - * Container class used to prevent all pointer events - * passing from listbox to popup-list. - */ - NONSHARABLE_CLASS(CMemStateListBox) : public CAknSingleHeadingPopupMenuStyleListBox - { - public: - // Destructor - virtual ~CMemStateListBox( ) {}; - }; - - private: - CDesCArray* iGroupNames; - CArrayFix< TInt64 >* iScanResults; - CDesCArray* iListModel; - CMemStateListBox* iListBox; - CAknWaitDialog* iWaitDialog; - TBool iFinished; - TDriveNumber iDrive; - CAknPopupList* iPopup; - TDesC* iTitle; - CCoeEnv& iCoeEnv; - RConeResourceLoader iResLoader; - CMSPUtil* iUtil; - TBool iOwnsUtil; - CMemScanEventReceiver* iEventReceiver; - }; - -#endif // __CMEMORYSTATEPOPUPIMPL_H__ - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memstatepopup/loc/MemStatePopup.loc --- a/filesystemuis/memstatepopup/loc/MemStatePopup.loc Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2005 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: -* This is a localisation file for Memory State Popup -* -*/ - - - -// LOCALISATION STRINGS - -//d:Memory state dialog wait note. -//l:popup_note_wait_window -// -#define qtn_swins_note_mem_wait "Scanning memory. Please wait." - -//d:Unit formatter, %N is the amount of data and %U is one of the units below. -//l:list_single_heading_pane_t2 -// -#define qtn_swins_lsh2_format "%0N %1U" - -//d:Unit name for byte. -//l:list_single_heading_pane_t2 -// -#define qtn_swins_lsh2_plain_byte "B" - -//d:Unit name for kilobyte. -//l:list_single_heading_pane_t2 -// -#define qtn_swins_lsh2_plain_kilobyte "kB" - -//d:Unit name for megabyte. -//l:list_single_heading_pane_t2 -// -#define qtn_swins_lsh2_plain_megabyte "MB" - -//d:Unit name for gigabyte. -//l:list_single_heading_pane_t2 -// -#define qtn_swins_lsh2_plain_gigabyte "GB" - - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memstatepopup/rom/MemStatePopup.iby --- a/filesystemuis/memstatepopup/rom/MemStatePopup.iby Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +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: Image description file for project memstatepopup -* -*/ - - -#ifndef __MEMSTATEPOPUP_IBY__ -#define __MEMSTATEPOPUP_IBY__ - -// Memory State Popup -file=ABI_DIR\BUILD_DIR\MemStatePopup.dll SHARED_LIB_DIR\MemStatePopup.dll - -#endif diff -r 95243422089a -r 491b3ed49290 filesystemuis/memstatepopup/rom/MemStatePopupResources.iby --- a/filesystemuis/memstatepopup/rom/MemStatePopupResources.iby Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +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: Image description file for project memstatepopup -* -*/ - - -#ifndef __MEMSTATEPOPUP_RESOURCES_IBY__ -#define __MEMSTATEPOPUP_RESOURCES_IBY__ - -//Resource file(s) for Memory State Popup - -data=DATAZ_\RESOURCE_FILES_DIR\MemStatePopup.rsc RESOURCE_FILES_DIR\MemStatePopup.rsc - - -#endif diff -r 95243422089a -r 491b3ed49290 filesystemuis/memstatepopup/src/CMemStatePopup.cpp --- a/filesystemuis/memstatepopup/src/CMemStatePopup.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +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: Definition for CMemStatePopup -* -* -*/ - - -// SYSTEM INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// USER INCLUDES -#include "cmemstatepopup.h" -#include "cmemstatepopupimpl.h" -#include "cmemscaneventreceiver.h" - -// --------------------------------------------------------------------------- - -CMemStatePopup::CMemStatePopup( ) - { - } - -// --------------------------------------------------------------------------- - -CMemStatePopup::~CMemStatePopup( ) - { - } - - - -// --------------------------------------------------------------------------- - -EXPORT_C void CMemStatePopup::RunLD( TDriveNumber aDrive, TDesC& aTitle ) - { - CMemStatePopupImpl::RunLD( aDrive, aTitle ); - } - -// --------------------------------------------------------------------------- - -EXPORT_C void CMemStatePopup::GetUtilL( CMSPUtil*& aUtil ) - { - CMemStatePopupImpl::GetUtilL( aUtil ); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 filesystemuis/memstatepopup/src/MSPUtil.cpp --- a/filesystemuis/memstatepopup/src/MSPUtil.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* -* Copyright (c) 2002 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: CMSPUtil Implementation -* -* -*/ - - -// INCLUDE FILES -#include -#include "MSPPanic.hrh" -#include "msputil.h" - -// --------------------------------------------------------------------------- - -CMSPUtil* CMSPUtil::NewL( CDesCArrayFlat* aArray ) - { - __ASSERT_DEBUG( aArray, - User::Panic( KPanicMSP, EInvalidParameter ) ); - CMSPUtil* self = new( ELeave ) CMSPUtil; - self->iUnitArray = aArray; - return self; - } - -// --------------------------------------------------------------------------- - -CMSPUtil::~CMSPUtil( ) - { - if( iUnitArray ) - { - iUnitArray->Delete( 0, iUnitArray->Count( ) ); - } - delete iUnitArray; - } - -// --------------------------------------------------------------------------- - -CMSPUtil::CMSPUtil( ): iUnitArray( NULL ) - { - } - -// --------------------------------------------------------------------------- - -void CMSPUtil::SolveUnitAndSize( TInt64& aNumber, TInt& aUnit ) - { - TInt count( iUnitArray->Count( ) ); - const TInt KMaxDigits = 10000; - const TInt KKiloByte = 1024; - const TInt KRoundLimit = 512; - const TInt KShiftValue = 10; - aUnit = EByte; - - // If number is 1024 or more, it can be divided and unit changed - while( aNumber >= 1024 && (aUnit + 1) < count ) - { - // Show kilobytes and megabytes with 4 digits - if( ( aUnit == EKiloByte || aUnit == EMegaByte ) && aNumber < KMaxDigits ) - { - break; - } - // Check how the rounding should be done - if( aNumber % KKiloByte < KRoundLimit ) - { - // Round downwards - aNumber >>= KShiftValue; // 2^10 = 1024 - } - else - { - aNumber = ( aNumber >> KShiftValue ) + 1; - } - aUnit++; // Next enum - } - } - - -// --------------------------------------------------------------------------- - -EXPORT_C TPtrC CMSPUtil::SolveUnitAndSize( TInt64& aNumber ) - { - TInt unitType( EByte ); - SolveUnitAndSize( aNumber, unitType ); - if( unitType >= iUnitArray->Count() ) - { - if( iUnitArray->Count() ) - { - unitType = iUnitArray->Count() - 1; - } - else - { - unitType = 0; - } - } - - return ( *iUnitArray )[ unitType ]; - } - -// End of File - diff -r 95243422089a -r 491b3ed49290 filesystemuis/memstatepopup/src/cmemscaneventreceiver.cpp --- a/filesystemuis/memstatepopup/src/cmemscaneventreceiver.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,209 +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: -* Memory Scan Event Receiver -* -* -*/ - - - -// SYSTEM INCLUDES -#include - - -// USER INCLUDES -#include "cmemscaneventreceiver.h" - - -// ========================= MEMBER FUNCTIONS ================================ - - -// --------------------------------------------------------------------------- -// CMemScanEventReceiver::CMemScanEventReceiver() -// -// C++ default constructor. -// --------------------------------------------------------------------------- -CMemScanEventReceiver::CMemScanEventReceiver( MMsengUIHandler& aUIHandler ) -: CActive(EPriorityStandard), iUIHandler(aUIHandler) - { - CActiveScheduler::Add(this); - } - - -// --------------------------------------------------------------------------- -// CMemScanEventReceiver::NewL() -// -// -// --------------------------------------------------------------------------- -CMemScanEventReceiver* CMemScanEventReceiver::NewL( MMsengUIHandler& aUIHandler ) - { - CMemScanEventReceiver* self = new( ELeave ) CMemScanEventReceiver( aUIHandler ); - CleanupStack::PushL( self ); - self->ConstructL( ); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------------------------- -// CMemScanEventReceiver::ConstructL() -// -// Destructor -// --------------------------------------------------------------------------- -void CMemScanEventReceiver::ConstructL() - { - User::LeaveIfError( iScanClient.Connect() ); - } - - -// --------------------------------------------------------------------------- -// CMemScanEventReceiver::~CMemScanEventReceiver() -// -// -// --------------------------------------------------------------------------- -CMemScanEventReceiver::~CMemScanEventReceiver() - { - Cancel(); - iScanClient.Close(); - } - - -// --------------------------------------------------------------------------- -// CMemScanEventReceiver::RunL() -// -// -// --------------------------------------------------------------------------- -void CMemScanEventReceiver::RunL() - { - User::LeaveIfError( iStatus.Int() ); - - switch( iStatus.Int() ) - { - case EMemScanEventScanningStarted: - { - iUIHandler.StartL(); - break; - } - - case EMemScanEventScanningFinished: - { - iUIHandler.QuitL(iEventError); - break; - } - - case EMemScanEventScanningError: - { - iUIHandler.ErrorL(iEventError); - break; - } - - default: - { - break; - } - } - - RegisterForScanEvents(); - } - - -// --------------------------------------------------------------------------- -// CMemScanEventReceiver::DoCancel() -// -// -// --------------------------------------------------------------------------- -void CMemScanEventReceiver::DoCancel() - { - iScanClient.RequestScanEventsCancel(); - } - - -// --------------------------------------------------------------------------- -// CMemScanEventReceiver::RunError() -// -// -// --------------------------------------------------------------------------- -TInt CMemScanEventReceiver::RunError( TInt /*aError*/ ) - { - RegisterForScanEvents(); - return KErrNone; - } - - -// --------------------------------------------------------------------------- -// CMemScanEventReceiver::DataGroupsL() -// -// -// --------------------------------------------------------------------------- -CDesCArray* CMemScanEventReceiver::DataGroupsL() const - { - CDesCArray* dataGroupArray = iScanClient.DataGroupsL(); - return dataGroupArray; - } - - -// --------------------------------------------------------------------------- -// CMemScanEventReceiver::ScanResultL() -// -// -// --------------------------------------------------------------------------- -CArrayFix* CMemScanEventReceiver::ScanResultL() const - { - CArrayFix* scanResultArray = iScanClient.ScanResultL(); - return scanResultArray; - } - - -// --------------------------------------------------------------------------- -// CMemScanEventReceiver::ScanInProgress() -// -// -// --------------------------------------------------------------------------- -TBool CMemScanEventReceiver::ScanInProgress() const - { - return iScanClient.ScanInProgress(); - } - - -// --------------------------------------------------------------------------- -// CMemScanEventReceiver::ScanL() -// -// -// --------------------------------------------------------------------------- -TInt CMemScanEventReceiver::ScanL(TDriveNumber aDrive) - { - RegisterForScanEvents(); - - return iScanClient.Scan(aDrive); - } - - -// --------------------------------------------------------------------------- -// CMemScanEventReceiver::RegisterForScanEvents() -// -// -// --------------------------------------------------------------------------- -void CMemScanEventReceiver::RegisterForScanEvents() - { - Cancel(); - - // We request events from the server. When the server has an event - // for us, it will complete our request status (iStatus) with an - // event type (i.e. one of the TMemScanEvent enumerations) and - // also ensures that iEventError is updated with any associated error - // value. This will then cause the RunL method to be called. - iScanClient.RequestScanEvents( iEventError, iStatus ); - SetActive(); - } diff -r 95243422089a -r 491b3ed49290 filesystemuis/memstatepopup/src/cmemstatepopupimpl.cpp --- a/filesystemuis/memstatepopup/src/cmemstatepopupimpl.cpp Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,415 +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: Memory state popup implementation -* -*/ - - -// SYSTEM INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// USER INCLUDES -#include "msputil.h" -#include "cmemstatepopup.h" -#include "cmemstatepopupimpl.h" -#include "cmemscaneventreceiver.h" - -// CONSTANTS -_LIT( KDirAndFile,"Z:MemStatePopup.RSC" ); -_LIT( KMemListSeparator, "\t" ); - -// Max length of a list row -// Has to be big enough to hold "%N %U" -const TInt KListItemMaxLength = 32; - -// --------------------------------------------------------------------------- - -CMemStatePopupImpl::~CMemStatePopupImpl( ) - { - Cancel(); - // Close the resource - iResLoader.Close( ); - - if( iWaitDialog ) - { - iWaitDialog->SetObserver( NULL ); - delete iWaitDialog; - } - - delete iEventReceiver; // deletes also scan engine and server - - delete iGroupNames; - delete iListModel; - delete iListBox; - delete iScanResults; - - - if( iOwnsUtil ) - { - // Delete only if the actual dialog was launched - delete iUtil; - } - - // Try to delete also iPopup in case of leave - // Must call CBase's destructor - // because CAknPopupList destructor is protected - delete ( CBase* ) iPopup; - } - -// --------------------------------------------------------------------------- - -CMemStatePopupImpl::CMemStatePopupImpl( TDriveNumber aDrive, const TDesC& aTitle ) : - CActive(EPriorityStandard), - iFinished( EFalse ), - iDrive( aDrive ), - iTitle( const_cast (&aTitle) ), - iCoeEnv( *CCoeEnv::Static( ) ), - iResLoader( iCoeEnv ), - iOwnsUtil( ETrue ) - { - CActiveScheduler::Add(this); - } - -// --------------------------------------------------------------------------- - -// Used by GetUtilL -CMemStatePopupImpl::CMemStatePopupImpl( ) : - CActive(EPriorityStandard), - iFinished( EFalse ), - iDrive( EDriveC ), - iCoeEnv( *CCoeEnv::Static( ) ), - iResLoader( iCoeEnv ), - iOwnsUtil( EFalse ) - { - } - -// --------------------------------------------------------------------------- - -void CMemStatePopupImpl::ConstructL( ) - { - OpenResourceAndReadArrayL( ); - - // Instantiate event receiver, memory scan engine and server - iEventReceiver = CMemScanEventReceiver::NewL( *this ); - - // Get data group names from engine - iGroupNames = iEventReceiver->DataGroupsL( ); - - // Create popup - ConstructPopupL( ); - - // Create wait dialog - iWaitDialog = new( ELeave ) CAknWaitDialog( - reinterpret_cast< CEikDialog** >( &iWaitDialog ) ); - iWaitDialog->SetCallback( this ); - iWaitDialog->PrepareLC( R_MEMSTATE_WAIT_NOTE ); - - StartObserver(); - } - -// --------------------------------------------------------------------------- - -void CMemStatePopupImpl::RunLD( TDriveNumber aDrive, const TDesC& aTitle ) - { - CMemStatePopupImpl* self = new( ELeave ) CMemStatePopupImpl( aDrive, aTitle ); - CleanupStack::PushL( self ); - self->ConstructL( ); - - // Run the actual process - self->ExecuteL( ); - - CleanupStack::PopAndDestroy( self ); - } - - -// --------------------------------------------------------------------------- - -void CMemStatePopupImpl::GetUtilL( CMSPUtil*& aUtil ) - { - CMemStatePopupImpl* self = new( ELeave ) CMemStatePopupImpl; - CleanupStack::PushL( self ); - - // Read the unit array from resource - self->OpenResourceAndReadArrayL( ); - aUtil = self->iUtil; // iUtil is not deleted - - CleanupStack::PopAndDestroy( self ); - } - -// --------------------------------------------------------------------------- - -void CMemStatePopupImpl::StartL( ) - { -#ifdef _DEBUG - RDebug::Print( _L( "Scanning started!" ) ); -#endif - } - -// --------------------------------------------------------------------------- - -void CMemStatePopupImpl::QuitL( TInt /*aReason*/ ) - { -#ifdef _DEBUG - RDebug::Print( _L( "Scanning ended!" ) ); -#endif - if( !iFinished ) - { - // Tell waitdialog that it can quit now - iWaitDialog->ProcessFinishedL( ); - iFinished = ETrue; - } - } - -// --------------------------------------------------------------------------- - -void CMemStatePopupImpl::ErrorL( TInt aError ) - { -#ifdef _DEBUG - RDebug::Print( _L( "Error scanning memory: %d" ), aError ); -#endif - - // getting rid of UREL compiler warning - if( !aError ) - { - aError = KErrNone; - } - } - -// --------------------------------------------------------------------------- - -void CMemStatePopupImpl::DialogDismissedL( TInt aButtonId ) - { - - // Cancel is pressed while scanning is in progress - if( iEventReceiver->ScanInProgress( ) ) - { - iFinished = ETrue; - iEventReceiver->Cancel( ); // Stop scanning - } - - // Cancel is pressed while wait note is on screen (scanning may be completed) - if( aButtonId == EAknSoftkeyCancel ) // instead of EAknSoftkeyDone - { - iPopup->CancelPopup( ); // Remove memory state popup from screen - return; - } - - // Get the new result array - delete iScanResults; - iScanResults = NULL; - TRAPD( err, iScanResults = iEventReceiver->ScanResultL( ) ); - if( err != KErrNone ) - { - iPopup->CancelPopup( ); // Remove memory state popup from screen - return; - } - RefreshL( ); - } - -// --------------------------------------------------------------------------- - -void CMemStatePopupImpl::ConstructPopupL( ) - { - iListBox = new( ELeave ) CMemStateListBox( ); - - iPopup = CAknPopupList::NewL( iListBox, R_AVKON_SOFTKEYS_OK_EMPTY, - AknPopupLayouts::EMenuGraphicHeadingWindow ); - iPopup->SetTitleL( *iTitle ); - - // Set up listbox - iListBox->ConstructL( iPopup, EAknListBoxViewerFlags ); - - // Create listbox model and give the model to the listbox - iListModel = new( ELeave ) CDesCArraySeg( iGroupNames->Count( ) ); - - // Create scroll indicator - iListBox->CreateScrollBarFrameL( ETrue ); - iListBox->ScrollBarFrame( )->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - iListBox->Model( )->SetItemTextArray( iListModel ); - iListBox->Model( )->SetOwnershipType( ELbmDoesNotOwnItemArray ); - iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); - } - -// --------------------------------------------------------------------------- - -void CMemStatePopupImpl::ExecuteL( ) - { - // Show wait dialog - iWaitDialog->RunLD( ); - - // Start the scanning - User::LeaveIfError(iEventReceiver->ScanL( iDrive )); - - // Get the result array - iScanResults = iEventReceiver->ScanResultL( ); - - // Set all results zero, so that no actual results are shown - // before the scan is done. - NullifyResults( ); - - // Update the list with initial values (0's) - RefreshL( ); - - // Show popup - iPopup->ExecuteLD( ); - iPopup = NULL; // Has to be set NULL because deleted in destructor - } - -// --------------------------------------------------------------------------- - -void CMemStatePopupImpl::RefreshL( ) - { - //TBuf< KListItemMaxLength > result; - TBuf< KListItemMaxLength > unitText; - TBuf< KListItemMaxLength > tempText; - TPtrC unit; - TInt64 res64( 0 ); - TInt count( iScanResults ? iScanResults->Count( ) : 0 ); - TInt maxGroupName(0); - - for( TInt i = 0; i < iGroupNames->Count(); i++ ) - { - if( maxGroupName < ( *iGroupNames )[ i ].Length() ) - { - maxGroupName = ( *iGroupNames )[ i ].Length(); - } - } - - // Allocate memory for size, unit text and actual group name - HBufC* result = HBufC::NewLC( maxGroupName + 2*KListItemMaxLength ); - TPtr resultPtr( result->Des() ); - HBufC* unitFormatter = StringLoader::LoadLC( R_UNIT_FORMATTER, &iCoeEnv ); - - iListModel->Reset( ); - - // Go through the result array and append to the model as text - for( TInt i = 0; i < count; i++ ) - { - res64 = ( *iScanResults )[ i ]; - - unit.Set( iUtil->SolveUnitAndSize( res64 ) ); - StringLoader::Format( tempText, *unitFormatter, 0, I64INT( res64 ) ); - StringLoader::Format( unitText, tempText, 1, unit ); - resultPtr.Zero( ); - - // The actual listbox row is constructed here - // iListModel is just an array of descriptors - if ( User::Language() == ELangArabic ) - { - resultPtr.Append( KRightToLeftMark ); - } - resultPtr.Append( unitText ); - resultPtr.Append( KMemListSeparator ); - if( i < iGroupNames->Count() ) - { - resultPtr.Append( ( *iGroupNames )[ i ] ); - } - else - { - resultPtr.Append( ( *iGroupNames )[ 0 ] ); - } - iListModel->AppendL( resultPtr ); - } - - CleanupStack::PopAndDestroy( unitFormatter ); - CleanupStack::PopAndDestroy( result ); - - // Update the listbox - iListBox->HandleItemAdditionL( ); - } - -// --------------------------------------------------------------------------- - -void CMemStatePopupImpl::NullifyResults( ) - { - // Set all results to zero - if( iScanResults ) - { - TInt count( iScanResults->Count( ) ); - for( TInt t = 0; t < count; t++ ) - { - ( *iScanResults )[ t ] = 0; - } - } - } - -// --------------------------------------------------------------------------- - -void CMemStatePopupImpl::OpenResourceAndReadArrayL( ) - { - // Open dll resource - - TParse* fp = new(ELeave) TParse(); - fp->Set(KDirAndFile, &KDC_RESOURCE_FILES_DIR, NULL); - TFileName fileName( fp->FullName() ); - delete fp; - - BaflUtils::NearestLanguageFile( iCoeEnv.FsSession( ), - fileName ); - iResLoader.OpenL( fileName ); - - // Read localised unit texts from resource - TResourceReader reader; - iCoeEnv.CreateResourceReaderLC( reader, R_ARRAY_UNITS ); - CDesCArrayFlat* units = reader.ReadDesCArrayL( ); - CleanupStack::PushL( units ); - iUtil = CMSPUtil::NewL( units ); // Give the array to the util class - CleanupStack::Pop( units ); - CleanupStack::PopAndDestroy(); // Private HBufC8* variable - // of CreateResourceReaderLC() - } - -// --------------------------------------------------------------------------- -void CMemStatePopupImpl::RunL() - { - TVolumeInfo volInfo; - TInt err = iCoeEnv.FsSession().Volume( volInfo, iDrive ); - if(err != KErrNone) - { - iPopup->CancelPopup( ); - } - else - { - StartObserver(); - } - } - -// --------------------------------------------------------------------------- -void CMemStatePopupImpl::DoCancel() - { - iCoeEnv.FsSession().NotifyChangeCancel(); - } - -// --------------------------------------------------------------------------- -void CMemStatePopupImpl::StartObserver() - { - if ( IsActive() ) - { - Cancel(); - } - iCoeEnv.FsSession().NotifyChange( ENotifyDisk, iStatus ); - SetActive(); - } - -// End of File diff -r 95243422089a -r 491b3ed49290 group/bld.inf --- a/group/bld.inf Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2006-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: Master blf for files -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -PRJ_MMPFILES - -#include "../deviceencryption/group/bld.inf" -#include "../files_plat/group/bld.inf" -#include "../filemanager/group/bld.inf" -#include "../filesystemuis/group/bld.inf" - - -PRJ_TESTMMPFILES - -// End of File diff -r 95243422089a -r 491b3ed49290 layers.sysdef.xml --- a/layers.sysdef.xml Thu Aug 19 09:42:45 2010 +0300 +++ b/layers.sysdef.xml Tue Aug 31 15:06:05 2010 +0300 @@ -1,14 +1,25 @@ - ]> - + + + + + + + - - + + + + + + + - + \ No newline at end of file diff -r 95243422089a -r 491b3ed49290 sysdef_1_4_0.dtd --- a/sysdef_1_4_0.dtd Thu Aug 19 09:42:45 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 95243422089a -r 491b3ed49290 sysdef_1_5_1.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_5_1.dtd Tue Aug 31 15:06:05 2010 +0300 @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file