|
1 /* |
|
2 * Copyright (c) 2002 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 * Agent which holds an array of email protocol specific agents |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __ALWAYSONLINEEMAILAGENT_H__ |
|
21 #define __ALWAYSONLINEEMAILAGENT_H__ |
|
22 |
|
23 //INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <msvapi.h> |
|
26 #include <MuiuMsvSingleOpWatcher.h> |
|
27 #include <imapconnectionobserver.h> |
|
28 #include <AlwaysOnlineManagerCommon.h> |
|
29 |
|
30 #include "AlwaysOnlineEmailAgentBase.h" |
|
31 |
|
32 |
|
33 //constants |
|
34 const TInt KEmailAgentOperationsGranularity = 5; |
|
35 |
|
36 //forward declarations |
|
37 class MAlwaysOnlineStatusQueryInterface; |
|
38 class CAlwaysOnlineEmailEMNResolver; |
|
39 |
|
40 /** |
|
41 * CAlwaysOnlineEmailAgent |
|
42 * |
|
43 */ |
|
44 class CAlwaysOnlineEmailAgent : public CBase |
|
45 { |
|
46 public: |
|
47 |
|
48 /** |
|
49 * CAlwaysOnlineEmailAgent |
|
50 * @param CMsvSession&, CMsvSession reference |
|
51 * @param MAlwaysOnlineStatusQueryInterface&, status query interface reference |
|
52 */ |
|
53 CAlwaysOnlineEmailAgent( |
|
54 CMsvSession& aMsvSession, |
|
55 MAlwaysOnlineStatusQueryInterface& aAlwaysOnlineManager ); |
|
56 |
|
57 |
|
58 /** |
|
59 * ~CAlwaysOnlineEmailAgent() |
|
60 */ |
|
61 ~CAlwaysOnlineEmailAgent(); |
|
62 |
|
63 /** |
|
64 * NewL |
|
65 * @param CMsvSession&, CMsvSession reference |
|
66 * @param MAlwaysOnlineStatusQueryInterface&, status query interface reference |
|
67 * @return CAlwaysOnlineEmailAgent*, self pointer |
|
68 */ |
|
69 static CAlwaysOnlineEmailAgent* NewL( |
|
70 CMsvSession& aMsvSession, |
|
71 MAlwaysOnlineStatusQueryInterface& aAlwaysOnlineManager ); |
|
72 |
|
73 /** |
|
74 * StartL |
|
75 */ |
|
76 void StartL(); |
|
77 |
|
78 /** |
|
79 * SuspendNWOperationsL |
|
80 */ |
|
81 void SuspendNWOperationsL(); |
|
82 |
|
83 /** |
|
84 * ResumeNWOperationsL |
|
85 */ |
|
86 void ResumeNWOperationsL(); |
|
87 |
|
88 /** |
|
89 * RoamingEventL |
|
90 */ |
|
91 void RoamingEventL(); |
|
92 |
|
93 /** |
|
94 * HomeNetworkEventL |
|
95 */ |
|
96 void HomeNetworkEventL(); |
|
97 |
|
98 /** |
|
99 * HandleOutOfDiskL |
|
100 */ |
|
101 void HandleOutOfDiskL(); |
|
102 |
|
103 /** |
|
104 * HandleEMNMessageL |
|
105 * @since Series60 3.0 |
|
106 * @param aParameter |
|
107 */ |
|
108 void HandleEMNMessageL( const TDesC8& aParameter ); |
|
109 |
|
110 /** |
|
111 * ActivateOnlineMailboxesL |
|
112 */ |
|
113 void ActivateOnlineMailboxesL(); |
|
114 |
|
115 /** |
|
116 * GetMailboxesLC |
|
117 * @return CMsvEntrySelection*, all mailboxes |
|
118 */ |
|
119 CMsvEntrySelection* GetMailboxesLC(); |
|
120 |
|
121 /** |
|
122 * RefreshMailAgentArrayL |
|
123 */ |
|
124 void RefreshMailAgentArrayL(); |
|
125 |
|
126 /** |
|
127 * MailboxSettingsChangedL |
|
128 * @param TMsvId, mailbox id |
|
129 */ |
|
130 void MailboxSettingsChangedL( TMsvId aMailboxId ); |
|
131 |
|
132 /** |
|
133 * RemoveMailAgentL |
|
134 */ |
|
135 void RemoveMailAgentL(); |
|
136 |
|
137 /** |
|
138 * SwitchOffAllAgentsL() |
|
139 * Will turn off all mailbox agents. |
|
140 */ |
|
141 void SwitchOffAllAgentsL(); |
|
142 |
|
143 /** |
|
144 * Turns on/off the AlwaysOnline or set it to be removed |
|
145 * @since Series60 2.6 |
|
146 * @param aCommand Command used to handle the AO |
|
147 * @param aParameter |
|
148 */ |
|
149 void HandleAOStateL( |
|
150 const TInt aCommand, |
|
151 const TDesC8& aParameter ); |
|
152 |
|
153 private: |
|
154 |
|
155 /** |
|
156 * ConstructL |
|
157 */ |
|
158 void ConstructL(); |
|
159 |
|
160 /** |
|
161 * FindMailbox |
|
162 * @param TMsvId, mailbox id |
|
163 * @return CAlwaysOnlineEmailAgentBase*, returns email agent for given mailbox. NULL if not found |
|
164 */ |
|
165 CAlwaysOnlineEmailAgentBase* FindMailbox( TMsvId aMailboxId ); |
|
166 |
|
167 public: |
|
168 |
|
169 /** |
|
170 * AddMailboxL |
|
171 * @param TMsvId, mailbox id |
|
172 * @return CAlwaysOnlineEmailAgentBase* returns email agent for given mailbox. |
|
173 * Can return NULL if mailbox not imap4 or pop3 or mailbox not found at all |
|
174 */ |
|
175 CAlwaysOnlineEmailAgentBase* AddMailboxL( TMsvId aMailboxId ); |
|
176 |
|
177 |
|
178 /** |
|
179 * DeleteMailbox |
|
180 * @param TMsvId, mailbox id |
|
181 * @return TBool, deletion successful |
|
182 */ |
|
183 TBool DeleteMailbox( TMsvId aMailboxId ); |
|
184 |
|
185 |
|
186 private: |
|
187 |
|
188 /** |
|
189 * IsMailAgentActiveL |
|
190 * @param TMsvId, mailbox id |
|
191 * @return TBool, ETrue if mailbox has been set to be auto update or emn |
|
192 */ |
|
193 TBool IsMailAgentActiveL( TMsvId aMailboxId ); |
|
194 |
|
195 /** |
|
196 * Turns Always online on or off |
|
197 * @since Series60 2.6 |
|
198 * @param aMailboxId |
|
199 * @param aState |
|
200 */ |
|
201 void MailboxSetActivityL( |
|
202 const TMsvId aMailboxId, |
|
203 const TBool aState ); |
|
204 |
|
205 /** |
|
206 * Dispatches MsvId from parameter |
|
207 * @since Series60 2.6 |
|
208 * @param aParameters Parameters |
|
209 * @param aId Parameter to store the id |
|
210 * @return KErrNone, if dispatching is ok |
|
211 */ |
|
212 TInt ParameterDispatchMsvId( |
|
213 const TDesC8& aParameters, |
|
214 TMsvId& aMailboxId ) const; |
|
215 |
|
216 void MailboxUpdateMailWhileConnectedL( const TMsvId aMailboxId ); |
|
217 |
|
218 //data |
|
219 private: |
|
220 MAlwaysOnlineStatusQueryInterface& iAlwaysOnlineManager; |
|
221 |
|
222 CClientMtmRegistry* iClientMtmRegistry; |
|
223 CMsvSession& iSession; |
|
224 CAOEmailAgentArray* iMailAgentArray; |
|
225 CAlwaysOnlineEmailEMNResolver* iEmnResolver; |
|
226 |
|
227 }; |
|
228 |
|
229 |
|
230 #endif |
|
231 |
|
232 //EOF |