harvester/monitorplugins/fileplugin/inc/FolderRenamer.h
changeset 0 c53acadfccc6
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef FOLDERRENAMER_H_
       
    19 #define FOLDERRENAMER_H_
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <mdesession.h>
       
    23 
       
    24 class CFileEventHandlerAO;
       
    25 class TMdsFSPStatus;
       
    26 
       
    27 
       
    28 class CRenameItem : public CBase
       
    29 	{
       
    30 public:
       
    31 	static CRenameItem * NewL (const TDesC &aOldName, const TDesC &aNewName);
       
    32 
       
    33 	virtual ~CRenameItem();
       
    34 
       
    35 	void HandleFileEventsL(CFileEventHandlerAO &aCFileEventHandlerAO);
       
    36 	void AddFileEvent(TMdsFSPStatus &aEvent);
       
    37 	TPtrC OldName();
       
    38 	TPtrC NewName();
       
    39 
       
    40 private:
       
    41 	CRenameItem();
       
    42 	void ConstructL(const TDesC &aOldName, const TDesC &aNewName);
       
    43 
       
    44 private:
       
    45 	HBufC *iOldName;
       
    46 	HBufC *iNewName;
       
    47 	RPointerArray <TMdsFSPStatus> iFileEvents;		
       
    48 	};
       
    49 
       
    50 class CFolderRenamer : public CActive
       
    51 	{
       
    52 public:
       
    53 	virtual ~CFolderRenamer();
       
    54 	
       
    55 	void RenameL(const TDesC &aOldName, const TDesC &aNewName);
       
    56 	void HandleFileEventL(TMdsFSPStatus &aEvent);
       
    57 	void HandleFileEventsL( CArrayFixSeg< TMdsFSPStatus >* aEvents );
       
    58 	
       
    59 	static CFolderRenamer * NewL(CFileEventHandlerAO &aCFileEventHandlerAO);
       
    60 
       
    61 private:
       
    62 
       
    63 	enum TFolderRenameState
       
    64 	{
       
    65 	ERenameStateIdle,
       
    66 	ERenameStateRenaming,
       
    67 	ERenameStateWaitingMdeRename,
       
    68 	};
       
    69 
       
    70 	void ConstructL();
       
    71 	void DoCancel();
       
    72 	void RunL();
       
    73     TInt RunError( TInt aError );
       
    74 	void SetNextRequest(TFolderRenameState aState);
       
    75 	CFolderRenamer(CFileEventHandlerAO &aCFileEventHandlerAO);
       
    76 
       
    77 private:
       
    78 	RPointerArray <CRenameItem> iRenamedFolders;		
       
    79 	TFolderRenameState iState;
       
    80 	CFileEventHandlerAO &iCFileEventHandlerAO;	
       
    81 public:
       
    82 	TBool iIsRunning;
       
    83 	};
       
    84 
       
    85 #endif /*FOLDERRENAMER_H_*/