|
1 // Copyright (c) 2006-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 #ifndef __CIMAP4SERVERMTM_H__ |
|
17 #define __CIMAP4SERVERMTM_H__ |
|
18 |
|
19 #include <e32std.h> |
|
20 #include <imapset.h> |
|
21 #include <mtsr.h> |
|
22 #include <tnonoperationmtmdata.h> |
|
23 |
|
24 class CBaseServerMtm; |
|
25 class CImapOfflineControl; |
|
26 class CImapProtocolController; |
|
27 |
|
28 #if (defined SYMBIAN_USER_PROMPT_SERVICE) |
|
29 class CImapUpsResponseWaiter; |
|
30 #endif |
|
31 |
|
32 // package buffer for progress info. |
|
33 /** |
|
34 @internalComponent |
|
35 @prototype |
|
36 */ |
|
37 typedef TPckgBuf<TImap4CompoundProgress> TImap4ProgressBuf; |
|
38 |
|
39 // States that MTM can be in |
|
40 /** |
|
41 @internalComponent |
|
42 @prototype |
|
43 */ |
|
44 enum TImap4ServerMtmState |
|
45 { |
|
46 EMtmStateIdle = 0, |
|
47 EMtmStateCopyToLocal = 1, |
|
48 EMtmStateCopyFromLocal = 2, |
|
49 EMtmStateCopyWithinService = 3, |
|
50 EMtmStateMoveToLocal = 4, |
|
51 EMtmStateMoveFromLocal = 5, |
|
52 EMtmStateMoveWithinService = 6, |
|
53 // EMtmStateDeleteAfterMove = 7, // n/a for new implementation |
|
54 EMtmStateDelete = 8, |
|
55 EMtmStateDeleteFolder = 9, |
|
56 EMtmStateCreateFolder = 10, |
|
57 EMtmStateRenameFolder = 11, |
|
58 EMtmStatePrimaryConnect = 12, |
|
59 // EMtmStateSecondaryConnect = 13, // n/a for new implementation |
|
60 EMtmStateForegroundSync = 14, |
|
61 EMtmStateMiscCommand = 15, |
|
62 EMtmStateWaitingForBackgroundToFinish = 16, |
|
63 // EMtmStateSyncCompleted = 17, // n/a for new implementation |
|
64 EMtmStatePopulate = 18, |
|
65 // EMtmStateLogging = 19, // n/a for new implementation |
|
66 EMtmStateOffLineDelete = 20, |
|
67 EMtmStateOffLineUndelete = 21, |
|
68 EMtmStateOffLineCopyToLocal = 22, |
|
69 EMtmStateOffLineMoveToLocal = 23, |
|
70 EMtmStateOffLineCopyFromLocal = 24, |
|
71 EMtmStateOffLineMoveFromLocal = 25, |
|
72 EMtmStateOffLineCopyWithinService = 26, |
|
73 EMtmStateOffLineMoveWithinService = 27, |
|
74 EMtmStateOffLinePopulate = 28, |
|
75 // EMtmStateSecondarySessionIdle = 29, |
|
76 EMtmStateAuthoriseConnection = 30, |
|
77 EMtmStateUpdateFlag = 31 |
|
78 }; |
|
79 |
|
80 |
|
81 /** |
|
82 @internalTechnology |
|
83 @prototype |
|
84 */ |
|
85 class CImap4ServerMtm : public CBaseServerMtm |
|
86 { |
|
87 public: |
|
88 IMPORT_C static CImap4ServerMtm* NewL( CRegisteredMtmDll& aRegisteredMtmDll, |
|
89 CMsvServerEntry* aEntry ); |
|
90 virtual ~CImap4ServerMtm(); |
|
91 void CopyToLocalL( const CMsvEntrySelection& aSelection, |
|
92 TMsvId aDestination, |
|
93 TRequestStatus& aStatus ); |
|
94 |
|
95 void CopyFromLocalL( const CMsvEntrySelection& aSelection, |
|
96 TMsvId aDestination, |
|
97 TRequestStatus& aStatus ); |
|
98 void CopyWithinServiceL( const CMsvEntrySelection& aSelection, |
|
99 TMsvId aDestination, |
|
100 TRequestStatus& aStatus ); |
|
101 void MoveToLocalL( const CMsvEntrySelection& aSelection, |
|
102 TMsvId aDestination, |
|
103 TRequestStatus& aStatus ); |
|
104 void MoveFromLocalL( const CMsvEntrySelection& aSelection, |
|
105 TMsvId aDestination, |
|
106 TRequestStatus& aStatus ); |
|
107 void MoveWithinServiceL( const CMsvEntrySelection& aSelection, |
|
108 TMsvId aDestination, |
|
109 TRequestStatus& aStatus ); |
|
110 void DeleteAllL( const CMsvEntrySelection& aSelection, |
|
111 TRequestStatus& aStatus ); |
|
112 void CreateL( TMsvEntry aNewEntry, |
|
113 TRequestStatus& aStatus ); |
|
114 void ChangeL( TMsvEntry aNewEntry, |
|
115 TRequestStatus& aStatus ); |
|
116 void StartCommandL( CMsvEntrySelection& aSelection, |
|
117 TInt aCommand, |
|
118 const TDesC8& aParameter, |
|
119 TRequestStatus& aStatus ); |
|
120 TBool CommandExpected(); |
|
121 const TDesC8& Progress(); |
|
122 |
|
123 protected: |
|
124 IMPORT_C TInt Extension_(TUint aExtensionId, TAny *&a0, TAny *a1); |
|
125 |
|
126 private: |
|
127 CImap4ServerMtm( CRegisteredMtmDll& aRegisteredMtmDll, |
|
128 CMsvServerEntry* aServerEntry); |
|
129 void ConstructL(); |
|
130 |
|
131 // from CBaseServerMtm |
|
132 void DoCancel(); |
|
133 void DoRunL(); |
|
134 void DoComplete(TInt aError); |
|
135 |
|
136 void Queue(TRequestStatus& aStatus); |
|
137 |
|
138 TBool PruneMessages(const CMsvEntrySelection& aSelection, TRequestStatus& aStatus); |
|
139 |
|
140 void GetSystemProgress(TMsvSystemProgress& aOutSysProg); |
|
141 |
|
142 void GetProgress(TImap4CompoundProgress& imap4Progress); |
|
143 |
|
144 TInt GetNonOperationMtmData(TNonOperationMtmDataType aMtmDataType, TPtrC8& aMtmDataBuffer); |
|
145 |
|
146 private: |
|
147 // Owned heap objects |
|
148 CImapProtocolController* iImapProtocolController; |
|
149 CImapOfflineControl* iImapOfflineControl; |
|
150 |
|
151 TRequestStatus* iRequest; // no ownership |
|
152 |
|
153 // CImapServerMtm internal state |
|
154 TImap4ServerMtmState iState; |
|
155 TBool iBatchInProgress; |
|
156 TImap4ProgressBuf iProgressBuffer; |
|
157 // Last operation performed was an offline operation |
|
158 TBool iLastOpWasOffline; |
|
159 CMsvServerEntry* iServerEntry; |
|
160 |
|
161 /** |
|
162 For Interaction with UPS server. |
|
163 */ |
|
164 #if (defined SYMBIAN_USER_PROMPT_SERVICE) |
|
165 TThreadId iClientThreadId; |
|
166 TBool iHasCapability; |
|
167 CImapUpsResponseWaiter* iWaiter; |
|
168 #endif |
|
169 |
|
170 TNonOperationMtmDataAccessPointIdBuffer iMtmDataAccessPointIdBuffer; |
|
171 }; |
|
172 |
|
173 #endif //__CIMAP4SERVERMTM_H__ |