|
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: ImumMboxInternalDataConverter.cpp |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32base.h> |
|
21 #include <miutset.h> |
|
22 #include <smtpset.h> |
|
23 #include <pop3set.h> |
|
24 #include <imapset.h> |
|
25 #include <SendUiConsts.h> |
|
26 |
|
27 #include "ImumMboxInternalDataConverter.h" |
|
28 #include "ImumInSettingsDataCollection.h" |
|
29 #include "ImumDaSettingsKeys.h" |
|
30 #include "ImumInSettingsKeys.h" |
|
31 #include "ImumDaErrorCodes.h" |
|
32 #include "ImumPanic.h" |
|
33 #include "ImumMboxData.h" |
|
34 #include "ImumInSettingsDataImpl.h" |
|
35 #include "ImumInSettingsDataCollectionImpl.h" |
|
36 #include "ImumInMailboxServicesImpl.h" |
|
37 #include "ImumInternalApiImpl.h" |
|
38 #include "ComDbUtl.h" |
|
39 #include "EmailUtils.H" |
|
40 #include "ImumUtilsLogging.h" |
|
41 |
|
42 // EXTERNAL DATA STRUCTURES |
|
43 // EXTERNAL FUNCTION PROTOTYPES |
|
44 // CONSTANTS |
|
45 // MACROS |
|
46 // LOCAL CONSTANTS AND MACROS |
|
47 // MODULE DATA STRUCTURES |
|
48 // LOCAL FUNCTION PROTOTYPES |
|
49 // FORWARD DECLARATIONS |
|
50 |
|
51 // ============================ MEMBER FUNCTIONS =============================== |
|
52 |
|
53 // ---------------------------------------------------------------------------- |
|
54 // CImumMboxInternalDataConverter::CImumMboxInternalDataConverter() |
|
55 // ---------------------------------------------------------------------------- |
|
56 // |
|
57 CImumMboxInternalDataConverter::CImumMboxInternalDataConverter( |
|
58 CImumInternalApiImpl& aMailboxApi, |
|
59 const CImumMboxData& aSourceData, |
|
60 CImumInSettingsData& aTargetData ) |
|
61 : |
|
62 iMailboxApi( aMailboxApi ), |
|
63 iTargetData( aTargetData ), |
|
64 iSourceData( aSourceData ) |
|
65 { |
|
66 IMUM_CONTEXT( CImumMboxInternalDataConverter::CImumMboxInternalDataConverter, 0, KLogData ); |
|
67 |
|
68 } |
|
69 |
|
70 // ---------------------------------------------------------------------------- |
|
71 // CImumMboxInternalDataConverter::~CImumMboxInternalDataConverter() |
|
72 // ---------------------------------------------------------------------------- |
|
73 // |
|
74 CImumMboxInternalDataConverter::~CImumMboxInternalDataConverter() |
|
75 { |
|
76 IMUM_CONTEXT( CImumMboxInternalDataConverter::~CImumMboxInternalDataConverter, 0, KLogData ); |
|
77 } |
|
78 |
|
79 // ---------------------------------------------------------------------------- |
|
80 // CImumMboxInternalDataConverter::ConstructL() |
|
81 // ---------------------------------------------------------------------------- |
|
82 // |
|
83 void CImumMboxInternalDataConverter::ConstructL() |
|
84 { |
|
85 IMUM_CONTEXT( CImumMboxInternalDataConverter::ConstructL, 0, KLogData ); |
|
86 } |
|
87 |
|
88 // ---------------------------------------------------------------------------- |
|
89 // CImumMboxInternalDataConverter::NewL() |
|
90 // ---------------------------------------------------------------------------- |
|
91 // |
|
92 CImumMboxInternalDataConverter* CImumMboxInternalDataConverter::NewL( |
|
93 CImumInternalApiImpl& aMailboxApi, |
|
94 const CImumMboxData& aSourceData, |
|
95 CImumInSettingsData& aTargetData ) |
|
96 { |
|
97 IMUM_STATIC_CONTEXT( CImumMboxInternalDataConverter::NewL, 0, utils, KLogData ); |
|
98 |
|
99 CImumMboxInternalDataConverter* self = NewLC( |
|
100 aMailboxApi, aSourceData, aTargetData ); |
|
101 CleanupStack::Pop( self ); |
|
102 |
|
103 return self; |
|
104 } |
|
105 |
|
106 // ---------------------------------------------------------------------------- |
|
107 // CImumMboxInternalDataConverter::NewLC() |
|
108 // ---------------------------------------------------------------------------- |
|
109 // |
|
110 CImumMboxInternalDataConverter* CImumMboxInternalDataConverter::NewLC( |
|
111 CImumInternalApiImpl& aMailboxApi, |
|
112 const CImumMboxData& aSourceData, |
|
113 CImumInSettingsData& aTargetData ) |
|
114 { |
|
115 IMUM_STATIC_CONTEXT( CImumMboxInternalDataConverter::NewLC, 0, utils, KLogData ); |
|
116 |
|
117 CImumMboxInternalDataConverter* self = |
|
118 new ( ELeave ) CImumMboxInternalDataConverter( |
|
119 aMailboxApi, aSourceData, aTargetData ); |
|
120 CleanupStack::PushL( self ); |
|
121 self->ConstructL(); |
|
122 |
|
123 return self; |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------------------------- |
|
127 // CImumMboxInternalDataConverter::ConvertToInternalMboxDataLC() |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 CImumInSettingsData* CImumMboxInternalDataConverter::ConvertToInternalMboxDataLC( |
|
131 CImumInternalApiImpl& aMailboxApi, |
|
132 const CImumMboxData& aSourceData ) |
|
133 { |
|
134 IMUM_STATIC_CONTEXT( CImumMboxInternalDataConverter::ConvertToInternalMboxDataLC, 0, utils, KLogData ); |
|
135 |
|
136 TUid protocol = { 0 }; |
|
137 |
|
138 // Imap4 settings? |
|
139 if ( aSourceData.iIsImap4 ) |
|
140 { |
|
141 protocol = KSenduiMtmImap4Uid; |
|
142 } |
|
143 // Pop3 settings! |
|
144 else |
|
145 { |
|
146 protocol = KSenduiMtmPop3Uid; |
|
147 } |
|
148 |
|
149 CImumInSettingsData* targetData = CreateInternalDataLC( aMailboxApi, protocol ); |
|
150 |
|
151 ConvertToInternalMboxDataL( aMailboxApi, aSourceData, *targetData ); |
|
152 |
|
153 return targetData; |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // CImumMboxInternalDataConverter::ConvertToInternalMboxDataL() |
|
158 // --------------------------------------------------------------------------- |
|
159 // |
|
160 void CImumMboxInternalDataConverter::ConvertToInternalMboxDataL( |
|
161 CImumInternalApiImpl& aMailboxApi, |
|
162 const CImumMboxData& aSourceData, |
|
163 CImumInSettingsData& aTargetData ) |
|
164 { |
|
165 IMUM_STATIC_CONTEXT( CImumMboxInternalDataConverter::ConvertToInternalMboxDataL, 0, utils, KLogData ); |
|
166 |
|
167 CImumMboxInternalDataConverter* converter = NewLC( |
|
168 aMailboxApi, aSourceData, aTargetData ); |
|
169 |
|
170 converter->DoConvertToInternalMboxDataL(); |
|
171 |
|
172 CleanupStack::PopAndDestroy( converter ); |
|
173 converter = NULL; |
|
174 } |
|
175 |
|
176 // --------------------------------------------------------------------------- |
|
177 // CImumMboxInternalDataConverter::DoConvertToInternalMboxDataL() |
|
178 // --------------------------------------------------------------------------- |
|
179 // |
|
180 void CImumMboxInternalDataConverter::DoConvertToInternalMboxDataL() |
|
181 { |
|
182 IMUM_CONTEXT( CImumMboxInternalDataConverter::DoConvertToInternalMboxDataL, 0, KLogData ); |
|
183 |
|
184 SetIdsToInternalDataL(); |
|
185 |
|
186 // Imap4 settings? |
|
187 if ( iSourceData.iIsImap4 ) |
|
188 { |
|
189 ConvToInternalImap4DataL(); |
|
190 } |
|
191 // Pop3 settings! |
|
192 else |
|
193 { |
|
194 ConvToInternalPop3DataL(); |
|
195 } |
|
196 } |
|
197 |
|
198 // --------------------------------------------------------------------------- |
|
199 // CImumMboxInternalDataConverter::CreateInternalDataLC() |
|
200 // --------------------------------------------------------------------------- |
|
201 // |
|
202 CImumInSettingsData* CImumMboxInternalDataConverter::CreateInternalDataLC( |
|
203 CImumInternalApiImpl& aMailboxApi, |
|
204 const TUid& aProtocol ) |
|
205 { |
|
206 IMUM_STATIC_CONTEXT( CImumMboxInternalDataConverter::CreateInternalDataLC, 0, utils, KLogData ); |
|
207 |
|
208 CImumInSettingsData* data = |
|
209 aMailboxApi.MailboxServicesL().CreateSettingsDataL( aProtocol ); |
|
210 CleanupStack::PushL( data ); |
|
211 return data; |
|
212 } |
|
213 |
|
214 // --------------------------------------------------------------------------- |
|
215 // CImumMboxInternalDataConverter::ConvToInternalImap4DataL() |
|
216 // --------------------------------------------------------------------------- |
|
217 // |
|
218 void CImumMboxInternalDataConverter::ConvToInternalImap4DataL() |
|
219 { |
|
220 IMUM_CONTEXT( CImumMboxInternalDataConverter::ConvToInternalImap4DataL, 0, KLogData ); |
|
221 |
|
222 DoPopulateInternalImap4SettingsL(); |
|
223 DoPopulateInternalSmtpSettingsL(); |
|
224 DoPopulateInternalGeneralSettingsL(); |
|
225 } |
|
226 |
|
227 // --------------------------------------------------------------------------- |
|
228 // CImumMboxInternalDataConverter::ConvToInternalPop3DataL() |
|
229 // --------------------------------------------------------------------------- |
|
230 // |
|
231 void CImumMboxInternalDataConverter::ConvToInternalPop3DataL() |
|
232 { |
|
233 IMUM_CONTEXT( CImumMboxInternalDataConverter::ConvToInternalPop3DataL, 0, KLogData ); |
|
234 |
|
235 DoPopulateInternalPop3SettingsL(); |
|
236 DoPopulateInternalSmtpSettingsL(); |
|
237 DoPopulateInternalGeneralSettingsL(); |
|
238 } |
|
239 |
|
240 // --------------------------------------------------------------------------- |
|
241 // CImumMboxInternalDataConverter::DoPopulateInternalImap4SettingsL() |
|
242 // --------------------------------------------------------------------------- |
|
243 // |
|
244 void CImumMboxInternalDataConverter::DoPopulateInternalImap4SettingsL() |
|
245 { |
|
246 IMUM_CONTEXT( CImumMboxInternalDataConverter::DoPopulateInternalImap4SettingsL, 0, KLogData ); |
|
247 |
|
248 // CONNECTION SETTINGS |
|
249 MImumInSettingsDataCollection& connSett = iTargetData.GetInSetL(0); |
|
250 const CImImap4Settings& imap4 = *iSourceData.iImap4Settings; |
|
251 |
|
252 // |
|
253 FillTextInternalL<KImumDaServerSettingLength>( |
|
254 connSett, TImumDaSettings::EKeyServer, |
|
255 imap4.ServerAddress() ); |
|
256 |
|
257 // |
|
258 FillText8InternalL<KImumDaUserNameLength>( |
|
259 connSett, TImumDaSettings::EKeyUsername, |
|
260 imap4.LoginName() ); |
|
261 |
|
262 // |
|
263 FillText8InternalL<KImumDaPasswordLength>( |
|
264 connSett, TImumDaSettings::EKeyPassword, |
|
265 imap4.Password() ); |
|
266 |
|
267 // |
|
268 User::LeaveIfError( connSett.SetAttr( |
|
269 TImumDaSettings::EKeySecurity, |
|
270 MsvEmailMtmUiUtils::RestoreSecuritySettings( imap4 ) ) ); |
|
271 |
|
272 // |
|
273 User::LeaveIfError( connSett.SetAttr( |
|
274 TImumDaSettings::EKeyPort, |
|
275 static_cast<TInt>( imap4.Port() ) ) ); |
|
276 |
|
277 // |
|
278 User::LeaveIfError( connSett.SetAttr( |
|
279 TImumInSettings::EKeySyncFlags, |
|
280 GetInternalImapDownload( imap4.GetMailOptions() ) ) ); |
|
281 |
|
282 // |
|
283 User::LeaveIfError( connSett.SetAttr( |
|
284 TImumInSettings::EKeyDownloadFlags, |
|
285 GetInternalImapPartial( imap4.PartialMailOptions() ) ) ); |
|
286 |
|
287 // |
|
288 User::LeaveIfError( connSett.SetAttr( |
|
289 TImumInSettings::EKeyDownloadBodySize, |
|
290 imap4.BodyTextSizeLimit() ) ); |
|
291 |
|
292 // |
|
293 User::LeaveIfError( connSett.SetAttr( |
|
294 TImumInSettings::EKeyDownloadAttachmentSize, |
|
295 imap4.AttachmentSizeLimit() ) ); |
|
296 |
|
297 // |
|
298 User::LeaveIfError( connSett.SetAttr( |
|
299 TImumInSettings::EKeyDownloadMaxEmailSize, |
|
300 static_cast<TInt>( imap4.MaxEmailSize() ) ) ); |
|
301 |
|
302 // |
|
303 User::LeaveIfError( connSett.SetAttr( |
|
304 TImumInSettings::EKeyImapIdle, |
|
305 imap4.ImapIdle() ) ); |
|
306 |
|
307 // |
|
308 User::LeaveIfError( connSett.SetAttr( |
|
309 TImumInSettings::EKeyImapIdleTimeout, |
|
310 imap4.ImapIdleTimeout() ) ); |
|
311 |
|
312 // |
|
313 FillText8InternalL<KImumDaFolderPathLength>( |
|
314 connSett, TImumDaSettings::EImapFolderPath, |
|
315 imap4.FolderPath() ); |
|
316 |
|
317 // |
|
318 User::LeaveIfError( connSett.SetAttr( |
|
319 TImumInSettings::EKeySyncRate, |
|
320 imap4.SyncRate() ) ); |
|
321 |
|
322 // MAILBOX SETTINGS |
|
323 |
|
324 // |
|
325 TBuf8<KImumInSeparatorLength> buffer; |
|
326 buffer.Append(imap4.PathSeparator()); |
|
327 FillText8InternalL<KImumInSeparatorLength>( |
|
328 iTargetData, TImumInSettings::EKeyPathSeparator, |
|
329 buffer ); |
|
330 |
|
331 // |
|
332 FillText8InternalL<KImumInSearchStringLength>( |
|
333 iTargetData, TImumInSettings::EKeySearchString, |
|
334 imap4.SearchString() ); |
|
335 |
|
336 // |
|
337 User::LeaveIfError( iTargetData.SetAttr( |
|
338 TImumInSettings::EKeyDisconnectedMode, |
|
339 imap4.DisconnectedUserMode() ) ); |
|
340 |
|
341 // |
|
342 User::LeaveIfError( iTargetData.SetAttr( |
|
343 TImumInSettings::EKeySynchronise, |
|
344 imap4.Synchronise() ) ); |
|
345 |
|
346 // |
|
347 User::LeaveIfError( iTargetData.SetAttr( |
|
348 TImumInSettings::EKeySubscribe, |
|
349 imap4.Subscribe() ) ); |
|
350 |
|
351 // |
|
352 User::LeaveIfError( iTargetData.SetAttr( |
|
353 TImumInSettings::EKeyAutoSendOnConnect, |
|
354 imap4.AutoSendOnConnect() ) ); |
|
355 |
|
356 // |
|
357 User::LeaveIfError( iTargetData.SetAttr( |
|
358 TImumInSettings::EKeyDeleteEmailsWhenDisconnecting, |
|
359 imap4.DeleteEmailsWhenDisconnecting() ) ); |
|
360 |
|
361 // |
|
362 User::LeaveIfError( iTargetData.SetAttr( |
|
363 TImumInSettings::EKeyAcknowledgeReceipts, |
|
364 imap4.AcknowledgeReceipts() ) ); |
|
365 |
|
366 // |
|
367 TInt32 val = imap4.InboxSynchronisationLimit(); |
|
368 User::LeaveIfError( iTargetData.SetAttr( |
|
369 TImumDaSettings::EKeyInboxUpdateLimit, |
|
370 ( val > 0 ) ? val : KErrNotFound ) ); |
|
371 |
|
372 // |
|
373 User::LeaveIfError( iTargetData.SetAttr( |
|
374 TImumDaSettings::EKeyFolderUpdateLimit, |
|
375 imap4.MailboxSynchronisationLimit() ) ); |
|
376 |
|
377 // |
|
378 User::LeaveIfError( iTargetData.SetAttr( |
|
379 TImumInSettings::EKeyUpdatingSeenFlag, |
|
380 imap4.UpdatingSeenFlags() ) ); |
|
381 |
|
382 // |
|
383 User::LeaveIfError( iTargetData.SetAttr( |
|
384 TImumInSettings::EKeyFetchSize, |
|
385 static_cast<TInt>( imap4.FetchSize() ) ) ); |
|
386 } |
|
387 |
|
388 // --------------------------------------------------------------------------- |
|
389 // CImumMboxInternalDataConverter::DoPopulateInternalPop3SettingsL() |
|
390 // --------------------------------------------------------------------------- |
|
391 // |
|
392 void CImumMboxInternalDataConverter::DoPopulateInternalPop3SettingsL() |
|
393 { |
|
394 IMUM_CONTEXT( CImumMboxInternalDataConverter::DoPopulateInternalPop3SettingsL, 0, KLogData ); |
|
395 |
|
396 // CONNECTION SETTINGS |
|
397 MImumInSettingsDataCollection& connSett = iTargetData.GetInSetL( 0 ); |
|
398 const CImPop3Settings& pop3 = *iSourceData.iPop3Settings; |
|
399 |
|
400 // |
|
401 FillTextInternalL<KImumDaServerSettingLength>( |
|
402 connSett, |
|
403 TImumDaSettings::EKeyServer, |
|
404 pop3.ServerAddress() ); |
|
405 |
|
406 // |
|
407 User::LeaveIfError( connSett.SetAttr( |
|
408 TImumDaSettings::EKeyPort, |
|
409 static_cast<TInt>( pop3.Port() ) ) ); |
|
410 |
|
411 // |
|
412 User::LeaveIfError( connSett.SetAttr( |
|
413 TImumDaSettings::EKeySecurity, |
|
414 MsvEmailMtmUiUtils::RestoreSecuritySettings( pop3 ) ) ); |
|
415 |
|
416 // |
|
417 FillText8InternalL<KImumDaUserNameLength>( |
|
418 connSett, TImumDaSettings::EKeyUsername, |
|
419 pop3.LoginName() ); |
|
420 |
|
421 // |
|
422 FillText8InternalL<KImumDaPasswordLength>( |
|
423 connSett, TImumDaSettings::EKeyPassword, |
|
424 pop3.Password() ); |
|
425 |
|
426 // |
|
427 User::LeaveIfError( connSett.SetAttr( |
|
428 TImumDaSettings::EKeyAPop, pop3.Apop() ) ); |
|
429 |
|
430 // |
|
431 User::LeaveIfError( connSett.SetAttr( |
|
432 TImumInSettings::EKeySyncFlags, |
|
433 GetInternalPopSyncL( |
|
434 pop3.GetMailOptions() ) ) ); |
|
435 |
|
436 // |
|
437 User::LeaveIfError( connSett.SetAttr( |
|
438 TImumInSettings::EKeySyncFlags, |
|
439 GetInternalPopDownloadL( |
|
440 pop3.PopulationLimit(), connSett ) ) ); |
|
441 |
|
442 // |
|
443 User::LeaveIfError( connSett.SetAttr( |
|
444 TImumInSettings::EKeyDownloadMaxEmailSize, |
|
445 pop3.MaxEmailSize() ) ); |
|
446 |
|
447 // MAILBOX SETTINGS |
|
448 |
|
449 // |
|
450 User::LeaveIfError( iTargetData.SetAttr( |
|
451 TImumInSettings::EKeyAutoSendOnConnect, |
|
452 pop3.AutoSendOnConnect() ) ); |
|
453 |
|
454 // |
|
455 User::LeaveIfError( iTargetData.SetAttr( |
|
456 TImumInSettings::EKeyDisconnectedMode, |
|
457 pop3.DisconnectedUserMode() ) ); |
|
458 |
|
459 // |
|
460 User::LeaveIfError( iTargetData.SetAttr( |
|
461 TImumInSettings::EKeyDeleteEmailsWhenDisconnecting, |
|
462 pop3.DeleteEmailsWhenDisconnecting() ) ); |
|
463 |
|
464 // |
|
465 User::LeaveIfError( iTargetData.SetAttr( |
|
466 TImumInSettings::EKeyAcknowledgeReceipts, |
|
467 pop3.AcknowledgeReceipts() ) ); |
|
468 |
|
469 // |
|
470 TInt32 val = pop3.InboxSynchronisationLimit(); |
|
471 User::LeaveIfError( iTargetData.SetAttr( |
|
472 TImumDaSettings::EKeyInboxUpdateLimit, |
|
473 ( val > 0 ) ? val : KErrNotFound ) ); |
|
474 } |
|
475 |
|
476 // --------------------------------------------------------------------------- |
|
477 // CImumMboxInternalDataConverter::DoPopulateInternalSmtpSettingsL() |
|
478 // --------------------------------------------------------------------------- |
|
479 // |
|
480 void CImumMboxInternalDataConverter::DoPopulateInternalSmtpSettingsL() |
|
481 { |
|
482 IMUM_CONTEXT( CImumMboxInternalDataConverter::DoPopulateInternalSmtpSettingsL, 0, KLogData ); |
|
483 |
|
484 // CONNECTION SETTINGS |
|
485 MImumInSettingsDataCollection& connSett = iTargetData.GetInSetL( 1 ); |
|
486 const CImSmtpSettings& smtp = *iSourceData.iSmtpSettings; |
|
487 |
|
488 // |
|
489 FillTextInternalL<KImumDaServerSettingLength>( |
|
490 connSett, TImumDaSettings::EKeyServer, |
|
491 smtp.ServerAddress() ); |
|
492 |
|
493 // |
|
494 FillText8InternalL<KImumDaUserNameLength>( |
|
495 connSett, TImumDaSettings::EKeyUsername, |
|
496 smtp.LoginName() ); |
|
497 |
|
498 // |
|
499 FillText8InternalL<KImumDaPasswordLength>( |
|
500 connSett, TImumDaSettings::EKeyPassword, |
|
501 smtp.Password() ); |
|
502 |
|
503 // |
|
504 User::LeaveIfError( connSett.SetAttr( |
|
505 TImumDaSettings::EKeyPort, |
|
506 static_cast<TInt>( smtp.Port() ) ) ); |
|
507 |
|
508 // |
|
509 User::LeaveIfError( connSett.SetAttr( |
|
510 TImumDaSettings::EKeySecurity, |
|
511 MsvEmailMtmUiUtils::RestoreSecuritySettings( smtp ) ) ); |
|
512 |
|
513 |
|
514 // MAILBOX SETTINGS |
|
515 |
|
516 // |
|
517 FillTextInternalL<KImumDaEmailSettingLength>( |
|
518 iTargetData, TImumDaSettings::EKeyEmailAddress, |
|
519 smtp.EmailAddress() ); |
|
520 |
|
521 // |
|
522 FillTextInternalL<KImumDaUserAliasLength>( |
|
523 iTargetData, TImumDaSettings::EKeyUserAlias, |
|
524 smtp.EmailAlias() ); |
|
525 |
|
526 // |
|
527 FillTextInternalL<KImumDaEmailSettingLength>( |
|
528 iTargetData, TImumDaSettings::EKeyReplyToAddress, |
|
529 smtp.ReplyToAddress() ); |
|
530 |
|
531 // |
|
532 FillTextInternalL<KImumDaEmailSettingLength>( |
|
533 iTargetData, TImumInSettings::EKeyReceiptAddress, |
|
534 smtp.ReceiptAddress() ); |
|
535 |
|
536 // |
|
537 User::LeaveIfError( iTargetData.SetAttr( |
|
538 TImumInSettings::EKeyDefaultMsgCharSet, |
|
539 smtp.DefaultMsgCharSet().iUid ) ); |
|
540 |
|
541 // |
|
542 User::LeaveIfError( iTargetData.SetAttr( |
|
543 TImumInSettings::EKeyBodyEncoding, |
|
544 smtp.BodyEncoding() ) ); |
|
545 |
|
546 // |
|
547 User::LeaveIfError( iTargetData.SetAttr( |
|
548 TImumInSettings::EKeyAddVCardToEmail, |
|
549 smtp.AddVCardToEmail() ) ); |
|
550 |
|
551 // |
|
552 User::LeaveIfError( iTargetData.SetAttr( |
|
553 TImumDaSettings::EKeyIncludeSignature, |
|
554 smtp.AddSignatureToEmail() ) ); |
|
555 |
|
556 // |
|
557 User::LeaveIfError( iTargetData.SetAttr( |
|
558 TImumInSettings::EKeyRequestReceipts, |
|
559 smtp.RequestReceipts() ) ); |
|
560 |
|
561 // |
|
562 User::LeaveIfError( iTargetData.SetAttr( |
|
563 TImumDaSettings::EKeySendCopyToSelf, |
|
564 smtp.SendCopyToSelf() ) ); |
|
565 |
|
566 // |
|
567 User::LeaveIfError( iTargetData.SetAttr( |
|
568 TImumDaSettings::EKeySendDelay, |
|
569 smtp.SendMessageOption() ) ); |
|
570 |
|
571 // |
|
572 User::LeaveIfError( iTargetData.SetAttr( |
|
573 TImumInSettings::EKeySMTPAuth, |
|
574 smtp.SMTPAuth() ) ); |
|
575 |
|
576 // |
|
577 User::LeaveIfError( iTargetData.SetAttr( |
|
578 TImumInSettings::EKeyInboxLoginDetails, |
|
579 smtp.InboxLoginDetails() ) ); |
|
580 |
|
581 // |
|
582 User::LeaveIfError( iTargetData.SetAttr( |
|
583 TImumInSettings::EKeyToCcIncludeLimit, |
|
584 smtp.ToCcIncludeLimit() ) ); |
|
585 } |
|
586 |
|
587 // --------------------------------------------------------------------------- |
|
588 // CImumMboxInternalDataConverter::DoPopulateInternalGeneralSettingsL() |
|
589 // --------------------------------------------------------------------------- |
|
590 // |
|
591 void CImumMboxInternalDataConverter::DoPopulateInternalGeneralSettingsL() |
|
592 { |
|
593 IMUM_CONTEXT( CImumMboxInternalDataConverter::DoPopulateInternalGeneralSettingsL, 0, KLogData ); |
|
594 |
|
595 const CImumMboxDataExtension& ext = *iSourceData.iExtendedSettings; |
|
596 |
|
597 // Set access point data here |
|
598 SetInternalAccessPointL( 0 ); |
|
599 SetInternalAccessPointL( 1 ); |
|
600 |
|
601 // |
|
602 User::LeaveIfError( iTargetData.SetAttr( |
|
603 TImumDaSettings::EKeyMailboxName, |
|
604 iSourceData.iName ) ); |
|
605 |
|
606 TImumDaSettings::TTextSignature signature; |
|
607 iSourceData.iSignature->iRichText->Extract( |
|
608 signature, 0, KImumDaSignatureLength ); |
|
609 User::LeaveIfError( iTargetData.SetAttr( |
|
610 TImumDaSettings::EKeySignature, |
|
611 signature ) ); |
|
612 |
|
613 // |
|
614 User::LeaveIfError( iTargetData.SetAttr( |
|
615 TImumDaSettings::EKeyMailDeletion, |
|
616 ext.MailDeletion() ) ); |
|
617 |
|
618 // |
|
619 User::LeaveIfError( iTargetData.SetAttr( |
|
620 TImumDaSettings::EKeyAutoNotifications, |
|
621 InternalEmnState( ext.EmailNotificationState() ) ) ); |
|
622 |
|
623 // |
|
624 User::LeaveIfError( iTargetData.SetAttr( |
|
625 TImumDaSettings::EKeyEmailAlert, |
|
626 ext.NewMailIndicators() ) ); |
|
627 |
|
628 // |
|
629 User::LeaveIfError( iTargetData.SetAttr( |
|
630 TImumInSettings::EKeyHideMsgs, |
|
631 ext.HideMsgs() ) ); |
|
632 |
|
633 // |
|
634 User::LeaveIfError( iTargetData.SetAttr( |
|
635 TImumInSettings::EKeyOpenHtmlMail, |
|
636 ext.OpenHtmlMail() ) ); |
|
637 |
|
638 // |
|
639 User::LeaveIfError( iTargetData.SetAttr( |
|
640 TImumInSettings::EKeySettingsVersion, |
|
641 ext.Version() ) ); |
|
642 |
|
643 // |
|
644 User::LeaveIfError( iTargetData.SetAttr( |
|
645 TImumDaSettings::EKeyAutoRetrieval, |
|
646 InternalAoState( ext.AlwaysOnlineState() ) ) ); |
|
647 |
|
648 // |
|
649 User::LeaveIfError( iTargetData.SetAttr( |
|
650 TImumDaSettings::EKeyAutoRetrievalDays, |
|
651 static_cast<TInt>( ext.SelectedWeekDays() ) ) ); |
|
652 |
|
653 // |
|
654 User::LeaveIfError( iTargetData.SetAttr( |
|
655 TImumDaSettings::EKeyAutoRetrievalStartHour, |
|
656 ext.SelectedTimeStart().Int64() ) ); |
|
657 |
|
658 // |
|
659 User::LeaveIfError( iTargetData.SetAttr( |
|
660 TImumDaSettings::EKeyAutoRetrievalEndHour, |
|
661 ext.SelectedTimeStop().Int64() ) ); |
|
662 |
|
663 // |
|
664 User::LeaveIfError( iTargetData.SetAttr( |
|
665 TImumDaSettings::EKeyAutoRetrievalInterval, |
|
666 InternalRetrivalInterval( ext.InboxRefreshTime() ) ) ); |
|
667 |
|
668 // |
|
669 User::LeaveIfError( iTargetData.SetAttr( |
|
670 TImumInSettings::EKeyInfoLastUpdateFailed, |
|
671 ext.LastUpdateInfo().iLastUpdateFailed ) ); |
|
672 |
|
673 // |
|
674 User::LeaveIfError( iTargetData.SetAttr( |
|
675 TImumInSettings::EKeyInfoLastSuccessfulUpdate, |
|
676 ext.LastUpdateInfo().iLastSuccessfulUpdate.Int64() ) ); |
|
677 |
|
678 User::LeaveIfError( iTargetData.SetAttr( |
|
679 TImumInSettings::EKeyAoUpdateSuccessfulWithCurSettings, |
|
680 ext.LastUpdateInfo().iUpdateSuccessfulWithCurSettings ) ); |
|
681 |
|
682 // |
|
683 User::LeaveIfError( iTargetData.SetAttr( |
|
684 TImumInSettings::EKeyIsPredefinedMailbox, |
|
685 ext.IsPredefined() ) ); |
|
686 |
|
687 // Temporary password status |
|
688 const TMuiuFlags& statusFlags = ext.StatusFlags(); |
|
689 // Receive temp password flag |
|
690 User::LeaveIfError( iTargetData[0].SetAttr( |
|
691 TImumInSettings::EKeyTemporaryPassword, |
|
692 statusFlags.Flag( EIMASStatusTempRcvPassword ) ) ); |
|
693 // Transmit temp password flag |
|
694 User::LeaveIfError( iTargetData[1].SetAttr( |
|
695 TImumInSettings::EKeyTemporaryPassword, |
|
696 statusFlags.Flag( EIMASStatusTempSndPassword ) ) ); |
|
697 } |
|
698 |
|
699 // --------------------------------------------------------------------------- |
|
700 // CImumMboxInternalDataConverter::SetIdsToInternalDataL() |
|
701 // --------------------------------------------------------------------------- |
|
702 // |
|
703 void CImumMboxInternalDataConverter::SetIdsToInternalDataL() |
|
704 { |
|
705 IMUM_CONTEXT( CImumMboxInternalDataConverter::SetIdsToInternalDataL, 0, KLogData ); |
|
706 |
|
707 // Get smtp id |
|
708 TMsvId id = iSourceData.iExtendedSettings->MailboxId(); |
|
709 |
|
710 // Set smtp id |
|
711 iTargetData[1].SetAttr( TImumDaSettings::EKeyMailboxId, id ); |
|
712 |
|
713 // Set Receiving id |
|
714 TMsvEntry entry = iMailboxApi.MailboxUtilitiesL().GetMailboxEntryL( id ); |
|
715 iTargetData[0].SetAttr( TImumDaSettings::EKeyMailboxId, entry.iRelatedId ); |
|
716 } |
|
717 |
|
718 // --------------------------------------------------------------------------- |
|
719 // CImumMboxInternalDataConverter::GetInternalImapPartial() |
|
720 // --------------------------------------------------------------------------- |
|
721 // |
|
722 TInt32 CImumMboxInternalDataConverter::GetInternalImapPartial( |
|
723 const TImImap4PartialMailOptions& /* aPartialOptions */ ) |
|
724 { |
|
725 IMUM_CONTEXT( CImumMboxInternalDataConverter::GetInternalImapPartial, 0, KLogData ); |
|
726 |
|
727 return TImumInSettings::EFlagSetDownloadAll; |
|
728 } |
|
729 |
|
730 |
|
731 // --------------------------------------------------------------------------- |
|
732 // CImumMboxInternalDataConverter::GetInternalImapDownload() |
|
733 // --------------------------------------------------------------------------- |
|
734 // |
|
735 TInt32 CImumMboxInternalDataConverter::GetInternalImapDownload( |
|
736 const TImap4GetMailOptions& /* aPartialOptions */ ) |
|
737 { |
|
738 IMUM_CONTEXT( CImumMboxInternalDataConverter::GetInternalImapDownload, 0, KLogData ); |
|
739 |
|
740 return TImumInSettings::EFlagDownloadHeader; |
|
741 } |
|
742 |
|
743 |
|
744 // --------------------------------------------------------------------------- |
|
745 // CImumMboxInternalDataConverter::SetInternalAccessPointL() |
|
746 // --------------------------------------------------------------------------- |
|
747 // |
|
748 void CImumMboxInternalDataConverter::SetInternalAccessPointL( |
|
749 const TInt aIndex ) |
|
750 { |
|
751 IMUM_CONTEXT( CImumMboxInternalDataConverter::SetInternalAccessPointL, 0, KLogData ); |
|
752 |
|
753 // Initialize access point type to Iap Id |
|
754 iTargetData[aIndex].SetAttr( TImumInSettings::EKeyAccessPointType, |
|
755 TImumInSettings::EValueApIsIapId ); |
|
756 |
|
757 // aIndex refers to incoming or outgoing settings |
|
758 TInt ap = KErrNotFound; |
|
759 if ( !aIndex ) |
|
760 { |
|
761 ap = iSourceData.iIncomingIap; |
|
762 } |
|
763 else |
|
764 { |
|
765 ap = iSourceData.iOutgoingIap; |
|
766 } |
|
767 |
|
768 // And access point to always ask, which means that default connection |
|
769 // is used |
|
770 iTargetData[aIndex].SetAttr( TImumDaSettings::EKeyAccessPoint, ap ); |
|
771 } |
|
772 |
|
773 // --------------------------------------------------------------------------- |
|
774 // CImumMboxInternalDataConverter::InternalAoState() |
|
775 // --------------------------------------------------------------------------- |
|
776 // |
|
777 TInt CImumMboxInternalDataConverter::InternalAoState( |
|
778 const TMailAoStates& aAoState ) |
|
779 { |
|
780 IMUM_CONTEXT( CImumMboxInternalDataConverter::InternalAoState, 0, KLogData ); |
|
781 |
|
782 switch ( aAoState ) |
|
783 { |
|
784 case EMailAoAlways: |
|
785 return TImumDaSettings::EValueAutoOn; |
|
786 case EMailAoHomeOnly: |
|
787 return TImumDaSettings::EValueAutoHomeNetwork; |
|
788 case EMailAoOff: |
|
789 return TImumDaSettings::EValueAutoOff; |
|
790 } |
|
791 |
|
792 return TImumDaSettings::EValueAutoOff; |
|
793 } |
|
794 |
|
795 // --------------------------------------------------------------------------- |
|
796 // CImumMboxInternalDataConverter::InternalEmnState() |
|
797 // --------------------------------------------------------------------------- |
|
798 // |
|
799 TInt CImumMboxInternalDataConverter::InternalEmnState( |
|
800 const TMailEmnStates& aEmnState ) |
|
801 { |
|
802 IMUM_CONTEXT( CImumMboxInternalDataConverter::InternalEmnState, 0, KLogData ); |
|
803 |
|
804 switch ( aEmnState ) |
|
805 { |
|
806 case EMailEmnAutomatic: |
|
807 return TImumDaSettings::EValueNotificationsOn; |
|
808 case EMailEmnHomeOnly: |
|
809 return TImumDaSettings::EValueNotificationsHome; |
|
810 case EMailEmnOff: |
|
811 return TImumDaSettings::EValueNotificationsOff; |
|
812 } |
|
813 |
|
814 return TImumDaSettings::EValueNotificationsOff; |
|
815 } |
|
816 |
|
817 // --------------------------------------------------------------------------- |
|
818 // CImumMboxInternalDataConverter::InternalRetrivalInterval() |
|
819 // --------------------------------------------------------------------------- |
|
820 // |
|
821 TInt CImumMboxInternalDataConverter::InternalRetrivalInterval( |
|
822 TInt aInterval ) |
|
823 { |
|
824 IMUM_CONTEXT( CImumMboxInternalDataConverter::InternalRetrivalInterval, 0, KLogData ); |
|
825 |
|
826 switch ( aInterval ) |
|
827 { |
|
828 case KIMASAoInterval5Min: |
|
829 return TImumDaSettings::EValue5Minutes; |
|
830 case KIMASAoInterval15Min: |
|
831 return TImumDaSettings::EValue15Minutes; |
|
832 case KIMASAoInterval30Min: |
|
833 return TImumDaSettings::EValue30Minutes; |
|
834 case KIMASAoInterval1Hour: |
|
835 return TImumDaSettings::EValue1Hour; |
|
836 case KIMASAoInterval2Hours: |
|
837 return TImumDaSettings::EValue2Hours; |
|
838 case KIMASAoInterval4Hours: |
|
839 return TImumDaSettings::EValue4Hours; |
|
840 case KIMASAoInterval6Hours: |
|
841 return TImumDaSettings::EValue6Hours; |
|
842 } |
|
843 |
|
844 return TImumDaSettings::EValue1Hour; |
|
845 } |
|
846 |
|
847 |
|
848 // --------------------------------------------------------------------------- |
|
849 // CImumMboxInternalDataConverter::GetInternalPopDownloadL() |
|
850 // --------------------------------------------------------------------------- |
|
851 // |
|
852 TInt32 CImumMboxInternalDataConverter::GetInternalPopDownloadL( |
|
853 const TInt32& aSetting, |
|
854 MImumInSettingsDataCollection& aInternalDataCollection ) |
|
855 { |
|
856 IMUM_CONTEXT( CImumMboxInternalDataConverter::GetInternalPopDownloadL, 0, KLogData ); |
|
857 |
|
858 TInt partial = 0; |
|
859 if ( aSetting == EIMASMapFullBody ) |
|
860 { |
|
861 partial = TImumInSettings::EFlagSetDownloadAll; |
|
862 } |
|
863 else if ( aSetting == EIMASMapHeadersOnly ) |
|
864 { |
|
865 partial = TImumInSettings::EFlagDownloadHeader; |
|
866 } |
|
867 else |
|
868 { |
|
869 partial = TImumInSettings::EFlagDownloadPartialCumulative; |
|
870 aInternalDataCollection.SetAttr( |
|
871 TImumInSettings::EKeyDownloadBodySize, aSetting ); |
|
872 } |
|
873 |
|
874 return partial; |
|
875 } |
|
876 |
|
877 // --------------------------------------------------------------------------- |
|
878 // CImumMboxInternalDataConverter::GetInternalPopSyncL() |
|
879 // --------------------------------------------------------------------------- |
|
880 // |
|
881 TInt32 CImumMboxInternalDataConverter::GetInternalPopSyncL( |
|
882 const TInt32& aSetting ) |
|
883 { |
|
884 IMUM_CONTEXT( CImumMboxInternalDataConverter::GetInternalPopSyncL, 0, KLogData ); |
|
885 |
|
886 return ( aSetting == EGetPop3EmailMessages ) ? |
|
887 TImumInSettings::EFlagSetDownloadAll : |
|
888 TImumInSettings::EFlagDownloadHeader; |
|
889 } |
|
890 |
|
891 // End of File |