13 * |
13 * |
14 * Description: IMAP4 connect operation |
14 * Description: IMAP4 connect operation |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #ifndef __IPSPLGIMAP4CONNECTOP_H__ |
18 #ifndef IPSPLGIMAP4CONNECTOP_H |
19 #define __IPSPLGIMAP4CONNECTOP_H__ |
19 #define IPSPLGIMAP4CONNECTOP_H |
20 |
|
21 |
20 |
22 #include "ipsplgonlineoperation.h" |
21 #include "ipsplgonlineoperation.h" |
23 #include "imapconnectionobserver.h" |
22 #include "imapconnectionobserver.h" |
24 |
23 |
25 class CIpsPlgEventHandler; |
24 class CIpsPlgEventHandler; |
26 |
25 |
27 const TInt KIpsAutoPopulateByteLimit = KMaxTInt32; |
26 // <qmail> KIpsAutoPopulateByteLimit not used |
28 |
27 |
29 /** |
28 /** |
30 * class CIpsPlgImap4ConnectionOp |
29 * class CIpsPlgImap4ConnectionOp |
31 * |
30 * |
32 */ |
31 */ |
33 |
32 NONSHARABLE_CLASS ( CIpsPlgImap4ConnectOp ) : |
34 class CIpsPlgImap4ConnectOp : |
|
35 public CIpsPlgOnlineOperation, |
33 public CIpsPlgOnlineOperation, |
36 public MMsvImapConnectionObserver, |
34 // <qmail> public MMsvImapConnectionObserver, not used any more |
37 public MIpsPlgConnectOpCallback, |
35 // <qmail> public MIpsPlgConnectOpCallback not used any more |
38 public MFSMailRequestObserver |
36 public MFSMailRequestObserver |
39 { |
37 { |
40 |
38 // <qmail> MIpsPlgConnectOpCallback not used any more |
41 public://from MIpsPlgConnectOpCallback |
39 public: |
42 |
|
43 void CredientialsSetL( TInt aEvent ); |
|
44 |
|
45 public: |
|
46 |
40 |
47 /** |
41 /** |
48 * NewL() |
42 * NewL() |
49 * Basic factory function - creates dialog with standard title resource |
43 * @param aMsvSession reference to client/server session to MsvServer |
50 * @param CMsvSession& CMsvSession reference |
44 * @param aObserverRequestStatus client's status |
51 * @param TInt priority |
45 * @param aService service (mailbox) id |
52 * @param TRequestStatus& request status |
46 * @param aActivityTimer mailbox specific activity timer |
53 * @param TMsvId service (mailbox) id |
47 * @param aFSMailBoxId specifies mailbox |
54 * @param TImapConnectionType connection type |
48 * @param aFSOperationObserver observer of this operation |
55 * @param |
49 * @param aFSRequestId request identifier of this op (assigned by caller, and used when calling |
56 * @param |
50 * back aFSOperationObserver |
57 * @return CIpsPlgImap4ConnectionOp* self pointer |
51 * @param aEventHandler used for signalling synchronisation statuses |
58 */ |
52 * @param aDoPlainConnect whether just connect to mailbox, or synch messages also |
59 static CIpsPlgImap4ConnectOp* NewL( |
53 * @return CIpsPlgImap4ConnectionOp* self pointer |
60 CMsvSession& aMsvSession, |
54 */ |
61 TInt aPriority, |
55 // <qmail> priority parameter has been removed |
62 TRequestStatus& aObserverRequestStatus, |
56 // <qmail> MFSMailRequestObserver& changed it to pointer |
63 TMsvId aService, |
57 // <qmail> aSignallingAllowed parameter has been removed |
64 CIpsPlgTimerOperation& aActivityTimer, |
58 static CIpsPlgImap4ConnectOp* NewL( |
65 TFSMailMsgId aFSMailBoxId, |
59 CMsvSession& aMsvSession, |
66 MFSMailRequestObserver& aFSOperationObserver, |
60 TRequestStatus& aObserverRequestStatus, |
67 TInt aFSRequestId, |
61 TMsvId aService, |
68 CIpsPlgEventHandler* aEventHandler, |
62 CIpsPlgTimerOperation& aActivityTimer, |
69 TBool aDoPlainConnect=EFalse, |
63 TFSMailMsgId aFSMailBoxId, |
70 TBool aSignallingAllowed=ETrue ); |
64 MFSMailRequestObserver* aFSOperationObserver, |
71 |
65 TInt aFSRequestId, |
72 /** |
66 CIpsPlgEventHandler* aEventHandler, |
73 * ~CIpsPlgImap4ConnectionOp() |
67 TBool aDoPlainConnect=EFalse ); |
74 * destructor |
68 |
75 */ |
69 // <qmail> make destructor virtual |
76 ~CIpsPlgImap4ConnectOp(); |
70 virtual ~CIpsPlgImap4ConnectOp(); |
77 |
71 |
78 public: // from CIpsPlgBaseOperation |
72 public: // from CIpsPlgBaseOperation |
79 |
73 |
80 virtual const TDesC8& ProgressL(); |
74 /** |
81 |
75 * From MsvOperation |
82 /** |
76 * Gets information on the progress of the operation |
83 * |
77 * (see MsvOperation header) |
84 */ |
78 */ |
85 virtual const TDesC8& GetErrorProgressL( TInt aError ); |
79 virtual const TDesC8& ProgressL(); |
|
80 |
|
81 /** |
|
82 * From CIpsPlgBaseOperation |
|
83 * For reporting if DoRunL leaves |
|
84 */ |
|
85 virtual const TDesC8& GetErrorProgressL( TInt aError ); |
|
86 |
|
87 virtual TFSProgress GetFSProgressL() const; |
|
88 |
|
89 // <qmail> change ret val type |
|
90 /** |
|
91 * Returns operation type |
|
92 */ |
|
93 TIpsOpType IpsOpType() const; |
|
94 |
|
95 //<qmail> moved from private to public and changed to static |
|
96 /** |
|
97 * |
|
98 * @param aInfo is filled correctly in this function |
|
99 * @param aImap4Settings info is filled partly based on settings |
|
100 */ |
|
101 static void ConstructImapPartialFetchInfo( |
|
102 TImImap4GetPartialMailInfo& aInfo, |
|
103 const CImImap4Settings& aImap4Settings ); |
|
104 //</qmail> |
86 |
105 |
87 /** |
106 // <qmail> HandleImapConnectionEvent() not used any more |
88 * |
107 |
89 */ |
108 public: // from MFSMailRequestObserver |
90 virtual TFSProgress GetFSProgressL() const; |
109 |
|
110 void RequestResponseL( TFSProgress aEvent, TInt aRequestId ); |
91 |
111 |
92 |
112 // <qmail> Connected() used from baseclass |
93 /** |
113 |
94 * |
114 protected: // From CActive |
95 */ |
115 void DoRunL(); |
96 virtual TInt IpsOpType() const; |
116 void DoCancel(); |
97 |
117 |
98 public: // from MMsvImapConnectionObserver |
118 private: |
99 |
119 enum TImapConnectionState |
100 /** |
120 { |
101 * HandleImapConnectionEvent() |
121 EStateStartConnect, |
102 * From MMsvImapConnectionObserver |
122 // <qmail> removing EStateQueryingDetails, EStateQueryingDetailsBusy |
103 * @param TImapConnectionEvent, imap connection event |
123 EStateConnectAndSync, |
104 */ |
124 EStatePopulateAllCompleted, |
105 void HandleImapConnectionEvent( |
125 EStateCompleted, |
106 TImapConnectionEvent aConnectionEvent); |
126 EStateIdle |
107 |
127 }; |
108 |
128 |
109 public: // from MFSMailRequestObserver |
129 // <qmail> priority parameter has been removed |
110 |
130 // <qmail> MFSMailRequestObserver& changed it to pointer |
111 void RequestResponseL( TFSProgress aEvent, TInt aRequestId ); |
131 // <qmail> aSignallingAllowed parameter has been removed |
112 |
132 CIpsPlgImap4ConnectOp( |
113 public: |
133 CMsvSession& aMsvSession, |
114 |
134 TRequestStatus& aObserverRequestStatus, |
115 /** |
135 TMsvId aService, |
116 * |
136 CIpsPlgTimerOperation& aActivityTimer, |
117 */ |
137 TFSMailMsgId aFSMailBoxId, |
118 TBool Connected() const; |
138 MFSMailRequestObserver* aFSOperationObserver, |
119 |
139 TInt aFSRequestId, |
120 protected: |
140 TBool aDoPlainConnect, |
121 |
141 CIpsPlgEventHandler* aEventHandler ); |
122 /** |
142 |
123 * From CActive |
143 void ConstructL(); |
124 */ |
144 |
125 void DoRunL(); |
145 /** |
126 |
146 * Handles one internal state |
127 /** |
147 */ |
128 * |
148 void DoConnectOpL(); |
129 */ |
149 |
130 void DoCancel(); |
150 // <qmail> remove void StartL(); |
131 |
151 |
132 /** |
152 /** |
133 * From CIpsPlgOnlineoperation |
153 * Handles one internal state |
134 */ |
154 */ |
135 //TInt GetOperationErrorCodeL( ); |
155 void DoPopulateAllL(); |
136 |
156 |
137 private: |
157 // <qmail> removed QueryUserPwdL(); |
138 |
158 |
139 enum TImapConnectionState |
159 /** |
140 { |
160 * initiates sync state changed event |
141 EStateStartConnect, |
161 */ |
142 EStateQueryingDetails, |
162 void SignalSyncStarted(); |
143 EStateQueryingDetailsBusy, |
163 |
144 EStateConnectAndSync, |
164 /** |
145 EStatePopulateAllCompleted, |
165 * initiates sync state changed event |
146 EStateCompleted, |
166 * @param aError specifies completion status |
147 EStateIdle }; |
167 */ |
148 |
168 void SignalSyncCompleted( TInt aError ); |
149 /** |
169 |
150 * CIpsPlgImap4ConnectionOp() |
170 // <qmail> moved to public |
151 * @param CMsvSession&, CMsvSession reference |
171 |
152 * @param TInt, priority |
172 /** |
153 * @param TRequestStatus&, request status |
173 * GetImapSettingsLC() |
154 * @param TMsvId, service ( mailbox ) id |
174 * constructs imap settings object with this account's settings (based on iService member) |
155 * @param MMsvProgressReporter&, prog. reporter |
175 * @return CImImap4Settings object as a pointer. Object is placed into CleanupStack. |
156 * @param TImapConnectionType, connection type |
176 */ |
157 */ |
177 CImImap4Settings* GetImapSettingsLC(); |
158 CIpsPlgImap4ConnectOp( |
178 |
159 CMsvSession& aMsvSession, |
179 /** |
160 TInt aPriority, |
180 * Updates iSelection member to contain the message entries from inbox folder |
161 TRequestStatus& aObserverRequestStatus, |
181 * NOTE: all prior contents of iSelection will be deleted |
162 TMsvId aService, |
182 * NOTE: takes care of only direct Inbox folder |
163 CIpsPlgTimerOperation& aActivityTimer, |
183 */ |
164 TFSMailMsgId aFSMailBoxId, |
184 void CreateInboxMessagesSelectionL(); |
165 MFSMailRequestObserver& aFSOperationObserver, |
185 |
166 TInt aFSRequestId, |
186 // </qmail> |
167 TBool aDoPlainConnect, |
187 |
168 TBool aSignallingAllowed, |
188 private: //Data |
169 CIpsPlgEventHandler* aEventHandler ); |
189 // internal state of this operation |
170 |
190 TImapConnectionState iState; |
171 /** |
191 TPckgBuf<TImap4CompoundProgress> iProgressBuf; |
172 * ConstructL() |
192 CMsvEntrySelection* iSelection; |
173 */ |
193 // whether caller instantiated this op to do only connect or not |
174 void ConstructL(); |
194 TBool iDoPlainConnect; |
175 |
195 // pointer to event handler in order to signal sync status to client |
176 /** |
196 CIpsPlgEventHandler* iEventHandler; // not owned |
177 * |
197 // prevents signalling sync started for more than once |
178 */ |
198 TBool iIsSyncStartedSignaled; |
179 void DoConnectOpL(); |
199 |
180 |
200 // <qmail> iAlreadyConnected removed |
181 /** |
|
182 * |
|
183 */ |
|
184 void StartL(); |
|
185 |
|
186 /** |
|
187 * |
|
188 */ |
|
189 void DoPopulateAllL(); |
|
190 |
|
191 /** |
|
192 * Send user password query request to CIpsPlgEventHandler |
|
193 * @return ETrue - if query send |
|
194 */ |
|
195 TBool QueryUserPassL(); |
|
196 |
|
197 |
|
198 /** |
|
199 * |
|
200 */ |
|
201 void SignalSyncStarted(); |
|
202 |
|
203 /** |
|
204 * |
|
205 */ |
|
206 void SignalSyncCompleted( TInt aError ); |
|
207 |
|
208 |
|
209 private: //Data |
|
210 |
|
211 TImapConnectionState iState; |
|
212 TPckgBuf<TImap4CompoundProgress> iProgressBuf; |
|
213 CMsvEntrySelection* iSelection; |
|
214 TBool iDoPlainConnect; |
|
215 |
|
216 |
|
217 |
|
218 // not owned |
|
219 CIpsPlgEventHandler* iEventHandler; |
|
220 TBool iIsSyncStartedSignaled; |
|
221 |
|
222 // set to true if connection is already exists |
|
223 TBool iAlreadyConnected; |
|
224 }; |
201 }; |
225 |
202 |
226 #endif |
203 #endif // IPSPLGIMAP4CONNECT_H |