|
1 /* |
|
2 * Copyright (c) 2005 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: Profile structure mapped to server side data sync profile |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef ASPPROFILE_H |
|
20 #define ASPPROFILE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <ecom.h> |
|
25 |
|
26 #include <SyncMLClient.h> // for RSyncMLSession |
|
27 #include <SyncMLClientDS.h> // for RSyncMLDataSyncProfile |
|
28 |
|
29 #include "AspDefines.h" |
|
30 #include "AspUtil.h" |
|
31 |
|
32 //For Error EAZG-7KGAK8. Language definiton not found in elang.h |
|
33 const TInt ELangIndon_Apac=327; |
|
34 const TUid KCRUidDSDefaultProfileInternalKeys = { 0x20021338 }; |
|
35 const TInt KNsmlDsDefaultProfile = 0x0; |
|
36 |
|
37 // CONSTANTS |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 class CAspProfile; |
|
41 |
|
42 |
|
43 // CLASS DECLARATION |
|
44 |
|
45 |
|
46 |
|
47 /** |
|
48 * TAspProfileItem |
|
49 * |
|
50 * TAspProfileItem contains sync profile data. |
|
51 */ |
|
52 NONSHARABLE_CLASS (TAspProfileItem) |
|
53 { |
|
54 public: |
|
55 /** |
|
56 * Get profile name. |
|
57 * @param None. |
|
58 * @return Profile name. |
|
59 */ |
|
60 const TDesC& Name(); |
|
61 |
|
62 /** |
|
63 * Get profile name. |
|
64 * @param None. |
|
65 * @return Profile name. |
|
66 */ |
|
67 HBufC* NameLC(); |
|
68 |
|
69 /** |
|
70 * Set profile name. |
|
71 * @param aName. |
|
72 * @return None. |
|
73 */ |
|
74 void SetName(const TDesC& aName); |
|
75 |
|
76 /** |
|
77 * Initalize object data. |
|
78 * @param None. |
|
79 * @return None. |
|
80 */ |
|
81 void Init(); |
|
82 |
|
83 public: |
|
84 /** |
|
85 * Compare two profile items. |
|
86 * @param aFirst. |
|
87 * @param aSecond. |
|
88 * @return Compare result. |
|
89 */ |
|
90 static TInt CompareItems(const TAspProfileItem& aFirst, const TAspProfileItem& aSecond); |
|
91 |
|
92 public: |
|
93 // profile name |
|
94 TBuf<KBufSize> iProfileName; |
|
95 |
|
96 // profile id |
|
97 TInt iProfileId; |
|
98 |
|
99 // is profile synced |
|
100 TInt iSynced; |
|
101 |
|
102 // last sync time |
|
103 TTime iLastSync; |
|
104 |
|
105 // bearer type |
|
106 TInt iBearer; |
|
107 |
|
108 // is server alert sync activated |
|
109 TInt iActive; |
|
110 |
|
111 // can profile be deleted |
|
112 TBool iDeleteAllowed; |
|
113 |
|
114 // application id |
|
115 TInt iApplicationId; |
|
116 |
|
117 // is all mandatory data found |
|
118 TInt iMandatoryCheck; |
|
119 |
|
120 // number of sync tasks |
|
121 TInt iTaskCount; |
|
122 |
|
123 // application specific sync task id |
|
124 TInt iTaskId; |
|
125 |
|
126 // server id check sum |
|
127 TUint16 iServerIdCheckSum; |
|
128 |
|
129 }; |
|
130 |
|
131 |
|
132 |
|
133 /** |
|
134 * TAspTaskItem |
|
135 * |
|
136 * TAspTaskItem contains sync task data. |
|
137 */ |
|
138 NONSHARABLE_CLASS (TAspTaskItem) |
|
139 { |
|
140 public: |
|
141 // task id |
|
142 TInt iTaskId; |
|
143 |
|
144 // sync direction |
|
145 TInt iSyncDirection; |
|
146 |
|
147 // is remote database defined |
|
148 TBool iRemoteDatabaseDefined; |
|
149 |
|
150 // is local database defined |
|
151 TBool iLocalDatabaseDefined; |
|
152 |
|
153 // is task included in sync |
|
154 TBool iEnabled; |
|
155 |
|
156 // id of data provider that this task uses |
|
157 TInt iDataProviderId; |
|
158 |
|
159 // last sync time |
|
160 TTime iLastSync; |
|
161 |
|
162 // task display name |
|
163 TBuf<KBufSize> iDisplayName; |
|
164 TBuf<KBufSize> iClientDataSource; |
|
165 }; |
|
166 |
|
167 |
|
168 /** |
|
169 * TAspDataProviderItem |
|
170 * |
|
171 * TAspDataProviderItem contains data provider data. |
|
172 */ |
|
173 NONSHARABLE_CLASS (TAspProviderItem) |
|
174 { |
|
175 enum TProviderListSortOrder |
|
176 { |
|
177 EOrderContact = 4, |
|
178 EOrderCalendar = 3, |
|
179 EOrderNotes = 2, |
|
180 EOrderEmail = 1, |
|
181 EOrderOther = 0 |
|
182 }; |
|
183 |
|
184 public: |
|
185 /** |
|
186 * Compare two profile items. |
|
187 * @param aFirst. |
|
188 * @param aSecond. |
|
189 * @return Compare result. |
|
190 */ |
|
191 static TInt CompareItems(const TAspProviderItem& aFirst, const TAspProviderItem& aSecond); |
|
192 static TInt SortOrder(TInt aDataProviderId); |
|
193 |
|
194 public: |
|
195 // data provider id |
|
196 TInt iDataProviderId; |
|
197 |
|
198 // can more than one database be synced |
|
199 TBool iAllowMultipleDataStores; |
|
200 |
|
201 // is default data store defined |
|
202 TBool iHasDefaultDataStore; |
|
203 |
|
204 // sync protocol |
|
205 TInt iSyncProtocol; |
|
206 |
|
207 // id of sync task that is using this data provider |
|
208 TBool iTaskId; |
|
209 |
|
210 // display name |
|
211 TBuf<KBufSize> iDisplayName; |
|
212 |
|
213 // default data store name |
|
214 TBuf<KBufSize> iDefaultDataStore; |
|
215 |
|
216 // is this provider included in sync (profile specific) |
|
217 TBool iIsIncludedInSync; |
|
218 }; |
|
219 |
|
220 |
|
221 /** |
|
222 * TAspFilterInfo |
|
223 * |
|
224 * TAspFilterInfo contains profile list filtering data. |
|
225 */ |
|
226 NONSHARABLE_CLASS (TAspFilterInfo) |
|
227 { |
|
228 public: |
|
229 enum TFilterType |
|
230 { |
|
231 EIncludeDeletableProfile, |
|
232 EIncludeRemoteProfile |
|
233 }; |
|
234 |
|
235 public: |
|
236 // filter type |
|
237 TInt iFilterType; |
|
238 |
|
239 // filter id (eg. application id |
|
240 TBool iFilterId; |
|
241 |
|
242 // filter text |
|
243 TBuf<KBufSize> iFilterText; |
|
244 }; |
|
245 |
|
246 |
|
247 /** |
|
248 * CAspContentList |
|
249 * |
|
250 * CAspContentList contains sync task list and data provider list. |
|
251 */ |
|
252 NONSHARABLE_CLASS (CAspContentList): public CBase |
|
253 { |
|
254 public: |
|
255 |
|
256 enum TListMode |
|
257 { |
|
258 EInitDataProviders, |
|
259 EInitTasks, |
|
260 EInitAll |
|
261 }; |
|
262 |
|
263 public: |
|
264 /** |
|
265 * Two-phased constructor. |
|
266 */ |
|
267 static CAspContentList* NewLC(const TAspParam& aParam); |
|
268 |
|
269 /** |
|
270 * Two-phased constructor. |
|
271 */ |
|
272 static CAspContentList* NewL(const TAspParam& aParam); |
|
273 |
|
274 /** |
|
275 * Destructor. |
|
276 */ |
|
277 virtual ~CAspContentList(); |
|
278 |
|
279 private: |
|
280 /** |
|
281 * C++ default constructor. |
|
282 */ |
|
283 CAspContentList(const TAspParam& aParam); |
|
284 |
|
285 /** |
|
286 * By default Symbian 2nd phase constructor is private. |
|
287 */ |
|
288 void ConstructL(); |
|
289 |
|
290 public: |
|
291 /** |
|
292 * Sets sync profile. |
|
293 * @param aProfile. |
|
294 * @return None. |
|
295 */ |
|
296 void SetProfile(CAspProfile* aProfile); |
|
297 |
|
298 /** |
|
299 * Find out whether iProfile has been set. |
|
300 * @param None. |
|
301 * @return TBool. |
|
302 */ |
|
303 TBool IsLocked(); |
|
304 |
|
305 /** |
|
306 * Returns data provider count. |
|
307 * @param None. |
|
308 * @return Data provider count. |
|
309 */ |
|
310 TInt ProviderCount(); |
|
311 |
|
312 /** |
|
313 * Returns Data provider. |
|
314 * @param aIndex List index. |
|
315 * @return Data provider. |
|
316 */ |
|
317 TAspProviderItem& ProviderItem(TInt aIndex); |
|
318 |
|
319 /** |
|
320 * Returns list index. |
|
321 * @param aId. |
|
322 * @return List index. |
|
323 */ |
|
324 TInt FindProviderIndex(TInt aId); |
|
325 |
|
326 /** |
|
327 * Returns list index. |
|
328 * @param aId. |
|
329 * @return List index. |
|
330 */ |
|
331 TInt FindProviderIndexForTask(TInt aId); |
|
332 |
|
333 /** |
|
334 * Returns task count. |
|
335 * @return Task count. |
|
336 */ |
|
337 TInt TaskCount(); |
|
338 |
|
339 /** |
|
340 * Returns task item. |
|
341 * @param aIndex. |
|
342 * @return Task item. |
|
343 */ |
|
344 TAspTaskItem& TaskItem(TInt aIndex); |
|
345 |
|
346 /** |
|
347 * Returns list index. |
|
348 * @param aId. |
|
349 * @return List index. |
|
350 */ |
|
351 TInt FindTaskIndex(TInt aId); |
|
352 |
|
353 /** |
|
354 * Returns list index. |
|
355 * @param aId. |
|
356 * @return List index. |
|
357 */ |
|
358 TInt FindTaskIndexForProvider(TInt aId); |
|
359 |
|
360 /** |
|
361 * Returns task id. |
|
362 * @param aId. |
|
363 * @return Task id. |
|
364 */ |
|
365 TInt FindTaskIdForProvider(TInt aId); |
|
366 |
|
367 /** |
|
368 * Checks that data provider has default local database. |
|
369 * @param aDataProviderId. |
|
370 * @return ETrue if database exists, EFalse otherwise. |
|
371 */ |
|
372 //TBool DefaultLocalDatabaseExist(TInt aDataProviderId); |
|
373 |
|
374 /** |
|
375 * Checks that all content items are valid. |
|
376 * @param aContentCount. |
|
377 * @return Return code. |
|
378 */ |
|
379 TInt CheckMandatoryDataL(TInt& aContentCount); |
|
380 |
|
381 public: |
|
382 |
|
383 /** |
|
384 * Read sync data providers from RSyncMLSession. |
|
385 * @return None. |
|
386 */ |
|
387 void InitDataProvidersL(); |
|
388 |
|
389 /** |
|
390 * Read sync data providers from RSyncMLSession. |
|
391 * @return None. |
|
392 */ |
|
393 void DoInitDataProvidersL(); |
|
394 |
|
395 /** |
|
396 * Read all tasks from profile into task list. |
|
397 * @return None. |
|
398 */ |
|
399 void InitAllTasksL(); |
|
400 |
|
401 /** |
|
402 * Read one task from profile into task list. |
|
403 * @return None. |
|
404 */ |
|
405 void InitTaskL(TInt aTaskId); |
|
406 |
|
407 /** |
|
408 * Remove task that uses dataprovider aDataProviderId. |
|
409 * @param aDataProviderId. |
|
410 * @return None. |
|
411 */ |
|
412 void RemoveTask(TInt aDataProviderId); |
|
413 |
|
414 /** |
|
415 * Remove all tasks from task list. |
|
416 * @param None. |
|
417 * @return None. |
|
418 */ |
|
419 void RemoveAllTasks(); |
|
420 |
|
421 /** |
|
422 * Remove data provider with id aDataProviderId. |
|
423 * @param aDataProviderId. |
|
424 * @return None. |
|
425 */ |
|
426 void RemoveDataProvider(TInt aDataProviderId); |
|
427 |
|
428 /** |
|
429 * Read one task item from profile. |
|
430 * @param aProfile. |
|
431 * @param aTaskId. |
|
432 * @return Task item. |
|
433 */ |
|
434 static TAspTaskItem ReadTaskItemL(RSyncMLDataSyncProfile& aProfile, TInt aTaskId); |
|
435 |
|
436 |
|
437 TInt CreateTaskL(TAspProviderItem& aDataProvider); |
|
438 void CreateTaskL(TInt aDataProviderId, const TDesC& aLocalDatabase, |
|
439 const TDesC& aRemoteDatabase, TBool aEnabled, TInt aSyncDirection); |
|
440 void CreateTask(TInt aDataProviderId, const TDesC& aLocalDatabase, |
|
441 const TDesC& aRemoteDatabase, TBool aEnabled, TInt aSyncDirection); |
|
442 |
|
443 |
|
444 void ReadTaskL(TInt aDataProviderId, TDes& aLocalDatabase, TDes& aRemoteDatabase, TBool& aEnable, TInt& aSyncDirection); |
|
445 |
|
446 |
|
447 void IncludeTaskL(TAspProviderItem& aDataProvider); |
|
448 void IncludeTasks(const CArrayFix<TInt>* aIncludedProviderList); |
|
449 |
|
450 void ModifyTaskIncludedL(TInt aDataProviderId, TBool aIsIncluded, const TDesC& aLocalDatabase); |
|
451 void ModifyTaskIncludedL(TAspProviderItem& aProvider, TBool aIsIncluded, const TDesC& aLocalDatabase); |
|
452 void ModifyTaskDirectionL(TAspProviderItem& aProvider, TInt aDirection); |
|
453 void ModifyTaskDirectionsL(TInt aSyncDirection); |
|
454 TBool CheckTaskDirectionsL(); |
|
455 |
|
456 void SetIncludedProviders(const CArrayFix<TInt>* aIncludedProviderList); |
|
457 void GetIncludedProviders(CArrayFix<TInt>* aIncludedProviderList); |
|
458 |
|
459 |
|
460 |
|
461 void GetLocalDatabaseList(TInt aDataProviderId, CDesCArray* aList); |
|
462 void GetLocalDatabaseListL(TInt aDataProviderId, CDesCArray* aList); |
|
463 void UpdateLocalDatabaseL(); |
|
464 TInt SyncDirection(); |
|
465 TSmlSyncType SmlSyncDirection(); |
|
466 TBool TaskEnabled(TInt aDataProviderId); |
|
467 void Sort(); |
|
468 void UpdateDataProviderL(TInt aDataProviderId); |
|
469 void ReadDataProviderItemL(RSyncMLDataProvider& aProvider, TAspProviderItem& aItem); |
|
470 |
|
471 |
|
472 |
|
473 |
|
474 private: |
|
475 |
|
476 /** |
|
477 * Utility function. |
|
478 * @return Sync session. |
|
479 */ |
|
480 RSyncMLSession& Session(); |
|
481 |
|
482 /** |
|
483 * Returns sync profile. |
|
484 * @param None. |
|
485 * @return Sync profile. |
|
486 */ |
|
487 RSyncMLDataSyncProfile* Profile(); |
|
488 |
|
489 |
|
490 #ifdef _DEBUG |
|
491 public: |
|
492 void LogL(const TDesC& aText); |
|
493 private: |
|
494 |
|
495 void LogTasksL(); |
|
496 void LogDataProvidersL(); |
|
497 void GetTaskLogText(TDes& aText, TAspTaskItem& aTask); |
|
498 void GetDataProviderIdText(TDes& aText, TInt aId); |
|
499 #endif |
|
500 |
|
501 |
|
502 |
|
503 private: |
|
504 // id of the calling application |
|
505 TInt iApplicationId; |
|
506 |
|
507 // sync session |
|
508 RSyncMLSession* iSyncSession; |
|
509 |
|
510 // sync profile |
|
511 CAspProfile* iProfile; |
|
512 |
|
513 // sync list type |
|
514 TInt iListMode; |
|
515 |
|
516 // data provider list |
|
517 RArray<TAspTaskItem> iTaskList; |
|
518 |
|
519 // data provider id list |
|
520 RArray<TAspProviderItem> iProviderList; |
|
521 }; |
|
522 |
|
523 |
|
524 |
|
525 /** |
|
526 * CAspProfileList |
|
527 * |
|
528 * CAspProfileList is a list of sync profiles, |
|
529 */ |
|
530 NONSHARABLE_CLASS (CAspProfileList) : public CBase |
|
531 { |
|
532 public: |
|
533 |
|
534 enum TListMode |
|
535 { |
|
536 EBasePropertiesOnly, |
|
537 ENoMandatoryCheck, |
|
538 EMandatoryCheck, |
|
539 EMandatoryCheckEx, |
|
540 EEMailRetrieve, |
|
541 EEMailSync, |
|
542 }; |
|
543 |
|
544 public: |
|
545 /** |
|
546 * Two-phased constructor. |
|
547 */ |
|
548 static CAspProfileList* NewLC(const TAspParam& aParam); |
|
549 |
|
550 /** |
|
551 * Two-phased constructor. |
|
552 */ |
|
553 static CAspProfileList* NewL(const TAspParam& aParam); |
|
554 |
|
555 /** |
|
556 * Destructor. |
|
557 */ |
|
558 virtual ~CAspProfileList(); |
|
559 |
|
560 private: |
|
561 /** |
|
562 * C++ default constructor. |
|
563 */ |
|
564 CAspProfileList(const TAspParam& aParam); |
|
565 |
|
566 /** |
|
567 * By default Symbian 2nd phase constructor is private. |
|
568 */ |
|
569 void ConstructL(); |
|
570 |
|
571 public: |
|
572 /** |
|
573 * Returns profile count. |
|
574 * @param None. |
|
575 * @return Profile count. |
|
576 */ |
|
577 TInt Count(); |
|
578 |
|
579 /** |
|
580 * Returns profile count. |
|
581 * @param aApplicationId. |
|
582 * @return Profile count. |
|
583 */ |
|
584 TInt Count(TInt aApplicationId); |
|
585 |
|
586 /** |
|
587 * Returns profile from list. |
|
588 * @param aIndex List index. |
|
589 * @return Profile. |
|
590 */ |
|
591 TAspProfileItem& Item(TInt aIndex); |
|
592 |
|
593 /** |
|
594 * Finds profile with name aProfileName. |
|
595 * @param aProfileName Profile name. |
|
596 * @return Profile index or KErrNotFound. |
|
597 */ |
|
598 TInt FindProfileIndex(const TDesC& aProfileName); |
|
599 |
|
600 /** |
|
601 * Gets the Default Profile ID from the Cenrep |
|
602 * @param aValue ProfileID read from the Cenrep |
|
603 */ |
|
604 void GetDefaultProfileIdL(TInt& aValue); |
|
605 |
|
606 /** |
|
607 * Finds last synced profile index. |
|
608 * @param aProfileName Profile name. |
|
609 * @return Profile index or KErrNotFound. |
|
610 */ |
|
611 TInt FindLastSyncedProfileIndexL(); |
|
612 |
|
613 /** |
|
614 * Read one profile from database. |
|
615 * @param aProfile. |
|
616 * @param aItem. |
|
617 * @return None. |
|
618 */ |
|
619 void ReadProfileItemL(CAspProfile* aProfile, TAspProfileItem& aItem); |
|
620 |
|
621 /** |
|
622 * Reads all profiles from database. |
|
623 * @param aListMode. |
|
624 * @return None. |
|
625 */ |
|
626 void ReadAllProfilesL(TInt aListMode); |
|
627 |
|
628 /** |
|
629 * Reads all profiles that contain EMail task that uses aLocalDatabase. |
|
630 * @param aLocalDatabase. |
|
631 * @param aListMode. |
|
632 * @return None. |
|
633 */ |
|
634 void ReadEMailProfilesL(const TDesC& aLocalDatabase, TInt aListMode); |
|
635 |
|
636 /** |
|
637 * Reads one profile from database. |
|
638 * @param aProfileId. |
|
639 * @return None. |
|
640 */ |
|
641 void ReadProfileL(TInt aProfileId); |
|
642 |
|
643 /** |
|
644 * Sorts profile list. |
|
645 * @param None. |
|
646 * @return None. |
|
647 */ |
|
648 void Sort(); |
|
649 |
|
650 /** |
|
651 * Removes profile from profile list. |
|
652 * @param aProfileId. |
|
653 * @return None. |
|
654 */ |
|
655 void Remove(TInt aProfileId); |
|
656 |
|
657 /** |
|
658 * Adds profile into profile list. |
|
659 * @param aProfileItem. |
|
660 * @return None. |
|
661 */ |
|
662 void AddL(TAspProfileItem& aProfileItem); |
|
663 |
|
664 /** |
|
665 * Constructs filtered profile list. |
|
666 * @param aFilterInfo. |
|
667 * @return Profile list. |
|
668 */ |
|
669 CAspProfileList* FilteredListL(TAspFilterInfo& aFilterInfo); |
|
670 |
|
671 /** |
|
672 * Replaces profile item. |
|
673 * @param aProfileItem. |
|
674 * @return None. |
|
675 */ |
|
676 void ReplaceProfileItemL(TAspProfileItem& aProfileItem); |
|
677 |
|
678 /** |
|
679 * Returns profile's list position. |
|
680 * @param aProfileId. |
|
681 * @return List index. |
|
682 */ |
|
683 TInt ListIndex(TInt aProfileId); |
|
684 |
|
685 /** |
|
686 * Returns sync session. |
|
687 * @param None. |
|
688 * @return Sync session. |
|
689 */ |
|
690 RSyncMLSession& Session(); |
|
691 |
|
692 /** |
|
693 * Returns number of profiles that can be deleted. |
|
694 * @param None. |
|
695 * @return Profile count. |
|
696 */ |
|
697 TInt DeletableProfileCount(); |
|
698 |
|
699 TBool IsAutoSyncProfile(CAspProfile* aProfile); |
|
700 |
|
701 public: |
|
702 |
|
703 /** |
|
704 * Checks if aServerId is unique in setting databse. |
|
705 * @param aServerId. |
|
706 * @param aProfileId. |
|
707 * @return Return code. |
|
708 */ |
|
709 TBool IsUniqueServerId(const TDesC& aServerId, TInt aProfileId); |
|
710 |
|
711 |
|
712 |
|
713 private: |
|
714 // sync session |
|
715 RSyncMLSession* iSyncSession; |
|
716 |
|
717 // list of profiles |
|
718 RArray<TAspProfileItem> iList; |
|
719 |
|
720 // needed for filtering unwanted profiles |
|
721 TInt iApplicationId; |
|
722 |
|
723 // long buffer for string handling |
|
724 TBuf<KBufSize255> iBuf; |
|
725 }; |
|
726 |
|
727 |
|
728 |
|
729 /** |
|
730 * CAspProfile |
|
731 * |
|
732 * CAspProfile is used for getting/setting sync profile settings. |
|
733 */ |
|
734 NONSHARABLE_CLASS (CAspProfile) : public CBase |
|
735 { |
|
736 |
|
737 public: |
|
738 enum TOpenMode |
|
739 { |
|
740 EOpenReadWrite, |
|
741 EOpenRead, |
|
742 EBaseProperties, |
|
743 EAllProperties |
|
744 }; |
|
745 |
|
746 public: |
|
747 /** |
|
748 * Two-phased constructor. |
|
749 */ |
|
750 static CAspProfile* NewLC(const TAspParam& aParam); |
|
751 |
|
752 /** |
|
753 * Two-phased constructor. |
|
754 */ |
|
755 static CAspProfile* NewL(const TAspParam& aParam); |
|
756 |
|
757 /** |
|
758 * Destructor. |
|
759 */ |
|
760 virtual ~CAspProfile(); |
|
761 |
|
762 private: |
|
763 /** |
|
764 * C++ default constructor. |
|
765 */ |
|
766 CAspProfile(const TAspParam& aParam); |
|
767 |
|
768 /** |
|
769 * By default Symbian 2nd phase constructor is private. |
|
770 */ |
|
771 void ConstructL(); |
|
772 |
|
773 public: |
|
774 /** |
|
775 * Open profile. |
|
776 * @param aProfileId. |
|
777 * @param aReadWrite. |
|
778 * @param aOpenMode. |
|
779 * @return None. |
|
780 */ |
|
781 void OpenL(TInt aProfileId, TInt aReadWrite, TInt aOpenMode); |
|
782 |
|
783 /** |
|
784 * Create profile. |
|
785 * @param aOpenMode. |
|
786 * @return None. |
|
787 */ |
|
788 void CreateL(TInt aOpenMode); |
|
789 |
|
790 /** |
|
791 * Create copy profile. |
|
792 * @param aProfileId. |
|
793 * @return None. |
|
794 */ |
|
795 void CreateCopyL(TInt aProfileId); |
|
796 |
|
797 /** |
|
798 * Save profile. |
|
799 * @param None. |
|
800 * @return None. |
|
801 */ |
|
802 void SaveL(); |
|
803 |
|
804 /** |
|
805 * Save profile. |
|
806 * @param None. |
|
807 * @return None. |
|
808 */ |
|
809 void Save(); |
|
810 |
|
811 public: |
|
812 /** |
|
813 * Set profile name. |
|
814 * @param aText. |
|
815 * @return None. |
|
816 */ |
|
817 void SetNameL(const TDesC& aText); |
|
818 |
|
819 /** |
|
820 * Get profile name. |
|
821 * @param aText. |
|
822 * @return None. |
|
823 */ |
|
824 void GetName(TDes& aText); |
|
825 |
|
826 /** |
|
827 * Get profile name. |
|
828 * @param None. |
|
829 * @return Profile name. |
|
830 */ |
|
831 HBufC* NameL(); |
|
832 |
|
833 /** |
|
834 * Set creator id. |
|
835 * @param aCreatorId. |
|
836 * @return None. |
|
837 */ |
|
838 void SetCreatorId(TInt aCreatorId); |
|
839 |
|
840 /** |
|
841 * Get creator id. |
|
842 * @param None. |
|
843 * @return Creator id. |
|
844 */ |
|
845 TInt CreatorId(); |
|
846 |
|
847 /** |
|
848 * Get profile id. |
|
849 * @param None. |
|
850 * @return Profile id. |
|
851 */ |
|
852 TInt ProfileId(); |
|
853 |
|
854 /** |
|
855 * Can profile be deleted. |
|
856 * @param None. |
|
857 * @return Boolean. |
|
858 */ |
|
859 TBool DeleteAllowed(); |
|
860 |
|
861 /** |
|
862 * Has profile been synced. |
|
863 * @param None. |
|
864 * @return Boolean. |
|
865 */ |
|
866 TBool IsSynced(); |
|
867 |
|
868 /** |
|
869 * Last sync time. |
|
870 * @param None. |
|
871 * @return Sync time. |
|
872 */ |
|
873 TTime LastSync(); |
|
874 |
|
875 /** |
|
876 * Last sync time. |
|
877 * @param aTaskId. |
|
878 * @return Sync time. |
|
879 */ |
|
880 TTime LastSync(TInt aTaskId); |
|
881 |
|
882 |
|
883 // settings that connection dialog displays |
|
884 public: |
|
885 /** |
|
886 * Set server id. |
|
887 * @param aText. |
|
888 * @return None. |
|
889 */ |
|
890 void SetServerIdL(const TDesC& aText); |
|
891 |
|
892 /** |
|
893 * Get server id. |
|
894 * @param aText. |
|
895 * @return None. |
|
896 */ |
|
897 void GetServerId(TDes& aText); |
|
898 |
|
899 /** |
|
900 * Get protocol version. |
|
901 * @param None. |
|
902 * @return aProtocolVersion. |
|
903 */ |
|
904 TInt ProtocolVersion(); |
|
905 |
|
906 /** |
|
907 * Set protocol version. |
|
908 * @param aProtocolVersion. |
|
909 * @return None. |
|
910 */ |
|
911 void SetProtocolVersionL(TInt aProtocolVersion); |
|
912 |
|
913 /** |
|
914 * Get bearer type. |
|
915 * @param None. |
|
916 * @return Bearer type. |
|
917 */ |
|
918 TInt BearerType(); |
|
919 |
|
920 /** |
|
921 * Set bearer type. |
|
922 * @param aId. |
|
923 * @return None. |
|
924 */ |
|
925 void SetBearerTypeL(TInt aId); |
|
926 |
|
927 /** |
|
928 * Get access point. |
|
929 * @param None. |
|
930 * @return Access point. |
|
931 */ |
|
932 TInt AccessPointL(); |
|
933 |
|
934 /** |
|
935 * Set access point. |
|
936 * @param aId. |
|
937 * @return None. |
|
938 */ |
|
939 void SetAccessPointL(const TInt aId); |
|
940 |
|
941 /** |
|
942 * Get host address. |
|
943 * @param aText. |
|
944 * @param aPort. |
|
945 * @return None. |
|
946 */ |
|
947 void GetHostAddress(TDes& aText, TInt& aPort); |
|
948 |
|
949 /** |
|
950 * Set host address. |
|
951 * @param aText. |
|
952 * @param aPort. |
|
953 * @return None. |
|
954 */ |
|
955 void SetHostAddressL(const TDesC& aText, const TInt aPort); |
|
956 |
|
957 /** |
|
958 * Get user name. |
|
959 * @param aText. |
|
960 * @return None. |
|
961 */ |
|
962 void GetUserName(TDes& aText); |
|
963 |
|
964 /** |
|
965 * Set user name. |
|
966 * @param aText. |
|
967 * @return None. |
|
968 */ |
|
969 void SetUserNameL(const TDesC& aText); |
|
970 |
|
971 /** |
|
972 * Get password. |
|
973 * @param aText. |
|
974 * @return None. |
|
975 */ |
|
976 void GetPassword(TDes& aText); |
|
977 |
|
978 /** |
|
979 * Set password. |
|
980 * @param aText. |
|
981 * @return None. |
|
982 */ |
|
983 void SetPasswordL(const TDesC& aText); |
|
984 |
|
985 /** |
|
986 * Set server alert sync state. |
|
987 * @param aState. |
|
988 * @return None. |
|
989 */ |
|
990 void SetSASyncStateL(TInt aState); |
|
991 |
|
992 /** |
|
993 * Get server alert sync state. |
|
994 * @param None. |
|
995 * @return Server alert sync state. |
|
996 */ |
|
997 TInt SASyncState(); |
|
998 |
|
999 /** |
|
1000 * Set http authentication state. |
|
1001 * @param aEnable. |
|
1002 * @return None. |
|
1003 */ |
|
1004 void SetHttpUsedL(TBool aEnable); |
|
1005 |
|
1006 /** |
|
1007 * Get http authentication state. |
|
1008 * @param aEnable. |
|
1009 * @return Boolean. |
|
1010 */ |
|
1011 TBool HttpUsedL(); |
|
1012 |
|
1013 /** |
|
1014 * Get http user name. |
|
1015 * @param aText. |
|
1016 * @return None. |
|
1017 */ |
|
1018 void GetHttpUserNameL(TDes& aText); |
|
1019 |
|
1020 /** |
|
1021 * Set http user name. |
|
1022 * @param aText. |
|
1023 * @return None. |
|
1024 */ |
|
1025 void SetHttpUserNameL(const TDesC& aText); |
|
1026 |
|
1027 /** |
|
1028 * Get http password. |
|
1029 * @param aText. |
|
1030 * @return None. |
|
1031 */ |
|
1032 void GetHttpPasswordL(TDes& aText); |
|
1033 |
|
1034 /** |
|
1035 * Set http password. |
|
1036 * @param aText. |
|
1037 * @return None. |
|
1038 */ |
|
1039 void SetHttpPasswordL(const TDesC& aText); |
|
1040 |
|
1041 |
|
1042 public: |
|
1043 /** |
|
1044 * Open history log. |
|
1045 * @param None. |
|
1046 * @return None. |
|
1047 */ |
|
1048 void OpenHistoryLog(); |
|
1049 |
|
1050 /** |
|
1051 * Open connection. |
|
1052 * @param None. |
|
1053 * @return None. |
|
1054 */ |
|
1055 void OpenConnection(); |
|
1056 |
|
1057 /** |
|
1058 * Get RSyncMLDataSyncProfile. |
|
1059 * @param None. |
|
1060 * @return RSyncMLDataSyncProfile. |
|
1061 */ |
|
1062 RSyncMLDataSyncProfile& Profile(); |
|
1063 |
|
1064 /** |
|
1065 * Get RSyncMLSession. |
|
1066 * @param None. |
|
1067 * @return RSyncMLSession. |
|
1068 */ |
|
1069 RSyncMLSession& Session(); |
|
1070 |
|
1071 /** |
|
1072 * Get application id. |
|
1073 * @param None. |
|
1074 * @return Application id. |
|
1075 */ |
|
1076 TInt ApplicationId(); |
|
1077 |
|
1078 public: |
|
1079 /** |
|
1080 * Get connection property name. |
|
1081 * @param aText. |
|
1082 * @param aPropertyPos. |
|
1083 * @return None. |
|
1084 */ |
|
1085 void GetConnectionPropertyNameL(TDes8& aText, TInt aPropertyPos); |
|
1086 |
|
1087 /** |
|
1088 * Get sync type. |
|
1089 * @param aSyncTask. |
|
1090 * @return Sync type. |
|
1091 */ |
|
1092 static TInt SyncType(RSyncMLTask& aSyncTask); |
|
1093 |
|
1094 /** |
|
1095 * Set default bearer. |
|
1096 * @param None. |
|
1097 * @return None. |
|
1098 */ |
|
1099 void SetDefaultBearerL(); |
|
1100 |
|
1101 /** |
|
1102 * Get latest history job. |
|
1103 * @param None. |
|
1104 * @return History job. |
|
1105 */ |
|
1106 const CSyncMLHistoryJob* LatestHistoryJob(); |
|
1107 |
|
1108 /** |
|
1109 * Get latest history job. |
|
1110 * @param aTaskId. |
|
1111 * @return History job. |
|
1112 */ |
|
1113 const CSyncMLHistoryJob* LatestHistoryJob(TInt aTaskId); |
|
1114 |
|
1115 /** |
|
1116 * Find out whether history job contains a task. |
|
1117 * @param aHistoryJob. |
|
1118 * @return Boolean. |
|
1119 */ |
|
1120 TBool TaskExist(const CSyncMLHistoryJob* aHistoryJob, TInt aTaskId); |
|
1121 |
|
1122 /** |
|
1123 * Copy values from another profile. |
|
1124 * @param aSource. |
|
1125 * @return None. |
|
1126 */ |
|
1127 void CopyValuesL(CAspProfile* aSource); |
|
1128 |
|
1129 /** |
|
1130 * Get default transport id. |
|
1131 * @param None. |
|
1132 * @return Transport id. |
|
1133 */ |
|
1134 TInt DefaultTransportIdL(); |
|
1135 |
|
1136 /** |
|
1137 * Delete all connections. |
|
1138 * @param aId. |
|
1139 * @return None. |
|
1140 */ |
|
1141 //void DeleteConnectionsL(); |
|
1142 |
|
1143 public: |
|
1144 /** |
|
1145 * Get new profile name. |
|
1146 * @param aList. |
|
1147 * @param aApplicationId. |
|
1148 * @return Profile name. |
|
1149 */ |
|
1150 static HBufC* GetNewProfileNameLC(CAspProfileList* aList, TInt aApplicationId); |
|
1151 |
|
1152 /** |
|
1153 * Set default values. |
|
1154 * @param aProfile. |
|
1155 * @return None. |
|
1156 */ |
|
1157 static void SetDefaultValuesL(CAspProfile* aProfile); |
|
1158 |
|
1159 /** |
|
1160 * Is other sync running. |
|
1161 * @param aSyncSession. |
|
1162 * @return Boolean. |
|
1163 */ |
|
1164 static TBool OtherSyncRunning(RSyncMLSession* aSyncSession); |
|
1165 |
|
1166 /** |
|
1167 * Get current sync job. |
|
1168 * @param aSyncSession. |
|
1169 * @return Sync job. |
|
1170 */ |
|
1171 static TInt CurrentJob(RSyncMLSession* aSyncSession); |
|
1172 |
|
1173 /** |
|
1174 * Is this profile PCSuite profile. |
|
1175 * @param aProfile. |
|
1176 * @return Boolean. |
|
1177 */ |
|
1178 static TBool IsPCSuiteProfile(CAspProfile* aProfile); |
|
1179 |
|
1180 public: |
|
1181 /** |
|
1182 * Check mandatory task data. |
|
1183 * @param aProfile. |
|
1184 * @param aContentCount. |
|
1185 * @return Mandatory data status code. |
|
1186 */ |
|
1187 static TInt CheckMandatoryTaskDataL(CAspProfile* aProfile, TInt& aContentCount); |
|
1188 |
|
1189 /** |
|
1190 * Check mandatory task data. |
|
1191 * @param aProfile. |
|
1192 * @param aContentCount. |
|
1193 * @return Mandatory data status code. |
|
1194 */ |
|
1195 static TInt CheckMandatoryTaskData(CAspProfile* aProfile, TInt& aContentCount); |
|
1196 |
|
1197 /** |
|
1198 * Check mandatory data. |
|
1199 * @param aProfile. |
|
1200 * @param aContentCount. |
|
1201 * @return Mandatory data status code. |
|
1202 */ |
|
1203 static TInt CheckMandatoryData(CAspProfile* aProfile, TInt& aContentCount); |
|
1204 |
|
1205 /** |
|
1206 * Check mandatory connection data. |
|
1207 * @param aProfile. |
|
1208 * @return Mandatory data status code. |
|
1209 */ |
|
1210 static TInt CheckMandatoryConnData(CAspProfile* aProfile); |
|
1211 |
|
1212 /** |
|
1213 * Delete sync history for a profile |
|
1214 * @param None |
|
1215 * @return None |
|
1216 */ |
|
1217 void DeleteHistory(); |
|
1218 public: |
|
1219 // ----------------------------------------------------------------------------- |
|
1220 // CAspProfile::GetLocalisedPCSuite |
|
1221 // |
|
1222 // Returns "PC Suite" string localised to specific language |
|
1223 // |
|
1224 // Current requirement is to localise to 2 languages TaiwanChinese and ELangHongKongChinese |
|
1225 // For all the rest it will be mapped to "PC suite" only |
|
1226 // ----------------------------------------------------------------------------- |
|
1227 // |
|
1228 void GetLocalisedPCSuite(TDes& aText); |
|
1229 |
|
1230 //public: |
|
1231 //HBufC* HistoryJobsLC(); |
|
1232 |
|
1233 private: |
|
1234 // historylog open state |
|
1235 TBool iHistoryLogOpen; |
|
1236 |
|
1237 // connection open state |
|
1238 TBool iConnectionOpen; |
|
1239 |
|
1240 // needed for setting creator id |
|
1241 TInt iApplicationId; |
|
1242 |
|
1243 // long buffer for string handling |
|
1244 TBuf<KBufSize255> iBuf; |
|
1245 |
|
1246 // long buffer for string handling |
|
1247 TBuf8<KBufSize255> iBuf8; |
|
1248 |
|
1249 // sync session |
|
1250 RSyncMLSession* iSyncSession; |
|
1251 |
|
1252 // sync profile |
|
1253 RSyncMLDataSyncProfile iProfile; |
|
1254 |
|
1255 // history log |
|
1256 RSyncMLHistoryLog iHistoryLog; |
|
1257 |
|
1258 // sync connection |
|
1259 RSyncMLConnection iConnection; |
|
1260 }; |
|
1261 |
|
1262 |
|
1263 /** |
|
1264 * CAspTask |
|
1265 * |
|
1266 * TAspTask is used for sync task operations. |
|
1267 */ |
|
1268 NONSHARABLE_CLASS (TAspTask) : public CBase |
|
1269 { |
|
1270 public: |
|
1271 static TInt SyncDirection(TSmlSyncType aSmlSyncDirection); |
|
1272 static TSmlSyncType SmlSyncDirection(TInt aSyncDirection); |
|
1273 static TInt FindTaskIdL(CAspProfile* aProfile, TInt aDataProviderId, const TDesC& aLocalDatabase); |
|
1274 static TBool CheckLocalDatabaseL(CAspProfile* aProfile, TInt& aDataProviderId); |
|
1275 static TBool CheckLocalDatabase(CAspProfile* aProfile, TInt& aDataProviderId); |
|
1276 }; |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 #endif // ASPPROFILE_H |
|
1285 |
|
1286 |
|
1287 // End of file |