From: SungWan Kim Date: Wed, 20 Mar 2013 06:44:25 +0000 (+0900) Subject: Add new appcontrol operations. X-Git-Tag: 2.1_release~39 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c3930e1e0fdf81cdbb7601594d498c893b75f3b1;p=apps%2Fosp%2FCalendar.git Add new appcontrol operations. Change-Id: Ie9fd9ec57318cf8efe190b3894f5352619fb5dd3 Signed-off-by: SungWan Kim --- diff --git a/inc/ClCalendarApp.h b/inc/ClCalendarApp.h index 29dcbea..2bff3af 100644 --- a/inc/ClCalendarApp.h +++ b/inc/ClCalendarApp.h @@ -36,8 +36,10 @@ class CalendarApp public: const Tizen::Base::String* GetArgument(const Tizen::Base::String& key) const; const Tizen::Base::String& GetInitialScene(void) const; + const Tizen::Base::String& GetMimeType(void) const; OperationType GetOperationType(void) const; RequestId GetRequestId(void) const; + const Tizen::Base::String& GetUri(void) const; void AddCalendarAppStatusChangedEventListener(ICalendarAppStatusChangedEventListener& listener); void RemoveCalendarAppStatusChangedEventListener(ICalendarAppStatusChangedEventListener& listener); diff --git a/inc/ClTypes.h b/inc/ClTypes.h index 7ca6755..8fc35fb 100644 --- a/inc/ClTypes.h +++ b/inc/ClTypes.h @@ -234,13 +234,30 @@ extern const wchar_t* ID_OPERATION_MAIN; extern const wchar_t* ID_OPERATION_PICK; extern const wchar_t* ID_OPERATION_VIEW; +extern const wchar_t* ID_OPERATION_SOCIAL_EDIT; +extern const wchar_t* ID_OPERATION_SOCIAL_PICK; +extern const wchar_t* ID_OPERATION_SOCIAL_VIEW; + +extern const wchar_t* MIME_TYPE_VCALENDAR; + extern const wchar_t* KEY_CALENDAR_EVENT_ID; extern const wchar_t* KEY_CALENDAR_TODO_ID; +extern const wchar_t* KEY_CALENDAR_ITEM_ID; extern const wchar_t* KEY_CALENDAR_ITEM_TYPE; extern const wchar_t* KEY_CALENDAR_VIEW_TYPE; extern const wchar_t* KEY_CALENDAR_SELECTION_MODE; extern const wchar_t* KEY_CALENDAR_PATH; + +extern const wchar_t* KEY_DATA_PATH; +extern const wchar_t* KEY_DATA_SELECTION_MODE; +extern const wchar_t* KEY_DATA_RETURN_RESULT; + +extern const wchar_t* KEY_SOCIAL_ITEM_ID; +extern const wchar_t* KEY_SOCIAL_ITEM_TYPE; +extern const wchar_t* KEY_SOCIAL_RESULT_TYPE; + extern const wchar_t* KEY_NOTIFICATION_MANAGER_APP_MESSAGE; +extern const wchar_t* KEY_DATA_RETURN_RESULT; extern const wchar_t* KEY_SYSTEM_24_HOUR_NOTATION_ENABLED; extern const wchar_t* KEY_SYSTEM_COUNTRY; extern const wchar_t* KEY_SYSTEM_FIRST_DAY_OF_WEEK; @@ -254,13 +271,19 @@ extern const wchar_t* VALUE_CALENDAR_VCS_TYPE; extern const wchar_t* VALUE_CALENDAR_SINGLE_SELECTION_MODE; extern const wchar_t* VALUE_CALENDAR_MULTIPLE_SELECTION_MODE; +extern const wchar_t* VALUE_SOCIAL_ITEM_ID; + extern const wchar_t* VCS_EXPORT_PATH; // enums enum OperationType { - OPERATION_TYPE_DEFAULT, - OPERATION_TYPE_APPCONTROL + OPERATION_TYPE_MAIN, + OPERATION_TYPE_2_0_APPCONTROL, + OPERATION_TYPE_VIEW, + OPERATION_TYPE_PICK, + OPERATION_TYPE_EDIT, + OPERATION_TYPE_ADD }; enum EventItemStyle diff --git a/src/ClCalendarApp.cpp b/src/ClCalendarApp.cpp index b6d210d..7511412 100644 --- a/src/ClCalendarApp.cpp +++ b/src/ClCalendarApp.cpp @@ -70,7 +70,7 @@ CheckVcsFileValidation(String& vcsFilePath) CalendarApp::CalendarApp(void) - : __type(OPERATION_TYPE_DEFAULT) + : __type(OPERATION_TYPE_MAIN) , __requestId(INVALID_REQUEST_ID) , __initialScene(IDSCN_MONTH) , __pArgs(null) @@ -133,6 +133,12 @@ CalendarApp::GetInitialScene(void) const return __initialScene; } +const String& +CalendarApp::GetMimeType(void) const +{ + return __mimeType; +} + OperationType CalendarApp::GetOperationType(void) const { @@ -145,6 +151,12 @@ CalendarApp::GetRequestId(void) const return __requestId; } +const String& +CalendarApp::GetUri(void) const +{ + return __uriScheme; +} + void CalendarApp::AddCalendarAppStatusChangedEventListener(ICalendarAppStatusChangedEventListener& listener) { @@ -163,9 +175,6 @@ CalendarApp::OnAppInitializing(AppRegistry& appRegistry) // Set AppControl Provider AppControlProviderManager::GetInstance()->SetAppControlProviderEventListener(this); - // Set SettingInfo event listener - SettingInfo::AddSettingEventListener(*this); - return true; } @@ -180,6 +189,12 @@ CalendarApp::OnAppInitialized(void) AddFrame(*pMainFrame); + if (__type == OPERATION_TYPE_MAIN) + { + // Set SettingInfo event listener + SettingInfo::AddSettingEventListener(*this); + } + return true; } @@ -260,13 +275,13 @@ CalendarApp::OnAppControlRequestReceived(RequestId reqId, const String& operatio if (pItemType->Equals(VALUE_CALENDAR_EVENT_TYPE, false) == true) { __initialScene = IDSCN_EVENT_SELECTOR; - __type = OPERATION_TYPE_APPCONTROL; + __type = OPERATION_TYPE_2_0_APPCONTROL; requestFailed = false; } else if (pItemType->Equals(VALUE_CALENDAR_TODO_TYPE, false) == true) { __initialScene = IDSCN_TASK_SELECTOR; - __type = OPERATION_TYPE_APPCONTROL; + __type = OPERATION_TYPE_2_0_APPCONTROL; requestFailed = false; } } @@ -279,13 +294,13 @@ CalendarApp::OnAppControlRequestReceived(RequestId reqId, const String& operatio if (pViewType->Equals(VALUE_CALENDAR_EVENT_TYPE, false) == true) { __initialScene = IDSCN_EVENT_DETAILS; - __type = OPERATION_TYPE_APPCONTROL; + __type = OPERATION_TYPE_2_0_APPCONTROL; requestFailed = false; } else if (pViewType->Equals(VALUE_CALENDAR_TODO_TYPE, false) == true) { __initialScene = IDSCN_TASK_DETAILS; - __type = OPERATION_TYPE_APPCONTROL; + __type = OPERATION_TYPE_2_0_APPCONTROL; requestFailed = false; } else if (pViewType->Equals(VALUE_CALENDAR_VCS_TYPE, false) == true) @@ -297,23 +312,90 @@ CalendarApp::OnAppControlRequestReceived(RequestId reqId, const String& operatio if (vcsType != VCS_TYPE_NOT_VCS_FILE) { __initialScene = (vcsType == VCS_TYPE_VEVENT) ? IDSCN_EVENT_DETAILS : IDSCN_TASK_DETAILS; - __type = OPERATION_TYPE_APPCONTROL; + __type = OPERATION_TYPE_2_0_APPCONTROL; requestFailed = false; } } } } + else if (__mimeType == MIME_TYPE_VCALENDAR) + { + VcsType vcsType = CheckVcsFileValidation(__uriScheme); + if (vcsType != VCS_TYPE_NOT_VCS_FILE) + { + __initialScene = (vcsType == VCS_TYPE_VEVENT) ? IDSCN_EVENT_DETAILS : IDSCN_TASK_DETAILS; + __type = OPERATION_TYPE_VIEW; + requestFailed = false; + } + } + } + else if (operationId == ID_OPERATION_SOCIAL_PICK) + { + const String* pItemType = GetArgument(KEY_SOCIAL_ITEM_TYPE); + if (pItemType != null) + { + if (pItemType->Equals(VALUE_CALENDAR_EVENT_TYPE, false) == true) + { + __initialScene = IDSCN_EVENT_SELECTOR; + __type = OPERATION_TYPE_PICK; + requestFailed = false; + } + else if (pItemType->Equals(VALUE_CALENDAR_TODO_TYPE, false) == true) + { + __initialScene = IDSCN_TASK_SELECTOR; + __type = OPERATION_TYPE_PICK; + requestFailed = false; + } + } + } + else if (operationId == ID_OPERATION_SOCIAL_VIEW) + { + const String* pItemType = GetArgument(KEY_SOCIAL_ITEM_TYPE); + if (pItemType != null) + { + if (pItemType->Equals(VALUE_CALENDAR_EVENT_TYPE, false) == true) + { + __initialScene = IDSCN_EVENT_DETAILS; + __type = OPERATION_TYPE_VIEW; + requestFailed = false; + } + else if (pItemType->Equals(VALUE_CALENDAR_TODO_TYPE, false) == true) + { + __initialScene = IDSCN_TASK_DETAILS; + __type = OPERATION_TYPE_VIEW; + requestFailed = false; + } + } + } + else if (operationId == ID_OPERATION_SOCIAL_EDIT) + { + const String* pItemType = GetArgument(KEY_SOCIAL_ITEM_TYPE); + if (pItemType != null) + { + if (pItemType->Equals(VALUE_CALENDAR_EVENT_TYPE, false) == true) + { + __initialScene = IDSCN_EVENT_EDITOR; + __type = OPERATION_TYPE_EDIT; + requestFailed = false; + } +// else if (pItemType->Equals(VALUE_CALENDAR_TODO_TYPE, false) == true) +// { +// __initialScene = IDSCN_TASK_EDITOR; +// __type = OPERATION_TYPE_EDIT; +// requestFailed = false; +// } + } } else if (operationId == ID_OPERATION_ADD) { __initialScene = IDSCN_EVENT_EDITOR; - __type = OPERATION_TYPE_APPCONTROL; + __type = OPERATION_TYPE_ADD; requestFailed = false; } else if (operationId == ID_OPERATION_CONFIG) { __initialScene = IDSCN_SETTING; - __type = OPERATION_TYPE_APPCONTROL; + __type = OPERATION_TYPE_2_0_APPCONTROL; requestFailed = false; } @@ -332,7 +414,7 @@ CalendarApp::OnSettingChanged(String& key) || key.Equals(KEY_SYSTEM_COUNTRY, false) == true || key.Equals(KEY_SYSTEM_TIME_ZONE, false) == true) { - if (__type == OPERATION_TYPE_APPCONTROL) + if (__type != OPERATION_TYPE_MAIN) { result r = AppControlProviderManager::GetInstance()->SendAppControlResult(__requestId, APP_CTRL_RESULT_TERMINATED, null); AppLogDebugIf(r != E_SUCCESS, "[%s] Unable to return result.", GetErrorMessage(r)); diff --git a/src/ClEventDetailsForm.cpp b/src/ClEventDetailsForm.cpp index 68bfbf9..d31601f 100644 --- a/src/ClEventDetailsForm.cpp +++ b/src/ClEventDetailsForm.cpp @@ -231,7 +231,7 @@ EventDetailsForm::OnFormBackRequested(Form& source) CalendarApp* pApp = static_cast(UiApp::GetInstance()); if (pApp != null) { - if (pApp->GetOperationType() == OPERATION_TYPE_APPCONTROL) + if (pApp->GetOperationType() != OPERATION_TYPE_MAIN) { // result r = SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED); // AppLogDebugIf(r != E_SUCCESS, "[%s] Unable to return result.", GetErrorMessage(r)); @@ -383,7 +383,7 @@ void EventDetailsForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs) { CalendarApp* pApp = static_cast(UiApp::GetInstance()); - if (pApp->GetOperationType() == OPERATION_TYPE_DEFAULT) + if (pApp->GetOperationType() == OPERATION_TYPE_MAIN) { if (pArgs != null) { @@ -429,53 +429,105 @@ EventDetailsForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneI //AppControl result r = E_SUCCESS; + const String* pViewType = null; + const String* pItemType = null; const String* pParseId = null; const String* pPath = null; RecordId eventId = INVALID_RECORD_ID; - const String* pViewType = pApp->GetArgument(KEY_CALENDAR_VIEW_TYPE); - TryCatch(pViewType != null, , "[E_FAILURE] Unable to get viewtype."); - - if (pViewType->Equals(VALUE_CALENDAR_VCS_TYPE, false) == true) + if (pApp->GetOperationType() == OPERATION_TYPE_2_0_APPCONTROL) { - pPath = pApp->GetArgument(KEY_CALENDAR_PATH); - r = __pPm->SetVcsFile(*pPath); - TryCatch(r == E_SUCCESS, , "[E_FAILURE] Unable to parse events from vcs file."); + pViewType = pApp->GetArgument(KEY_CALENDAR_VIEW_TYPE); + TryCatch(pViewType != null, , "[E_FAILURE] Unable to get view type."); - if (GetFooter() != null) + if (pViewType->Equals(VALUE_CALENDAR_VCS_TYPE, false) == true) { - Footer* pFooter = GetFooter(); - pFooter->RemoveAllItems(); - pFooter->RemoveAllButtons(); - pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT); - pFooter->SetBackButtonEnabled(true); - pFooter->SetBackButton(); - - FooterItem item; - item.Construct(IDA_EVENT_DETAILS_FORM_ADD_TO_CALENDAR); - item.SetText(ResourceManager::GetString(IDS_EMAIL_OPT_ADD_TO_CALENDAR)); - pFooter->AddItem(item); + pPath = pApp->GetArgument(KEY_CALENDAR_PATH); + TryCatch(pPath != null, , "[E_FAILURE] Unable to get path."); + + r = __pPm->SetVcsFile(*pPath); + TryCatch(r == E_SUCCESS, , "[E_FAILURE] Unable to parse events from vcs file."); + + if (GetFooter() != null) + { + Footer* pFooter = GetFooter(); + pFooter->RemoveAllItems(); + pFooter->RemoveAllButtons(); + pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT); + pFooter->SetBackButtonEnabled(true); + pFooter->SetBackButton(); + + FooterItem item; + item.Construct(IDA_EVENT_DETAILS_FORM_ADD_TO_CALENDAR); + item.SetText(ResourceManager::GetString(IDS_EMAIL_OPT_ADD_TO_CALENDAR)); + pFooter->AddItem(item); + } + return; + } + else if (pViewType->Equals(VALUE_CALENDAR_EVENT_TYPE, false) == true) + { + pParseId = pApp->GetArgument(KEY_CALENDAR_EVENT_ID); + TryCatch(pParseId != null, , "[E_FAILURE] Unable to get eventid."); + + r = Integer::Parse(*pParseId, eventId); + TryCatch(r == E_SUCCESS, , "[%s] Unable to get eventid.", GetErrorMessage(r)); + + r = __pPm->SetEventId(eventId); + TryCatch(r == E_SUCCESS, , "[%s] Unable to get event.", GetErrorMessage(r)); + + if (GetFooter() != null) + { + GetFooter()->RemoveButtonAt(BUTTON_POSITION_LEFT); + GetFooter()->RemoveAllItems(); + } + return; } - return; } - else if (pViewType->Equals(VALUE_CALENDAR_EVENT_TYPE, false) == true) + else { - pParseId = pApp->GetArgument(KEY_CALENDAR_EVENT_ID); - TryCatch(pParseId != null, , "[E_FAILURE] Unable to get eventid."); + pItemType = pApp->GetArgument(KEY_SOCIAL_ITEM_TYPE); + if (pItemType != null) + { + pParseId = pApp->GetArgument(KEY_SOCIAL_ITEM_ID); + TryCatch(pParseId != null, , "[E_FAILURE] Unable to get eventid."); - r = Integer::Parse(*pParseId, eventId); - TryCatch(r == E_SUCCESS, , "[%s] Unable to get eventid.", GetErrorMessage(r)); + r = Integer::Parse(*pParseId, eventId); + TryCatch(r == E_SUCCESS, , "[%s] Unable to get eventid.", GetErrorMessage(r)); - r = __pPm->SetEventId(eventId); - TryCatch(r == E_SUCCESS, , "[%s] Unable to get event.", GetErrorMessage(r)); + r = __pPm->SetEventId(eventId); + TryCatch(r == E_SUCCESS, , "[%s] Unable to get event.", GetErrorMessage(r)); - if (GetFooter() != null) + if (GetFooter() != null) + { + GetFooter()->RemoveButtonAt(BUTTON_POSITION_LEFT); + GetFooter()->RemoveAllItems(); + } + return; + } + else if (pApp->GetMimeType() == MIME_TYPE_VCALENDAR) { - GetFooter()->RemoveButtonAt(BUTTON_POSITION_LEFT); - GetFooter()->RemoveAllItems(); + r = __pPm->SetVcsFile(pApp->GetUri()); + TryCatch(r == E_SUCCESS, , "[E_FAILURE] Unable to parse events from vcs file."); + + if (GetFooter() != null) + { + Footer* pFooter = GetFooter(); + pFooter->RemoveAllItems(); + pFooter->RemoveAllButtons(); + pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT); + pFooter->SetBackButtonEnabled(true); + pFooter->SetBackButton(); + + FooterItem item; + item.Construct(IDA_EVENT_DETAILS_FORM_ADD_TO_CALENDAR); + item.SetText(ResourceManager::GetString(IDS_EMAIL_OPT_ADD_TO_CALENDAR)); + pFooter->AddItem(item); + } + return; } - return; } + AppLogDebug("[E_FAILURE] Invalid arguments."); + CATCH: SendAppControlResult(APP_CTRL_RESULT_FAILED); UiApp::GetInstance()->Terminate(); diff --git a/src/ClEventEditorForm.cpp b/src/ClEventEditorForm.cpp index ff7dc16..3fd7a24 100644 --- a/src/ClEventEditorForm.cpp +++ b/src/ClEventEditorForm.cpp @@ -202,10 +202,14 @@ EventEditorForm::OnFormBackRequested(Form& source) CalendarApp* pApp = static_cast(UiApp::GetInstance()); if (pApp != null) { - if (pApp->GetOperationType() == OPERATION_TYPE_APPCONTROL) + if (pApp->GetOperationType() != OPERATION_TYPE_MAIN) { - result r = SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED); - AppLogDebugIf(r != E_SUCCESS, "[%s] Unable to return result.", GetErrorMessage(r)); + const String* pReturnResult = pApp->GetArgument(KEY_DATA_RETURN_RESULT); + if (pReturnResult != null && pReturnResult->Equals(L"true", false) == true) + { + result r = SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED); + AppLogDebugIf(r != E_SUCCESS, "[%s] Unable to return result.", GetErrorMessage(r)); + } pApp->Terminate(); return; @@ -831,7 +835,7 @@ EventEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId else { CalendarApp* pApp = static_cast(UiApp::GetInstance()); - if (pApp->GetOperationType() == OPERATION_TYPE_DEFAULT) + if (pApp->GetOperationType() == OPERATION_TYPE_MAIN) { if (pArgs != null) { @@ -890,20 +894,52 @@ EventEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId else { //AppControl - DateTime start; - SystemTime::GetCurrentTime(TIME_MODE_WALL, start); - start.AddHours(1); - start.AddMinutes(-start.GetMinute()); - start.AddSeconds(-start.GetSecond()); + CalendarApp* pApp = static_cast(UiApp::GetInstance()); + if (pApp->GetOperationType() == OPERATION_TYPE_EDIT) + { + const String* pItemType = pApp->GetArgument(KEY_SOCIAL_ITEM_TYPE); + const String* pEventId = pApp->GetArgument(KEY_SOCIAL_ITEM_ID); + if (pItemType != null && pItemType->Equals(VALUE_CALENDAR_EVENT_TYPE, false) == true && pEventId != null) + { + RecordId eventId = INVALID_RECORD_ID; + Integer::Parse(*pEventId, eventId); + result r = __pPm->SetEventId(eventId); + if (r != E_SUCCESS) + { + if (pArgs != null) + { + pArgs->RemoveAll(true); + delete pArgs; + } - DateTime end = start; - end.AddHours(1); - __pPm->SetStartEndTime(start, end); + const String* pReturnResult = pApp->GetArgument(KEY_DATA_RETURN_RESULT); + if (pReturnResult != null && pReturnResult->Equals(L"true", false) == true) + { + r = SendAppControlResult(APP_CTRL_RESULT_FAILED); + AppLogDebugIf(r != E_SUCCESS, "[%s] Unable to return result.", GetErrorMessage(r)); + } - SetStyle(EDIT_EVENT_FORM_STYLE_CREATE); - if (__pEditFieldTitle != null) + pApp->Terminate(); + } + } + } + else if (pApp->GetOperationType() == OPERATION_TYPE_ADD) { - __pEditFieldTitle->SetFocus(); + DateTime start; + SystemTime::GetCurrentTime(TIME_MODE_WALL, start); + start.AddHours(1); + start.AddMinutes(-start.GetMinute()); + start.AddSeconds(-start.GetSecond()); + + DateTime end = start; + end.AddHours(1); + __pPm->SetStartEndTime(start, end); + + SetStyle(EDIT_EVENT_FORM_STYLE_CREATE); + if (__pEditFieldTitle != null) + { + __pEditFieldTitle->SetFocus(); + } } } } @@ -939,10 +975,14 @@ EventEditorForm::OnActionPerformed(const Control& source, int actionId) CalendarApp* pApp = static_cast(UiApp::GetInstance()); if (pApp != null) { - if (pApp->GetOperationType() == OPERATION_TYPE_APPCONTROL) + if (pApp->GetOperationType() != OPERATION_TYPE_MAIN) { - result r = SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED); - AppLogDebugIf(r != E_SUCCESS, "[%s] Unable to return result.", GetErrorMessage(r)); + const String* pReturnResult = pApp->GetArgument(KEY_DATA_RETURN_RESULT); + if (pReturnResult != null && pReturnResult->Equals(L"true", false) == true) + { + result r = SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED); + AppLogDebugIf(r != E_SUCCESS, "[%s] Unable to return result.", GetErrorMessage(r)); + } pApp->Terminate(); AppLogDebug("Exit."); diff --git a/src/ClEventSelectorForm.cpp b/src/ClEventSelectorForm.cpp index 5d9d79b..3a6ee1b 100644 --- a/src/ClEventSelectorForm.cpp +++ b/src/ClEventSelectorForm.cpp @@ -222,10 +222,18 @@ EventSelectorForm::OnSceneActivatedN(const SceneId& previousSceneId, const Scene delete pArgs; } - const String* pSelectionMode = static_cast(UiApp::GetInstance())->GetArgument(KEY_CALENDAR_SELECTION_MODE); - const String* pItemType = static_cast(UiApp::GetInstance())->GetArgument(KEY_CALENDAR_ITEM_TYPE); - if (pSelectionMode != null && pItemType != null && pItemType->Equals(VALUE_CALENDAR_EVENT_TYPE, false) == true) + CalendarApp* pApp = static_cast(UiApp::GetInstance()); + const String* pSelectionMode = null; + const String* pItemType = null; + if (pApp->GetOperationType() == OPERATION_TYPE_2_0_APPCONTROL) { + pSelectionMode = pApp->GetArgument(KEY_CALENDAR_SELECTION_MODE); + TryCatch(pSelectionMode != null, , "[E_FAILURE] Unable to get selection mode."); + + pItemType = pApp->GetArgument(KEY_CALENDAR_ITEM_TYPE); + TryCatch(pItemType != null, , "[E_FAILURE] Unable to get item type."); + TryCatch(pItemType->Equals(VALUE_CALENDAR_EVENT_TYPE, false) == true, , "[E_FAILURE] Invalid item type."); + if (pSelectionMode->Equals(VALUE_CALENDAR_MULTIPLE_SELECTION_MODE, false) == true) { __selectionType = EVENT_SELECTOR_FORM_SELECTION_TYPE_MULTIPLE; @@ -244,7 +252,31 @@ EventSelectorForm::OnSceneActivatedN(const SceneId& previousSceneId, const Scene return; } } + else + { + pSelectionMode = pApp->GetArgument(KEY_DATA_SELECTION_MODE); + if (pSelectionMode != null && pSelectionMode->Equals(VALUE_CALENDAR_MULTIPLE_SELECTION_MODE, false) == true) + { + __selectionType = EVENT_SELECTOR_FORM_SELECTION_TYPE_MULTIPLE; + } + + TryCatch(pApp->GetArgument(KEY_SOCIAL_RESULT_TYPE) != null, , "[E_FAILURE] Unable to get result type."); + + pItemType = pApp->GetArgument(KEY_SOCIAL_ITEM_TYPE); + TryCatch(pItemType != null, , "[E_FAILURE] Unable to get item type."); + TryCatch(pItemType->Equals(VALUE_CALENDAR_EVENT_TYPE, false) == true, , "[E_FAILURE] Invalid item type."); + + if (__selectionType == EVENT_SELECTOR_FORM_SELECTION_TYPE_SINGLE) + { + GetFooter()->RemoveAllItems(); + } + LoadAllEvents(); + __pListViewContents->UpdateList(); + return; + } + +CATCH: SendAppControlResult(APP_CTRL_RESULT_FAILED); UiApp::GetInstance()->Terminate(); } @@ -380,11 +412,44 @@ EventSelectorForm::SendAppControlResult(AppCtrlResult appControlResult, const IL { pArgs = new (std::nothrow) HashMap(); pArgs->Construct(2); - pArgs->Add(new (std::nothrow) String(KEY_CALENDAR_ITEM_TYPE), new (std::nothrow) String(VALUE_CALENDAR_EVENT_TYPE)); + if (pApp->GetOperationType() == OPERATION_TYPE_2_0_APPCONTROL) + { + pArgs->Add(new (std::nothrow) String(KEY_CALENDAR_ITEM_TYPE), new (std::nothrow) String(VALUE_CALENDAR_EVENT_TYPE)); - String* pPath = new (std::nothrow) String(CalendarApp::GetExportVcsFilePath()); - __pCalendarbook->ExportEventsToVcalendar(*pResultList, *pPath); - pArgs->Add(new (std::nothrow) String(KEY_CALENDAR_PATH), pPath); + String* pPath = new (std::nothrow) String(CalendarApp::GetExportVcsFilePath()); + __pCalendarbook->ExportEventsToVcalendar(*pResultList, *pPath); + pArgs->Add(new (std::nothrow) String(KEY_CALENDAR_PATH), pPath); + } + else + { + const String* pResultType = pApp->GetArgument(KEY_SOCIAL_RESULT_TYPE); + if (pResultType != null && *pResultType == VALUE_SOCIAL_ITEM_ID) + { + const String* pSelectionMode = pApp->GetArgument(KEY_DATA_SELECTION_MODE); + if (pSelectionMode != null && pSelectionMode->Equals(VALUE_CALENDAR_MULTIPLE_SELECTION_MODE, false) == true) + { + int itemCount = pResultList->GetCount(); + ArrayList* pEvents = new (std::nothrow) ArrayList(); + pEvents->Construct(itemCount); + for (int i = 0; i < itemCount; ++i) + { + pEvents->Add(new (std::nothrow) String(Integer::ToString(static_cast(pResultList->GetAt(i))->GetRecordId()))); + } + pArgs->Add(new (std::nothrow) String(KEY_SOCIAL_ITEM_ID), pEvents); + } + else + { + RecordId eventId = static_cast(pResultList->GetAt(0))->GetRecordId(); + pArgs->Add(new (std::nothrow) String(KEY_SOCIAL_ITEM_ID), new (std::nothrow) String(Integer::ToString(eventId))); + } + } + else + { + String* pPath = new (std::nothrow) String(CalendarApp::GetExportVcsFilePath()); + __pCalendarbook->ExportEventsToVcalendar(*pResultList, *pPath); + pArgs->Add(new (std::nothrow) String(KEY_DATA_PATH), pPath); + } + } } result r = AppControlProviderManager::GetInstance()->SendAppControlResult(pApp->GetRequestId(), appControlResult, pArgs); diff --git a/src/ClRepeatForm.cpp b/src/ClRepeatForm.cpp index 8bd952b..fe25598 100644 --- a/src/ClRepeatForm.cpp +++ b/src/ClRepeatForm.cpp @@ -455,8 +455,11 @@ RepeatForm::OnSectionTableViewItemStateChanged(SectionTableView& tableView, int { __untilDate = __startDate; __untilDate.AddDays(7); - __pEditDateUntilDate->SetDate(__untilDate); - __pEditDateUntilDate->Invalidate(false); + if (__pEditDateUntilDate != null) + { + __pEditDateUntilDate->SetDate(__untilDate); + __pEditDateUntilDate->Invalidate(false); + } } break; case REPEAT_TYPE_EVERY_3DAYS: @@ -466,8 +469,11 @@ RepeatForm::OnSectionTableViewItemStateChanged(SectionTableView& tableView, int { __untilDate = __startDate; __untilDate.AddDays(21); - __pEditDateUntilDate->SetDate(__untilDate); - __pEditDateUntilDate->Invalidate(false); + if (__pEditDateUntilDate != null) + { + __pEditDateUntilDate->SetDate(__untilDate); + __pEditDateUntilDate->Invalidate(false); + } } break; case REPEAT_TYPE_EVERY_WEEK: @@ -476,8 +482,11 @@ RepeatForm::OnSectionTableViewItemStateChanged(SectionTableView& tableView, int { __untilDate = __startDate; __untilDate.AddMonths(1); - __pEditDateUntilDate->SetDate(__untilDate); - __pEditDateUntilDate->Invalidate(false); + if (__pEditDateUntilDate != null) + { + __pEditDateUntilDate->SetDate(__untilDate); + __pEditDateUntilDate->Invalidate(false); + } } break; case REPEAT_TYPE_EVERY_2WEEKS: @@ -487,8 +496,11 @@ RepeatForm::OnSectionTableViewItemStateChanged(SectionTableView& tableView, int { __untilDate = __startDate; __untilDate.AddMonths(2); - __pEditDateUntilDate->SetDate(__untilDate); - __pEditDateUntilDate->Invalidate(false); + if (__pEditDateUntilDate != null) + { + __pEditDateUntilDate->SetDate(__untilDate); + __pEditDateUntilDate->Invalidate(false); + } } break; case REPEAT_TYPE_EVERY_MONTH: @@ -497,8 +509,11 @@ RepeatForm::OnSectionTableViewItemStateChanged(SectionTableView& tableView, int { __untilDate = __startDate; __untilDate.AddYears(1); - __pEditDateUntilDate->SetDate(__untilDate); - __pEditDateUntilDate->Invalidate(false); + if (__pEditDateUntilDate != null) + { + __pEditDateUntilDate->SetDate(__untilDate); + __pEditDateUntilDate->Invalidate(false); + } } break; case REPEAT_TYPE_EVERY_YEAR: @@ -507,8 +522,11 @@ RepeatForm::OnSectionTableViewItemStateChanged(SectionTableView& tableView, int { __untilDate = __startDate; __untilDate.AddYears(5); - __pEditDateUntilDate->SetDate(__untilDate); - __pEditDateUntilDate->Invalidate(false); + if (__pEditDateUntilDate != null) + { + __pEditDateUntilDate->SetDate(__untilDate); + __pEditDateUntilDate->Invalidate(false); + } } break; default: diff --git a/src/ClSettingForm.cpp b/src/ClSettingForm.cpp index ee8dd8f..0c88b5d 100644 --- a/src/ClSettingForm.cpp +++ b/src/ClSettingForm.cpp @@ -131,7 +131,7 @@ SettingForm::OnFormBackRequested(Form& source) CalendarApp* pApp = static_cast(UiApp::GetInstance()); if (pApp != null) { - if (pApp->GetOperationType() == OPERATION_TYPE_APPCONTROL) + if (pApp->GetOperationType() != OPERATION_TYPE_MAIN) { pApp->Terminate(); return; diff --git a/src/ClTaskDetailsForm.cpp b/src/ClTaskDetailsForm.cpp index f8a3257..a51201b 100644 --- a/src/ClTaskDetailsForm.cpp +++ b/src/ClTaskDetailsForm.cpp @@ -325,43 +325,82 @@ TaskDetailsForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId delete pArgs; } + CalendarApp* pApp = static_cast(UiApp::GetInstance()); result r = E_SUCCESS; IList* pTodos = null; + const String* pViewType = null; + const String* pItemType = null; const String* pParseId = null; const String* pPath = null; RecordId todoId = INVALID_RECORD_ID; - const String* pViewType = static_cast(UiApp::GetInstance())->GetArgument(KEY_CALENDAR_VIEW_TYPE); - TryCatch(pViewType != null, , "[E_FAILURE] Unable to get viewtype."); - if (pViewType->Equals(VALUE_CALENDAR_VCS_TYPE, false) == true) + if (pApp->GetOperationType() == OPERATION_TYPE_2_0_APPCONTROL) { - pPath = static_cast(UiApp::GetInstance())->GetArgument(KEY_CALENDAR_PATH); - TryCatch(pPath != null, , "[E_FAILURE] Unable to get vcs file path."); - pTodos = Calendarbook::ParseTodosFromVcalendarN(*pPath); - TryCatch(pTodos != null, , "[E_FAILURE] Unable to parse todos from vcs file."); - TryCatch(pTodos->GetCount() > 0, delete pTodos, "[E_FAILURE] Unable to parse todos from vcs file."); - - __pTask = static_cast(pTodos->GetAt(0)); - pTodos->RemoveAt(0); - pTodos->RemoveAll(true); - delete pTodos; - return; + pViewType = pApp->GetArgument(KEY_CALENDAR_VIEW_TYPE); + TryCatch(pViewType != null, , "[E_FAILURE] Unable to get viewtype."); + + if (pViewType->Equals(VALUE_CALENDAR_VCS_TYPE, false) == true) + { + pPath = pApp->GetArgument(KEY_CALENDAR_PATH); + TryCatch(pPath != null, , "[E_FAILURE] Unable to get vcs file path."); + pTodos = Calendarbook::ParseTodosFromVcalendarN(*pPath); + TryCatch(pTodos != null, , "[E_FAILURE] Unable to parse todos from vcs file."); + TryCatch(pTodos->GetCount() > 0, delete pTodos, "[E_FAILURE] Unable to parse todos from vcs file."); + + __pTask = static_cast(pTodos->GetAt(0)); + pTodos->RemoveAt(0, false); + pTodos->RemoveAll(true); + delete pTodos; + return; + } + else if (pViewType->Equals(VALUE_CALENDAR_TODO_TYPE, false) == true) + { + pParseId = pApp->GetArgument(KEY_CALENDAR_TODO_ID); + TryCatch(pParseId != null, , "[E_FAILURE] Unable to get eventid."); + + r = Integer::Parse(*pParseId, todoId); + TryCatch(r == E_SUCCESS, , "[%s] Unable to get eventid.", GetErrorMessage(r)); + + Calendarbook calendarbook; + calendarbook.Construct(); + __pTask = calendarbook.GetTodoN(todoId); + TryCatch(__pTask != null, , "[E_FAILURE] Unable to get todo."); + + GetFooter()->RemoveAllItems(); + return; + } } - else if (pViewType->Equals(VALUE_CALENDAR_TODO_TYPE, false) == true) + else { - pParseId = static_cast(UiApp::GetInstance())->GetArgument(KEY_CALENDAR_TODO_ID); - TryCatch(pParseId != null, , "[E_FAILURE] Unable to get eventid."); + pItemType = pApp->GetArgument(KEY_SOCIAL_ITEM_TYPE); + if (pItemType != null) + { + pParseId = pApp->GetArgument(KEY_SOCIAL_ITEM_ID); + TryCatch(pParseId != null, , "[E_FAILURE] Unable to get eventid."); - r = Integer::Parse(*pParseId, todoId); - TryCatch(r == E_SUCCESS, , "[%s] Unable to get eventid.", GetErrorMessage(r)); + r = Integer::Parse(*pParseId, todoId); + TryCatch(r == E_SUCCESS, , "[%s] Unable to get eventid.", GetErrorMessage(r)); - Calendarbook calendarbook; - calendarbook.Construct(); - __pTask = calendarbook.GetTodoN(todoId); - TryCatch(__pTask != null, , "[E_FAILURE] Unable to get todo."); + Calendarbook calendarbook; + calendarbook.Construct(); + __pTask = calendarbook.GetTodoN(todoId); + TryCatch(__pTask != null, , "[E_FAILURE] Unable to get todo."); - GetFooter()->RemoveAllItems(); - return; + GetFooter()->RemoveAllItems(); + return; + } + else if (pApp->GetMimeType() == MIME_TYPE_VCALENDAR) + { + pTodos = Calendarbook::ParseTodosFromVcalendarN(pApp->GetUri()); + TryCatch(pTodos != null, , "[E_FAILURE] Unable to parse todos from vcs file."); + TryCatch(pTodos->GetCount() > 0, delete pTodos, "[E_FAILURE] Unable to parse todos from vcs file."); + + __pTask = static_cast(pTodos->GetAt(0)); + pTodos->RemoveAt(0, false); + pTodos->RemoveAll(true); + delete pTodos; + return; + } } CATCH: diff --git a/src/ClTaskSelectorForm.cpp b/src/ClTaskSelectorForm.cpp index 71d1f5e..1613bc6 100644 --- a/src/ClTaskSelectorForm.cpp +++ b/src/ClTaskSelectorForm.cpp @@ -251,19 +251,24 @@ TaskSelectorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneI delete pArgs; } - const String* pSelectionMode = static_cast(UiApp::GetInstance())->GetArgument(KEY_CALENDAR_SELECTION_MODE); - const String* pItemType = static_cast(UiApp::GetInstance())->GetArgument(KEY_CALENDAR_ITEM_TYPE); - if (pSelectionMode != null && pItemType != null && pItemType->Equals(VALUE_CALENDAR_TODO_TYPE, false) == true) + CalendarApp* pApp = static_cast(UiApp::GetInstance()); + const String* pSelectionMode = null; + const String* pItemType = null; + if (pApp->GetOperationType() == OPERATION_TYPE_2_0_APPCONTROL) { + pSelectionMode = pApp->GetArgument(KEY_CALENDAR_SELECTION_MODE); + TryCatch(pSelectionMode != null, , "[E_FAILURE] Unable to get selection mode."); + + pItemType = pApp->GetArgument(KEY_CALENDAR_ITEM_TYPE); + TryCatch(pItemType != null, , "[E_FAILURE] Unable to get item type."); + TryCatch(pItemType->Equals(VALUE_CALENDAR_TODO_TYPE, false) == true, , "[E_FAILURE] Invalid item type."); + if (pSelectionMode->Equals(VALUE_CALENDAR_MULTIPLE_SELECTION_MODE, false) == true) { __selectionType = TASK_SELECTOR_FORM_SELECTION_TYPE_MULTIPLE; LoadAllTodos(); - if (__pListViewContents != null) - { - __pListViewContents->UpdateList(); - } + __pListViewContents->UpdateList(); return; } else if (pSelectionMode->Equals(VALUE_CALENDAR_SINGLE_SELECTION_MODE, false) == true) @@ -272,14 +277,35 @@ TaskSelectorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneI GetFooter()->RemoveAllItems(); LoadAllTodos(); - if (__pListViewContents != null) - { - __pListViewContents->UpdateList(); - } + __pListViewContents->UpdateList(); return; } } + else + { + pSelectionMode = pApp->GetArgument(KEY_DATA_SELECTION_MODE); + if (pSelectionMode != null && pSelectionMode->Equals(VALUE_CALENDAR_MULTIPLE_SELECTION_MODE, false) == true) + { + __selectionType = TASK_SELECTOR_FORM_SELECTION_TYPE_MULTIPLE; + } + + TryCatch(pApp->GetArgument(KEY_SOCIAL_RESULT_TYPE) != null, , "[E_FAILURE] Unable to get result type."); + pItemType = pApp->GetArgument(KEY_SOCIAL_ITEM_TYPE); + TryCatch(pItemType != null, , "[E_FAILURE] Unable to get item type."); + TryCatch(pItemType->Equals(VALUE_CALENDAR_TODO_TYPE, false) == true, , "[E_FAILURE] Invalid item type."); + + if (__selectionType == TASK_SELECTOR_FORM_SELECTION_TYPE_SINGLE) + { + GetFooter()->RemoveAllItems(); + } + + LoadAllTodos(); + __pListViewContents->UpdateList(); + return; + } + +CATCH: SendAppControlResult(APP_CTRL_RESULT_FAILED); UiApp::GetInstance()->Terminate(); } @@ -380,11 +406,44 @@ TaskSelectorForm::SendAppControlResult(AppCtrlResult appControlResult, const ILi { pArgs = new (std::nothrow) HashMap(); pArgs->Construct(2); - pArgs->Add(new (std::nothrow) String(KEY_CALENDAR_ITEM_TYPE), new (std::nothrow) String(VALUE_CALENDAR_TODO_TYPE)); + if (pApp->GetOperationType() == OPERATION_TYPE_2_0_APPCONTROL) + { + pArgs->Add(new (std::nothrow) String(KEY_CALENDAR_ITEM_TYPE), new (std::nothrow) String(VALUE_CALENDAR_TODO_TYPE)); - String* pPath = new (std::nothrow) String(CalendarApp::GetExportVcsFilePath()); - __pCalendarbook->ExportTodosToVcalendar(*pResultList, *pPath); - pArgs->Add(new (std::nothrow) String(KEY_CALENDAR_PATH), pPath); + String* pPath = new (std::nothrow) String(CalendarApp::GetExportVcsFilePath()); + __pCalendarbook->ExportTodosToVcalendar(*pResultList, *pPath); + pArgs->Add(new (std::nothrow) String(KEY_CALENDAR_PATH), pPath); + } + else + { + const String* pResultType = pApp->GetArgument(KEY_SOCIAL_RESULT_TYPE); + if (pResultType != null && *pResultType == VALUE_SOCIAL_ITEM_ID) + { + const String* pSelectionMode = pApp->GetArgument(KEY_DATA_SELECTION_MODE); + if (pSelectionMode != null && pSelectionMode->Equals(VALUE_CALENDAR_MULTIPLE_SELECTION_MODE, false) == true) + { + int itemCount = pResultList->GetCount(); + ArrayList* pTodos = new (std::nothrow) ArrayList(); + pTodos->Construct(itemCount); + for (int i = 0; i < itemCount; ++i) + { + pTodos->Add(new (std::nothrow) String(Integer::ToString(static_cast(pResultList->GetAt(i))->GetRecordId()))); + } + pArgs->Add(new (std::nothrow) String(KEY_SOCIAL_ITEM_ID), pTodos); + } + else + { + RecordId todoId = static_cast(pResultList->GetAt(0))->GetRecordId(); + pArgs->Add(new (std::nothrow) String(KEY_SOCIAL_ITEM_ID), new (std::nothrow) String(Integer::ToString(todoId))); + } + } + else + { + String* pPath = new (std::nothrow) String(CalendarApp::GetExportVcsFilePath()); + __pCalendarbook->ExportTodosToVcalendar(*pResultList, *pPath); + pArgs->Add(new (std::nothrow) String(KEY_DATA_PATH), pPath); + } + } } result r = AppControlProviderManager::GetInstance()->SendAppControlResult(pApp->GetRequestId(), appControlResult, pArgs); diff --git a/src/ClTypes.cpp b/src/ClTypes.cpp index 8435098..3aacfc5 100644 --- a/src/ClTypes.cpp +++ b/src/ClTypes.cpp @@ -228,12 +228,27 @@ const wchar_t* ID_OPERATION_MAIN = L"http://tizen.org/appcontrol/operation/main" const wchar_t* ID_OPERATION_PICK = L"http://tizen.org/appcontrol/operation/pick"; const wchar_t* ID_OPERATION_VIEW = L"http://tizen.org/appcontrol/operation/view"; +const wchar_t* ID_OPERATION_SOCIAL_EDIT = L"http://tizen.org/appcontrol/operation/social/edit"; +const wchar_t* ID_OPERATION_SOCIAL_PICK = L"http://tizen.org/appcontrol/operation/social/pick"; +const wchar_t* ID_OPERATION_SOCIAL_VIEW = L"http://tizen.org/appcontrol/operation/social/view"; + +const wchar_t* MIME_TYPE_VCALENDAR = L"text/x-vcalendar"; + const wchar_t* KEY_CALENDAR_EVENT_ID = L"eventId"; const wchar_t* KEY_CALENDAR_TODO_ID = L"todoId"; const wchar_t* KEY_CALENDAR_ITEM_TYPE = L"itemType"; const wchar_t* KEY_CALENDAR_VIEW_TYPE = L"viewType"; const wchar_t* KEY_CALENDAR_SELECTION_MODE = L"selectionMode"; const wchar_t* KEY_CALENDAR_PATH = L"path"; + +const wchar_t* KEY_DATA_PATH = L"http://tizen.org/appcontrol/data/path"; +const wchar_t* KEY_DATA_SELECTION_MODE = L"http://tizen.org/appcontrol/data/selection_mode"; +const wchar_t* KEY_DATA_RETURN_RESULT = L"http://tizen.org/appcontrol/data/return_result"; + +const wchar_t* KEY_SOCIAL_ITEM_ID = L"http://tizen.org/appcontrol/data/social/item_id"; +const wchar_t* KEY_SOCIAL_ITEM_TYPE = L"http://tizen.org/appcontrol/data/social/item_type"; +const wchar_t* KEY_SOCIAL_RESULT_TYPE = L"http://tizen.org/appcontrol/data/social/result_type"; + const wchar_t* KEY_NOTIFICATION_MANAGER_APP_MESSAGE = L"http://tizen.org/appcontrol/data/notification"; const wchar_t* KEY_SYSTEM_24_HOUR_NOTATION_ENABLED = L"http://tizen.org/setting/locale.time.format.24hour"; const wchar_t* KEY_SYSTEM_COUNTRY = L"http://tizen.org/setting/locale.country"; @@ -248,4 +263,6 @@ const wchar_t* VALUE_CALENDAR_VCS_TYPE = L"vcs"; const wchar_t* VALUE_CALENDAR_SINGLE_SELECTION_MODE = L"single"; const wchar_t* VALUE_CALENDAR_MULTIPLE_SELECTION_MODE = L"multiple"; +const wchar_t* VALUE_SOCIAL_ITEM_ID = L"item_id"; + const wchar_t* VCS_EXPORT_PATH = L"/tmp/Cl%d%02d%02d%02d%02d%02d.vcs";