messagingfw/msgsrvnstore/server/inc/MSVCOPY.H
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #if !defined(__MSVCOPY_H__)
       
    17 #define __MSVCOPY_H__
       
    18 
       
    19 #if !defined(__E32BASE_H__)
       
    20 #include <e32base.h>
       
    21 #endif
       
    22 
       
    23 #if !defined(__MSVSTD_H__)
       
    24 #include <msvstd.h>
       
    25 #endif
       
    26 
       
    27 #include "MSVCMBSE.H"
       
    28 
       
    29 class CCopyOneFile;
       
    30 class CCopyFiles;
       
    31 class CMsvServer;
       
    32 
       
    33 
       
    34 //**********************************
       
    35 // CMsvCopyEntry
       
    36 //**********************************
       
    37 //
       
    38 //
       
    39 //
       
    40 
       
    41 class CMsvCopyEntry : public CActive
       
    42 /**
       
    43 @internalComponent
       
    44 @released
       
    45 */
       
    46 	{
       
    47 public:
       
    48 	static CMsvCopyEntry* NewL(CMsvServer& aServer);
       
    49 	~CMsvCopyEntry();
       
    50 	//
       
    51 	void StartL(TMsvId aOrigEntryId, TMsvId aTargetId, TRequestStatus& aObserverStatus);
       
    52 	inline TMsvId NewEntryId() const;
       
    53 	//
       
    54 private:
       
    55 	CMsvCopyEntry(CMsvServer& aServer);
       
    56 	void ConstructL();
       
    57 	//
       
    58 	void Completed(TInt aError);
       
    59 	void NextState();
       
    60 	void CopyStoreFile();
       
    61 	void CopyFolder();
       
    62 
       
    63 	// from CActive
       
    64 	void RunL();
       
    65 	void DoCancel();
       
    66 
       
    67 
       
    68 private:
       
    69 
       
    70 	enum TState {ENotYetStarted=0, EEntryCreated, ECopyingStore, ECopyingFolder, ECompleted };
       
    71 
       
    72 private:
       
    73 	CMsvServer& iServer;
       
    74 	TRequestStatus* iObserverStatus;
       
    75 	CCopyOneFile* iCopyOneFile;
       
    76 	CCopyFiles* iCopyFiles;
       
    77 	TState iState;
       
    78 	TMsvId iOrigEntryId;
       
    79 	TMsvEntry* iNewEntry;
       
    80 	
       
    81 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB)
       
    82 	TMsvEntry* iOrigEntry;
       
    83 #endif
       
    84 
       
    85 	TFileName *iFromName;
       
    86 	TFileName *iToName;
       
    87 	};
       
    88 
       
    89 
       
    90 //**********************************
       
    91 // CMsvCopy
       
    92 //**********************************
       
    93 //
       
    94 //
       
    95 //
       
    96 
       
    97 class CMsvCopy : public CActive
       
    98 /**
       
    99 @internalComponent
       
   100 @released
       
   101 */
       
   102 	{
       
   103 public:
       
   104 	static CMsvCopy* NewL(CMsvServer& aServer);
       
   105 	~CMsvCopy();
       
   106 	//
       
   107 	void StartL(TMsvId aOrigEntryId, TMsvId aTargetId, TRequestStatus& aObserverStatus, TBool aDescendentCopying);
       
   108 	//
       
   109 	inline TMsvId NewEntryId() const;
       
   110 	inline void DeleteAllOnFailure();
       
   111 	//
       
   112 private:
       
   113 	CMsvCopy(CMsvServer& aServer);
       
   114 	void ConstructL();
       
   115 	void Completed();
       
   116 	void DoRunL(TBool aTopLevel);
       
   117 	// from CActive
       
   118 	void RunL();
       
   119 	void DoCancel();
       
   120 	//
       
   121 private:
       
   122 	CMsvServer& iServer;
       
   123 	TRequestStatus* iObserverStatus;
       
   124 	TMsvId iOrigTargetId;
       
   125 	TMsvId iOrigSourceId;
       
   126 	TMsvId iTopLevelId;
       
   127 	TMsvId iTempTargetId;
       
   128 	TMsvId iTempSourceId;
       
   129 	TBool iDescendentCopying;
       
   130 	TMsvId iDescendentId;
       
   131 	CMsvEntrySelection* iFailedEntryParents;
       
   132 	CMsvEntrySelection* iRecursionList;
       
   133 	CMsvCopyEntry* iCopyEntry;
       
   134 	TInt iError;
       
   135 	TBool iDeleteAllOnFailure;
       
   136 	};
       
   137 
       
   138 
       
   139 //**********************************
       
   140 // CMsvCopyEntries
       
   141 //**********************************
       
   142 //
       
   143 //
       
   144 //
       
   145 
       
   146 class CMsvCopyEntries : public CMsvCopyMoveEntriesBase
       
   147 /**
       
   148 @internalComponent
       
   149 @released
       
   150 */
       
   151 	{
       
   152 public:
       
   153 	static CMsvCopyEntries* NewL(CMsvServer& aServer);
       
   154 	~CMsvCopyEntries();
       
   155 	//
       
   156 	inline const CMsvEntrySelection& NewEntryIds() const;
       
   157 	//
       
   158 private:
       
   159 	void DoStartL(TMsvId aSourceId, TMsvId aTargetId, TRequestStatus& aObserverStatus);
       
   160 	CMsvCopyEntries();
       
   161 	void ConstructL(CMsvServer& aServer);
       
   162 	void DoCancel();
       
   163 	void RunL();
       
   164 	//
       
   165 private:
       
   166 	CMsvCopy* iCopy;
       
   167 	CMsvEntrySelection* iNewEntries;
       
   168 	};
       
   169 
       
   170 
       
   171 // inline functions
       
   172 
       
   173 inline TMsvId CMsvCopyEntry::NewEntryId() const
       
   174 	{
       
   175 	return iNewEntry->Id();
       
   176 	}
       
   177 
       
   178 inline TMsvId CMsvCopy::NewEntryId() const
       
   179 	{
       
   180 	return iTopLevelId;
       
   181 	}
       
   182 
       
   183 inline void CMsvCopy::DeleteAllOnFailure()
       
   184 	{
       
   185 	iDeleteAllOnFailure = ETrue;
       
   186 	}
       
   187 
       
   188 inline const CMsvEntrySelection& CMsvCopyEntries::NewEntryIds() const
       
   189 	{
       
   190 	return *iNewEntries;
       
   191 	}
       
   192 
       
   193 #endif