|
1 /* |
|
2 * Copyright (c) 2002-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: DM-settings |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __NSMLDMSETTINGS_H |
|
20 #define __NSMLDMSETTINGS_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 |
|
29 // CONSTANTS |
|
30 _LIT(KNSmlDMProfilesRsc,"\\Resource\\NSMLDMPROFILERES.RSC"); |
|
31 |
|
32 const TInt KNSmlDmSettingsFatMinSize=200; |
|
33 const TInt KNSmlDmCreateDB=50; |
|
34 const TInt KNSmlDmMaxIntegerLength=16; |
|
35 const TInt KNSmlDMDriveLetter = EDriveC; |
|
36 const TInt KNSmlDMProfileTableColCount = 23; //correct this after somemtime |
|
37 const TInt KMaxXmlPathLength = 1024; |
|
38 |
|
39 //Database name & location |
|
40 _LIT( KNSmlDMSettingsDbName, "c:nsmldmsettings.db" ); |
|
41 |
|
42 //Database tables |
|
43 _LIT( KNSmlDMTableProfiles, "Profiles" ); |
|
44 _LIT( KNSmlTableCommonSettings, "CommonSettings" ); |
|
45 |
|
46 //table Profiles columns |
|
47 _LIT( KNSmlDMProfileId, "Id" ); |
|
48 _LIT( KNSmlDMProfileDisplayName, "DisplayName" ); |
|
49 _LIT( KNSmlDMProfileIAPId, "IAPId" ); |
|
50 _LIT( KNSmlDMProfileTransportId, "TransportId" ); |
|
51 _LIT( KNSmlDMProfileServerUsername, "ServerUsername" ); |
|
52 _LIT( KNSmlDMProfileServerPassword, "ServerPassword" ); |
|
53 _LIT( KNSmlDMProfileServerNonce, "ServerNonce" ); |
|
54 _LIT( KNSmlDMProfileClientPassword, "ClientPassword" ); |
|
55 _LIT( KNSmlDMProfileClientNonce, "ClientNonce" ); |
|
56 _LIT( KNSmlDMProfileServerURL, "ServerURL" ); |
|
57 _LIT( KNSmlDMProfileServerId, "ServerId" ); |
|
58 _LIT( KNSmlDMProfileSessionId, "DMSessionId" ); |
|
59 _LIT( KNSmlDMProfileServerAlertedAction, "ServerAlertedAction" ); |
|
60 _LIT( KNSmlDMProfileAuthenticationRequired, "AuthenticationRequired" ); |
|
61 _LIT( KNSmlDMProfileCreatorId, "CreatorId" ); |
|
62 _LIT( KNSmlDMProfileDeleteAllowed, "DeleteAllowed" ); |
|
63 _LIT( KNSmlDMProfileHidden, "HiddenProfile" ); |
|
64 _LIT( KNSmlDMProfileLog, "Log" ); |
|
65 _LIT( KNSmlDMProfileHttpAuthUsed, "HttpAuthUsed" ); |
|
66 _LIT( KNSmlDMProfileHttpAuthUsername, "HttpAuthUsername" ); |
|
67 _LIT( KNSmlDMProfileHttpAuthPassword, "HttpAuthPassword" ); |
|
68 _LIT( KNSmlDMLastSync , "LastSync"); |
|
69 _LIT( KNSmlDMProfileLock , "ProfileLock"); |
|
70 |
|
71 // Table commonsettings columns |
|
72 _LIT( KLogColumn, "DMAllowed"); |
|
73 |
|
74 // SQL clauses |
|
75 _LIT( KDMCreateDMProfilesTable, "CREATE TABLE Profiles ( Id COUNTER, DisplayName CHAR(%d), IAPId SMALLINT NOT NULL, TransportId INTEGER, ServerUsername CHAR(%d), ServerPassword CHAR(%d), ServerNonce LONG VARCHAR, ClientPassword CHAR(%d), ClientNonce LONG VARCHAR, ServerURL CHAR(%d), ServerId CHAR(%d), DMSessionId UNSIGNED SMALLINT, ServerAlertedAction SMALLINT, AuthenticationRequired UNSIGNED TINYINT, CreatorId INTEGER, DeleteAllowed BIT,HiddenProfile BIT, Log LONG VARBINARY, LastSync LONG VARBINARY, HttpAuthUsed BIT, HttpAuthUsername CHAR(%d), HttpAuthPassword CHAR(%d),ProfileLock BIT )" ); |
|
76 _LIT( KDMCreateCommSetTable, "CREATE TABLE CommonSettings ( DMAllowed BIT NOT NULL)" ); |
|
77 _LIT( KDMSQLGetProfile, "SELECT * FROM Profiles WHERE Id = %d" ); |
|
78 _LIT( KDMSQLGetAllProfiles, "SELECT * FROM Profiles ORDER BY Id" ); |
|
79 _LIT( KDMSQLDeleteProfile, "DELETE FROM Profiles WHERE Id = %d" ); |
|
80 _LIT( KDMSQLGetAllCommonSettings, "SELECT * FROM CommonSettings"); |
|
81 _LIT( KDMSQLSelectMatchingServerId, "SELECT * FROM Profiles WHERE ServerId = '%S' AND Id <> %d"); |
|
82 _LIT( KDMSQLSelectMatchingServerIdOnly, "SELECT * FROM Profiles WHERE ServerId = '%S'"); |
|
83 |
|
84 //enumerations |
|
85 |
|
86 enum TNSmlDMProfileData |
|
87 { |
|
88 EDMProfileId, |
|
89 EDMProfileDisplayName, |
|
90 EDMProfileIAPId, |
|
91 EDMProfileTransportId, |
|
92 EDMProfileServerUsername, |
|
93 EDMProfileServerPassword, |
|
94 EDMProfileServerNonce, |
|
95 EDMProfileClientPassword, |
|
96 EDMProfileClientNonce, |
|
97 EDMProfileServerURL, |
|
98 EDMProfileServerId, |
|
99 EDMProfileSessionId, |
|
100 EDMProfileServerAlertAction, |
|
101 EDMProfileAuthenticationRequired, |
|
102 EDMProfileCreatorId, |
|
103 EDMProfileDeleteAllowed, |
|
104 EDMProfileHttpAuthUsed, |
|
105 EDMProfileHttpAuthUsername, |
|
106 EDMProfileHttpAuthPassword, |
|
107 EDMProfileHidden, |
|
108 EDMProfileLock |
|
109 }; |
|
110 |
|
111 |
|
112 enum TNSmlDMTable |
|
113 { |
|
114 EDMProfiles |
|
115 }; |
|
116 |
|
117 enum TNSmlDMProfileAllowed |
|
118 { |
|
119 EDMNotAllowed, |
|
120 EDMAllowed |
|
121 }; |
|
122 |
|
123 enum TNSmlDMEnabled |
|
124 { |
|
125 EDMDisabled, |
|
126 EDMEnabled |
|
127 }; |
|
128 |
|
129 |
|
130 // FORWARD DECLARATIONS |
|
131 class CNSmlDMSettings; |
|
132 class CNSmlDMProfile; |
|
133 class CNSmlDMProfileListItem; |
|
134 class CNSmlDMCrypt; |
|
135 |
|
136 // CLASS DECLARATION |
|
137 |
|
138 /** |
|
139 * CNSmlDMProfileListItem contains profile id. It is used to list all id's of profiles. |
|
140 * |
|
141 * @lib nsmldmsettings.lib |
|
142 */ |
|
143 class CNSmlDMProfileListItem : public CBase |
|
144 { |
|
145 public: |
|
146 /** |
|
147 * two-phase constructor - Creates new CNSmlDMProfileListItem* |
|
148 * @param TInt aId - id of profile |
|
149 * @return CNSmlDMProfileListItem* - item that was created |
|
150 */ |
|
151 IMPORT_C static CNSmlDMProfileListItem* NewL( const TInt aId ); |
|
152 |
|
153 /** |
|
154 * two-phase constructor - Creates new CNSmlDMProfileListItem*, |
|
155 * which is left into cleanup stack. |
|
156 * @param TInt aId - id of profile |
|
157 * @return CNSmlDMProfileListItem* - item that was created |
|
158 */ |
|
159 IMPORT_C static CNSmlDMProfileListItem* NewLC( const TInt aId ); |
|
160 |
|
161 /** |
|
162 * Destructor |
|
163 * @param - |
|
164 * @return - |
|
165 */ |
|
166 ~CNSmlDMProfileListItem(); |
|
167 |
|
168 /** |
|
169 * Returns value of given integer field - only profile id |
|
170 * @param TNSmlDMProfileData aProfileItem - field enumeration |
|
171 * @return TInt - id of profile |
|
172 */ |
|
173 IMPORT_C TInt IntValue( TNSmlDMProfileData aProfileItem ) const; |
|
174 |
|
175 /** |
|
176 * Copies values from sourceitem |
|
177 * @param CNSmlDMProfileListItem* aSourceItem - Item form which values are copied from |
|
178 * @return - |
|
179 */ |
|
180 IMPORT_C void AssignL( const CNSmlDMProfileListItem* aSourceItem ); |
|
181 |
|
182 private: |
|
183 /** |
|
184 * two-phase construction |
|
185 * @param - |
|
186 * @return - |
|
187 */ |
|
188 void ConstructL(); |
|
189 |
|
190 private: |
|
191 TInt iId; |
|
192 |
|
193 }; |
|
194 |
|
195 typedef CArrayPtr<CNSmlDMProfileListItem> CNSmlDMProfileList; |
|
196 |
|
197 /** |
|
198 * CNSmlDMSettings provides an interface to dm settings database |
|
199 * |
|
200 * @lib nsmldmsettings.lib |
|
201 */ |
|
202 class CNSmlDMSettings : public CBase |
|
203 { |
|
204 public: |
|
205 /** |
|
206 * two-phase constructor - Creates new CNSmlDMSettings* |
|
207 * @param - |
|
208 * @return CNSmlDMSettings* - new CNSmlDMSettings |
|
209 */ |
|
210 IMPORT_C static CNSmlDMSettings* NewL(); |
|
211 |
|
212 /** |
|
213 * two-phase constructor - Creates new CNSmlDMSettings*, which |
|
214 * is left in cleanup stack |
|
215 * @param - |
|
216 * @return CNSmlDMSettings* - new CNSmlDMSettings |
|
217 */ |
|
218 IMPORT_C static CNSmlDMSettings* NewLC(); |
|
219 |
|
220 /** |
|
221 * Destrcutor |
|
222 * @param - |
|
223 * @return - |
|
224 */ |
|
225 IMPORT_C ~CNSmlDMSettings(); |
|
226 |
|
227 /** |
|
228 * Creates new profile |
|
229 * @param - |
|
230 * @return CNSmlDMProfile* - new profile |
|
231 */ |
|
232 IMPORT_C CNSmlDMProfile* CreateProfileL(); |
|
233 |
|
234 /** |
|
235 * Creates new profile with values from given profile id |
|
236 * @param TInt aId - profile that values are copied from |
|
237 * @return CNSmlDMProfile* - new profile |
|
238 */ |
|
239 IMPORT_C CNSmlDMProfile* CreateProfileL( const TInt aId ); |
|
240 |
|
241 /** |
|
242 * List all profile id's into array |
|
243 * @param CNSmlDMProfileList* aProfileList - array to fill with profile id's |
|
244 * @return - |
|
245 */ |
|
246 IMPORT_C void GetProfileListL( CNSmlDMProfileList* aProfileList ); |
|
247 |
|
248 /** |
|
249 * Gets profile with given id |
|
250 * @param TInt aId - Profile id |
|
251 * @return CNSmlDMProfile* - profile |
|
252 */ |
|
253 IMPORT_C CNSmlDMProfile* ProfileL( TInt aId ); |
|
254 |
|
255 /** |
|
256 * Deletes profile with given id |
|
257 * @param TInt aId - Profile id |
|
258 * @return TInt - KErrNone if succesfull, other system-wide errorcode otherwise |
|
259 */ |
|
260 IMPORT_C TInt DeleteProfileL( TInt aId ); |
|
261 |
|
262 /** |
|
263 * Returns ETrue if given server id exists in database |
|
264 * @param const TDesC& aServerId - Server id |
|
265 * @return TBool - ETrue if server id was found |
|
266 */ |
|
267 IMPORT_C TBool ServerIdFoundL(const TDesC& aServerId ); |
|
268 IMPORT_C TBool ServerIdFoundL(const TDesC& aServerId,TInt aProfileId); |
|
269 |
|
270 /** |
|
271 * Scan And Repair RestoredProfiles in database |
|
272 * @param - |
|
273 * @return - |
|
274 */ |
|
275 IMPORT_C void ScanAndRepairRestoredProfilesL(); |
|
276 /** |
|
277 * Returns ETrue if DMAllowed value in commonsettings table is ETrue |
|
278 * @param - |
|
279 * @return TBool - ETrue DMAllowed value is ETrue |
|
280 */ |
|
281 IMPORT_C TBool IsDMAllowedL(); |
|
282 |
|
283 /** |
|
284 * Sets value of DMAllowed in commonsettings table |
|
285 * @param TBool aAllowed - new value |
|
286 * @return - |
|
287 */ |
|
288 IMPORT_C void SetDMAllowedFlagL( TBool aAllowed ); |
|
289 |
|
290 /** |
|
291 * returns database |
|
292 * @param - |
|
293 * @return RDbNamedDatabase* - the database |
|
294 */ |
|
295 IMPORT_C RDbNamedDatabase* Database(); |
|
296 |
|
297 private: |
|
298 |
|
299 /** |
|
300 * Creates new database and tables. |
|
301 * @param const TDesC& aFullName - Name and path of database |
|
302 * @return - |
|
303 */ |
|
304 void CreateDatabaseL( const TDesC& aFullName ); |
|
305 |
|
306 /** |
|
307 * Creates tables in the dm settings database |
|
308 * @param - |
|
309 * @return - |
|
310 */ |
|
311 void CreateDMTablesL(); |
|
312 |
|
313 /** |
|
314 * Creates CNSmlDMProfile with older release database columns |
|
315 * @param - TInt aId |
|
316 * @return - CNSmlDMProfile* |
|
317 */ |
|
318 CNSmlDMProfile* OldProfileL( TInt aId); |
|
319 |
|
320 /** |
|
321 * Creates profiles from resources |
|
322 * @param - |
|
323 * @return - |
|
324 */ |
|
325 void CreateHiddenProfilesL(); |
|
326 |
|
327 /** |
|
328 * Creates profiles from XML |
|
329 * @param - |
|
330 * @return - |
|
331 */ |
|
332 void CreateDMProfilesFromXmlL(); |
|
333 |
|
334 /** |
|
335 * Prepares view for updating |
|
336 * @param - |
|
337 * @return - |
|
338 */ |
|
339 void PrepareViewL( const TDesC& aSql, RDbRowSet::TAccess aAccess ); |
|
340 |
|
341 /** |
|
342 * Commits and compacts database |
|
343 * @param - |
|
344 * @return - |
|
345 */ |
|
346 void CommitAndCompact(); |
|
347 |
|
348 /** |
|
349 * Adds item to list |
|
350 * @param CNSmlDMProfileList* aProfileList - list of profiles to add the item |
|
351 * @return - |
|
352 */ |
|
353 void AddToProfileListL( CNSmlDMProfileList* aProfileList ); |
|
354 |
|
355 /** |
|
356 * Returns data from given descriptor field |
|
357 * @param const TDesC& aFieldName - name of field |
|
358 * @return TPtrC - the descriptor |
|
359 */ |
|
360 TPtrC ViewColDes( const TDesC& aFieldName ); |
|
361 |
|
362 /** |
|
363 * Returns data from given integer field |
|
364 * @param const TDesC& aFieldName - name of field |
|
365 * @return TInt - the integer |
|
366 */ |
|
367 TInt ViewColInt( const TDesC& aFieldName ); |
|
368 |
|
369 /** |
|
370 * Returns data from given unsigned integer field |
|
371 * @param const TDesC& aFieldName - name of field |
|
372 * @return TUint- the unsigned integer |
|
373 */ |
|
374 TUint ViewColUint( const TDesC& aFieldName ); |
|
375 |
|
376 private: |
|
377 RDbNamedDatabase iDatabase; |
|
378 RFs iFsSession; |
|
379 RDbs iRdbSession; |
|
380 RDbTable iTableProfiles; |
|
381 CDbColSet* iColSet; |
|
382 RDbView iView; |
|
383 TBool iAllowed; |
|
384 RArray<TPtrC> iMissingCols; |
|
385 RPointerArray<CNSmlDMProfile> iOldProfiles; |
|
386 }; |
|
387 |
|
388 |
|
389 /** |
|
390 * CNSmlDMProfile provides methods to update and save profile data |
|
391 * |
|
392 * @lib nsmldmsettings.lib |
|
393 */ |
|
394 class CNSmlDMProfile : public CBase |
|
395 { |
|
396 public: |
|
397 /** |
|
398 * two-phase constructor - Creates new CNSmlDMProfile* |
|
399 * @param RDbNamedDatabase* aDatabase - database to be used |
|
400 * @return CNSmlDMProfile* - new profile |
|
401 */ |
|
402 static CNSmlDMProfile* NewL( RDbNamedDatabase* aDatabase ); |
|
403 |
|
404 /** |
|
405 * two-phase constructor - Creates new CNSmlDMProfile*, which |
|
406 * is left in cleanup stack |
|
407 * @param RDbNamedDatabase* aDatabase - database to be used |
|
408 * @return CNSmlDMProfile* - new profile |
|
409 */ |
|
410 static CNSmlDMProfile* NewLC( RDbNamedDatabase* aDatabase ); |
|
411 |
|
412 /** |
|
413 * Destructor |
|
414 * @param - |
|
415 * @return - |
|
416 */ |
|
417 IMPORT_C ~CNSmlDMProfile(); |
|
418 |
|
419 /** |
|
420 * Saves profile, i.e. either creates a new one in database or updates existing |
|
421 * @param - |
|
422 * @return TInt - KErrNone if succesfull, systemwide errorcode otherwise |
|
423 */ |
|
424 IMPORT_C TInt SaveL(); |
|
425 |
|
426 /** |
|
427 * Returns value of given descriptor field |
|
428 * @param TNSmlDMProfileData aProfileItem - Enumeration of the field |
|
429 * @return const TDesC& - the descriptor |
|
430 */ |
|
431 IMPORT_C const TDesC& StrValue( TNSmlDMProfileData aProfileItem ) const; |
|
432 |
|
433 /** |
|
434 * Returns value of given integer field |
|
435 * @param TNSmlDMProfileData aProfileItem - Enumeration of the field |
|
436 * @return const TInt - the integer |
|
437 */ |
|
438 IMPORT_C TInt IntValue( TNSmlDMProfileData aProfileItem ) const; |
|
439 |
|
440 /** |
|
441 * Returns value of client nonce or server nonce |
|
442 * @param TNSmlDMProfileData aProfileItem - Enumeration of the field |
|
443 * @return HBufC* - value of nonce, that is left in cleanup stack |
|
444 */ |
|
445 IMPORT_C HBufC* CNSmlDMProfile::NonceLC( TNSmlDMProfileData aProfileItem); |
|
446 |
|
447 /** |
|
448 * Sets new value for descriptor |
|
449 * @param TNSmlDMProfileData aProfileItem - Enumeration of the field that is updated |
|
450 * @param const TDesC& aNewValue - New value for field |
|
451 * @return - |
|
452 */ |
|
453 IMPORT_C void SetStrValue( TNSmlDMProfileData aProfileItem, const TDesC& aNewValue ); |
|
454 |
|
455 /** |
|
456 * Sets new value for integer |
|
457 * @param TNSmlDMProfileData aProfileItem - Enumeration of the field that is updated |
|
458 * @param const TInt aNewValue - New value for field |
|
459 * @return - |
|
460 */ |
|
461 IMPORT_C void SetIntValue( TNSmlDMProfileData aProfileItem, const TInt aNewValue ); |
|
462 |
|
463 /** |
|
464 * Sets new value for client nonce or server nonce |
|
465 * @param TNSmlDMProfileData aProfileItem - Enumeration of the field that is updated |
|
466 * @param const TInt aNewValue - New value for field |
|
467 * @return - |
|
468 */ |
|
469 IMPORT_C void SetNonceL( TNSmlDMProfileData aProfileItem, const TDesC& aNewValue ); |
|
470 |
|
471 /** |
|
472 * Returns true if profile has not been saved yet |
|
473 * @param - |
|
474 * @return TBool - ETrue if profile has not been saved yet |
|
475 */ |
|
476 IMPORT_C TBool IsNew() const; |
|
477 |
|
478 /** |
|
479 * Returns true if profile has the same data as given profile |
|
480 * @param CNSmlDMProfile* profile - profile to compare data with |
|
481 * @return TBool - ETrue if both profiles have the same data |
|
482 */ |
|
483 IMPORT_C TBool EqualData( CNSmlDMProfile* profile ) const; |
|
484 |
|
485 /** |
|
486 * Returns true if value of given field is NULL |
|
487 * @param const TDesC& aFieldName - Name of the field |
|
488 * @return TBool - ETrue if value of given field is NULL |
|
489 */ |
|
490 IMPORT_C TBool IsNullL( const TDesC& aFieldName ); |
|
491 |
|
492 /** |
|
493 * Returns true if profile has log |
|
494 * @param - |
|
495 * @return TBool - ETrue if profile has log |
|
496 */ |
|
497 IMPORT_C TBool HasLogL(); |
|
498 |
|
499 /** |
|
500 * Returns true if profile has last sync time |
|
501 * @param - |
|
502 * @return TBool - ETrue if profile has last sync time |
|
503 */ |
|
504 IMPORT_C TBool HasLastSyncL(); |
|
505 |
|
506 /** |
|
507 * Returns stream to read log data from |
|
508 * @param - |
|
509 * @return RReadStream& - stream to read profile log |
|
510 */ |
|
511 IMPORT_C RReadStream& LogReadStreamL(); |
|
512 |
|
513 /** |
|
514 * Returns stream to read log from |
|
515 * @param - |
|
516 * @return RReadStream& - stream to read profile log |
|
517 */ |
|
518 IMPORT_C RWriteStream& LogWriteStreamL(); |
|
519 |
|
520 /** |
|
521 * Commits writing to stream |
|
522 * @param - |
|
523 * @return - |
|
524 */ |
|
525 IMPORT_C void WriteStreamCommitL(); |
|
526 |
|
527 /** |
|
528 * Returns stream to write Last Success Sync log from |
|
529 * @param - |
|
530 * @return RWriteStream& - stream to write Last Success Sync of profile |
|
531 */ |
|
532 IMPORT_C RWriteStream& LastSyncWriteStreamL(); |
|
533 |
|
534 /** |
|
535 * Returns stream to read Last Success Sync log from |
|
536 * @param - |
|
537 * @return RReadStream& - stream to read Last Success Sync of profile |
|
538 */ |
|
539 IMPORT_C RReadStream& LastSyncReadStreamL(); |
|
540 |
|
541 /** |
|
542 * Commits Last sync time writing to stream |
|
543 * @param - |
|
544 * @return - |
|
545 */ |
|
546 IMPORT_C void LastSyncStreamCommitL(); |
|
547 |
|
548 /** |
|
549 * Resets the database reference |
|
550 * @param - RDbNamedDatabase* aDatabase |
|
551 * @return - |
|
552 */ |
|
553 void ResetDatabaseL( RDbNamedDatabase* aDatabase ); |
|
554 |
|
555 /** |
|
556 * Resets the profile ID to create new profile |
|
557 * @param - |
|
558 * @return - |
|
559 */ |
|
560 void ResetID(); |
|
561 |
|
562 /** |
|
563 * Resets table references |
|
564 * @param - |
|
565 * @return - |
|
566 */ |
|
567 void CloseDbHandles(); |
|
568 |
|
569 private: |
|
570 /** |
|
571 * two-phase construction |
|
572 * @param - |
|
573 * @return - |
|
574 */ |
|
575 void ConstructL(); |
|
576 |
|
577 /** |
|
578 * two-phase construction |
|
579 * @param RDbNamedDatabase* aDatabase - the database |
|
580 * @return - |
|
581 */ |
|
582 void ConstructL( RDbNamedDatabase* aDatabase ); |
|
583 |
|
584 /** |
|
585 * Prepares view for updating |
|
586 * @param const TDesC& aSql - SQL clause to use |
|
587 * @param RDbRowSet::TAccess aAccess - access level that is needed |
|
588 * @return - |
|
589 */ |
|
590 void PrepareViewL( const TDesC& aSql, RDbRowSet::TAccess aAccess ); |
|
591 |
|
592 /** |
|
593 * Commits changes and compacts database |
|
594 * @param - |
|
595 * @return - |
|
596 */ |
|
597 void CommitAndCompact(); |
|
598 |
|
599 /** |
|
600 * Sets new integer value |
|
601 * @param const TDesC& aFieldName - name of the field |
|
602 * @param TInt aValue - Value of field |
|
603 * @return - |
|
604 */ |
|
605 void TableProfilesSetColIntL( const TDesC& aFieldName, TInt aValue ); |
|
606 |
|
607 /** |
|
608 * Sets new descriptor value |
|
609 * @param const TDesC& aFieldName - name of the field |
|
610 * @param TDesC& aValue - Value of field |
|
611 * @return - |
|
612 */ |
|
613 void TableProfilesSetColDesL( const TDesC& aFieldName, TDesC& aValue ); |
|
614 |
|
615 /** |
|
616 * Updates integer value |
|
617 * @param const TDesC& aFieldName - name of the field |
|
618 * @param TInt aValue - Value of field |
|
619 * @return - |
|
620 */ |
|
621 void ViewSetColIntL( const TDesC& aFieldName, TInt aValue ); |
|
622 |
|
623 /** |
|
624 * Updates descriptor value |
|
625 * @param const TDesC& aFieldName - name of the field |
|
626 * @param TDesC& aValue - Value of field |
|
627 * @return - |
|
628 */ |
|
629 void ViewSetColDesL( const TDesC& aFieldName, TDesC& aValue ); |
|
630 |
|
631 private: |
|
632 TUint iId; |
|
633 HBufC* iDisplayName; |
|
634 |
|
635 TInt iTransportId; |
|
636 TInt iIAPId; |
|
637 |
|
638 HBufC* iDMServerUsername; |
|
639 HBufC* iDMServerPassword; |
|
640 HBufC* iClientPassword; |
|
641 |
|
642 TBool iHttpAuthUsed; |
|
643 HBufC* iHttpAuthUsername; |
|
644 HBufC* iHttpAuthPassword; |
|
645 |
|
646 HBufC* iServerURL; |
|
647 HBufC* iServerId; |
|
648 |
|
649 TInt iDMSessionId; |
|
650 TInt iServerAlertAction; |
|
651 TInt iAuthenticationRequired; |
|
652 TInt iCreatorId; |
|
653 TBool iDeleteAllowed; |
|
654 TBool iProfileHidden; |
|
655 TBool iProfileLock; |
|
656 RDbNamedDatabase* iDatabase; |
|
657 |
|
658 RDbTable iTableProfiles; |
|
659 |
|
660 TBool iWriteStreamOpen; |
|
661 TBool iReaDMtreamOpen; |
|
662 |
|
663 RDbColWriteStream iWs; |
|
664 RDbColReadStream iRs; |
|
665 |
|
666 RDbView iRSView; |
|
667 RDbView iWSView; |
|
668 |
|
669 CDbColSet* iColSetProfiles; |
|
670 |
|
671 RDbView iView; |
|
672 }; |
|
673 |
|
674 /** |
|
675 * CNSmlDMCrypt handles encryption / decryption of data |
|
676 * |
|
677 * @lib nsmldmsettings.lib |
|
678 */ |
|
679 class CNSmlDMCrypt : public CBase |
|
680 { |
|
681 public: |
|
682 /** |
|
683 * Constructor |
|
684 * @param - |
|
685 * @return - |
|
686 */ |
|
687 IMPORT_C CNSmlDMCrypt(); |
|
688 |
|
689 /** |
|
690 * Destructor |
|
691 * @param - |
|
692 * @return - |
|
693 */ |
|
694 IMPORT_C ~CNSmlDMCrypt(); |
|
695 |
|
696 /** |
|
697 * Encrypts data |
|
698 * @param const TDesC& aInput - data to be encrypted |
|
699 * @return TDesC& - Encrypted data |
|
700 */ |
|
701 IMPORT_C TDesC& EncryptedL( const TDesC& aInput ); |
|
702 |
|
703 /** |
|
704 * Decrypts data |
|
705 * @param const TDesC& aInput - data to be decrypted |
|
706 * @return TDesC& - Decrypted data |
|
707 */ |
|
708 IMPORT_C TDesC& DecryptedL( const TDesC& aInput ); |
|
709 |
|
710 private: |
|
711 HBufC* iOutput; |
|
712 }; |
|
713 |
|
714 #endif //__NSMLDMSETTINGS_H |