|
1 /* |
|
2 * Copyright (c) 2006 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: Defines an API to create and edit mailbox settings |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef IMUMMAILACCOUNTSETTINGSSTORER_H |
|
21 #define IMUMMAILACCOUNTSETTINGSSTORER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <miutset.h> // CImBaseEmailSettings |
|
26 #include <cemailaccounts.h> // CEmailAccounts |
|
27 #include "ImumMboxDataExtension.h" // CImumMboxDataExtension |
|
28 #include "ImumInHealthServicesImpl.h" |
|
29 |
|
30 // CONSTANTS |
|
31 // MACROS |
|
32 // DATA TYPES |
|
33 // FUNCTION PROTOTYPES |
|
34 // FORWARD DECLARATIONS |
|
35 class CRepository; |
|
36 class CImumMboxDataExtension; |
|
37 class CIMASCenRepControl; |
|
38 class CIMASAccountControl; |
|
39 class CImumMboxDefaultData; |
|
40 class CImumInternalApiImpl; |
|
41 class MImumInMailboxUtilities; |
|
42 |
|
43 // CLASS DECLARATION |
|
44 |
|
45 /** |
|
46 * ?one_line_short_description. |
|
47 * ?other_description_lines |
|
48 * |
|
49 * @lib Imum.lib |
|
50 * @since S60 3.0 |
|
51 */ |
|
52 class TIMAStorerParams |
|
53 { |
|
54 public: // Constructors |
|
55 |
|
56 TIMAStorerParams( |
|
57 const TUid& aMtmId, |
|
58 const TMsvId aMailboxId ); |
|
59 TIMAStorerParams( |
|
60 const TUint32 aAccountId, |
|
61 const TUid& aMtmId ); |
|
62 TIMAStorerParams( |
|
63 const TMsvEntry& aEntry ); |
|
64 |
|
65 public: // New functions |
|
66 |
|
67 TMsvId MailboxId() const; |
|
68 TUint32 AccountId() const; |
|
69 TUid MtmId() const; |
|
70 |
|
71 private: // Data |
|
72 TMsvId iMailboxId; |
|
73 TUint32 iAccountId; |
|
74 TUid iMtmId; |
|
75 }; |
|
76 |
|
77 |
|
78 /** |
|
79 * ?one_line_short_description. |
|
80 * ?other_description_lines |
|
81 * |
|
82 * @lib Imum.lib |
|
83 * @since S60 3.0 |
|
84 */ |
|
85 class CImumMboxSettingsCtrl : public CBase |
|
86 { |
|
87 public: // Constructors and destructor |
|
88 |
|
89 /** |
|
90 * Destructor |
|
91 * @since S60 3.0 |
|
92 */ |
|
93 virtual ~CImumMboxSettingsCtrl(); |
|
94 |
|
95 /** |
|
96 * Creates the settings storer object |
|
97 * @since S60 3.0 |
|
98 */ |
|
99 static CImumMboxSettingsCtrl* NewL( |
|
100 CImumInternalApiImpl& aMailboxApi ); |
|
101 |
|
102 /** |
|
103 * Creates the settings storer object |
|
104 * @since S60 3.0 |
|
105 */ |
|
106 static CImumMboxSettingsCtrl* NewLC( |
|
107 CImumInternalApiImpl& aMailboxApi ); |
|
108 |
|
109 public: // New functions |
|
110 |
|
111 // CREATING NEW ACCOUNT |
|
112 |
|
113 /** |
|
114 * |
|
115 * @since S60 3.0 |
|
116 */ |
|
117 TInt CreateSettings( |
|
118 const CImumMboxDataExtension& aExtendedMailSettings ); |
|
119 |
|
120 /** |
|
121 * |
|
122 * @since S60 3.0 |
|
123 */ |
|
124 TInt CreateSettings( |
|
125 const TMsvId aMailboxId, |
|
126 const TUint32 aAccountId, |
|
127 const TUid& aProtocol, |
|
128 CImumMboxDataExtension& aExtendedMailSettings, |
|
129 const TBool aPopulateDefaults = ETrue ); |
|
130 |
|
131 /** |
|
132 * |
|
133 * @since S60 3.0 |
|
134 */ |
|
135 void PreInitializeExtendedSettings( |
|
136 const TMsvId aMailboxId, |
|
137 const TUint32 aAccountId, |
|
138 const TUid& aProtocol, |
|
139 CImumMboxDataExtension& aExtendedMailSettings ) const; |
|
140 |
|
141 /** |
|
142 * |
|
143 * @since S60 3.0 |
|
144 */ |
|
145 TInt PopulateDefaultExtSettings( |
|
146 CImumMboxDataExtension& aExtendedMailSettings ) const; |
|
147 |
|
148 // DELETING EXISTING ACCOUNT |
|
149 |
|
150 /** |
|
151 * |
|
152 * @since S60 3.0 |
|
153 */ |
|
154 TInt DeleteExtendedSettings( |
|
155 const TIMAStorerParams& aParams ); |
|
156 |
|
157 // SAVING CURRENT ACCOUNT |
|
158 |
|
159 /** |
|
160 * Saves the Extended settings to the Central Repository |
|
161 * @since S60 3.0 |
|
162 * @param aExtendedSettings, Settings object |
|
163 * @return KErrNone, if saving has been successful |
|
164 */ |
|
165 TInt SaveSettings( |
|
166 const CImumMboxDataExtension& aExtendedMailSettings ); |
|
167 |
|
168 /** |
|
169 * |
|
170 * @since S60 3.0 |
|
171 */ |
|
172 TInt SaveSettings( |
|
173 const TUint32 aAccountId, |
|
174 const CImImap4Settings& aImap4Settings ); |
|
175 |
|
176 /** |
|
177 * |
|
178 * @since S60 3.0 |
|
179 */ |
|
180 TInt SaveSettings( |
|
181 const TUint32 aAccountId, |
|
182 const CImPop3Settings& aPop3Settings ); |
|
183 |
|
184 /** |
|
185 * |
|
186 * @since S60 3.0 |
|
187 */ |
|
188 TInt SaveSettings( |
|
189 const TUint32 aAccountId, |
|
190 const CImSmtpSettings& aSmtpSettings ); |
|
191 |
|
192 /** |
|
193 * |
|
194 * @since S60 3.0 |
|
195 */ |
|
196 TInt SaveSettings( |
|
197 const TMsvId aMailboxId, |
|
198 const CImImap4Settings& aImap4Settings ); |
|
199 |
|
200 /** |
|
201 * |
|
202 * @since S60 3.0 |
|
203 */ |
|
204 TInt SaveSettings( |
|
205 const TMsvId aMailboxId, |
|
206 const CImPop3Settings& aPop3Settings ); |
|
207 |
|
208 /** |
|
209 * |
|
210 * @since S60 3.0 |
|
211 */ |
|
212 TInt SaveSettings( |
|
213 const TMsvId aMailboxId, |
|
214 const CImSmtpSettings& aSmtpSettings ); |
|
215 |
|
216 /** |
|
217 * |
|
218 * @since S60 3.0 |
|
219 */ |
|
220 TInt SaveSettings( |
|
221 const TMsvEntry& aEntry, |
|
222 CImBaseEmailSettings& aBaseSettings ); |
|
223 |
|
224 // LOADING EXISTING ACCOUNT |
|
225 |
|
226 /** |
|
227 * Loads the Extended settings from the Central Repository |
|
228 * @since S60 3.0 |
|
229 * @param aAccountId, Id of the account to be used |
|
230 * @param aExtendedSettings, Settings object |
|
231 * @return KErrNone, if loading has been successful |
|
232 */ |
|
233 TInt LoadSettings( |
|
234 const TIMAStorerParams& aParams, |
|
235 CImumMboxDataExtension& aExtendedMailSettings ); |
|
236 |
|
237 /** |
|
238 * |
|
239 * @since S60 3.0 |
|
240 */ |
|
241 TInt LoadSettings( |
|
242 const TUint32 aAccountId, |
|
243 CImImap4Settings& aImap4Settings ); |
|
244 |
|
245 /** |
|
246 * |
|
247 * @since S60 3.0 |
|
248 */ |
|
249 TInt LoadSettings( |
|
250 const TUint32 aAccountId, |
|
251 CImPop3Settings& aPop3Settings ); |
|
252 |
|
253 /** |
|
254 * |
|
255 * @since S60 3.0 |
|
256 */ |
|
257 TInt LoadSettings( |
|
258 const TUint32 aAccountId, |
|
259 CImSmtpSettings& aSmtpSettings ); |
|
260 |
|
261 /** |
|
262 * |
|
263 * @since S60 3.0 |
|
264 */ |
|
265 TInt LoadSettings( |
|
266 const TMsvId aMailboxId, |
|
267 CImImap4Settings& aImap4Settings ); |
|
268 |
|
269 /** |
|
270 * |
|
271 * @since S60 3.0 |
|
272 */ |
|
273 TInt LoadSettings( |
|
274 const TMsvId aMailboxId, |
|
275 CImPop3Settings& aPop3Settings ); |
|
276 |
|
277 /** |
|
278 * |
|
279 * @since S60 3.0 |
|
280 */ |
|
281 TInt LoadSettings( |
|
282 const TMsvId aMailboxId, |
|
283 CImSmtpSettings& aSmtpSettings ); |
|
284 |
|
285 /** |
|
286 * |
|
287 * @since S60 3.0 |
|
288 */ |
|
289 TInt LoadSettings( |
|
290 const TMsvEntry& aEntry, |
|
291 CImBaseEmailSettings& aBaseSettings ); |
|
292 |
|
293 /** |
|
294 * |
|
295 * @since S60 3.0 |
|
296 */ |
|
297 TUint32 AccountId2ExtensionId( |
|
298 const TUint32 aAccountId, |
|
299 const TUid& aMtmId ) const; |
|
300 |
|
301 /** |
|
302 * |
|
303 * @since S60 3.0 |
|
304 */ |
|
305 TUint32 ExtensionId2AccountId( |
|
306 const TUint32 aExtension, |
|
307 const TUid& aMtmId ) const; |
|
308 |
|
309 // DEFAULT DATA RESTORING |
|
310 |
|
311 /** |
|
312 * |
|
313 * @since Series60 3.0 |
|
314 */ |
|
315 void RestoreDefaultSettingsDataL( |
|
316 CImumMboxDefaultData& aDefaultData ); |
|
317 |
|
318 /** |
|
319 * |
|
320 * |
|
321 * @since S60 v3.2 |
|
322 * @param |
|
323 * @leave &(leavedesc)s |
|
324 */ |
|
325 void LoadAlwaysOnlineSettingsL( |
|
326 const TUint32 aAccountId, |
|
327 const TUid& aMtmId, |
|
328 TInt64& aDays, |
|
329 TInt64& aStartTime, |
|
330 TInt64& aStopTime, |
|
331 TInt& iActive ); |
|
332 |
|
333 /** |
|
334 * Checks the mailboxname and cut it off if too long |
|
335 * @since S60 3.2 |
|
336 * @param aMailboxEntry |
|
337 * @return EIMDNoError, when operation was faultless |
|
338 */ |
|
339 TIMDErrors CheckMailboxNameImap( |
|
340 TMsvEntry& aMailboxEntry ) const; |
|
341 |
|
342 /** |
|
343 * Checks the mailboxname and cut it off if too long |
|
344 * @since S60 3.2 |
|
345 * @param aMailboxEntry |
|
346 * @return EIMDNoError, when operation was faultless |
|
347 */ |
|
348 TIMDErrors CheckMailboxNamePop( |
|
349 TMsvEntry& aMailboxEntry ) const; |
|
350 |
|
351 /** |
|
352 * Checks the mailboxname and cut it off if too long |
|
353 * @since S60 3.2 |
|
354 * @param aMailboxEntry |
|
355 * @return EIMDNoError, when operation was faultless |
|
356 */ |
|
357 TIMDErrors CheckMailboxNameSmtp( |
|
358 TMsvEntry& aMailboxEntry ) const; |
|
359 |
|
360 /** |
|
361 * Set last update info |
|
362 * @since S60 v3.2 |
|
363 * @param aAccountId, Account ID |
|
364 * @param aMtmId, Mtm ID |
|
365 * @param aSuccess, True if mailbox update was successfull |
|
366 * @param aTime, Update time |
|
367 */ |
|
368 void SetLastUpdateInfoL(TUint32 aAccountId, const TUid& aMtmId, |
|
369 TBool aSuccess, const TTime& aTime ); |
|
370 |
|
371 public: // Functions from base classes |
|
372 |
|
373 protected: // New virtual functions |
|
374 protected: // New functions |
|
375 protected: // Functions from base classes |
|
376 |
|
377 private: // Constructors and destructor |
|
378 |
|
379 /** |
|
380 * Default constructor |
|
381 * @since S60 3.0 |
|
382 */ |
|
383 CImumMboxSettingsCtrl( |
|
384 CImumInternalApiImpl& aMailboxApi ); |
|
385 |
|
386 /** |
|
387 * ConstructL |
|
388 * @since S60 3.0 |
|
389 */ |
|
390 void ConstructL(); |
|
391 |
|
392 private: // New virtual functions |
|
393 private: // New functions |
|
394 |
|
395 // CREATING NEW ACCOUNT |
|
396 |
|
397 /** |
|
398 * |
|
399 * @since S60 3.0 |
|
400 */ |
|
401 void CreateSettingsL( |
|
402 const CImumMboxDataExtension& aExtendedMailSettings ); |
|
403 |
|
404 /** |
|
405 * |
|
406 * @since S60 3.0 |
|
407 */ |
|
408 void CreateSettingsL( |
|
409 const TMsvId aMailboxId, |
|
410 const TUid& aMtmId, |
|
411 const CImumMboxDataExtension& aExtendedMailSettings ); |
|
412 |
|
413 // DELETING EXISTING ACCOUNT |
|
414 |
|
415 /** |
|
416 * |
|
417 * @since S60 3.0 |
|
418 */ |
|
419 void DeleteExtendedSettingsL( |
|
420 const TMsvId aMailboxId, |
|
421 const TUid& aMtmId ); |
|
422 |
|
423 /** |
|
424 * |
|
425 * @since S60 3.0 |
|
426 */ |
|
427 void DeleteExtendedSettingsL( |
|
428 const TUint32 aAccountId, |
|
429 const TUid& aMtmId ); |
|
430 |
|
431 // SAVING CURRENT ACCOUNT |
|
432 |
|
433 /** |
|
434 * Saves the Extended settings to the Central Repository |
|
435 * @since S60 3.0 |
|
436 * @param aExtendedSettings, Settings object |
|
437 * @return KErrNone, if saving has been successful |
|
438 */ |
|
439 void SaveSettingsL( |
|
440 const CImumMboxDataExtension& aExtendedMailSettings ); |
|
441 |
|
442 /** |
|
443 * |
|
444 * @since S60 3.0 |
|
445 */ |
|
446 void SaveSettingsL( |
|
447 const TUint32 aAccountId, |
|
448 const CImImap4Settings& aImap4Settings ); |
|
449 |
|
450 /** |
|
451 * |
|
452 * @since S60 3.0 |
|
453 */ |
|
454 void SaveSettingsL( |
|
455 const TUint32 aAccountId, |
|
456 const CImPop3Settings& aPop3Settings ); |
|
457 |
|
458 /** |
|
459 * |
|
460 * @since S60 3.0 |
|
461 */ |
|
462 void SaveSettingsL( |
|
463 const TUint32 aAccountId, |
|
464 const CImSmtpSettings& aSmtpSettings ); |
|
465 |
|
466 /** |
|
467 * |
|
468 * @since S60 3.0 |
|
469 */ |
|
470 void SaveSettingsL( |
|
471 const TMsvId aMailboxId, |
|
472 const CImImap4Settings& aImap4Settings ); |
|
473 |
|
474 /** |
|
475 * |
|
476 * @since S60 3.0 |
|
477 */ |
|
478 void SaveSettingsL( |
|
479 const TMsvId aMailboxId, |
|
480 const CImPop3Settings& aPop3Settings ); |
|
481 |
|
482 /** |
|
483 * |
|
484 * @since S60 3.0 |
|
485 */ |
|
486 void SaveSettingsL( |
|
487 const TMsvId aMailboxId, |
|
488 const CImSmtpSettings& aSmtpSettings ); |
|
489 |
|
490 /** |
|
491 * |
|
492 * @since S60 3.0 |
|
493 */ |
|
494 void SaveSettingsL( |
|
495 const TMsvEntry& aEntry, |
|
496 CImBaseEmailSettings& aBaseSettings ); |
|
497 |
|
498 // LOADING EXISTING ACCOUNT |
|
499 |
|
500 /** |
|
501 * Loads the Extended settings from the Central Repository |
|
502 * @since S60 3.0 |
|
503 * @param aAccountId, Id of the account to be used |
|
504 * @param aExtendedSettings, Settings object |
|
505 * @return KErrNone, if loading has been successful |
|
506 */ |
|
507 void LoadSettingsL( |
|
508 const TUint32 aAccountId, |
|
509 const TUid& aMtmId, |
|
510 CImumMboxDataExtension& aExtendedMailSettings ); |
|
511 |
|
512 /** |
|
513 * |
|
514 * @since S60 3.0 |
|
515 */ |
|
516 void LoadSettingsL( |
|
517 const TMsvId aMailboxId, |
|
518 const TUid& aMtmId, |
|
519 CImumMboxDataExtension& aExtendedMailSettings ); |
|
520 |
|
521 /** |
|
522 * |
|
523 * @since S60 3.0 |
|
524 */ |
|
525 void LoadSettingsL( |
|
526 const TUint32 aAccountId, |
|
527 CImImap4Settings& aImap4Settings ); |
|
528 |
|
529 /** |
|
530 * |
|
531 * @since S60 3.0 |
|
532 */ |
|
533 void LoadSettingsL( |
|
534 const TMsvId aMailboxId, |
|
535 CImImap4Settings& aImap4Settings ); |
|
536 |
|
537 /** |
|
538 * |
|
539 * @since S60 3.0 |
|
540 */ |
|
541 void LoadSettingsL( |
|
542 const TUint32 aAccountId, |
|
543 CImPop3Settings& aPop3Settings ); |
|
544 |
|
545 /** |
|
546 * |
|
547 * @since S60 3.0 |
|
548 */ |
|
549 void LoadSettingsL( |
|
550 const TMsvId aMailboxId, |
|
551 CImPop3Settings& aPop3Settings ); |
|
552 |
|
553 /** |
|
554 * |
|
555 * @since S60 3.0 |
|
556 */ |
|
557 void LoadSettingsL( |
|
558 const TUint32 aAccountId, |
|
559 CImSmtpSettings& aSmtpSettings ); |
|
560 |
|
561 /** |
|
562 * |
|
563 * @since S60 3.0 |
|
564 */ |
|
565 void LoadSettingsL( |
|
566 const TMsvId aMailboxId, |
|
567 CImSmtpSettings& aSmtpSettings ); |
|
568 |
|
569 /** |
|
570 * |
|
571 * @since S60 3.0 |
|
572 */ |
|
573 void LoadSettingsL( |
|
574 const TMsvEntry& aEntry, |
|
575 CImBaseEmailSettings& aBaseSettings ); |
|
576 |
|
577 // SPECIAL STORERS |
|
578 |
|
579 /** |
|
580 * |
|
581 * @since S60 3.0 |
|
582 */ |
|
583 void CreateLastUpdateInfoL( |
|
584 const TAOInfo& aAoInfo ); |
|
585 |
|
586 /** |
|
587 * |
|
588 * @since S60 3.0 |
|
589 */ |
|
590 TInt DeleteLastUpdateInfo(); |
|
591 |
|
592 /** |
|
593 * |
|
594 * @since S60 3.0 |
|
595 */ |
|
596 TInt SaveLastUpdateInfo( |
|
597 const TAOInfo& aAoInfo ); |
|
598 |
|
599 /** |
|
600 * |
|
601 * @since S60 3.0 |
|
602 */ |
|
603 TAOInfo LoadLastUpdateInfo(); |
|
604 |
|
605 /** |
|
606 * Verifies the validity of the extended settings and opens them |
|
607 * @since S60 3.0 |
|
608 */ |
|
609 void OpenExtendedSettingsL( |
|
610 const TIMAStorerParams& aParams, |
|
611 CImumMboxDataExtension& aExtendedMailSettings ); |
|
612 |
|
613 /** |
|
614 * |
|
615 * @since S60 3.0 |
|
616 */ |
|
617 CEmailAccounts* AccountsL(); |
|
618 |
|
619 /** |
|
620 * |
|
621 * @since S60 3.0 |
|
622 */ |
|
623 void LoadExtendedSettingsStatusFlagsL( |
|
624 CImumMboxDataExtension& aExtendedSettings ); |
|
625 |
|
626 /** |
|
627 * |
|
628 * @since S60 3.0 |
|
629 */ |
|
630 void SaveExtendedSettingsStatusFlagsL( |
|
631 const CImumMboxDataExtension& aExtendedSettings ); |
|
632 |
|
633 /** |
|
634 * |
|
635 * @since S60 3.0 |
|
636 */ |
|
637 void CreateExtendedSettingsStatusFlagsL( |
|
638 const CImumMboxDataExtension& aExtendedSettings ); |
|
639 |
|
640 /** |
|
641 * Fix possible errors in SMTP mailbox name. Leaves if fixing fails. |
|
642 * @param aMailboxEntry Mailbox to fix. |
|
643 */ |
|
644 void FixMailboxNameSmtpL( TMsvEntry& aMailboxEntry ) const; |
|
645 |
|
646 /** |
|
647 * Fix possible errors in IMAP mailbox name. Leaves if fixing fails. |
|
648 * @param aMailboxEntry Mailbox to fix. |
|
649 */ |
|
650 void FixMailboxNameImapL( TMsvEntry& aMailboxEntry ) const; |
|
651 |
|
652 /** |
|
653 * Fix possible errors in POP mailbox name. Leaves if fixing fails. |
|
654 * @param aMailboxEntry Mailbox to fix. |
|
655 */ |
|
656 void FixMailboxNamePopL( TMsvEntry& aMailboxEntry ) const; |
|
657 |
|
658 private: // Functions from base classes |
|
659 |
|
660 public: // Data |
|
661 protected: // Data |
|
662 private: // Data |
|
663 |
|
664 // Reference to mailbox api |
|
665 CImumInternalApiImpl& iMailboxApi; |
|
666 // Pointer to Utilities |
|
667 MImumInMailboxUtilities* iUtils; |
|
668 // Repository for smtp settings |
|
669 CRepository* iCenRepSmtp; |
|
670 // Repository for extended mail settings |
|
671 CRepository* iCenRepExtMail; |
|
672 // Repository for always online settings |
|
673 CRepository* iCenRepAlwaysOnline; |
|
674 // Repository for default settings data |
|
675 CRepository* iCenRepDefaultData; |
|
676 // Pointer to accounts handler |
|
677 CEmailAccounts* iAccounts; |
|
678 // Class to handle Central Repository operations |
|
679 CIMASCenRepControl* iCenRepControl; |
|
680 // Class to handle account id shifting |
|
681 CIMASAccountControl* iAccountControl; |
|
682 // Flag whether cmail variation is on or off |
|
683 TBool iFFEmailVariation; |
|
684 }; |
|
685 |
|
686 #endif // IMUMMAILACCOUNTSETTINGSSTORER_H |
|
687 |
|
688 // End of File |