|
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: ImumDaSettingsDataImpl.h |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_IMUMDASETTINGSDATAIMPL_H |
|
20 #define C_IMUMDASETTINGSDATAIMPL_H |
|
21 |
|
22 #include "ImumDaSettingsData.h" |
|
23 #include "ImumInternalApi.h" |
|
24 #include "ImumDaSettingsDataCollectionImpl.h" |
|
25 |
|
26 class CImumDaMailboxServicesImpl; |
|
27 class MImumInSettingsDataCollection; |
|
28 class CImumInSettingsData; |
|
29 |
|
30 typedef CArrayPtrFlat<CImumDaSettingsDataCollectionImpl> CImumDaConnSettings; |
|
31 |
|
32 NONSHARABLE_CLASS( CImumDaSettingsDataImpl ) : |
|
33 public CImumDaSettingsData |
|
34 { |
|
35 public: // Constructors and destructor |
|
36 |
|
37 /** |
|
38 * Create object from CImumDaSettingsDataImpl |
|
39 * |
|
40 * @since S60 3.2 |
|
41 * @param aMailboxApi, Reference to internal api. |
|
42 * @param aProtocol, Any receiving protocol: Imap4 or Pop3. |
|
43 * @return, Constructed object |
|
44 */ |
|
45 static CImumDaSettingsDataImpl* NewL( |
|
46 CImumInternalApi& aMailboxApi, |
|
47 const TUid& aProtocol ); |
|
48 |
|
49 /** |
|
50 * Creates object from CImumDaSettingsDataImpl and leaves it |
|
51 * to cleanup stack |
|
52 * |
|
53 * @since S60 3.2 |
|
54 * @param aMailboxApi, Reference to internal api. |
|
55 * @param aProtocol, Any receiving protocol: Imap4 or Pop3. |
|
56 * @return, Constructed object |
|
57 */ |
|
58 static CImumDaSettingsDataImpl* NewLC( |
|
59 CImumInternalApi& aMailboxApi, |
|
60 const TUid& aProtocol ); |
|
61 |
|
62 /** |
|
63 * Destructor |
|
64 * @since S60 3.2 |
|
65 */ |
|
66 virtual ~CImumDaSettingsDataImpl(); |
|
67 |
|
68 protected: // Constructors |
|
69 |
|
70 /** |
|
71 * Default constructor for CImumDaSettingsDataImpl |
|
72 * |
|
73 * @since S60 3.2 |
|
74 * @param aMailboxApi, Reference to internal api. |
|
75 * @return, Constructed object |
|
76 */ |
|
77 CImumDaSettingsDataImpl( CImumInternalApi& aMailboxApi ); |
|
78 |
|
79 /** |
|
80 * Symbian 2-phase constructor |
|
81 * @since S60 3.2 |
|
82 */ |
|
83 void ConstructL( const TUid& aProtocol ); |
|
84 |
|
85 private: |
|
86 |
|
87 /** |
|
88 * Throws an exception as leave (release) or panic (debug) |
|
89 * |
|
90 * @since S60 v3.2 |
|
91 * @param aErrorCode Error code that is thrown. |
|
92 * @leave aErrorCode |
|
93 */ |
|
94 void SettingsDataExceptionL( const TInt aErrorCode ) const; |
|
95 |
|
96 public: // From class CImumDaSettingsData |
|
97 |
|
98 /** |
|
99 * Creates connection data set to settings. |
|
100 * |
|
101 * @since S60 v3.2 |
|
102 * @param aProtocol, The protocol of the connection settings |
|
103 * @return Reference to created connection settings. |
|
104 */ |
|
105 MImumDaSettingsDataCollection& AddSetL( const TUid& aProtocol ); |
|
106 |
|
107 /** |
|
108 * Removes the connection data set from the settings data. |
|
109 * |
|
110 * @since S60 v3.2 |
|
111 * @param aIndex, Index to connection settings to be removed |
|
112 * @param aSettingsDataCollection, Connection settings to be removed |
|
113 * @leave EImumDaConnectionSetNotExist, if the item does not exist |
|
114 */ |
|
115 void DelSetL( const TUint aIndex ) ; |
|
116 void DelSetL( const MImumDaSettingsDataCollection& aSettingsDataCollection ); |
|
117 |
|
118 /** |
|
119 * Gets an access to connection data at position. |
|
120 * |
|
121 * @since S60 v3.2 |
|
122 * @param aIndex, Index to connection settings data. |
|
123 * @return Reference to connection settings at current index. |
|
124 */ |
|
125 MImumDaSettingsDataCollection& GetSetL( const TUint aIndex ) const; |
|
126 |
|
127 /** |
|
128 * Validates the settings data. |
|
129 * |
|
130 * @since S60 v3.2 |
|
131 * @return Result of the validation operation. |
|
132 */ |
|
133 TInt Validate(); |
|
134 |
|
135 /** |
|
136 * Sets the given value/text to the key |
|
137 * |
|
138 * @since S60 v3.2 |
|
139 * @param aAttributeKey, Id of the setting key |
|
140 * @param aValue/aText, Data to be stored |
|
141 * @return EImumDaNoError, when successful |
|
142 */ |
|
143 TInt SetAttr( const TUint aAttributeKey, const TInt aValue ); |
|
144 TInt SetAttr( const TUint aAttributeKey, const TInt64 aValue ); |
|
145 TInt SetAttr( const TUint aAttributeKey, const TMsvId aValue ); |
|
146 TInt SetAttr( const TUint aAttributeKey, const TDesC& aText ); |
|
147 TInt SetAttr( const TUint aAttributeKey, const TDesC8& aText ); |
|
148 |
|
149 /** |
|
150 * Gets the required value/text from the key |
|
151 * |
|
152 * @since S60 v3.2 |
|
153 * @param aAttributeKey, Value of the setting key |
|
154 * @param aValue/aText, Data to be stored |
|
155 * @return EImumDaNoError, when successful |
|
156 */ |
|
157 TInt GetAttr( const TUint aAttributeKey, TInt& aValue ) const; |
|
158 TInt GetAttr( const TUint aAttributeKey, TInt64& aValue ) const; |
|
159 TInt GetAttr( const TUint aAttributeKey, TMsvId& aId ) const; |
|
160 TInt GetAttr( const TUint aAttributeKey, TDes& aText ) const; |
|
161 TInt GetAttr( const TUint aAttributeKey, TDes8& aText ) const; |
|
162 |
|
163 /** |
|
164 * Compares the content of the datas |
|
165 * |
|
166 * @since S60 v3.2 |
|
167 * @param aSettingsData |
|
168 * @return Result of the comparasion |
|
169 */ |
|
170 TBool operator!=( |
|
171 const CImumDaSettingsData& aSettingsData ) const; |
|
172 TBool operator==( |
|
173 const CImumDaSettingsData& aSettingsData ) const; |
|
174 |
|
175 /** |
|
176 * Gets an access to connection data at position. |
|
177 * |
|
178 * @since S60 v3.2 |
|
179 * @param aIndex, Index to connection settings data. |
|
180 * @return Reference to connection settings at current index. |
|
181 */ |
|
182 MImumDaSettingsDataCollection& operator[]( const TUint aIndex ) const; |
|
183 |
|
184 /** |
|
185 * Resets the default values to most of the settings |
|
186 * |
|
187 * This method sets the default value to all settings in the class, |
|
188 * except those, that would invalidate the settings. |
|
189 * Settings that are not resetted are: |
|
190 * Server address, email address, mailbox name and protocol |
|
191 * |
|
192 * @since S60 v3.2 |
|
193 */ |
|
194 void ResetAll(); |
|
195 |
|
196 /** |
|
197 * Resets the default value of the single key |
|
198 * |
|
199 * @since S60 v3.2 |
|
200 * @param aAttributeKey, Id of the setting key |
|
201 * @return EImumDaNoError, when successful |
|
202 */ |
|
203 void Reset( const TUint aAttributeKey ); |
|
204 |
|
205 /** |
|
206 * Copies the content of the setting data |
|
207 * |
|
208 * @since S60 v3.2 |
|
209 * @param aSettingsData Collection data object to be copied |
|
210 * @return EImumDaNoError, when successful |
|
211 */ |
|
212 TInt Copy( const CImumDaSettingsData& aSettingsData ); |
|
213 |
|
214 /** |
|
215 * |
|
216 * @since S60 3.2 |
|
217 * @param |
|
218 * @return reference to internal data settigns. |
|
219 * @leave &(leavedesc)s |
|
220 */ |
|
221 CImumInSettingsData& GetInData(); |
|
222 |
|
223 private: |
|
224 |
|
225 // Reference to internal Api |
|
226 CImumInternalApi& iMailboxApi; |
|
227 // owned |
|
228 CImumInSettingsData* iData; |
|
229 // Owned: Domain api connection settings |
|
230 CImumDaConnSettings* iDaConnectionSettings; |
|
231 }; |
|
232 |
|
233 |
|
234 |
|
235 #endif /* C_IMUMDASETTINGSDATAIMPL_H */ |