Fixed remove instance and example
authorHosang Kim <hosang.kim@samsung.com>
Fri, 29 Mar 2013 04:02:38 +0000 (13:02 +0900)
committerHosang Kim <hosang.kim@samsung.com>
Fri, 29 Mar 2013 04:02:38 +0000 (13:02 +0900)
Change-Id: Ib37553322d2e77304109886b5cb1f074ab18c26a
Signed-off-by: Hosang Kim <hosang.kim@samsung.com>
inc/FSclCalendarbook.h
src/FScl_CalendarbookImpl.cpp

index 5d0abfc..65551f3 100644 (file)
@@ -1037,6 +1037,7 @@ public:
                        }\r
 \r
                        // Sets the start time and end time\r
+                       pEvent->SetRecurrence(null);\r
                        pEvent->SetStartAndEndTime(eventInstance.GetStartTime(), eventInstance.GetEndTime());\r
 \r
                        // Modifies the properties\r
index e8fe678..3b8abdc 100644 (file)
@@ -1304,31 +1304,30 @@ _CalendarbookImpl::RemoveEventInstance(const CalEventInstance& eventInstance)
        {
                errorCode = calendar_db_delete_record(_calendar_event._uri, eventInstance.GetOriginalEventId());
                SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
-
-               errorCode = calendar_db_get_record(_calendar_event._uri, baseEventId, &eventHandle);
-               SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
-               eventRecord.ResetHandle(eventHandle);
        }
+       else
+       {
+               // Append exdate
+               errorCode = calendar_record_get_str_p(eventHandle, _calendar_event.exdate, &pExdate);
 
-       // Append exdate
-       errorCode = calendar_record_get_str_p(eventHandle, _calendar_event.exdate, &pExdate);
+               String exdate;
+               if (pExdate != null && strlen(pExdate) > 0)
+               {
+                       exdate.Append(pExdate);
+                       r = exdate.Append(_RECURRENCE_DELIMITER);
+               }
 
-       String exdate;
-       if (pExdate != null && strlen(pExdate) > 0)
-       {
-               exdate.Append(pExdate);
-               r = exdate.Append(_RECURRENCE_DELIMITER);
-       }
+               r = exdate.Append(_CalendarbookUtil::ConvertDateTimeToRRuleDateTimeString(eventInstance.GetStartTime(), eventInstance.IsAllDayEvent()));
 
-       r = exdate.Append(_CalendarbookUtil::ConvertDateTimeToRRuleDateTimeString(eventInstance.GetStartTime(), eventInstance.IsAllDayEvent()));
+               std::unique_ptr<char[]> pAppendedExdate(_StringConverter::CopyToCharArrayN(exdate));
+               SysTryReturnResult(NID_SCL, pAppendedExdate != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
-       std::unique_ptr<char[]> pAppendedExdate(_StringConverter::CopyToCharArrayN(exdate));
-       SysTryReturnResult(NID_SCL, pAppendedExdate != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
-       errorCode = calendar_record_set_str(eventHandle, _calendar_event.exdate, pAppendedExdate.get());
+               errorCode = calendar_record_set_str(eventHandle, _calendar_event.exdate, pAppendedExdate.get());
 
-       // Update event handle
-       errorCode = calendar_db_update_record(eventHandle);
-       SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
+               // Update event handle
+               errorCode = calendar_db_update_record(eventHandle);
+               SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_SYSTEM, "A system error has been occurred.");
+       }
 
        return E_SUCCESS;
 }