|
1 /* |
|
2 * Copyright (c) 2010 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CCALENDARPLUGIN_H |
|
19 #define CCALENDARPLUGIN_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <cindexingplugin.h> |
|
23 #include <calprogresscallback.h> |
|
24 #include <calchangecallback.h> |
|
25 #include <calcommon.h> // TCalLocalUid |
|
26 |
|
27 #include <common.h> |
|
28 #include "delayedcallback.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CCalSession; |
|
32 class CCalIter; |
|
33 class CCalEntryView; |
|
34 class CCPixIndexer; |
|
35 |
|
36 |
|
37 /** Field names */ |
|
38 _LIT(KCalendarSummaryField, "Summary"); |
|
39 _LIT(KCalendarDescriptionField, "Description"); |
|
40 _LIT(KCalendarLocationField, "Location"); |
|
41 _LIT(KCalendarStartTimeField, "StartTime"); |
|
42 _LIT(KCalendarEndTimeField, "EndTime"); |
|
43 _LIT(KCalendarAttendeesField, "Attendees"); |
|
44 |
|
45 class CCalendarPlugin : public CIndexingPlugin, public MDelayedCallbackObserver, public MCalProgressCallBack, public MCalChangeCallBack2 |
|
46 { |
|
47 public: // Constructors and destructor |
|
48 |
|
49 static CCalendarPlugin* NewL(); |
|
50 static CCalendarPlugin* NewLC(); |
|
51 virtual ~CCalendarPlugin(); |
|
52 |
|
53 public: // From CIndexingPlugin |
|
54 void StartPluginL(); |
|
55 void StartHarvestingL(const TDesC& aQualifiedBaseAppClass); |
|
56 |
|
57 public: // From MCalProgressCallBack |
|
58 |
|
59 /** Progress callback. |
|
60 This calls the observing class with the percentage complete of the current operation. |
|
61 @param aPercentageCompleted The percentage complete. */ |
|
62 void Progress(TInt aPercentageCompleted); |
|
63 |
|
64 /** Progress callback. |
|
65 This calls the observing class when the current operation is finished. |
|
66 @param aError The error if the operation failed, or KErrNone if successful. */ |
|
67 void Completed(TInt aError); |
|
68 |
|
69 /** Asks the observing class whether progress callbacks are required. |
|
70 @return If the observing class returns EFalse, then the Progress() function will not be called. */ |
|
71 TBool NotifyProgress(); |
|
72 |
|
73 public: // From MCalChangeCallBack2 |
|
74 |
|
75 void CalChangeNotification( RArray< TCalChangeEntry >& aChangeItems ); |
|
76 |
|
77 public: // From MDelayedCallbackObserver |
|
78 |
|
79 void DelayedCallbackL(TInt aCode); |
|
80 void DelayedError(TInt aError); |
|
81 |
|
82 private: // New functions |
|
83 |
|
84 void HandleChangedEntryL(const TCalChangeEntry& changedEntry); |
|
85 |
|
86 void CreateEntryL( const TCalLocalUid& aLocalUid, TCPixActionType aActionType ); |
|
87 |
|
88 private: // Constructors |
|
89 |
|
90 /** |
|
91 * Default C++ constructor. |
|
92 */ |
|
93 CCalendarPlugin(); |
|
94 |
|
95 /** |
|
96 * Symbian 2nd phase constructor. |
|
97 */ |
|
98 void ConstructL(); |
|
99 |
|
100 private: |
|
101 |
|
102 /** The asynchronizer */ |
|
103 CDelayedCallback* iAsynchronizer; |
|
104 |
|
105 // CPix database |
|
106 CCPixIndexer* iIndexer; |
|
107 |
|
108 /** Calendar session */ |
|
109 CCalSession* iSession; |
|
110 |
|
111 /** Calendar iterator */ |
|
112 CCalIter* iCalIterator; |
|
113 |
|
114 /** Calendar entry view */ |
|
115 CCalEntryView* iEntryView; |
|
116 |
|
117 /** Are we positioned at first entry? */ |
|
118 TBool iFirstEntry; |
|
119 |
|
120 // Start harvesting |
|
121 TBool iStartHarvesting; |
|
122 |
|
123 #ifdef __PERFORMANCE_DATA |
|
124 TTime iStartTime; |
|
125 TTime iCompleteTime; |
|
126 void UpdatePerformaceDataL(); |
|
127 void UpdatePerformaceDataL(TCPixActionType); |
|
128 #endif |
|
129 }; |
|
130 |
|
131 #endif // CCALENDARPLUGIN_H |