#include <FBase.h>
#include <FUi.h>
+#include "ClTypes.h"
class CalendarSelectorPopup
: public Tizen::Ui::Controls::Popup
{
public:
result Initialize(void);
- void RequestCalendar(Tizen::Ui::Control* pTarget = null);
+ void RequestCalendar(CalendarSelectorPopupStyle style, Tizen::Ui::Control* pTarget = null);
CalendarSelectorPopup(void);
virtual ~CalendarSelectorPopup(void);
#include "ClICalendarEventChangedEventListener.h"
class EventListPresentationModel;
+class TwoButtonPopup;
class EventDeleterForm
: public Tizen::Ui::Controls::Form
Tizen::Ui::Controls::CheckButton* __pSelectBeforeToday;
Tizen::Ui::Controls::Panel* __pPanel;
Tizen::Ui::Controls::Label* __pLabel;
+ TwoButtonPopup* __pTwoButtonPopup;
bool __topBottomItemEnabled;
}; // EventDeleterForm
#include <FGraphics.h>
#include <FUi.h>
+class CalendarSelectorPopup;
class EventPresentationModel;
class SharePopup;
+class ThreeButtonPopup;
+class TwoButtonPopup;
class EventDetailsForm
: public Tizen::Ui::Controls::Form
Tizen::Ui::Controls::TableViewItem* CreateSaveToItemN(int itemWidth, const Tizen::Base::String& accountName,
const Tizen::Base::String& calendarName,
const Tizen::Graphics::Bitmap* pCalendarIcon = null);
- result SendAppControlResult(Tizen::App::AppCtrlResult appControlResult);
void InitializeSubMenu(void);
+ result SaveEvent(void);
+ result SendAppControlResult(Tizen::App::AppCtrlResult appControlResult);
private:
EventPresentationModel* __pPm;
Tizen::Ui::Controls::SectionTableView* __pTableView;
Tizen::Ui::Controls::ContextMenu* __pContextMenuSub;
+ CalendarSelectorPopup* __pCalendarSelectorPopup;
SharePopup* __pSharePopup;
+ ThreeButtonPopup* __pThreeButtonPopup;
+ TwoButtonPopup* __pTwoButtonPopup;
}; // EventDetailsForm
#endif // _CL_EVENT_DETAILS_FORM_H_
class EventSearchPresentationModel;
class SharePopup;
+class ThreeButtonPopup;
+class TwoButtonPopup;
class EventSearcherForm
: public Tizen::Ui::Controls::Form
Tizen::Ui::Controls::ListContextItem* __pContextItem;
Tizen::Ui::Controls::ListContextItem* __pContextItemNoEdit;
SharePopup* __pSharePopup;
+ ThreeButtonPopup* __pThreeButtonPopup;
+ TwoButtonPopup* __pTwoButtonPopup;
};
#endif // _CL_EVENT_SEARCHER_FORM_H_
class EventListPresentationModel;
class SharePopup;
+class ThreeButtonPopup;
+class TwoButtonPopup;
class ListPanel
: public Tizen::Ui::Controls::Panel
Tizen::Ui::Controls::ListContextItem* __pContextItemNoEdit;
Tizen::Locales::DateTimeFormatter* __pDateFormatter;
SharePopup* __pSharePopup;
+ ThreeButtonPopup* __pThreeButtonPopup;
+ TwoButtonPopup* __pTwoButtonPopup;
}; // ListPanel
#endif // _CL_LIST_PANEL_H_
class EventListPresentationModel;
class PanningAnimationManager;
class SharePopup;
+class ThreeButtonPopup;
+class TwoButtonPopup;
class MonthPanel
: public Tizen::Ui::Controls::Panel
Tizen::Ui::Controls::ListContextItem* __pContextItemNoEdit;
PanningAnimationManager* __pPanningAnimationManager;
SharePopup* __pSharePopup;
+ ThreeButtonPopup* __pThreeButtonPopup;
+ TwoButtonPopup* __pTwoButtonPopup;
}; // MonthPanel
#endif // _CL_MONTH_PANEL_H_
#include <FSocial.h>
#include <FUi.h>
+class CalendarSelectorPopup;
+
class TaskDetailsForm
: public Tizen::Ui::Controls::Form
, public virtual Tizen::Ui::IActionEventListener
virtual result OnInitializing(void);
virtual result OnTerminating(void);
+ virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs);
virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
Tizen::Graphics::Bitmap* GetCalendarIconN(Tizen::Social::RecordId calendarId = Tizen::Social::INVALID_RECORD_ID) const;
Tizen::Base::String GetCalendarName(Tizen::Social::RecordId calendarId = Tizen::Social::INVALID_RECORD_ID) const;
Tizen::Base::String GetReminderString(const Tizen::Social::Reminder* pReminder = null) const;
+ result SaveTask(Tizen::Social::RecordId calendarId = Tizen::Social::INVALID_RECORD_ID);
result SendAppControlResult(Tizen::App::AppCtrlResult appControlResult);
private:
Tizen::Social::CalTodo* __pTask;
Tizen::Ui::Controls::SectionTableView* __pTableView;
+ CalendarSelectorPopup* __pCalendarSelectorPopup;
}; // TaskDetailsForm
#endif // _CL_TASK_DETAILS_FORM_H_
, public virtual Tizen::Ui::IActionEventListener
{
public:
+ result Initialize(void);
+ void RequestPopup(ThreeButtonPopupStyle style, Tizen::Ui::Control* pTarget, const Tizen::Social::CalEventInstance* pEvent = null);
+
+ ThreeButtonPopup(void);
+ virtual ~ThreeButtonPopup(void);
+
virtual result OnInitializing(void);
virtual result OnTerminating(void);
virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
- static void RequestThreeButtonPopup(ThreeButtonPopupStyle style, Tizen::Ui::Control* pTarget, const Tizen::Social::CalEventInstance* pEvent = null);
-
-private:
- ThreeButtonPopup(ThreeButtonPopupStyle style);
- virtual ~ThreeButtonPopup(void);
-
private:
- ThreeButtonPopupStyle __style;
+ Tizen::Ui::Controls::Label* __pTitle;
+ Tizen::Ui::Controls::Button* __pButtonOnlyThis;
+ Tizen::Ui::Controls::Button* __pButtonAllEvents;
Tizen::Ui::Control* __pTarget;
Tizen::Social::CalEventInstance* __pEvent;
}; // ThreeButtonPopup
, public virtual Tizen::Ui::IActionEventListener
{
public:
+ result Initialize(void);
+ void RequestPopup(TwoButtonPopupStyle style, Tizen::Ui::Control* pTarget, const Tizen::Social::CalEventInstance* pEvent = null);
+
+ TwoButtonPopup(void);
+ virtual ~TwoButtonPopup(void);
+
virtual result OnInitializing(void);
virtual result OnTerminating(void);
virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
- static void RequestTwoButtonPopup(TwoButtonPopupStyle style, Tizen::Ui::Control* pTarget, const Tizen::Social::CalEventInstance* pEvent = null);
-
-private:
- TwoButtonPopup(TwoButtonPopupStyle style);
- virtual ~TwoButtonPopup(void);
-
private:
- TwoButtonPopupStyle __style;
+ Tizen::Ui::Controls::Label* __pTitle;
Tizen::Ui::Control* __pTarget;
Tizen::Social::CalEventInstance* __pEvent;
}; // TwoButtonPopup
TASK_PRIORITY_HIGH
};
+enum CalendarSelectorPopupStyle
+{
+ CALENDAR_SELECTOR_POPUP_STYLE_EVENT,
+ CALENDAR_SELECTOR_POPUP_STYLE_TODO,
+ CALENDAR_SELECTOR_POPUP_STYLE_ALL
+};
+
enum ThreeButtonPopupStyle
{
THREE_BUTTON_POPUP_STYLE_EDIT,
- THREE_BUTTON_POPUP_STYLE_DELETE,
- THREE_BUTTON_POPUP_STYLE_NONE
+ THREE_BUTTON_POPUP_STYLE_DELETE
};
enum TwoButtonPopupStyle
{
- TWO_BUTTON_POPUP_STYLE_REPEATED_EVENT,
TWO_BUTTON_POPUP_STYLE_SINGLE_EVENT,
- TWO_BUTTON_POPUP_STYLE_NONE
+ TWO_BUTTON_POPUP_STYLE_REPEATED_EVENT
};
enum
#include <FSocial.h>
#include "ClCalendarSelectorPopup.h"
#include "ClResourceManager.h"
-#include "ClTypes.h"
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
}
void
-CalendarSelectorPopup::RequestCalendar(Control* pTarget)
+CalendarSelectorPopup::RequestCalendar(CalendarSelectorPopupStyle style, Control* pTarget)
{
if (__pCalendars != null)
{
calendarbook.Construct();
CalendarbookFilter filter(CB_FI_TYPE_CALENDAR);
- filter.AppendInt(FI_CONJ_OP_NONE, CALENDAR_FI_PR_ITEM_TYPE, FI_CMP_OP_EQUAL, CALENDAR_ITEM_TYPE_EVENT_ONLY);
+ switch (style)
+ {
+ case CALENDAR_SELECTOR_POPUP_STYLE_EVENT:
+ filter.AppendInt(FI_CONJ_OP_NONE, CALENDAR_FI_PR_ITEM_TYPE, FI_CMP_OP_EQUAL, CALENDAR_ITEM_TYPE_EVENT_ONLY);
+ break;
+ case CALENDAR_SELECTOR_POPUP_STYLE_TODO:
+ filter.AppendInt(FI_CONJ_OP_NONE, CALENDAR_FI_PR_ITEM_TYPE, FI_CMP_OP_EQUAL, CALENDAR_ITEM_TYPE_TODO_ONLY);
+ break;
+ case CALENDAR_SELECTOR_POPUP_STYLE_ALL:
+ filter.AppendInt(FI_CONJ_OP_NONE, CALENDAR_FI_PR_ITEM_TYPE, FI_CMP_OP_EQUAL, CALENDAR_ITEM_TYPE_EVENT_AND_TODO);
+ break;
+ }
__pCalendars = calendarbook.SearchN(filter);
TryReturnVoid(__pCalendars != null, "[E_FAILURE] Unable to get calendar list.");
result
DayEventPanel::OnTerminating(void)
{
+ __pPanelDayEvents->RemoveScrollEventListener(*this);
+ __eventButtons.RemoveAll(false);
return E_SUCCESS;
}
, __pSelectBeforeToday(null)
, __pPanel(null)
, __pLabel(null)
+ , __pTwoButtonPopup(null)
, __topBottomItemEnabled(false)
{
}
__pDateFormatter = ResourceManager::CreateDateFormatterN(DATE_TIME_STYLE_SHORT);
+ __pTwoButtonPopup = new (std::nothrow) TwoButtonPopup();
+ __pTwoButtonPopup->Initialize();
+
return E_SUCCESS;
}
delete __pCalendarbook;
delete __pDateFormatter;
delete __pTimeFormatter;
+ delete __pTwoButtonPopup;
__pPm->RemoveCalendarEventChangedEventListener(*this);
return E_SUCCESS;
}
}
- TwoButtonPopup::RequestTwoButtonPopup(style, this);
+ __pTwoButtonPopup->RequestPopup(style, this);
break;
case IDA_SELECT_ALL_CHECKED:
for (int i = startGroupIndex; i <= endGroupIndex; i++)
#include <string>
#include <FSocial.h>
#include "ClCalendarApp.h"
+#include "ClCalendarSelectorPopup.h"
#include "ClEventDetailsForm.h"
#include "ClEventPresentationModel.h"
#include "ClResourceManager.h"
: __pPm(null)
, __pTableView(null)
, __pContextMenuSub(null)
+ , __pCalendarSelectorPopup(null)
, __pSharePopup(null)
+ , __pThreeButtonPopup(null)
+ , __pTwoButtonPopup(null)
{
}
__pSharePopup = new (std::nothrow) SharePopup();
__pSharePopup->Initialize();
+ __pThreeButtonPopup = new (std::nothrow) ThreeButtonPopup();
+ __pThreeButtonPopup->Initialize();
+
+ __pTwoButtonPopup = new (std::nothrow) TwoButtonPopup();
+ __pTwoButtonPopup->Initialize();
+
return E_SUCCESS;
}
EventDetailsForm::OnTerminating(void)
{
delete __pPm;
+ delete __pCalendarSelectorPopup;
delete __pSharePopup;
+ delete __pThreeButtonPopup;
+ delete __pTwoButtonPopup;
return E_SUCCESS;
}
}
break;
}
+ case IDA_CALENDAR_SELECTOR_POPUP_DONE:
+ if (pArgs != null)
+ {
+ __pPm->SetCalendar(static_cast<Integer*>(pArgs->GetAt(0))->value);
+ if (SaveEvent() == E_SUCCESS)
+ {
+ if (GetFooter() != null)
+ {
+ GetFooter()->RemoveAllItems();
+ }
+ __pTableView->UpdateTableView();
+ }
+ }
+ break;
}
if (pArgs != null)
r = __pPm->SetVcsFile(*pPath);
TryCatch(r == E_SUCCESS, , "[E_FAILURE] Unable to parse events from vcs file.");
+ if (__pCalendarSelectorPopup == null)
+ {
+ __pCalendarSelectorPopup = new (std::nothrow) CalendarSelectorPopup();
+ __pCalendarSelectorPopup->Initialize();
+ }
+
if (GetFooter() != null)
{
Footer* pFooter = GetFooter();
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();
+ }
+
if (GetFooter() != null)
{
Footer* pFooter = GetFooter();
{
if (__pPm->IsRecurring() == true)
{
- ThreeButtonPopup::RequestThreeButtonPopup(THREE_BUTTON_POPUP_STYLE_EDIT, this);
+ __pThreeButtonPopup->RequestPopup(THREE_BUTTON_POPUP_STYLE_EDIT, this);
}
else
{
{
if (__pPm->IsRecurring() == true)
{
- ThreeButtonPopup::RequestThreeButtonPopup(THREE_BUTTON_POPUP_STYLE_DELETE, this);
+ __pThreeButtonPopup->RequestPopup(THREE_BUTTON_POPUP_STYLE_DELETE, this);
}
else
{
- TwoButtonPopup::RequestTwoButtonPopup(TWO_BUTTON_POPUP_STYLE_SINGLE_EVENT, this);
+ __pTwoButtonPopup->RequestPopup(TWO_BUTTON_POPUP_STYLE_SINGLE_EVENT, this);
}
}
break;
case IDA_EVENT_DETAILS_FORM_SHARE:
-// SharePopup::RequestShare(__pPm->GetEventId());
__pSharePopup->RequestShare(__pPm->GetEventId());
break;
case IDA_EVENT_DETAILS_FORM_ADD_TO_CALENDAR:
- r = __pPm->Update();
- TryReturnVoid(r == E_SUCCESS, "[%s] Unable to add event.", GetErrorMessage(r));
-
- if (GetFooter() != null)
+ if (__pCalendarSelectorPopup != null)
{
- GetFooter()->RemoveAllItems();
+ __pCalendarSelectorPopup->RequestCalendar(CALENDAR_SELECTOR_POPUP_STYLE_EVENT, this);
+ }
+ else
+ {
+ if (SaveEvent() == E_SUCCESS)
+ {
+ if (GetFooter() != null)
+ {
+ GetFooter()->RemoveAllItems();
+ }
+ __pTableView->UpdateTableView();
+ }
}
- __pTableView->UpdateTableView();
break;
default:
break;
return pItem;
}
-result
-EventDetailsForm::SendAppControlResult(AppCtrlResult appControlResult)
-{
- CalendarApp* pApp = static_cast<CalendarApp*>(UiApp::GetInstance());
- TryReturn(pApp != null, E_FAILURE, "[E_FAILURE] Unable to get app instance.");
-
- result r = AppControlProviderManager::GetInstance()->SendAppControlResult(pApp->GetRequestId(), appControlResult, null);
- AppLogDebugIf(r != E_SUCCESS, "[%s] Unable to return result.", GetErrorMessage(r));
-
- return r;
-}
-
void
EventDetailsForm::InitializeSubMenu(void)
{
__pContextMenuSub->AddItem(ResourceManager::GetString(IDS_COM_SK4_SHARE), IDA_EVENT_DETAILS_FORM_SHARE);
__pContextMenuSub->SetShowState(false);
}
+
+result
+EventDetailsForm::SendAppControlResult(AppCtrlResult appControlResult)
+{
+ CalendarApp* pApp = static_cast<CalendarApp*>(UiApp::GetInstance());
+ TryReturn(pApp != null, E_FAILURE, "[E_FAILURE] Unable to get app instance.");
+
+ result r = AppControlProviderManager::GetInstance()->SendAppControlResult(pApp->GetRequestId(), appControlResult, null);
+ AppLogDebugIf(r != E_SUCCESS, "[%s] Unable to return result.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+EventDetailsForm::SaveEvent(void)
+{
+ result r = __pPm->Update();
+ if (r != E_SUCCESS)
+ {
+ __pPm->Rollback();
+ AppLogDebug("[%s] Unable to add event.", GetErrorMessage(r));
+ return r;
+ }
+ __pPm->Commit();
+ return E_SUCCESS;
+}
bool
EventEditorForm::HasSectionHeader(int sectionIndex)
{
+ if (sectionIndex == 0)
+ {
+ return false;
+ }
return true;
}
case GROUP_SAVE_TO:
if (itemIndex == SAVE_TO_ITEM_SAVE_TO)
{
- // Call SaveTo Popup.(Tizen 2.0 b1 RC1 APIs are not supported yet.)
- __pCalendarSelectorPopup->RequestCalendar(this);
+ __pCalendarSelectorPopup->RequestCalendar(CALENDAR_SELECTOR_POPUP_STYLE_EVENT, this);
}
break;
}
bool
EventPresentationModel::IsSaved(void) const
{
- return __pEventInstance != null || __pEvent->GetCalendarId() != INVALID_RECORD_ID;
+ return __pEventInstance != null || __pEvent->GetRecordId() != INVALID_RECORD_ID;
}
bool
__allEventEditing = true;
}
+ if (__pCalendar == null || (__pCalendar != null && __pCalendar->GetRecordId() != __pEvent->GetCalendarId()))
+ {
+ Calendarbook calendarbook;
+ calendarbook.Construct();
+ delete __pCalendar;
+ __pCalendar = calendarbook.GetCalendarN(__pEvent->GetCalendarId());
+ }
+
delete __pEventBackup;
__pEventBackup = null;
delete __pEventInstanceBackup;
, __pContextItem(null)
, __pContextItemNoEdit(null)
, __pSharePopup(null)
+ , __pThreeButtonPopup(null)
+ , __pTwoButtonPopup(null)
{
}
__pSharePopup = new (std::nothrow) SharePopup();
__pSharePopup->Initialize();
+ __pThreeButtonPopup = new (std::nothrow) ThreeButtonPopup();
+ __pThreeButtonPopup->Initialize();
+
+ __pTwoButtonPopup = new (std::nothrow) TwoButtonPopup();
+ __pTwoButtonPopup->Initialize();
+
return E_SUCCESS;
}
delete __pContextItem;
delete __pContextItemNoEdit;
delete __pSharePopup;
+ delete __pThreeButtonPopup;
+ delete __pTwoButtonPopup;
return E_SUCCESS;
}
case IDA_EVENT_SEARCHER_CONTEXT_MENU_EDIT:
if (pEventInstance->IsRecurring() == true)
{
- ThreeButtonPopup::RequestThreeButtonPopup(THREE_BUTTON_POPUP_STYLE_EDIT, this, pEventInstance);
+ __pThreeButtonPopup->RequestPopup(THREE_BUTTON_POPUP_STYLE_EDIT, this, pEventInstance);
}
else
{
}
break;
case IDA_EVENT_SEARCHER_CONTEXT_MENU_SHARE:
-// SharePopup::RequestShare(pEventInstance->GetOriginalEventId());
__pSharePopup->RequestShare(pEventInstance->GetOriginalEventId());
break;
case IDA_EVENT_SEARCHER_CONTEXT_MENU_DELETE:
if (pEventInstance->IsRecurring() == true)
{
- ThreeButtonPopup::RequestThreeButtonPopup(THREE_BUTTON_POPUP_STYLE_DELETE, this, pEventInstance);
+ __pThreeButtonPopup->RequestPopup(THREE_BUTTON_POPUP_STYLE_DELETE, this, pEventInstance);
}
else
{
- TwoButtonPopup::RequestTwoButtonPopup(TWO_BUTTON_POPUP_STYLE_SINGLE_EVENT, this, pEventInstance);
+ __pTwoButtonPopup->RequestPopup(TWO_BUTTON_POPUP_STYLE_SINGLE_EVENT, this, pEventInstance);
}
break;
}
, __pContextItemNoEdit(null)
, __pDateFormatter(null)
, __pSharePopup(null)
+ , __pThreeButtonPopup(null)
+ , __pTwoButtonPopup(null)
{
}
__pSharePopup = new (std::nothrow) SharePopup();
__pSharePopup->Initialize();
+ __pThreeButtonPopup = new (std::nothrow) ThreeButtonPopup();
+ __pThreeButtonPopup->Initialize();
+
+ __pTwoButtonPopup = new (std::nothrow) TwoButtonPopup();
+ __pTwoButtonPopup->Initialize();
+
return E_SUCCESS;
}
delete __pContextItemNoEdit;
delete __pDateFormatter;
delete __pSharePopup;
+ delete __pThreeButtonPopup;
+ delete __pTwoButtonPopup;
return E_SUCCESS;
}
case IDA_LIST_PANEL_CONTEXT_MENU_EDIT:
if (pEventInstance->IsRecurring() == true)
{
- ThreeButtonPopup::RequestThreeButtonPopup(THREE_BUTTON_POPUP_STYLE_EDIT, this, pEventInstance);
+ __pThreeButtonPopup->RequestPopup(THREE_BUTTON_POPUP_STYLE_EDIT, this, pEventInstance);
}
else
{
}
break;
case IDA_LIST_PANEL_CONTEXT_MENU_SHARE:
-// SharePopup::RequestShare(__pPm->GetEventWithWholeIndex(groupIndex - (TOP_BOTTOM_GROUP_ITEM_COUNT / 2), itemIndex)->GetOriginalEventId());
__pSharePopup->RequestShare(__pPm->GetEventWithWholeIndex(groupIndex - (TOP_BOTTOM_GROUP_ITEM_COUNT / 2), itemIndex)->GetOriginalEventId());
break;
case IDA_LIST_PANEL_CONTEXT_MENU_DELETE:
if (__pPm->GetEventWithWholeIndex(actualGroupIndex, itemIndex)->IsRecurring() == true)
{
- ThreeButtonPopup::RequestThreeButtonPopup(THREE_BUTTON_POPUP_STYLE_DELETE, this, pEventInstance);
+ __pThreeButtonPopup->RequestPopup(THREE_BUTTON_POPUP_STYLE_DELETE, this, pEventInstance);
}
else
{
- TwoButtonPopup::RequestTwoButtonPopup(TWO_BUTTON_POPUP_STYLE_SINGLE_EVENT, this, pEventInstance);
+ __pTwoButtonPopup->RequestPopup(TWO_BUTTON_POPUP_STYLE_SINGLE_EVENT, this, pEventInstance);
}
break;
}
, __pContextItemNoEdit(null)
, __pPanningAnimationManager(null)
, __pSharePopup(null)
+ , __pThreeButtonPopup(null)
+ , __pTwoButtonPopup(null)
{
memset((void *)__pPanelMonthCalendar, 0, sizeof(Panel*) * VIEW_SCROLL_EFFECT_COUNT);
}
__pSharePopup = new (std::nothrow) SharePopup();
__pSharePopup->Initialize();
+ __pThreeButtonPopup = new (std::nothrow) ThreeButtonPopup();
+ __pThreeButtonPopup->Initialize();
+
+ __pTwoButtonPopup = new (std::nothrow) TwoButtonPopup();
+ __pTwoButtonPopup->Initialize();
+
return E_SUCCESS;
}
delete __pContextItem;
delete __pContextItemNoEdit;
delete __pSharePopup;
+ delete __pThreeButtonPopup;
+ delete __pTwoButtonPopup;
return E_SUCCESS;
}
case IDA_MONTH_PANEL_CONTEXT_MENU_EDIT:
if (pEvent->IsRecurring() == true)
{
- ThreeButtonPopup::RequestThreeButtonPopup(THREE_BUTTON_POPUP_STYLE_EDIT, this, pEvent);
+ __pThreeButtonPopup->RequestPopup(THREE_BUTTON_POPUP_STYLE_EDIT, this, pEvent);
}
else
{
}
break;
case IDA_MONTH_PANEL_CONTEXT_MENU_SHARE:
-// SharePopup::RequestShare(pEvent->GetOriginalEventId());
__pSharePopup->RequestShare(pEvent->GetOriginalEventId());
break;
case IDA_MONTH_PANEL_CONTEXT_MENU_DELETE:
if (pEvent->IsRecurring() == true)
{
- ThreeButtonPopup::RequestThreeButtonPopup(THREE_BUTTON_POPUP_STYLE_DELETE, this, pEvent);
+ __pThreeButtonPopup->RequestPopup(THREE_BUTTON_POPUP_STYLE_DELETE, this, pEvent);
}
else
{
- TwoButtonPopup::RequestTwoButtonPopup(TWO_BUTTON_POPUP_STYLE_SINGLE_EVENT, this, pEvent);
+ __pTwoButtonPopup->RequestPopup(TWO_BUTTON_POPUP_STYLE_SINGLE_EVENT, this, pEvent);
}
break;
}
if (actionId == IDA_SHARE_POPUP_CLOSE)
{
SetShowState(false);
-// delete this;
}
}
-
-//void
-//SharePopup::RequestShare(RecordId eventId)
-//{
-// SharePopup* pPopup = new (std::nothrow) SharePopup();
-// pPopup->__eventId = eventId;
-// pPopup->Construct(L"IDL_SHARE_POPUP");
-// pPopup->Show();
-//}
#include <FGraphics.h>
#include <FLocales.h>
#include "ClCalendarApp.h"
+#include "ClCalendarSelectorPopup.h"
#include "ClResourceManager.h"
#include "ClTaskDetailsForm.h"
#include "ClTypes.h"
TaskDetailsForm::TaskDetailsForm(void)
: __pTask(null)
, __pTableView(null)
+ , __pCalendarSelectorPopup(null)
{
}
TaskDetailsForm::OnTerminating(void)
{
delete __pTask;
+ delete __pCalendarSelectorPopup;
return E_SUCCESS;
}
void
+TaskDetailsForm::OnUserEventReceivedN(RequestId requestId, IList* pArgs)
+{
+ switch (requestId)
+ {
+ case IDA_CALENDAR_SELECTOR_POPUP_DONE:
+ if (pArgs != null)
+ {
+ if (SaveTask(static_cast<Integer*>(pArgs->GetAt(0))->value) == E_SUCCESS)
+ {
+ if (GetFooter() != null)
+ {
+ GetFooter()->RemoveAllItems();
+ }
+ __pTableView->UpdateTableView();
+ }
+ }
+ break;
+ }
+
+ if (pArgs != null)
+ {
+ pArgs->RemoveAll(true);
+ delete pArgs;
+ }
+}
+
+void
TaskDetailsForm::OnFormBackRequested(Form& source)
{
// result r = SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED);
int
TaskDetailsForm::GetSectionCount(void)
{
- if (__pTask->GetCalendarId() == INVALID_RECORD_ID)
+ if (__pTask->GetRecordId() == INVALID_RECORD_ID)
{
return GROUP_COUNT - 1;
}
bool
TaskDetailsForm::HasSectionHeader(int sectionIndex)
{
- if (sectionIndex == GROUP_INFORMATION_CONTENT)
+ if (sectionIndex == GROUP_MAIN_CONTENT)
+ {
+ return false;
+ }
+ else if (sectionIndex == GROUP_INFORMATION_CONTENT)
{
if ((__pTask->GetLocation().IsEmpty() == true) && (__pTask->GetDescription().IsEmpty() == true))
{
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<CalTodo*>(pTodos->GetAt(0));
pTodos->RemoveAt(0, false);
pTodos->RemoveAll(true);
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<CalTodo*>(pTodos->GetAt(0));
pTodos->RemoveAt(0, false);
pTodos->RemoveAll(true);
switch (actionId)
{
case IDA_TASK_DETAILS_FORM_ADD_TO_CALENDAR:
- if (__pTask->GetSubject().IsEmpty() == true)
+ if (__pCalendarSelectorPopup != null)
{
- __pTask->SetSubject(ResourceManager::GetString(IDS_CLD_BODY_NO_TITLE));
+ __pCalendarSelectorPopup->RequestCalendar(CALENDAR_SELECTOR_POPUP_STYLE_TODO, this);
}
- Calendarbook calendarbook;
- calendarbook.Construct();
- calendarbook.AddTodo(*__pTask);
-
- if (GetFooter() != null)
+ else
{
- GetFooter()->RemoveAllItems();
+ if (SaveTask() == E_SUCCESS)
+ {
+ if (GetFooter() != null)
+ {
+ GetFooter()->RemoveAllItems();
+ }
+ __pTableView->UpdateTableView();
+ }
}
- __pTableView->UpdateTableView();
break;
}
}
}
result
+TaskDetailsForm::SaveTask(RecordId calendarId)
+{
+ String subject = __pTask->GetSubject();
+ if (subject.IsEmpty() == true)
+ {
+ __pTask->SetSubject(ResourceManager::GetString(IDS_CLD_BODY_NO_TITLE));
+ }
+ Calendarbook calendarbook;
+ calendarbook.Construct();
+ result r = E_SUCCESS;
+ if (calendarId != INVALID_RECORD_ID)
+ {
+ r = calendarbook.AddTodo(*__pTask, calendarId);
+ }
+ else
+ {
+ r = calendarbook.AddTodo(*__pTask);
+ }
+
+ if (r != E_SUCCESS)
+ {
+ __pTask->SetSubject(subject);
+ }
+
+ return r;
+}
+
+result
TaskDetailsForm::SendAppControlResult(AppCtrlResult appControlResult)
{
CalendarApp* pApp = static_cast<CalendarApp*>(UiApp::GetInstance());
static const int IDA_EVENT_POPUP_CANCEL = 11905;
-ThreeButtonPopup::ThreeButtonPopup(ThreeButtonPopupStyle style)
- : __style(style)
+ThreeButtonPopup::ThreeButtonPopup(void)
+ : __pTitle(null)
+ , __pButtonOnlyThis(null)
+ , __pButtonAllEvents(null)
, __pTarget(null)
, __pEvent(null)
{
}
result
-ThreeButtonPopup::OnInitializing(void)
+ThreeButtonPopup::Initialize(void)
+{
+ result r = Construct(L"IDL_THREE_BUTTON_POPUP");
+ if (r == E_SUCCESS)
+ {
+ __pTitle = dynamic_cast<Label*>(GetControl(L"IDC_LABEL"));
+ AppAssertf(__pTitle != null, "[E_FAILURE] Unable to get label.");
+
+ __pButtonOnlyThis = dynamic_cast<Button*>(GetControl(L"IDC_BUTTON_ONLY_THIS_EVENT"));
+ AppAssertf(__pButtonOnlyThis != null, "[E_FAILURE] Unable to get button.");
+
+ __pButtonAllEvents = dynamic_cast<Button*>(GetControl(L"IDC_BUTTON_ALL_EVENTS"));
+ AppAssertf(__pButtonAllEvents != null, "[E_FAILURE] Unable to get button.");
+ }
+ return r;
+}
+
+void
+ThreeButtonPopup::RequestPopup(ThreeButtonPopupStyle style, Control* pTarget, const CalEventInstance* pEvent)
{
- Label* pTitle = dynamic_cast<Label*>(GetControl(L"IDC_LABEL"));
- AppAssertf(pTitle != null, "[E_FAILURE] Unable to get label.");
+ switch (style)
+ {
+ case THREE_BUTTON_POPUP_STYLE_EDIT:
+ __pTitle->SetText(ResourceManager::GetString(IDS_POPUP_EDIT_EVENT_QUESTION));
+ __pButtonOnlyThis->SetActionId(IDA_EVENT_POPUP_ONLY_THIS_EVENT_EDIT);
+ __pButtonAllEvents->SetActionId(IDA_EVENT_POPUP_ALL_REPETITIVE_EVENT_EDIT);
+ break;
+ case THREE_BUTTON_POPUP_STYLE_DELETE:
+ __pTitle->SetText(ResourceManager::GetString(IDS_COM_POP_DELETE_Q));
+ __pButtonOnlyThis->SetActionId(IDA_EVENT_POPUP_ONLY_THIS_EVENT_DELETE);
+ __pButtonAllEvents->SetActionId(IDA_EVENT_POPUP_ALL_REPETITIVE_EVENT_DELETE);
+ break;
+ }
- Button* pButtonOnlyThis = dynamic_cast<Button*>(GetControl(L"IDC_BUTTON_ONLY_THIS_EVENT"));
- AppAssertf(pButtonOnlyThis != null, "[E_FAILURE] Unable to get button.");
- pButtonOnlyThis->AddActionEventListener(*this);
+ __pTarget = pTarget;
- Button* pButtonAllEvents = dynamic_cast<Button*>(GetControl(L"IDC_BUTTON_ALL_EVENTS"));
- AppAssertf(pButtonAllEvents != null, "[E_FAILURE] Unable to get button.");
- pButtonAllEvents->AddActionEventListener(*this);
+ delete __pEvent;
+ __pEvent = (pEvent != null) ? new (std::nothrow) CalEventInstance(*pEvent) : null;
+
+ Show();
+}
+
+result
+ThreeButtonPopup::OnInitializing(void)
+{
+ __pButtonOnlyThis->AddActionEventListener(*this);
+ __pButtonAllEvents->AddActionEventListener(*this);
Button* pButtonCancel = dynamic_cast<Button*>(GetControl(L"IDC_BUTTON_CANCEL"));
AppAssertf(pButtonCancel != null, "[E_FAILURE] Unable to get button.");
pButtonCancel->SetActionId(IDA_EVENT_POPUP_CANCEL);
pButtonCancel->AddActionEventListener(*this);
- if (__style == THREE_BUTTON_POPUP_STYLE_EDIT)
- {
- pTitle->SetText(ResourceManager::GetString(IDS_POPUP_EDIT_EVENT_QUESTION));
- pButtonOnlyThis->SetActionId(IDA_EVENT_POPUP_ONLY_THIS_EVENT_EDIT);
- pButtonAllEvents->SetActionId(IDA_EVENT_POPUP_ALL_REPETITIVE_EVENT_EDIT);
- }
- else if (__style == THREE_BUTTON_POPUP_STYLE_DELETE)
- {
- pTitle->SetText(ResourceManager::GetString(IDS_COM_POP_DELETE_Q));
- pButtonOnlyThis->SetActionId(IDA_EVENT_POPUP_ONLY_THIS_EVENT_DELETE);
- pButtonAllEvents->SetActionId(IDA_EVENT_POPUP_ALL_REPETITIVE_EVENT_DELETE);
- }
-
return E_SUCCESS;
}
}
__pTarget->SendUserEvent(actionId, pArgs);
}
-
- delete this;
-}
-
-void
-ThreeButtonPopup::RequestThreeButtonPopup(ThreeButtonPopupStyle style, Control* pTarget, const CalEventInstance* pEvent)
-{
- ThreeButtonPopup* pPopup = new (std::nothrow) ThreeButtonPopup(style);
- pPopup->__pTarget = pTarget;
- pPopup->__pEvent = (pEvent != null) ? new (std::nothrow) CalEventInstance(*pEvent) : null;
- pPopup->Construct(L"IDL_THREE_BUTTON_POPUP");
- pPopup->Show();
}
static const int IDA_EVENT_POPUP_CANCEL = 10902;
-TwoButtonPopup::TwoButtonPopup(TwoButtonPopupStyle style)
- : __style(style)
+TwoButtonPopup::TwoButtonPopup(void)
+ : __pTitle(null)
, __pTarget(null)
, __pEvent(null)
{
}
result
-TwoButtonPopup::OnInitializing(void)
+TwoButtonPopup::Initialize(void)
{
- Label* pTitle = dynamic_cast<Label*>(GetControl(L"IDC_LABEL"));
- AppAssertf(pTitle != null, "[E_FAILURE] Unable to get label.");
- if (__style == TWO_BUTTON_POPUP_STYLE_REPEATED_EVENT)
+ result r = Construct(L"IDL_TWO_BUTTON_POPUP");
+ if (r == E_SUCCESS)
{
- pTitle->SetText(ResourceManager::GetString(IDS_POPUP_DELETE_MULTIPLE_REPEATED_EVENT));
+ __pTitle = dynamic_cast<Label*>(GetControl(L"IDC_LABEL"));
+ AppAssertf(__pTitle != null, "[E_FAILURE] Unable to get label.");
}
- else
+ return r;
+}
+
+void
+TwoButtonPopup::RequestPopup(TwoButtonPopupStyle style, Control* pTarget, const CalEventInstance* pEvent)
+{
+ switch (style)
{
- pTitle->SetText(ResourceManager::GetString(IDS_COM_POP_DELETE_Q));
+ case TWO_BUTTON_POPUP_STYLE_REPEATED_EVENT:
+ __pTitle->SetText(ResourceManager::GetString(IDS_POPUP_DELETE_MULTIPLE_REPEATED_EVENT));
+ break;
+ default:
+ __pTitle->SetText(ResourceManager::GetString(IDS_COM_POP_DELETE_Q));
+ break;
}
+ __pTarget = pTarget;
+
+ delete __pEvent;
+ __pEvent = (pEvent != null) ? new (std::nothrow) CalEventInstance(*pEvent) : null;
+
+ Show();
+}
+
+result
+TwoButtonPopup::OnInitializing(void)
+{
Button* pButtonDone = dynamic_cast<Button*>(GetControl(L"IDC_BUTTON_DELETE"));
AppAssertf(pButtonDone != null, "[E_FAILURE] Unable to get button.");
pButtonDone->SetActionId(IDA_EVENT_POPUP_DELETE);
}
__pTarget->SendUserEvent(actionId, pArgs);
}
-
- delete this;
-}
-
-void
-TwoButtonPopup::RequestTwoButtonPopup(TwoButtonPopupStyle style, Control* pTarget, const CalEventInstance* pEvent)
-{
- TwoButtonPopup* pPopup = new (std::nothrow) TwoButtonPopup(style);
- pPopup->__pTarget = pTarget;
- pPopup->__pEvent = (pEvent != null) ? new (std::nothrow) CalEventInstance(*pEvent) : null;
- pPopup->Construct(L"IDL_TWO_BUTTON_POPUP");
- pPopup->Show();
}