|
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: ImumInMailboxServicesImpl.h |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CIMUMINMAILBOXSERVICESIMPL_H |
|
20 #define CIMUMINMAILBOXSERVICESIMPL_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <msvstd.h> |
|
24 |
|
25 #include "ImumInMailboxServices.h" |
|
26 |
|
27 // CONSTANTS |
|
28 // MACROS |
|
29 // DATA TYPES |
|
30 // FUNCTION PROTOTYPES |
|
31 // FORWARD DECLARATIONS |
|
32 class CImumInternalApiImpl; |
|
33 class CImumMboxDefaultDataCtrl; |
|
34 class CImumMboxDefaultData; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * |
|
40 * @lib |
|
41 * @since S60 v3.2 |
|
42 */ |
|
43 class CImumInMailboxServicesImpl : public CBase, public MImumInMailboxServices |
|
44 { |
|
45 public: // Constructors and destructor |
|
46 |
|
47 /** |
|
48 * Creates object from CImumInMailboxServicesImpl and leaves it to cleanup stack |
|
49 * |
|
50 * @since S60 v3.2 |
|
51 * @return, Constructed object |
|
52 */ |
|
53 static CImumInMailboxServicesImpl* NewLC( CImumInternalApiImpl& aInternalApi ); |
|
54 |
|
55 /** |
|
56 * Create object from CImumInMailboxServicesImpl |
|
57 * |
|
58 * @since S60 v3.2 |
|
59 * @return, Constructed object |
|
60 */ |
|
61 static CImumInMailboxServicesImpl* NewL( CImumInternalApiImpl& aInternalApi ); |
|
62 |
|
63 /** |
|
64 * Destructor |
|
65 * |
|
66 * @since S60 v3.2 |
|
67 */ |
|
68 virtual ~CImumInMailboxServicesImpl(); |
|
69 |
|
70 public: // New functions |
|
71 |
|
72 /** |
|
73 * Fills settings data object and fills the mandatory data. |
|
74 * |
|
75 * @since S60 v3.2 |
|
76 * @param aSettingsData Settings data object to be filled |
|
77 * @param aProtocol Receiving protocol of the mailbox (Imap4/Pop3) |
|
78 * @param aEmailAddress The email address |
|
79 * @param aIncomingServer Server to be used to fetch the mail |
|
80 * @param aOutgoingServer Server to be used to send the mail |
|
81 * @param aAccessPoint Used accesspoint id or 0 for default connection |
|
82 * @param aMailboxName The name of the mailbox in UI |
|
83 */ |
|
84 void FillCompulsorySettingsL( |
|
85 CImumInSettingsData& aSettingsData, |
|
86 const TUid& aProtocol, |
|
87 const TDesC& aEmailAddress, |
|
88 const TDesC& aIncomingServer, |
|
89 const TDesC& aOutgoingServer, |
|
90 const TInt aAccessPoint, |
|
91 const TDesC& aMailboxName ) const; |
|
92 |
|
93 /** |
|
94 * Returns the default data object. |
|
95 * |
|
96 * @since S60 v3.2 |
|
97 * @return Pointer to default data object |
|
98 */ |
|
99 const CImumMboxDefaultData* DefaultDataObjectL(); |
|
100 |
|
101 public: // Functions from base classes |
|
102 |
|
103 /** |
|
104 * Creates an empty settings data object. |
|
105 * |
|
106 * @since S60 v3.2 |
|
107 * @param aProtocol Protocol for initialization (Imap4/Pop3) |
|
108 * @return Settings data object and responsibility to destroy it. |
|
109 */ |
|
110 CImumInSettingsData* CreateSettingsDataL( const TUid& aProtocol ) const; |
|
111 |
|
112 /** |
|
113 * Creates and fills settings data object and fills the mandatory data. |
|
114 * |
|
115 * @since S60 v3.2 |
|
116 * @param aSettingsData Settings data object to be filled |
|
117 * @param aProtocol Receiving protocol of the mailbox (Imap4/Pop3) |
|
118 * @param aEmailAddress The email address |
|
119 * @param aIncomingServer Server to be used to fetch the mail |
|
120 * @param aOutgoingServer Server to be used to send the mail |
|
121 * @param aAccessPoint Used accesspoint id or 0 for default connection |
|
122 * @param aMailboxName The name of the mailbox in UI |
|
123 * @return Settings data object and responsibility to destroy it. |
|
124 */ |
|
125 CImumInSettingsData* CreateSettingsDataL( |
|
126 const TUid& aProtocol, |
|
127 const TDesC& aEmailAddress, |
|
128 const TDesC& aIncomingServer, |
|
129 const TDesC& aOutgoingServer, |
|
130 const TInt aAccessPoint, |
|
131 const TDesC& aMailboxName ) const; |
|
132 |
|
133 /** |
|
134 * Load the settings data of requested mailbox. |
|
135 * |
|
136 * @since S60 v3.2 |
|
137 * @param aMailboxId Id of the mailbox entry |
|
138 * @return Settings data object and responsibility to destroy it. |
|
139 */ |
|
140 CImumInSettingsData* LoadMailboxSettingsL( const TMsvId aMailboxId ) const; |
|
141 |
|
142 /** |
|
143 * Saves the settings data. |
|
144 * |
|
145 * @since S60 v3.2 |
|
146 * @param aSettingsData Settings data to be stored. |
|
147 */ |
|
148 void SaveMailboxSettingsL( CImumInSettingsData& aSettingsData ) const; |
|
149 |
|
150 /** |
|
151 * Verifies and creates the mailbox based on the settings data. |
|
152 * |
|
153 * @since S60 v3.2 |
|
154 * @param aSettingsData Settings data to be used. |
|
155 * @return Id of the new mailbox. |
|
156 */ |
|
157 TMsvId CreateMailboxL( CImumInSettingsData& aSettingsData ) const; |
|
158 |
|
159 /** |
|
160 * Deletes the mailbox from the system. |
|
161 * |
|
162 * @since S60 v3.2 |
|
163 * @param Id of the mailbox entry. |
|
164 */ |
|
165 CMsvOperation* RemoveMailboxL( |
|
166 const TMsvId aMailboxId, |
|
167 TRequestStatus& aStatus ) const; |
|
168 |
|
169 /** |
|
170 * Sets the default sending mailbox. |
|
171 * |
|
172 * Provided mailbox id is used to set the default sending mailbox. In |
|
173 * case the mailbox id is not correct, valid mailbox is searched from the |
|
174 * system. |
|
175 * |
|
176 * @since S60 v3.2 |
|
177 * @param aMailboxId Id of the mailbox entry. |
|
178 */ |
|
179 void SetDefaultMailboxL( const TMsvId aMailboxId ) const; |
|
180 |
|
181 /** |
|
182 * Set last mailbox update time |
|
183 * |
|
184 * @since S60 v3.2 |
|
185 * @param aMailboxId Mailbox ID |
|
186 * @param aSuccess Flag if mailbox update was successfull |
|
187 * @param aTime Mailbox update time |
|
188 */ |
|
189 void SetLastUpdateInfoL( TMsvId aMailboxId, TBool aSuccess, |
|
190 const TTime& aTime ) const; |
|
191 |
|
192 protected: // Constructors |
|
193 |
|
194 /** |
|
195 * Default constructor for classCImumInMailboxServicesImpl |
|
196 * |
|
197 * @since S60 v3.2 |
|
198 * @return, Constructed object |
|
199 */ |
|
200 CImumInMailboxServicesImpl( CImumInternalApiImpl& aInternalApi ); |
|
201 |
|
202 /** |
|
203 * Symbian 2-phase constructor |
|
204 * |
|
205 * @since S60 v3.2 |
|
206 */ |
|
207 void ConstructL(); |
|
208 |
|
209 protected: // New virtual functions |
|
210 protected: // New functions |
|
211 protected: // Functions from base classes |
|
212 |
|
213 private: // New virtual functions |
|
214 private: // New functions |
|
215 |
|
216 /** |
|
217 * Raises leave with error in release mode and panic in debug mode. |
|
218 * |
|
219 * @since S60 v3.2 |
|
220 * @param aErrorCode The actual error code |
|
221 */ |
|
222 void ServiceExceptionL( const TInt aErrorCode ) const; |
|
223 |
|
224 /** |
|
225 * Validates the settings data object. |
|
226 * |
|
227 * @since S60 v3.2 |
|
228 * @param aSettingsData The object to be verified. |
|
229 * @leave Any error code defined in ImumDaErrorCodes.h |
|
230 * @see ImumDaErrorCodes.h |
|
231 */ |
|
232 void ValidateSettingsL( |
|
233 CImumInSettingsData& aSettingsData ) const; |
|
234 |
|
235 private: // Functions from base classes |
|
236 |
|
237 public: // Data |
|
238 protected: // Data |
|
239 private: // Data |
|
240 |
|
241 // Reference to internal api |
|
242 CImumInternalApiImpl& iInternalApi; |
|
243 // Owned: Default data |
|
244 CImumMboxDefaultData* iDefaultData; |
|
245 }; |
|
246 |
|
247 #endif // CIMUMINMAILBOXSERVICESIMPL_H |