--- /dev/null
+Hansang Lee <hs321.lee at samsung dot com>
--- /dev/null
+Flora License
+
+Version 1.0, May, 2012
+
+http://floralicense.org/license/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction,
+and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by
+the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and
+all other entities that control, are controlled by, or are
+under common control with that entity. For the purposes of
+this definition, "control" means (i) the power, direct or indirect,
+to cause the direction or management of such entity,
+whether by contract or otherwise, or (ii) ownership of fifty percent (50%)
+or more of the outstanding shares, or (iii) beneficial ownership of
+such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity
+exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.
+
+"Object" form shall mean any form resulting from mechanical
+transformation or translation of a Source form, including but
+not limited to compiled object code, generated documentation,
+and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice
+that is included in or attached to the work (an example is provided
+in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent,
+as a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from,
+or merely link (or bind by name) to the interfaces of, the Work and
+Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor
+for inclusion in the Work by the copyright owner or by an individual or
+Legal Entity authorized to submit on behalf of the copyright owner.
+For the purposes of this definition, "submitted" means any form of
+electronic, verbal, or written communication sent to the Licensor or
+its representatives, including but not limited to communication on
+electronic mailing lists, source code control systems, and issue
+tracking systems that are managed by, or on behalf of, the Licensor
+for the purpose of discussing and improving the Work, but excluding
+communication that is conspicuously marked or otherwise designated
+in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity
+on behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies
+with the standards set forth in the Compatibility Definition Document
+and passes the Compatibility Test Suite as defined from time to time
+by the Tizen Technical Steering Group and certified by the Tizen
+Association or its designated agent.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the
+Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made,
+use, offer to sell, sell, import, and otherwise transfer the Work
+solely as incorporated into a Tizen Certified Platform, where such
+license applies only to those patent claims licensable by such
+Contributor that are necessarily infringed by their Contribution(s)
+alone or by combination of their Contribution(s) with the Work solely
+as incorporated into a Tizen Certified Platform to which such
+Contribution(s) was submitted. If You institute patent litigation
+against any entity (including a cross-claim or counterclaim
+in a lawsuit) alleging that the Work or a Contribution incorporated
+within the Work constitutes direct or contributory patent infringement,
+then any patent licenses granted to You under this License for that
+Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+Work or Derivative Works thereof pursuant to the copyright license
+above, in any medium, with or without modifications, and in Source or
+Object form, provided that You meet the following conditions:
+
+ 1. You must give any other recipients of the Work or Derivative Works
+ a copy of this License; and
+ 2. You must cause any modified files to carry prominent notices stating
+ that You changed the files; and
+ 3. You must retain, in the Source form of any Derivative Works that
+ You distribute, all copyright, patent, trademark, and attribution
+ notices from the Source form of the Work, excluding those notices
+ that do not pertain to any part of the Derivative Works; and
+ 4. If the Work includes a "NOTICE" text file as part of its distribution,
+ then any Derivative Works that You distribute must include a readable
+ copy of the attribution notices contained within such NOTICE file,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works, in at least one of the following places:
+ within a NOTICE text file distributed as part of the Derivative Works;
+ within the Source form or documentation, if provided along with the
+ Derivative Works; or, within a display generated by the Derivative Works,
+ if and wherever such third-party notices normally appear.
+ The contents of the NOTICE file are for informational purposes only
+ and do not modify the License.
+
+You may add Your own attribution notices within Derivative Works
+that You distribute, alongside or as an addendum to the NOTICE text
+from the Work, provided that such additional attribution notices
+cannot be construed as modifying the License. You may add Your own
+copyright statement to Your modifications and may provide additional or
+different license terms and conditions for use, reproduction, or
+distribution of Your modifications, or for any such Derivative Works
+as a whole, provided Your use, reproduction, and distribution of
+the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+any Contribution intentionally submitted for inclusion in the Work
+by You to the Licensor shall be under the terms and conditions of
+this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify
+the terms of any separate license agreement you may have executed
+with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor,
+except as required for reasonable and customary use in describing the
+origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+agreed to in writing, Licensor provides the Work (and each
+Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied, including, without limitation, any warranties or conditions
+of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+PARTICULAR PURPOSE. You are solely responsible for determining the
+appropriateness of using or redistributing the Work and assume any
+risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+whether in tort (including negligence), contract, or otherwise,
+unless required by applicable law (such as deliberate and grossly
+negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a
+result of this License or out of the use or inability to use the
+Work (including but not limited to damages for loss of goodwill,
+work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses), even if such Contributor
+has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+the Work or Derivative Works thereof, You may choose to offer,
+and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this
+License. However, in accepting such obligations, You may act only
+on Your own behalf and on Your sole responsibility, not on behalf
+of any other Contributor, and only if You agree to indemnify,
+defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason
+of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following
+boilerplate notice, with the fields enclosed by brackets "[]"
+replaced with your own identifying information. (Don't include
+the brackets!) The text should be enclosed in the appropriate
+comment syntax for the file format. We also recommend that a
+file or class name and description of purpose be included on the
+same "printed page" as the copyright notice for easier
+identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Flora License, Version 1.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://floralicense.org/license/
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
--- /dev/null
+Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Flora License, Version 1.
+Please, see the LICENSE.Flora file for Flora License, Version 1 terms and conditions.
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<?xml-stylesheet type="text/xsl" href="../../../../description.xsl"?>
+
+<Overview version="0.17.1">
+ <SampleName> Todo </SampleName>
+ <SampleVersion>1.0</SampleVersion>
+ <Preview>screenshot.png</Preview>
+ <Description>
+The Todo sample application demonstrates how you can manage to-dos of the calendar.</Description>
+</Overview>
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef _CREATE_TODO_FORM_H_
+#define _CREATE_TODO_FORM_H_
+
+#include <FBase.h>
+#include <FSocial.h>
+#include <FUi.h>
+
+class CreateTodoForm
+ : public Tizen::Ui::Controls::Form
+ , public Tizen::Ui::IActionEventListener
+ , public Tizen::Ui::IKeypadEventListener
+ , public Tizen::Ui::IDateChangeEventListener
+{
+public:
+ CreateTodoForm();
+ virtual ~CreateTodoForm();
+
+ bool Initialize(void);
+
+public:
+ virtual result OnInitializing(void);
+ virtual result OnTerminating(void);
+
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ virtual void OnKeypadWillOpen(Tizen::Ui::Control& source);
+ virtual void OnKeypadOpened(Tizen::Ui::Control& source);
+ virtual void OnKeypadClosed(Tizen::Ui::Control& source);
+ virtual void OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction);
+ virtual void OnKeypadBoundsChanged(Tizen::Ui::Control& source);
+
+ virtual void OnDateChanged(const Tizen::Ui::Control& source, int year, int month, int day);
+ virtual void OnDateChangeCanceled(const Tizen::Ui::Control& source);
+
+private:
+ result CreateTodo(void);
+
+private:
+ static const int ID_BUTTON_SAVE = 100;
+ static const int ID_BUTTON_CANCEL = 101;
+ static const int ID_BUTTON_PRIORITY = 200;
+ static const int ID_BUTTON_SENSITIVITY = 201;
+ static const int ID_BUTTON_STATUS = 202;
+ static const int ID_CONTEXT_PRIORITY_HIGH = 300;
+ static const int ID_CONTEXT_PRIORITY_NORMAL = 301;
+ static const int ID_CONTEXT_PRIORITY_LOW = 302;
+ static const int ID_CONTEXT_SENSITIVITY_PUBLIC = 400;
+ static const int ID_CONTEXT_SENSITIVITY_PRIVATE = 401;
+ static const int ID_CONTEXT_SENSITIVITY_CONFIDENTIAL = 402;
+ static const int ID_CONTEXT_STATUS_NONE = 500;
+ static const int ID_CONTEXT_STATUS_NEEDSACTION = 501;
+ static const int ID_CONTEXT_STATUS_COMPLETED = 502;
+ static const int ID_CONTEXT_STATUS_INPROCESS = 503;
+ static const int ID_CONTEXT_STATUS_CANCELLED = 504;
+
+ Tizen::Ui::Controls::Button* __pPriorityContextButton;
+ Tizen::Ui::Controls::Button* __pSensitivityContextButton;
+ Tizen::Ui::Controls::Button* __pStatusContextButton;
+ Tizen::Ui::Controls::ContextMenu* __pPriorityTextContextMenu;
+ Tizen::Ui::Controls::ContextMenu* __pSensitivityTextContextMenu;
+ Tizen::Ui::Controls::ContextMenu* __pStatusTextContextMenu;
+ Tizen::Ui::Controls::EditDate* __pStartEditDate;
+ Tizen::Ui::Controls::EditDate* __pDueEditDate;
+ Tizen::Ui::Controls::EditField*__pSubjectEditField;
+ Tizen::Ui::Controls::EditField*__pLocationEditField;
+ Tizen::Ui::Controls::EditField*__pDescriptionEditField;
+ Tizen::Social::TodoPriority __selectedPriority;
+ Tizen::Social::RecordSensitivity __selectedSensitivity;
+ Tizen::Social::TodoStatus __selectedStatus;
+
+};
+
+#endif // _CREATE_TODO_FORM_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef _EDIT_TODO_FORM_H_
+#define _EDIT_TODO_FORM_H_
+
+#include <FBase.h>
+#include <FSocial.h>
+#include <FUi.h>
+
+class EditTodoForm
+ : public Tizen::Ui::Controls::Form
+ , public Tizen::Ui::IActionEventListener
+ , public Tizen::Ui::IKeypadEventListener
+ , public Tizen::Ui::Scenes::ISceneEventListener
+ , public Tizen::Ui::IDateChangeEventListener
+{
+
+public:
+ EditTodoForm();
+ virtual ~EditTodoForm();
+
+ bool Initialize(void);
+
+public:
+ virtual result OnInitializing(void);
+ virtual result OnTerminating(void);
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
+ virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId);
+
+ virtual void OnKeypadWillOpen(Tizen::Ui::Control& source);
+ virtual void OnKeypadOpened(Tizen::Ui::Control& source);
+ virtual void OnKeypadClosed(Tizen::Ui::Control& source);
+ virtual void OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction);
+ virtual void OnKeypadBoundsChanged(Tizen::Ui::Control& source);
+
+ virtual void OnDateChanged(const Tizen::Ui::Control& source, int year, int month, int day);
+ virtual void OnDateChangeCanceled(const Tizen::Ui::Control& source);
+
+private:
+ void LoadTodo(void);
+ result UpdateTodo(void);
+
+private:
+ static const int ID_BUTTON_SAVE = 100;
+ static const int ID_BUTTON_CANCEL = 101;
+ static const int ID_BUTTON_PRIORITY = 200;
+ static const int ID_BUTTON_SENSITIVITY = 201;
+ static const int ID_BUTTON_STATUS = 202;
+ static const int ID_CONTEXT_PRIORITY_HIGH = 300;
+ static const int ID_CONTEXT_PRIORITY_NORMAL = 301;
+ static const int ID_CONTEXT_PRIORITY_LOW = 302;
+ static const int ID_CONTEXT_SENSITIVITY_PUBLIC = 400;
+ static const int ID_CONTEXT_SENSITIVITY_PRIVATE = 401;
+ static const int ID_CONTEXT_SENSITIVITY_CONFIDENTIAL = 402;
+ static const int ID_CONTEXT_STATUS_NONE = 500;
+ static const int ID_CONTEXT_STATUS_NEEDSACTION = 501;
+ static const int ID_CONTEXT_STATUS_COMPLETED = 502;
+ static const int ID_CONTEXT_STATUS_INPROCESS = 503;
+ static const int ID_CONTEXT_STATUS_CANCELLED = 504;
+
+ Tizen::Ui::Controls::Button* __pPriorityContextButton;
+ Tizen::Ui::Controls::Button* __pSensitivityContextButton;
+ Tizen::Ui::Controls::Button* __pStatusContextButton;
+ Tizen::Ui::Controls::ContextMenu* __pPriorityTextContextMenu;
+ Tizen::Ui::Controls::ContextMenu* __pSensitivityTextContextMenu;
+ Tizen::Ui::Controls::ContextMenu* __pStatusTextContextMenu;
+ Tizen::Ui::Controls::EditDate* __pStartEditDate;
+ Tizen::Ui::Controls::EditDate* __pDueEditDate;
+ Tizen::Ui::Controls::EditField*__pSubjectEditField;
+ Tizen::Ui::Controls::EditField*__pLocationEditField;
+ Tizen::Ui::Controls::EditField*__pDescriptionEditField;
+ Tizen::Social::CalTodo* __pTodo;
+ Tizen::Social::TodoPriority __selectedPriority;
+ Tizen::Social::RecordSensitivity __selectedSensitivity;
+ Tizen::Social::TodoStatus __selectedStatus;
+
+};
+
+#endif // _EDIT_TODO_FORM_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef _SCENE_REGISTER_H_
+#define _SCENE_REGISTER_H_
+
+#include <FUi.h>
+
+// Use 'extern' to eliminate duplicate data allocation.
+extern const wchar_t* SCENE_LIST;
+extern const wchar_t* SCENE_DETAIL;
+extern const wchar_t* SCENE_CREATION;
+extern const wchar_t* SCENE_EDITION;
+
+class SceneRegister
+{
+public:
+ static void RegisterAllScenes(void);
+
+private:
+ SceneRegister(void);
+ ~SceneRegister(void);
+};
+
+#endif // _SCENE_REGISTER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef _TODO_H_
+#define _TODO_H_
+
+#include <FApp.h>
+#include <FBase.h>
+#include <FSystem.h>
+#include <FUi.h>
+
+/**
+ * [TodoApp] UiApp must inherit from UiApp class
+ * which provides basic features necessary to define an UiApp.
+ */
+class TodoApp
+ : public Tizen::App::UiApp
+ , public Tizen::System::IScreenEventListener
+{
+public:
+ /**
+ * [Test] UiApp must have a factory method that creates an instance of itself.
+ */
+ static Tizen::App::UiApp* CreateInstance(void);
+
+public:
+ TodoApp(void);
+ virtual~TodoApp(void);
+
+public:
+ // Called when the UiApp is initializing.
+ bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry);
+
+ // Called when the UiApp initializing is finished.
+ bool OnAppInitialized(void);
+
+ // Called when the UiApp is requested to terminate.
+ bool OnAppWillTerminate(void);
+
+ // Called when the UiApp is terminating.
+ bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false);
+
+ // Called when the UiApp's frame moves to the top of the screen.
+ void OnForeground(void);
+
+ // Called when this UiApp's frame is moved from top of the screen to the background.
+ void OnBackground(void);
+
+ // Called when the system memory is not sufficient to run the UiApp any further.
+ void OnLowMemory(void);
+
+ // Called when the battery level changes.
+ void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel);
+
+ // Called when the screen turns on.
+ void OnScreenOn(void);
+
+ // Called when the screen turns off.
+ void OnScreenOff(void);
+};
+
+#endif // _TODO_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef _TODO_DETAIL_FORM_H_
+#define _TODO_DETAIL_FORM_H_
+
+#include <FBase.h>
+#include <FSocial.h>
+#include <FUi.h>
+
+class TodoDetailForm
+ : public Tizen::Ui::Controls::Form
+ , public Tizen::Ui::IActionEventListener
+ , public Tizen::Ui::Controls::IFormBackEventListener
+ , public Tizen::Ui::Scenes::ISceneEventListener
+{
+
+public:
+ TodoDetailForm();
+ virtual ~TodoDetailForm();
+
+ bool Initialize(void);
+
+public:
+ virtual result OnInitializing(void);
+ virtual result OnTerminating(void);
+
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+ virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
+
+ virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
+ virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId);
+
+private:
+ result GetTodo(Tizen::Social::RecordId todoId);
+ result DeleteTodo(void);
+ void UpdateTodoView(void);
+ void ShowMessageBox(void);
+
+private:
+ static const int ID_FOOTER_EDIT = 100;
+ static const int ID_FOOTER_DELETE = 101;
+ static const int ID_FOOTER_BACK = 102;
+ static const int ID_BUTTON_YES_POPUP = 200;
+ static const int ID_BUTTON_CANCEL_POPUP = 201;
+
+ Tizen::Ui::Controls::Label* __pSubjectLabelData;
+ Tizen::Ui::Controls::Label* __pStartDateLabelData;
+ Tizen::Ui::Controls::Label* __pDueDateLabelData;
+ Tizen::Ui::Controls::Label* __pLocationLabelData;
+ Tizen::Ui::Controls::Label* __pPriorityLabelData;
+ Tizen::Ui::Controls::Label* __pSensitivityLabelData;
+ Tizen::Ui::Controls::Label* __pStatusLabelData;
+ Tizen::Ui::Controls::Label* __pDescriptionLabelData;
+ Tizen::Social::Calendarbook* __pCalendarbook;
+ Tizen::Social::CalTodo* __pTodo;
+};
+
+#endif // _TODO_DETAIL_FORM_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef _TODO_FORM_FACTORY_H_
+#define _TODO_FORM_FACTORY_H_
+
+#include <FUi.h>
+
+// Use 'extern' to eliminate duplicate data allocation.
+extern const wchar_t* FORM_LIST;
+extern const wchar_t* FORM_DETAIL;
+extern const wchar_t* FORM_CREATION;
+extern const wchar_t* FORM_EDITION;
+
+class TodoFormFactory
+ : public Tizen::Ui::Scenes::IFormFactory
+{
+public:
+ TodoFormFactory(void);
+ virtual ~TodoFormFactory(void);
+
+ virtual Tizen::Ui::Controls::Form* CreateFormN(const Tizen::Base::String& formId, const Tizen::Ui::Scenes::SceneId& sceneId);
+};
+
+#endif // _TODO_FORM_FACTORY_H_
--- /dev/null
+#ifndef _TODO_FRAME_H_
+#define _TODO_FRAME_H_
+
+#include <FBase.h>
+#include <FUi.h>
+
+
+class TodoFrame
+ : public Tizen::Ui::Controls::Frame
+{
+public:
+ TodoFrame(void);
+ virtual ~TodoFrame(void);
+
+public:
+ virtual result OnInitializing(void);
+ virtual result OnTerminating(void);
+};
+
+#endif // _TODO_FRAME_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef _TODO_LIST_FORM_H_
+#define _TODO_LIST_FORM_H_
+
+#include <FBase.h>
+#include <FSocial.h>
+#include <FUi.h>
+
+class TodoListForm
+ : public Tizen::Ui::Controls::Form
+ , public Tizen::Ui::IActionEventListener
+ , public Tizen::Social::ICalendarbookEventListener
+ , public Tizen::Ui::Controls::IFormBackEventListener
+ , public Tizen::Ui::Controls::IListViewItemEventListener
+ , public Tizen::Ui::Controls::IListViewItemProvider
+ , public Tizen::Ui::Scenes::ISceneEventListener
+{
+
+public:
+ TodoListForm();
+ virtual ~TodoListForm();
+
+ bool Initialize(void);
+
+public:
+ virtual result OnInitializing(void);
+ virtual result OnTerminating(void);
+ virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+
+ virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
+
+ virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
+ virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction);
+ virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
+ virtual void OnItemReordered(Tizen::Ui::Controls::ListView& view, int oldIndex, int newIndex);
+ virtual int GetItemCount(void);
+ virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth);
+ virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
+
+ virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
+ virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId);
+
+ virtual void OnCalendarEventsChanged(const Tizen::Base::Collection::IList& eventChangeInfoList){}
+ virtual void OnCalendarTodosChanged(const Tizen::Base::Collection::IList& todoChangeInfoList);
+
+private:
+ result GetTodoList();
+
+private:
+ static const int ID_FOOTER_CREATE = 100;
+ static const int ID_BUTTON_STATUS = 200;
+ static const int ID_CONTEXT_STATUS_NONE = 300;
+ static const int ID_CONTEXT_STATUS_NEEDS_ACTION = 301;
+ static const int ID_CONTEXT_STATUS_COMPLETED = 302;
+ static const int ID_CONTEXT_STATUS_IN_PROCESS = 303;
+ static const int ID_CONTEXT_STATUS_CANCELLED = 304;
+ static const int ID_CONTEXT_STATUS_ALL = 305;
+
+ Tizen::Base::Collection::IList* __pTodosList;
+ Tizen::Ui::Controls::Button* __pStatusContextButton;
+ Tizen::Ui::Controls::ContextMenu* __pContextMenuStatusText;
+ Tizen::Ui::Controls::ListView* __pListView;
+ Tizen::Social::Calendarbook* __pCalendarbook;
+ unsigned long __selectedStatus;
+
+};
+
+#endif // _TODO_LIST_FORM_H_
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<Manifest xmlns="http://schemas.tizen.org/2012/12/manifest">
+ <Id>$(manifestAppId)</Id>
+ <Version>1.0.0</Version>
+ <Type>C++App</Type>
+ <Author/>
+ <Descriptions/>
+ <Url></Url>
+ <Requirements/>
+ <Apps>
+ <ApiVersion>2.0</ApiVersion>
+ <Privileges>
+ <Privilege>http://tizen.org/privilege/calendar.read</Privilege>
+ <Privilege>http://tizen.org/privilege/calendar.write</Privilege>
+ </Privileges>
+ <UiApp Main="True" MenuIconVisible="True" Name="$(projectName)">
+ <UiScalability CoordinateSystem="Logical" BaseScreenSize="Normal" LogicalCoordinate="720"/>
+ <UiTheme SystemTheme="White"/>
+ <DisplayNames>
+ <DisplayName Locale="eng-GB">$(projectName)</DisplayName>
+ </DisplayNames>
+ <Icons>
+ <Icon Section="MainMenu" Type="Xhigh">mainmenu.png</Icon>
+ </Icons>
+ <LaunchConditions/>
+ <Notifications/>
+ </UiApp>
+ </Apps>
+</Manifest>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ This XML file was automatically generated by UiBuilder - do not modify by hand.
+-->
+<!DOCTYPE Scene SYSTEM "UIForm.dtd">
+
+<Scene Bversion="3.0.0.v20120410" Dversion="20120315">
+ <LogicalCoordinate>720</LogicalCoordinate>
+ <Form id="IDF_FORM">
+ <property backgroundColor="" backgroundOpacity="100" orientation="Automatic" softKey0NormalIcon="" softKey0PressedIcon="" softKey0Text="" softKey1NormalIcon="" softKey1PressedIcon="" softKey1Text="" title="" titleAlign="ALIGN_CENTER" titleIcon="" translucentFooter="false" translucentHeader="false" translucentIndicator="false"/>
+ <layout mode="Portrait" style="FORM_STYLE_INDICATOR|FORM_STYLE_HEADER|FORM_STYLE_FOOTER" type="LAYOUT_RELATIVE"/>
+ <layout mode="Landscape" style="FORM_STYLE_INDICATOR|FORM_STYLE_HEADER|FORM_STYLE_FOOTER" type="LAYOUT_RELATIVE"/>
+ </Form>
+ <Footer>
+ <property backgroundBitmapPath="" color="" colorOpacity="0" disabledButtonColor="" disabledButtonColorOpacity="0" disabledButtonTextColor="" disabledItemColor="" disabledItemColorOpacity="0" disabledItemTextColor="" footerStyle="FOOTER_STYLE_BUTTON_TEXT" highlightedButtonColor="" highlightedButtonColorOpacity="0" highlightedButtonTextColor="" highlightedItemColor="" highlightedItemColorOpacity="0" highlightedItemTextColor="" normalButtonColor="" normalButtonColorOpacity="0" normalButtonTextColor="" normalItemColor="" normalItemColorOpacity="0" normalItemTextColor="" pressedButtonColor="" pressedButtonColorOpacity="0" pressedButtonTextColor="" pressedItemColor="" pressedItemColorOpacity="0" pressedItemTextColor="" selectedItemColor="" selectedItemColorOpacity="0" selectedItemTextColor="" showBackButton="true"/>
+ <itemSet/>
+ </Footer>
+ <Header>
+ <property backgroundBitmapPath="" color="" colorOpacity="0" descriptionText="" descriptionTextColor="" disabledButtonColor="" disabledButtonColorOpacity="0" disabledButtonTextColor="" disabledItemColor="" disabledItemColorOpacity="0" disabledItemTextColor="" headerStyle="HEADER_STYLE_TITLE" highlightedButtonColor="" highlightedButtonColorOpacity="0" highlightedButtonTextColor="" highlightedItemColor="" highlightedItemColorOpacity="0" highlightedItemTextColor="" normalButtonColor="" normalButtonColorOpacity="0" normalButtonTextColor="" normalItemColor="" normalItemColorOpacity="0" normalItemTextColor="" pressedButtonColor="" pressedButtonColorOpacity="0" pressedButtonTextColor="" pressedItemColor="" pressedItemColorOpacity="0" pressedItemTextColor="" selectedItemColor="" selectedItemColorOpacity="0" selectedItemTextColor="" titleIconPath="" titleText="Hello Tizen!" titleTextColor=""/>
+ <itemSet/>
+ </Header>
+ <Button id="IDC_BUTTON_OK" parent="IDF_FORM">
+ <property disableTextColor="" disabledBitmapPath="" disabledColor="" disabledColorOpacity="0" highlightedBGBitmapPath="" highlightedColor="" highlightedColorOpacity="0" highlightedTextColor="" horizontalAlign="ALIGN_CENTER" normalBGBitmapPath="" normalBitmapPath="" normalColor="" normalColorOpacity="0" normalTextColor="" pressedBGBitmapPath="" pressedBitmapPath="" pressedColor="" pressedColorOpacity="0" pressedTextColor="" text="OK" textSize="32" verticalAlign="ALIGN_MIDDLE"/>
+ <layout bottomRelation="" bottomRelationType="" centerHorizontal="true" centerVertical="true" height="135" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0" marginLeft="0" marginRight="0" marginTop="0" mode="Portrait" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="420" />
+ <layout bottomRelation="" bottomRelationType="" centerHorizontal="true" centerVertical="true" height="102" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0" marginLeft="0" marginRight="0" marginTop="0" mode="Landscape" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="400" />
+ </Button>
+</Scene>
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <new>
+
+#include "CreateTodoForm.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Social;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+
+CreateTodoForm::CreateTodoForm()
+ : __selectedPriority(TODO_PRIORITY_LOW)
+ , __selectedSensitivity(SENSITIVITY_PUBLIC)
+ , __selectedStatus(TODO_STATUS_NONE)
+{
+}
+
+CreateTodoForm::~CreateTodoForm()
+{
+}
+
+bool
+CreateTodoForm::Initialize(void)
+{
+ result r = E_SUCCESS;
+
+ r = Construct(FORM_STYLE_NORMAL | FORM_STYLE_FOOTER | FORM_STYLE_HEADER | FORM_STYLE_INDICATOR);
+ TryReturn(!IsFailed(r), false, "Failed to construct the form (%s).", GetErrorMessage(r));
+
+ return true;
+}
+
+result
+CreateTodoForm::OnInitializing(void)
+{
+ result r = E_SUCCESS;
+
+ Header* pHeader = GetHeader();
+ AppAssert(pHeader);
+ pHeader->SetStyle(HEADER_STYLE_TITLE);
+ pHeader->SetTitleText(L"CREATION");
+
+ Footer* pFooter = GetFooter();
+ AppAssert(pFooter);
+ pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
+
+ FooterItem footerSave;
+ footerSave.Construct(ID_BUTTON_SAVE);
+ footerSave.SetText(L"Save");
+ pFooter->AddItem(footerSave);
+
+ FooterItem footerCancel;
+ footerCancel.Construct(ID_BUTTON_CANCEL);
+ footerCancel.SetText(L"Cancel");
+ pFooter->AddItem(footerCancel);
+
+ pFooter->AddActionEventListener(*this);
+
+ static const unsigned int COLOR_BACKGROUND_LABEL = 0xFFEFEDE5;
+ static const unsigned int COLOR_TITLE_LABEL = 0xFF808080;
+
+ static const int UI_X_POSITION_GAP = 20;
+ static const int UI_WIDTH = GetClientAreaBounds().width - 40;
+ static const int UI_X_POSITION_MIDDLE = UI_WIDTH / 4;
+ static const int UI_HEIGHT = 112;
+ static const int BUTTON_HEIGHT = 74;
+ static const int UI_SPACE = 26;
+ int yPosition = 0;
+
+ ScrollPanel* pScrollPanel = new (std::nothrow) ScrollPanel();
+ pScrollPanel->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height));
+
+ // Subject
+ __pSubjectEditField = new (std::nothrow) EditField();
+ __pSubjectEditField->Construct(Rectangle(UI_X_POSITION_GAP, yPosition, UI_WIDTH, UI_HEIGHT), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, EDIT_FIELD_TITLE_STYLE_TOP);
+ __pSubjectEditField->SetGuideText(L"Enter the subject");
+ __pSubjectEditField->SetName(L"Subject");
+ __pSubjectEditField->SetTitleText(L"Subject");
+ __pSubjectEditField->AddKeypadEventListener(*this);
+ __pSubjectEditField->SetOverlayKeypadCommandButtonVisible(false);
+ pScrollPanel->AddControl(*__pSubjectEditField);
+
+ // Start Date
+ int minYear = Calendarbook::GetMinDateTime().GetYear();
+ int maxYear = Calendarbook::GetMaxDateTime().GetYear();
+
+ Label* pStartDateLabel = new (std::nothrow) Label();
+ pStartDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE,UI_WIDTH, UI_HEIGHT), L"Start");
+ pStartDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pStartDateLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pStartDateLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
+ pScrollPanel->AddControl(*pStartDateLabel);
+
+ __pStartEditDate = new (std::nothrow) EditDate();
+ __pStartEditDate->Construct(Point(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition));
+ __pStartEditDate->SetCurrentDate();
+ __pStartEditDate->SetYearRange(minYear, maxYear);
+ __pStartEditDate->AddDateChangeEventListener(*this);
+ pScrollPanel->AddControl(*__pStartEditDate);
+
+ // Due Date
+ Label* pDueDateLabel = new (std::nothrow) Label();
+ pDueDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"Due");
+ pDueDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pDueDateLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pDueDateLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
+ pScrollPanel->AddControl(*pDueDateLabel);
+
+ __pDueEditDate = new (std::nothrow) EditDate();
+ __pDueEditDate->Construct(Point(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition));
+ __pDueEditDate->SetCurrentDate();
+ __pDueEditDate->SetYearRange(minYear, maxYear);
+ __pDueEditDate->AddDateChangeEventListener(*this);
+ pScrollPanel->AddControl(*__pDueEditDate);
+
+ // Location
+ __pLocationEditField = new (std::nothrow) EditField();
+ __pLocationEditField->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, EDIT_FIELD_TITLE_STYLE_TOP);
+ __pLocationEditField->SetGuideText(L"Enter the location");
+ __pLocationEditField->SetName(L"Location");
+ __pLocationEditField->SetTitleText(L"Location");
+ __pLocationEditField->AddKeypadEventListener(*this);
+ __pLocationEditField->SetOverlayKeypadCommandButtonVisible(false);
+ pScrollPanel->AddControl(*__pLocationEditField);
+
+ // Priority
+ Label* pPriorityLabel = new (std::nothrow) Label();
+ pPriorityLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), L"Priority");
+ pPriorityLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pPriorityLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pPriorityLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
+ pScrollPanel->AddControl(*pPriorityLabel);
+
+ __pPriorityContextButton = new (std::nothrow) Button();
+ __pPriorityContextButton->Construct(Rectangle(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH * 3 / 4, BUTTON_HEIGHT), L"Low");
+ __pPriorityContextButton->SetActionId(ID_BUTTON_PRIORITY);
+ __pPriorityContextButton->AddActionEventListener(*this);
+ pScrollPanel->AddControl(*__pPriorityContextButton);
+
+ __pPriorityTextContextMenu = new (std::nothrow) ContextMenu();
+ __pPriorityTextContextMenu->Construct(Point(UI_X_POSITION_GAP + UI_WIDTH * 5 / 8, yPosition), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
+ __pPriorityTextContextMenu->AddItem(L"High", ID_CONTEXT_PRIORITY_HIGH);
+ __pPriorityTextContextMenu->AddItem(L"Normal", ID_CONTEXT_PRIORITY_NORMAL);
+ __pPriorityTextContextMenu->AddItem(L"Low", ID_CONTEXT_PRIORITY_LOW);
+ __pPriorityTextContextMenu->AddActionEventListener(*this);
+ pScrollPanel->AddControl(*__pPriorityTextContextMenu);
+
+ // Sensitivity
+ Label* pSensitivityLabel = new (std::nothrow) Label();
+ pSensitivityLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"Sensitivity");
+ pSensitivityLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pSensitivityLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pSensitivityLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
+ pScrollPanel->AddControl(*pSensitivityLabel);
+
+ __pSensitivityContextButton = new (std::nothrow) Button();
+ __pSensitivityContextButton->Construct(Rectangle(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH * 3 / 4, BUTTON_HEIGHT), L"Public");
+ __pSensitivityContextButton->SetActionId(ID_BUTTON_SENSITIVITY);
+ __pSensitivityContextButton->AddActionEventListener(*this);
+ pScrollPanel->AddControl(*__pSensitivityContextButton);
+
+ __pSensitivityTextContextMenu = new (std::nothrow) ContextMenu();
+ __pSensitivityTextContextMenu->Construct(Point(UI_X_POSITION_GAP + UI_WIDTH * 5 / 8, yPosition), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
+ __pSensitivityTextContextMenu->AddItem(L"Public", ID_CONTEXT_SENSITIVITY_PUBLIC);
+ __pSensitivityTextContextMenu->AddItem(L"Private", ID_CONTEXT_SENSITIVITY_PRIVATE);
+ __pSensitivityTextContextMenu->AddItem(L"Confidential", ID_CONTEXT_SENSITIVITY_CONFIDENTIAL);
+
+ __pSensitivityTextContextMenu->AddActionEventListener(*this);
+ pScrollPanel->AddControl(*__pSensitivityTextContextMenu);
+
+ // Status
+ Label* pStatusLabel = new (std::nothrow) Label();
+ pStatusLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"Status");
+ pStatusLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pStatusLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pStatusLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
+ pScrollPanel->AddControl(*pStatusLabel);
+
+ __pStatusContextButton = new (std::nothrow) Button();
+ __pStatusContextButton->Construct(Rectangle(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH * 3 / 4, BUTTON_HEIGHT), L"None");
+ __pStatusContextButton->SetActionId(ID_BUTTON_STATUS);
+ __pStatusContextButton->AddActionEventListener(*this);
+ pScrollPanel->AddControl(*__pStatusContextButton);
+
+ __pStatusTextContextMenu = new (std::nothrow) ContextMenu();
+ __pStatusTextContextMenu->Construct(Point(UI_X_POSITION_GAP + UI_WIDTH * 5 / 8, yPosition), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
+ __pStatusTextContextMenu->AddItem(L"None", ID_CONTEXT_STATUS_NONE);
+ __pStatusTextContextMenu->AddItem(L"Needs Action", ID_CONTEXT_STATUS_NEEDSACTION);
+ __pStatusTextContextMenu->AddItem(L"Completed", ID_CONTEXT_STATUS_COMPLETED);
+ __pStatusTextContextMenu->AddItem(L"In Process", ID_CONTEXT_STATUS_INPROCESS);
+ __pStatusTextContextMenu->AddItem(L"Cancelled", ID_CONTEXT_STATUS_CANCELLED);
+ __pStatusTextContextMenu->SetMaxVisibleItemsCount(3);
+ __pStatusTextContextMenu->AddActionEventListener(*this);
+ pScrollPanel->AddControl(*__pStatusTextContextMenu);
+
+ // Description
+ __pDescriptionEditField = new (std::nothrow) EditField();
+ __pDescriptionEditField->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, EDIT_FIELD_TITLE_STYLE_TOP);
+ __pDescriptionEditField->SetGuideText(L"Enter the description");
+ __pDescriptionEditField->SetName(L"Description");
+ __pDescriptionEditField->SetTitleText(L"Description");
+ __pDescriptionEditField->AddKeypadEventListener(*this);
+ __pDescriptionEditField->SetOverlayKeypadCommandButtonVisible(false);
+ pScrollPanel->AddControl(*__pDescriptionEditField);
+
+ AddControl(*pScrollPanel);
+
+ return r;
+}
+
+result
+CreateTodoForm::OnTerminating(void)
+{
+ result r = E_SUCCESS;
+ return r;
+}
+
+void
+CreateTodoForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
+{
+ result r = E_SUCCESS;
+
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ AppAssert(pSceneManager);
+
+ ScrollPanel* pScrollPanel = static_cast<ScrollPanel*>(GetControl(0));
+ AppAssert(pScrollPanel);
+
+ static const int CONTEXT_POSITION = 200;
+
+ switch (actionId)
+ {
+ case ID_BUTTON_CANCEL:
+ pSceneManager->GoBackward(BackwardSceneTransition());
+ break;
+ case ID_BUTTON_SAVE:
+ if (__pSubjectEditField->GetText().IsEmpty())
+ {
+ int doModal;
+ MessageBox messageBox;
+ messageBox.Construct(L"Error", "Please enter the subject", MSGBOX_STYLE_OK, 0);
+ messageBox.ShowAndWait(doModal);
+ }
+ else
+ {
+ r = CreateTodo();
+ TryReturnVoid(!IsFailed(r),"Failed to create Todo (%s).", GetErrorMessage(r));
+ pSceneManager->GoBackward(BackwardSceneTransition());
+ }
+ break;
+ case ID_BUTTON_PRIORITY:
+ __pPriorityTextContextMenu->SetAnchorPosition(Point(__pPriorityTextContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
+ __pPriorityTextContextMenu->SetShowState(true);
+ __pPriorityTextContextMenu->Show();
+ break;
+ case ID_CONTEXT_PRIORITY_HIGH:
+ __selectedPriority = TODO_PRIORITY_HIGH;
+ __pPriorityContextButton->SetText(L"High");
+ __pPriorityContextButton->Invalidate(false);
+ break;
+ case ID_CONTEXT_PRIORITY_NORMAL:
+ __selectedPriority = TODO_PRIORITY_NORMAL;
+ __pPriorityContextButton->SetText(L"Normal");
+ __pPriorityContextButton->Invalidate(false);
+ break;
+ case ID_CONTEXT_PRIORITY_LOW:
+ __selectedPriority = TODO_PRIORITY_LOW;
+ __pPriorityContextButton->SetText(L"Low");
+ __pPriorityContextButton->Invalidate(false);
+ break;
+ case ID_BUTTON_SENSITIVITY:
+ __pSensitivityTextContextMenu->SetAnchorPosition(Point(__pSensitivityTextContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
+ __pSensitivityTextContextMenu->SetShowState(true);
+ __pSensitivityTextContextMenu->Show();
+ break;
+ case ID_CONTEXT_SENSITIVITY_PUBLIC:
+ __selectedSensitivity = SENSITIVITY_PUBLIC;
+ __pSensitivityContextButton->SetText(L"Public");
+ __pSensitivityContextButton->Invalidate(false);
+ break;
+ case ID_CONTEXT_SENSITIVITY_PRIVATE:
+ __selectedSensitivity = SENSITIVITY_PRIVATE;
+ __pSensitivityContextButton->SetText(L"Private");
+ __pSensitivityContextButton->Invalidate(false);
+ break;
+ case ID_CONTEXT_SENSITIVITY_CONFIDENTIAL:
+ __selectedSensitivity = SENSITIVITY_CONFIDENTIAL;
+ __pSensitivityContextButton->SetText(L"Confidential");
+ __pSensitivityContextButton->Invalidate(false);
+ break;
+ case ID_BUTTON_STATUS:
+ __pStatusTextContextMenu->SetAnchorPosition(Point(__pStatusTextContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
+ __pStatusTextContextMenu->SetShowState(true);
+ __pStatusTextContextMenu->Show();
+ break;
+ case ID_CONTEXT_STATUS_NONE:
+ __selectedStatus = TODO_STATUS_NONE;
+ __pStatusContextButton->SetText(L"None");
+ __pStatusContextButton->Invalidate(false);
+ break;
+ case ID_CONTEXT_STATUS_NEEDSACTION:
+ __selectedStatus = TODO_STATUS_NEEDS_ACTION;
+ __pStatusContextButton->SetText(L"Needs Action");
+ __pStatusContextButton->Invalidate(false);
+ break;
+ case ID_CONTEXT_STATUS_COMPLETED:
+ __selectedStatus = TODO_STATUS_COMPLETED;
+ __pStatusContextButton->SetText(L"Completed");
+ __pStatusContextButton->Invalidate(false);
+ break;
+ case ID_CONTEXT_STATUS_INPROCESS:
+ __selectedStatus = TODO_STATUS_IN_PROCESS;
+ __pStatusContextButton->SetText(L"In Process");
+ __pStatusContextButton->Invalidate(false);
+ break;
+ case ID_CONTEXT_STATUS_CANCELLED:
+ __selectedStatus = TODO_STATUS_CANCELLED;
+ __pStatusContextButton->SetText(L"Cancelled");
+ __pStatusContextButton->Invalidate(false);
+ break;
+ default:
+ break;
+ }
+}
+
+void
+CreateTodoForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
+{
+ Footer* pFooter = GetFooter();
+ pFooter->SetShowState(false);
+}
+
+void
+CreateTodoForm::OnKeypadOpened(Tizen::Ui::Control& source)
+{
+ ButtonItem saveItem;
+ saveItem.Construct(BUTTON_ITEM_STYLE_TEXT, ID_BUTTON_SAVE);
+ saveItem.SetText(L"Save");
+ GetHeader()->SetButton(BUTTON_POSITION_LEFT, saveItem);
+
+ ButtonItem cancelItem;
+ cancelItem.Construct(BUTTON_ITEM_STYLE_TEXT, ID_BUTTON_CANCEL);
+ cancelItem.SetText(L"Cancel");
+ GetHeader()->SetButton(BUTTON_POSITION_RIGHT, cancelItem);
+
+ GetHeader()->AddActionEventListener(*this);
+ Invalidate(true);
+}
+
+void
+CreateTodoForm::OnKeypadClosed(Tizen::Ui::Control& source)
+{
+ GetHeader()->RemoveActionEventListener(*this);
+ GetHeader()->RemoveAllButtons();
+ GetFooter()->SetShowState(true);
+
+ Invalidate(true);
+}
+
+void
+CreateTodoForm::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction)
+{
+}
+
+void
+CreateTodoForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
+{
+}
+
+void
+CreateTodoForm::OnDateChanged(const Tizen::Ui::Control& source, int year, int month, int day)
+{
+ if (__pStartEditDate->GetDate() > __pDueEditDate->GetDate())
+ {
+ __pDueEditDate->SetDate(__pStartEditDate->GetDate());
+ __pDueEditDate->Invalidate(false);
+ }
+}
+
+void
+CreateTodoForm::OnDateChangeCanceled(const Tizen::Ui::Control& source)
+{
+}
+
+result
+CreateTodoForm::CreateTodo(void)
+{
+ result r = E_SUCCESS;
+
+ Calendarbook calendarbook;
+ r = calendarbook.Construct();
+ TryReturn(!IsFailed(r), r, "Failed to construct the calendarbook (%s)", GetErrorMessage(r));
+
+ CalTodo todo;
+
+ // Sets the subject
+ todo.SetSubject(__pSubjectEditField->GetText());
+
+ // Sets the start date
+ r = todo.SetStartDate(__pStartEditDate->GetDate());
+ TryReturn(!IsFailed(r), r, "Failed to sets the start date (%s)", GetErrorMessage(r));
+
+ // Sets the due date
+ r = todo.SetDueDate(__pDueEditDate->GetDate());
+ TryReturn(!IsFailed(r), r, "Failed to sets the due date (%s)", GetErrorMessage(r));
+
+ // Sets the location
+ todo.SetLocation(__pLocationEditField->GetText());
+
+ // Sets the priority
+ todo.SetPriority(__selectedPriority);
+
+ // Sets the Sensitivity
+ todo.SetSensitivity(__selectedSensitivity);
+
+ // Sets the status
+ todo.SetStatus(__selectedStatus);
+
+ // Sets the description
+ todo.SetDescription(__pDescriptionEditField->GetText());
+
+ // creates the Todo
+ r = calendarbook.AddTodo(todo);
+ if (IsFailed(r))
+ {
+ MessageBox messageBox;
+ messageBox.Construct(L"Error", "Failed to create Todo", MSGBOX_STYLE_OK, 0);
+ int doModal;
+ messageBox.ShowAndWait(doModal);
+ }
+ TryReturn(!IsFailed(r), r, "Failed to create Todo (%s)", GetErrorMessage(r));
+
+ return r;
+}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <new>
+
+#include "EditTodoForm.h"
+#include "SceneRegister.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+using namespace Tizen::Social;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+
+
+EditTodoForm::EditTodoForm()
+ : __pTodo(null)
+ , __selectedPriority(TODO_PRIORITY_LOW)
+ , __selectedSensitivity(SENSITIVITY_PUBLIC)
+ , __selectedStatus(TODO_STATUS_NONE)
+{
+}
+
+EditTodoForm::~EditTodoForm()
+{
+}
+
+bool
+EditTodoForm::Initialize(void)
+{
+ result r = E_SUCCESS;
+
+ r = Construct(FORM_STYLE_NORMAL | FORM_STYLE_FOOTER | FORM_STYLE_HEADER | FORM_STYLE_INDICATOR);
+ TryReturn(!IsFailed(r), false, "Failed to construct the form (%s).", GetErrorMessage(r));
+
+ return true;
+}
+
+result
+EditTodoForm::OnInitializing(void)
+{
+ result r = E_SUCCESS;
+
+ Header* pHeader = GetHeader();
+ AppAssert(pHeader);
+ pHeader->SetStyle(HEADER_STYLE_TITLE);
+ pHeader->SetTitleText(L"EDITION");
+
+ Footer* pFooter = GetFooter();
+ AppAssert(pFooter);
+ pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
+
+ FooterItem footerSave;
+ footerSave.Construct(ID_BUTTON_SAVE);
+ footerSave.SetText(L"Save");
+ pFooter->AddItem(footerSave);
+
+ FooterItem footerCancel;
+ footerCancel.Construct(ID_BUTTON_CANCEL);
+ footerCancel.SetText(L"Cancel");
+ pFooter->AddItem(footerCancel);
+
+ pFooter->AddActionEventListener(*this);
+
+ static const unsigned int COLOR_BACKGROUND_LABEL = 0xFFEFEDE5;
+ static const unsigned int COLOR_TITLE_LABEL = 0xFF808080;
+
+ static const int UI_X_POSITION_GAP = 20;
+ static const int UI_WIDTH = GetClientAreaBounds().width - 40;
+ static const int UI_X_POSITION_MIDDLE = UI_WIDTH / 4;
+ static const int UI_HEIGHT = 112;
+ static const int BUTTON_HEIGHT = 74;
+ static const int UI_SPACE = 26;
+ int yPosition = 0;
+
+ ScrollPanel* pScrollPanel = new (std::nothrow) ScrollPanel();
+ pScrollPanel->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height));
+
+ // Subject
+ __pSubjectEditField = new (std::nothrow) EditField();
+ __pSubjectEditField->Construct(Rectangle(UI_X_POSITION_GAP, yPosition, UI_WIDTH, UI_HEIGHT), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, EDIT_FIELD_TITLE_STYLE_TOP);
+ __pSubjectEditField->SetGuideText(L"Enter the subject");
+ __pSubjectEditField->SetName(L"Subject");
+ __pSubjectEditField->SetTitleText(L"Subject");
+ __pSubjectEditField->AddKeypadEventListener(*this);
+ __pSubjectEditField->SetOverlayKeypadCommandButtonVisible(false);
+ pScrollPanel->AddControl(*__pSubjectEditField);
+
+ // Start Date
+ int minYear = Calendarbook::GetMinDateTime().GetYear();
+ int maxYear = Calendarbook::GetMaxDateTime().GetYear();
+
+ Label* pStartDateLabel = new (std::nothrow) Label();
+ pStartDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE,UI_WIDTH, UI_HEIGHT), L"Start");
+ pStartDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pStartDateLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pStartDateLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
+ pScrollPanel->AddControl(*pStartDateLabel);
+
+ __pStartEditDate = new (std::nothrow) EditDate();
+ __pStartEditDate->Construct(Point(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition));
+ __pStartEditDate->SetCurrentDate();
+ __pStartEditDate->SetYearRange(minYear, maxYear);
+ __pStartEditDate->AddDateChangeEventListener(*this);
+ pScrollPanel->AddControl(*__pStartEditDate);
+
+ // Due Date
+ Label* pDueDateLabel = new (std::nothrow) Label();
+ pDueDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"Due");
+ pDueDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pDueDateLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pDueDateLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
+ pScrollPanel->AddControl(*pDueDateLabel);
+
+ __pDueEditDate = new (std::nothrow) EditDate();
+ __pDueEditDate->Construct(Point(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition));
+ __pDueEditDate->SetCurrentDate();
+ __pDueEditDate->SetYearRange(minYear, maxYear);
+ __pDueEditDate->AddDateChangeEventListener(*this);
+ pScrollPanel->AddControl(*__pDueEditDate);
+
+ // Location
+ __pLocationEditField = new (std::nothrow) EditField();
+ __pLocationEditField->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, EDIT_FIELD_TITLE_STYLE_TOP);
+ __pLocationEditField->SetGuideText(L"Enter the location");
+ __pLocationEditField->SetName(L"Location");
+ __pLocationEditField->SetTitleText(L"Location");
+ __pLocationEditField->AddKeypadEventListener(*this);
+ __pLocationEditField->SetOverlayKeypadCommandButtonVisible(false);
+ pScrollPanel->AddControl(*__pLocationEditField);
+
+ // Priority
+ Label* pPriorityLabel = new (std::nothrow) Label();
+ pPriorityLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), L"Priority");
+ pPriorityLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pPriorityLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pPriorityLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
+ pScrollPanel->AddControl(*pPriorityLabel);
+
+ __pPriorityContextButton = new (std::nothrow) Button();
+ __pPriorityContextButton->Construct(Rectangle(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH * 3 / 4, BUTTON_HEIGHT), L"Low");
+ __pPriorityContextButton->SetActionId(ID_BUTTON_PRIORITY);
+ __pPriorityContextButton->AddActionEventListener(*this);
+ pScrollPanel->AddControl(*__pPriorityContextButton);
+
+ __pPriorityTextContextMenu = new (std::nothrow) ContextMenu();
+ __pPriorityTextContextMenu->Construct(Point(UI_X_POSITION_GAP + UI_WIDTH * 5 / 8, yPosition), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
+ __pPriorityTextContextMenu->AddItem(L"High", ID_CONTEXT_PRIORITY_HIGH);
+ __pPriorityTextContextMenu->AddItem(L"Normal", ID_CONTEXT_PRIORITY_NORMAL);
+ __pPriorityTextContextMenu->AddItem(L"Low", ID_CONTEXT_PRIORITY_LOW);
+ __pPriorityTextContextMenu->AddActionEventListener(*this);
+ pScrollPanel->AddControl(*__pPriorityTextContextMenu);
+
+ // Sensitivity
+ Label* pSensitivityLabel = new (std::nothrow) Label();
+ pSensitivityLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"Sensitivity");
+ pSensitivityLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pSensitivityLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pSensitivityLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
+ pScrollPanel->AddControl(*pSensitivityLabel);
+
+ __pSensitivityContextButton = new (std::nothrow) Button();
+ __pSensitivityContextButton->Construct(Rectangle(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH * 3 / 4, BUTTON_HEIGHT), L"Public");
+ __pSensitivityContextButton->SetActionId(ID_BUTTON_SENSITIVITY);
+ __pSensitivityContextButton->AddActionEventListener(*this);
+ pScrollPanel->AddControl(*__pSensitivityContextButton);
+
+ __pSensitivityTextContextMenu = new (std::nothrow) ContextMenu();
+ __pSensitivityTextContextMenu->Construct(Point(UI_X_POSITION_GAP + UI_WIDTH * 5 / 8, yPosition), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
+ __pSensitivityTextContextMenu->AddItem(L"Public", ID_CONTEXT_SENSITIVITY_PUBLIC);
+ __pSensitivityTextContextMenu->AddItem(L"Private", ID_CONTEXT_SENSITIVITY_PRIVATE);
+ __pSensitivityTextContextMenu->AddItem(L"Confidential", ID_CONTEXT_SENSITIVITY_CONFIDENTIAL);
+
+ __pSensitivityTextContextMenu->AddActionEventListener(*this);
+ pScrollPanel->AddControl(*__pSensitivityTextContextMenu);
+
+ // Status
+ Label* pStatusLabel = new (std::nothrow) Label();
+ pStatusLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"Status");
+ pStatusLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pStatusLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pStatusLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
+ pScrollPanel->AddControl(*pStatusLabel);
+
+ __pStatusContextButton = new (std::nothrow) Button();
+ __pStatusContextButton->Construct(Rectangle(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH * 3 / 4, BUTTON_HEIGHT), L"None");
+ __pStatusContextButton->SetActionId(ID_BUTTON_STATUS);
+ __pStatusContextButton->AddActionEventListener(*this);
+ pScrollPanel->AddControl(*__pStatusContextButton);
+
+ __pStatusTextContextMenu = new (std::nothrow) ContextMenu();
+ __pStatusTextContextMenu->Construct(Point(UI_X_POSITION_GAP + UI_WIDTH * 5 / 8, yPosition), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
+ __pStatusTextContextMenu->AddItem(L"None", ID_CONTEXT_STATUS_NONE);
+ __pStatusTextContextMenu->AddItem(L"Needs Action", ID_CONTEXT_STATUS_NEEDSACTION);
+ __pStatusTextContextMenu->AddItem(L"Completed", ID_CONTEXT_STATUS_COMPLETED);
+ __pStatusTextContextMenu->AddItem(L"In Process", ID_CONTEXT_STATUS_INPROCESS);
+ __pStatusTextContextMenu->AddItem(L"Cancelled", ID_CONTEXT_STATUS_CANCELLED);
+ __pStatusTextContextMenu->SetMaxVisibleItemsCount(3);
+ __pStatusTextContextMenu->AddActionEventListener(*this);
+ pScrollPanel->AddControl(*__pStatusTextContextMenu);
+
+ // Description
+ __pDescriptionEditField = new (std::nothrow) EditField();
+ __pDescriptionEditField->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, EDIT_FIELD_TITLE_STYLE_TOP);
+ __pDescriptionEditField->SetGuideText(L"Enter the description");
+ __pDescriptionEditField->SetName(L"Description");
+ __pDescriptionEditField->SetTitleText(L"Description");
+ __pDescriptionEditField->AddKeypadEventListener(*this);
+ __pDescriptionEditField->SetOverlayKeypadCommandButtonVisible(false);
+ pScrollPanel->AddControl(*__pDescriptionEditField);
+
+ AddControl(*pScrollPanel);
+
+ return r;
+}
+
+result
+EditTodoForm::OnTerminating(void)
+{
+ result r = E_SUCCESS;
+
+ if (__pTodo != null)
+ {
+ delete __pTodo;
+ }
+ return r;
+}
+
+void
+EditTodoForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
+{
+ result r = E_SUCCESS;
+
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ AppAssert(pSceneManager);
+
+ ScrollPanel* pScrollPanel = static_cast<ScrollPanel*>(GetControl(0));
+ AppAssert(pScrollPanel);
+
+ static const int CONTEXT_POSITION = 200;
+
+ switch (actionId)
+ {
+ case ID_BUTTON_CANCEL:
+ {
+ pSceneManager->GoBackward(BackwardSceneTransition());
+ }
+ break;
+ case ID_BUTTON_SAVE:
+ {
+ if (__pSubjectEditField->GetText().IsEmpty())
+ {
+ int doModal;
+ MessageBox messageBox;
+ messageBox.Construct(L"Error", "Please enter the subject", MSGBOX_STYLE_OK, 0);
+ messageBox.ShowAndWait(doModal);
+ }
+ else
+ {
+ r = UpdateTodo();
+ TryReturnVoid(!IsFailed(r),"Failed to update Todo (%s).", GetErrorMessage(r));
+
+ ArrayList* pList = new (std::nothrow) ArrayList();
+ pList->Construct();
+ pList->Add(*new (std::nothrow) Integer(__pTodo->GetRecordId()));
+
+ pSceneManager->GoBackward(BackwardSceneTransition(SCENE_DETAIL), pList);
+ }
+ }
+ break;
+ case ID_BUTTON_PRIORITY:
+ {
+ __pPriorityTextContextMenu->SetAnchorPosition(Point(__pPriorityTextContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
+ __pPriorityTextContextMenu->SetShowState(true);
+ __pPriorityTextContextMenu->Show();
+ }
+ break;
+ case ID_CONTEXT_PRIORITY_LOW:
+ {
+ __selectedPriority = TODO_PRIORITY_LOW;
+ __pPriorityContextButton->SetText(L"Low");
+ __pPriorityContextButton->Invalidate(false);
+ }
+ break;
+ case ID_CONTEXT_PRIORITY_NORMAL:
+ {
+ __selectedPriority = TODO_PRIORITY_NORMAL;
+ __pPriorityContextButton->SetText(L"Normal");
+ __pPriorityContextButton->Invalidate(false);
+ }
+ break;
+ case ID_CONTEXT_PRIORITY_HIGH:
+ {
+ __selectedPriority = TODO_PRIORITY_HIGH;
+ __pPriorityContextButton->SetText(L"High");
+ __pPriorityContextButton->Invalidate(false);
+ }
+ break;
+ case ID_BUTTON_SENSITIVITY:
+ {
+ __pSensitivityTextContextMenu->SetAnchorPosition(Point(__pSensitivityTextContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
+ __pSensitivityTextContextMenu->SetShowState(true);
+ __pSensitivityTextContextMenu->Show();
+ }
+ break;
+ case ID_CONTEXT_SENSITIVITY_PUBLIC:
+ {
+ __selectedSensitivity = SENSITIVITY_PUBLIC;
+ __pSensitivityContextButton->SetText(L"Public");
+ __pSensitivityContextButton->Invalidate(false);
+ }
+ break;
+ case ID_CONTEXT_SENSITIVITY_PRIVATE:
+ {
+ __selectedSensitivity = SENSITIVITY_PRIVATE;
+ __pSensitivityContextButton->SetText(L"Private");
+ __pSensitivityContextButton->Invalidate(false);
+ }
+ break;
+ case ID_CONTEXT_SENSITIVITY_CONFIDENTIAL:
+ {
+ __selectedSensitivity = SENSITIVITY_CONFIDENTIAL;
+ __pSensitivityContextButton->SetText(L"Confidential");
+ __pSensitivityContextButton->Invalidate(false);
+ }
+ break;
+ case ID_BUTTON_STATUS:
+ {
+ __pStatusTextContextMenu->SetAnchorPosition(Point(__pStatusTextContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
+ __pStatusTextContextMenu->SetShowState(true);
+ __pStatusTextContextMenu->Show();
+ }
+ break;
+ case ID_CONTEXT_STATUS_NONE:
+ {
+ __selectedStatus = TODO_STATUS_NONE;
+ __pStatusContextButton->SetText(L"None");
+ __pStatusContextButton->Invalidate(false);
+ }
+ break;
+ case ID_CONTEXT_STATUS_NEEDSACTION:
+ {
+ __selectedStatus = TODO_STATUS_NEEDS_ACTION;
+ __pStatusContextButton->SetText(L"Needs Action");
+ __pStatusContextButton->Invalidate(false);
+ }
+ break;
+ case ID_CONTEXT_STATUS_COMPLETED:
+ {
+ __selectedStatus = TODO_STATUS_COMPLETED;
+ __pStatusContextButton->SetText(L"Completed");
+ __pStatusContextButton->Invalidate(false);
+ }
+ break;
+ case ID_CONTEXT_STATUS_INPROCESS:
+ {
+ __selectedStatus = TODO_STATUS_IN_PROCESS;
+ __pStatusContextButton->SetText(L"In Process");
+ __pStatusContextButton->Invalidate(false);
+ }
+ break;
+ case ID_CONTEXT_STATUS_CANCELLED:
+ {
+ __selectedStatus = TODO_STATUS_CANCELLED;
+ __pStatusContextButton->SetText(L"Cancelled");
+ __pStatusContextButton->Invalidate(false);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void
+EditTodoForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
+{
+ if (pArgs != null)
+ {
+ __pTodo = static_cast<CalTodo*>(pArgs->GetAt(0));
+ LoadTodo();
+ pArgs->RemoveAll(false);
+ delete pArgs;
+ }
+}
+
+void
+EditTodoForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
+{
+}
+
+
+void
+EditTodoForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
+{
+ Footer* pFooter = GetFooter();
+ pFooter->SetShowState(false);
+}
+
+void
+EditTodoForm::OnKeypadOpened(Tizen::Ui::Control& source)
+{
+ ButtonItem saveItem;
+ saveItem.Construct(BUTTON_ITEM_STYLE_TEXT, ID_BUTTON_SAVE);
+ saveItem.SetText(L"Save");
+ GetHeader()->SetButton(BUTTON_POSITION_LEFT, saveItem);
+
+ ButtonItem cancelItem;
+ cancelItem.Construct(BUTTON_ITEM_STYLE_TEXT, ID_BUTTON_CANCEL);
+ cancelItem.SetText(L"Cancel");
+ GetHeader()->SetButton(BUTTON_POSITION_RIGHT, cancelItem);
+
+ GetHeader()->AddActionEventListener(*this);
+ Invalidate(true);
+}
+
+void
+EditTodoForm::OnKeypadClosed(Tizen::Ui::Control& source)
+{
+ GetHeader()->RemoveActionEventListener(*this);
+ GetHeader()->RemoveAllButtons();
+ GetFooter()->SetShowState(true);
+
+ Invalidate(true);
+}
+
+void
+EditTodoForm::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction)
+{
+}
+
+void
+EditTodoForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
+{
+}
+
+void
+EditTodoForm::OnDateChanged(const Tizen::Ui::Control& source, int year, int month, int day)
+{
+ if (__pStartEditDate->GetDate() > __pDueEditDate->GetDate())
+ {
+ __pDueEditDate->SetDate(__pStartEditDate->GetDate());
+ __pDueEditDate->Invalidate(false);
+ }
+}
+
+void
+EditTodoForm::OnDateChangeCanceled(const Tizen::Ui::Control& source)
+{
+}
+
+void
+EditTodoForm::LoadTodo(void)
+{
+ // Loads the Subject
+ __pSubjectEditField->SetText(__pTodo->GetSubject());
+
+ // Loads the start date
+ __pStartEditDate->SetDate(__pTodo->GetStartDate());
+
+ // Loads the due date
+ __pDueEditDate->SetDate(__pTodo->GetDueDate());
+
+ // Loads the Location
+ __pLocationEditField->SetText(__pTodo->GetLocation());
+
+ // Loads the Priority
+ __selectedPriority = __pTodo->GetPriority();
+ switch (__selectedPriority)
+ {
+ case TODO_PRIORITY_LOW:
+ __pPriorityContextButton->SetText(L"Low");
+ break;
+ case TODO_PRIORITY_NORMAL:
+ __pPriorityContextButton->SetText(L"Normal");
+ break;
+ case TODO_PRIORITY_HIGH:
+ __pPriorityContextButton->SetText(L"High");
+ break;
+ default:
+ break;
+ }
+
+ // Loads the Sensitivity
+ __selectedSensitivity = __pTodo->GetSensitivity();
+ switch (__selectedSensitivity)
+ {
+ case SENSITIVITY_PUBLIC:
+ __pSensitivityContextButton->SetText(L"Public");
+ break;
+ case SENSITIVITY_PRIVATE:
+ __pSensitivityContextButton->SetText(L"Private");
+ break;
+ case SENSITIVITY_CONFIDENTIAL:
+ __pSensitivityContextButton->SetText(L"Confidential");
+ break;
+ default:
+ break;
+ }
+
+ // Loads the Status
+ __selectedStatus = __pTodo->GetStatus();
+ switch (__selectedStatus)
+ {
+ case TODO_STATUS_NONE:
+ __pStatusContextButton->SetText(L"None");
+ break;
+ case TODO_STATUS_NEEDS_ACTION:
+ __pStatusContextButton->SetText(L"Needs action");
+ break;
+ case TODO_STATUS_COMPLETED:
+ __pStatusContextButton->SetText(L"Completed");
+ break;
+ case TODO_STATUS_IN_PROCESS:
+ __pStatusContextButton->SetText(L"In process");
+ break;
+ case TODO_STATUS_CANCELLED:
+ __pStatusContextButton->SetText(L"Cancelled");
+ break;
+ default:
+ break;
+ }
+
+ // Loads the Description
+ __pDescriptionEditField->SetText(__pTodo->GetDescription());
+
+}
+
+result
+EditTodoForm::UpdateTodo(void)
+{
+ result r = E_SUCCESS;
+
+ Calendarbook calendarbook;
+ r = calendarbook.Construct();
+ TryReturn(!IsFailed(r), r, "Failed to construct the calendarbook (%s).", GetErrorMessage(r));
+
+ // Sets the subject
+ __pTodo->SetSubject(__pSubjectEditField->GetText());
+
+ // Sets the start date
+ r = __pTodo->SetStartDate(__pStartEditDate->GetDate());
+ TryReturn(!IsFailed(r), r, "Failed to sets the start date (%s)", GetErrorMessage(r));
+
+ r = __pTodo->SetDueDate(__pDueEditDate->GetDate());
+ TryReturn(!IsFailed(r), r, "Failed to sets the due date (%s)", GetErrorMessage(r));
+
+ // Sets the location
+ __pTodo->SetLocation(__pLocationEditField->GetText());
+
+ // Sets the status
+ __pTodo->SetStatus(__selectedStatus);
+
+ // Sets the Sensitivity
+ __pTodo->SetSensitivity(__selectedSensitivity);
+
+ // Sets the priority
+ __pTodo->SetPriority(__selectedPriority);
+
+ // Sets the description
+ __pTodo->SetDescription(__pDescriptionEditField->GetText());
+
+ r = calendarbook.UpdateTodo(*__pTodo);
+ if (IsFailed(r))
+ {
+ MessageBox messageBox;
+ messageBox.Construct(L"Error", "Failed to update Todo", MSGBOX_STYLE_OK, 0);
+ int doModal;
+ messageBox.ShowAndWait(doModal);
+ }
+ TryReturn(!IsFailed(r), r, "Failed to update Todo (%s).", GetErrorMessage(r));
+
+ return r;
+}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "SceneRegister.h"
+#include "TodoFormFactory.h"
+
+using namespace Tizen::Ui::Scenes;
+
+// Definitions of extern.
+const wchar_t* SCENE_LIST = L"TodoListScene";
+const wchar_t* SCENE_DETAIL = L"TodoDetailScene";
+const wchar_t* SCENE_CREATION = L"CreateTodoScene";
+const wchar_t* SCENE_EDITION = L"EditTodoScene";
+
+SceneRegister::SceneRegister(void)
+{
+}
+
+SceneRegister::~SceneRegister(void)
+{
+}
+
+void
+SceneRegister::RegisterAllScenes(void)
+{
+ static const wchar_t* PANEL_BLANK = L"";
+ static TodoFormFactory formFactory;
+
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ AppAssert(pSceneManager);
+ pSceneManager->RegisterFormFactory(formFactory);
+
+ pSceneManager->RegisterScene(SCENE_LIST, FORM_LIST, PANEL_BLANK);
+ pSceneManager->RegisterScene(SCENE_DETAIL, FORM_DETAIL, PANEL_BLANK);
+ pSceneManager->RegisterScene(SCENE_CREATION, FORM_CREATION, PANEL_BLANK);
+ pSceneManager->RegisterScene(SCENE_EDITION, FORM_EDITION, PANEL_BLANK);
+}
+
+
+
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <new>
+
+#include "Todo.h"
+#include "TodoFrame.h"
+#include "TodoFormFactory.h"
+#include "SceneRegister.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+
+
+TodoApp::TodoApp(void)
+{
+}
+
+TodoApp::~TodoApp(void)
+{
+}
+
+UiApp*
+TodoApp::CreateInstance(void)
+{
+ // Create the instance through the constructor.
+ return new TodoApp();
+}
+
+bool
+TodoApp::OnAppInitializing(AppRegistry& appRegistry)
+{
+ return true;
+}
+
+bool
+TodoApp::OnAppInitialized(void)
+{
+ result r = E_SUCCESS;
+
+ // Create a Frame
+ TodoFrame* pTodoFrame = new TodoFrame();
+ pTodoFrame->Construct();
+ pTodoFrame->SetName(L"Todo");
+ AddFrame(*pTodoFrame);
+
+ // SceneManagement initializing
+ SceneRegister::RegisterAllScenes();
+
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ AppAssert(pSceneManager);
+
+ r = pSceneManager->GoForward(ForwardSceneTransition(SCENE_LIST));
+ TryReturn(!IsFailed(r), false, "%s", GetErrorMessage(r));
+
+ return true;
+}
+
+bool
+TodoApp::OnAppWillTerminate(void)
+{
+ return true;
+}
+
+bool
+TodoApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
+{
+ return true;
+}
+
+void
+TodoApp::OnForeground(void)
+{
+}
+
+void
+TodoApp::OnBackground(void)
+{
+}
+
+void
+TodoApp::OnLowMemory(void)
+{
+}
+
+void
+TodoApp::OnBatteryLevelChanged(BatteryLevel batteryLevel)
+{
+}
+
+void
+TodoApp::OnScreenOn(void)
+{
+}
+
+void
+TodoApp::OnScreenOff(void)
+{
+}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <new>
+#include <FBase.h>
+
+#include "TodoDetailForm.h"
+#include "SceneRegister.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+using namespace Tizen::Social;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+
+TodoDetailForm::TodoDetailForm()
+ : __pCalendarbook(null)
+ , __pTodo(null)
+{
+}
+
+TodoDetailForm::~TodoDetailForm()
+{
+}
+
+bool
+TodoDetailForm::Initialize(void)
+{
+ result r = E_SUCCESS;
+
+ __pCalendarbook = new Calendarbook();
+ TryReturn(__pCalendarbook != null, false, "Failed to instantiate calendarbook");
+
+ r = __pCalendarbook->Construct();
+ TryReturn(r == E_SUCCESS, false, "Failed to construct the calendarbook (%s).", GetErrorMessage(r));
+
+ Construct(FORM_STYLE_NORMAL | FORM_STYLE_FOOTER | FORM_STYLE_HEADER | FORM_STYLE_INDICATOR);
+ TryReturn(r == E_SUCCESS, false, "Failed to construct the form (%s).", GetErrorMessage(r));
+
+ return true;
+}
+
+result
+TodoDetailForm::OnInitializing(void)
+{
+ result r = E_SUCCESS;
+
+ Header* pHeader = GetHeader();
+ AppAssert(pHeader);
+ pHeader->SetStyle(HEADER_STYLE_TITLE);
+ pHeader->SetTitleText(L"DETAILS");
+
+ Footer* pFooter = GetFooter();
+ AppAssert(pFooter);
+ pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
+
+ FooterItem footerEdit;
+ footerEdit.Construct(ID_FOOTER_EDIT);
+ footerEdit.SetText(L"Edit");
+ pFooter->AddItem(footerEdit);
+
+ FooterItem footerDelete;
+ footerDelete.Construct(ID_FOOTER_DELETE);
+ footerDelete.SetText(L"Delete");
+ pFooter->AddItem(footerDelete);
+
+ pFooter->SetBackButton();
+ SetFormBackEventListener(this);
+
+ pFooter->AddActionEventListener(*this);
+
+ static const unsigned int COLOR_BACKGROUND_LABEL = 0xFFEFEDE5;
+ static const unsigned int COLOR_TITLE_LABEL = 0xFF808080;
+
+ static const int UI_X_POSITION_GAP = 20;
+ static const int UI_WIDTH = GetClientAreaBounds().width - 40;
+ static const int UI_X_POSITION_MIDDLE = UI_WIDTH / 4 + UI_X_POSITION_GAP;
+ static const int UI_HEIGHT = 112;
+ static const int UI_SPACE = 26;
+ int yPosition = 0;
+
+ String date;
+ DateTime displayStartDate;
+ DateTime displayDueDate;
+
+ // Subject
+ Label* pSubjectLabel = new (std::nothrow) Label();
+ pSubjectLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition, UI_WIDTH , UI_HEIGHT), L"Subject");
+ pSubjectLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pSubjectLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pSubjectLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
+ AddControl(*pSubjectLabel);
+
+ __pSubjectLabelData = new (std::nothrow) Label();
+ __pSubjectLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
+ __pSubjectLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pSubjectLabelData);
+
+ // Start Date
+ Label* pStartDateLabel = new (std::nothrow) Label();
+ pStartDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), L"Start");
+ pStartDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pStartDateLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pStartDateLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
+ AddControl(*pStartDateLabel);
+
+ __pStartDateLabelData = new (std::nothrow) Label();
+ __pStartDateLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
+ __pStartDateLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pStartDateLabelData);
+
+ // Due Date
+ Label* pDueDateLabel = new (std::nothrow) Label();
+ pDueDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"Due");
+ pDueDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pDueDateLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pDueDateLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
+ AddControl(*pDueDateLabel);
+
+ __pDueDateLabelData = new (std::nothrow) Label();
+ __pDueDateLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
+ __pDueDateLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pDueDateLabelData);
+
+ // Location
+ Label* pLocationLabel = new (std::nothrow) Label();
+ pLocationLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), L"Location");
+ pLocationLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pLocationLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pLocationLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
+ AddControl(*pLocationLabel);
+
+ __pLocationLabelData = new (std::nothrow) Label();
+ __pLocationLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
+ __pLocationLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pLocationLabelData);
+
+ // Priority
+ Label* pPriorityLabel = new (std::nothrow) Label();
+ pPriorityLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), L"Priority");
+ pPriorityLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pPriorityLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pPriorityLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
+ AddControl(*pPriorityLabel);
+
+ __pPriorityLabelData = new (std::nothrow) Label();
+ __pPriorityLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
+ __pPriorityLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pPriorityLabelData);
+
+ // Sensitivity
+ Label* pSensitivityLabel = new (std::nothrow) Label();
+ pSensitivityLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"Sensitivity");
+ pSensitivityLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pSensitivityLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pSensitivityLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
+ AddControl(*pSensitivityLabel);
+
+ __pSensitivityLabelData = new (std::nothrow) Label();
+ __pSensitivityLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
+ __pSensitivityLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pSensitivityLabelData);
+
+ // Status
+ Label* pStatusLabel = new (std::nothrow) Label();
+ pStatusLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"Status");
+ pStatusLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pStatusLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pStatusLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
+ AddControl(*pStatusLabel);
+
+ __pStatusLabelData = new (std::nothrow) Label();
+ __pStatusLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
+ __pStatusLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pStatusLabelData);
+
+ // Description
+ Label* pDescriptionLabel = new (std::nothrow) Label();
+ pDescriptionLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), L"Description");
+ pDescriptionLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ pDescriptionLabel->SetTextColor(COLOR_TITLE_LABEL);
+ pDescriptionLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
+ AddControl(*pDescriptionLabel);
+
+ __pDescriptionLabelData = new (std::nothrow) Label();
+ __pDescriptionLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
+ __pDescriptionLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ AddControl(*__pDescriptionLabelData);
+
+ return r;
+}
+
+result
+TodoDetailForm::OnTerminating(void)
+{
+ result r = E_SUCCESS;
+
+ delete __pCalendarbook;
+
+ if (__pTodo != null)
+ {
+ delete __pTodo;
+ }
+
+ return r;
+}
+
+void
+TodoDetailForm::OnActionPerformed(const Tizen::Ui::Control& source,int actionId)
+{
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ AppAssert(pSceneManager);
+
+ switch (actionId)
+ {
+ case ID_FOOTER_EDIT:
+ {
+ ArrayList* pList = new ArrayList();
+ pList->Construct();
+ pList->Add(*(new (std::nothrow)CalTodo(*__pTodo)));
+
+ pSceneManager->GoForward(ForwardSceneTransition(SCENE_EDITION), pList);
+ }
+ break;
+ case ID_FOOTER_DELETE:
+ {
+ ShowMessageBox();
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+ }
+
+void
+TodoDetailForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
+{
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ AppAssert(pSceneManager);
+
+ pSceneManager->GoBackward(BackwardSceneTransition(SCENE_LIST));
+}
+
+void
+TodoDetailForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
+{
+ result r = E_SUCCESS;
+
+ if(pArgs != null)
+ {
+ Integer* pId = static_cast<Integer*>(pArgs->GetAt(0));
+ RecordId todoId = pId->ToInt();
+ r = GetTodo(todoId);
+ TryReturnVoid(!IsFailed(r),"Failed to get Todo (%s).", GetErrorMessage(r));
+
+ UpdateTodoView();
+ Invalidate(true);
+ pArgs->RemoveAll(true);
+ delete pArgs;
+ }
+}
+
+void
+TodoDetailForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,const Tizen::Ui::Scenes::SceneId& nextSceneId)
+{
+}
+
+result
+TodoDetailForm::GetTodo(Tizen::Social::RecordId todoId)
+{
+ result r = E_SUCCESS;
+ if (__pTodo)
+ {
+ delete __pTodo;
+ __pTodo = null;
+ }
+ __pTodo = __pCalendarbook->GetTodoN(todoId);
+
+ r = GetLastResult();
+ TryReturn(!IsFailed(r), r, "Failed to get the Todo (%s).", GetErrorMessage(r));
+ return r;
+}
+
+result
+TodoDetailForm::DeleteTodo(void)
+{
+ result r = E_SUCCESS;
+
+ r = __pCalendarbook->RemoveTodo(__pTodo->GetRecordId());
+ if(IsFailed(r))
+ {
+ MessageBox messageBox;
+ messageBox.Construct(L"Error", "Failed to delete Todo", MSGBOX_STYLE_OK, 0);
+ int doModal;
+ messageBox.ShowAndWait(doModal);
+ }
+ TryReturn(!IsFailed(r), r, "Failed to remove Todo (%s).", GetErrorMessage(r));
+
+ return r;
+}
+
+void
+TodoDetailForm::UpdateTodoView()
+{
+ String propertyValue;
+
+ // Subject
+ propertyValue = __pTodo->GetSubject();
+ if (propertyValue.IsEmpty())
+ {
+ propertyValue = L"(No Subject)";
+ }
+ __pSubjectLabelData->SetText(propertyValue);
+
+ // Start Date
+ DateTime startDate = __pTodo->GetStartDate();
+ propertyValue = startDate.ToString();
+ propertyValue.SetLength(10);
+ __pStartDateLabelData->SetText(propertyValue);
+
+ // Due Date
+ DateTime dueDate = __pTodo->GetDueDate();
+ propertyValue = dueDate.ToString();
+ propertyValue.SetLength(10);
+ __pDueDateLabelData->SetText(propertyValue);
+
+ // Location
+ propertyValue = __pTodo->GetLocation();
+
+ if (propertyValue.IsEmpty())
+ {
+ propertyValue = L"(No Location)";
+ }
+ __pLocationLabelData->SetText(propertyValue);
+
+ // Priority
+ switch(__pTodo->GetPriority())
+ {
+ case TODO_PRIORITY_LOW:
+ __pPriorityLabelData->SetText(L"Low");
+ break;
+ case TODO_PRIORITY_NORMAL:
+ __pPriorityLabelData->SetText(L"Normal");
+ break;
+ case TODO_PRIORITY_HIGH:
+ __pPriorityLabelData->SetText(L"High");
+ break;
+ default:
+ break;
+ }
+
+ // Sensitivity
+ switch(__pTodo->GetSensitivity())
+ {
+ case SENSITIVITY_PUBLIC:
+ __pSensitivityLabelData->SetText(L"Public");
+ break;
+ case SENSITIVITY_PRIVATE:
+ __pSensitivityLabelData->SetText(L"Private");
+ break;
+ case SENSITIVITY_CONFIDENTIAL:
+ __pSensitivityLabelData->SetText(L"Confidential");
+ break;
+ default:
+ break;
+ }
+
+ // Status
+ switch(__pTodo->GetStatus())
+ {
+ case TODO_STATUS_NONE:
+ __pStatusLabelData->SetText(L"None");
+ break;
+ case TODO_STATUS_COMPLETED:
+ __pStatusLabelData->SetText(L"Completed");
+ break;
+ case TODO_STATUS_NEEDS_ACTION:
+ __pStatusLabelData->SetText(L"Needs action");
+ break;
+ case TODO_STATUS_IN_PROCESS:
+ __pStatusLabelData->SetText(L"In process");
+ break;
+ case TODO_STATUS_CANCELLED:
+ __pStatusLabelData->SetText(L"Cancelled");
+ break;
+ default:
+ break;
+ }
+
+ // Description
+ propertyValue = __pTodo->GetDescription();
+ if (propertyValue.IsEmpty())
+ {
+ propertyValue = L"(No Description)";
+ }
+ __pDescriptionLabelData->SetText(propertyValue);
+}
+
+void
+TodoDetailForm::ShowMessageBox(void)
+{
+ result r = E_SUCCESS;
+
+ MessageBox messageBox;
+ r = messageBox.Construct(L"Delete Todo", "Are you sure you want to delete?", MSGBOX_STYLE_YESNO, 0);
+ TryReturnVoid(!IsFailed(r),"Failed to construct messageBox (%s).", GetErrorMessage(r));
+
+ int modalResult;
+ messageBox.ShowAndWait(modalResult);
+
+ switch (modalResult)
+ {
+ case MSGBOX_RESULT_YES:
+ {
+ r = DeleteTodo();
+ TryReturnVoid(!IsFailed(r),"Failed to delete Todo (%s).", GetErrorMessage(r));
+
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ AppAssert(pSceneManager);
+
+ pSceneManager->GoBackward(BackwardSceneTransition(SCENE_LIST));
+ }
+ break;
+ case MSGBOX_RESULT_NO:
+ {
+ Invalidate(true);
+ }
+ break;
+ }
+}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <new>
+
+#include "Todo.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+
+_EXPORT_ int OspMain(int argc, char* pArgv[]);
+
+/**
+ * The entry function of Tizen application called by the operating system.
+ */
+int
+OspMain(int argc, char* pArgv[])
+{
+ result r = E_SUCCESS;
+
+ AppLog("Application started.");
+ ArrayList* pArgs = new ArrayList();
+ pArgs->Construct();
+ for (int i = 0; i < argc; i++)
+ {
+ pArgs->Add(*(new String(pArgv[i])));
+ }
+
+ r = Tizen::App::UiApp::Execute(TodoApp::CreateInstance, pArgs);
+ if (IsFailed(r))
+ {
+ AppLogException("Application execution failed-[%s].", GetErrorMessage(r));
+ r &= 0x0000FFFF;
+ }
+
+ pArgs->RemoveAll(true);
+ delete pArgs;
+ AppLog("Application finished.");
+
+ return static_cast<int>(r);
+}
+#ifdef __cplusplus
+}
+#endif // __cplusplus
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <new>
+
+#include "TodoFormFactory.h"
+#include "TodoListForm.h"
+#include "CreateTodoForm.h"
+#include "TodoDetailForm.h"
+#include "EditTodoForm.h"
+
+using namespace Tizen::Ui::Scenes;
+
+// Definitions of extern.
+const wchar_t* FORM_LIST = L"TodoListForm";
+const wchar_t* FORM_DETAIL = L"TodoDetailForm";
+const wchar_t* FORM_CREATION = L"CreateTodoForm";
+const wchar_t* FORM_EDITION = L"EditTodoForm";
+
+TodoFormFactory::TodoFormFactory(void)
+{
+}
+
+TodoFormFactory::~TodoFormFactory(void)
+{
+}
+
+Tizen::Ui::Controls::Form*
+TodoFormFactory::CreateFormN(const Tizen::Base::String& formId, const Tizen::Ui::Scenes::SceneId& sceneId)
+{
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ AppAssert(pSceneManager);
+ Tizen::Ui::Controls::Form* pNewForm = null;
+
+ if (formId == FORM_LIST)
+ {
+ TodoListForm* pForm = new (std::nothrow) TodoListForm();
+ pForm->Initialize();
+ pSceneManager->AddSceneEventListener(sceneId, *pForm);
+ pNewForm = pForm;
+ }
+ else if (formId == FORM_CREATION)
+ {
+ CreateTodoForm* pForm = new (std::nothrow) CreateTodoForm();
+ pForm->Initialize();
+ pNewForm = pForm;
+ }
+ else if (formId == FORM_DETAIL)
+ {
+ TodoDetailForm* pForm = new (std::nothrow) TodoDetailForm();
+ pForm->Initialize();
+ pSceneManager->AddSceneEventListener(sceneId, *pForm);
+ pNewForm = pForm;
+ }
+ else if (formId == FORM_EDITION)
+ {
+ EditTodoForm* pForm = new (std::nothrow) EditTodoForm();
+ pForm->Initialize();
+ pSceneManager->AddSceneEventListener(sceneId, *pForm);
+ pNewForm = pForm;
+ }
+
+ return pNewForm;
+}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <new>
+
+#include "TodoFrame.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Ui;
+using namespace Tizen::Ui::Controls;
+
+TodoFrame::TodoFrame(void)
+{
+}
+
+TodoFrame::~TodoFrame(void)
+{
+}
+
+result
+TodoFrame::OnInitializing(void)
+{
+ result r = E_SUCCESS;
+ return r;
+}
+
+result
+TodoFrame::OnTerminating(void)
+{
+ result r = E_SUCCESS;
+ return r;
+}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <new>
+#include <FApp.h>
+
+#include "TodoListForm.h"
+#include "SceneRegister.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Scenes;
+using namespace Tizen::Social;
+
+static const int LIST_HEIGHT = 112;
+static const int BUTTON_HEIGHT = 74;
+
+TodoListForm::TodoListForm()
+ : __pTodosList(null)
+ , __pCalendarbook(null)
+ , __selectedStatus(TODO_STATUS_ALL)
+
+ {
+ }
+
+TodoListForm::~TodoListForm()
+{
+}
+
+bool
+TodoListForm::Initialize(void)
+{
+ result r = E_SUCCESS;
+
+ __pCalendarbook = new Calendarbook();
+ TryReturn(__pCalendarbook != null, false, "Failed to instantiate calendarbook");
+
+ r = __pCalendarbook->Construct();
+ TryReturn(!IsFailed(r), false, "Failed to construct the calendarbook (%s).", GetErrorMessage(r));
+
+ r = Construct(FORM_STYLE_NORMAL | FORM_STYLE_FOOTER | FORM_STYLE_HEADER | FORM_STYLE_INDICATOR);
+ TryReturn(!IsFailed(r), false, "Failed to construct the form (%s).", GetErrorMessage(r));
+
+ return true;
+}
+
+result
+TodoListForm::OnInitializing(void)
+{
+ result r = E_SUCCESS;
+
+ Header* pHeader = GetHeader();
+ AppAssert(pHeader);
+ pHeader->SetStyle(HEADER_STYLE_TITLE);
+ pHeader->SetTitleText(L"TODO");
+
+ Footer* pFooter = GetFooter();
+ AppAssert(pFooter);
+ pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
+
+ FooterItem footerCreate;
+ footerCreate.Construct(ID_FOOTER_CREATE);
+ footerCreate.SetText(L"Create");
+ pFooter->AddItem(footerCreate);
+ pFooter->AddActionEventListener(*this);
+
+ static const int UI_POSITION_GAP = 0;
+
+ __pStatusContextButton = new (std::nothrow) Button();
+ __pStatusContextButton->Construct(Rectangle(GetClientAreaBounds().width * 2/3, UI_POSITION_GAP, GetClientAreaBounds().width/3, BUTTON_HEIGHT), L"All");
+ __pStatusContextButton->SetActionId(ID_BUTTON_STATUS);
+ __pStatusContextButton->AddActionEventListener(*this);
+ AddControl(*__pStatusContextButton);
+
+ __pContextMenuStatusText = new (std::nothrow) ContextMenu();
+ __pContextMenuStatusText->Construct(Point(GetClientAreaBounds().width * 5/6, BUTTON_HEIGHT * 3), CONTEXT_MENU_STYLE_LIST);
+ __pContextMenuStatusText->AddItem(L"All", ID_CONTEXT_STATUS_ALL);
+ __pContextMenuStatusText->AddItem(L"None", ID_CONTEXT_STATUS_NONE);
+ __pContextMenuStatusText->AddItem(L"Needs Action", ID_CONTEXT_STATUS_NEEDS_ACTION);
+ __pContextMenuStatusText->AddItem(L"Completed", ID_CONTEXT_STATUS_COMPLETED);
+ __pContextMenuStatusText->AddItem(L"In Process", ID_CONTEXT_STATUS_IN_PROCESS);
+ __pContextMenuStatusText->AddItem(L"Cancelled", ID_CONTEXT_STATUS_CANCELLED);
+ __pContextMenuStatusText->AddActionEventListener(*this);
+
+ __pListView = new (std::nothrow) ListView();
+ __pListView->Construct(Rectangle(UI_POSITION_GAP, BUTTON_HEIGHT, GetClientAreaBounds().width, GetClientAreaBounds().height - BUTTON_HEIGHT));
+ __pListView->SetItemProvider(*this);
+ __pListView->AddListViewItemEventListener(*this);
+ AddControl(*__pListView);
+
+ __selectedStatus = TODO_STATUS_ALL;
+ r = GetTodoList();
+ TryReturn(!IsFailed(r), r, "Failed to get the Todo list (%s).", GetErrorMessage(r));
+
+ SetFormBackEventListener(this);
+
+ return r;
+}
+
+result
+TodoListForm::OnTerminating(void)
+{
+ result r = E_SUCCESS;
+
+ delete __pCalendarbook;
+
+ if (__pTodosList != null)
+ {
+ __pTodosList->RemoveAll(true);
+ delete __pTodosList;
+ }
+
+ return r;
+}
+
+void
+TodoListForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
+{
+ result r = E_SUCCESS;
+
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ AppAssert(pSceneManager);
+
+ switch (actionId)
+ {
+ case ID_FOOTER_CREATE:
+ pSceneManager->GoForward(ForwardSceneTransition(SCENE_CREATION));
+ break;
+ case ID_BUTTON_STATUS:
+ __pContextMenuStatusText->SetShowState(true);
+ __pContextMenuStatusText->Show();
+ break;
+ case ID_CONTEXT_STATUS_NONE:
+ __pStatusContextButton->SetText(L"None");
+ __pStatusContextButton->Invalidate(false);
+ __selectedStatus = TODO_STATUS_NONE;
+
+ r = GetTodoList();
+ TryReturnVoid(!IsFailed(r), "Failed to get the Todo list (%s).", GetErrorMessage(r));
+
+ __pListView->UpdateList();
+ break;
+ case ID_CONTEXT_STATUS_NEEDS_ACTION:
+ __pStatusContextButton->SetText(L"Needs Action");
+ __pStatusContextButton->Invalidate(false);
+ __selectedStatus = TODO_STATUS_NEEDS_ACTION;
+
+ r = GetTodoList();
+ TryReturnVoid(!IsFailed(r), "Failed to get the Todo list (%s).", GetErrorMessage(r));
+
+ __pListView->UpdateList();
+ break;
+ case ID_CONTEXT_STATUS_COMPLETED:
+ __pStatusContextButton->SetText(L"Completed");
+ __pStatusContextButton->Invalidate(false);
+ __selectedStatus = TODO_STATUS_COMPLETED;
+
+ r = GetTodoList();
+ TryReturnVoid(!IsFailed(r), "Failed to get the Todo list (%s).", GetErrorMessage(r));
+
+ __pListView->UpdateList();
+ break;
+ case ID_CONTEXT_STATUS_IN_PROCESS:
+ __pStatusContextButton->SetText(L"In Process");
+ __pStatusContextButton->Invalidate(false);
+ __selectedStatus = TODO_STATUS_IN_PROCESS;
+
+ r = GetTodoList();
+ TryReturnVoid(!IsFailed(r), "Failed to get the Todo list (%s).", GetErrorMessage(r));
+
+ __pListView->UpdateList();
+ break;
+ case ID_CONTEXT_STATUS_CANCELLED:
+ __pStatusContextButton->SetText(L"Cancelled");
+ __pStatusContextButton->Invalidate(false);
+ __selectedStatus = TODO_STATUS_CANCELLED;
+
+ r = GetTodoList();
+ TryReturnVoid(!IsFailed(r), "Failed to get the Todo list (%s).", GetErrorMessage(r));
+
+ __pListView->UpdateList();
+ break;
+ case ID_CONTEXT_STATUS_ALL:
+ __pStatusContextButton->SetText(L"All");
+ __pStatusContextButton->Invalidate(false);
+ __selectedStatus = TODO_STATUS_ALL;
+
+ r = GetTodoList();
+ TryReturnVoid(!IsFailed(r), "Failed to get the Todo list (%s).", GetErrorMessage(r));
+
+ __pListView->UpdateList();
+ break;
+ default:
+ break;
+ }
+}
+
+void
+TodoListForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
+{
+ UiApp* pApp = UiApp::GetInstance();
+ AppAssert(pApp);
+ pApp->Terminate();
+}
+
+void
+TodoListForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
+{
+ if (status == LIST_ITEM_STATUS_SELECTED)
+ {
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ AppAssert(pSceneManager);
+
+ CalTodo* pTodo = static_cast<CalTodo*>(__pTodosList->GetAt(index));
+ AppAssert(pTodo);
+
+ ArrayList* pList = new (std::nothrow) ArrayList();
+ pList->Construct();
+ pList->Add(*new (std::nothrow) Integer(pTodo->GetRecordId()));
+
+ pSceneManager->GoForward(ForwardSceneTransition(SCENE_DETAIL), pList);
+ }
+}
+
+void
+TodoListForm::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
+{
+}
+
+void
+TodoListForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
+{
+}
+
+void
+TodoListForm::OnItemReordered(Tizen::Ui::Controls::ListView& view, int oldIndex, int newIndex)
+{
+}
+
+int
+TodoListForm::GetItemCount(void)
+{
+ if (__pTodosList)
+ {
+ return __pTodosList->GetCount();
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+Tizen::Ui::Controls::ListItemBase*
+TodoListForm::CreateItem (int index, int itemWidth)
+{
+
+ SimpleItem* pItem = new SimpleItem();
+ AppAssert(pItem);
+
+ CalTodo* pTodo = null;
+
+ pItem->Construct(Dimension(itemWidth, LIST_HEIGHT), LIST_ANNEX_STYLE_NORMAL);
+ pTodo = static_cast<CalTodo*>(__pTodosList->GetAt(index));
+
+ String listItemString;
+ String subject = pTodo->GetSubject();
+
+ if (subject.IsEmpty())
+ {
+ subject = L"(No subject)";
+ }
+
+ listItemString.Append(subject);
+ pItem->SetElement(listItemString);
+
+ return pItem;
+}
+
+bool
+TodoListForm::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
+{
+ delete pItem;
+ return true;
+}
+
+void
+TodoListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
+{
+ result r = E_SUCCESS;
+
+ r = GetTodoList();
+ TryReturnVoid(!IsFailed(r), "Failed to get the Todo list (%s).", GetErrorMessage(r));
+ __pListView->UpdateList();
+}
+
+void
+TodoListForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
+{
+}
+
+void
+TodoListForm::OnCalendarTodosChanged (const Tizen::Base::Collection::IList& todoChangeInfoList)
+{
+ result r = E_SUCCESS;
+
+ r = GetTodoList();
+ TryReturnVoid(!IsFailed(r), "Failed to get the Todo list (%s).", GetErrorMessage(r));
+
+ __pListView->UpdateList();
+}
+
+result
+TodoListForm::GetTodoList()
+{
+ result r = E_SUCCESS;
+
+ if (__pTodosList)
+ {
+ __pTodosList->RemoveAll(true);
+ delete __pTodosList;
+ __pTodosList = null;
+ }
+
+ CalendarbookFilter filter(CB_FI_TYPE_TODO);
+
+ if (__selectedStatus != TODO_STATUS_ALL)
+ {
+ filter.AppendInt(FI_CONJ_OP_NONE, TODO_FI_PR_STATUS, FI_CMP_OP_EQUAL, __selectedStatus);
+ }
+
+ __pTodosList = __pCalendarbook->SearchN(filter, TODO_FI_PR_DUE_DATE, SORT_ORDER_ASCENDING);
+
+ r = GetLastResult();
+ TryReturn(!IsFailed(r), r, "Failed to get the Todo list (%s).", GetErrorMessage(r));
+ return r;
+}
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template>
+
+ <slp-property>
+ <property-group>
+ <sample-name>Todo</sample-name>
+ <category>Sample</category>
+ <sdk-version>1.00</sdk-version>
+ <project-type>org.tizen.nativecpp.buildArtefactType.app</project-type>
+ <sample-description>description.xml</sample-description>
+ </property-group>
+ </slp-property>
+
+ <process type="org.tizen.nativeappcommon.TizenCopyFolder">
+ <simple name="projectName" value="$(projectName)"/>
+ <simple name="folderPath" value="project"/>
+ <complex-array name="replaceableFiles">
+ <element>
+ <simple name="sourcePath" value="manifest.xml"/>
+ <simple name="targetPath" value="manifest.xml"/>
+ <simple name="replaceable" value = "true"/>
+ </element>
+ </complex-array>
+ </process>
+ <process type="org.tizen.nativecpp.SetDefaultFrameworks">
+ <simple name="projectName" value="$(projectName)"/>
+ <complex-array name="frameworkList">
+ <element>
+ <simple name="framework" value="osp"/>
+ </element>
+ </complex-array>
+ </process>
+
+</template>