32 #include "calendardeleteentry.h" |
32 #include "calendardeleteentry.h" |
33 #include "calendarimport.h" |
33 #include "calendarimport.h" |
34 #include "calendarexport.h" |
34 #include "calendarexport.h" |
35 #include "addentry.h" |
35 #include "addentry.h" |
36 #include "asyncreqobserver.h" |
36 #include "asyncreqobserver.h" |
37 |
37 #include "calendargetlist.h" |
38 |
38 |
39 // --------------------------------------------------------------------------- |
39 // --------------------------------------------------------------------------- |
40 // Two-phased constructor. |
40 // Two-phased constructor. |
41 // --------------------------------------------------------------------------- |
41 // --------------------------------------------------------------------------- |
42 // |
42 // |
204 EXPORT_C void CCalendarService::GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, RPointerArray<CCalEntry>& aEntryList) |
204 EXPORT_C void CCalendarService::GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, RPointerArray<CCalEntry>& aEntryList) |
205 { |
205 { |
206 CCalendarSessionInfo* sessionInfo = CalendarSessionInfoL( aCalendarName ); |
206 CCalendarSessionInfo* sessionInfo = CalendarSessionInfoL( aCalendarName ); |
207 |
207 |
208 // Get list of calendar entries using CCalEntryView |
208 // Get list of calendar entries using CCalEntryView |
209 sessionInfo->EntryView()->FetchL( aGuid, aEntryList ); |
209 CCalendarGetList* getlistObj = CCalendarGetList::NewL( sessionInfo, aGuid ); |
|
210 |
|
211 CleanupStack::PushL( getlistObj ); |
|
212 |
|
213 getlistObj->GetListL( aGuid, aEntryList ); |
|
214 |
|
215 CleanupStack::PopAndDestroy( getlistObj ); |
210 } |
216 } |
211 |
217 |
212 // --------------------------------------------------------------------------- |
218 // --------------------------------------------------------------------------- |
213 // Returns list of calendar entries from given calendar with the given Local UID. |
219 // Returns list of calendar entries from given calendar with the given Local UID. |
214 // --------------------------------------------------------------------------- |
220 // --------------------------------------------------------------------------- |
215 // |
221 // |
216 EXPORT_C void CCalendarService::GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, RPointerArray<CCalEntry>& aEntryList) |
222 EXPORT_C void CCalendarService::GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, RPointerArray<CCalEntry>& aEntryList) |
217 { |
223 { |
218 CCalendarSessionInfo* sessionInfo = CalendarSessionInfoL( aCalendarName ); |
224 CCalendarSessionInfo* sessionInfo = CalendarSessionInfoL( aCalendarName ); |
219 |
225 |
220 // Fetch only that entry having local uid aLocalUid |
226 CCalendarGetList* getlistObj = CCalendarGetList::NewL( sessionInfo, aLocalUid ); |
221 CCalEntry* entry = sessionInfo->EntryView()->FetchL( aLocalUid ); |
227 |
222 if( entry ) |
228 CleanupStack::PushL( getlistObj ); |
223 { |
229 |
224 aEntryList.Append( entry ); |
230 getlistObj->GetListL( aLocalUid, aEntryList ); |
225 } |
231 |
|
232 CleanupStack::PopAndDestroy( getlistObj ); |
|
233 |
226 } |
234 } |
227 |
235 |
228 // --------------------------------------------------------------------------- |
236 // --------------------------------------------------------------------------- |
229 // Returns list of calendar instances from given calendar based on input filter. |
237 // Returns list of calendar instances from given calendar based on input filter. |
230 // --------------------------------------------------------------------------- |
238 // --------------------------------------------------------------------------- |
234 { |
242 { |
235 if ( !aFilter ) |
243 if ( !aFilter ) |
236 User::Leave( KErrArgument ); |
244 User::Leave( KErrArgument ); |
237 |
245 |
238 CCalendarSessionInfo* sessionInfo = CalendarSessionInfoL( aCalendarName ); |
246 CCalendarSessionInfo* sessionInfo = CalendarSessionInfoL( aCalendarName ); |
239 CalCommon::TCalTimeRange range = aFilter->TimeRange(); |
247 |
240 if( (range.EndTime().TimeLocalL()) < (range.StartTime().TimeLocalL()) ) |
248 CCalendarGetList* getlistObj = CCalendarGetList::NewL( sessionInfo, aFilter ); |
241 User::Leave( KErrArgument ); |
249 |
242 if ( aFilter->FilterText().Length() ) |
250 CleanupStack::PushL( getlistObj ); |
243 { |
251 |
244 // Search and return all instances which match filter text and time range |
252 getlistObj->GetListL( aInstanceList ); |
245 CCalInstanceView::TCalSearchParams searchParam( aFilter->FilterText(), CalCommon::EFoldedTextSearch ); |
253 |
246 sessionInfo->InstanceView()->FindInstanceL( aInstanceList, |
254 CleanupStack::PopAndDestroy( getlistObj ); |
247 aFilter->FilterType(), |
255 |
248 aFilter->TimeRange(), searchParam ) ; |
256 } |
249 } |
257 |
250 else |
258 // --------------------------------------------------------------------------- |
251 { |
259 // Returns list of calendar instances from given calendar based on input filter and callback. |
252 // Search and return all instances which match filter type and time range |
260 // --------------------------------------------------------------------------- |
253 sessionInfo->InstanceView()->FindInstanceL( aInstanceList, |
261 // |
254 aFilter->FilterType(), |
262 EXPORT_C void CCalendarService::GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, |
255 aFilter->TimeRange() ) ; |
263 MCalCallbackBase* aCallBack ) |
256 } |
264 { |
257 } |
265 if ( !aFilter ) |
258 |
266 User::Leave( KErrArgument ); |
|
267 |
|
268 CCalendarSessionInfo* sessionInfo = CalendarSessionInfoL( aCalendarName ); |
|
269 |
|
270 //Instantiate the getlist CoreClass Object |
|
271 CCalendarGetList* getlistObj = CCalendarGetList::NewL( sessionInfo, aFilter, iAsyncReqObserver, aCallBack ); |
|
272 |
|
273 //Push the GetlistObject onto the cleanup stack as the getlist function can Leave |
|
274 CleanupStack::PushL( getlistObj ); |
|
275 |
|
276 getlistObj->GetListL(); |
|
277 |
|
278 AddAsyncObjL( aCallBack->iTransactionId, getlistObj ); |
|
279 |
|
280 CleanupStack::Pop( getlistObj ); |
|
281 |
|
282 } |
|
283 // --------------------------------------------------------------------------- |
|
284 // Returns list of calendar entries from given calendar with the given Global UID. |
|
285 // --------------------------------------------------------------------------- |
|
286 // |
|
287 EXPORT_C void CCalendarService::GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack) |
|
288 { |
|
289 CCalendarSessionInfo* sessionInfo = CalendarSessionInfoL( aCalendarName ); |
|
290 |
|
291 CCalendarGetList* getlistObj = CCalendarGetList::NewL( sessionInfo, aGuid, iAsyncReqObserver, aCallBack ); |
|
292 |
|
293 CleanupStack::PushL( getlistObj ); |
|
294 |
|
295 getlistObj->GetListL(); |
|
296 |
|
297 AddAsyncObjL( aCallBack->iTransactionId, getlistObj ); |
|
298 |
|
299 CleanupStack::Pop( getlistObj ); |
|
300 |
|
301 } |
|
302 // --------------------------------------------------------------------------- |
|
303 // Returns list of calendar entries from given calendar with the given Local UID. |
|
304 // --------------------------------------------------------------------------- |
|
305 // |
|
306 EXPORT_C void CCalendarService::GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack) |
|
307 { |
|
308 CCalendarSessionInfo* sessionInfo = CalendarSessionInfoL( aCalendarName ); |
|
309 |
|
310 CCalendarGetList* getlistObj = CCalendarGetList::NewL( sessionInfo, aLocalUid, iAsyncReqObserver, aCallBack ); |
|
311 |
|
312 CleanupStack::PushL( getlistObj ); |
|
313 |
|
314 getlistObj->GetListL(); |
|
315 |
|
316 AddAsyncObjL( aCallBack->iTransactionId, getlistObj ); |
|
317 |
|
318 CleanupStack::Pop( getlistObj ); |
|
319 |
|
320 } |
259 // --------------------------------------------------------------------------- |
321 // --------------------------------------------------------------------------- |
260 // Adds new calendar |
322 // Adds new calendar |
261 // --------------------------------------------------------------------------- |
323 // --------------------------------------------------------------------------- |
262 // |
324 // |
263 EXPORT_C void CCalendarService::AddL( const TDesC& aCalendarName ) |
325 EXPORT_C void CCalendarService::AddL( const TDesC& aCalendarName ) |