|
1 /* |
|
2 * Copyright (c) 2004 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: DS-settings |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __NSMLDSSETTINGS_H |
|
20 #define __NSMLDSSETTINGS_H |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include <d32dbms.h> |
|
26 #include <s32strm.h> |
|
27 #include <f32file.h> |
|
28 #include <SyncMLDef.h> |
|
29 #include <SyncMLDataFilter.h> |
|
30 // CONSTANTS |
|
31 |
|
32 const TInt KNsmlDsSuspendResume = 1;//RD_SUSPEND_RESUME |
|
33 const TInt KNsmlDsAutoRestart = 7; //(0x00000007) RD_AUTO_RESTART |
|
34 |
|
35 const TInt KNSmlDsSettingsFatMinSize=1000; |
|
36 const TInt KNSmlDsSettingsMaxIntegerLength=16; |
|
37 |
|
38 _LIT(KNSmlDSProfilesRsc,"\\Resource\\NSMLDSPROFILERES.RSC"); |
|
39 |
|
40 // Constants for visibility |
|
41 // The visibility array size, equals to the amount of |
|
42 // fields in TNSmlDSProfileData-enum! |
|
43 const TInt KNSmlDSVisibilityArraySize=18; |
|
44 _LIT( KNSmlDefaultVisibility, "nnnnnnnnnnnnnnnnnn"); // Default value for the visibility |
|
45 _LIT( KNSmlDSVisibilityHidden, "h"); |
|
46 _LIT( KNSmlDSVisibilityReadOnly, "r"); |
|
47 _LIT( KNSmlDSVisibilityNormal, "n"); |
|
48 const TText KNSmlDSHiddenChar = 'h'; |
|
49 const TText KNSmlDSReadOnlyChar = 'r'; |
|
50 const TText KNSmlDSNormalChar = 'n'; |
|
51 |
|
52 _LIT(KReadOnlyVisiblity ,"nrhrnnrrhnrnnrnrnn"); |
|
53 const TInt KNSmlMaxAdapterIdLength = 10; |
|
54 const TInt KAccessPointNameMaxLen = 50; |
|
55 |
|
56 //Database name & location |
|
57 _LIT( KNSmlSettingsDbName, "c:nsmldssettings.db" ); |
|
58 |
|
59 //Database tables |
|
60 _LIT( KNSmlTableProfiles, "Profiles" ); |
|
61 _LIT( KNSmlTableAdapters, "Adapters" ); |
|
62 |
|
63 // central repository uid for variating XML profile definition |
|
64 const TUid KCRUidDataSyncInternalKeys = { 0x2000CF7E }; |
|
65 const TUid KCRUidDSDefaultProfileInternalKeys = { 0x20021338 }; |
|
66 const TInt KNsmlDsCustomProfiles = 0; |
|
67 const TInt KNsmlDsDefaultProfile = 0; |
|
68 |
|
69 _LIT(KEmpty, ""); |
|
70 |
|
71 const TInt KDSMaxURLLength = 144; |
|
72 const TInt KDSMaxRemoteNameLength = 125; |
|
73 |
|
74 // sync adapder uids |
|
75 const TUid KUidNSmlAdapterCalendar = { 0x101F6DDE }; |
|
76 const TUid KUidNSmlAdapterContact = { 0x101F6DDD }; |
|
77 const TUid KUidNSmlAdapterEMail = { 0x101F6DDF }; |
|
78 const TUid KUidNSmlAdapterNote = { 0x101F8612 }; |
|
79 const TUid KUidNSmlAdapterSms = { 0x10206B5C }; |
|
80 const TUid KUidNSmlAdapterMMS = { 0x101FB0E9 }; |
|
81 const TUid KUidNSmlAdapterBookmarks = { 0x102751BA }; |
|
82 |
|
83 //table Profiles columns |
|
84 _LIT( KNSmlDSProfileId, "Id" ); |
|
85 _LIT( KNSmlDSProfileDisplayName, "DisplayName" ); |
|
86 _LIT( KNSmlDSProfileServerURL, "ServerURL" ); |
|
87 _LIT( KNSmlDSProfileIAPId, "IAPid" ); |
|
88 _LIT( KNSmlDSProfileTransportId, "TransportId" ); |
|
89 _LIT( KNSmlDSProfileSyncServerUsername, "SyncServerUsername" ); |
|
90 _LIT( KNSmlDSProfileSyncServerPassword, "SyncServerPassword" ); |
|
91 _LIT( KNSmlDSProfileServerAlertedAction, "ServerAlertedAction" ); |
|
92 _LIT( KNSmlDSProfileDeleteAllowed, "DeleteAllowed" ); |
|
93 _LIT( KNSmlDSProfileHidden, "HiddenProfile" ); |
|
94 _LIT( KNSmlDSProfileLog, "Log" ); |
|
95 _LIT( KNSmlDSProfileHttpAuthUsed, "HttpAuthUsed" ); |
|
96 _LIT( KNSmlDSProfileHttpAuthUsername, "HttpAuthUsername" ); |
|
97 _LIT( KNSmlDSProfileHttpAuthPassword, "HttpAuthPassword" ); |
|
98 _LIT( KNSmlDSProfileAutoChangeIAP, "AutoChangeIAP" ); |
|
99 _LIT( KNSmlDSProfileVisibilityStr, "Visibility" ); |
|
100 _LIT( KNSmlDSProfileCreatorID, "CreatorID" ); |
|
101 _LIT( KNSmlDSProfileServerId, "ServerId" ); |
|
102 _LIT( KNSmlDSProfileProtocolVersion, "ProtocolVersion" ); |
|
103 _LIT( KNSmlDSProfileDefaultProfile, "DefaultProfile" ); |
|
104 |
|
105 //table Adapters columns |
|
106 _LIT( KNSmlAdapterId, "Id" ); |
|
107 _LIT( KNSmlAdapterProfileId, "ProfileId" ); |
|
108 _LIT( KNSmlAdapterImlementationUID, "ImplementationUID" ); |
|
109 _LIT( KNSmlAdapterEnabled, "Enabled" ); |
|
110 _LIT( KNSmlAdapterCreatorID, "CreatorID" ); |
|
111 _LIT( KNSmlAdapterFilter, "Filter" ); |
|
112 _LIT( KNSmlAdapterDisplayName, "DisplayName" ); |
|
113 _LIT( KNSmlAdapterServerDataSource, "ServerDataSource" ); |
|
114 _LIT( KNSmlAdapterClientDataSource, "ClientDataSource" ); |
|
115 _LIT( KNSmlAdapterSyncType, "SyncType" ); |
|
116 _LIT( KNSmlAdapterFilterMatchType, "FilterMatchType" ); |
|
117 |
|
118 // SQL clauses |
|
119 _LIT( KDSCreateProfilesTable, "CREATE TABLE Profiles ( Id COUNTER, DisplayName CHAR(%d), IAPId SMALLINT NOT NULL, ProtocolVersion UNSIGNED SMALLINT NOT NULL, TransportId INTEGER, SyncServerUsername CHAR(%d), SyncServerPassword CHAR(%d), ServerURL CHAR(%d), ServerId CHAR(%d), ServerAlertedAction UNSIGNED SMALLINT, DeleteAllowed BIT, HiddenProfile BIT, Log LONG VARBINARY, HttpAuthUsed BIT, HttpAuthUsername CHAR(%d), HttpAuthPassword CHAR(%d), AutoChangeIAP BIT, Visibility CHAR(%d), CreatorID INTEGER)" ); |
|
120 _LIT( KDSCreateAdaptersTable, "CREATE TABLE Adapters ( Id COUNTER, ProfileId UNSIGNED SMALLINT NOT NULL, ImplementationUID UNSIGNED INTEGER NOT NULL, Enabled BIT NOT NULL, CreatorID INTEGER, Filter LONG VARBINARY, SyncType UNSIGNED SMALLINT, DisplayName CHAR(%d), ServerDataSource CHAR(%d), ClientDataSource CHAR(%d), FilterMatchType UNSIGNED SMALLINT )"); |
|
121 _LIT( KDSSQLGetProfileId, "SELECT ProfileId FROM Adapters WHERE ImplementationUID = %d" ); |
|
122 _LIT( KDSSQLGetProfile, "SELECT * FROM Profiles WHERE Id = %d" ); |
|
123 _LIT( KDSSQLGetProfiles, "SELECT * FROM Profiles WHERE HiddenProfile = 0 ORDER BY Id" ); |
|
124 _LIT( KDSSQLGetAllProfiles, "SELECT * FROM Profiles ORDER BY Id" ); |
|
125 _LIT( KDSSQLDeleteProfile,"DELETE FROM Profiles WHERE Id = %d" ); |
|
126 _LIT( KDSSQLDeleteAdapter,"DELETE FROM Adapters WHERE ProfileId = %d" ); |
|
127 _LIT( KDSSQLDeleteAdapterById, "DELETE FROM Adapters WHERE Id = %d" ); |
|
128 _LIT( KDSSQLGetAdapterId, "SELECT Id FROM Adapters WHERE Id = %d" ); |
|
129 _LIT( KDSSQLCountProfiles, "SELECT * FROM Profiles WHERE HiddenProfile = 0" ); |
|
130 _LIT( KDSSQLFindContentType, "SELECT * FROM Adapters WHERE Id = %d"); |
|
131 _LIT( KDSSQLGetAllContentTypes, "SELECT * FROM Adapters WHERE ProfileId = %d"); |
|
132 _LIT( KDSSQLGetAllContentTypesByImplementationId, "SELECT * FROM Adapters WHERE ProfileId = %d and ImplementationUID = %d" ); |
|
133 |
|
134 //enumerations |
|
135 |
|
136 enum TNSmlDSProfileData |
|
137 { |
|
138 EDSProfileId, |
|
139 EDSProfileDisplayName, |
|
140 EDSProfileServerURL, |
|
141 EDSProfileIAPId, |
|
142 EDSProfileTransportId, |
|
143 EDSProfileSyncServerUsername, |
|
144 EDSProfileSyncServerPassword, |
|
145 EDSProfileServerAlertedAction, |
|
146 EDSProfileDeleteAllowed, |
|
147 EDSProfileHidden, |
|
148 EDSProfileHttpAuthUsed, |
|
149 EDSProfileHttpAuthUsername, |
|
150 EDSProfileHttpAuthPassword, |
|
151 EDSProfileAutoChangeIAP, |
|
152 EDSProfileCreatorId, |
|
153 EDSProfileServerId, |
|
154 EDSProfileProtocolVersion, |
|
155 EDSProfileDefaultProfile |
|
156 }; |
|
157 |
|
158 enum TNSmlDSFieldVisibility |
|
159 { |
|
160 EVisibilityNormal, |
|
161 EVisibilityReadOnly, |
|
162 EVisibilityHidden |
|
163 }; |
|
164 |
|
165 enum TNSmlDSTable |
|
166 { |
|
167 EProfiles, |
|
168 EAdapters |
|
169 }; |
|
170 |
|
171 enum TNSmlDSContentTypeData |
|
172 { |
|
173 EDSAdapterTableId, |
|
174 EDSAdapterProfileId, |
|
175 EDSAdapterImplementationId, |
|
176 EDSAdapterEnabled, |
|
177 EDSAdapterCreatorId, |
|
178 EDSAdapterFilter, |
|
179 EDSAdapterDisplayName, |
|
180 EDSAdapterServerDataSource, |
|
181 EDSAdapterClientDataSource, |
|
182 EDSAdapterSyncType, |
|
183 EDSAdapterFilterMatchType |
|
184 }; |
|
185 |
|
186 enum TNSmlDSContentTypeGetMode |
|
187 { |
|
188 EDSActiveContentTypes, |
|
189 EDSAllContentTypes |
|
190 }; |
|
191 |
|
192 enum TNSmlDSProfileAllowed |
|
193 { |
|
194 EDSNotAllowed, |
|
195 EDSAllowed |
|
196 }; |
|
197 enum TNSmlDSEnabled |
|
198 { |
|
199 EDSDisabled, |
|
200 EDSEnabled |
|
201 }; |
|
202 |
|
203 enum TNSmlXMLContentData |
|
204 { |
|
205 EXMLDSAdapaterId , |
|
206 EXMLDSProfileName, |
|
207 EXMLDSServerId, |
|
208 EXMLDSServerDataSource |
|
209 |
|
210 }; |
|
211 |
|
212 |
|
213 // FORWARD DECLARATIONS |
|
214 class CNSmlDSSettings; |
|
215 class CNSmlDSProfile; |
|
216 class CNSmlDSContentType; |
|
217 class CNSmlDSCrypt; |
|
218 |
|
219 |
|
220 // CLASS DECLARATION |
|
221 |
|
222 /** |
|
223 * CNSmlDSProfileListItem class is used when list of profiles is |
|
224 * needed (when starting application). |
|
225 * |
|
226 * @lib nsmldssettings.lib |
|
227 */ |
|
228 class CNSmlDSProfileListItem : public CBase |
|
229 { |
|
230 public: |
|
231 /** |
|
232 * two-phase constructor - Creates new CNSmlDSProfileListItem* |
|
233 * @param TInt aId - id of profile |
|
234 * @return CNSmlDSProfileListItem* - item that was created |
|
235 */ |
|
236 IMPORT_C static CNSmlDSProfileListItem* NewL( const TInt aId ); |
|
237 |
|
238 /** |
|
239 * two-phase constructor - Creates new CNSmlDSProfileListItem*, which is left |
|
240 * in cleanup stack. |
|
241 * @param TInt aId - id of profile |
|
242 * @return CNSmlDSProfileListItem* - item that was created |
|
243 */ |
|
244 IMPORT_C static CNSmlDSProfileListItem* NewLC( const TInt aId ); |
|
245 |
|
246 /** |
|
247 * Destructor |
|
248 * @param - |
|
249 * @return - |
|
250 */ |
|
251 ~CNSmlDSProfileListItem(); |
|
252 |
|
253 /** |
|
254 * Returns value of given integer field - only profile id |
|
255 * @param TNSmlDSProfileData aProfileItem - field enumeration |
|
256 * @return TInt - id of profile |
|
257 */ |
|
258 IMPORT_C TInt IntValue( TNSmlDSProfileData aProfileItem ) const; |
|
259 |
|
260 /** |
|
261 * Copies values from sourceitem |
|
262 * @param CNSmlDSProfileListItem* aSourceItem - Item from which values are copied from |
|
263 * @return - |
|
264 */ |
|
265 IMPORT_C void AssignL( const CNSmlDSProfileListItem* aSourceItem ); |
|
266 |
|
267 private: |
|
268 void ConstructL(); |
|
269 void ShowHiddenProfiles(); |
|
270 |
|
271 private: |
|
272 TInt iId; |
|
273 TBool iShowHidden; |
|
274 |
|
275 }; |
|
276 |
|
277 typedef CArrayPtrFlat<CNSmlDSProfileListItem> CNSmlDSProfileList; |
|
278 typedef CArrayPtrFlat<CNSmlDSProfile> CNSmlProfileArray; |
|
279 |
|
280 /** |
|
281 * CNSmlDSSettings provides an interface to DS Settings database |
|
282 * |
|
283 * @lib nsmldssettings.lib |
|
284 */ |
|
285 class CNSmlDSSettings : public CBase |
|
286 { |
|
287 public: |
|
288 /** |
|
289 * two-phase constructor - Creates new CNSmlDSSettings* |
|
290 * @param - |
|
291 * @return CNSmlDSSettings* - new CNSmlDSSettings |
|
292 */ |
|
293 IMPORT_C static CNSmlDSSettings* NewL(); |
|
294 |
|
295 /** |
|
296 * two-phase constructor - Creates new CNSmlDSSettings*, which |
|
297 * is left in cleanup stack |
|
298 * @param - |
|
299 * @return CNSmlDSSettings* - new CNSmlDSSettings |
|
300 */ |
|
301 IMPORT_C static CNSmlDSSettings* NewLC(); |
|
302 |
|
303 /** |
|
304 * Destructor |
|
305 * @param - |
|
306 * @return - |
|
307 */ |
|
308 IMPORT_C ~CNSmlDSSettings(); |
|
309 |
|
310 /** |
|
311 * Creates new profile |
|
312 * @param - |
|
313 * @return CNSmlDSProfile* - new profile |
|
314 */ |
|
315 IMPORT_C CNSmlDSProfile* CreateProfileL(); |
|
316 |
|
317 /** |
|
318 * Creates new profile with values from given profile id |
|
319 * @param TInt aId - profile that values are copied from |
|
320 * @return CNSmlDSProfile* - new profile |
|
321 */ |
|
322 IMPORT_C CNSmlDSProfile* CreateProfileL( const TInt aId ); |
|
323 |
|
324 /** |
|
325 * List all profile id's (except hidden profiles) into array |
|
326 * @param CNSmlDSProfileList* aProfileList - array to fill with profile id's |
|
327 * @return - |
|
328 */ |
|
329 IMPORT_C void GetProfileListL( CNSmlDSProfileList* aProfileList); |
|
330 |
|
331 /** |
|
332 * List all profile id's (including hidden profiles) into array |
|
333 * @param CNSmlDSProfileList* aProfileList - array to fill with profile id's |
|
334 * @return - |
|
335 */ |
|
336 IMPORT_C void GetAllProfileListL( CNSmlDSProfileList* aProfileList); |
|
337 |
|
338 /** |
|
339 * Gets profile with given id |
|
340 * @param TInt aId - Profile id |
|
341 * @param const TNSmlDSContentTypeGetMode aMode - All / active contents. |
|
342 * @return CNSmlDSProfile* - profile |
|
343 */ |
|
344 IMPORT_C CNSmlDSProfile* ProfileL(TInt aId, const TNSmlDSContentTypeGetMode aMode = EDSAllContentTypes ); |
|
345 |
|
346 /** |
|
347 * Returns Profile ID with given AdapterId |
|
348 * @param TInt aId - adapter id |
|
349 * @return TInt - id of profile |
|
350 */ |
|
351 IMPORT_C TInt ProfileIdL( TInt aId); |
|
352 |
|
353 /** |
|
354 * Deletes profile with given id |
|
355 * @param TInt aId - profile id |
|
356 * @return TInt - KErrNone, if succesfull |
|
357 */ |
|
358 IMPORT_C TInt DeleteProfileL( TInt aId ); |
|
359 |
|
360 /** |
|
361 * returns database |
|
362 * @param - |
|
363 * @return RDbNamedDatabase* - the database |
|
364 */ |
|
365 IMPORT_C RDbNamedDatabase* Database(); |
|
366 |
|
367 /** |
|
368 * updates the default profiles |
|
369 * @param - |
|
370 * @return - |
|
371 */ |
|
372 IMPORT_C void UpdateHiddenProfilesL(); |
|
373 |
|
374 /** |
|
375 * Parse xml |
|
376 * @param - whether data has to be restored from existing database |
|
377 * @return - |
|
378 */ |
|
379 void CreateXMLProfilesL(TBool aRestore); |
|
380 |
|
381 /** |
|
382 * check mandatory settings of the profile |
|
383 * @param - profile, index |
|
384 * @return - |
|
385 */ |
|
386 TBool CheckXMLProfileSettings(CNSmlProfileArray* aProfileArray, TInt aIndex); |
|
387 |
|
388 /** |
|
389 * read cenrep key value |
|
390 * @param - aKey, aKey |
|
391 * @return - |
|
392 */ |
|
393 void ReadRepositoryL(TInt aKey, TInt& aValue); |
|
394 |
|
395 /** |
|
396 * read cenrep key value |
|
397 * @param - aKey, aKey |
|
398 * @return - |
|
399 */ |
|
400 void WriteRepositoryL(TUid aUid, TInt aKey, TInt aValue); |
|
401 |
|
402 private: |
|
403 void ConstructL(); |
|
404 void CreateDatabaseL( const TDesC& aFullName ); |
|
405 void CreateHiddenProfilesL(); |
|
406 void PrepareViewL( const TDesC& aSql, RDbRowSet::TAccess aAccess ); |
|
407 void CommitAndCompact(); |
|
408 void AddToProfileListL( CNSmlDSProfileList* aProfileList ); |
|
409 CNSmlDSProfile* ProfileOnlyL( TInt aId ); |
|
410 TPtrC ViewColDes( const TDesC& aFieldName ); |
|
411 TInt ViewColInt( const TDesC& aFieldName ); |
|
412 TUint ViewColUint( const TDesC& aFieldName ); |
|
413 TBool RemoveDeletedL(); |
|
414 |
|
415 private: |
|
416 RDbNamedDatabase iDatabase; |
|
417 RFs iFsSession; |
|
418 RDbs iRdbSession; |
|
419 RDbTable iTableProfiles; |
|
420 CDbColSet* iColSet; |
|
421 RDbView iView; |
|
422 TInt iAdapterId; |
|
423 CNSmlProfileArray* iResourceProfileArray; |
|
424 }; |
|
425 |
|
426 /** |
|
427 * CNSmlDSProfile provides methods to update and save profile data |
|
428 * |
|
429 * @lib nsmldssettings.lib |
|
430 */ |
|
431 |
|
432 class CNSmlDSProfile : public CBase |
|
433 { |
|
434 public: |
|
435 |
|
436 /** |
|
437 * two-phase constructor - Creates new CNSmlDSProfile* |
|
438 * @param RDbNamedDatabase* aDatabase - database to be used |
|
439 * @return CNSmlDSProfile* - new profile |
|
440 */ |
|
441 static CNSmlDSProfile* NewL( RDbNamedDatabase* aDatabase ); |
|
442 |
|
443 /** |
|
444 * two-phase constructor - Creates new CNSmlDSProfile*, which is |
|
445 * left in cleanup stack |
|
446 * @param RDbNamedDatabase* aDatabase - database to be used |
|
447 * @return CNSmlDSProfile* - new profile |
|
448 */ |
|
449 static CNSmlDSProfile* NewLC( RDbNamedDatabase* aDatabase ); |
|
450 |
|
451 /** |
|
452 * Destructor |
|
453 * @param - |
|
454 * @return - |
|
455 */ |
|
456 IMPORT_C ~CNSmlDSProfile(); |
|
457 |
|
458 /** |
|
459 * Adds new content type for profile |
|
460 * @param TInt aImplementationUID - Uid of adapter to be used |
|
461 * @param TDesC& aClientDataSource - Data source for client |
|
462 * @param TDesC& aServerDataSource - Data source for server |
|
463 * @return CNSmlDSContentType* - new content type |
|
464 */ |
|
465 IMPORT_C CNSmlDSContentType* AddContentTypeL ( TInt aImplementationUID, TDesC& aClientDataSource, TDesC& aServerDataSource ); |
|
466 |
|
467 /** |
|
468 * Gets content type |
|
469 * @param TInt aImplementationUID - Uid of adapter to be used |
|
470 * @return CNSmlDSContentType* - the content type, or NULL if nothing was found |
|
471 */ |
|
472 IMPORT_C CNSmlDSContentType* ContentType (TInt aImplementationUID ) const; |
|
473 |
|
474 /** |
|
475 * Gets content type |
|
476 * @param TInt aId - Id of content type |
|
477 * @return CNSmlDSContentType* - the content type, or NULL if nothing was found |
|
478 */ |
|
479 IMPORT_C CNSmlDSContentType* ContentTypeId ( TInt aId ) const; |
|
480 |
|
481 /** |
|
482 * Deletes content type |
|
483 * @param TInt aTaskid - task id of content type |
|
484 * @return TBool - ETrue if delete succeeded |
|
485 */ |
|
486 IMPORT_C TBool DeleteContentTypeL( TInt aTaskId ); |
|
487 |
|
488 /** |
|
489 * Saves values of profile and it's content type's into database |
|
490 * @param - |
|
491 * @return TInt - KErrNone, if succeeded |
|
492 */ |
|
493 IMPORT_C TInt SaveL(); |
|
494 |
|
495 /** |
|
496 * Returns value of given descriptor field |
|
497 * @param TNSmlDSProfileData aProfileItem - Enumeration of the field |
|
498 * @return const TDesC& - the descriptor |
|
499 */ |
|
500 IMPORT_C const TDesC& StrValue( TNSmlDSProfileData aProfileItem ) const; |
|
501 |
|
502 /** |
|
503 * Returns value of given integer field |
|
504 * @param TNSmlDSProfileData aProfileItem - Enumeration of the field |
|
505 * @return const TInt - the integer |
|
506 */ |
|
507 IMPORT_C TInt IntValue( TNSmlDSProfileData aProfileItem ) const; |
|
508 |
|
509 /** |
|
510 * Sets new value for descriptor |
|
511 * @param TNSmlDSProfileData aProfileItem - Enumeration of the field that is updated |
|
512 * @param const TDesC& aNewValue - New value for field |
|
513 * @return - |
|
514 */ |
|
515 IMPORT_C void SetStrValue( TNSmlDSProfileData aProfileItem, const TDesC& aNewValue ); |
|
516 |
|
517 /** |
|
518 * Sets new value for integer |
|
519 * @param TNSmlDSProfileData aProfileItem - Enumeration of the field that is updated |
|
520 * @param const TInt aNewValue - New value for field |
|
521 * @return - |
|
522 */ |
|
523 IMPORT_C void SetIntValue( TNSmlDSProfileData aProfileItem, const TInt aNewValue ); |
|
524 |
|
525 /** |
|
526 * Returns true if profile has not been saved yet |
|
527 * @param - |
|
528 * @return TBool - ETrue if profile has not been saved yet |
|
529 */ |
|
530 IMPORT_C TBool IsNew() const; |
|
531 |
|
532 /** |
|
533 * Returns true if profile has log |
|
534 * @param - |
|
535 * @return TBool - ETrue if profile has log |
|
536 */ |
|
537 IMPORT_C TBool HasLogL(); |
|
538 |
|
539 /** |
|
540 * Returns true if value of given field is NULL |
|
541 * @param const TDesC& aFieldName - Name of the field |
|
542 * @return TBool - ETrue if value of given field is NULL |
|
543 */ |
|
544 IMPORT_C TBool IsNullL( const TDesC& aFieldName ); |
|
545 |
|
546 /** |
|
547 * Returns stream to read log data from |
|
548 * @param - |
|
549 * @return RReadStream& - stream to read profile log |
|
550 */ |
|
551 IMPORT_C RReadStream& LogReadStreamL(); |
|
552 |
|
553 /** |
|
554 * Returns stream to read log from |
|
555 * @param - |
|
556 * @return RReadStream& - stream to read profile log |
|
557 */ |
|
558 IMPORT_C RWriteStream& LogWriteStreamL(); |
|
559 |
|
560 /** |
|
561 * Commits writing to stream |
|
562 * @param - |
|
563 * @return - |
|
564 */ |
|
565 IMPORT_C void WriteStreamCommitL(); |
|
566 |
|
567 /** |
|
568 * Sets profile as hidden |
|
569 * @param TBool aHidden - new value for profile hidden field |
|
570 * @return TBool - ETrue if success |
|
571 */ |
|
572 IMPORT_C TBool SetHiddenL( TBool aHidden ); |
|
573 |
|
574 /** |
|
575 * A getter for each fields visibility |
|
576 * @param TNSmlDSProfileData aProfileItem - Enumeration of the field |
|
577 * @return TNSmlDSFieldVisibility - Visibility value |
|
578 */ |
|
579 IMPORT_C TNSmlDSFieldVisibility Visibility( TNSmlDSProfileData aProfileItem ) const; |
|
580 |
|
581 /** |
|
582 * A setter for each fields visibility |
|
583 * @param TNSmlDSProfileData aProfileItem - Enumeration of the field |
|
584 * @param const TNSmlDSFieldVisibility aVisibility - Visibility value to set |
|
585 * @return - |
|
586 */ |
|
587 IMPORT_C void SetVisibility( TNSmlDSProfileData aProfileItem, const TNSmlDSFieldVisibility aVisibility ); |
|
588 |
|
589 void InitVisibilityArray( const TDesC& aVisibilityStr ); |
|
590 TNSmlDSFieldVisibility CharToVisibility( const TText aCh ) const; |
|
591 TPtrC VisibilityToChar( const TNSmlDSFieldVisibility aVisibility ) const; |
|
592 |
|
593 void GetContentTypesL( const TNSmlDSContentTypeGetMode aMode ); |
|
594 CNSmlDSContentType* GetContentTypeL( TInt aImplementationUID ); |
|
595 |
|
596 CArrayPtrFlat<CNSmlDSContentType>* iContentTypes; |
|
597 |
|
598 private: |
|
599 |
|
600 HBufC* GetVisibilityStrL() const; |
|
601 |
|
602 void ConstructL( RDbNamedDatabase* aDatabase ); |
|
603 |
|
604 void PrepareViewL( const TDesC& aSql, RDbRowSet::TAccess aAccess ); |
|
605 void UpdateToDeleteAllowedL(); |
|
606 void CommitAndCompact(); |
|
607 void ResetContentTypesL(); |
|
608 void TableProfilesSetColIntL( const TDesC& aFieldName, TInt aValue); |
|
609 void TableProfilesSetColDesL( const TDesC& aFieldName, TDesC& aValue); |
|
610 void ViewSetColIntL( const TDesC& aFieldName, TInt aValue); |
|
611 void ViewSetColDesL( const TDesC& aFieldName, TDesC& aValue); |
|
612 void InsertTableAdaptersL( TInt aInd ); |
|
613 |
|
614 private: |
|
615 |
|
616 TFixedArray<TNSmlDSFieldVisibility, KNSmlDSVisibilityArraySize> iVisibilityArray; |
|
617 |
|
618 TInt iId; |
|
619 HBufC* iDisplayName; |
|
620 |
|
621 TInt iTransportId; |
|
622 TInt iIAPId; |
|
623 |
|
624 HBufC* iSyncServerUsername; |
|
625 HBufC* iSyncServerPassword; |
|
626 |
|
627 HBufC* iServerURL; |
|
628 HBufC* iServerId; |
|
629 |
|
630 TInt iProtocolVersion; |
|
631 TInt iServerAlertedAction; |
|
632 TBool iDeleteAllowed; |
|
633 TBool iProfileHidden; |
|
634 |
|
635 TBool iHttpAuthUsed; |
|
636 HBufC* iHttpAuthUsername; |
|
637 HBufC* iHttpAuthPassword; |
|
638 TBool iAutoChangeIAP; |
|
639 TInt iCreatorId; |
|
640 |
|
641 TBool iDefaultProfile; |
|
642 |
|
643 RDbNamedDatabase* iDatabase; |
|
644 |
|
645 TInt iAdapterId; |
|
646 |
|
647 RDbTable iTableProfiles; |
|
648 RDbTable iTableAdapters; |
|
649 |
|
650 RDbColWriteStream iWs; |
|
651 RDbColReadStream iRs; |
|
652 |
|
653 RDbView iRSView; |
|
654 RDbView iWSView; |
|
655 |
|
656 CDbColSet* iColSetProfiles; |
|
657 CDbColSet* iColSetAdapters; |
|
658 |
|
659 RDbView iView; |
|
660 |
|
661 }; |
|
662 |
|
663 /** |
|
664 * CNSmlDSContentType provides methods to update and save content type data |
|
665 * |
|
666 * @lib nsmldssettings.lib |
|
667 */ |
|
668 |
|
669 class CNSmlDSContentType: public CBase |
|
670 { |
|
671 public: |
|
672 |
|
673 /** |
|
674 * two-phase constructor - Creates new CNSmlDSContentType* |
|
675 * @param RDbNamedDatabase* aDatabase - database to be used |
|
676 * @return CNSmlDSContentType* - new profile |
|
677 */ |
|
678 static CNSmlDSContentType* NewL( RDbNamedDatabase* aDatabase ); |
|
679 |
|
680 /** |
|
681 * two-phase constructor - Creates new CNSmlDSContentType*, which |
|
682 * is left in cleanup stack. |
|
683 * @param RDbNamedDatabase* aDatabase - database to be used |
|
684 * @return CNSmlDSContentType* - new profile |
|
685 */ |
|
686 static CNSmlDSContentType* NewLC( RDbNamedDatabase* aDatabase ); |
|
687 |
|
688 /** |
|
689 * Destructor |
|
690 * @param - |
|
691 * @return - |
|
692 */ |
|
693 ~CNSmlDSContentType(); |
|
694 |
|
695 /** |
|
696 * Returns value of given descriptor field |
|
697 * @param TNSmlDSContentTypeData aProfileItem - Enumeration of the field |
|
698 * @return const TDesC& - the descriptor |
|
699 */ |
|
700 IMPORT_C const TDesC& StrValue( TNSmlDSContentTypeData aProfileItem ) const; |
|
701 |
|
702 /** |
|
703 * Returns value of given integer field |
|
704 * @param TNSmlDSContentTypeData aProfileItem - Enumeration of the field |
|
705 * @return const TInt - the integer |
|
706 */ |
|
707 IMPORT_C TInt IntValue( TNSmlDSContentTypeData aType ) const; |
|
708 |
|
709 /** |
|
710 * Sets new value for integer |
|
711 * @param TNSmlDSContentTypeData aProfileItem - Enumeration of the field that is updated |
|
712 * @param const TInt aNewValue - New value for field |
|
713 * @return - |
|
714 */ |
|
715 IMPORT_C void SetIntValue( TNSmlDSContentTypeData aType, const TInt aNewValue ); |
|
716 |
|
717 /** |
|
718 * Sets new value for descriptor |
|
719 * @param TNSmlDSContentTypeData aProfileItem - Enumeration of the field that is updated |
|
720 * @param const TDesC& aNewValue - New value for field |
|
721 * @return - |
|
722 */ |
|
723 IMPORT_C void SetStrValue( TNSmlDSContentTypeData aProfileItem, const TDesC& aNewValue ); |
|
724 |
|
725 /** |
|
726 * Returns true, if content type has a filter |
|
727 * @param - |
|
728 * @return TBool - ETrue if content type has a filter |
|
729 */ |
|
730 IMPORT_C TBool HasFilterL(); |
|
731 |
|
732 /** |
|
733 * Returns stream to read filter data from |
|
734 * @param - |
|
735 * @return RReadStream& - stream to read filter |
|
736 */ |
|
737 IMPORT_C RReadStream& FilterReadStreamL(); |
|
738 |
|
739 /** |
|
740 * Returns stream to write filter into |
|
741 * @param - |
|
742 * @return RWriteStream& - stream to write filter |
|
743 */ |
|
744 IMPORT_C RWriteStream& FilterWriteStreamL(); |
|
745 |
|
746 /** |
|
747 * Commits writing to stream |
|
748 * @param - |
|
749 * @return - |
|
750 */ |
|
751 IMPORT_C void WriteStreamCommitL(); |
|
752 |
|
753 private: |
|
754 void ConstructL(); |
|
755 private: |
|
756 TInt iId; |
|
757 TInt iProfileId; |
|
758 TInt iImplementationId; |
|
759 TNSmlDSEnabled iEnabled; |
|
760 TInt iCreatorId; |
|
761 HBufC* iDisplayName; |
|
762 HBufC* iServerDataSource; |
|
763 HBufC* iClientDataSource; |
|
764 TInt iSyncType; |
|
765 |
|
766 |
|
767 TSyncMLFilterMatchType iFilterMatchType; |
|
768 RDbNamedDatabase* iDatabase; |
|
769 CDbColSet* iColSetAdapterParams; |
|
770 |
|
771 RDbView iView; |
|
772 |
|
773 RDbView iRSView; |
|
774 RDbView iWSView; |
|
775 |
|
776 TInt iParamId; |
|
777 TInt iParamTableId; |
|
778 TUid iUid; |
|
779 |
|
780 RDbColWriteStream iWs; |
|
781 RDbColReadStream iRs; |
|
782 }; |
|
783 |
|
784 /** |
|
785 * CNSmlDSCrypt handles encryption / decryption of data |
|
786 * |
|
787 * @lib nsmldssettings.lib |
|
788 */ |
|
789 class CNSmlDSCrypt : public CBase |
|
790 { |
|
791 public: |
|
792 /** |
|
793 * Constructor |
|
794 * @param - |
|
795 * @return - |
|
796 */ |
|
797 IMPORT_C CNSmlDSCrypt(); |
|
798 |
|
799 /** |
|
800 * Destructor |
|
801 * @param - |
|
802 * @return - |
|
803 */ |
|
804 IMPORT_C ~CNSmlDSCrypt(); |
|
805 |
|
806 /** |
|
807 * Encrypts data |
|
808 * @param const TDesC& aInput - data to be encrypted |
|
809 * @return TDesC& - Encrypted data |
|
810 */ |
|
811 IMPORT_C TDesC& EncryptedL( const TDesC& aInput ); |
|
812 |
|
813 /** |
|
814 * Decrypts data |
|
815 * @param const TDesC& aInput - data to be decrypted |
|
816 * @return TDesC& - Decrypted data |
|
817 */ |
|
818 IMPORT_C TDesC& DecryptedL( const TDesC& aInput ); |
|
819 |
|
820 private: |
|
821 HBufC* iOutput; |
|
822 }; |
|
823 |
|
824 |
|
825 class CNSmlDSContentSettingType: public CBase |
|
826 { |
|
827 public: |
|
828 /** |
|
829 * two-phase constructor - Creates new CNSmlDSContentSettingType* |
|
830 * @param |
|
831 * @return CNSmlDSContentSettingType* - |
|
832 */ |
|
833 static CNSmlDSContentSettingType* NewL( ); |
|
834 |
|
835 /** |
|
836 * two-phase constructor - Creates new CNSmlDSContentSettingType*, which |
|
837 * is left in cleanup stack. |
|
838 * @param |
|
839 * @return CNSmlDSContentSettingType* - |
|
840 */ |
|
841 static CNSmlDSContentSettingType* NewLC( ); |
|
842 |
|
843 /** |
|
844 * Destructor |
|
845 * @param - |
|
846 * @return - |
|
847 */ |
|
848 ~CNSmlDSContentSettingType(); |
|
849 |
|
850 /** |
|
851 * Returns value of given integer field |
|
852 * @param TNSmlXMLContentData aType - |
|
853 * @return const TInt - the integer |
|
854 */ |
|
855 const TDesC& StrValue(TNSmlXMLContentData aType) const ; |
|
856 |
|
857 /** |
|
858 * Sets new value for integer |
|
859 * @param TNSmlXMLContentData aType - |
|
860 * @param TInt aNewValue - New value for field |
|
861 * @return - |
|
862 */ |
|
863 void SetStrValue(TNSmlXMLContentData aType ,const TDesC& aNewValue ); |
|
864 |
|
865 |
|
866 |
|
867 private: |
|
868 |
|
869 void ConstructL(); |
|
870 |
|
871 private: |
|
872 |
|
873 HBufC* iImplementationId; |
|
874 |
|
875 HBufC* iProfileName; |
|
876 HBufC* iServerId; |
|
877 HBufC* iServerDataSource; |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 }; |
|
883 #endif //__NSMLDSSETTINGS_H |