Add import function to SettingForm.
authorSungWan Kim <sw0726.kim@samsung.com>
Wed, 10 Apr 2013 04:19:16 +0000 (13:19 +0900)
committerSungWan Kim <sw0726.kim@samsung.com>
Wed, 10 Apr 2013 04:19:16 +0000 (13:19 +0900)
Change-Id: I6915ff09d3f9d7f08b2317ab5ef1705fb7788f3d
Signed-off-by: SungWan Kim <sw0726.kim@samsung.com>
inc/ClCalendarApp.h
inc/ClResourceManager.h
inc/ClSettingForm.h
inc/ClTypes.h
src/ClCalendarApp.cpp
src/ClImportForm.cpp
src/ClMainFrame.cpp
src/ClResourceManager.cpp
src/ClSettingForm.cpp
src/ClTypes.cpp
src/ClVcsSelectorForm.cpp

index 2a55ae4..ff90ec1 100644 (file)
@@ -36,7 +36,7 @@ class CalendarApp
 public:
        const Tizen::Base::String* GetArgument(const Tizen::Base::String& key) const;
        const Tizen::Base::String& GetInitialScene(void) const;
-       const Tizen::Base::Collection::IList* GetInitialSceneArgument(void) const;
+       const Tizen::Base::Collection::IList* GetInitialSceneArgumentN(void) const;
        const Tizen::Base::String& GetMimeType(void) const;
        OperationType GetOperationType(void) const;
        RequestId GetRequestId(void) const;
index 932c953..12ec199 100644 (file)
@@ -42,6 +42,8 @@ public:
 
        static Tizen::Base::DateTime ConvertUtcTimeToWallTime(const Tizen::Base::DateTime& utcTime);
        static Tizen::Base::DateTime ConvertWallTimeToUtcTime(const Tizen::Base::DateTime& wallTime);
+
+       static Tizen::Base::Collection::IList* ParseVcsFileN(const Tizen::Base::String& filePath);
 private:
        result Construct(void);
 
index 4b9d075..179e3fe 100644 (file)
 #ifndef _CL_SETTING_FORM_H_
 #define _CL_SETTING_FORM_H_
 
+#include <FApp.h>
 #include <FBase.h>
 #include <FUi.h>
 
 class SettingForm
        : public Tizen::Ui::Controls::Form
+       , public virtual Tizen::App::IAppControlResponseListener
        , public virtual Tizen::Ui::Controls::IFormBackEventListener
        , public virtual Tizen::Ui::Controls::ISectionTableViewItemEventListener
        , public virtual Tizen::Ui::Controls::ISectionTableViewItemProvider
@@ -41,6 +43,9 @@ public:
        virtual result OnInitializing(void);
        virtual result OnTerminating(void);
 
+       virtual void OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId,
+                                                                       Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData);
+
        virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
 
        virtual int GetSectionCount(void);
index 5417130..c1d4dd8 100644 (file)
@@ -242,9 +242,11 @@ extern const wchar_t* ID_OPERATION_SOCIAL_EDIT;
 extern const wchar_t* ID_OPERATION_SOCIAL_PICK;
 extern const wchar_t* ID_OPERATION_SOCIAL_VIEW;
 
+extern const wchar_t* MIME_TYPE_DIRECTORY;
 extern const wchar_t* MIME_TYPE_VCALENDAR;
 
 extern const wchar_t* KEY_DATA_PATH;
+extern const wchar_t* KEY_DATA_SELECTED;
 extern const wchar_t* KEY_DATA_SELECTION_MODE;
 extern const wchar_t* KEY_DATA_RETURN_RESULT;
 
index fa39e5a..feea890 100644 (file)
@@ -24,6 +24,7 @@
 #include <FSocial.h>
 #include "ClCalendarApp.h"
 #include "ClMainFrame.h"
+#include "ClResourceManager.h"
 
 using namespace Tizen::App;
 using namespace Tizen::Base;
@@ -36,51 +37,6 @@ using namespace Tizen::Ui::Controls;
 using namespace Tizen::Ui::Scenes;
 
 
-IList*
-ParseVcsFileN(String& vcsFilePath)
-{
-       ArrayList* pResultList = null;
-       IList* pEvents = Calendarbook::ParseEventsFromVcalendarN(vcsFilePath);
-       TryReturn(pEvents != null, null, "[%s] Unable to get event from vcs file.", GetErrorMessage(GetLastResult()));
-
-       IList* pTodos = Calendarbook::ParseTodosFromVcalendarN(vcsFilePath);
-       TryCatch(pTodos != null, , "[%s] Unable to get todo from vcs file.", GetErrorMessage(GetLastResult()));
-
-       pResultList = new (std::nothrow) ArrayList(SingleObjectDeleter);
-       pResultList->Construct(pEvents->GetCount() + pTodos->GetCount());
-
-       while (pEvents->GetCount() > 0 && pTodos->GetCount() > 0)
-       {
-               if (static_cast<CalEvent*>(pEvents->GetAt(0))->GetStartTime() > static_cast<CalTodo*>(pTodos->GetAt(0))->GetStartDate())
-               {
-                       pResultList->Add(pTodos->GetAt(0));
-                       pTodos->RemoveAt(0, false);
-               }
-               else
-               {
-                       pResultList->Add(pEvents->GetAt(0));
-                       pEvents->RemoveAt(0, false);
-               }
-       }
-       while (pEvents->GetCount() > 0)
-       {
-               pResultList->Add(pEvents->GetAt(0));
-               pEvents->RemoveAt(0, false);
-       }
-       while (pTodos->GetCount() > 0)
-       {
-               pResultList->Add(pTodos->GetAt(0));
-               pTodos->RemoveAt(0, false);
-       }
-
-CATCH:
-       delete pEvents;
-       delete pTodos;
-
-       return pResultList;
-}
-
-
 CalendarApp::CalendarApp(void)
        : __type(OPERATION_TYPE_MAIN)
        , __requestId(INVALID_REQUEST_ID)
@@ -147,9 +103,28 @@ CalendarApp::GetInitialScene(void) const
 }
 
 const IList*
-CalendarApp::GetInitialSceneArgument(void) const
+CalendarApp::GetInitialSceneArgumentN(void) const
 {
-       return __pInitialSceneArgument;
+       ArrayList* pArgs = null;
+       if (__pInitialSceneArgument != null)
+       {
+               pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
+               pArgs->Construct(__pInitialSceneArgument->GetCount());
+               IEnumerator* pEnum = __pInitialSceneArgument->GetEnumeratorN();
+               while (pEnum->MoveNext() == E_SUCCESS)
+               {
+                       if (dynamic_cast<const CalEvent*>(pEnum->GetCurrent()) != null)
+                       {
+                               pArgs->Add(new (std::nothrow) CalEvent(static_cast<const CalEvent&>(*pEnum->GetCurrent())));
+                       }
+                       else if (dynamic_cast<const CalTodo*>(pEnum->GetCurrent()) != null)
+                       {
+                               pArgs->Add(new (std::nothrow) CalTodo(static_cast<const CalTodo&>(*pEnum->GetCurrent())));
+                       }
+               }
+               delete pEnum;
+       }
+       return pArgs;
 }
 
 const String&
@@ -295,7 +270,7 @@ CalendarApp::OnAppControlRequestReceived(RequestId reqId, const String& operatio
                        String path = __uriScheme;
                        path.Replace(FILE_URL_HEADER, L"");
 
-                       __pInitialSceneArgument = ParseVcsFileN(path);
+                       __pInitialSceneArgument = ResourceManager::ParseVcsFileN(path);
                        if (__pInitialSceneArgument != null)
                        {
                                __initialScene = IDSCN_VCS_SELECTOR;
index a408ca1..1954ff8 100644 (file)
@@ -93,6 +93,7 @@ ImportForm::OnInitializing(void)
 result
 ImportForm::OnTerminating(void)
 {
+       delete __pList;
        delete __pDateTimeFormatter;
        delete __pDateFormatter;
        delete __pTimeFormatter;
@@ -217,7 +218,22 @@ void
 ImportForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
 {
        AppLogDebug("Enter.");
-       SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
+       ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
+       pArgs->Construct(__pList->GetCount());
+       IEnumerator* pEnum = __pList->GetEnumeratorN();
+       while (pEnum->MoveNext() == E_SUCCESS)
+       {
+               if (dynamic_cast<CalEvent*>(pEnum->GetCurrent()) != null)
+               {
+                       pArgs->Add(new (std::nothrow) CalEvent(static_cast<CalEvent&>(*pEnum->GetCurrent())));
+               }
+               else if (dynamic_cast<CalTodo*>(pEnum->GetCurrent()) != null)
+               {
+                       pArgs->Add(new (std::nothrow) CalTodo(static_cast<CalTodo&>(*pEnum->GetCurrent())));
+               }
+       }
+       delete pEnum;
+       SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pArgs);
        AppLogDebug("Exit.");
 }
 
@@ -326,7 +342,6 @@ void
 ImportForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
 {
        AppLogDebug("Enter.");
-       __pList = null;
        AppLogDebug("Exit.");
 }
 
index 5e58be6..90ded94 100644 (file)
@@ -49,7 +49,7 @@ MainFrame::OnInitializing(void)
        CalendarApp* pApp = static_cast<CalendarApp*>(UiApp::GetInstance());
        AppAssertf(pApp != null, "[E_FAILURE] Unable to get calendarapp.");
 
-       SceneManager::GetInstance()->GoForward(ForwardSceneTransition(pApp->GetInitialScene()), pApp->GetInitialSceneArgument());
+       SceneManager::GetInstance()->GoForward(ForwardSceneTransition(pApp->GetInitialScene()), pApp->GetInitialSceneArgumentN());
 
        return E_SUCCESS;
 }
index f22636a..5b2c5cc 100644 (file)
 #include <cstdlib>
 #include <new>
 #include <FMedia.h>
+#include <FSocial.h>
 #include <FSystem.h>
 #include "ClResourceManager.h"
 #include "ClTypes.h"
 
+using namespace Tizen;
 using namespace Tizen::App;
 using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
 using namespace Tizen::Graphics;
 using namespace Tizen::Locales;
 using namespace Tizen::Media;
@@ -36,6 +39,69 @@ using namespace Tizen::System;
 static const int BASE_DAY = 7;
 
 
+class EventComparer
+       : public virtual IComparer
+{
+       virtual result Compare(const Object& obj1, const Object& obj2, int& cmp) const;
+};
+
+result
+EventComparer::Compare(const Object& obj1, const Object& obj2, int& cmp) const
+{
+       const Social::CalEvent* pEvent1 = dynamic_cast<const Social::CalEvent*>(&obj1);
+       TryReturn(pEvent1 != null, E_FAILURE, "[E_FAILURE] Unable to convert CalEvent.");
+       const Social::CalEvent* pEvent2 = dynamic_cast<const Social::CalEvent*>(&obj2);
+       TryReturn(pEvent2 != null, E_FAILURE, "[E_FAILURE] Unable to convert CalEvent.");
+
+       long long time1 = pEvent1->GetStartTime().GetTicks();
+       long long time2 = pEvent2->GetStartTime().GetTicks();
+       if (time1 > time2)
+       {
+               cmp = 1;
+       }
+       else if (time1 < time2)
+       {
+               cmp = -1;
+       }
+       else
+       {
+               cmp = 0;
+       }
+       return E_SUCCESS;
+}
+
+class TodoComparer
+       : public virtual IComparer
+{
+       virtual result Compare(const Object& obj1, const Object& obj2, int& cmp) const;
+};
+
+result
+TodoComparer::Compare(const Object& obj1, const Object& obj2, int& cmp) const
+{
+       const Social::CalTodo* pTodo1 = dynamic_cast<const Social::CalTodo*>(&obj1);
+       TryReturn(pTodo1 != null, E_FAILURE, "[E_FAILURE] Unable to convert CalTodo.");
+       const Social::CalTodo* pTodo2 = dynamic_cast<const Social::CalTodo*>(&obj2);
+       TryReturn(pTodo2 != null, E_FAILURE, "[E_FAILURE] Unable to convert CalTodo.");
+
+       DateTime time1 = pTodo1->GetStartDate();
+       DateTime time2 = pTodo2->GetStartDate();
+       if (time1 > time2)
+       {
+               cmp = 1;
+       }
+       else if (time1 < time2)
+       {
+               cmp = -1;
+       }
+       else
+       {
+               cmp = 0;
+       }
+       return E_SUCCESS;
+}
+
+
 ResourceManager* ResourceManager::__pInstance = null;
 
 ResourceManager::ResourceManager(void)
@@ -254,6 +320,56 @@ ResourceManager::ConvertWallTimeToUtcTime(const DateTime& wallTime)
        return GetInstance()->__timeZone.WallTimeToUtcTime(wallTime);
 }
 
+IList*
+ResourceManager::ParseVcsFileN(const String& filePath)
+{
+       ArrayList* pResultList = null;
+       EventComparer eventComparer;
+       TodoComparer todoComparer;
+
+       IList* pEvents = Social::Calendarbook::ParseEventsFromVcalendarN(filePath);
+       TryReturn(pEvents != null, null, "[%s] Unable to get event from vcs file.", GetErrorMessage(GetLastResult()));
+
+       IList* pTodos = Social::Calendarbook::ParseTodosFromVcalendarN(filePath);
+       TryCatch(pTodos != null, , "[%s] Unable to get todo from vcs file.", GetErrorMessage(GetLastResult()));
+
+       pEvents->Sort(eventComparer);
+       pTodos->Sort(todoComparer);
+
+       pResultList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+       pResultList->Construct(pEvents->GetCount() + pTodos->GetCount());
+
+       while (pEvents->GetCount() > 0 && pTodos->GetCount() > 0)
+       {
+               if (static_cast<Social::CalEvent*>(pEvents->GetAt(0))->GetStartTime() > static_cast<Social::CalTodo*>(pTodos->GetAt(0))->GetStartDate())
+               {
+                       pResultList->Add(pTodos->GetAt(0));
+                       pTodos->RemoveAt(0, false);
+               }
+               else
+               {
+                       pResultList->Add(pEvents->GetAt(0));
+                       pEvents->RemoveAt(0, false);
+               }
+       }
+       while (pEvents->GetCount() > 0)
+       {
+               pResultList->Add(pEvents->GetAt(0));
+               pEvents->RemoveAt(0, false);
+       }
+       while (pTodos->GetCount() > 0)
+       {
+               pResultList->Add(pTodos->GetAt(0));
+               pTodos->RemoveAt(0, false);
+       }
+
+CATCH:
+       delete pEvents;
+       delete pTodos;
+
+       return pResultList;
+}
+
 result
 ResourceManager::Construct(void)
 {
index de6e037..66614ce 100644 (file)
@@ -20,8 +20,8 @@
  */
 
 #include <new>
-#include <FApp.h>
 #include <FGraphics.h>
+#include <FSocial.h>
 #include <FSystem.h>
 #include "ClCalendarApp.h"
 #include "ClResourceManager.h"
@@ -32,17 +32,23 @@ using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Graphics;
+using namespace Tizen::Social;
 using namespace Tizen::System;
 using namespace Tizen::Ui;
 using namespace Tizen::Ui::Controls;
 using namespace Tizen::Ui::Scenes;
 
+// This options is used for import/export function development.
+//#define _ENABLE_IMPORT_EXPORT_
+
 enum
 {
        GROUP_ITEM_INDEX = -1,
 //     GROUP_LOCK_TIME_ZONE = 0,
        GROUP_FIRST_DAY_OF_WEEK,
-//     GROUP_IMPORT_EXPORT,
+#ifdef _ENABLE_IMPORT_EXPORT_
+       GROUP_IMPORT_EXPORT,
+#endif
        GROUP_COUNT,
 
 //     LOCK_TIME_ZONE_ITEM_ONOFF = 0,
@@ -56,9 +62,11 @@ enum
        FIRST_DAY_OF_WEEK_ITEM_COUNT_EXPANDED,
        FIRST_DAY_OF_WEEK_ITEM_COUNT_COLLAPSED = FIRST_DAY_OF_WEEK_ITEM_SUNDAY,
 
-//     IMPORT_EXPORT_ITEM_IMPORT = 0,
+#ifdef _ENABLE_IMPORT_EXPORT_
+       IMPORT_EXPORT_ITEM_IMPORT = 0,
 //     IMPORT_EXPORT_ITEM_EXPORT,
-//     IMPORT_EXPORT_ITEM_COUNT
+       IMPORT_EXPORT_ITEM_COUNT
+#endif
 };
 
 static const int H_ITEM = 112;
@@ -82,6 +90,7 @@ static const unsigned int COLOR_DETAIL02 = Color32<0, 0, 0>::Value;
 static const int FONT_SIZE_DETAIL03 = 32;
 static const unsigned int COLOR_DETAIL03 = Color32<128, 128, 128>::Value;
 
+
 SettingForm::SettingForm(void)
        : __pTableView(null)
        , __pLabelLockTimeZone(null)
@@ -125,6 +134,31 @@ SettingForm::OnTerminating(void)
 }
 
 void
+SettingForm::OnAppControlCompleteResponseReceived(const AppId& appId, const String& operationId,
+                                                                                                 AppCtrlResult appControlResult, const IMap* pExtraData)
+{
+       AppLogDebug("Enter.");
+       AppLogDebug("AppId : %ls", appId.GetPointer());
+       AppLogDebug("OperationId : %ls", operationId.GetPointer());
+       if (appControlResult == APP_CTRL_RESULT_SUCCEEDED)
+       {
+               if (operationId.Equals(ID_OPERATION_PICK, false) == true && pExtraData != null)
+               {
+                       const IList* pPaths = dynamic_cast<const IList*>(pExtraData->GetValue(String(KEY_DATA_SELECTED)));
+                       if (pPaths != null && pPaths->GetCount() > 0)
+                       {
+                               IList* pList = ResourceManager::ParseVcsFileN(static_cast<const String&>(*pPaths->GetAt(0)));
+                               if (pList != null)
+                               {
+                                       SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_IMPORT, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
+                               }
+                       }
+               }
+       }
+       AppLogDebug("Exit.");
+}
+
+void
 SettingForm::OnFormBackRequested(Form& source)
 {
        CalendarApp* pApp = static_cast<CalendarApp*>(UiApp::GetInstance());
@@ -155,8 +189,10 @@ SettingForm::GetItemCount(int sectionIndex)
 //             return (__isLockTimeZoneSet == true) ? LOCK_TIME_ZONE_ITEM_COUNT_ON : LOCK_TIME_ZONE_ITEM_COUNT_OFF;
        case GROUP_FIRST_DAY_OF_WEEK:
                return (__isFirstDayOfWeekSelectionItemExpanded == true) ? FIRST_DAY_OF_WEEK_ITEM_COUNT_EXPANDED : FIRST_DAY_OF_WEEK_ITEM_COUNT_COLLAPSED;
-//     case GROUP_IMPORT_EXPORT:
-//             return IMPORT_EXPORT_ITEM_COUNT;
+#ifdef _ENABLE_IMPORT_EXPORT_
+       case GROUP_IMPORT_EXPORT:
+               return IMPORT_EXPORT_ITEM_COUNT;
+#endif
        }
        return 0;
 }
@@ -192,17 +228,19 @@ SettingForm::CreateItem(int sectionIndex, int itemIndex, int itemWidth)
                        break;
                }
                break;
-//     case GROUP_IMPORT_EXPORT:
-//             switch (itemIndex)
-//             {
-//             case IMPORT_EXPORT_ITEM_IMPORT:
-//                     pItem = CreateImportItemN(itemWidth);
-//                     break;
+#ifdef _ENABLE_IMPORT_EXPORT_
+       case GROUP_IMPORT_EXPORT:
+               switch (itemIndex)
+               {
+               case IMPORT_EXPORT_ITEM_IMPORT:
+                       pItem = CreateImportItemN(itemWidth);
+                       break;
 //             case IMPORT_EXPORT_ITEM_EXPORT:
 //                     pItem = CreateExportItemN(itemWidth);
 //                     break;
-//             }
-//             break;
+               }
+               break;
+#endif
        }
 
        return pItem;
@@ -289,40 +327,36 @@ SettingForm::GetSectionHeader(int sectionIndex)
 bool
 SettingForm::HasSectionHeader(int sectionIndex)
 {
-       return false;
+       if (sectionIndex == 0)
+       {
+               return false;
+       }
+       return true;
 }
 
 String
 SettingForm::GetSectionFooter(int sectionIndex)
 {
-       switch (sectionIndex)
-       {
+//     switch (sectionIndex)
+//     {
 //     case GROUP_LOCK_TIME_ZONE:
 //             if (__isLockTimeZoneSet == false)
 //             {
 //                     return ResourceManager::GetString(IDS_CLD_BODY_LOCK_TIME_ZONE_DESCRIPTION_MSG);
 //             }
 //             break;
-       case GROUP_FIRST_DAY_OF_WEEK:
-               break;
-//     case GROUP_IMPORT_EXPORT:
-//             break;
-       }
+//     }
        return L"";
 }
 
 bool
 SettingForm::HasSectionFooter(int sectionIndex)
 {
-       switch (sectionIndex)
-       {
+//     switch (sectionIndex)
+//     {
 //     case GROUP_LOCK_TIME_ZONE:
 //             return __isLockTimeZoneSet == false;
-       case GROUP_FIRST_DAY_OF_WEEK:
-               break;
-//     case GROUP_IMPORT_EXPORT:
-//             break;
-       }
+//     }
        return false;
 }
 
@@ -355,6 +389,30 @@ SettingForm::OnSectionTableViewItemStateChanged(SectionTableView& tableView, int
                                }
                        }
                        break;
+#ifdef _ENABLE_IMPORT_EXPORT_
+               case GROUP_IMPORT_EXPORT:
+                       switch (itemIndex)
+                       {
+                       case IMPORT_EXPORT_ITEM_IMPORT:
+                       {
+                               String mimeType = MIME_TYPE_VCALENDAR;
+                               AppControl* pApp = AppManager::FindAppControlN(AppId(L"tizen.filemanager"), ID_OPERATION_PICK);
+                               if (pApp != null)
+                               {
+                                       pApp->Start(null, &mimeType, null, this);
+                                       delete pApp;
+                               }
+
+                               // Todo: Change upper codes to below codes.
+//                             String mimeType = MIME_TYPE_VCALENDAR;
+//                             AppControl::FindAndStart(ID_OPERATION_PICK, null, &mimeType, null, null, this);
+                               break;
+                       }
+//                     case IMPORT_EXPORT_ITEM_EXPORT:
+//                             break;
+                       }
+                       break;
+#endif
                }
                break;
        case TABLE_VIEW_ITEM_STATUS_CHECKED:
@@ -439,6 +497,8 @@ SettingForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& cu
                        __pTableView->SetItemChecked(GROUP_FIRST_DAY_OF_WEEK, FIRST_DAY_OF_WEEK_ITEM_MONDAY, true);
                }
        }
+
+       delete pArgs;
 }
 
 void
index 0c4dda4..167bd9e 100644 (file)
@@ -236,9 +236,11 @@ const wchar_t* ID_OPERATION_SOCIAL_EDIT = L"http://tizen.org/appcontrol/operatio
 const wchar_t* ID_OPERATION_SOCIAL_PICK = L"http://tizen.org/appcontrol/operation/social/pick";
 const wchar_t* ID_OPERATION_SOCIAL_VIEW = L"http://tizen.org/appcontrol/operation/social/view";
 
+const wchar_t* MIME_TYPE_DIRECTORY = L"inode/directory";
 const wchar_t* MIME_TYPE_VCALENDAR = L"text/x-vcalendar";
 
 const wchar_t* KEY_DATA_PATH = L"http://tizen.org/appcontrol/data/path";
+const wchar_t* KEY_DATA_SELECTED = L"http://tizen.org/appcontrol/data/selected";
 const wchar_t* KEY_DATA_SELECTION_MODE = L"http://tizen.org/appcontrol/data/selection_mode";
 const wchar_t* KEY_DATA_RETURN_RESULT = L"http://tizen.org/appcontrol/data/return_result";
 
index f992c21..c3e4dfb 100644 (file)
@@ -98,6 +98,7 @@ VcsSelectorForm::OnInitializing(void)
 result
 VcsSelectorForm::OnTerminating(void)
 {
+       delete __pList;
        delete __pContextMenuSub;
        delete __pDateTimeFormatter;
        delete __pDateFormatter;
@@ -116,9 +117,26 @@ VcsSelectorForm::OnActionPerformed(const Control& source, int actionId)
                __pContextMenuSub->Show();
                break;
        case IDA_VCS_SELECTOR_FORM_SUB_MENU_ADD_TO_CALENDAR:
-               SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_IMPORT, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), __pList);
+       {
+               ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
+               pArgs->Construct(__pList->GetCount());
+               IEnumerator* pEnum = __pList->GetEnumeratorN();
+               while (pEnum->MoveNext() == E_SUCCESS)
+               {
+                       if (dynamic_cast<CalEvent*>(pEnum->GetCurrent()) != null)
+                       {
+                               pArgs->Add(new (std::nothrow) CalEvent(static_cast<CalEvent&>(*pEnum->GetCurrent())));
+                       }
+                       else if (dynamic_cast<CalTodo*>(pEnum->GetCurrent()) != null)
+                       {
+                               pArgs->Add(new (std::nothrow) CalTodo(static_cast<CalTodo&>(*pEnum->GetCurrent())));
+                       }
+               }
+               delete pEnum;
+               SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_IMPORT, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
                break;
        }
+       }
 }
 
 void
@@ -274,6 +292,7 @@ VcsSelectorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId
                }
                else if (dynamic_cast<CalEvent*>(pArgs->GetAt(0)) != null || dynamic_cast<CalTodo*>(pArgs->GetAt(0)) != null)
                {
+                       delete __pList;
                        __pList = pArgs;
                        pArgs = null;
                }