# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1263838181 -7200 # Node ID 6a9f87576119b0604ce6b5d3b654c1618df5955f Revision: 201001 Kit: 201003 diff -r 000000000000 -r 6a9f87576119 deviceencryption/DevEncDmAdapter/data/DevEncUiDmAdapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncDmAdapter/data/DevEncUiDmAdapter.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncDmAdapter/group/DevEncUiDmAdapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncDmAdapter/group/DevEncUiDmAdapter.mmp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncDmAdapter/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncDmAdapter/group/bld.inf Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,35 @@ +/* +* 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncDmAdapter/inc/DevEncAdapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncDmAdapter/inc/DevEncAdapter.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,450 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncDmAdapter/inc/DevEncUids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncDmAdapter/inc/DevEncUids.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncDmAdapter/sis/DevEncDmAdapter.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncDmAdapter/sis/DevEncDmAdapter.pkg Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,39 @@ +; +; 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncDmAdapter/src/DevEncAdapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncDmAdapter/src/DevEncAdapter.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,1084 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncDmAdapter/src/DevEncAdapterImp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncDmAdapter/src/DevEncAdapterImp.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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: 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncGsPlugin/data/200255CF.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncGsPlugin/data/200255CF.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncGsPlugin/data/devencgspluginrsc.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncGsPlugin/data/devencgspluginrsc.rss Mon Jan 18 20:09:41 2010 +0200 @@ -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: 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncGsPlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncGsPlugin/group/bld.inf Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncGsPlugin/group/devencgsplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncGsPlugin/group/devencgsplugin.mmp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncGsPlugin/group/devencgspluginexports.inc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncGsPlugin/group/devencgspluginexports.inc Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,12 @@ + +// 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncGsPlugin/group/qgn_prop_cp_devenc.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncGsPlugin/group/qgn_prop_cp_devenc.svg Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,52 @@ + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 6a9f87576119 deviceencryption/DevEncGsPlugin/inc/devencgsplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncGsPlugin/inc/devencgsplugin.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncGsPlugin/loc/devencgsplugin.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncGsPlugin/loc/devencgsplugin.loc Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,30 @@ +/* +* 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncGsPlugin/src/devencgsplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncGsPlugin/src/devencgsplugin.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,301 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 +#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 000000000000 -r 6a9f87576119 deviceencryption/DevEncGsPlugin/src/devencgspluginImplementationTable.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncGsPlugin/src/devencgspluginImplementationTable.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncNotifPlugin/data/20002672.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncNotifPlugin/data/20002672.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncNotifPlugin/data/DevEncNotifPlugin.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncNotifPlugin/data/DevEncNotifPlugin.rss Mon Jan 18 20:09:41 2010 +0200 @@ -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: 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncNotifPlugin/group/DevEncNotifPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncNotifPlugin/group/DevEncNotifPlugin.mmp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncNotifPlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncNotifPlugin/group/bld.inf Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncNotifPlugin/inc/DevEncPasswdDlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncNotifPlugin/inc/DevEncPasswdDlg.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncNotifPlugin/src/DevEncNotifPluginImp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncNotifPlugin/src/DevEncNotifPluginImp.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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: 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncNotifPlugin/src/DevEncPasswdDlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncNotifPlugin/src/DevEncPasswdDlg.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/aif/DevEncUi_aif.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/aif/DevEncUi_aif.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/data/DevEncUi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/data/DevEncUi.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,857 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/data/DevEncUi_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/data/DevEncUi_reg.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/group/DevEncUi.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/group/DevEncUi.mmp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/group/bld.inf Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/group/qgn_menu_encryption.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/group/qgn_menu_encryption.svg Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,52 @@ + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUi.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUi.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUi.pan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUi.pan Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiApplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiApplication.h Mon Jan 18 20:09:41 2010 +0200 @@ -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: 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiAppui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiAppui.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,222 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiConfig.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiConfig.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiContainerEventCallback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiContainerEventCallback.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiCreateKeyProcess.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiCreateKeyProcess.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiDecrView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiDecrView.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiDecrViewContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiDecrViewContainer.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiDef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiDef.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiDocument.h Mon Jan 18 20:09:41 2010 +0200 @@ -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: 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiEncrView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiEncrView.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiEncrViewContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiEncrViewContainer.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiEncryptionOperator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiEncryptionOperator.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,178 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiFileManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiFileManager.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiLog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiLog.h Mon Jan 18 20:09:41 2010 +0200 @@ -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: 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiMainView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiMainView.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiMainViewContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiMainViewContainer.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiMemInfoObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiMemInfoObserver.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiMemoryEntity.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiMemoryEntity.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,187 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiSecretMinMaxCodeQuery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiSecretMinMaxCodeQuery.h Mon Jan 18 20:09:41 2010 +0200 @@ -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: +* +*/ + +#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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiSettingItemList.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiSettingItemList.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiTimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiTimer.h Mon Jan 18 20:09:41 2010 +0200 @@ -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: +* +*/ + +#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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/inc/DevEncUiUids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/inc/DevEncUiUids.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/loc/devenc.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/loc/devenc.loc Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,354 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/rom/DevEncUi.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/rom/DevEncUi.iby Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/sis/DevEncUi.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/sis/DevEncUi.pkg Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,37 @@ +; +; 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUi.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiApplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiApplication.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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: 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiAppui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiAppui.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,565 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiCreateKeyProcess.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiCreateKeyProcess.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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: 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiDecrView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiDecrView.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiDecrViewContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiDecrViewContainer.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,244 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 EEventItemDoubleClicked: // 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiDocument.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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: 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiEncrView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiEncrView.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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: 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiEncrViewContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiEncrViewContainer.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,250 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 EEventItemDoubleClicked: // 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiEncryptionOperator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiEncryptionOperator.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,1349 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiFileManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiFileManager.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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: 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiLog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiLog.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiMainView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiMainView.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,441 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiMainViewContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiMainViewContainer.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,564 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiMemoryEntity.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiMemoryEntity.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,535 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiSecretMinMaxCodeQuery.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiSecretMinMaxCodeQuery.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiSettingItemList.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiSettingItemList.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,241 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 == EEventItemDoubleClicked ) + { + 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 000000000000 -r 6a9f87576119 deviceencryption/DevEncUi/src/DevEncUiTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/DevEncUi/src/DevEncUiTimer.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/common/DevEnc.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/common/DevEnc.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/common/DevEncConfig.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/common/DevEncConfig.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/common/DevEncDef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/common/DevEncDef.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/common/DevEncLog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/common/DevEncLog.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/common/DevEncLog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/common/DevEncLog.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/common/DevEncUids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/common/DevEncUids.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/group/bld.inf Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/help/data/xhtml.zip Binary file deviceencryption/help/data/xhtml.zip has changed diff -r 000000000000 -r 6a9f87576119 deviceencryption/help/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/help/group/bld.inf Mon Jan 18 20:09:41 2010 +0200 @@ -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: +* 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 000000000000 -r 6a9f87576119 deviceencryption/help/inc/devenc.hlp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/help/inc/devenc.hlp.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -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: +* +*/ + +// +// 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 000000000000 -r 6a9f87576119 deviceencryption/help/rom/deviceencryptionhelps_variant.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/help/rom/deviceencryptionhelps_variant.iby Mon Jan 18 20:09:41 2010 +0200 @@ -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: +* +*/ + +#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 000000000000 -r 6a9f87576119 deviceencryption/layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/layers.sysdef.xml Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,14 @@ + + +]> + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r 6a9f87576119 deviceencryption/rom/DevEnc.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/rom/DevEnc.iby Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/rom/DevEncResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/rom/DevEncResources.iby Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 deviceencryption/sis/DevEnc.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/sis/DevEnc.pkg Mon Jan 18 20:09:41 2010 +0200 @@ -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: +; +; 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 000000000000 -r 6a9f87576119 deviceencryption/sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceencryption/sysdef_1_4_0.dtd Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 6a9f87576119 filemanager/Aif/FileManageraif.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Aif/FileManageraif.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,30 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Aif/icon44.bmp Binary file filemanager/Aif/icon44.bmp has changed diff -r 000000000000 -r 6a9f87576119 filemanager/Aif/icon44m.bmp Binary file filemanager/Aif/icon44m.bmp has changed diff -r 000000000000 -r 6a9f87576119 filemanager/App/data/FileManager.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/data/FileManager.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,1514 @@ +/* +* 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 "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; + }, + MENU_ITEM + { + command = EFileManagerDisconnectRemoveDrive; + txt = qtn_rd_opt_disconnect; + }, + MENU_ITEM + { + command = EFileManagerEject; + txt = qtn_fmgr_options_eject; + }, +#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 = 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; + flags = EEikMenuItemSpecific; + }, + MENU_ITEM + { + command = EFileManagerDisconnectRemoveDrive; + txt = qtn_rd_opt_disconnect; + flags = EEikMenuItemSpecific; + }, + MENU_ITEM + { + command = EFileManagerRefreshRemoteDrive; + txt = qtn_fmgr_rd_opt_refresh; + flags = EEikMenuItemSpecific; + }, + 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 = 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 = 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 = 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 = EFileManagerRemoveDrivesMapDrive; + txt = qtn_fmgr_opt_rd_new_drive; + 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; } +// End of File diff -r 000000000000 -r 6a9f87576119 filemanager/App/data/FileManager_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/data/FileManager_reg.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/data/filemanager_caption.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/data/filemanager_caption.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,41 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerAppUi.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,409 @@ +/* +* 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 "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(); + + 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; + }; + +#endif // CFILEMANAGERAPPUI_H + +// End of File diff -r 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerApplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerApplication.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,67 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerBackupView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerBackupView.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,177 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerContainerBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerContainerBase.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,270 @@ +/* +* 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); + + 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 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerDocument.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,143 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerFileListContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerFileListContainer.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,198 @@ +/* +* 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 ); + + 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 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerFileSelectionFilter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerFileSelectionFilter.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,50 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerFoldersView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerFoldersView.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,186 @@ +/* +* 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; + // Own: Indicate USB storage was removed + TBool usbWrongRemoved; + + }; + +#endif // CFILEMANAGERFOLDERSVIEW_H + +// End of File diff -r 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerMainView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerMainView.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,197 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerMemoryStoreView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerMemoryStoreView.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,125 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerRestoreView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerRestoreView.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,168 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerSchBackupHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerSchBackupHandler.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,154 @@ +/* +* 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(); + +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 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerSettingListContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerSettingListContainer.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,88 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerStringCache.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerStringCache.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,145 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerTaskScheduler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerTaskScheduler.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,90 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/inc/CFileManagerViewBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/CFileManagerViewBase.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,705 @@ +/* +* 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 ); + + + 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 000000000000 -r 6a9f87576119 filemanager/App/inc/Cfilemanagersearchresultsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/Cfilemanagersearchresultsview.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,121 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/inc/FileManager.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/FileManager.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -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: 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 000000000000 -r 6a9f87576119 filemanager/App/inc/MFileManagerSchBackupObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/inc/MFileManagerSchBackupObserver.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,50 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerAppUi.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,1301 @@ +/* +* 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 "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 ); + } + +// ----------------------------------------------------------------------------- +// 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(); + +#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 ); + + //Fix for EDMO-7JMH7V + //File manager:The phone displays "no data" in File manager + //when cancel installing ".sis" file + 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 ); + } + +// ----------------------------------------------------------------------------- +// 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 ); + } + +// ------------------------------------------------------------------------------ +// 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; + } + +// End of File + diff -r 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerApplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerApplication.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,93 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerBackupView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerBackupView.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,559 @@ +/* +* 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 + + if ( iContainer ) + { + iContainer->RefreshListL( iIndex ); + } + } + +// ---------------------------------------------------------------------------- +// 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; + } + StoreIndex(); + CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); + TInt drive( settings.TargetDrive() ); + TInt MemoryCardDriveF( KFmgrMemoryCardDrive + 1 ); + //KFmgrMemoryCardDrive has been changed as Mass memory,MemoryCard is changed to F + + if( drive != MemoryCardDriveF && !IsDriveAvailable( drive ) ) + { + drive = MemoryCardDriveF; + settings.SetTargetDrive( drive ); + settings.SaveL(); + } + TFileManagerDriveInfo drvInfo; + iEngine.GetDriveInfoL( drive, drvInfo ); + 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 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerContainerBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerContainerBase.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,582 @@ +/* +* 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 ); + } + +// End of File diff -r 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerDocument.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,262 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerFileListContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerFileListContainer.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,863 @@ +/* +* 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" + + +// 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 ); + + response = ListBox().OfferKeyEventL( aKeyEvent, aType ); + /* if ( response == EKeyWasConsumed ) + { + return response; + }*/ + switch( aKeyEvent.iCode ) + { + case EKeyEnter: // FALLTHROUH + case EKeyOK: + { + /* indexOfMSK++; + iAppUi->ProcessCommandL( EFileManagerSelectionKey ); + response = EKeyWasConsumed;*/ + break; + } + case EKeyDelete: // FALLTHROUGH + case EKeyBackspace: + { + 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 ); + } + +// End of File diff -r 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerFileSelectionFilter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerFileSelectionFilter.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,69 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerFoldersView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerFoldersView.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,485 @@ +/* +* 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 +#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(); + } + TInt usb_err(KErrNone); + TRAP( usb_err,RefreshDriveInfoL() ); + if (usb_err != KErrNone) + { + usbWrongRemoved = ETrue; + HBufC* error = StringLoader::LoadLC(R_QTN_SELEC_EMPTY_LIST); + + if (iContainer) + { + iContainer->ListBoxSetTextL(*error); + } + CleanupStack::PopAndDestroy(error); + } + else + { + TFileManagerDriveInfo& drvInfo( DriveInfo() ); + if ( !( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) ) + { + //User::Leave(KErrPathNotFound); + HBufC* error = StringLoader::LoadLC(R_QTN_SELEC_EMPTY_LIST); + + if (iContainer) + { + iContainer->ListBoxSetTextL(*error); + } + CleanupStack::PopAndDestroy(error); + } + else + { + usbWrongRemoved = EFalse; + 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 ( usbWrongRemoved ) + { + CFileManagerAppUi* appUi = static_cast (AppUi()); + usbWrongRemoved = EFalse; + iFolderDepth = 0; + iIndex = 0; + appUi->CloseFoldersViewL(); + } + else + { + 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 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerMainView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerMainView.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,924 @@ +/* +* 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; + } + + if ( !FeatureManager().IsRemoteStorageFwSupported() ) + { + aMenuPane.SetItemDimmed( EFileManagerRemoveDrives, ETrue ); + } + + 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 ); + } + 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 ); + } + } + +#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 + + 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 ); + iEngine.SetObserver( this ); + iEngine.RefreshDirectory(); + } + +// ------------------------------------------------------------------------------ +// 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 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerMemoryStoreView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerMemoryStoreView.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,351 @@ +/* +* 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() ); + TInt usb_err( KErrNone ); + if ( drvInfo.iState & ( + TFileManagerDriveInfo::EDriveRemovable | + TFileManagerDriveInfo::EDriveRemote ) ) + { + TRAP( usb_err , RefreshDriveInfoL() ); + } + if( usb_err != KErrNone ) + { + error = StringLoader::LoadLC( R_QTN_MEMC_MAINPAGE_ERROR1 ); + } + + 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 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerRestoreView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerRestoreView.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,427 @@ +/* +* 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; + } + 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 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerSchBackupHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerSchBackupHandler.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,406 @@ +/* +* 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() + { + TBool drvAvailable( ETrue ); + TRAPD( err, drvAvailable = IsTargetDriveAvailableL() ); + if ( !drvAvailable && err == KErrNone ) + { + iGlobalDlg->ShowDialogL( + CFileManagerGlobalDlg::EQueryWithWarningIcon, + R_QTN_FMGR_SCHEDULED_BACKUP_ERROR, + R_AVKON_SOFTKEYS_OK_EMPTY ); + CancelBackupStarter(); + return; + } + + CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); + 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() + { + // Start backup with cancelable global progress dialog + CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); + + // Check is target drive available + TBool ret( ETrue ); + TFileManagerDriveInfo info; + iEngine.GetDriveInfoL( settings.TargetDrive(), info ); + if ( !( info.iState & TFileManagerDriveInfo::EDrivePresent ) || + ( info.iState & + ( TFileManagerDriveInfo::EDriveLocked | + TFileManagerDriveInfo::EDriveCorrupted | + TFileManagerDriveInfo::EDriveWriteProtected ) ) ) + { + ERROR_LOG1( + "CFileManagerSchBackupHandler::IsTargetDriveAvailableL-DrvState=%d", + info.iState ) + ret = EFalse; + } + return ret; + } + +// End of File diff -r 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerSettingListContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerSettingListContainer.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,287 @@ +/* +* 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_mmc_add, + EMbmFilemanagerQgn_indi_mmc_add_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 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerStringCache.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerStringCache.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,479 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerTaskScheduler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerTaskScheduler.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,184 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/App/src/CFileManagerViewBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/CFileManagerViewBase.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,5121 @@ +/* +* 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 + + +// ============================ 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 + sendUi.ShowQueryAndSendL( msgData, caps, servicesToDim ); + CleanupStack::PopAndDestroy( servicesToDim ); + } + CleanupStack::PopAndDestroy( files ); + CleanupStack::PopAndDestroy( msgData ); + + iSendUiPopupOpened = EFalse; + } + +// ----------------------------------------------------------------------------- +// CFileManagerViewBase::MarkMenuFilteringL +// +// ----------------------------------------------------------------------------- +// +void CFileManagerViewBase::MarkMenuFilteringL( CEikMenuPane& aMenuPane ) + { + TInt index( iContainer->ListBoxCurrentItemIndex() ); + if ( iContainer->ListBoxIsItemSelected( index ) ) + { + aMenuPane.SetItemDimmed( EFileManagerMarkOne, ETrue ); + } + else + { + aMenuPane.SetItemDimmed( EFileManagerUnmarkOne, ETrue ); + } + + if ( iEngine.IsFolder( index ) ) + { + aMenuPane.SetItemDimmed( EFileManagerMarkOne, ETrue ); + aMenuPane.SetItemDimmed( EFileManagerUnmarkOne, ETrue ); + aMenuPane.SetItemDimmed( EFileManagerMarkAll, ETrue ); + } + + TInt 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 ) + { + DeleteItemsL( index ); + } + 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: + { + RefreshDriveInfoL(); + if ( aError == KErrNone ) + { +#ifdef RD_MULTIPLE_DRIVE + if ( DriveInfo().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(); + } + } + + 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/1024 ); + } + } + +// ------------------------------------------------------------------------------ +// 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 ); + + 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; + } + + /* Codes below will cause trouble for large amount file selection + if ( !dimSend ) + { + // Check if there are files to send + TInt dummy( 0 ); + CArrayFixFlat< TInt >* files = GetSendFilesLC( dummy ); + if ( !files->Count() ) + { + dimSend = ETrue; + } + CleanupStack::PopAndDestroy( files ); + } + */ + + // 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::EDriveRemote ) && + !( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected ) ) + { + // Handle disconnected remote drive + dimSend = ETrue; + } + } + else if ( iContainer->ListBoxNumberOfItems() ) + { + // 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( EFileManagerMark, ETrue ); + aMenuPane.SetItemDimmed( EFileManagerRename, ETrue ); + } + else if ( fileType & CFileManagerItemProperties::EFolder ) + { + dimSend = ETrue; + aMenuPane.SetItemDimmed( EFileManagerMark, 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() ); + + 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 ); + } + + // 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 ); + } + + TInt index(iContainer->ListBoxCurrentItemIndex()); + TUint32 fileType(iEngine.FileTypeL(index)); + if (!(fileType & CFileManagerItemProperties::EFolder)) + { + aMenuPane.SetItemDimmed(EFileManagerMoveToFolder, 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 + { + FileManagerDlgUtils::ShowErrorNoteL( resWrong ); + } + } + 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/1024 ) ); + iProgressInfo->SetAndDraw( static_cast( aInitialValue/1024 ) ); + } + 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 ), + ETrue ); + 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; + iProgressCurrentValue = iProgressInfo->CurrentValue(); + 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::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::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 000000000000 -r 6a9f87576119 filemanager/App/src/Cfilemanagersearchresultsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/App/src/Cfilemanagersearchresultsview.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,239 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/BWINS/FILEMANAGERENGINEU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/BWINS/FILEMANAGERENGINEU.DEF Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,140 @@ +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) + diff -r 000000000000 -r 6a9f87576119 filemanager/BWINS/FILEMANAGERVIEWU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/BWINS/FILEMANAGERVIEWU.DEF Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,51 @@ +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 000000000000 -r 6a9f87576119 filemanager/BWINS/GFLMU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/BWINS/GFLMU.DEF Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,54 @@ +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 000000000000 -r 6a9f87576119 filemanager/BWINS/filemanagerbkupengineU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/BWINS/filemanagerbkupengineU.DEF Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,36 @@ +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 000000000000 -r 6a9f87576119 filemanager/EABI/FileManagerEngineU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/EABI/FileManagerEngineU.DEF Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,148 @@ +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 + diff -r 000000000000 -r 6a9f87576119 filemanager/EABI/FileManagerViewU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/EABI/FileManagerViewU.DEF Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,63 @@ +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 000000000000 -r 6a9f87576119 filemanager/EABI/GFLMU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/EABI/GFLMU.DEF Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,68 @@ +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 000000000000 -r 6a9f87576119 filemanager/EABI/filemanagerbkupengineU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/EABI/filemanagerbkupengineU.DEF Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,52 @@ +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 000000000000 -r 6a9f87576119 filemanager/Engine/data/FileManagerEngine.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/data/FileManagerEngine.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,590 @@ +/* +* 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 + 0x10282475, // Java Registry 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 + 0x10282475, // Java Registry 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; } + +// End of File diff -r 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerActiveBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerActiveBase.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,105 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerActiveExecute.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerActiveExecute.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,284 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerActiveRename.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerActiveRename.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,96 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerBackupSettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerBackupSettings.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,320 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerCommonDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerCommonDefinitions.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,41 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerDocHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerDocHandler.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,135 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerEngine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerEngine.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,897 @@ +/* +* 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; + + /** + * 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(); + + 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(); + + 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; + }; + +#endif // CFILEMANAGERENGINE_H + +// End of File diff -r 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerFeatureManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerFeatureManager.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,121 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerFileSystemIterator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerFileSystemIterator.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,120 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerFolderEntry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerFolderEntry.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,119 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerIRReceiver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerIRReceiver.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,203 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerItemFilter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerItemFilter.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,107 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerItemProperties.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerItemProperties.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,307 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerPropertySubscriber.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerPropertySubscriber.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,81 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerRefresher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerRefresher.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,107 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerRemoteDriveHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerRemoteDriveHandler.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,150 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerRemovableDriveHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerRemovableDriveHandler.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,309 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerRestoreSettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerRestoreSettings.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,146 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerThreadWrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerThreadWrapper.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,155 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFileManagerUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFileManagerUtils.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,409 @@ +/* +* 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 IsDrmProtectedFile( 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFilemanagerActiveCount.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFilemanagerActiveCount.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,136 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/CFilemanagerMimeIconArray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/CFilemanagerMimeIconArray.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,106 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/Cfilemanageractivedelete.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/Cfilemanageractivedelete.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,207 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/Cfilemanageractivesize.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/Cfilemanageractivesize.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,107 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/Cfilemanagerfilesystemevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/Cfilemanagerfilesystemevent.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,127 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/Cfilemanagerfolderarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/Cfilemanagerfolderarray.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,121 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/Cfilemanagerindexiterator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/Cfilemanagerindexiterator.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,98 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/FileManagerDebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/FileManagerDebug.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,179 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/FileManagerEngine.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/FileManagerEngine.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,98 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/FileManagerEngine.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/FileManagerEngine.rh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,51 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/FileManagerPrivateCRKeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/FileManagerPrivateCRKeys.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,109 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/FileManagerSchDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/FileManagerSchDefinitions.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,30 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/MFileManagerProcessObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/MFileManagerProcessObserver.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,159 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/MFileManagerPropertyObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/MFileManagerPropertyObserver.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,48 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/MFileManagerThreadFunction.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/MFileManagerThreadFunction.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,89 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/Mfilemanageritemiterator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/Mfilemanageritemiterator.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,63 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/TFileManagerDriveInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/TFileManagerDriveInfo.h Mon Jan 18 20:09:41 2010 +0200 @@ -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: 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 000000000000 -r 6a9f87576119 filemanager/Engine/inc/filemanagerprivatepskeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/inc/filemanagerprivatepskeys.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,46 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerActiveBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerActiveBase.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,137 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerActiveExecute.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerActiveExecute.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,1178 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerActiveRename.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerActiveRename.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,205 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerBackupSettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerBackupSettings.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,217 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerBackupSettingsFull.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerBackupSettingsFull.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,679 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerDocHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerDocHandler.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,360 @@ +/* +* 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 file open is denied + if ( iObserver && iFileFullPath ) + { + 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerEngine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerEngine.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,2221 @@ +/* +* 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 TInt KMGFileArrayGranularity = 32; + + +// ============================ 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 ) + { + 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; + } + +// ----------------------------------------------------------------------------- +// 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 = '.'; + TInt nameLen( aName.Length() ); + if ( !nameLen ) + { + return EFalse; + } + for ( TInt i( 0 ); i < nameLen; i++ ) + { + TUint16 ch( aName[ 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 ( aName[ nameLen - 1 ] == KDot || IllegalChars( aName ) ) + { + 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( aName ); + 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::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() ) + { + 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 ); + } + } + } + } + +// ------------------------------------------------------------------------------ +// 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 += static_cast(fsItem->Entry().iSize); + 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(); + } + + +// End of File diff -r 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerFeatureManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerFeatureManager.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,182 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerFileSystemIterator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerFileSystemIterator.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,245 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerFolderEntry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerFolderEntry.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,175 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerIRReceiver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerIRReceiver.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,604 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerItemFilter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerItemFilter.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,297 @@ +/* +* 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 ) + { + if ( !( driveStatus & DriveInfo::EDrivePresent ) ) + { + ERROR_LOG( "CFileManagerItemFilter::FilterItemL()-NotPresentUsbMemory" ) + return EFalse; // Not present USB drive is not shown + } + 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerItemProperties.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerItemProperties.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,602 @@ +/* +* 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 ); + 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerPropertySubscriber.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerPropertySubscriber.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,120 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerRefresher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerRefresher.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,202 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerRemoteDriveHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerRemoteDriveHandler.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,252 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerRemovableDriveHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerRemovableDriveHandler.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,1371 @@ +/* +* 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 ) + { + 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 ); + } + +// --------------------------------------------------------------------------- +// 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() + { + RDebug::Printf(">> CFileManagerRemovableDriveHandler::StartFormatProcessL() 1 "); + // 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() ); + RDebug::Printf(">> CFileManagerRemovableDriveHandler::StartFormatProcessL() 2"); + // Resolve drive character and open formatter + iFormatter.Close(); + RDebug::Printf(">> CFileManagerRemovableDriveHandler::StartFormatProcessL() 2.1"); + err = iFormatter.Open( + iFs, driveName, EFullFormat, iFinalValue ); + RDebug::Printf(">> CFileManagerRemovableDriveHandler::StartFormatProcessL() 2.2 RFormat::Open full err=%d", err); + + // Forced format for locked card + if ( err == KErrLocked ) + { + // Erase password and try again + err = iFs.ErasePassword( iDrive ); + INFO_LOG1( "FileManagerRemovableDriveHandler::StartFormatProcessL-ErasePassword result=%d", err); + + if (err == KErrNone) + { + err = iFormatter.Open(iFs, driveName, EFullFormat , iFinalValue ); + RDebug::Printf(">> CFileManagerRemovableDriveHandler::StartFormatProcessL() RFormat::Open again err=%d", err); + } + } + + if (err == KErrInUse) + { + RDebug::Printf(">> CFileManagerRemovableDriveHandler::StartFormatProcessL KErrInUse try force format err=%d", err); + + // There are still files open on the drive being formatted, prompt the user to + // ask if they want to format anyway. + // + // formatting. + //TBool reallyFormat = FileManagerDlgUtils::ShowConfirmQueryWithYesNoL(_L("There are files open on this drive, continue with format?")); + TBool reallyFormat = ETrue; // TEMP! - should ask the user to confirm Yes / No + + if (reallyFormat) + { + // Open the RFormat sub-session with force format flags + RDebug::Printf( "FileManagerRemovableDriveHandler::StartFormatProcessL-******force format*****"); + err = iFormatter.Open( + iFs, driveName, EFullFormat | EForceFormat, iFinalValue ); + RDebug::Printf( "FileManagerRemovableDriveHandler::StartFormatProcessL-******force format***** err = %d", err); + } + } + + // By the time we get here, one of three things could have happened: + // 1. RFormat has been opened with standard full format flag with no error + // 2. Some other app still has files opened so full format cannot be used. + // A second attempt has been made to open the format sub-session with + // full format flags and this has succeeded. + // 3. As 2 but for some other reason (corrupt card perhaps?), force format + // does not work in which case abort format. + + + TFullName fsName; + if (err == KErrNone) + { + err = iFs.FileSystemName( fsName, iDrive ); + + RDebug::Printf( "FileManagerRemovableDriveHandler::StartFormatProcessL-fsName=%S, result=%d", + &fsName, err ); + + 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 ) + { + RDebug::Printf(">> CFileManagerRemovableDriveHandler::StartFormatProcessL() RFormat::Next err = %d, tracks left=%d", err, iFinalValue); + iFormatCountBuf = iFinalValue; + iFormatter.Next( iFormatCountBuf, iStatus ); + SetActive(); + } + } + if ( !iFinalValue || err != KErrNone ) + { + RDebug::Printf(">> CFileManagerRemovableDriveHandler::StartFormatProcessL() 6 err = %d", err); + EndFormatProcessL( err ); + RDebug::Printf(">> CFileManagerRemovableDriveHandler::StartFormatProcessL() 7 err = %d", err); + } + RDebug::Printf("<< CFileManagerRemovableDriveHandler::StartFormatProcessL() 8 err=%d", 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerRestoreSettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerRestoreSettings.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,113 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerRestoreSettingsFull.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerRestoreSettingsFull.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,294 @@ +/* +* 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; + iEngine.GetRestoreInfoArrayL( infoArray ); + CleanupClosePushL( 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 + { + aInfoArray.Reset(); + + TInt count( iList.Count() ); + + for ( TInt i( 0 ); i < count; ++i ) + { + if ( ( ( ( TUint64 ) 1 ) << i ) & iSelection ) + { + aInfoArray.AppendL( iList[ i ]->iInfo ); + } + } + } + +// ---------------------------------------------------------------------------- +// 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerThreadWrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerThreadWrapper.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,408 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFileManagerUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFileManagerUtils.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,1121 @@ +/* +* 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::IsDrmProtectedFile( 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; + + User::LeaveIfError( drmFile.Open( + iFs, aFullPath, EFileRead | EFileShareReadersOrWriters ) ); + CleanupClosePushL( drmFile ); + DRM::CDrmUtility *drmCheck = DRM::CDrmUtility::NewLC(); + + TBool isProtected( EFalse ); + if ( drmCheck->IsProtectedL(drmFile) ) + { + isProtected = ETrue; + } + 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 ( IsDrmProtectedFile( 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; + if ( IsDrmProtectedFile( aFullPath) ) + { + fileType |= CFileManagerItemProperties::EDrmProtected; + } + } + } + + 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 ); + + if(array->MdcaCount() > 1 ) + { + TPtrC16 drivename=array->MdcaPoint( KDriveNameIndex ); + usbLetterName->AppendL( drivename ); + } + else + { + TPtrC16 drivename=_L(""); + usbLetterName->AppendL( drivename ); + } + + + ret = StringLoader::LoadL( + aTextIdForDefaultName,*usbLetterName ); + + CleanupStack::PopAndDestroy( usbLetterName ); + } + 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CFilemanagerMimeIconArray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CFilemanagerMimeIconArray.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,177 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CfilemanagerActiveCount.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CfilemanagerActiveCount.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,236 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/CfilemanageractiveDelete.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/CfilemanageractiveDelete.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,467 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/Cfilemanageractivesize.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/Cfilemanageractivesize.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,140 @@ +/* +* 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.iSize; + ++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 000000000000 -r 6a9f87576119 filemanager/Engine/src/Cfilemanagerfilesystemevent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/Cfilemanagerfilesystemevent.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,188 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/Cfilemanagerfolderarray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/Cfilemanagerfolderarray.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,356 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/Cfilemanagerindexiterator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/Cfilemanagerindexiterator.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,125 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/Engine/src/TFileManagerDriveInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/Engine/src/TFileManagerDriveInfo.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,319 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/data/GflmFileExtensionMimeTypes.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/data/GflmFileExtensionMimeTypes.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,98 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/CGflmDirectoryListingCache.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/CGflmDirectoryListingCache.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,126 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/CGflmDriveItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/CGflmDriveItem.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,159 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/CGflmDriveResolver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/CGflmDriveResolver.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,147 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/CGflmFileFinder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/CGflmFileFinder.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,157 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/CGflmFileFinderItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/CGflmFileFinderItem.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,92 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/CGflmFileListModel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/CGflmFileListModel.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,355 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/CGflmFileRecognizer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/CGflmFileRecognizer.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,174 @@ +/* +* 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 ); + + 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/CGflmFileSystemItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/CGflmFileSystemItem.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,152 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/CGflmGlobalActionItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/CGflmGlobalActionItem.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,99 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/CGflmGroupItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/CGflmGroupItem.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,219 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/CGflmItemGroupImpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/CGflmItemGroupImpl.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,168 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/CGflmItemLocalizer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/CGflmItemLocalizer.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,113 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/CGflmNavigatorModel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/CGflmNavigatorModel.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,144 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/GFLM.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/GFLM.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,60 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/GFLMConsts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/GFLMConsts.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/GFLMUid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/GFLMUid.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/GflmFileExtensionMimeTypes.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/GflmFileExtensionMimeTypes.rh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,30 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/GflmUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/GflmUtils.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,137 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/MGflmItemFilter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/MGflmItemFilter.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,63 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/inc/MGflmItemGroup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/inc/MGflmItemGroup.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,106 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/src/CGflmDirectoryListingCache.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/src/CGflmDirectoryListingCache.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,217 @@ +/* +* 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 ) ); + 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 000000000000 -r 6a9f87576119 filemanager/GFLM/src/CGflmDriveItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/src/CGflmDriveItem.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,222 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/src/CGflmDriveResolver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/src/CGflmDriveResolver.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,309 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/src/CGflmFileFinder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/src/CGflmFileFinder.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,408 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/src/CGflmFileFinderItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/src/CGflmFileFinderItem.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,166 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/src/CGflmFileListModel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/src/CGflmFileListModel.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,686 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/src/CGflmFileRecognizer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/src/CGflmFileRecognizer.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,436 @@ +/* +* 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 ) + { + // 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 ); + } + +// ----------------------------------------------------------------------------- +// 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::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 000000000000 -r 6a9f87576119 filemanager/GFLM/src/CGflmFileSystemItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/src/CGflmFileSystemItem.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,212 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/src/CGflmGlobalActionItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/src/CGflmGlobalActionItem.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,137 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/src/CGflmGroupItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/src/CGflmGroupItem.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,343 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/src/CGflmItemGroupImpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/src/CGflmItemGroupImpl.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,374 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/src/CGflmItemLocalizer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/src/CGflmItemLocalizer.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,136 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/src/CGflmNavigatorModel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/src/CGflmNavigatorModel.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,298 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/GFLM/src/GflmUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/GFLM/src/GflmUtils.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,174 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/data/FileManagerView.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/data/FileManagerView.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,740 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/CFileManagerCheckBoxSettingPage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/CFileManagerCheckBoxSettingPage.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,73 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/CFileManagerFileNameQueryDlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/CFileManagerFileNameQueryDlg.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,98 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/CFileManagerFullOmaDrmInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/CFileManagerFullOmaDrmInfo.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,100 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/CFileManagerGlobalDlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/CFileManagerGlobalDlg.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,224 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/CFileManagerGlobalQueryDlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/CFileManagerGlobalQueryDlg.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,151 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/CFileManagerIconArray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/CFileManagerIconArray.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,115 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/CFileManagerInfoPopup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/CFileManagerInfoPopup.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,149 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/CFileManagerMMCInfoPopup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/CFileManagerMMCInfoPopup.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,132 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/CFileManagerPopupBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/CFileManagerPopupBase.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,113 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/Cfilemanagerfoldernamequerydlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/Cfilemanagerfoldernamequerydlg.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,99 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/Cfilemanagerfoldernavigationpane.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/Cfilemanagerfoldernavigationpane.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,258 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/FileManagerDlgUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/FileManagerDlgUtils.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,389 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/FileManagerView.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/FileManagerView.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,32 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/FileManagerView.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/FileManagerView.rh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,74 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/MFileManagerFolderNaviObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/MFileManagerFolderNaviObserver.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,59 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/inc/MFileManagerGlobalDlgObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/inc/MFileManagerGlobalDlgObserver.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,52 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/src/CFileManagerCheckBoxSettingPage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/src/CFileManagerCheckBoxSettingPage.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,140 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/src/CFileManagerFileNameQueryDlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/src/CFileManagerFileNameQueryDlg.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,249 @@ +/* +* 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() ); + + // 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 != KErrAccessDenied ) + { + User::Leave( err ); + } + + if( ( fileType & ( CFileManagerItemProperties::EOpen | + CFileManagerItemProperties::EReadOnly | + CFileManagerItemProperties::EFolder ) ) || + ( err == KErrAccessDenied ) ) + { + 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 000000000000 -r 6a9f87576119 filemanager/View/src/CFileManagerFullOmaDrmInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/src/CFileManagerFullOmaDrmInfo.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,997 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/src/CFileManagerGlobalDlgFull.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/src/CFileManagerGlobalDlgFull.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,391 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/src/CFileManagerGlobalQueryDlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/src/CFileManagerGlobalQueryDlg.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,188 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/src/CFileManagerIconArray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/src/CFileManagerIconArray.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,273 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/src/CFileManagerInfoPopup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/src/CFileManagerInfoPopup.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,443 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/src/CFileManagerMMCInfoPopup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/src/CFileManagerMMCInfoPopup.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,232 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/src/CFileManagerPopupBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/src/CFileManagerPopupBase.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,236 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/src/Cfilemanagerfoldernamequerydlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/src/Cfilemanagerfoldernamequerydlg.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,271 @@ +/* +* 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 ); + + // 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 000000000000 -r 6a9f87576119 filemanager/View/src/Cfilemanagerfoldernavigationpane.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/src/Cfilemanagerfoldernavigationpane.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,622 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/View/src/FileManagerDlgUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/View/src/FileManagerDlgUtils.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,665 @@ +/* +* 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 = CFileManagerInfoPopup::NewL( + aProperties, aFeatureManager ); + 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 000000000000 -r 6a9f87576119 filemanager/aiwprovider/data/200110F8.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/aiwprovider/data/200110F8.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,51 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/aiwprovider/inc/filemanageraiwprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/aiwprovider/inc/filemanageraiwprovider.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,128 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/aiwprovider/src/filemanageraiwprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/aiwprovider/src/filemanageraiwprovider.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,443 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/bkupchecker/data/10205078.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupchecker/data/10205078.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,50 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/bkupchecker/data/filemanagerbkupchecker.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupchecker/data/filemanagerbkupchecker.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,56 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/bkupchecker/inc/filemanagerbkupchecker.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupchecker/inc/filemanagerbkupchecker.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,95 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/bkupchecker/inc/filemanagerbkupchecker.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupchecker/inc/filemanagerbkupchecker.rh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,30 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/bkupchecker/src/filemanagerbkupchecker.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupchecker/src/filemanagerbkupchecker.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,460 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/BKupEngine.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/BKupEngine.rh Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/BkupEngine.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/BkupEngine.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupArchive.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupArchive.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupArchiveDataManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupArchiveDataManager.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupArchiveFooter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupArchiveFooter.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupArchiveHeader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupArchiveHeader.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupArchiveInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupArchiveInfo.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupBufferManagers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupBufferManagers.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupDataOwnerCollection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupDataOwnerCollection.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupDataOwnerInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupDataOwnerInfo.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupDataStrategies.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupDataStrategies.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupDriveAndOperationTypeManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupDriveAndOperationTypeManager.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupDriveDataSizeManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupDriveDataSizeManager.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupDriveSpecificRequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupDriveSpecificRequest.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupEngine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupEngine.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,112 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupEngineImpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupEngineImpl.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,272 @@ +/* +* 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(); + +#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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupFileInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupFileInfo.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupFileListCollection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupFileListCollection.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupIndexActiveData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupIndexActiveData.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupIndexBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupIndexBase.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupIndexDataOwners.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupIndexDataOwners.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupIndexJavaData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupIndexJavaData.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupIndexPassiveData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupIndexPassiveData.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupIndexPublicDataFiles.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupIndexPublicDataFiles.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupIndexSystemData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupIndexSystemData.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupIndexWithIdentifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupIndexWithIdentifier.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupOperationParameters.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupOperationParameters.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,240 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupState.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupState.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpActiveData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpActiveData.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpArchiveFooter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpArchiveFooter.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpArchiveHeader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpArchiveHeader.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpDataOwners.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpDataOwners.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpJavaData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpJavaData.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpPassiveData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpPassiveData.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpPublicDataFiles.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpPublicDataFiles.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpSystemData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateArchiveOpSystemData.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateFactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateFactory.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateGetDataOwnerStatuses.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateGetDataOwnerStatuses.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateGetDataOwners.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateGetDataOwners.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateNotifyAllSnapshotsSupplied.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateNotifyAllSnapshotsSupplied.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateOpAware.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateOpAware.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateRequestListOfPublicFiles.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateRequestListOfPublicFiles.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateRequestSizeOfBackupData.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateRequestSizeOfBackupData.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateSetPhoneMode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateSetPhoneMode.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupStateValidateDiskSpace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupStateValidateDiskSpace.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupTransferReadRequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupTransferReadRequest.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupTransferRequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupTransferRequest.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/CMMCScBkupTransferWriteRequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/CMMCScBkupTransferWriteRequest.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/MMCScBkupArchiveFlags.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/MMCScBkupArchiveFlags.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/MMCScBkupArchiveUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/MMCScBkupArchiveUtils.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/MMCScBkupConfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/MMCScBkupConfig.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/MMCScBkupDllUids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/MMCScBkupDllUids.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 0x101F4667 + +#endif // __MMCSCBKUPDLLUIDS_H__ + +// End Of File diff -r 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/MMCScBkupLogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/MMCScBkupLogger.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/MMCScBkupOperations.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/MMCScBkupOperations.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/MMCScBkupPhoneModelUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/MMCScBkupPhoneModelUtils.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/MMCScBkupSBEUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/MMCScBkupSBEUtils.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/MMCScBkupStateIds.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/MMCScBkupStateIds.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/MMMCScBkupArchiveDataInterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/MMMCScBkupArchiveDataInterface.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/MMMCScBkupDriver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/MMMCScBkupDriver.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/MMMCScBkupEngineObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/MMMCScBkupEngineObserver.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/MMMCScBkupProgressObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/MMMCScBkupProgressObserver.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/RMMCScBkupArchiveStreams.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/RMMCScBkupArchiveStreams.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/RMMCScBkupPointerArray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/RMMCScBkupPointerArray.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/RMMCScBkupProgressSizer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/RMMCScBkupProgressSizer.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/TMMCScBkupArchiveVector.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/TMMCScBkupArchiveVector.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/TMMCScBkupDriveAndSize.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/TMMCScBkupDriveAndSize.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/TMMCScBkupDriveFilter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/TMMCScBkupDriveFilter.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/inc/TMMCScBkupOwnerDataType.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/inc/TMMCScBkupOwnerDataType.h Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupArchive.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupArchive.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupArchiveDataManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupArchiveDataManager.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupArchiveFooter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupArchiveFooter.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupArchiveHeader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupArchiveHeader.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupArchiveInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupArchiveInfo.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupBufferManagers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupBufferManagers.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupDataOwnerCollection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupDataOwnerCollection.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupDataOwnerInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupDataOwnerInfo.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupDataStrategies.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupDataStrategies.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupDriveAndOperationTypeManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupDriveAndOperationTypeManager.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,216 @@ +/* +* 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 + { + 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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupDriveSpecificRequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupDriveSpecificRequest.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupEngine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupEngine.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,157 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupEngineImpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupEngineImpl.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,1189 @@ +/* +* 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::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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupFileInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupFileInfo.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupFileListCollection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupFileListCollection.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupIndexActiveData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupIndexActiveData.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupIndexBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupIndexBase.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupIndexDataOwners.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupIndexDataOwners.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupIndexJavaData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupIndexJavaData.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupIndexPassiveData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupIndexPassiveData.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupIndexPublicDataFiles.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupIndexPublicDataFiles.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupIndexSystemData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupIndexSystemData.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupIndexWithIdentifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupIndexWithIdentifier.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupOperationParameters.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupOperationParameters.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,490 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupState.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupState.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpActiveData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpActiveData.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpArchiveFooter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpArchiveFooter.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpArchiveHeader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpArchiveHeader.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpDataOwners.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpDataOwners.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpJavaData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpJavaData.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpPassiveData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpPassiveData.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpPublicDataFiles.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpPublicDataFiles.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,443 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateArchiveOpSystemData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateArchiveOpSystemData.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateFactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateFactory.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateGetDataOwnerStatuses.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateGetDataOwnerStatuses.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateGetDataOwners.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateGetDataOwners.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateNotifyAllSnapshotsSupplied.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateNotifyAllSnapshotsSupplied.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateOpAware.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateOpAware.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateRequestListOfPublicFiles.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateRequestListOfPublicFiles.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateRequestSizeOfBackupData.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateRequestSizeOfBackupData.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateSetPhoneMode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateSetPhoneMode.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupStateValidateDiskSpace.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateValidateDiskSpace.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupTransferReadRequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupTransferReadRequest.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupTransferRequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupTransferRequest.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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() - 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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/CMMCScBkupTransferWriteRequest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupTransferWriteRequest.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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'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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/MMCScBkupArchiveUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/MMCScBkupArchiveUtils.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/MMCScBkupLogger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/MMCScBkupLogger.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/MMCScBkupPhoneModelUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/MMCScBkupPhoneModelUtils.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/MMCScBkupSBEUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/MMCScBkupSBEUtils.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,524 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 ); + switch(type) + { + case ESIDTransferDerivedType: + ret = CSBSIDTransferType::NewL( transferType ); + break; + case EPackageTransferDerivedType: + ret = CSBPackageTransferType::NewL( transferType ); + break; + case EJavaTransferDerivedType: + ret = CSBJavaTransferType::NewL( transferType ); + break; + default: + break; + } + 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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/RMMCScBkupArchiveStreams.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/RMMCScBkupArchiveStreams.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/RMMCScBkupProgressSizer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/RMMCScBkupProgressSizer.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/TMMCScBkupArchiveVector.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/TMMCScBkupArchiveVector.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/TMMCScBkupDriveAndSize.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/TMMCScBkupDriveAndSize.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/bkupengine/src/TMMCScBkupDriveFilter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/TMMCScBkupDriveFilter.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/cenrep/keys_s60filemanager.xls Binary file filemanager/cenrep/keys_s60filemanager.xls has changed diff -r 000000000000 -r 6a9f87576119 filemanager/conf/s60filemanager.confml Binary file filemanager/conf/s60filemanager.confml has changed diff -r 000000000000 -r 6a9f87576119 filemanager/conf/s60filemanager_1020506B.crml Binary file filemanager/conf/s60filemanager_1020506B.crml has changed diff -r 000000000000 -r 6a9f87576119 filemanager/group/FileManager.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/group/FileManager.mmp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,99 @@ +/* +* 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 + +// End of File diff -r 000000000000 -r 6a9f87576119 filemanager/group/FileManagerEngine.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/group/FileManagerEngine.mmp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,114 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/group/FileManagerUID.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/group/FileManagerUID.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,40 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/group/FileManagerView.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/group/FileManagerView.mmp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,80 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/group/GFLM.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/group/GFLM.mmp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,69 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/group/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/group/backup_registration.xml Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,8 @@ + + + + + + + + diff -r 000000000000 -r 6a9f87576119 filemanager/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/group/bld.inf Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,95 @@ +/* +* 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 +#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 +#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 000000000000 -r 6a9f87576119 filemanager/group/filemanageraiwprovider.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/group/filemanageraiwprovider.mmp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,49 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/group/filemanagerbkupchecker.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/group/filemanagerbkupchecker.mmp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,56 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/group/filemanagerbkupengine.mmh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/group/filemanagerbkupengine.mmh Mon Jan 18 20:09:41 2010 +0200 @@ -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 000000000000 -r 6a9f87576119 filemanager/group/filemanagerbkupengine.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/group/filemanagerbkupengine.mmp Mon Jan 18 20:09:41 2010 +0200 @@ -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 "../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 000000000000 -r 6a9f87576119 filemanager/group/filemanagerschbkup.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/group/filemanagerschbkup.mmp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,45 @@ +/* +* 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 + +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 diff -r 000000000000 -r 6a9f87576119 filemanager/help/data/xhtml.zip Binary file filemanager/help/data/xhtml.zip has changed diff -r 000000000000 -r 6a9f87576119 filemanager/help/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/help/group/bld.inf Mon Jan 18 20:09:41 2010 +0200 @@ -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: +* 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 000000000000 -r 6a9f87576119 filemanager/help/inc/fmgr.hlp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/help/inc/fmgr.hlp.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -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: +* +*/ + +// +// 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 000000000000 -r 6a9f87576119 filemanager/help/rom/filemanagerhelps_variant.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/help/rom/filemanagerhelps_variant.iby Mon Jan 18 20:09:41 2010 +0200 @@ -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: +* +*/ + +#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 000000000000 -r 6a9f87576119 filemanager/loc/FileManager.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/loc/FileManager.loc Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,2131 @@ +/* +* 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)" + +// End of File diff -r 000000000000 -r 6a9f87576119 filemanager/rom/FileManager.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/rom/FileManager.iby Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,42 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/rom/FileManagerResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/rom/FileManagerResources.iby Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/schbkup/inc/filemanagerschbackuptask.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/schbkup/inc/filemanagerschbackuptask.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,134 @@ +/* +* 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" + + +// 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: + /** + * 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 ); + +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; + + }; + + +#endif // C_FILEMANAGERSCHBACKUPTASK_H + +// End of file diff -r 000000000000 -r 6a9f87576119 filemanager/schbkup/inc/filemanagerschobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/schbkup/inc/filemanagerschobserver.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,54 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/schbkup/inc/filemanagerschsubscriber.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/schbkup/inc/filemanagerschsubscriber.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,155 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/schbkup/src/filemanagerschbackupmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/schbkup/src/filemanagerschbackupmain.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,127 @@ +/* +* 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 000000000000 -r 6a9f87576119 filemanager/schbkup/src/filemanagerschbackuptask.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/schbkup/src/filemanagerschbackuptask.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,474 @@ +/* +* 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; + 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 ) ); + } + + 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 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(); + } + } + +// End of file diff -r 000000000000 -r 6a9f87576119 filemanager/schbkup/src/filemanagerschsubscriber.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/schbkup/src/filemanagerschsubscriber.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,216 @@ +/* +* 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 000000000000 -r 6a9f87576119 files_plat/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/files_plat/group/bld.inf Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,21 @@ +/* +* 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 000000000000 -r 6a9f87576119 files_plat/memory_scan_popup_ui_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/files_plat/memory_scan_popup_ui_api/group/bld.inf Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,28 @@ +/* +* 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 000000000000 -r 6a9f87576119 files_plat/memory_scan_popup_ui_api/inc/CMemStatePopup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/files_plat/memory_scan_popup_ui_api/inc/CMemStatePopup.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,69 @@ +/* +* 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 000000000000 -r 6a9f87576119 files_plat/memory_scan_popup_ui_api/inc/MSPUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/files_plat/memory_scan_popup_ui_api/inc/MSPUtil.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,85 @@ +/* +* 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 000000000000 -r 6a9f87576119 files_plat/memory_scan_popup_ui_api/memory_scan_popup_ui_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/files_plat/memory_scan_popup_ui_api/memory_scan_popup_ui_api.metaxml Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,18 @@ + + + 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 000000000000 -r 6a9f87576119 filesystemuis/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/group/bld.inf Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,32 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/bwins/MemScanClientU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/bwins/MemScanClientU.DEF Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,11 @@ +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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/bwins/msengu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/bwins/msengu.def Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,11 @@ +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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/clientinc/memscanclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/clientinc/memscanclient.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,52 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/clientsrc/memscanclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/clientsrc/memscanclient.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,260 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/data/mseng.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/data/mseng.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,807 @@ +/* +* 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\\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\\MIDlets\\"; + // 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\\MIDlets\\"; + // 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"; + }, + + // ---------- 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"; + }, + + // ---------- 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 + }; + }, + 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 + }; + }, + 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/eabi/MemScanClientU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/eabi/MemScanClientU.DEF Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,12 @@ +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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/eabi/msengU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/eabi/msengU.DEF Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,29 @@ +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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/group/bld.inf Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,40 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/group/memscanclient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/group/memscanclient.mmp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,45 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/group/memscanserv.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/group/memscanserv.mmp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,63 @@ +/* +* 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 + +//Uncomment this line to show the RDebug::Print() +// MACRO __SHOW_RDEBUG_PRINT_ + +// End of File + diff -r 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/loc/mseng.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/loc/mseng.loc Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,90 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/rom/Mseng.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/rom/Mseng.iby Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,27 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/rom/MsengResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/rom/MsengResources.iby Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,26 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/memscanclientserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/memscanclientserver.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,64 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/memscanserv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/memscanserv.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,192 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/memscanutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/memscanutils.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,33 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/mseng.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/mseng.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,194 @@ +/* +* 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 chanked. + * @return ETrue if internal drive, otherwise EFalse. + */ + static TBool IsInternalDrive( RFs& aFs, const TInt aDrv ); + + /** + * Check whether removable drive. + * @param aDrv Drive to be chanked. + * @return ETrue if internal drive, otherwise EFalse. + */ + static TBool IsRemovableDrive( 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/mseng.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/mseng.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,156 @@ +/* +* 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, + // Java file types + EExtJad, + EExtJar, + // Native installation file types + EExtSis, + EExtSisx, + // Video types + EExt3gp, + EExtMp4, + EExtNim, + EExtRm, + EExtRv, + EExtWmv, + EExt3g2, + // 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/mseng.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/mseng.rh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,211 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/msengdirectoryscanner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/msengdirectoryscanner.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,125 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/msengfileextscanner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/msengfileextscanner.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,91 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/msengfilescanner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/msengfilescanner.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,81 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/msengfindallscanner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/msengfindallscanner.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,83 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/msenginfoarray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/msenginfoarray.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,214 @@ +/* +* 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, TInt 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, TInt 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, TInt 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/msenginfoarray.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/msenginfoarray.inl Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,88 @@ +/* +* 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, TInt aSize) + { + // The array must have been initialized to contain zeros! + (*iUidResultArray)[aUid] += aSize; + } + +inline void CMsengInfoArray::AddSizeByExtL(TInt aExt, TInt aSize) + { + // The array must have been initialized to contain zeros! + (*iExtResultArray)[aExt] += aSize; + } + +inline void CMsengInfoArray::AddSizeByGroupL(TInt aGroupIndex, TInt aSize) + { + // The array must have been initialized to contain zeros! + (*iGroupResultArray)[aGroupIndex] += aSize; + } + +// End of File diff -r 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/msengregistryscanner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/msengregistryscanner.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,95 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/msengscanner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/msengscanner.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,144 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/msengscanner.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/msengscanner.inl Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,40 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/msengscannerbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/msengscannerbase.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,159 @@ +/* +* 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, TInt 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, TInt 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/msengscannerbase.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/msengscannerbase.inl Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,54 @@ +/* +* 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, TInt aSize) + { + iInfoArray.AddSizeByUidL(aUid, aSize); + } + +inline void CMsengScannerBase::AddSizeByExtL(TExtTypes aExt, TInt 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/msengscanobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/msengscanobserver.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,56 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/msengsisxinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/msengsisxinfo.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,82 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serverinc/msenguihandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serverinc/msenguihandler.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,63 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serversrc/memscanserv.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serversrc/memscanserv.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,621 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serversrc/mseng.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serversrc/mseng.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,567 @@ +/* +* 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 + +// 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.iSize ); + + 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; + } + + +// End of File diff -r 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serversrc/msengdirectoryscanner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serversrc/msengdirectoryscanner.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,230 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serversrc/msengfileextscanner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serversrc/msengfileextscanner.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,208 @@ +/* +* 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.iSize); + +#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.iSize); + } + else + { + RDebug::Print(_L("File: see next line, extension number: %d, size: %d"), + iCurrentExtensionIndex, aEntry.iSize ); + 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.iSize); + } + } + + return response; + } + +// End of File diff -r 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serversrc/msengfilescanner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serversrc/msengfilescanner.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,88 @@ +/* +* 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.iSize); + + TRACES + ( + RDebug::Print(_L("File %S belongs to group: %d"), + &aFullFileNameAndPath, group) + ); + } + } + } + } + } + + // We processed this one + return EEntryWasProcessed; + } + +// End of File diff -r 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serversrc/msenginfoarray.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serversrc/msenginfoarray.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,389 @@ +/* +* 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)) + { + 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 if(CMseng::IsRemovableDrive(aFsSession, iCurrentScannedDrive)) + { + 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serversrc/msengregistryscanner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serversrc/msengregistryscanner.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,196 @@ +/* +* 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; + + TInt 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 ); + TInt 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serversrc/msengscanner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serversrc/msengscanner.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,230 @@ +/* +* 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)) + { + theReader.OpenLC( &iResFile, C_EXTRADATAFILES ); + somethingToDo = ETrue; + } + else if(CMseng::IsRemovableDrive(aFsSession, aDrive)) + { + 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) + { + TInt size = file.iSize; + iScanArray->AddSizeByGroupL(groupindex, size); + } + + CleanupStack::PopAndDestroy(name); + } + } + } + CleanupStack::PopAndDestroy(&theReader); + } + +// End of File diff -r 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serversrc/msengscannerbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serversrc/msengscannerbase.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,131 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memscaneng/serversrc/msengsisxinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memscaneng/serversrc/msengsisxinfo.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,149 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memstatepopup/BWINS/MEMSTATEPOPUPU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memstatepopup/BWINS/MEMSTATEPOPUPU.DEF Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,5 @@ +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 000000000000 -r 6a9f87576119 filesystemuis/memstatepopup/EABI/MemStatePopupU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memstatepopup/EABI/MemStatePopupU.DEF Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,9 @@ +EXPORTS + _ZN14CMemStatePopup5RunLDE12TDriveNumberR7TDesC16 @ 1 NONAME + _ZN14CMemStatePopup8GetUtilLERP8CMSPUtil @ 2 NONAME + _ZN8CMSPUtil16SolveUnitAndSizeERx @ 3 NONAME + _ZTI14CMemStatePopup @ 4 NONAME ; ## + _ZTI8CMSPUtil @ 5 NONAME ; ## + _ZTV14CMemStatePopup @ 6 NONAME ; ## + _ZTV8CMSPUtil @ 7 NONAME ; ## + diff -r 000000000000 -r 6a9f87576119 filesystemuis/memstatepopup/group/MemStatePopup.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memstatepopup/group/MemStatePopup.mmp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,60 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memstatepopup/group/MemStatePopup.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memstatepopup/group/MemStatePopup.rss Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies 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 000000000000 -r 6a9f87576119 filesystemuis/memstatepopup/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memstatepopup/group/bld.inf Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,30 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memstatepopup/inc/MSPPanic.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memstatepopup/inc/MSPPanic.hrh Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,35 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memstatepopup/inc/cmemscaneventreceiver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memstatepopup/inc/cmemscaneventreceiver.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,63 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memstatepopup/inc/cmemstatepopupimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memstatepopup/inc/cmemstatepopupimpl.h Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,148 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memstatepopup/loc/MemStatePopup.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memstatepopup/loc/MemStatePopup.loc Mon Jan 18 20:09:41 2010 +0200 @@ -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: +* 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 000000000000 -r 6a9f87576119 filesystemuis/memstatepopup/rom/MemStatePopup.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memstatepopup/rom/MemStatePopup.iby Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,25 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memstatepopup/rom/MemStatePopupResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memstatepopup/rom/MemStatePopupResources.iby Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,27 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memstatepopup/src/CMemStatePopup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memstatepopup/src/CMemStatePopup.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,64 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memstatepopup/src/MSPUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memstatepopup/src/MSPUtil.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,109 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memstatepopup/src/cmemscaneventreceiver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memstatepopup/src/cmemscaneventreceiver.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,209 @@ +/* +* 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 000000000000 -r 6a9f87576119 filesystemuis/memstatepopup/src/cmemstatepopupimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filesystemuis/memstatepopup/src/cmemstatepopupimpl.cpp Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,415 @@ +/* +* 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 000000000000 -r 6a9f87576119 group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/bld.inf Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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 000000000000 -r 6a9f87576119 layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layers.sysdef.xml Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,14 @@ + + +]> + + + + + + + + + + diff -r 000000000000 -r 6a9f87576119 package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 6a9f87576119 sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Mon Jan 18 20:09:41 2010 +0200 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +