|
1 /* |
|
2 * Copyright (c) 2007-2008 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: IMAP4 connect operation |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __IPSPLGIMAP4CONNECTOP_H__ |
|
19 #define __IPSPLGIMAP4CONNECTOP_H__ |
|
20 |
|
21 |
|
22 #include "ipsplgonlineoperation.h" |
|
23 #include "imapconnectionobserver.h" |
|
24 |
|
25 class CIpsPlgEventHandler; |
|
26 |
|
27 const TInt KIpsAutoPopulateByteLimit = KMaxTInt32; |
|
28 |
|
29 /** |
|
30 * class CIpsPlgImap4ConnectionOp |
|
31 * |
|
32 */ |
|
33 |
|
34 class CIpsPlgImap4ConnectOp : |
|
35 public CIpsPlgOnlineOperation, |
|
36 public MMsvImapConnectionObserver, |
|
37 public MIpsPlgConnectOpCallback, |
|
38 public MFSMailRequestObserver |
|
39 { |
|
40 |
|
41 public://from MIpsPlgConnectOpCallback |
|
42 |
|
43 void CredientialsSetL( TInt aEvent ); |
|
44 |
|
45 public: |
|
46 |
|
47 /** |
|
48 * NewL() |
|
49 * Basic factory function - creates dialog with standard title resource |
|
50 * @param CMsvSession& CMsvSession reference |
|
51 * @param TInt priority |
|
52 * @param TRequestStatus& request status |
|
53 * @param TMsvId service (mailbox) id |
|
54 * @param TImapConnectionType connection type |
|
55 * @param |
|
56 * @param |
|
57 * @return CIpsPlgImap4ConnectionOp* self pointer |
|
58 */ |
|
59 static CIpsPlgImap4ConnectOp* NewL( |
|
60 CMsvSession& aMsvSession, |
|
61 TInt aPriority, |
|
62 TRequestStatus& aObserverRequestStatus, |
|
63 TMsvId aService, |
|
64 CIpsPlgTimerOperation& aActivityTimer, |
|
65 TFSMailMsgId aFSMailBoxId, |
|
66 MFSMailRequestObserver& aFSOperationObserver, |
|
67 TInt aFSRequestId, |
|
68 CIpsPlgEventHandler* aEventHandler, |
|
69 TBool aDoPlainConnect=EFalse, |
|
70 TBool aSignallingAllowed=ETrue ); |
|
71 |
|
72 /** |
|
73 * ~CIpsPlgImap4ConnectionOp() |
|
74 * destructor |
|
75 */ |
|
76 ~CIpsPlgImap4ConnectOp(); |
|
77 |
|
78 public: // from CIpsPlgBaseOperation |
|
79 |
|
80 virtual const TDesC8& ProgressL(); |
|
81 |
|
82 /** |
|
83 * |
|
84 */ |
|
85 virtual const TDesC8& GetErrorProgressL( TInt aError ); |
|
86 |
|
87 /** |
|
88 * |
|
89 */ |
|
90 virtual TFSProgress GetFSProgressL() const; |
|
91 |
|
92 |
|
93 /** |
|
94 * |
|
95 */ |
|
96 virtual TInt IpsOpType() const; |
|
97 |
|
98 public: // from MMsvImapConnectionObserver |
|
99 |
|
100 /** |
|
101 * HandleImapConnectionEvent() |
|
102 * From MMsvImapConnectionObserver |
|
103 * @param TImapConnectionEvent, imap connection event |
|
104 */ |
|
105 void HandleImapConnectionEvent( |
|
106 TImapConnectionEvent aConnectionEvent); |
|
107 |
|
108 |
|
109 public: // from MFSMailRequestObserver |
|
110 |
|
111 void RequestResponseL( TFSProgress aEvent, TInt aRequestId ); |
|
112 |
|
113 public: |
|
114 |
|
115 /** |
|
116 * |
|
117 */ |
|
118 TBool Connected() const; |
|
119 |
|
120 protected: |
|
121 |
|
122 /** |
|
123 * From CActive |
|
124 */ |
|
125 void DoRunL(); |
|
126 |
|
127 /** |
|
128 * |
|
129 */ |
|
130 void DoCancel(); |
|
131 |
|
132 /** |
|
133 * From CIpsPlgOnlineoperation |
|
134 */ |
|
135 //TInt GetOperationErrorCodeL( ); |
|
136 |
|
137 private: |
|
138 |
|
139 enum TImapConnectionState |
|
140 { |
|
141 EStateStartConnect, |
|
142 EStateQueryingDetails, |
|
143 EStateConnectAndSync, |
|
144 EStatePopulateAllCompleted, |
|
145 EStateCompleted, |
|
146 EStateIdle }; |
|
147 |
|
148 /** |
|
149 * CIpsPlgImap4ConnectionOp() |
|
150 * @param CMsvSession&, CMsvSession reference |
|
151 * @param TInt, priority |
|
152 * @param TRequestStatus&, request status |
|
153 * @param TMsvId, service ( mailbox ) id |
|
154 * @param MMsvProgressReporter&, prog. reporter |
|
155 * @param TImapConnectionType, connection type |
|
156 */ |
|
157 CIpsPlgImap4ConnectOp( |
|
158 CMsvSession& aMsvSession, |
|
159 TInt aPriority, |
|
160 TRequestStatus& aObserverRequestStatus, |
|
161 TMsvId aService, |
|
162 CIpsPlgTimerOperation& aActivityTimer, |
|
163 TFSMailMsgId aFSMailBoxId, |
|
164 MFSMailRequestObserver& aFSOperationObserver, |
|
165 TInt aFSRequestId, |
|
166 TBool aDoPlainConnect, |
|
167 TBool aSignallingAllowed, |
|
168 CIpsPlgEventHandler* aEventHandler ); |
|
169 |
|
170 /** |
|
171 * ConstructL() |
|
172 */ |
|
173 void ConstructL(); |
|
174 |
|
175 /** |
|
176 * |
|
177 */ |
|
178 void DoConnectOpL(); |
|
179 |
|
180 /** |
|
181 * |
|
182 */ |
|
183 void StartL(); |
|
184 |
|
185 /** |
|
186 * |
|
187 */ |
|
188 void DoPopulateAllL(); |
|
189 |
|
190 /** |
|
191 * |
|
192 */ |
|
193 void QueryUserPwdL(); |
|
194 |
|
195 |
|
196 /** |
|
197 * |
|
198 */ |
|
199 void SignalSyncStarted(); |
|
200 |
|
201 /** |
|
202 * |
|
203 */ |
|
204 void SignalSyncCompleted( TInt aError ); |
|
205 |
|
206 |
|
207 private: //Data |
|
208 |
|
209 TImapConnectionState iState; |
|
210 TPckgBuf<TImap4CompoundProgress> iProgressBuf; |
|
211 CMsvEntrySelection* iSelection; |
|
212 TBool iDoPlainConnect; |
|
213 |
|
214 |
|
215 |
|
216 // not owned |
|
217 CIpsPlgEventHandler* iEventHandler; |
|
218 TBool iIsSyncStartedSignaled; |
|
219 |
|
220 }; |
|
221 |
|
222 #endif |