|
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: ImumInSettingsDataCtrl.cpp |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32base.h> |
|
21 #include <SendUiConsts.h> |
|
22 |
|
23 #include "ImumInSettingsDataCtrl.h" |
|
24 #include "ImumInSettingsDataArray.h" |
|
25 |
|
26 // EXTERNAL DATA STRUCTURES |
|
27 // EXTERNAL FUNCTION PROTOTYPES |
|
28 // CONSTANTS |
|
29 // MACROS |
|
30 // LOCAL CONSTANTS AND MACROS |
|
31 // MODULE DATA STRUCTURES |
|
32 // LOCAL FUNCTION PROTOTYPES |
|
33 // FORWARD DECLARATIONS |
|
34 |
|
35 // ============================ MEMBER FUNCTIONS =============================== |
|
36 |
|
37 // --------------------------------------------------------------------------- |
|
38 // ImumInSettingsDataCtrl::IsText() |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 TBool ImumInSettingsDataCtrl::IsText( const TInt aAttributeType ) |
|
42 { |
|
43 return ( aAttributeType == ECmpNormal || aAttributeType == ECmpNormal8 ); |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // ImumInSettingsDataCtrl::IsNumber() |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 TBool ImumInSettingsDataCtrl::IsNumber( const TInt aAttributeType ) |
|
51 { |
|
52 return ( aAttributeType >= ECmpTInt8 && aAttributeType <= ECmpTInt64 ); |
|
53 } |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // ImumInSettingsDataCtrl::MatchKey() |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 TInt ImumInSettingsDataCtrl::MatchKey( |
|
60 const TUint aAttributeKey, |
|
61 const TInt aRequiredKey ) |
|
62 { |
|
63 TInt error = TImumDaErrorCode::ENoError; |
|
64 TInt type = GetKeyAttributeType( aAttributeKey ); |
|
65 |
|
66 // Requested key does not match with exisiting key, return error |
|
67 if ( type != aRequiredKey ) |
|
68 { |
|
69 switch ( type ) |
|
70 { |
|
71 case ECmpNormal: |
|
72 error = TImumDaErrorCode::ERequestedKeyIsTDesC; |
|
73 break; |
|
74 case ECmpNormal8: |
|
75 error = TImumDaErrorCode::ERequestedKeyIsTDesC8; |
|
76 break; |
|
77 case ECmpTInt32: |
|
78 error = TImumDaErrorCode::ERequestedKeyIsTInt; |
|
79 break; |
|
80 case ECmpTInt64: |
|
81 error = TImumDaErrorCode::ERequestedKeyIsTInt64; |
|
82 break; |
|
83 case ECmpTUint32: |
|
84 error = TImumDaErrorCode::ERequestedKeyIsTMsvId; |
|
85 break; |
|
86 default: |
|
87 error = TImumDaErrorCode::ERequestedKeyIsUnknown; |
|
88 break; |
|
89 } |
|
90 } |
|
91 |
|
92 // Panic, when key type is wrong |
|
93 __ASSERT_DEBUG( !error, User::Panic( |
|
94 KImumInSettingsDataArray, error ) ); |
|
95 |
|
96 return error; |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // ImumInSettingsDataCtrl::GetKeyAttributeType() |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 TInt ImumInSettingsDataCtrl::GetKeyAttributeType( |
|
104 const TUint aAttributeKey ) |
|
105 { |
|
106 TInt type; |
|
107 |
|
108 switch ( aAttributeKey ) |
|
109 { |
|
110 // 16-bit text |
|
111 case TImumDaSettings::EKeyEmailAddress: |
|
112 case TImumDaSettings::EKeyServer: |
|
113 case TImumDaSettings::EKeyMailboxName: |
|
114 case TImumDaSettings::EKeyUserAlias: |
|
115 case TImumDaSettings::EKeyReplyToAddress: |
|
116 case TImumDaSettings::EKeySignature: |
|
117 case TImumInSettings::EKeyAccessPointName: |
|
118 case TImumInSettings::EKeyReceiptAddress: |
|
119 type = ECmpNormal; |
|
120 break; |
|
121 |
|
122 // 32-bit values |
|
123 case TImumDaSettings::EKeyProtocol: |
|
124 case TImumDaSettings::EKeyAccessPoint: |
|
125 case TImumDaSettings::EKeyPort: |
|
126 case TImumDaSettings::EKeySecurity: |
|
127 case TImumDaSettings::EKeySendDelay: |
|
128 case TImumDaSettings::EKeySendCopyToSelf: |
|
129 case TImumDaSettings::EKeyIncludeSignature: |
|
130 case TImumDaSettings::EKeyEmailAlert: |
|
131 case TImumDaSettings::EKeyMailDeletion: |
|
132 case TImumDaSettings::EKeyAPop: |
|
133 case TImumDaSettings::EKeyAutoNotifications: |
|
134 case TImumDaSettings::EKeyAutoRetrieval: |
|
135 case TImumDaSettings::EKeyAutoRetrievalDays: |
|
136 case TImumDaSettings::EKeyAutoRetrievalInterval: |
|
137 case TImumInSettings::EKeyDownloadMaxEmailSize: |
|
138 case TImumInSettings::EKeyHideMsgs: |
|
139 case TImumInSettings::EKeyOpenHtmlMail: |
|
140 case TImumInSettings::EKeySynchronise: |
|
141 case TImumInSettings::EKeySubscribe: |
|
142 case TImumInSettings::EKeyUpdatingSeenFlag: |
|
143 case TImumInSettings::EKeySyncRate: |
|
144 case TImumInSettings::EKeyFetchSize: |
|
145 case TImumInSettings::EKeyImapIdle: |
|
146 case TImumInSettings::EKeyImapIdleTimeout: |
|
147 case TImumInSettings::EKeyBodyEncoding: |
|
148 case TImumInSettings::EKeyAddVCardToEmail: |
|
149 case TImumInSettings::EKeyRequestReceipts: |
|
150 case TImumInSettings::EKeySMTPAuth: |
|
151 case TImumInSettings::EKeyInboxLoginDetails: |
|
152 case TImumInSettings::EKeyToCcIncludeLimit: |
|
153 case TImumInSettings::EKeyDisconnectedMode: |
|
154 case TImumInSettings::EKeyAutoSendOnConnect: |
|
155 case TImumInSettings::EKeyDeleteEmailsWhenDisconnecting: |
|
156 case TImumInSettings::EKeyAcknowledgeReceipts: |
|
157 case TImumInSettings::EKeyTemporaryUsername: |
|
158 case TImumInSettings::EKeyTemporaryPassword: |
|
159 case TImumInSettings::EKeySettingsVersion: |
|
160 case TImumInSettings::EKeyAllowEmptyEmailAddress: |
|
161 case TImumInSettings::EKeyGenerateMailboxName: |
|
162 case TImumInSettings::EKeyAccessPointType: |
|
163 case TImumInSettings::EKeyInfoLastUpdateFailed: |
|
164 case TImumInSettings::EKeyDownloadBufferWlan: |
|
165 case TImumInSettings::EKeyDownloadBufferGprs: |
|
166 case TImumInSettings::EKeyIsPredefinedMailbox: |
|
167 case TImumInSettings::EKeyAoUpdateSuccessfulWithCurSettings: |
|
168 type = ECmpTInt32; |
|
169 break; |
|
170 |
|
171 // 8-bit text |
|
172 case TImumDaSettings::EKeyUsername: |
|
173 case TImumDaSettings::EKeyPassword: |
|
174 case TImumInSettings::EKeyPathSeparator: |
|
175 case TImumDaSettings::EImapFolderPath: |
|
176 case TImumInSettings::EKeySearchString: |
|
177 type = ECmpNormal8; |
|
178 break; |
|
179 |
|
180 // 64-bit values |
|
181 case TImumDaSettings::EKeyAutoRetrievalStartHour: |
|
182 case TImumDaSettings::EKeyAutoRetrievalEndHour: |
|
183 case TImumInSettings::EKeyInfoLastSuccessfulUpdate: |
|
184 type = ECmpTInt64; |
|
185 break; |
|
186 |
|
187 // 32-bit unsigned values |
|
188 case TImumDaSettings::EKeyMailboxId: |
|
189 case TImumDaSettings::EKeyInboxUpdateLimit: |
|
190 case TImumDaSettings::EKeyFolderUpdateLimit: |
|
191 case TImumInSettings::EKeyDownloadBodySize: |
|
192 case TImumInSettings::EKeyDownloadAttachmentSize: |
|
193 case TImumInSettings::EKeyDefaultMsgCharSet: |
|
194 case TImumInSettings::EKeySyncFlags: |
|
195 case TImumInSettings::EKeyDownloadFlags: |
|
196 type = ECmpTUint32; |
|
197 break; |
|
198 |
|
199 // Not too good if executing this part of the code... |
|
200 default: |
|
201 type = KErrNotFound; |
|
202 break; |
|
203 } |
|
204 |
|
205 return type; |
|
206 } |
|
207 |
|
208 // --------------------------------------------------------------------------- |
|
209 // ImumInSettingsDataCtrl::GetNextKey() |
|
210 // --------------------------------------------------------------------------- |
|
211 // |
|
212 TBool ImumInSettingsDataCtrl::GetNextKey( |
|
213 TUint& aKey, |
|
214 const TBool& aIncludeCompulsory ) |
|
215 { |
|
216 TBool isLast = EFalse; |
|
217 |
|
218 do |
|
219 { |
|
220 switch ( aKey ) |
|
221 { |
|
222 case 0: |
|
223 aKey = TImumDaSettings::EKeyMailboxId; |
|
224 break; |
|
225 |
|
226 case TImumDaSettings::EKeyLastSetting: |
|
227 aKey = TImumInSettings::EKeyAccessPointName; |
|
228 break; |
|
229 |
|
230 case TImumInSettings::ELastInSettingsKey: |
|
231 aKey = TImumDaSettings::EKeyMailboxName; |
|
232 break; |
|
233 |
|
234 case TImumDaSettings::ELastPreference: |
|
235 aKey = TImumInSettings::EKeySyncFlags; |
|
236 break; |
|
237 |
|
238 case TImumInSettings::ELastInPreferenceKey: |
|
239 aKey = TImumDaSettings::EKeyAutoNotifications; |
|
240 break; |
|
241 |
|
242 case TImumDaSettings::ELastAuto: |
|
243 aKey = TImumDaSettings::EKeyAPop; |
|
244 break; |
|
245 |
|
246 case TImumDaSettings::ELastMisc: |
|
247 aKey = TImumInSettings::EKeySearchString; |
|
248 break; |
|
249 |
|
250 case TImumInSettings::ELastInMiscKey: |
|
251 aKey = TImumInSettings::EKeyDisconnectedMode; |
|
252 break; |
|
253 |
|
254 case TImumInSettings::ELastEmailKey: |
|
255 aKey = TImumInSettings::EKeyTemporaryUsername; |
|
256 break; |
|
257 |
|
258 case TImumInSettings::ELastControlKey: |
|
259 isLast = ETrue; |
|
260 break; |
|
261 |
|
262 default: |
|
263 break; |
|
264 } |
|
265 } |
|
266 while ( !aIncludeCompulsory && IsCompulsory( aKey ) ); |
|
267 |
|
268 return isLast; |
|
269 } |
|
270 |
|
271 // --------------------------------------------------------------------------- |
|
272 // ImumInSettingsDataCtrl::IsCompulsory() |
|
273 // --------------------------------------------------------------------------- |
|
274 // |
|
275 TBool ImumInSettingsDataCtrl::IsCompulsory( TUint& aKey ) |
|
276 { |
|
277 switch ( aKey ) |
|
278 { |
|
279 case TImumDaSettings::EKeyProtocol: |
|
280 case TImumDaSettings::EKeyEmailAddress: |
|
281 case TImumDaSettings::EKeyMailboxName: |
|
282 case TImumDaSettings::EKeyServer: |
|
283 aKey++; |
|
284 return ETrue; |
|
285 |
|
286 default: |
|
287 break; |
|
288 } |
|
289 |
|
290 return EFalse; |
|
291 } |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 // End of File |