X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fplatform%2FTizen%2FCalendar%2FCalendar.cpp;h=ffd20b66dd8bd58b899b10abae91d8bd19683072;hb=7fbb54fd938fd921c44b63a8cab9c7364a021f79;hp=35e9edd8c3001301863df7916b9c2d77b8c29c47;hpb=37fad6a43e6da3aa466886818d0c8a8c952f28f2;p=profile%2Fivi%2Fwrt-plugins-tizen.git diff --git a/src/platform/Tizen/Calendar/Calendar.cpp b/src/platform/Tizen/Calendar/Calendar.cpp index 35e9edd..ffd20b6 100755 --- a/src/platform/Tizen/Calendar/Calendar.cpp +++ b/src/platform/Tizen/Calendar/Calendar.cpp @@ -85,21 +85,21 @@ void Calendar::OnRequestReceived(const IEventAddEventsPtr &events) Try { if (events->getEvents()->empty()) { - ThrowMsg(NullPointerException, "event vector parameter is empty"); + ThrowMsg(NullPointerException, "Items array is empty."); + } + + int returnValue = calendar_svc_begin_trans(); + if(CAL_SUCCESS!=returnValue) { + ThrowMsg(PlatformException, "Begin transaction failed with error code: "<getEvents()->size(); i++) { - if (events->checkCancelled()) { - events->setCancelAllowed(true); - events->setResult(true); - return; - } - if (events->getEvents()->at(i)->getIdIsSet()) { - LogWarning("adding event that is already added: index " << i); + LogWarning("Item has index: " << i << ". Resetting it."); events->getEvents()->at(i)->resetId(); } DPL::ScopedPtr eventWrapper(new EventWrapper(events->getEvents()->at(i), getType())); @@ -107,7 +107,6 @@ void Calendar::OnRequestReceived(const IEventAddEventsPtr &events) eventWrapper->convertAbstractEventToPlatformEvent(); Try { - // Set the account and calendar id before saving the item. eventWrapper->setCalendarId(getId()); eventWrapper->setCalendarAccountId(getAccountId()); eventWrapper->saveEvent(); @@ -115,13 +114,18 @@ void Calendar::OnRequestReceived(const IEventAddEventsPtr &events) LogWarning("Exception: "<<_rethrown_exception.GetMessage()); failedAdding = true; } - //getAddEmitter()->emit(eventPtr); } if( false==failedAdding ) { events->setResult(true); + + returnValue = calendar_svc_end_trans(true); + LogInfo("End transaction return value with true flag: "<setResult(false); + + returnValue = calendar_svc_end_trans(false); + LogInfo("End transaction return value with false flag: "<setResult(false); events->setExceptionCode(ExceptionCodes::UnknownException); } - events->setCancelAllowed(false); } void Calendar::OnRequestReceived(const IEventUpdateEventPtr &event) @@ -172,12 +175,8 @@ void Calendar::OnRequestReceived(const IEventUpdateEventPtr &event) } int detachedEventId = calendar_svc_struct_get_int(platformEvent, CAL_VALUE_INT_INDEX); - std::time_t detachedStartTime = calendar_svc_struct_get_time(platformEvent, - CAL_VALUE_GMT_START_DATE_TIME, - CAL_TZ_FLAG_GMT); - std::time_t detachedEndTime = calendar_svc_struct_get_time(platformEvent, - CAL_VALUE_GMT_END_DATE_TIME, - CAL_TZ_FLAG_GMT); + long long int detachedStartTime = calendar_svc_struct_get_lli(platformEvent, CALS_VALUE_LLI_DTSTART_UTIME); + long long int detachedEndTime = calendar_svc_struct_get_lli(platformEvent, CALS_VALUE_LLI_DTEND_UTIME); DPL::ScopedPtr eventWrapperChild(new EventWrapper(event->getEvent(), getType())); eventWrapperChild->convertAbstractEventToPlatformEvent(); @@ -191,20 +190,18 @@ void Calendar::OnRequestReceived(const IEventUpdateEventPtr &event) parentId)) { ThrowMsg(PlatformException, "Can't set parent Id."); } - if (CAL_SUCCESS != calendar_svc_struct_set_time(eventWrapperChild->getPlatformEvent(), - CAL_VALUE_GMT_START_DATE_TIME, - CAL_TZ_FLAG_GMT, + if (CAL_SUCCESS != calendar_svc_struct_set_lli(eventWrapperChild->getPlatformEvent(), + CALS_VALUE_LLI_DTSTART_UTIME, detachedStartTime)) { ThrowMsg(PlatformException, "Can't set start time."); } - if (CAL_SUCCESS != calendar_svc_struct_set_time(eventWrapperChild->getPlatformEvent(), - CAL_VALUE_GMT_END_DATE_TIME, - CAL_TZ_FLAG_GMT, + if (CAL_SUCCESS != calendar_svc_struct_set_lli(eventWrapperChild->getPlatformEvent(), + CALS_VALUE_LLI_DTEND_UTIME, detachedEndTime)) { ThrowMsg(PlatformException, "Can't set end time."); } if (CAL_SUCCESS != calendar_svc_struct_set_int(eventWrapperChild->getPlatformEvent(), - CAL_VALUE_INT_REPEAT_TERM, + CALS_VALUE_INT_RRULE_FREQ, CAL_REPEAT_NONE)) { ThrowMsg(PlatformException, "Can't set repeat term."); } @@ -222,15 +219,15 @@ void Calendar::OnRequestReceived(const IEventUpdateEventPtr &event) CAL_VALUE_INT_ORIGINAL_EVENT_ID, event->getEvent()->getId()) ) { ThrowMsg(PlatformException, "cannot save exception event"); } - // Use "CAL_VALUE_GMT_COMPLETED_DATE_TIME" as the recurrence id saving point. - if ( CAL_SUCCESS!=calendar_svc_struct_set_time(eventWrapperChild->getPlatformEvent(), - CAL_VALUE_GMT_COMPLETED_DATE_TIME, CAL_TZ_FLAG_GMT, event->getEvent()->getRecurrenceId()) ) { + // Use "CAL_VALUE_LLI_COMPLETED_TIME" as the recurrence id saving point. + if ( CAL_SUCCESS!=calendar_svc_struct_set_lli(eventWrapperChild->getPlatformEvent(), + CAL_VALUE_LLI_COMPLETED_TIME, event->getEvent()->getRecurrenceId()) ) { ThrowMsg(PlatformException, "cannot save recurrence id"); } else { LogInfo("Saved the rid for the child: "<getEvent()->getRecurrenceId()); } if (CAL_SUCCESS!=calendar_svc_struct_set_int(eventWrapperChild->getPlatformEvent(), - CAL_VALUE_INT_REPEAT_TERM, CAL_REPEAT_NONE) ) { + CALS_VALUE_INT_RRULE_FREQ, CAL_REPEAT_NONE) ) { ThrowMsg(PlatformException, "cannot save exception event"); } int childId = calendar_svc_insert(eventWrapperChild->getPlatformEvent()); @@ -238,25 +235,10 @@ void Calendar::OnRequestReceived(const IEventUpdateEventPtr &event) ThrowMsg(PlatformException, "cannot save exception event"); } - GList* list = NULL; - cal_value *value = calendar_svc_value_new(CAL_VALUE_LST_EXCEPTION_DATE); - if (CAL_SUCCESS!=calendar_svc_value_set_time(value, CAL_VALUE_GMT_EXCEPTION_DATE_TIME, CAL_TZ_FLAG_GMT, event->getEvent()->getRecurrenceId()) ) { - ThrowMsg(PlatformException, "cannot save the exception date"); - } else { - LogInfo("Saved the exception date: "<getEvent()->getRecurrenceId()); - } - if (CAL_SUCCESS!=calendar_svc_value_set_int(value, CAL_VALUE_INT_EXCEPTION_DATE_ID, childId)) { - ThrowMsg(PlatformException, "cannot save the exception parent event"); - } else { - LogInfo("Saved the exception id: "<loadEvent(event->getEvent()->getId()); - calendar_svc_struct_get_list(eventWrapper->getPlatformEvent(), CAL_VALUE_LST_EXCEPTION_DATE, &list); - list = g_list_append(list, value); - if (CAL_SUCCESS!=calendar_svc_struct_store_list(eventWrapper->getPlatformEvent(), CAL_VALUE_LST_EXCEPTION_DATE, list)) { - ThrowMsg(PlatformException, "cannot save the exception parent event"); + int error = calendar_svc_event_delete_normal_instance(event->getEvent()->getId(), event->getEvent()->getRecurrenceId()); + if(error!=CAL_SUCCESS) { + ThrowMsg(PlatformException, "Can't delete the instance. Error code " << error); } - calendar_svc_update(eventWrapper->getPlatformEvent()); event->getEvent()->setIsDetached(true); } @@ -283,19 +265,19 @@ void Calendar::OnRequestReceived(const IEventUpdateEventsPtr &events) Try { if (events->getEvents()->empty()) { - ThrowMsg(NullPointerException, "Item vector is empty."); + ThrowMsg(NullPointerException, "Item array is empty."); + } + + int returnValue = calendar_svc_begin_trans(); + if(CAL_SUCCESS!=returnValue) { + ThrowMsg(PlatformException, "Begin transaction failed with error code: "<getEvents()->size(); i++) { - if (events->checkCancelled()) { - events->setCancelAllowed(true); - events->setResult(true); - return; - } - CalendarEventPtr thisEvent = events->getEvents()->at(i); if (!thisEvent->getIdIsSet()) { ThrowMsg(InvalidArgumentException, "Item id is not set."); @@ -326,12 +308,10 @@ void Calendar::OnRequestReceived(const IEventUpdateEventsPtr &events) } int detachedEventId = calendar_svc_struct_get_int(platformEvent, CAL_VALUE_INT_INDEX); - std::time_t detachedStartTime = calendar_svc_struct_get_time(platformEvent, - CAL_VALUE_GMT_START_DATE_TIME, - CAL_TZ_FLAG_GMT); - std::time_t detachedEndTime = calendar_svc_struct_get_time(platformEvent, - CAL_VALUE_GMT_END_DATE_TIME, - CAL_TZ_FLAG_GMT); + long long int detachedStartTime = calendar_svc_struct_get_lli(platformEvent, + CALS_VALUE_LLI_DTSTART_UTIME); + long long int detachedEndTime = calendar_svc_struct_get_lli(platformEvent, + CALS_VALUE_LLI_DTEND_UTIME); DPL::ScopedPtr eventWrapperChild(new EventWrapper(thisEvent, getType())); eventWrapperChild->convertAbstractEventToPlatformEvent(); @@ -340,15 +320,13 @@ void Calendar::OnRequestReceived(const IEventUpdateEventsPtr &events) detachedEventId)) { ThrowMsg(PlatformException, "Can't set event Id."); } - if (CAL_SUCCESS != calendar_svc_struct_set_time(eventWrapperChild->getPlatformEvent(), - CAL_VALUE_GMT_START_DATE_TIME, - CAL_TZ_FLAG_GMT, + if (CAL_SUCCESS != calendar_svc_struct_set_lli(eventWrapperChild->getPlatformEvent(), + CALS_VALUE_LLI_DTSTART_UTIME, detachedStartTime)) { ThrowMsg(PlatformException, "Can't set start time."); } - if (CAL_SUCCESS != calendar_svc_struct_set_time(eventWrapperChild->getPlatformEvent(), - CAL_VALUE_GMT_END_DATE_TIME, - CAL_TZ_FLAG_GMT, + if (CAL_SUCCESS != calendar_svc_struct_set_lli(eventWrapperChild->getPlatformEvent(), + CALS_VALUE_LLI_DTEND_UTIME, detachedEndTime)) { ThrowMsg(PlatformException, "Can't set end time."); } @@ -367,15 +345,15 @@ void Calendar::OnRequestReceived(const IEventUpdateEventsPtr &events) CAL_VALUE_INT_ORIGINAL_EVENT_ID, thisEvent->getId()) ) { ThrowMsg(PlatformException, "cannot save parent id."); } - // Use "CAL_VALUE_GMT_COMPLETED_DATE_TIME" as the recurrence id saving point. - if ( CAL_SUCCESS!=calendar_svc_struct_set_time(eventWrapperChild->getPlatformEvent(), - CAL_VALUE_GMT_COMPLETED_DATE_TIME, CAL_TZ_FLAG_GMT, thisEvent->getRecurrenceId()) ) { + // Use "CAL_VALUE_LLI_COMPLETED_TIME" as the recurrence id saving point. + if ( CAL_SUCCESS!=calendar_svc_struct_set_lli(eventWrapperChild->getPlatformEvent(), + CAL_VALUE_LLI_COMPLETED_TIME, thisEvent->getRecurrenceId()) ) { ThrowMsg(PlatformException, "cannot save recurrence id."); } else { LogInfo("Saved the rid for the child: "<getRecurrenceId()); } if (CAL_SUCCESS!=calendar_svc_struct_set_int(eventWrapperChild->getPlatformEvent(), - CAL_VALUE_INT_REPEAT_TERM, CAL_REPEAT_NONE) ) { + CALS_VALUE_INT_RRULE_FREQ, CAL_REPEAT_NONE) ) { ThrowMsg(PlatformException, "cannot save repeat term."); } int childId = calendar_svc_insert(eventWrapperChild->getPlatformEvent()); @@ -383,24 +361,10 @@ void Calendar::OnRequestReceived(const IEventUpdateEventsPtr &events) ThrowMsg(PlatformException, "cannot save exception event"); } - GList* list = NULL; - cal_value *value = calendar_svc_value_new(CAL_VALUE_LST_EXCEPTION_DATE); - if (CAL_SUCCESS!=calendar_svc_value_set_time(value, CAL_VALUE_GMT_EXCEPTION_DATE_TIME, CAL_TZ_FLAG_GMT, thisEvent->getRecurrenceId()) ) { - ThrowMsg(PlatformException, "cannot save the exception parent event"); - } else { - LogInfo("Saved the exception date: "<getRecurrenceId()); + int error = calendar_svc_event_delete_normal_instance(thisEvent->getId(), thisEvent->getRecurrenceId()); + if(error!=CAL_SUCCESS) { + ThrowMsg(PlatformException, "Can't delete the instance. Error code " << error); } - if (CAL_SUCCESS!=calendar_svc_value_set_int(value, CAL_VALUE_INT_EXCEPTION_DATE_ID, childId)) { - ThrowMsg(PlatformException, "cannot save the exception parent event"); - } else { - LogInfo("Saved the exception id: "<getPlatformEvent(), CAL_VALUE_LST_EXCEPTION_DATE, &list); - list = g_list_append(list, value); - if (CAL_SUCCESS!=calendar_svc_struct_store_list(eventWrapper->getPlatformEvent(), CAL_VALUE_LST_EXCEPTION_DATE, list)) { - ThrowMsg(PlatformException, "cannot save the exception parent event"); - } - calendar_svc_update(eventWrapper->getPlatformEvent()); thisEvent->setIsDetached(true); } @@ -413,8 +377,14 @@ void Calendar::OnRequestReceived(const IEventUpdateEventsPtr &events) if( false==failedUpdating ) { events->setResult(true); + + returnValue = calendar_svc_end_trans(true); + LogInfo("End transaction return value with true flag: "<setResult(false); + + returnValue = calendar_svc_end_trans(false); + LogInfo("End transaction return value with false flag: "<setCancelAllowed(false); } void Calendar::OnRequestReceived(const IEventDeleteEventPtr &event) @@ -447,7 +416,7 @@ void Calendar::OnRequestReceived(const IEventDeleteEventPtr &event) eventWrapper->getAbstractEvent()->setId(id); std::stringstream ss(event->getEventId()->getRecurrenceId()); - std::time_t rid; + long long int rid; ss>>rid; eventWrapper->getAbstractEvent()->setRecurrenceId(rid); @@ -489,7 +458,7 @@ void Calendar::OnRequestReceived(const IEventGetPtr &event) ss>>id; eventWrapper->loadEvent(id); - event->setItem(eventWrapper->convertPlatformEventToAbstractEvent()); + event->setItem(eventWrapper->getAbstractEvent()); event->setResult(true); } Catch (NotFoundException) @@ -512,10 +481,16 @@ void Calendar::OnRequestReceived(const IEventDeleteEventsPtr &events) Try { if (events->getEventIds()->empty()) { - ThrowMsg(NullPointerException, "event vector parameter is empty"); + ThrowMsg(NullPointerException, "Item id array is empty."); + } + + int returnValue = calendar_svc_begin_trans(); + if(CAL_SUCCESS!=returnValue) { + ThrowMsg(PlatformException, "Begin transaction failed with error code: "<getEventIds()->size(); i++) { @@ -527,7 +502,7 @@ void Calendar::OnRequestReceived(const IEventDeleteEventsPtr &events) eventWrapper->getAbstractEvent()->setId(id); std::stringstream ss(events->getEventIds()->at(i)->getRecurrenceId()); - std::time_t rid; + long long int rid; ss>>rid; eventWrapper->getAbstractEvent()->setRecurrenceId(rid); eventWrapper->convertAbstractEventToPlatformEvent(); @@ -549,9 +524,13 @@ void Calendar::OnRequestReceived(const IEventDeleteEventsPtr &events) if( false==failedDeleting ) { events->setResult(true); - } - else { + returnValue = calendar_svc_end_trans(true); + LogInfo("End transaction return value with true flag: "<setResult(false); + + returnValue = calendar_svc_end_trans(false); + LogInfo("End transaction return value with false flag: "<getPlatformEvent(), CAL_VALUE_GMT_COMPLETED_DATE_TIME, CAL_TZ_FLAG_GMT)); - event->getEvents()->at(i)->setRecurrenceId(calendar_svc_struct_get_time(eventWrapper->getPlatformEvent(), CAL_VALUE_GMT_COMPLETED_DATE_TIME, CAL_TZ_FLAG_GMT)); + LogInfo("Set the saved rid: "<getPlatformEvent(), CAL_VALUE_LLI_COMPLETED_TIME)); + event->getEvents()->at(i)->setRecurrenceId(calendar_svc_struct_get_lli(eventWrapper->getPlatformEvent(), CAL_VALUE_LLI_COMPLETED_TIME)); } } } @@ -728,28 +706,44 @@ static void eventChangedCb(void *user_data) // Determine the status of event change. cal_iter *iter = NULL; cal_struct *platformEvent = NULL; - int index; - int syncStatus; - - if( CAL_SUCCESS != calendar_svc_get_updated_event_list(thisCalendar->getAccountId(), - thisCalendar->getLastChangeFetchTime(), - &iter) ) { - ThrowMsg(PlatformException, "Can't get the updated event list."); + int id; + int type; + int version = 0; + int errorCode; + + int calendarId; + std::stringstream ss(thisCalendar->getId()); + ss>>calendarId; + + LogDebug("Getting items with calendar id: "<getLastChangedVersion()<<", type: "<getType()); + if (CalendarEvent::TASK_TYPE==thisCalendar->getType()) { + errorCode = calendar_svc_todo_get_changes(calendarId, + thisCalendar->getLastChangedVersion(), + &iter); + } else { + errorCode = calendar_svc_event_get_changes(calendarId, + thisCalendar->getLastChangedVersion(), + &iter); + } + if( CAL_SUCCESS!=errorCode ) { + ThrowMsg(PlatformException, "Can't get the updated event list. Error code: "<setStatus(OnEventsChanged::ON_ADD); - } else if ( CAL_SYNC_STATUS_UPDATED==syncStatus ) { + } else if ( CALS_UPDATED_TYPE_MODIFIED==type ) { eventPtr->setStatus(OnEventsChanged::ON_UPDATE); - } else if ( CAL_SYNC_STATUS_DELETED==syncStatus ) { + } else if ( CALS_UPDATED_TYPE_DELETED==type ) { eventPtr->setStatus(OnEventsChanged::ON_DELETE); } else { if( platformEvent ) { @@ -761,9 +755,9 @@ static void eventChangedCb(void *user_data) DPL::ScopedPtr eventWrapper(new EventWrapper(thisCalendar->getType())); Try { - eventWrapper->loadEvent(index); + eventWrapper->loadEvent(id); } Catch (NotFoundException){ - LogDebug("Handling deleted event with index: "<addEvent(eventWrapper->getAbstractEvent()); @@ -776,9 +770,8 @@ static void eventChangedCb(void *user_data) ThrowMsg(PlatformException, "Can't remove the iter."); } - std::time_t localTime = time(NULL); - thisCalendar->setLastChangeFetchTime(localTime); - LogInfo("Last change fetch time: "<getLastChangeFetchTime()); + thisCalendar->setLastChangedVersion(version); + LogInfo("Last change fetch version: "<getLastChangedVersion()); eventPtr->setResult(true); eventPtr->setCalendarType(thisCalendar->getType()); @@ -803,13 +796,18 @@ void Calendar::OnRequestReceived(const IEventWatchChangesPtr &event) // Subscribe the watch to the platform just once. if( m_changeEmitters.size()==0 ) { - if( CAL_SUCCESS!=calendar_svc_subscribe_change(eventChangedCb, this) ) { - ThrowMsg(PlatformException, "Can't subscribe the db change noti."); + if (CAL_SUCCESS!=calendar_svc_begin_trans() ) { + ThrowMsg(PlatformException, "Transaction failed."); } else { - // Save the last change fetch time to start watching. - std::time_t localTime = time(NULL); - setLastChangeFetchTime(localTime); - LogInfo("Last change fetch time: "<getWatchId()); - - if( m_changeEmitters.size()==0 ) { - if( CAL_SUCCESS!=calendar_svc_unsubscribe_change(eventChangedCb) ) { - ThrowMsg(PlatformException, "Can't unsubscribe the db change noti."); - } else { - LogDebug("Platform watch cleared successfully."); + if( m_changeEmitters.detach(event->getWatchId()) ) { + if( m_changeEmitters.size()==0 ) { + if( CAL_SUCCESS!=calendar_svc_unsubscribe_change(eventChangedCb) ) { + ThrowMsg(PlatformException, "Can't unsubscribe the db change noti."); + } else { + LogDebug("Platform watch cleared successfully."); + } } + event->setResult(true); + } else { + LogInfo("Wrong watch Id."); + event->setResult(false); } - event->setResult(true); } Catch (Exception) { @@ -853,8 +854,8 @@ void Calendar::OnRequestReceived(const IEventExpandEventRecurrencePtr &event) { LogDebug("entered"); const CalendarEventPtr calEvent = event->getEvent(); - const std::time_t startDate = event->getStartDate(); - const std::time_t endDate = event->getEndDate(); + const long long int startDate = event->getStartDate(); + const long long int endDate = event->getEndDate(); event->setResult(true); Try { @@ -863,31 +864,52 @@ void Calendar::OnRequestReceived(const IEventExpandEventRecurrencePtr &event) ThrowMsg(PlatformException, "This is not a recurring event."); } - std::time_t nextStartTime = 0; - std::time_t nextEndTime = 0; - DPL::ScopedPtr eventWrapper(new EventWrapper(CalendarEvent::EVENT_TYPE)); // We must load the event from the DB in order to get the auto-calculated repeat end time. - eventWrapper->loadEvent(event->getEvent()->getId()); - //eventWrapper->displayPlatformEvent(); + eventWrapper->loadEvent(calEvent->getId()); - while ( CAL_SUCCESS==calendar_svc_util_next_valid_event(eventWrapper->getPlatformEvent(), startDate, endDate, &nextStartTime, &nextEndTime) ) + cal_iter *iter = NULL; + cal_struct *cs; + int candidateIndex; + long long int dtstart, dtend; + int calendarId; + std::stringstream ss(getId()); + ss>>calendarId; + + int returnVal = calendar_svc_event_get_normal_list_by_period(calendarId, CALS_LIST_PERIOD_NORMAL_BASIC, startDate, endDate, &iter); + if( CAL_SUCCESS!=returnVal ) { + ThrowMsg(PlatformException, "Getting event instances failed due to "< recurringEventWrapper(new EventWrapper(getType())); - recurringEventWrapper->loadEvent(calEvent->getId()); + cs = NULL; + returnVal = calendar_svc_iter_get_info(iter, &cs); + if( CAL_SUCCESS!=returnVal ){ + LogDebug("Iterator get info failed due to "<getAbstractEvent()->setRecurrenceId(nextStartTime); - recurringEventWrapper->getAbstractEvent()->setStartTime(nextStartTime); - recurringEventWrapper->getAbstractEvent()->setEndTime(nextEndTime); + candidateIndex = calendar_svc_struct_get_int(cs, CALS_LIST_PERIOD_NORMAL_BASIC_INT_EVENTID); + if(candidateIndex==calEvent->getId()) { + DPL::ScopedPtr recurringEventWrapper(new EventWrapper(getType())); + recurringEventWrapper->loadEvent(calEvent->getId()); - event->addExpandedEvent(recurringEventWrapper->getAbstractEvent()); + // Set distintive attributes of each instance. + dtstart = calendar_svc_struct_get_lli(cs, CALS_LIST_PERIOD_NORMAL_BASIC_LLI_DTSTART_UTIME); + dtend = calendar_svc_struct_get_lli(cs, CALS_LIST_PERIOD_NORMAL_BASIC_LLI_DTEND_UTIME); + recurringEventWrapper->getAbstractEvent()->setRecurrenceId(dtstart); + recurringEventWrapper->getAbstractEvent()->setStartTime(dtstart); + recurringEventWrapper->getAbstractEvent()->setEndTime(dtend); + LogInfo("Found a valid event instance with dtstart: "<addExpandedEvent(recurringEventWrapper->getAbstractEvent()); + } } LogInfo("Length of expanded events from parent: "<getExpandedEventList()->size()); // Consider the detached events also. - cal_iter *iter = NULL; + iter = NULL; cal_struct *platformEvent = NULL; int parentId = event->getEvent()->getId(); if(CAL_SUCCESS != calendar_svc_find_event_list(getAccountId(), CAL_VALUE_INT_ORIGINAL_EVENT_ID, (void*) parentId, &iter)) { @@ -901,8 +923,8 @@ void Calendar::OnRequestReceived(const IEventExpandEventRecurrencePtr &event) } int detachedEventId = calendar_svc_struct_get_int(platformEvent, CAL_VALUE_INT_INDEX); - std::time_t detachedStartTime = calendar_svc_struct_get_time(platformEvent, CAL_VALUE_GMT_START_DATE_TIME, CAL_TZ_FLAG_GMT); - std::time_t detachedEndTime = calendar_svc_struct_get_time(platformEvent, CAL_VALUE_GMT_END_DATE_TIME, CAL_TZ_FLAG_GMT); + long long int detachedStartTime = calendar_svc_struct_get_lli(platformEvent, CALS_VALUE_LLI_DTSTART_UTIME); + long long int detachedEndTime = calendar_svc_struct_get_lli(platformEvent, CALS_VALUE_LLI_DTEND_UTIME); if (detachedStartTime>=startDate && detachedStartTime<=endDate) { LogInfo("Found a valid detached event: "< detachedEventWrapper(new EventWrapper(getType()));