|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * Contains imap specified sync logic |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef IPSSOSAOIMAPAGENT_H_ |
|
21 #define IPSSOSAOIMAPAGENT_H_ |
|
22 |
|
23 #include <imapconnectionobserver.h> |
|
24 #include <imapset.h> |
|
25 #include <mtclreg.h> |
|
26 //<cmail> |
|
27 #include "MFSMailRequestObserver.h" |
|
28 //</cmail> |
|
29 |
|
30 #include "IpsSosAOBaseAgent.h" |
|
31 |
|
32 class CImap4ClientMtm; |
|
33 class CIpsSetDataApi; |
|
34 |
|
35 /** |
|
36 * class CIpsSosAOImapAgent; |
|
37 * |
|
38 * Is created by IpsSosAOBaseAgent, contains imap spesific implementations of base class pure |
|
39 * virtual functions. |
|
40 * |
|
41 */ |
|
42 class CIpsSosAOImapAgent : public CIpsSosAOBaseAgent, |
|
43 public MMsvImapConnectionObserver, |
|
44 public MFSMailRequestObserver |
|
45 { |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Two phased constructor |
|
50 * @return self pointer |
|
51 */ |
|
52 static CIpsSosAOImapAgent* NewL( |
|
53 CMsvSession& aSession, |
|
54 MIpsSosAOAgentOperationResponse& aOpResponse, |
|
55 TMsvId aServiceId ); |
|
56 |
|
57 /** |
|
58 * Destructor |
|
59 */ |
|
60 virtual ~CIpsSosAOImapAgent(); |
|
61 |
|
62 public: // from CIpsSosAOBaseAgent |
|
63 |
|
64 virtual void GetServerAddress( |
|
65 TBuf<KIpsSosAOTextBufferSize>& aIncomingServer ) const; |
|
66 |
|
67 virtual void GetUsername( |
|
68 TBuf8<KIpsSosAOTextBufferSize>& aUsername ) const; |
|
69 |
|
70 virtual TBool IsConnected() const; |
|
71 |
|
72 virtual void StartSyncL(); |
|
73 |
|
74 virtual void StartFetchMessagesL( const RArray<TMsvId>& aFetchMsgArray ); |
|
75 |
|
76 virtual void CancelAllAndDisconnectL(); |
|
77 |
|
78 virtual void CancelAllAndDoNotDisconnect(); |
|
79 |
|
80 virtual void DoNotDisconnect(); |
|
81 |
|
82 virtual void ClearDoNotDisconnect(); |
|
83 |
|
84 virtual void HoldOperations(); |
|
85 |
|
86 virtual void ContinueHoldOperations(); |
|
87 |
|
88 virtual CIpsSosAOBaseAgent::TAgentState GetState() const; |
|
89 |
|
90 virtual void LoadSettingsL(); |
|
91 |
|
92 public: // MMsvImapConnectionObserver |
|
93 |
|
94 /** |
|
95 * @param TImapConnectionEvent, imap connection event |
|
96 */ |
|
97 virtual void HandleImapConnectionEvent( |
|
98 TImapConnectionEvent aConnectionEvent); |
|
99 |
|
100 public: // MFSMailRequestObserver |
|
101 |
|
102 /** |
|
103 * used as dummy observer, needed for population operation |
|
104 */ |
|
105 virtual void RequestResponseL( TFSProgress aEvent, TInt aRequestId ); |
|
106 |
|
107 private: |
|
108 |
|
109 /** |
|
110 * Constructor |
|
111 */ |
|
112 CIpsSosAOImapAgent( |
|
113 CMsvSession& aSession, |
|
114 MIpsSosAOAgentOperationResponse& aOpResponse, |
|
115 TMsvId aServiceId ); |
|
116 |
|
117 /** |
|
118 * Second phase constructor |
|
119 */ |
|
120 void ConstructL(); |
|
121 |
|
122 virtual void DoCancel(); |
|
123 |
|
124 virtual void RunL(); |
|
125 |
|
126 virtual TInt RunError( TInt aError ); |
|
127 |
|
128 void PopulateAllL(); |
|
129 |
|
130 inline void SetActiveAndCompleteThis(); |
|
131 |
|
132 private: |
|
133 |
|
134 CMsvSession& iSession; |
|
135 MIpsSosAOAgentOperationResponse& iOpResponse; |
|
136 TMsvId iServiceId; |
|
137 TAgentState iState; |
|
138 TBool iDoNotDisconnect; |
|
139 CImImap4Settings* iImapSettings; |
|
140 CMsvOperation* iOngoingOp; |
|
141 |
|
142 TPckgBuf<TImap4CompoundProgress> iProgressBuf; |
|
143 TInt iError; |
|
144 CImap4ClientMtm* iImapClientMtm; |
|
145 CClientMtmRegistry* iMtmReg; |
|
146 RArray<TMsvId> iFoldersArray; |
|
147 CIpsSetDataApi* iDataApi; |
|
148 |
|
149 }; |
|
150 |
|
151 #endif /*IPSSOSAOIMAPAGENT_H_*/ |