34 #include <SmlDataFormat.h> |
30 #include <SmlDataFormat.h> |
35 #include <calprogresscallback.h> |
31 #include <calprogresscallback.h> |
36 #include <msvapi.h> |
32 #include <msvapi.h> |
37 #include <CalenImporter.h> |
33 #include <CalenImporter.h> |
38 #include <CalenExporter.h> |
34 #include <CalenExporter.h> |
39 #include <calinstanceview.h> |
|
40 #include <CalenInterimUtils2.h> |
35 #include <CalenInterimUtils2.h> |
41 #include <versittls.h> |
36 #include <versittls.h> |
|
37 #include <nsmlagendaadapterhandler.h> |
|
38 #include "nsmlconstants.h" |
|
39 #include "nsmlchangefinder.h" |
|
40 #include "NSmlDataModBase.h" |
|
41 #include "nsmlagendadefines.hrh" |
42 |
42 |
43 // CONSTANTS |
43 // CONSTANTS |
44 const TInt KNSmlAgendaCompressLimit = 20; |
44 const TInt KNSmlAgendaCompressLimit = 20; |
45 const TInt KNSmlAgendaLittleArraySize = 4; |
45 const TInt KNSmlAgendaLittleArraySize = 4; |
46 const TInt KNSmlAgendaSmallArraySize = 8; |
46 const TInt KNSmlAgendaSmallArraySize = 8; |
47 const TInt KNSmlAgendaLargeArraySize = 128; |
47 const TInt KNSmlAgendaLargeArraySize = 128; |
48 const TInt KNSmlAgendaOwnMaxObjectSize = 1048576; |
48 const TInt KNSmlAgendaOwnMaxObjectSize = 1048576; |
49 const TInt KNSmlCompactAfterChanges = 30; |
49 const TInt KNSmlCompactAfterChanges = 30; |
50 const TInt KNSmlDefaultStoreNameMaxSize = 256; |
50 const TInt KNSmlDefaultStoreNameMaxSize = 256; |
51 const TInt KNSmlItemDataExpandSize = 1024; |
51 const TInt KNSmlItemDataExpandSize = 1024; |
|
52 const TInt KDbPersonal = 100000; |
|
53 const TUid KRepositoryId = { 0x2000CF7E }; |
|
54 const TInt KNsmlDsOrphanEvent = 0xB ; |
|
55 const TUint KNSmlAgendaAdapterUid = 0x101F6DDD; |
|
56 const TUint KNSmlAgendaAdapterStreamUid = 0x101F6DDD+0x10009d8d; |
52 _LIT( KNSmlDriveC, "C" ); |
57 _LIT( KNSmlDriveC, "C" ); |
53 _LIT( KNSmlAgendaStoreNameForDefaultDB, "C:Calendar" ); |
58 _LIT( KNSmlAgendaStoreNameForDefaultDB, "Calendar" ); |
54 _LIT8( KNSmlMRUtilitiesEComPlugInUID, "AgnEntryUi" ); |
59 _LIT( KNSmlAgendaFileNameForDefaultDB, "c:calendar" ); |
55 _LIT8( KNSmlVersitTokenRecurrenceID, "RECURRENCE-ID"); |
60 _LIT8( KNSmlVersitTokenRecurrenceID, "RECURRENCE-ID"); |
56 _LIT8( KNSmlVersitTokenXRecurrenceID, "X-RECURRENCE-ID"); |
61 _LIT8( KNSmlVersitTokenXRecurrenceID, "X-RECURRENCE-ID"); |
57 _LIT8(KNSmlVersitTokenGeoID,"GEO"); |
62 _LIT8(KNSmlVersitTokenGeoID,"GEO"); |
58 |
63 |
|
64 //RD_MULTICAL |
|
65 // MIME content type for folder item |
|
66 _LIT8( KNSmlContentTypeFolder, "application/vnd.omads-folder+xml" ); |
|
67 // Email folder item type version |
|
68 _LIT8( KNSmlContentTypeFolderVersion, "1.2" ); |
|
69 _LIT8( KNSmlDefaultOpaqueData, "Default" ); |
|
70 |
|
71 const TInt KArrayGranularity = 30; |
|
72 const TInt KBuffLength = 128; |
59 |
73 |
60 // DATA TYPES |
74 // DATA TYPES |
|
75 enum TNSmlDataMimeType |
|
76 { |
|
77 ENSmlNone = 0, |
|
78 ENSmlCalendar, |
|
79 ENSmlFolder |
|
80 }; |
|
81 //RD_MULTICAL |
61 enum TNSmlDataStoreStatus |
82 enum TNSmlDataStoreStatus |
62 { |
83 { |
63 ENSmlClosed = 0, |
84 ENSmlClosed = 0, |
64 ENSmlOpenAndWaiting, |
85 ENSmlOpenAndWaiting, |
65 ENSmlItemOpen, |
86 ENSmlItemOpen, |
472 const CCalEntry::TReplicationStatus& aReplicationStatus ) const; |
509 const CCalEntry::TReplicationStatus& aReplicationStatus ) const; |
473 |
510 |
474 /** |
511 /** |
475 * Completes an item operation started in DoCreateItemL(). |
512 * Completes an item operation started in DoCreateItemL(). |
476 */ |
513 */ |
477 void DoCommitCreateItemL(); |
514 void DoCommitCreateCalItemL(); |
478 |
515 |
479 /** |
516 /** |
480 * Completes an item operation started in DoReplaceItemL(). |
517 * Completes an item operation started in DoReplaceItemL(). |
481 */ |
518 */ |
482 void DoCommitReplaceItemL(); |
519 void DoCommitReplaceCalItemL(); |
|
520 /** |
|
521 * Completes an Folder item operation started in DoCreateItemL(). |
|
522 */ |
|
523 void DoCommitCreateFolderItemL(); |
|
524 |
|
525 /** |
|
526 * Completes an Folder item operation started in DoReplaceItemL(). |
|
527 */ |
|
528 void DoCommitReplaceFolderItemL(); |
483 |
529 |
484 /** |
530 /** |
485 * Gets property from old item. |
531 * Gets property from old item. |
486 * @param aOldItem Data of old item. |
532 * @param aOldItem Data of old item. |
487 * @param aValue Value of searched property. |
533 * @param aValue Value of searched property. |
497 * @param aValue Value of added property. |
543 * @param aValue Value of added property. |
498 * @param aProperty Property that is added. |
544 * @param aProperty Property that is added. |
499 */ |
545 */ |
500 void SetPropertiesToDataL( HBufC8*& aValue, |
546 void SetPropertiesToDataL( HBufC8*& aValue, |
501 const TDesC8& aProperty ); |
547 const TDesC8& aProperty ); |
502 |
548 |
|
549 /** |
|
550 * Method to determine the MIME type, provided the UID |
|
551 */ |
|
552 void DataMimeType( TSmlDbItemUid aUid ); |
|
553 |
|
554 /** |
|
555 * Get All the AdapterHandler instance |
|
556 */ |
|
557 void ListAllAgendaPluginAdaptersL(); |
|
558 |
|
559 /** |
|
560 * Get the AdapterHandler instance |
|
561 */ |
|
562 void AgendaAdapterHandlerL(); |
|
563 |
|
564 /** |
|
565 * Retrieve the CalendarFile and associated entries ID |
|
566 */ |
|
567 void SynchronizableCalEntryIdsL( RArray<TCalLocalUid>& aUidArray ); |
|
568 |
|
569 /** |
|
570 * Method to retrieve the Id of the Calendar Entry |
|
571 */ |
|
572 void GetCalendarEntryIdL( TCalLocalUid& aParentId, TCalLocalUid& aCalId ) const; |
|
573 |
|
574 /** |
|
575 * Open the Store if present else create one to work upon |
|
576 */ |
|
577 void OpenStoreL(); |
|
578 |
|
579 /** |
|
580 * Filters out the non-active items from the given array |
|
581 */ |
|
582 CNSmlDataItemUidSet* ActiveItemsL( CNSmlDataItemUidSet& aUids ) const; |
|
583 |
|
584 /** |
|
585 * Populate iCommittedUidArr from the Stream |
|
586 */ |
|
587 void ExternalizeCommittedUidL() const; |
|
588 |
|
589 /** |
|
590 * Write the contents of iCommittedUidArr to the Stream |
|
591 */ |
|
592 void InternalizeCommittedUidL() const; |
503 |
593 |
504 private: // Data |
594 private: // Data |
505 // Key |
595 // Key |
506 TKeyArrayFix iKey; |
596 TKeyArrayFix iKey; |
507 // Position of buffer |
597 // Position of buffer |
532 RFs iRfs; |
622 RFs iRfs; |
533 // ServerMaxObjectSize |
623 // ServerMaxObjectSize |
534 TInt iServerMaxObjectSize; |
624 TInt iServerMaxObjectSize; |
535 // Name of the opened database |
625 // Name of the opened database |
536 HBufC* iOpenedStoreName; |
626 HBufC* iOpenedStoreName; |
|
627 // Name of the received storename |
|
628 HBufC* iReceivedStoreName; |
537 // Default name of the database |
629 // Default name of the database |
538 HBufC* iDefaultStoreName; |
630 HBufC* iDefaultStoreFileName; |
539 // Opened database ID |
631 // Opened database ID |
540 TInt64 iOpenedStoreId; |
632 TInt64 iOpenedStoreId; |
541 // Item's ID that is to be added |
633 // Item's ID that is to be added |
542 TInt* iAddItemId; |
634 TInt* iAddItemId; |
543 // Item's data that is to be written |
635 // Item's data that is to be written |
554 CNSmlDataItemUidSet* iSoftDeletedUids; |
646 CNSmlDataItemUidSet* iSoftDeletedUids; |
555 // Uids of replaced items |
647 // Uids of replaced items |
556 CNSmlDataItemUidSet* iReplacedUids; |
648 CNSmlDataItemUidSet* iReplacedUids; |
557 // Uids of moved items |
649 // Uids of moved items |
558 CNSmlDataItemUidSet* iMovedUids; |
650 CNSmlDataItemUidSet* iMovedUids; |
559 // Session to calendar server |
651 /*// Session to calendar server |
560 CCalSession* iVCalSession; |
652 CCalSession* iVCalSession; |
561 // Internal progress notifier |
653 // Internal progress notifier |
562 CNSmlAgendaProgressview* iAgendaProgressview; |
654 CNSmlAgendaProgressview* iAgendaProgressview;*/ |
563 // Interim Utility |
655 // Interim Utility |
564 CCalenInterimUtils2* iInterimUtils; |
656 CCalenInterimUtils2* iInterimUtils; |
565 |
657 |
566 // Importer |
658 /*// Importer |
567 CCalenImporter* iImporter; |
659 CCalenImporter* iImporter; |
568 // Exporter |
660 // Exporter |
569 CCalenExporter* iExporter; |
661 CCalenExporter* iExporter; |
570 |
662 |
571 //Instance View |
|
572 CCalInstanceView* iInstanceView; |
|
573 |
|
574 // Entry view |
663 // Entry view |
575 CCalEntryView* iEntryView; |
664 CCalEntryView* iEntryView; |
576 CVersitTlsData *iVersitTlsData; // for better performance |
665 CVersitTlsData *iVersitTlsData; // for better performance*/ |
|
666 // Flag is Hierarchical Sync is supported |
|
667 TBool iIsHierarchicalSyncSupported; |
|
668 // Mime Type of Calendar Item |
|
669 TNSmlDataMimeType iDataMimeType; |
|
670 // Parent Id of the Calendar Item |
|
671 TInt iParentItemId; |
|
672 // Offset value |
|
673 TUint iCalOffsetVal; |
|
674 // Offset memory values of the Calendar DB |
|
675 CArrayFixFlat<TUint>* iCalOffsetArr; |
|
676 // List of committed UIDs |
|
677 CNSmlDataItemUidSet* iCommittedUidArr; |
|
678 // Agenda Adapter Handler Instance |
|
679 RPointerArray<CNSmlAgendaAdapterHandler> iAgendaPluginAdapters; |
|
680 // Agenda Adapter Handler Instance |
|
681 CNSmlAgendaAdapterHandler* iAgendaAdapterHandler; |
|
682 // SyncRelationship instance |
|
683 CNSmlAgendaAdapterLog* iAgendaAdapterLog; |
|
684 // Flag indicating a Orphan Event |
|
685 TBool iOrphanEvent; |
577 }; |
686 }; |
578 |
687 |
|
688 // ---------------------------------------------------------------------------- |
|
689 // CNSmlAgendaDataStoreUtil provides services to cope with maintaining calendar |
|
690 // API's used for database access |
|
691 // @lib nsmlagendadataprovider.dll |
|
692 // ---------------------------------------------------------------------------- |
|
693 NONSHARABLE_CLASS(CNSmlAgendaDataStoreUtil) : public CBase |
|
694 { |
|
695 public: |
|
696 /** |
|
697 * Two-phased constructor. |
|
698 */ |
|
699 static CNSmlAgendaDataStoreUtil* NewL(); |
|
700 |
|
701 /** |
|
702 * Destructor. |
|
703 */ |
|
704 virtual ~CNSmlAgendaDataStoreUtil(); |
|
705 |
|
706 private: |
|
707 /** |
|
708 * C++ default constructor. |
|
709 */ |
|
710 CNSmlAgendaDataStoreUtil(); |
|
711 |
|
712 public: // New Functions |
|
713 /** |
|
714 * Initialize Calendar APIs for database access using the provided name and id |
|
715 */ |
|
716 void InitializeCalAPIsL( HBufC* aFileName, TSmlDbItemUid aUid = NULL ); |
|
717 |
|
718 |
|
719 public: // Data |
|
720 CCalSession* iCalSession; |
|
721 CCalenExporter* iExporter; |
|
722 CCalenImporter* iImporter; |
|
723 CNSmlAgendaProgressview* iProgressView; |
|
724 CCalEntryView* iEntryView; |
|
725 CCalEntry* iEntry; |
|
726 HBufC8* iFileName; |
|
727 TSmlDbItemUid iUid; |
|
728 }; |
|
729 |
|
730 // ---------------------------------------------------------------------------- |
|
731 // CNSmlAgendaAdapterLog provides services know active Sync |
|
732 // API's used for database access |
|
733 // @lib nsmlagendadataprovider.dll |
|
734 // ---------------------------------------------------------------------------- |
|
735 NONSHARABLE_CLASS(CNSmlAgendaAdapterLog) : public CBase |
|
736 { |
|
737 public: |
|
738 /** |
|
739 * Two-phased constructor. |
|
740 */ |
|
741 static CNSmlAgendaAdapterLog* NewL( MSmlSyncRelationship& aSyncRelationship ); |
|
742 |
|
743 /** |
|
744 * Destructor. |
|
745 */ |
|
746 virtual ~CNSmlAgendaAdapterLog(); |
|
747 |
|
748 private: |
|
749 /** |
|
750 * C++ default constructor. |
|
751 */ |
|
752 CNSmlAgendaAdapterLog( MSmlSyncRelationship& aSyncRelationship ); |
|
753 |
|
754 public: // Data |
|
755 MSmlSyncRelationship& iSyncRelationship; |
|
756 |
|
757 }; |
579 #endif // __NSMLAGENDADATASTORE_H__ |
758 #endif // __NSMLAGENDADATASTORE_H__ |
580 |
759 |
581 // End of File |
760 // End of File |