|
1 /* |
|
2 * Copyright (c) 2005 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: Class for handling message entries and using CMsvSession. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __CMRUTILSMSVHELPER_H__ |
|
21 #define __CMRUTILSMSVHELPER_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include "cmrmailboxutils.h" |
|
25 #include <mmrmbutilsmbinfohandler.h> |
|
26 |
|
27 #include <e32base.h> |
|
28 #include <msvapi.h> |
|
29 #include <badesca.h> |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CImSmtpSettings; |
|
33 class CEmailAccounts; |
|
34 class CClientMtmRegistry; |
|
35 class CMRMailBoxInfo; |
|
36 |
|
37 // same as in imum's MuiuDynamicSettingsArray.hrh & imas.hrh |
|
38 const TInt KMREmailAddrLength = 100; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * |
|
44 */ |
|
45 class CMRUtilsMsvHelper |
|
46 : public CBase, |
|
47 public MMRMBUtilsMBInfoHandler, |
|
48 public MMsvSessionObserver |
|
49 { |
|
50 public: // Constructors and destructors |
|
51 |
|
52 static CMRUtilsMsvHelper* NewL( |
|
53 CMsvSession* aSession, |
|
54 MMsvSessionObserver& aParentObserver ); |
|
55 |
|
56 /** |
|
57 * Destructor. |
|
58 */ |
|
59 ~CMRUtilsMsvHelper(); |
|
60 |
|
61 public: // New functions |
|
62 |
|
63 /** |
|
64 * Get session reference. |
|
65 * @return session reference |
|
66 */ |
|
67 CMsvSession& MsvSessionL(); |
|
68 |
|
69 public: // From MMRMBUtilsMBInfoHandler |
|
70 |
|
71 const RPointerArray<CMRMailBoxInfo>& MRMailBoxes() const; |
|
72 |
|
73 /** |
|
74 * Information about the specific mailbox. |
|
75 * Ownership is not transferred. |
|
76 * @param aEntryId entry id |
|
77 * @return mailbox info or NULL if mailbox not found |
|
78 */ |
|
79 const CMRMailBoxInfo* MRMailBoxInfoL( TInt iId) const; |
|
80 |
|
81 /** |
|
82 * Information about all mailboxes available. |
|
83 * @param aMailBoxes array to be filled with information |
|
84 */ |
|
85 void ListMRMailBoxesL( |
|
86 RArray<CMRMailboxUtils::TMailboxInfo>& aMailBoxes ); |
|
87 |
|
88 /** |
|
89 * Extension API |
|
90 */ |
|
91 TAny* ExtensionL( TUid aExtensionUid ); |
|
92 |
|
93 protected: // From MMsvSessionObserver |
|
94 |
|
95 void HandleSessionEventL( TMsvSessionEvent aEvent, |
|
96 TAny *aArg1, |
|
97 TAny *aArg2, |
|
98 TAny *aArg3 ); |
|
99 |
|
100 protected: // New functions |
|
101 |
|
102 /** |
|
103 * E-mail address of a specific mailbox. |
|
104 */ |
|
105 //TBuf<KMREmailAddrLength> EMailAddressL( TMsvEntry& entry ); |
|
106 void EMailAddressL( TMsvEntry& entry ); |
|
107 /** |
|
108 * Looks up SMTP service which is related to given service. |
|
109 * This is used for reading SMTP settings. |
|
110 */ |
|
111 TMsvId CorrespondingSmtpServiceL( TMsvEntry& entry ) const; |
|
112 |
|
113 /** |
|
114 * Loads and returns SMTP settings. |
|
115 * Item is left to cleanup stack, ownership is transferred. |
|
116 */ |
|
117 CImSmtpSettings* SmtpSettingsLC( TMsvId aSmtpService ); |
|
118 |
|
119 /** |
|
120 * Helper method for checking whether given mtm supports MR sending. |
|
121 * @param aMtmUid specifies the mtm to evaluate |
|
122 * @return ETrue if supports, EFalse otherwise |
|
123 */ |
|
124 TBool IsMRCapableL( TUid aMtmUid ); |
|
125 |
|
126 /** |
|
127 * Helper which constructs a session if it has been closed due |
|
128 * to an preceding server request of closing the session. |
|
129 */ |
|
130 void EnsureSessionExistsL(); |
|
131 |
|
132 /** |
|
133 * Checks whether given entry selection contains at least one |
|
134 * MR mailbox. |
|
135 */ |
|
136 TBool ContainsMRMailBoxEntryL( |
|
137 const CMsvEntrySelection& aEntries ) const; |
|
138 |
|
139 /** |
|
140 * Resets iMRMailBoxes and re-reads all MR capable mailboxes |
|
141 * in the device. |
|
142 */ |
|
143 void FindMRMailBoxesL(); |
|
144 |
|
145 TBool AddToListIfMRMailBoxesL( const CMsvEntrySelection& aEntries ); |
|
146 |
|
147 TBool AddToListIfMRMailBoxL( TMsvId aEntryId ); |
|
148 |
|
149 protected: // Constructors and destructors |
|
150 |
|
151 /** |
|
152 * C++ default constructor. |
|
153 */ |
|
154 CMRUtilsMsvHelper( CMsvSession* aSession, |
|
155 MMsvSessionObserver& aParentObserver ); |
|
156 |
|
157 /** |
|
158 * Constructor, second phase. |
|
159 */ |
|
160 void ConstructL(); |
|
161 |
|
162 protected: // data |
|
163 |
|
164 MMsvSessionObserver& iParentObserver; |
|
165 |
|
166 // array items owned |
|
167 RPointerArray<CMRMailBoxInfo> iMRMailBoxes; |
|
168 |
|
169 // own |
|
170 CEmailAccounts* iEmailSettings; |
|
171 |
|
172 CClientMtmRegistry* iMtmReg; |
|
173 |
|
174 // ownership determined by the iOwnSession |
|
175 CMsvSession* iSession; |
|
176 |
|
177 TBool iOwnSession; |
|
178 private: |
|
179 TBuf<KMREmailAddrLength> iEmailAddr; |
|
180 }; |
|
181 |
|
182 #endif // __CMRUTILSMSVHELPER_H__ |
|
183 |
|
184 // End of File |