From: SungWan Kim Date: Fri, 29 Mar 2013 06:02:06 +0000 (+0900) Subject: Remove 2.0 appcontrol operations and modify bugs of new appcontrol operations. X-Git-Tag: 2.1_release~33^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2babcbd2f17efce3459fc54aaef80964ae7a1078;p=apps%2Fosp%2FCalendar.git Remove 2.0 appcontrol operations and modify bugs of new appcontrol operations. Change-Id: Ibc7e55e05050b7a37a4802d7b418c320a53e0147 Signed-off-by: SungWan Kim --- diff --git a/inc/ClTypes.h b/inc/ClTypes.h index 71fc65e..cf353fd 100644 --- a/inc/ClTypes.h +++ b/inc/ClTypes.h @@ -229,10 +229,10 @@ extern const wchar_t* IDB_FORM_BACK_PRESS; extern const wchar_t* IDB_ICON_PHONE_CALENDAR; //etc +extern const wchar_t* FILE_URL_HEADER; + extern const wchar_t* ID_OPERATION_ADD; -extern const wchar_t* ID_OPERATION_CONFIG; 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; @@ -280,7 +280,6 @@ extern const wchar_t* VCS_EXPORT_PATH; enum OperationType { OPERATION_TYPE_MAIN, - OPERATION_TYPE_2_0_APPCONTROL, OPERATION_TYPE_VIEW, OPERATION_TYPE_PICK, OPERATION_TYPE_EDIT, diff --git a/src/ClCalendarApp.cpp b/src/ClCalendarApp.cpp index 7511412..b07c6d8 100644 --- a/src/ClCalendarApp.cpp +++ b/src/ClCalendarApp.cpp @@ -237,10 +237,12 @@ CalendarApp::OnAppControlRequestReceived(RequestId reqId, const String& operatio if (pMimeType != null) { __mimeType = *pMimeType; + AppLogDebug("MimeType : %ls", __mimeType.GetPointer()); } if (pUriData != null) { __uriScheme = *pUriData; + AppLogDebug("Uri : %ls", __uriScheme.GetPointer()); } __requestId = reqId; @@ -267,60 +269,13 @@ CalendarApp::OnAppControlRequestReceived(RequestId reqId, const String& operatio { requestFailed = false; } - else if (operationId == ID_OPERATION_PICK) - { - const String* pItemType = GetArgument(KEY_CALENDAR_ITEM_TYPE); - if (pItemType != null) - { - if (pItemType->Equals(VALUE_CALENDAR_EVENT_TYPE, false) == true) - { - __initialScene = IDSCN_EVENT_SELECTOR; - __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_2_0_APPCONTROL; - requestFailed = false; - } - } - } else if (operationId == ID_OPERATION_VIEW) { - const String* pViewType = GetArgument(KEY_CALENDAR_VIEW_TYPE); - if (pViewType != null) + if (__mimeType == MIME_TYPE_VCALENDAR && __uriScheme.StartsWith(FILE_URL_HEADER, 0) == true) { - if (pViewType->Equals(VALUE_CALENDAR_EVENT_TYPE, false) == true) - { - __initialScene = IDSCN_EVENT_DETAILS; - __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_2_0_APPCONTROL; - requestFailed = false; - } - else if (pViewType->Equals(VALUE_CALENDAR_VCS_TYPE, false) == true) - { - String* pPath = const_cast(GetArgument(KEY_CALENDAR_PATH)); - if (pPath != null) - { - VcsType vcsType = CheckVcsFileValidation(*pPath); - if (vcsType != VCS_TYPE_NOT_VCS_FILE) - { - __initialScene = (vcsType == VCS_TYPE_VEVENT) ? IDSCN_EVENT_DETAILS : IDSCN_TASK_DETAILS; - __type = OPERATION_TYPE_2_0_APPCONTROL; - requestFailed = false; - } - } - } - } - else if (__mimeType == MIME_TYPE_VCALENDAR) - { - VcsType vcsType = CheckVcsFileValidation(__uriScheme); + String path = __uriScheme; + path.Replace(FILE_URL_HEADER, L""); + VcsType vcsType = CheckVcsFileValidation(path); if (vcsType != VCS_TYPE_NOT_VCS_FILE) { __initialScene = (vcsType == VCS_TYPE_VEVENT) ? IDSCN_EVENT_DETAILS : IDSCN_TASK_DETAILS; @@ -392,12 +347,6 @@ CalendarApp::OnAppControlRequestReceived(RequestId reqId, const String& operatio __type = OPERATION_TYPE_ADD; requestFailed = false; } - else if (operationId == ID_OPERATION_CONFIG) - { - __initialScene = IDSCN_SETTING; - __type = OPERATION_TYPE_2_0_APPCONTROL; - requestFailed = false; - } if (requestFailed == true) { diff --git a/src/ClEventDetailsForm.cpp b/src/ClEventDetailsForm.cpp index a23e781..9da02c2 100644 --- a/src/ClEventDetailsForm.cpp +++ b/src/ClEventDetailsForm.cpp @@ -455,113 +455,55 @@ 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; - if (pApp->GetOperationType() == OPERATION_TYPE_2_0_APPCONTROL) + const String* pParseId = null; + const String* pItemType = pApp->GetArgument(KEY_SOCIAL_ITEM_TYPE); + if (pItemType != null) { - pViewType = pApp->GetArgument(KEY_CALENDAR_VIEW_TYPE); - TryCatch(pViewType != null, , "[E_FAILURE] Unable to get view type."); + pParseId = pApp->GetArgument(KEY_SOCIAL_ITEM_ID); + TryCatch(pParseId != null, , "[E_FAILURE] Unable to get eventid."); - if (pViewType->Equals(VALUE_CALENDAR_VCS_TYPE, false) == true) - { - pPath = pApp->GetArgument(KEY_CALENDAR_PATH); - TryCatch(pPath != null, , "[E_FAILURE] Unable to get path."); + r = Integer::Parse(*pParseId, eventId); + TryCatch(r == E_SUCCESS, , "[%s] Unable to get eventid.", GetErrorMessage(r)); - r = __pPm->SetVcsFile(*pPath); - TryCatch(r == E_SUCCESS, , "[E_FAILURE] Unable to parse events from vcs file."); + r = __pPm->SetEventId(eventId); + TryCatch(r == E_SUCCESS, , "[%s] Unable to get event.", GetErrorMessage(r)); - if (__pCalendarSelectorPopup == null) - { - __pCalendarSelectorPopup = new (std::nothrow) CalendarSelectorPopup(); - __pCalendarSelectorPopup->Initialize(); - } - - 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) + if (GetFooter() != null) { - 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; + GetFooter()->RemoveButtonAt(BUTTON_POSITION_LEFT); + GetFooter()->RemoveAllItems(); } + return; } - else + else if (pApp->GetMimeType() == MIME_TYPE_VCALENDAR) { - 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)); + String path = pApp->GetUri(); + path.Replace(FILE_URL_HEADER, L""); + r = __pPm->SetVcsFile(path); + TryCatch(r == E_SUCCESS, , "[E_FAILURE] Unable to parse events from vcs file."); - 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; - } - else if (pApp->GetMimeType() == MIME_TYPE_VCALENDAR) + if (__pCalendarSelectorPopup == null) { - r = __pPm->SetVcsFile(pApp->GetUri()); - TryCatch(r == E_SUCCESS, , "[E_FAILURE] Unable to parse events from vcs file."); - - if (__pCalendarSelectorPopup == null) - { - __pCalendarSelectorPopup = new (std::nothrow) CalendarSelectorPopup(); - __pCalendarSelectorPopup->Initialize(); - } + __pCalendarSelectorPopup = new (std::nothrow) CalendarSelectorPopup(); + __pCalendarSelectorPopup->Initialize(); + } - 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; + 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; } AppLogDebug("[E_FAILURE] Invalid arguments."); diff --git a/src/ClEventEditorForm.cpp b/src/ClEventEditorForm.cpp index 9d4e43e..4fb2925 100644 --- a/src/ClEventEditorForm.cpp +++ b/src/ClEventEditorForm.cpp @@ -563,7 +563,8 @@ EventEditorForm::UpdateItem(int sectionIndex, int itemIndex, TableViewItem* pIte break; case ADDITIONAL_CONTENT_ITEM_REPEAT: __pLabelRepeat->SetText(__pPm->GetRecurrenceString()); - __pLabelRepeat->Invalidate(false); + pItem->SetEnabled(__pPm->IsAllEventEditing() == true); + pItem->Invalidate(true); break; } break; @@ -571,7 +572,8 @@ EventEditorForm::UpdateItem(int sectionIndex, int itemIndex, TableViewItem* pIte if (itemIndex == SAVE_TO_ITEM_SAVE_TO) { __pLabelSaveTo->SetText(__pPm->GetCalendarName()); - __pLabelSaveTo->Invalidate(false); + pItem->SetEnabled(__pPm->IsAllEventEditing() == true); + pItem->Invalidate(true); } break; } @@ -1620,6 +1622,11 @@ EventEditorForm::CreateRepeatItemN(int itemWidth, const String& repeat) __pLabelRepeat = pContentLabel; + if (__pPm->IsAllEventEditing() == false) + { + pItem->SetEnabled(false); + } + return pItem; } @@ -1655,6 +1662,11 @@ EventEditorForm::CreateSaveToItemN(int itemWidth, const String& calendarName, co __pLabelSaveTo = pContentLabel; + if (__pPm->IsAllEventEditing() == false) + { + pItem->SetEnabled(false); + } + return pItem; } diff --git a/src/ClEventSelectorForm.cpp b/src/ClEventSelectorForm.cpp index 3a6ee1b..1b89afb 100644 --- a/src/ClEventSelectorForm.cpp +++ b/src/ClEventSelectorForm.cpp @@ -223,59 +223,28 @@ EventSelectorForm::OnSceneActivatedN(const SceneId& previousSceneId, const Scene } CalendarApp* pApp = static_cast(UiApp::GetInstance()); - const String* pSelectionMode = null; const String* pItemType = null; - if (pApp->GetOperationType() == OPERATION_TYPE_2_0_APPCONTROL) + const String* pSelectionMode = pApp->GetArgument(KEY_DATA_SELECTION_MODE); + if (pSelectionMode != null && pSelectionMode->Equals(VALUE_CALENDAR_MULTIPLE_SELECTION_MODE, false) == true) { - 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; - - LoadAllEvents(); - __pListViewContents->UpdateList(); - return; - } - else if (pSelectionMode->Equals(VALUE_CALENDAR_SINGLE_SELECTION_MODE, false) == true) - { - __selectionType = EVENT_SELECTOR_FORM_SELECTION_TYPE_SINGLE; - GetFooter()->RemoveAllItems(); - - LoadAllEvents(); - __pListViewContents->UpdateList(); - return; - } + __selectionType = EVENT_SELECTOR_FORM_SELECTION_TYPE_MULTIPLE; } - 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."); + TryCatch(pApp->GetArgument(KEY_SOCIAL_RESULT_TYPE) != null, , "[E_FAILURE] Unable to get result type."); - if (__selectionType == EVENT_SELECTOR_FORM_SELECTION_TYPE_SINGLE) - { - GetFooter()->RemoveAllItems(); - } + 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."); - LoadAllEvents(); - __pListViewContents->UpdateList(); - return; + if (__selectionType == EVENT_SELECTOR_FORM_SELECTION_TYPE_SINGLE) + { + GetFooter()->RemoveAllItems(); } + LoadAllEvents(); + __pListViewContents->UpdateList(); + return; + CATCH: SendAppControlResult(APP_CTRL_RESULT_FAILED); UiApp::GetInstance()->Terminate(); @@ -410,54 +379,35 @@ EventSelectorForm::SendAppControlResult(AppCtrlResult appControlResult, const IL HashMap* pArgs = null; if (pResultList != null && pResultList->GetCount() > 0) { - pArgs = new (std::nothrow) HashMap(); + pArgs = new (std::nothrow) HashMap(SingleObjectDeleter); pArgs->Construct(2); - 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); - } - else + const String* pResultType = pApp->GetArgument(KEY_SOCIAL_RESULT_TYPE); + if (pResultType != null && *pResultType == VALUE_SOCIAL_ITEM_ID) { - const String* pResultType = pApp->GetArgument(KEY_SOCIAL_RESULT_TYPE); - if (pResultType != null && *pResultType == VALUE_SOCIAL_ITEM_ID) + int itemCount = pResultList->GetCount(); + ArrayList* pEvents = new (std::nothrow) ArrayList(SingleObjectDeleter); + pEvents->Construct(itemCount); + for (int i = 0; i < itemCount; ++i) { - 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); + 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 + { + String* pPath = new (std::nothrow) String(CalendarApp::GetExportVcsFilePath()); + __pCalendarbook->ExportEventsToVcalendar(*pResultList, *pPath); + + ArrayList* pPaths = new (std::nothrow) ArrayList(SingleObjectDeleter); + pPaths->Construct(1); + pPaths->Add(pPath); + pArgs->Add(new (std::nothrow) String(KEY_DATA_PATH), pPaths); } } result r = AppControlProviderManager::GetInstance()->SendAppControlResult(pApp->GetRequestId(), appControlResult, pArgs); - if (pArgs != null) - { - pArgs->RemoveAll(true); - delete pArgs; - } + delete pArgs; AppLogDebugIf(r != E_SUCCESS, "[%s] Unable to return result.", GetErrorMessage(r)); return r; diff --git a/src/ClSharePopup.cpp b/src/ClSharePopup.cpp index 3efa41a..b9b8e17 100644 --- a/src/ClSharePopup.cpp +++ b/src/ClSharePopup.cpp @@ -40,10 +40,7 @@ using namespace Tizen::Ui::Controls; enum{ SHARE_EMAIL = 0, -// SHARE_MESSAGE, -// SHARE_BLUETOOTH, -// SHARE_NFC, -// SHARE_WI_FI, + SHARE_MESSAGE, SHARE_COUNT }; @@ -115,18 +112,9 @@ SharePopup::CreateItem(int index, int itemWidth) case SHARE_EMAIL: pItem->SetElement(ResourceManager::GetString(IDS_CLD_OPT_SENDVIA_EMAIL)); break; -// case SHARE_MESSAGE: -// pItem->SetElement(ResourceManager::GetString(IDS_POPUP_SHARE_MESSAGE)); -// break; -// case SHARE_BLUETOOTH: -// pItem->SetElement(ResourceManager::GetString(IDS_POPUP_SHARE_BLUETOOTH)); -// break; -// case SHARE_NFC: -// pItem->SetElement(ResourceManager::GetString(IDS_POPUP_SHARE_NFC)); -// break; -// case SHARE_WI_FI: -// pItem->SetElement(ResourceManager::GetString(IDS_POPUP_SHARE_WI_FI)); -// break; + case SHARE_MESSAGE: + pItem->SetElement(ResourceManager::GetString(IDS_CLD_OPT_MESSAGE_SEND_VIA)); + break; } return pItem; @@ -143,63 +131,45 @@ SharePopup::OnListViewItemStateChanged(ListView& listView, int index, int elemen { if (status == LIST_ITEM_STATUS_SELECTED) { - String* pPath = new (std::nothrow) String(CalendarApp::GetExportVcsFilePath()); - Calendarbook calendarbook; - calendarbook.Construct(); - LinkedList events; - events.Add(calendarbook.GetEventN(__eventId)); - calendarbook.ExportEventsToVcalendar(events, *pPath); - events.RemoveAll(true); - - HashMap* pArgs = new (std::nothrow) HashMap(); - pArgs->Construct(); - - AppId appId; String operationId; + String uri; switch (index) { case SHARE_EMAIL: - appId = L"tizen.email"; operationId = L"http://tizen.org/appcontrol/operation/compose"; - pArgs->Add(new (std::nothrow) String(L"attachments"), pPath); + uri = L"mailto:"; + break; + case SHARE_MESSAGE: + operationId = L"http://tizen.org/appcontrol/operation/compose"; + uri = L"mmsto:"; break; -// case SHARE_MESSAGE: -// appId = L"tizen.message"; -// operationId = L"http://tizen.org/appcontrol/operation/compose"; -// pArgs->Add(new (std::nothrow) String(L"type"), new (std::nothrow) String(L"MMS")); -// pArgs->Add(new (std::nothrow) String(L"attachVcalendar"), pPath); -// break; -// case SHARE_BLUETOOTH: -// appId = L"tizen.bluetooth"; -// operationId = L"http://tizen.org/appcontrol/operation/compose"; -// break; -// case SHARE_NFC: -// appId = L"tizen.nfc"; -// operationId = L"http://tizen.org/appcontrol/operation/compose"; -// break; -// case SHARE_WI_FI: -// appId = L"tizen.wifi"; -// operationId = L"http://tizen.org/appcontrol/operation/compose"; -// break; default: - File::Remove(*pPath); - pArgs->RemoveAll(true); - delete pArgs; - delete pPath; + AppLogDebug("[E_FAILURE] Invalid condition."); return; } - AppControl* pAc = AppManager::FindAppControlN(appId, operationId); - if (pAc != null) - { - pAc->Start(null, null, pArgs, null); - delete pAc; - } - pArgs->RemoveAll(true); + Calendarbook calendarbook; + calendarbook.Construct(); + CalEvent* pEvent = calendarbook.GetEventN(__eventId); + TryReturnVoid(pEvent != null, "[E_FAILURE] Unable to get event.(ID=%d)", __eventId); + + HashMap* pArgs = new (std::nothrow) HashMap(SingleObjectDeleter); + pArgs->Construct(1); + + String* pPath = new (std::nothrow) String(CalendarApp::GetExportVcsFilePath()); + LinkedList events(SingleObjectDeleter); + events.Add(calendarbook.GetEventN(__eventId)); + calendarbook.ExportEventsToVcalendar(events, *pPath); + + ArrayList* pPaths = new (std::nothrow) ArrayList(SingleObjectDeleter); + pPaths->Construct(1); + pPaths->Add(pPath); + pArgs->Add(new (std::nothrow) String(KEY_CALENDAR_PATH), pPaths); + + AppControl::FindAndStart(operationId, &uri, null, null, pArgs, null); delete pArgs; SetShowState(false); -// delete this; } } diff --git a/src/ClTaskDetailsForm.cpp b/src/ClTaskDetailsForm.cpp index 4ec5d20..2d19a6d 100644 --- a/src/ClTaskDetailsForm.cpp +++ b/src/ClTaskDetailsForm.cpp @@ -63,7 +63,6 @@ enum static const int IDA_TASK_DETAILS_FORM_ADD_TO_CALENDAR = 80001; -static const unsigned int COLOR_ITEM_BACKGROUND = Color32<232, 232, 232>::Value; static const int H_ITEM = 140; static const int H_MAIN_ITEM = 313; static const int Y_MAIN_ITEM_SUBJECT = 18; @@ -306,11 +305,7 @@ TaskDetailsForm::GetSectionHeader(int sectionIndex) bool TaskDetailsForm::HasSectionHeader(int sectionIndex) { - if (sectionIndex == GROUP_MAIN_CONTENT) - { - return false; - } - else if (sectionIndex == GROUP_INFORMATION_CONTENT) + if (sectionIndex == GROUP_INFORMATION_CONTENT) { if ((__pTask->GetLocation().IsEmpty() == true) && (__pTask->GetDescription().IsEmpty() == true)) { @@ -362,92 +357,45 @@ TaskDetailsForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId 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; + String path; RecordId todoId = INVALID_RECORD_ID; - - if (pApp->GetOperationType() == OPERATION_TYPE_2_0_APPCONTROL) + const String* pParseId = null; + const String* pItemType = pApp->GetArgument(KEY_SOCIAL_ITEM_TYPE); + if (pItemType != null) { - 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."); - - if (__pCalendarSelectorPopup == null) - { - __pCalendarSelectorPopup = new (std::nothrow) CalendarSelectorPopup(); - __pCalendarSelectorPopup->Initialize(); - } - - __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."); + 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(); } - else + else if (pApp->GetMimeType() == MIME_TYPE_VCALENDAR) { - 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)); - - Calendarbook calendarbook; - calendarbook.Construct(); - __pTask = calendarbook.GetTodoN(todoId); - TryCatch(__pTask != null, , "[E_FAILURE] Unable to get todo."); + path = pApp->GetUri(); + path.Replace(FILE_URL_HEADER, L""); + pTodos = Calendarbook::ParseTodosFromVcalendarN(path); + 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."); - GetFooter()->RemoveAllItems(); - return; - } - else if (pApp->GetMimeType() == MIME_TYPE_VCALENDAR) + if (__pCalendarSelectorPopup == null) { - 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."); - - if (__pCalendarSelectorPopup == null) - { - __pCalendarSelectorPopup = new (std::nothrow) CalendarSelectorPopup(); - __pCalendarSelectorPopup->Initialize(); - } - - __pTask = static_cast(pTodos->GetAt(0)); - pTodos->RemoveAt(0, false); - pTodos->RemoveAll(true); - delete pTodos; - return; + __pCalendarSelectorPopup = new (std::nothrow) CalendarSelectorPopup(); + __pCalendarSelectorPopup->Initialize(); } + + __pTask = static_cast(pTodos->GetAt(0)); + pTodos->RemoveAt(0, false); + pTodos->RemoveAll(true); + delete pTodos; } + return; CATCH: SendAppControlResult(APP_CTRL_RESULT_FAILED); @@ -490,7 +438,6 @@ TaskDetailsForm::CreateMainItemN(int itemWidth, const String& title, const DateT { TableViewItem* pItem = new (std::nothrow) TableViewItem(); pItem->Construct(Dimension(itemWidth, H_MAIN_ITEM)); - pItem->SetBackgroundColor(Color(COLOR_ITEM_BACKGROUND)); pItem->SetEnabled(false); int y = Y_MAIN_ITEM_SUBJECT; @@ -606,7 +553,6 @@ TaskDetailsForm::CreateDescriptionItemN(int itemWidth, const String& description } pItem->Construct(Dimension(itemWidth, itemHeight)); - pItem->SetBackgroundColor(Color(COLOR_ITEM_BACKGROUND)); pItem->SetEnabled(false); Label* pLabelDescription = new (std::nothrow) Label(); @@ -639,7 +585,6 @@ TaskDetailsForm::CreateLocationItemN(int itemWidth, const String& location) if (location.IsEmpty() == false) { pItem->Construct(Dimension(itemWidth, H_ITEM)); - pItem->SetBackgroundColor(Color(COLOR_ITEM_BACKGROUND)); pItem->SetEnabled(false); Label* pLabelLocation = new (std::nothrow) Label(); @@ -674,7 +619,6 @@ TaskDetailsForm::CreateReminderItemN(int itemWidth) TableViewItem* pItem = new (std::nothrow) TableViewItem(); pItem->Construct(Dimension(itemWidth, height)); - pItem->SetBackgroundColor(Color(COLOR_ITEM_BACKGROUND)); pItem->SetEnabled(false); Label* pLabelReminder = new (std::nothrow) Label(); @@ -708,7 +652,6 @@ TaskDetailsForm::CreatePriorityItemN(int itemWidth, const String& priority) { TableViewItem* pItem = new (std::nothrow) TableViewItem(); pItem->Construct(Dimension(itemWidth, H_PRIORITY_ITEM)); - pItem->SetBackgroundColor(Color(COLOR_ITEM_BACKGROUND)); pItem->SetEnabled(false); Label* pLabelPriority = new (std::nothrow) Label(); @@ -736,7 +679,6 @@ TaskDetailsForm::CreateSaveToItemN(int itemWidth, const String& accountName, con { TableViewItem* pItem = new (std::nothrow) TableViewItem(); pItem->Construct(Dimension(itemWidth, H_SAVE_TO_ITEM)); - pItem->SetBackgroundColor(Color(COLOR_ITEM_BACKGROUND)); pItem->SetEnabled(false); int x = 0; diff --git a/src/ClTaskSelectorForm.cpp b/src/ClTaskSelectorForm.cpp index 1613bc6..7461eee 100644 --- a/src/ClTaskSelectorForm.cpp +++ b/src/ClTaskSelectorForm.cpp @@ -252,59 +252,28 @@ TaskSelectorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneI } CalendarApp* pApp = static_cast(UiApp::GetInstance()); - const String* pSelectionMode = null; const String* pItemType = null; - if (pApp->GetOperationType() == OPERATION_TYPE_2_0_APPCONTROL) + const String* pSelectionMode = pApp->GetArgument(KEY_DATA_SELECTION_MODE); + if (pSelectionMode != null && pSelectionMode->Equals(VALUE_CALENDAR_MULTIPLE_SELECTION_MODE, false) == true) { - 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(); - __pListViewContents->UpdateList(); - return; - } - else if (pSelectionMode->Equals(VALUE_CALENDAR_SINGLE_SELECTION_MODE, false) == true) - { - __selectionType = TASK_SELECTOR_FORM_SELECTION_TYPE_SINGLE; - GetFooter()->RemoveAllItems(); - - LoadAllTodos(); - __pListViewContents->UpdateList(); - return; - } + __selectionType = TASK_SELECTOR_FORM_SELECTION_TYPE_MULTIPLE; } - 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."); + TryCatch(pApp->GetArgument(KEY_SOCIAL_RESULT_TYPE) != null, , "[E_FAILURE] Unable to get result type."); - if (__selectionType == TASK_SELECTOR_FORM_SELECTION_TYPE_SINGLE) - { - GetFooter()->RemoveAllItems(); - } + 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."); - LoadAllTodos(); - __pListViewContents->UpdateList(); - return; + if (__selectionType == TASK_SELECTOR_FORM_SELECTION_TYPE_SINGLE) + { + GetFooter()->RemoveAllItems(); } + LoadAllTodos(); + __pListViewContents->UpdateList(); + return; + CATCH: SendAppControlResult(APP_CTRL_RESULT_FAILED); UiApp::GetInstance()->Terminate(); @@ -404,54 +373,36 @@ TaskSelectorForm::SendAppControlResult(AppCtrlResult appControlResult, const ILi HashMap* pArgs = null; if (pResultList != null && pResultList->GetCount() > 0) { - pArgs = new (std::nothrow) HashMap(); + pArgs = new (std::nothrow) HashMap(SingleObjectDeleter); pArgs->Construct(2); - 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); - } - else + const String* pResultType = pApp->GetArgument(KEY_SOCIAL_RESULT_TYPE); + if (pResultType != null && *pResultType == VALUE_SOCIAL_ITEM_ID) { - const String* pResultType = pApp->GetArgument(KEY_SOCIAL_RESULT_TYPE); - if (pResultType != null && *pResultType == VALUE_SOCIAL_ITEM_ID) + int itemCount = pResultList->GetCount(); + ArrayList* pTodos = new (std::nothrow) ArrayList(SingleObjectDeleter); + pTodos->Construct(itemCount); + for (int i = 0; i < itemCount; ++i) { - 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); + 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 + { + String* pPath = new (std::nothrow) String(CalendarApp::GetExportVcsFilePath()); + __pCalendarbook->ExportTodosToVcalendar(*pResultList, *pPath); + + ArrayList* pPaths = new (std::nothrow) ArrayList(SingleObjectDeleter); + pPaths->Construct(1); + pPaths->Add(pPath); + pArgs->Add(new (std::nothrow) String(KEY_DATA_PATH), pPaths); } } result r = AppControlProviderManager::GetInstance()->SendAppControlResult(pApp->GetRequestId(), appControlResult, pArgs); - if (pArgs != null) - { - pArgs->RemoveAll(true); - delete pArgs; - } + delete pArgs; + AppLogDebugIf(r != E_SUCCESS, "[%s] Unable to return result.", GetErrorMessage(r)); return r; } diff --git a/src/ClTypes.cpp b/src/ClTypes.cpp index 680da25..fba1bf4 100644 --- a/src/ClTypes.cpp +++ b/src/ClTypes.cpp @@ -223,10 +223,10 @@ const wchar_t* IDB_FORM_BACK_PRESS = L"00_icon_Back_02_press.png"; const wchar_t* IDB_ICON_PHONE_CALENDAR = L"P01_icon_phoneCalendar.png"; //etc +const wchar_t* FILE_URL_HEADER = L"file://"; + const wchar_t* ID_OPERATION_ADD = L"http://tizen.org/appcontrol/operation/add"; -const wchar_t* ID_OPERATION_CONFIG = L"http://tizen.org/appcontrol/operation/configure"; 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";