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