H/W key support added
authorravi.n2 <ravi.n2@samsung.com>
Mon, 17 Jun 2013 07:01:26 +0000 (12:31 +0530)
committerravi.n2 <ravi.n2@samsung.com>
Mon, 17 Jun 2013 07:01:26 +0000 (12:31 +0530)
Change-Id: Ib76b56801536a1b39a61834c0406bff50de2a6d0

inc/MmDrawingDetailForm.h
inc/MmListForm.h
inc/MmTextDetailForm.h
manifest.xml
src/MmCommonUtils.cpp
src/MmDrawingDetailForm.cpp
src/MmListEditorForm.cpp
src/MmListForm.cpp
src/MmTextDetailForm.cpp

index 5d9bcf1..a0d2ed0 100644 (file)
@@ -35,6 +35,7 @@ class MemoDrawingDetailForm
        //, public Tizen::Ui::ITextEventListener
        , public Tizen::Ui::ITouchEventListener
        , public Tizen::Ui::Controls::IFormBackEventListener
+       , public Tizen::Ui::Controls::IFormMenuEventListener
        , public Tizen::Ui::Controls::IListViewItemEventListener  //for AppControl list
        , public Tizen::Ui::Scenes::ISceneEventListener
        , public Tizen::Ui::ITouchFlickGestureEventListener
@@ -96,6 +97,7 @@ public:
        virtual void OnFlickGestureDetected(Tizen::Ui::TouchFlickGestureDetector& gestureDetector);
        virtual void OnFlickGestureCanceled(Tizen::Ui::TouchFlickGestureDetector& gestureDetector){};
 
+       virtual void OnFormMenuRequested(Tizen::Ui::Controls::Form& source);
 private:
        ///Delete the memo displayed in detail form
        void RemoveMemo(void);
@@ -108,7 +110,6 @@ private:
        Tizen::Graphics::Canvas*                        __pCanvas;
        Tizen::Ui::Controls::EditArea*      __pCommentEditArea;
        Tizen::Ui::Controls::Panel*                 __pCommentPanel;
-       Tizen::Ui::Controls::ContextMenu*       __pContextMenu;
        Tizen::Ui::Controls::Label*                 __pDatetimeLabel;
        Tizen::Ui::Controls::Panel*                 __pDatetimePanel;
        Tizen::Ui::Controls::Panel*                 __pDrawingPanel;
@@ -117,7 +118,7 @@ private:
        Tizen::Ui::Controls::ListView*      __pPopupList;
        AppControlListProvider*             __pAppControlListProvider;
        VMemoCreator*                                           __pVMemoCreator;
-       Tizen::Base::Collection::ArrayList*     __pUpdateDetails;
+       Tizen::Base::Collection::ArrayList* __pUpdateDetails;
        Tizen::Ui::Controls::Popup*         __pDeletePopup;
        Tizen::Ui::TouchFlickGestureDetector* __pFlickGesture;
        Tizen::Base::Integer*                           __pMemoIndex;
@@ -125,6 +126,7 @@ private:
        Tizen::Base::Collection::ArrayList* __pShareMemoList;
        Tizen::Base::String*                    __pVntFilename;
        Tizen::Base::String*                    __pDrawingFileName;
+       Tizen::Ui::Controls::OptionMenu*        __pOption;
 };
 
 #endif /* _MM_DRAWING_DETAIL_FORM_H_ */
index 072c53c..d3158dc 100755 (executable)
@@ -38,6 +38,7 @@ class MemoListForm
        , public Tizen::Ui::IKeypadEventListener
        , public Tizen::Ui::ITextEventListener
        , public Tizen::Ui::Controls::IFormBackEventListener
+       , public Tizen::Ui::Controls::IFormMenuEventListener
        , public Tizen::Ui::Controls::IListViewItemEventListener
        , public Tizen::Ui::Controls::ISearchBarEventListener
        , public Tizen::Ui::Scenes::ISceneEventListener
@@ -96,11 +97,10 @@ public:
        virtual void OnTextValueChanged (const Tizen::Ui::Control& source);
        virtual void OnTextValueChangeCanceled (const Tizen::Ui::Control& source){};
 
+       virtual void OnFormMenuRequested(Tizen::Ui::Controls::Form& source);
 private:
        Tizen::Ui::Controls::FooterItem     __footerItemCreate;
-       Tizen::Ui::Controls::ButtonItem     __footerItemMenu;
        bool __isSearchRegistered;
-       Tizen::Ui::Controls::ContextMenu*   __pContextMenu;
        ///the form header
        Tizen::Ui::Controls::Footer*        __pFormFooter;
        ///the form header
@@ -133,6 +133,7 @@ private:
        AppControlListProvider*                 __pAppControlListProvider;
        Tizen::Base::String*                    __pVntFilename;
        Tizen::Base::Collection::ArrayList* __pShareMemoList;
+       Tizen::Ui::Controls::OptionMenu*        __pOption;
        Tizen::Base::String*                    __pDrawingFileName;
 };
 
index f8442e2..a74af0c 100644 (file)
@@ -31,6 +31,7 @@ class MemoTextDetailForm
        , public Tizen::Ui::IActionEventListener
        , public Tizen::Ui::IUiLinkEventListener
        , public Tizen::Ui::Controls::IFormBackEventListener
+       , public Tizen::Ui::Controls::IFormMenuEventListener
        , public Tizen::Ui::Controls::IListViewItemEventListener  //for AppControl list
        , public Tizen::Ui::Scenes::ISceneEventListener
        , public Tizen::Ui::ITouchFlickGestureEventListener
@@ -76,6 +77,8 @@ public:
        virtual void OnFlickGestureDetected(Tizen::Ui::TouchFlickGestureDetector& gestureDetector);
        virtual void OnFlickGestureCanceled(Tizen::Ui::TouchFlickGestureDetector& gestureDetector){};
 
+       virtual void OnFormMenuRequested(Tizen::Ui::Controls::Form& source);
+
 protected:
        ///Deletes memo
        void RemoveMemo(void);
@@ -87,12 +90,10 @@ private:
 private:
        ///Delete footer item
        Tizen::Ui::Controls::FooterItem     __footerItemDelete;
-       Tizen::Ui::Controls::ButtonItem     __footerItemMenu;
        ///App control list provider
        AppControlListProvider*                 __pAppControlListProvider;
        ///Editarea control to show the memo content
        Tizen::Ui::Controls::EditArea*      __pContent;
-       Tizen::Ui::Controls::ContextMenu*       __pContextMenu;
        ///Datetime label to show the memo created/modified date time
        Tizen::Ui::Controls::Label*         __pDateTime;
        Tizen::Ui::Controls::Panel*                     __pDateTimePanel;
@@ -113,9 +114,10 @@ private:
        Tizen::Base::String*                    __pVntFilename;
        Tizen::Ui::Controls::Popup*         __pDeletePopup;
        Tizen::Ui::TouchFlickGestureDetector* __pFlickGesture;
-       Tizen::Base::Integer*                                   __pMemoIndex;
-       Tizen::Base::Integer*                                   __pCount;
+       Tizen::Base::Integer*                           __pMemoIndex;
+       Tizen::Base::Integer*                           __pCount;
        Tizen::Base::Collection::ArrayList* __pShareMemoList;
+       Tizen::Ui::Controls::OptionMenu*        __pOption;
 };
 
 #endif /* _MM_TEXT_DETAIL_FORM_H_ */
index d7e162f..20277bb 100644 (file)
@@ -4,6 +4,7 @@
     <Version>1.0.0</Version>
     <Type>C++App</Type>
     <Requirements>
+        <Feature Name="http://tizen.org/feature/platform.core.cpu.arch.armv7">true</Feature>
         <Feature Name="http://tizen.org/feature/platform.core.cpu.arch.x86">true</Feature>
         <Feature Name="http://tizen.org/feature/platform.core.fpu.arch.vfpv3">true</Feature>
     </Requirements>
index 3e07d48..7aa70ee 100755 (executable)
@@ -414,6 +414,12 @@ void RefreshEditListScene(void)
                        pFooter->SetItemEnabled(2, true);
                        pFooter->Draw();
                }
+               Header* pHeader = pSceneManager->GetCurrentScene()->GetForm()->GetHeader();
+               if(pHeader != null)
+               {
+                       pHeader->SetButtonEnabled(BUTTON_POSITION_RIGHT, false);
+                       pHeader->Draw();
+               }
 
        }
        /*SceneManager* pSceneManager = SceneManager::GetInstance();
index cc7acd9..fffe89a 100755 (executable)
@@ -62,6 +62,7 @@ MemoDrawingDetailForm::MemoDrawingDetailForm(void)
        , __pShareMemoList(null)
        , __pVntFilename(null)
        , __pDrawingFileName(null)
+       , __pOption(null)
 {
        __pVMemoCreator = new (std::nothrow) VMemoCreator();
 }
@@ -120,7 +121,6 @@ result
 MemoDrawingDetailForm::OnInitializing(void)
 {
        result r = E_SUCCESS;
-       int xPos= 0, yPos = 0;
 
        Header* pFormHeader = GetHeader();
        if (pFormHeader != null)
@@ -135,12 +135,9 @@ MemoDrawingDetailForm::OnInitializing(void)
                pFormFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
                pFormFooter->AddActionEventListener(*this);
                pFormFooter->SetBackButton();
+               pFormFooter->SetMenuButton();
                SetFormBackEventListener(this);
-
-               //More option
-               ButtonItem menuButton;
-               menuButton.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_BUTTON_MORE);
-               AddFooterMenuItem(pFormFooter, menuButton);
+               SetFormMenuEventListener(this);
 
                FooterItem deleteButton;
                deleteButton.Construct(IDA_FOOTER_BUTTON_LEFT);
@@ -211,18 +208,15 @@ MemoDrawingDetailForm::OnInitializing(void)
                        Invalidate(false);
                }
        }
-       __pContextMenu = new (std::nothrow) ContextMenu();
-       if (pFormFooter != null)
-       {
-               pFormFooter->GetPosition(xPos, yPos);
-               __pContextMenu->Construct(Point(0,yPos), CONTEXT_MENU_STYLE_LIST);
-       }
-       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_BODY_EDIT"), IDA_FOOTER_BUTTON_EDIT);
-       __pContextMenu->AddItem(GetResourceString(L"DS_COM_BUTTON_SHARE"), IDA_FOOTER_BUTTON_SHARE);
-       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_BODY_CREATE"), IDA_FOOTER_BUTTON_CREATE);
-       __pContextMenu->AddActionEventListener(*this);
-       __pContextMenu->SetShowState(false);
-       
+
+       __pOption = new (std::nothrow) OptionMenu();
+       __pOption->Construct();
+       __pOption->AddItem(GetResourceString(L"IDS_COM_BODY_EDIT"), IDA_FOOTER_BUTTON_EDIT);
+       __pOption->AddItem(GetResourceString(L"IDS_COM_BUTTON_SHARE"), IDA_FOOTER_BUTTON_SHARE);
+       __pOption->AddItem(GetResourceString(L"IDS_COM_BODY_CREATE"), IDA_FOOTER_BUTTON_CREATE);
+       __pOption->AddActionEventListener(*this);
+       __pOption->SetShowState(false);
+
        __pFlickGesture = new (std::nothrow) TouchFlickGestureDetector;
        if (__pFlickGesture != null)
        {
@@ -252,7 +246,10 @@ MemoDrawingDetailForm::OnTerminating(void)
                __pFlickGesture->RemoveFlickGestureEventListener(*this);
                delete __pFlickGesture;
        }
-
+       if (__pOption != null)
+       {
+               __pOption->Destroy();
+       }
        return E_SUCCESS;
 }
 
@@ -459,23 +456,13 @@ MemoDrawingDetailForm::OnActionPerformed(const Control& source, int actionId)
                }
                break;
 
-       case IDA_FOOTER_BUTTON_MORE:    //More
-               {
-                       __pContextMenu->RemoveAllItems();
-                       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_BODY_EDIT"), IDA_FOOTER_BUTTON_EDIT);
-                       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_BUTTON_SHARE"), IDA_FOOTER_BUTTON_SHARE);
-                       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_BODY_CREATE"), IDA_FOOTER_BUTTON_CREATE);
-                       __pContextMenu->SetShowState(true);
-                       __pContextMenu->Show();
-               }
-               break;
-
        case IDA_BUTTON_CLOSE_POPUP:
                {
                        __pPopup->SetShowState(false);
                        __pPopup->Invalidate(true);
                }
                break;
+
        case IDA_BUTTON_CANCEL_POPUP:
                {
                        __pDeletePopup->SetShowState(false);
@@ -490,6 +477,7 @@ MemoDrawingDetailForm::OnActionPerformed(const Control& source, int actionId)
                        RemoveMemo();
                }
                break;
+
        default:
                {
                        AppAssertf(0,"[%s] MemoDrawingDetailForm::OnActionPerformed() actionId cannot be [%d]", GetErrorMessage(E_INVALID_DATA), actionId);
@@ -639,12 +627,20 @@ MemoDrawingDetailForm::OnSceneDeactivated(const SceneId& currentSceneId, const S
 void
 MemoDrawingDetailForm::OnFormBackRequested(Form& source)
 {
-       SceneManager* pSceneManager = SceneManager::GetInstance();
-       IList* pArgs = new (std::nothrow) ArrayList();
+       if (__pOption->GetShowState() == true)
+       {
+               __pOption->SetShowState(false);
+               __pOption->Show();
+       }
+       else
+       {
+               SceneManager* pSceneManager = SceneManager::GetInstance();
+               IList* pArgs = new (std::nothrow) ArrayList();
 
-       UpdateComment();
-       pArgs->Add(new Integer(ID_REFRESH_LIST_FROM_DATABASE));
-       pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_MEMO_LIST), pArgs);
+               UpdateComment();
+               pArgs->Add(new Integer(ID_REFRESH_LIST_FROM_DATABASE));
+               pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_MEMO_LIST), pArgs);
+       }
        return;
 }
 
@@ -795,3 +791,10 @@ MemoDrawingDetailForm::OnTouchReleased(const Tizen::Ui::Control& source, const T
        }
        return;
 }
+
+void
+MemoDrawingDetailForm::OnFormMenuRequested(Form& source)
+{
+       __pOption->SetShowState(true);
+       __pOption->Show();
+}
index 2c99492..0070bf3 100644 (file)
@@ -313,6 +313,8 @@ MemoListEditorForm::OnActionPerformed(const Control& source, int actionId)
                        }
                        __pDeletePopup->SetShowState(true);
                        __pDeletePopup->Show();
+                       __pFormHeader->SetButtonEnabled(BUTTON_POSITION_RIGHT, false);
+                       __pFormHeader->Show();
                        __pFormFooter->SetItemEnabled(2, false);
                        SetFooterEnabled(false);
                }
@@ -330,6 +332,8 @@ MemoListEditorForm::OnActionPerformed(const Control& source, int actionId)
                        }
                        __pPopup->SetShowState(true);
                        __pPopup->Show();
+                       __pFormHeader->SetButtonEnabled(BUTTON_POSITION_RIGHT, false);
+                       __pFormHeader->Show();
                        __pFormFooter->SetItemEnabled(2, false);
                        SetFooterEnabled(false);
                }
@@ -347,6 +351,8 @@ MemoListEditorForm::OnActionPerformed(const Control& source, int actionId)
                {
                        __pPopup->SetShowState(false);
                        __pPopup->Invalidate(true);
+                       __pFormHeader->SetButtonEnabled(BUTTON_POSITION_RIGHT, true);
+                       __pFormHeader->Show();
                        __pFormFooter->SetItemEnabled(2, true);
                        SetFooterEnabled(true);
                }
@@ -375,6 +381,8 @@ MemoListEditorForm::OnActionPerformed(const Control& source, int actionId)
        {
                __pDeletePopup->SetShowState(false);
                __pDeletePopup->Invalidate(true);
+               __pFormHeader->SetButtonEnabled(BUTTON_POSITION_RIGHT, true);
+               __pFormHeader->Show();
                __pFormFooter->SetItemEnabled(2, true);
                SetFooterEnabled(true);
        }
index b283faf..24949b2 100755 (executable)
@@ -41,7 +41,6 @@ using namespace Tizen::Ui::Scenes;
 
 MemoListForm::MemoListForm(void)
        : __isSearchRegistered(false)
-       , __pContextMenu(null)
        , __pFormFooter(null)
        , __pFormHeader(null)
        , __pMemoDetails(null)
@@ -59,6 +58,7 @@ MemoListForm::MemoListForm(void)
        , __pSharePopup(null)
        , __pVntFilename(null)
        , __pShareMemoList(null)
+       , __pOption(null)
        , __pDrawingFileName(null)
 {
        __pVMemoCreator = new (std::nothrow) VMemoCreator();
@@ -80,7 +80,6 @@ result
 MemoListForm::OnInitializing(void)
 {
        result r = E_SUCCESS;
-       int xPos= 0, yPos = 0;
 
        __pMemoListDataProvider = new (std::nothrow) MemoListDataProvider();
        __pSearchItemProvider = new (std::nothrow) MemoSearchDataProvider();
@@ -96,10 +95,9 @@ MemoListForm::OnInitializing(void)
        __pFormFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
        __pFormFooter->AddActionEventListener(*this);
        __pFormFooter->SetBackButton();
+       __pFormFooter->SetMenuButton();
        SetFormBackEventListener(this);
-
-       __footerItemMenu.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_BUTTON_MORE);
-       AddFooterMenuItem(__pFormFooter, __footerItemMenu);
+       SetFormMenuEventListener(this);
 
        __footerItemCreate.Construct(IDA_FOOTER_BUTTON_CREATE);
        __footerItemCreate.SetText(GetResourceString(L"IDS_COM_BODY_CREATE"));
@@ -123,14 +121,13 @@ MemoListForm::OnInitializing(void)
        __pMemoListView->SetShowState(false);
        __pSearchBar->SetContent(__pMemoListView);
 
-       __pContextMenu = new (std::nothrow) ContextMenu();
-       __pFormFooter->GetPosition(xPos, yPos);
-       __pContextMenu->Construct(Point(0 , yPos), CONTEXT_MENU_STYLE_LIST);
-       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_BODY_SEARCH"), IDA_MENU_SEARCH);
-       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_BODY_EDIT"), IDA_MENU_EDIT);
-       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_OPT_SORT_BY"), IDA_MENU_SORTBY);
-       __pContextMenu->AddActionEventListener(*this);
-       __pContextMenu->SetShowState(false);
+       __pOption = new (std::nothrow) OptionMenu();
+       __pOption->Construct();
+       __pOption->AddItem(GetResourceString(L"IDS_COM_BODY_SEARCH"), IDA_MENU_SEARCH);
+       __pOption->AddItem(GetResourceString(L"IDS_COM_BODY_EDIT"), IDA_MENU_EDIT);
+       __pOption->AddItem(GetResourceString(L"IDS_COM_OPT_SORT_BY"), IDA_MENU_SORTBY);
+       __pOption->AddActionEventListener(*this);
+       __pOption->SetShowState(false);
 
        CreateSortRegistry();
        return r;
@@ -186,6 +183,10 @@ MemoListForm::OnTerminating(void)
                __pShareMemoList->RemoveAll();
                delete __pShareMemoList;
        }
+       if (__pOption != null)
+       {
+               __pOption->Destroy();
+       }
        if(__pDrawingFileName != null)
        {
                delete __pDrawingFileName;
@@ -209,13 +210,13 @@ MemoListForm::DisplayData(RequestId requestId, Tizen::Base::Collection::IList* p
                        SetListFormTitle(ID_MEMO_LIST);
                        //Enable or disable the edit option depending on the memo count
                        int memoCount = MemoListPresentationModel::GetInstance()->GetMemoCount(ID_MEMO_LIST);
-                       if (memoCount == 0)
+                       if(memoCount == 0)
                        {
-                               __pFormFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
+                               __pFormFooter->SetMenuButtonEnabled(false);
                        }
                        else
                        {
-                               __pFormFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
+                               __pFormFooter->SetMenuButtonEnabled(true);
                        }
                        __pFormFooter->Draw();
                        __pMemoListView->ScrollToItem(0);
@@ -310,23 +311,6 @@ MemoListForm::OnActionPerformed(const Control& source, int actionId)
                }
                break;
 
-       case IDA_FOOTER_BUTTON_MORE:
-               {
-                       //Items are removed and added again as there was issue of Edit Item is always selected once the
-                       //Edit option is selected and again more is selected
-                       __pContextMenu->RemoveAllItems();
-                       bool showState = __pSearchBar->GetShowState();
-                       if (showState == false)
-                       {
-                               __pContextMenu->AddItem(GetResourceString(L"IDS_COM_BODY_SEARCH"), IDA_MENU_SEARCH);
-                       }
-                       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_BODY_EDIT"), IDA_MENU_EDIT);
-                       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_OPT_SORT_BY"), IDA_MENU_SORTBY);
-                       __pContextMenu->SetShowState(true);
-                       __pContextMenu->Show();
-               }
-               break;
-
        case IDA_MENU_SEARCH:
                {
                        __pSearchBar->SetShowState(true);
@@ -498,12 +482,17 @@ MemoListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
                {
                        __pFormFooter->SetShowState(true);
                }
+               //Need to add menu button again as menu button was removed
+               __pFormFooter->SetMenuButton();
+               SetFormMenuEventListener(this);
+
                DisplayData(ID_MEMO_LIST);
                __pSearchBar->SetFocusable(false);
                __pSearchBar->SetContentAreaVisible(true);
        }
        else
        {
+               FloatRectangle rect = CoordinateSystem::AlignToDevice(FloatRectangle(__pSearchBar->GetBoundsF()));
                RelativeLayout* pLayout = dynamic_cast<RelativeLayout*>(GetLayoutN());
                if(__pMemoListView != null)
                {
@@ -511,9 +500,11 @@ MemoListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
                        __pMemoListView->ScrollToItem(0);
                }
                __isSearchRegistered = true;
+               __pFormFooter->RemoveMenuButton();
                __pFormFooter->SetShowState(false);
-               __pSearchBar->SetContentAreaSize(Dimension(GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight()));
+               __pSearchBar->SetContentAreaSize(FloatDimension(GetClientAreaBoundsF().width, GetClientAreaBoundsF().height - rect.height));
        }
+       __pFormFooter->Draw(true);
        __pMemoListView->Invalidate(true);
        return;
 }
@@ -552,11 +543,11 @@ MemoListForm::DeleteListItem(void)
                        int memoCount = MemoListPresentationModel::GetInstance()->GetMemoCount(ID_MEMO_LIST);
                        if (memoCount == 0)
                        {
-                               __pFormFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, false);
+                               __pFormFooter->SetMenuButtonEnabled(false);
                        }
                        else
                        {
-                               __pFormFooter->SetButtonEnabled(BUTTON_POSITION_LEFT, true);
+                               __pFormFooter->SetMenuButtonEnabled(true);
                        }
                        __pFormFooter->Draw();
                }
@@ -609,7 +600,6 @@ void
 MemoListForm::OnListViewItemStateChanged (ListView& listView, int index, int elementId, ListItemStatus status)
 {
        MemoInfo* pMemoData = null;
-
        if (&listView == __pPopupList)
        {
                __pPopupList->SetItemChecked(index, false);
@@ -708,14 +698,16 @@ MemoListForm::OnListViewItemStateChanged (ListView& listView, int index, int ele
 void
 MemoListForm::OnFormBackRequested(Form& source)
 {
-       //back button: terminates application
+       if (__pOption->GetShowState() == true)
+       {
+               __pOption->SetShowState(false);
+               return;
+       }
 
        //Hide the search bar if it is visible, else terminate the app
-       if(__pSearchBar->GetShowState() == true/* && __pSearchBar->GetMode() == SEARCH_BAR_MODE_NORMAL*/)
+       if(__pSearchBar->GetShowState() == true)
        {
-               __pSearchBar->SetShowState(false);
-               __pMemoListView->SetBounds(GetClientAreaBounds().x, 0, GetClientAreaBounds().width, GetClientAreaBounds().height);
-               __pMemoListView->Invalidate(true);
+               __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
        }
        else
        {
@@ -789,3 +781,21 @@ MemoListForm::SetSortValueToRegistry(const int value)
 
        return;
 }
+
+void
+MemoListForm::OnFormMenuRequested(Form& source)
+{
+       if(__pSearchBar->GetMode() != SEARCH_BAR_MODE_INPUT)
+       {
+               int memoCount = MemoListPresentationModel::GetInstance()->GetMemoCount(ID_MEMO_LIST);
+               if(memoCount == 0)
+               {
+                       __pOption->SetShowState(false);
+               }
+               else
+               {
+                       __pOption->SetShowState(true);
+               }
+               __pOption->Show();
+       }
+}
index 25d9e00..81e8478 100644 (file)
@@ -38,7 +38,6 @@ using namespace Tizen::Ui::Scenes;
 
 MemoTextDetailForm::MemoTextDetailForm(void)
        : __pContent(null)
-       , __pContextMenu(null)
        , __pDateTime(null)
        , __pEditArgList(null)
        , __pFormFooter(null)
@@ -52,6 +51,7 @@ MemoTextDetailForm::MemoTextDetailForm(void)
        , __pMemoIndex(null)
        , __pCount(null)
        , __pShareMemoList(null)
+       , __pOption(null)
 {
        __pVMemoCreator = new (std::nothrow) VMemoCreator();
        __pAppControlListProvider = new (std::nothrow) AppControlListProvider();
@@ -116,7 +116,6 @@ MemoTextDetailForm::Initialize(void)
 result
 MemoTextDetailForm::OnInitializing(void)
 {
-       int xPos= 0, yPos = 0;
        Font dateFont;
        dateFont.Construct(FONT_STYLE_BOLD, FONT_SIZE_DATETIME);
 
@@ -128,11 +127,9 @@ MemoTextDetailForm::OnInitializing(void)
        __pFormFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
        __pFormFooter->AddActionEventListener(*this);
        __pFormFooter->SetBackButton();
+       __pFormFooter->SetMenuButton();
        SetFormBackEventListener(this);
-
-       //More option
-       __footerItemMenu.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_BUTTON_MORE);
-       AddFooterMenuItem(__pFormFooter, __footerItemMenu);
+       SetFormMenuEventListener(this);
 
        __footerItemDelete.Construct(IDA_FOOTER_BUTTON_LEFT);
        __footerItemDelete.SetText(GetResourceString(L"IDS_COM_BODY_DELETE"));
@@ -169,15 +166,13 @@ MemoTextDetailForm::OnInitializing(void)
        __pContent->SetTextColor(EDIT_TEXT_COLOR_DISABLED, Color::GetColor(COLOR_ID_BLACK));
        __pContent->SetTextColor(EDIT_TEXT_COLOR_LINK, Color::GetColor(COLOR_ID_BLUE));
 
-       __pContextMenu = new (std::nothrow) ContextMenu();
-       __pFormFooter->GetPosition(xPos, yPos);
-       __pContextMenu->Construct(Point(0,yPos), CONTEXT_MENU_STYLE_LIST);
-       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_BODY_EDIT"), IDA_FOOTER_BUTTON_EDIT);
-       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_BUTTON_SHARE"), IDA_FOOTER_BUTTON_SHARE);
-       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_BODY_CREATE"), IDA_FOOTER_BUTTON_CREATE);
-
-       __pContextMenu->AddActionEventListener(*this);
-       __pContextMenu->SetShowState(false);
+       __pOption = new (std::nothrow) OptionMenu();
+       __pOption->Construct();
+       __pOption->AddItem(GetResourceString(L"IDS_COM_BODY_EDIT"), IDA_FOOTER_BUTTON_EDIT);
+       __pOption->AddItem(GetResourceString(L"IDS_COM_BUTTON_SHARE"), IDA_FOOTER_BUTTON_SHARE);
+       __pOption->AddItem(GetResourceString(L"IDS_COM_BODY_CREATE"), IDA_FOOTER_BUTTON_CREATE);
+       __pOption->AddActionEventListener(*this);
+       __pOption->SetShowState(false);
 
        __pFlickGesture = new (std::nothrow) TouchFlickGestureDetector;
        if (__pFlickGesture != null)
@@ -344,17 +339,6 @@ MemoTextDetailForm::OnActionPerformed(const Control& source, int actionId)
                }
                break;
 
-       case IDA_FOOTER_BUTTON_MORE:    //More
-               {
-                       __pContextMenu->RemoveAllItems();
-                       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_BODY_EDIT"), IDA_FOOTER_BUTTON_EDIT);
-                       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_BUTTON_SHARE"), IDA_FOOTER_BUTTON_SHARE);
-                       __pContextMenu->AddItem(GetResourceString(L"IDS_COM_BODY_CREATE"), IDA_FOOTER_BUTTON_CREATE);
-                       __pContextMenu->SetShowState(true);
-                       __pContextMenu->Show();
-               }
-               break;
-
        case IDA_BUTTON_CLOSE_POPUP:
                {
                        __pPopup->SetShowState(false);
@@ -445,10 +429,18 @@ MemoTextDetailForm::OnListViewItemStateChanged(ListView& listView, int index, in
 void
 MemoTextDetailForm::OnFormBackRequested(Form& source)
 {
-       SceneManager* pSceneManager = SceneManager::GetInstance();
-       IList* pArgs = new (std::nothrow) ArrayList();
-       pArgs->Add(new (std::nothrow) Integer(ID_REFRESH_LIST_FROM_DATABASEVIEW));
-       pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_MEMO_LIST), pArgs);
+       if (__pOption->GetShowState() == true)
+       {
+               __pOption->SetShowState(false);
+               __pOption->Show();
+       }
+       else
+       {
+               SceneManager* pSceneManager = SceneManager::GetInstance();
+               IList* pArgs = new (std::nothrow) ArrayList();
+               pArgs->Add(new (std::nothrow) Integer(ID_REFRESH_LIST_FROM_DATABASEVIEW));
+               pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_MEMO_LIST), pArgs);
+       }
        return;
 }
 
@@ -470,5 +462,16 @@ MemoTextDetailForm::OnTerminating(void)
                __pFlickGesture->RemoveFlickGestureEventListener(*this);
                delete __pFlickGesture;
        }
+       if (__pOption != null)
+       {
+               __pOption->Destroy();
+       }
        return E_SUCCESS;
 }
+
+void
+MemoTextDetailForm::OnFormMenuRequested(Form& source)
+{
+       __pOption->SetShowState(true);
+       __pOption->Show();
+}