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