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