|
1 /* |
|
2 * Copyright (c) 2007 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 the License "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 |
|
19 #ifndef __CALENDARSERVICE_H |
|
20 #define __CALENDARSERVICE_H |
|
21 |
|
22 class CAsyncRequestObserver; |
|
23 class CEntryAttributes; |
|
24 class CCalendarSessionInfo; |
|
25 |
|
26 /** |
|
27 * Calendar Service class. Perfoms various operations on calendar / calendar entries. |
|
28 */ |
|
29 class CCalendarService : public CBase |
|
30 { |
|
31 public: |
|
32 |
|
33 /** |
|
34 * Two Phase Constructor |
|
35 */ |
|
36 IMPORT_C static CCalendarService* NewL(); |
|
37 |
|
38 /** |
|
39 * Destructor |
|
40 */ |
|
41 virtual ~CCalendarService(); |
|
42 |
|
43 private: |
|
44 |
|
45 /** |
|
46 * Constructor |
|
47 */ |
|
48 CCalendarService(); |
|
49 |
|
50 /** |
|
51 * Constructor |
|
52 */ |
|
53 void ConstructL(); |
|
54 |
|
55 /** |
|
56 * Adds asynchronous request object |
|
57 * @param aTransactionId Transcation Id os Async object |
|
58 * @param aAsyncObj Async object |
|
59 */ |
|
60 void AddAsyncObjL( const TInt32 aTransactionId, CCalendarASyncRequest* aAsyncObj ); |
|
61 |
|
62 /** |
|
63 * Returns session info for the given calendar |
|
64 * @param aCalendar Calendar Name |
|
65 * @return CCalendarSessionInfo* Session info object |
|
66 */ |
|
67 CCalendarSessionInfo* CalendarSessionInfoL( const TDesC& aCalendar ); |
|
68 |
|
69 /** |
|
70 * Removes Session info object |
|
71 * @param aCalendar Calendar session to be removed |
|
72 * @return void |
|
73 */ |
|
74 void RemoveSessionInfo( const TDesC& aCalendar ); |
|
75 |
|
76 public: |
|
77 |
|
78 /** |
|
79 * Returns list of available calendars in device. |
|
80 * @param aDefault Flag for getting default calendar only |
|
81 * @param aCalendarList Calendar List |
|
82 */ |
|
83 IMPORT_C void GetListL( CDesCArray*& aCalendarList, const TBool aDefault = EFalse ); |
|
84 |
|
85 /** |
|
86 * Returns list of calendar entries from given calendar with the given Global UID. |
|
87 * @param aCalendarName Calendar Name |
|
88 * @param aGuid Global UID |
|
89 * @param aEntryList output param gives Calendar Entry List |
|
90 */ |
|
91 IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, RPointerArray<CCalEntry>& aEntryList); |
|
92 |
|
93 /** |
|
94 * Returns list of calendar entries from given calendar with the given Local UID. |
|
95 * @param aCalendarName Calendar Name |
|
96 * @param aLocalUid Local UID |
|
97 * @param aEntryList output param gives Calendar Entry List |
|
98 */ |
|
99 IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, RPointerArray<CCalEntry>& aEntryList); |
|
100 |
|
101 /** |
|
102 * Returns list of calendar instance from given calendar with the given Filter. |
|
103 * @param aCalendarName Calendar Name |
|
104 * @param aFilter Filter, Ownership is passed |
|
105 * @param aInstanceList output param gives Calendar Instance List |
|
106 */ |
|
107 IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray<CCalInstance>& aEntryList); |
|
108 |
|
109 /** |
|
110 * Add new calendar in device. |
|
111 * @param aCalendarName Calendar Name |
|
112 */ |
|
113 IMPORT_C void AddL( const TDesC& aCalendarName ); |
|
114 |
|
115 /** |
|
116 * Add new entry to given calendar. |
|
117 * @param aCalendarName Calendar Name |
|
118 * @param aCalendarData Entry data, Ownership is passed |
|
119 * @param aUidAdded Uid for newly added entry |
|
120 */ |
|
121 IMPORT_C void AddL( const TDesC& aCalendarName, CEntryAttributes* aCalendarData, TUIDSet*& aUidAdded ); |
|
122 |
|
123 /** |
|
124 * Remove calendar from the device. Deletion of defaut calendar is not supported |
|
125 * @param aCalendarName Calendar Name |
|
126 */ |
|
127 IMPORT_C void DeleteL( const TDesC& aCalendarName ); |
|
128 |
|
129 /** |
|
130 * Remove entries from the given calendar based on input filter |
|
131 * @param aCalendarName Calendar Name |
|
132 * @param aFilter Filter, Ownership is passed |
|
133 * @param aCallback CallBack for asynchronous requests, Ownership is passed |
|
134 */ |
|
135 IMPORT_C void DeleteL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallback = NULL ); |
|
136 |
|
137 |
|
138 /** |
|
139 * ASynchronous Version of Import: Imports the contents specified in the InputBuffer complaining to aFormat to aCalendarName |
|
140 * @param aCalendarName Calendar Name |
|
141 * @param aFormat used to set the iFormat it can be either ICAL or VCAL, two popular Calendar formats |
|
142 * @param aInputBuffer contains the data to be imported to the specified calendar |
|
143 * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set |
|
144 * |
|
145 * @return void |
|
146 */ |
|
147 IMPORT_C void ImportL( const TDesC& aCalendarName, const TDesC8& aFormat, const TDesC8& aInputBuffer, MCalCallbackBase* aCallBack ); |
|
148 |
|
149 /** |
|
150 * ASynchronous Version of Import: Imports the contents specified in the InputBuffer complaining to aFormat to aCalendarName |
|
151 * @param aCalendarName Calendar Name |
|
152 * @param aFormat used to set the iFormat it can be either ICAL or VCAL, two popular Calendar formats |
|
153 * @param aImportFile File from where entries needs to be imported |
|
154 * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set |
|
155 * |
|
156 * @return void |
|
157 */ |
|
158 IMPORT_C void ImportL( const TDesC& aCalendarName, const TDesC8& aFormat, const TDesC& aImportFile, MCalCallbackBase* aCallBack ); |
|
159 |
|
160 /** |
|
161 * Synchronous Version of Import: Imports the contents specified in the InputBuffer complaining to aFormat to aCalendarName |
|
162 * @param aCalendarName Calendar Name |
|
163 * @param aFormat used to set the iFormat it can be either ICAL or VCAL, two popular Calendar formats |
|
164 * @param aInputBuffer contains the data to be imported to the specified calendar |
|
165 * @param aCUIDSet contains the GUids and LUids of the imported entries from inputbuffer |
|
166 * |
|
167 * @return void |
|
168 */ |
|
169 IMPORT_C void ImportL( const TDesC& aCalendarName, const TDesC8& aFormat, const TDesC8& aInputBuffer, RPointerArray<TUIDSet>& aUIDSet ); |
|
170 |
|
171 /** |
|
172 * Synchronous Version of Import: Imports the contents specified in the InputBuffer complaining to aFormat to aCalendarName |
|
173 * @param aCalendarName Calendar Name |
|
174 * @param aFormat used to set the iFormat it can be either ICAL or VCAL, two popular Calendar formats |
|
175 * @param aImportFile File from where entries needs to be imported |
|
176 * @param aCUIDSet contains the GUids and LUids of the imported entries from inputbuffer |
|
177 * |
|
178 * @return void |
|
179 */ |
|
180 IMPORT_C void ImportL( const TDesC& aCalendarName, const TDesC8& aFormat, const TDesC& aImportFile, RPointerArray<TUIDSet>& aUIDSet ); |
|
181 |
|
182 /** |
|
183 * Synchronous Version of Export which Exports the data from aCalendarName in aFormat to aOutputBuffer |
|
184 * @param aCalendarName Calendar Name |
|
185 * @param aFormat used to set the iFormat it can be either ICAL or VCAL, two popular Calendar formats |
|
186 * @param aParams used to specify the GUIDS or LUIDS in it or nulll signify all entries to be exported |
|
187 * @param aOutputBuffer This Buffer contains the Output (Exported from the calender) |
|
188 * |
|
189 * @return void |
|
190 */ |
|
191 IMPORT_C void ExportL( const TDesC& aCalendarName, const TDesC8& aFormat, CCalendarExportParams* aParams, HBufC8*& aOutputBuffer ); |
|
192 |
|
193 /** |
|
194 * ASynchronous Version of Export which Exports the data from aCalendarName in aFormat to HBufC8*(which is sent througn callback mehcnism) |
|
195 * @param aCalendarName Calendar Name |
|
196 * @param aFormat used to set the iFormat it can be either ICAL or VCAL, two popular Calendar formats |
|
197 * @param aParams used to specify the GUIDS or LUIDS in it or nulll signify all entries to be exported |
|
198 * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set |
|
199 * |
|
200 * @return void |
|
201 */ |
|
202 IMPORT_C void ExportL( const TDesC& aCalendarName, const TDesC8& aFormat, CCalendarExportParams* aParams, MCalCallbackBase* aCallBack ); |
|
203 |
|
204 /** |
|
205 * Start Notification for changes in given calendar |
|
206 * @param aCalendarName Calendar Name |
|
207 * @param aFilter Filter, Ownership is passed |
|
208 * @param aCallback CallBack for asynchronous requests, Ownership is passed |
|
209 */ |
|
210 IMPORT_C void StartChangeNotifyL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallback ); |
|
211 |
|
212 /** |
|
213 * Cancels asynchronous request |
|
214 * @param aTransactionId asynchronous transaction id |
|
215 * @param aResult error code |
|
216 */ |
|
217 IMPORT_C TInt Cancel( TInt32 aTransectionID ); |
|
218 |
|
219 |
|
220 private: |
|
221 |
|
222 /** |
|
223 * Represents a channel of communication between a client thread |
|
224 * and the Calendar Server thread. |
|
225 */ |
|
226 RPointerArray< CCalendarSessionInfo > iArraySessionInfo; |
|
227 |
|
228 /** |
|
229 * Asynchronous request observer |
|
230 */ |
|
231 CAsyncRequestObserver* iAsyncReqObserver; |
|
232 }; |
|
233 |
|
234 |
|
235 #endif __CALENDARSERVICE_H |