00001 // TXTSCPMV.H 00002 // 00003 // Copyright (c) 1999 Symbian Ltd. All rights reserved. 00004 // 00005 00006 #ifndef _TXTSCPMV_H_ 00007 #define _TXTSCPMV_H_ 00008 00009 #if !defined(__MSVSTD_H__) 00010 #include <msvstd.h> 00011 #endif 00012 #if !defined(__MSVENTRY_H__) 00013 #include <msventry.h> 00014 #endif 00015 00016 #if !defined(__TXUT_H__) 00017 #include "txut.h" //for TTxtProgress 00018 #endif 00019 00020 #define ETxtRetrievingMessage 1 00021 #define ETxtFinished 0 00022 00023 00024 const TInt KMsgTxtRefreshMailboxPriority = 1; 00025 00026 class CParaFormatLayer; 00027 class CCharFormatLayer; 00028 class CMsvServerEntry; 00029 class CTxtCopyMoveBase; 00030 00031 // 00032 // CTxtActiveOper: performs an operation on exactly one Msv Entry. 00033 // Derive from this for the several move/copy/delete operations 00034 // 00035 // The methods have a RFs at their disposal, for access to the current 00036 // folder for the operation in the file system. 00037 // 00038 00039 class CTxtActiveOper : public CActive 00040 { 00041 public: 00042 CTxtActiveOper(RFs& aFs, CMsvServerEntry& aServerEntry); 00043 virtual ~CTxtActiveOper(); 00044 void Start(TMsvId& aSourceId, TMsvId& aDestId, TRequestStatus& aStatus); 00045 void SetCurrentCaller(CTxtCopyMoveBase* aCurrentCaller); 00046 public: 00047 virtual CTxtActiveOper* CopyConstructL()=0; 00048 // CopiedHeader reports whether messages are copied and entries need to be created. 00049 // the destination entry id will then be passed on in the Start method 00050 virtual TBool CopiedHeader() const = 0; 00051 // DeleteSourceAfterwards specifies whether the source entry needs to be deleted 00052 // afterwards. This will then be done automatically also. 00053 virtual TBool DeleteSourceAfterwards() const = 0; 00054 // MoveIsToService specifies whether the messages that are moved are moved to the service. 00055 // Some additional operations need to be done to make the entry a valid entry, 00056 // the flag iServiceId has to be set, and the correctness of the iDetails has 00057 // to be assured. Also the file name has to be altered if it already exists. 00058 virtual TBool MoveIsToService() const = 0; 00059 protected: 00060 // RunL will then do the actual transfer. It should call ReportFinished when the operation 00061 // has completed. 00062 void RunL(); 00063 virtual void DoRunL()=0; 00064 virtual void DoCancel(); 00065 protected: 00066 TRequestStatus* iReportStatus; 00067 CMsvServerEntry& iServerEntry; 00068 RFs &iFs; 00069 TMsvId iSourceId; 00070 TMsvId iDestId; 00071 CTxtCopyMoveBase* iCurrentCaller; // Currently being called from. 00072 TFileName iFileName; // Current source entry info 00073 }; 00074 00075 // 00076 // CTxtCopyMoveBase: defines some base functionality for transferring 00077 // between the server and the local file system. It needs a CTxtActiveOper 00078 // class at construction, that will actually copy the body text over asynchronously. 00079 // 00080 00081 class CTxtCopyMoveBase : public CActive 00082 { 00083 public: 00084 static CTxtCopyMoveBase* NewL(CTxtActiveOper* aActiveOperation, const CMsvEntrySelection& aSource, 00085 CMsvServerEntry& aDestination, TMsvId& aServiceEntryId, TParse& aParse); 00086 CTxtCopyMoveBase* CopyConstructL(const CMsvEntrySelection& aSource); 00087 ~CTxtCopyMoveBase(); 00088 void Start(TRequestStatus& aStatus); 00089 TTxtProgress& Progress(); 00090 protected: 00091 CTxtCopyMoveBase(CTxtActiveOper* aActiveOperation, const CMsvEntrySelection& aSource, 00092 CMsvServerEntry& aDestination, TMsvId& aServiceEntryId, TParse& aParse); 00093 void ConstructL(); 00094 void DoCancel(); 00095 void RunL(); 00096 void DoRunL(); 00097 private: 00098 void CheckDeleteSource(); 00099 void SetupNewEntryL(TMsvId& SourceMsgId, TMsvId& newDestMsvId); 00100 private: 00101 TInt iTxtCopyMoveState; 00102 CTxtActiveOper* iActiveOperation; 00103 const CMsvEntrySelection& iSource; 00104 CMsvServerEntry& iDestination; 00105 TMsvId iServiceEntryId; 00106 TMsvId iDestId; 00107 TInt iMsgCounter; 00108 TTxtProgress iProgress; 00109 TRequestStatus* iReportStatus; 00110 public: 00111 // iServiceDestinationpath is used as a current folder, when transferring to the RFs 00112 TParse& iServiceDestinationpath; 00113 }; 00114 00115 // 00116 // CTxtActiveOper-derived classes, defining the actual moving around of 00117 // body texts. 00118 // 00119 00120 // 00121 // CTxtCopyToLocalOp, CTxtCopyFromLocalOp, CTxtCopyWithinServiceOp: 00122 // The copy operations 00123 // 00124 00125 class CTxtCopyToLocalOp : public CTxtActiveOper 00126 { 00127 public: 00128 CTxtActiveOper* CopyConstructL(); 00129 CTxtCopyToLocalOp(RFs& aFs, CMsvServerEntry& aServerEntry) 00130 : CTxtActiveOper(aFs, aServerEntry) {}; 00131 TBool CopiedHeader() const; 00132 virtual TBool DeleteSourceAfterwards() const; 00133 TBool MoveIsToService() const; 00134 protected: 00135 void DoRunL(); 00136 private: 00137 void DoMessageCopyToLocalL(); 00138 }; 00139 00140 class CTxtCopyFromLocalOp : public CTxtActiveOper 00141 { 00142 public: 00143 CTxtActiveOper* CopyConstructL(); 00144 CTxtCopyFromLocalOp(RFs& aFs, CMsvServerEntry& aServerEntry) 00145 : CTxtActiveOper(aFs, aServerEntry) {}; 00146 TBool CopiedHeader() const; 00147 virtual TBool DeleteSourceAfterwards() const; 00148 TBool MoveIsToService() const; 00149 protected: 00150 void DoRunL(); 00151 private: 00152 void DoMessageCopyFromLocalL(const TMsvEntry& aEntry); 00153 }; 00154 00155 class CTxtCopyWithinServiceOp : public CTxtActiveOper 00156 { 00157 public: 00158 CTxtActiveOper* CopyConstructL(); 00159 CTxtCopyWithinServiceOp(RFs& aFs, CMsvServerEntry& aServerEntry) 00160 : CTxtActiveOper(aFs, aServerEntry) {}; 00161 TBool CopiedHeader() const; 00162 virtual TBool DeleteSourceAfterwards() const; 00163 TBool MoveIsToService() const ; 00164 protected: 00165 void DoRunL(); 00166 private: 00167 void DoMessageCopyWithinServiceL(); 00168 }; 00169 00170 // 00171 // CTxtMoveToLocalOp, CTxtMoveFromLocalOp, CTxtMoveWithinServiceOp: 00172 // The move operations: these are only a special case of copying, 00173 // where the original needs to be deleted. 00174 // 00175 00176 class CTxtMoveToLocalOp : public CTxtCopyToLocalOp 00177 { 00178 public: 00179 CTxtActiveOper* CopyConstructL(); 00180 CTxtMoveToLocalOp(RFs& aFs, CMsvServerEntry& aServerEntry) 00181 : CTxtCopyToLocalOp(aFs, aServerEntry) {}; 00182 TBool DeleteSourceAfterwards() const; 00183 }; 00184 00185 class CTxtMoveFromLocalOp : public CTxtCopyFromLocalOp 00186 { 00187 public: 00188 CTxtActiveOper* CopyConstructL(); 00189 CTxtMoveFromLocalOp(RFs& aFs, CMsvServerEntry& aServerEntry) 00190 : CTxtCopyFromLocalOp(aFs, aServerEntry) {}; 00191 TBool DeleteSourceAfterwards() const; 00192 }; 00193 00194 class CTxtMoveWithinServiceOp : public CTxtCopyWithinServiceOp 00195 { 00196 public: 00197 CTxtActiveOper* CopyConstructL(); 00198 CTxtMoveWithinServiceOp(RFs& aFs, CMsvServerEntry& aServerEntry) 00199 : CTxtCopyWithinServiceOp(aFs, aServerEntry) {}; 00200 TBool DeleteSourceAfterwards() const; 00201 }; 00202 00203 // 00204 // CTxtDeleteOp: Delete operation 00205 // 00206 00207 class CTxtDeleteOp : public CTxtActiveOper 00208 { 00209 public: 00210 CTxtActiveOper* CopyConstructL(); 00211 CTxtDeleteOp(RFs& aFs, CMsvServerEntry& aServerEntry) 00212 : CTxtActiveOper(aFs, aServerEntry) {}; 00213 TBool CopiedHeader() const; 00214 TBool DeleteSourceAfterwards() const; 00215 TBool MoveIsToService() const; 00216 protected: 00217 void DoRunL(); 00218 }; 00219 00220 00221 inline void CTxtActiveOper::SetCurrentCaller(CTxtCopyMoveBase* aCurrentCaller) 00222 { 00223 iCurrentCaller = aCurrentCaller; 00224 } 00225 00226 00227 #endif 00228
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.