From: Himanshu Talwar Date: Wed, 12 Jun 2013 10:20:56 +0000 (+0530) Subject: HW key changes X-Git-Tag: submit/tizen_2.2/20130714.134410~54^2 X-Git-Url: http://review.tizen.org/git/?p=apps%2Fosp%2FGallery.git;a=commitdiff_plain;h=110ba4b6db8c3c52e901ed1bd6f8895b9cc549c3 HW key changes Change-Id: I34a4b6936ef142f2e244cdfdd29bc9a97d212673 Signed-off-by: Himanshu Talwar --- diff --git a/inc/GlAlbumListForm.h b/inc/GlAlbumListForm.h index aac3a58..b41071b 100644 --- a/inc/GlAlbumListForm.h +++ b/inc/GlAlbumListForm.h @@ -34,6 +34,7 @@ class AlbumListForm , public Tizen::Ui::IActionEventListener , public Tizen::Ui::Controls::Form , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Controls::IFormMenuEventListener , public Tizen::Ui::Controls::IIconListViewItemEventListener , public Tizen::Ui::Controls::IIconListViewItemProvider , public Tizen::Ui::Scenes::ISceneEventListener @@ -64,6 +65,8 @@ public: virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + virtual void OnFormMenuRequested (Tizen::Ui::Controls::Form &source); + virtual void OnFileInfoChanged(const Tizen::Content::ContentType contentType); virtual void OnThumbnailDecoded(const int index); @@ -74,9 +77,11 @@ private: result Update(void); private: + bool __isHWBackButtonExist; int __itemCount; Tizen::Ui::Controls::IconListView* __pAlbumViewIconList; Tizen::Ui::Controls::ContextMenu* __pContextMenuMore; + Tizen::Ui::Controls::OptionMenu* __pOptionMenu; AlbumListPresentationModel* __pPresentationModel; }; diff --git a/inc/GlFileListEditorForm.h b/inc/GlFileListEditorForm.h index 086634a..6c224ad 100644 --- a/inc/GlFileListEditorForm.h +++ b/inc/GlFileListEditorForm.h @@ -36,6 +36,7 @@ class FileListEditorForm : public BaseForm , public IFileOpInvalidateListener , public IFormContentUpdateEventListener + , public Tizen::Ui::Controls::IFormMenuEventListener , public ISlideSettingListener , public Tizen::Ui::IActionEventListener , public Tizen::Ui::Controls::IFormBackEventListener @@ -71,6 +72,8 @@ public: virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + virtual void OnFormMenuRequested (Tizen::Ui::Controls::Form &source); + private: result InitializeFooter(void); Tizen::Base::String GetDirecotyNameFromFullPath(const Tizen::Base::String& fullPath) const; @@ -82,6 +85,7 @@ private: Tizen::Ui::Controls::ContextMenu* __pContextMenuShare; Tizen::Ui::Controls::ContextMenu* __pContextEditorMenuMove; Tizen::Ui::Controls::ContextMenu* __pContextSelectionMenuMove; + Tizen::Ui::Controls::OptionMenu* __pOptionMenu; Tizen::Ui::Controls::Popup* __pDeletePopup; Tizen::Graphics::Point __morePosition; Tizen::Base::Collection::IList* __pContentDirectoryList; @@ -89,6 +93,7 @@ private: SlideShowPopUp* __pPopUp; FileMoveTimer* __pFileMove; bool __isCopyOperation; + bool __isHWBackButtonExist; FileListPresentationModel* __pPresentationModel; }; diff --git a/inc/GlFileListForm.h b/inc/GlFileListForm.h index 9bba2a1..0a9b826 100644 --- a/inc/GlFileListForm.h +++ b/inc/GlFileListForm.h @@ -36,6 +36,7 @@ class FileListForm , public Tizen::Ui::IActionEventListener , public Tizen::Ui::Controls::Form , public Tizen::Ui::Controls::IFormBackEventListener + , public Tizen::Ui::Controls::IFormMenuEventListener { public: FileListForm(void); @@ -54,13 +55,17 @@ public: virtual void OnSlideSettingPopUpItemSelected(int index); + virtual void OnFormMenuRequested (Tizen::Ui::Controls::Form &source); + void SetFooterState(bool state); private: result InitializeFooter(void); private: + bool __isHWBackButtonExist; Tizen::Ui::Controls::ContextMenu* __pContextMenuMore; + Tizen::Ui::Controls::OptionMenu* __pOptionMenu; SlideShowPopUp* __pPopUp; FileListPresentationModel* __pPresentationModel; }; diff --git a/inc/GlGalleryApp.h b/inc/GlGalleryApp.h index 790cd62..3d8f2a5 100644 --- a/inc/GlGalleryApp.h +++ b/inc/GlGalleryApp.h @@ -61,6 +61,8 @@ public: void SetFrameEnabled(const bool enabled); + bool IsHwKeySupported(void); + private: RequestId __requestId; Tizen::Base::String __operationId; diff --git a/src/GlAlbumListForm.cpp b/src/GlAlbumListForm.cpp index 0faea57..e04444d 100644 --- a/src/GlAlbumListForm.cpp +++ b/src/GlAlbumListForm.cpp @@ -42,10 +42,13 @@ static const int W_FOLDER_SIZE = 348; static const int H_FOLDER_SIZE = 348; AlbumListForm::AlbumListForm(void) - : __itemCount(0) + : __isHWBackButtonExist(false) + , __itemCount(0) , __pAlbumViewIconList(null) , __pContextMenuMore(null) + , __pOptionMenu(null) , __pPresentationModel(null) + { AppLogDebug("ENTER"); AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); @@ -72,6 +75,12 @@ AlbumListForm::OnInitializing(void) { AppLogDebug("ENTER"); result r = E_SUCCESS; + GalleryApp* pApp = static_cast(GalleryApp::GetInstance()); + + __isHWBackButtonExist = false; + __isHWBackButtonExist = pApp->IsHwKeySupported(); + AppLogDebug("EXIT(%s)", GetErrorMessage(r)); + __pPresentationModel = AlbumListPresentationModel::GetInstance(); __pPresentationModel->ClearThumbnailRequests(); @@ -176,30 +185,44 @@ AlbumListForm::InitializeFooter(void) pFooter->AddItem(itemCamera); delete pBitmap1; - ButtonItem footerMore; - footerMore.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_MORE); - - Bitmap* pBitmapMore = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE); - Bitmap* pBitmapMoreDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE_DISABLED); - Bitmap* pBitmapMorePressed = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE_PRESSED); - if (pBitmapMore != null && pBitmapMoreDim != null && pBitmapMorePressed != null) + if( __isHWBackButtonExist == false ) { - footerMore.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmapMore); - footerMore.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pBitmapMoreDim); - footerMore.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapMorePressed); - } + ButtonItem footerMore; + footerMore.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_MORE); - pFooter->SetButton(BUTTON_POSITION_LEFT, footerMore); - delete pBitmapMore; - delete pBitmapMoreDim; - delete pBitmapMorePressed; + Bitmap* pBitmapMore = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE); + Bitmap* pBitmapMoreDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE_DISABLED); + Bitmap* pBitmapMorePressed = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE_PRESSED); - __pContextMenuMore = new (std::nothrow) ContextMenu(); - __pContextMenuMore->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST); - __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_HEADER_EDIT"), IDA_FOOTER_EDIT); - __pContextMenuMore->SetShowState(false); - __pContextMenuMore->AddActionEventListener(*this); + if (pBitmapMore != null && pBitmapMoreDim != null && pBitmapMorePressed != null) + { + footerMore.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmapMore); + footerMore.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pBitmapMoreDim); + footerMore.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapMorePressed); + } + + pFooter->SetButton(BUTTON_POSITION_LEFT, footerMore); + delete pBitmapMore; + delete pBitmapMoreDim; + delete pBitmapMorePressed; + + __pContextMenuMore = new (std::nothrow) ContextMenu(); + __pContextMenuMore->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST); + __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_HEADER_EDIT"), IDA_FOOTER_EDIT); + __pContextMenuMore->SetShowState(false); + __pContextMenuMore->AddActionEventListener(*this); + } + else + { + __pOptionMenu = new (std::nothrow) OptionMenu(); + __pOptionMenu->Construct(); + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_HEADER_EDIT"),IDA_FOOTER_EDIT); + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_HEADER_EDIT"), IDA_FOOTER_EDIT); + __pOptionMenu->SetShowState(false); + __pOptionMenu->AddActionEventListener(*this); + SetFormMenuEventListener(this); + } SetFormBackEventListener(this); } @@ -483,6 +506,12 @@ AlbumListForm::OnContentUpdated(void) __pContextMenuMore->SetShowState(false); } + if ( __pOptionMenu != null && __pOptionMenu ->GetShowState() == true) + { + __pOptionMenu->SetShowState(false); + __pOptionMenu->Show(); + } + if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK) { if (__pPresentationModel->GetAppControlMediaType() == APPCONTROL_MEDIA_TYPE_IMAGE) @@ -545,3 +574,17 @@ AlbumListForm::Update(void) return r; } + +void +AlbumListForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source) +{ + + if ( __pOptionMenu == null ) + { + return ; + } + + __pOptionMenu->SetShowState(true); + __pOptionMenu->Show(); + +} diff --git a/src/GlFileListEditorForm.cpp b/src/GlFileListEditorForm.cpp index 4adca41..0da3b41 100644 --- a/src/GlFileListEditorForm.cpp +++ b/src/GlFileListEditorForm.cpp @@ -62,6 +62,7 @@ FileListEditorForm::FileListEditorForm(void) , __pContextMenuShare(null) , __pContextEditorMenuMove(null) , __pContextSelectionMenuMove(null) + , __pOptionMenu(null) , __pDeletePopup(null) , __morePosition(Point(0, 0)) , __pContentDirectoryList(null) @@ -69,6 +70,7 @@ FileListEditorForm::FileListEditorForm(void) , __pPopUp(null) , __pFileMove(null) , __isCopyOperation(false) + , __isHWBackButtonExist(false) , __pPresentationModel(null) { AppLogDebug("ENTER"); @@ -118,6 +120,10 @@ FileListEditorForm::OnInitializing(void) AddControl(__pPopUp); } + GalleryApp* pApp = static_cast(GalleryApp::GetInstance()); + __isHWBackButtonExist = pApp->IsHwKeySupported(); + + SetFormMenuEventListener(this); __pPresentationModel = FileListPresentationModel::GetInstance(); __pPresentationModel->ClearThumbnailRequests(); @@ -179,23 +185,26 @@ FileListEditorForm::InitializeFooter(void) { pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON_TEXT); - ButtonItem footerMore; - footerMore.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_MORE); - Bitmap* pBitmapMore = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE); - Bitmap* pBitmapMoreDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE_DISABLED); - Bitmap* pBitmapMorePressed = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE_PRESSED); - - if (pBitmapMore != null && pBitmapMoreDim != NULL && pBitmapMorePressed != null) + if (__isHWBackButtonExist == false) { - footerMore.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmapMore); - footerMore.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pBitmapMoreDim); - footerMore.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapMorePressed); - } - pFooter->SetButton(BUTTON_POSITION_LEFT,footerMore); + ButtonItem footerMore; + footerMore.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_MORE); + Bitmap* pBitmapMore = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE); + Bitmap* pBitmapMoreDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE_DISABLED); + Bitmap* pBitmapMorePressed = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE_PRESSED); - delete pBitmapMore; - delete pBitmapMoreDim; - delete pBitmapMorePressed; + if (pBitmapMore != null && pBitmapMoreDim != NULL && pBitmapMorePressed != null) + { + footerMore.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmapMore); + footerMore.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pBitmapMoreDim); + footerMore.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapMorePressed); + } + pFooter->SetButton(BUTTON_POSITION_LEFT,footerMore); + + delete pBitmapMore; + delete pBitmapMoreDim; + delete pBitmapMorePressed; + } FooterItem footerShare; r = footerShare.Construct(IDA_FOOTER_SHARE); @@ -256,31 +265,71 @@ FileListEditorForm::InitializeFooter(void) AppLogDebug("GetItemCheckedCount(%d)", checkedCount); - if (__pContextMenuMore != null) + if (__isHWBackButtonExist == false) { - delete __pContextMenuMore; - __pContextMenuMore = null; - } + if (__pContextMenuMore != null) + { + delete __pContextMenuMore; + __pContextMenuMore = null; + } - __pContextMenuMore = new (std::nothrow) ContextMenu(); - __pContextMenuMore->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST); + __pContextMenuMore = new (std::nothrow) ContextMenu(); + __pContextMenuMore->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST); - __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"), - IDA_CONTEXT_MENU_MORE_MOVE); - __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"), - IDA_CONTEXT_MENU_MORE_COPY); + __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"), + IDA_CONTEXT_MENU_MORE_MOVE); + __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"), + IDA_CONTEXT_MENU_MORE_COPY); + + if (checkedCount > 1) + { + __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"), + IDA_CONTEXT_MENU_MORE_SLIDE_SHOW); + } + + __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT); + __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT); + + __pContextMenuMore->SetShowState(false); + __pContextMenuMore->AddActionEventListener(*this); + + __pContextEditorMenuMove = new (std::nothrow) ContextMenu(); + __pContextEditorMenuMove->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST); + __pContextEditorMenuMove->AddActionEventListener(*this); + + __pContextSelectionMenuMove = new (std::nothrow) ContextMenu(); + __pContextSelectionMenuMove->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST); + __pContextSelectionMenuMove->AddActionEventListener(*this); - if (checkedCount > 1) - { - __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"), - IDA_CONTEXT_MENU_MORE_SLIDE_SHOW); } + else + { - __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT); - __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT); + if (__pOptionMenu != null) + { + delete __pOptionMenu; + __pOptionMenu = null; + } - __pContextMenuMore->SetShowState(false); - __pContextMenuMore->AddActionEventListener(*this); + __pOptionMenu = new (std::nothrow) OptionMenu(); + __pOptionMenu->Construct(); + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"), + IDA_CONTEXT_MENU_MORE_MOVE); + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"), + IDA_CONTEXT_MENU_MORE_COPY); + + if (checkedCount > 1) + { + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"), + IDA_CONTEXT_MENU_MORE_SLIDE_SHOW); + } + + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT); + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT); + + __pOptionMenu->AddActionEventListener(*this); + + } __pContextMenuShare = new (std::nothrow) ContextMenu(); __pContextMenuShare->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST); @@ -291,13 +340,7 @@ FileListEditorForm::InitializeFooter(void) __pContextMenuShare->SetShowState(false); __pContextMenuShare->AddActionEventListener(*this); - __pContextEditorMenuMove = new (std::nothrow) ContextMenu(); - __pContextEditorMenuMove->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST); - __pContextEditorMenuMove->AddActionEventListener(*this); - __pContextSelectionMenuMove = new (std::nothrow) ContextMenu(); - __pContextSelectionMenuMove->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST); - __pContextSelectionMenuMove->AddActionEventListener(*this); if (__pContentDirectoryNameList != null) { @@ -511,32 +554,43 @@ FileListEditorForm::OnActionPerformed(const Control& source, int actionId) __isCopyOperation = true; } RefreshFolderList(); - if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + + if ( __isHWBackButtonExist == false ) { - if (__pContextEditorMenuMove->GetShowState() == false) + + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) { - __pContextEditorMenuMove->SetAnchorPosition(Point(__morePosition.x, __morePosition.y - 48)); - __pContextEditorMenuMove->SetShowState(true); - __pContextEditorMenuMove->Show(); + if (__pContextEditorMenuMove->GetShowState() == false) + { + __pContextEditorMenuMove->SetAnchorPosition(Point(__morePosition.x, __morePosition.y - 48)); + __pContextEditorMenuMove->SetShowState(true); + __pContextEditorMenuMove->Show(); + } + else + { + __pContextEditorMenuMove->SetShowState(false); + } } - else + else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) { - __pContextEditorMenuMove->SetShowState(false); + if (__pContextSelectionMenuMove->GetShowState() == false) + { + __pContextSelectionMenuMove->SetAnchorPosition(__morePosition); + __pContextSelectionMenuMove->SetShowState(true); + __pContextSelectionMenuMove->Show(); + } + else + { + __pContextSelectionMenuMove->SetShowState(false); + } } } - else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + else { - if (__pContextSelectionMenuMove->GetShowState() == false) - { - __pContextSelectionMenuMove->SetAnchorPosition(__morePosition); - __pContextSelectionMenuMove->SetShowState(true); - __pContextSelectionMenuMove->Show(); - } - else - { - __pContextSelectionMenuMove->SetShowState(false); - } + __pOptionMenu->SetShowState(true); + __pOptionMenu->Show(); } + } break; @@ -613,29 +667,27 @@ FileListEditorForm::OnActionPerformed(const Control& source, int actionId) } } - } - break; - - case IDA_CONTEXTMENU_SELECTION_MOVE_CREATE_ALBUM: - { - if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + else { - AllListSelectionPanel* pSelectionPanel = dynamic_cast - (pSceneManager->GetCurrentScene()->GetPanel()); - - if (pSelectionPanel != null) + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) { - IList* pList = pSelectionPanel->GetItemCheckedIndexListN(); - pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT); - if (__isCopyOperation) - { - pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT); - } - else + AllListSelectionPanel* pSelectionPanel = dynamic_cast + (pSceneManager->GetCurrentScene()->GetPanel()); + + if (pSelectionPanel != null) { - pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT); + IList* pList = pSelectionPanel->GetItemCheckedIndexListN(); + pList->InsertAt(new (std::nothrow) Integer(ALBUM_CREATE), ALBUM_FIRST_ELEMENT); + if (__isCopyOperation) + { + pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_COPY), ALBUM_SECOND_ELEMENT); + } + else + { + pList->InsertAt(new (std::nothrow) Integer(FILE_ACTION_MOVE), ALBUM_SECOND_ELEMENT); + } + pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList); } - pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_NAME_EDITOR), pList); } } } @@ -805,7 +857,7 @@ FileListEditorForm::OnActionPerformed(const Control& source, int actionId) else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) { if ((IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START <= actionId) && - (actionId <= IDA_CONTEXTMENU_SELECTION_MOVE_CREATE_ALBUM + 1000)) + (actionId <= IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM + 1000)) { if (__pContentDirectoryList == null) { @@ -1034,28 +1086,51 @@ FileListEditorForm::RefreshFolderList(void) __pContentDirectoryNameList->Add(pDirName); } } - __pContextEditorMenuMove->RemoveAllItems(); - __pContextEditorMenuMove->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"), - IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM); - __pContextSelectionMenuMove->RemoveAllItems(); - __pContextSelectionMenuMove->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"), - IDA_CONTEXTMENU_SELECTION_MOVE_CREATE_ALBUM); - - loopCount = __pContentDirectoryNameList->GetCount(); - for (int i = 0; i < loopCount; ++i) + + if (__isHWBackButtonExist == false) + { + __pContextEditorMenuMove->RemoveAllItems(); + __pContextEditorMenuMove->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"), + IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM); + __pContextSelectionMenuMove->RemoveAllItems(); + __pContextSelectionMenuMove->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"), + IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM); + + loopCount = __pContentDirectoryNameList->GetCount(); + for (int i = 0; i < loopCount; ++i) + { + pDirName = static_cast(__pContentDirectoryNameList->GetAt(i)); + + if ( *pDirName != __pPresentationModel->GetCurrentAlbumName()) + { + __pContextEditorMenuMove->AddItem(*(new (std::nothrow) String(*pDirName)), + IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START + i); + __pContextSelectionMenuMove->AddItem(*(new (std::nothrow) String(*pDirName)), + IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START + i); + } + } + __pContextEditorMenuMove->SetShowState(false); + __pContextSelectionMenuMove->SetShowState(false); + } + else { - pDirName = static_cast(__pContentDirectoryNameList->GetAt(i)); + __pOptionMenu->RemoveAllItems(); + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"), + IDA_CONTEXTMENU_EDITOR_MOVE_CREATE_ALBUM); - if ( *pDirName != __pPresentationModel->GetCurrentAlbumName()) + loopCount = __pContentDirectoryNameList->GetCount(); + for (int i = 0; i < loopCount; ++i) { - __pContextEditorMenuMove->AddItem(*(new (std::nothrow) String(*pDirName)), - IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START + i); - __pContextSelectionMenuMove->AddItem(*(new (std::nothrow) String(*pDirName)), - IDA_CONTEXTMENU_SELECTION_MOVE_ALBUM_ARRAY_START + i); + pDirName = static_cast(__pContentDirectoryNameList->GetAt(i)); + + if ( *pDirName != __pPresentationModel->GetCurrentAlbumName()) + { + __pOptionMenu->AddItem(*(new (std::nothrow) String(*pDirName)), + IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START + i); + } } + } - __pContextEditorMenuMove->SetShowState(false); - __pContextSelectionMenuMove->SetShowState(false); AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } @@ -1274,3 +1349,59 @@ FileListEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const Scen AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); } +void +FileListEditorForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source) +{ + + SceneManager* pSceneManager = SceneManager::GetInstance(); + int checkedCount = 0; + + if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_EDITOR) + { + AllListEditorPanel* pEditorPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pEditorPanel != null) + { + checkedCount = pEditorPanel->GetItemCheckedCount(); + } + } + else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION) + { + AllListSelectionPanel* pSelectionPanel = dynamic_cast(pSceneManager->GetCurrentScene()->GetPanel()); + if (pSelectionPanel != null) + { + checkedCount = pSelectionPanel->GetItemCheckedCount(); + } + } + + if (__pContextMenuShare != null && __pContextMenuShare->GetShowState() == true ) + { + __pContextMenuShare->SetShowState(false); + } + + if ( checkedCount > 0) + { + if ( __pOptionMenu == null ) + { + return ; + } + + __pOptionMenu->RemoveAllItems(); + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MOVE"), + IDA_CONTEXT_MENU_MORE_MOVE); + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_COPY"), + IDA_CONTEXT_MENU_MORE_COPY); + + if (checkedCount > 1) + { + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"), + IDA_CONTEXT_MENU_MORE_SLIDE_SHOW); + } + + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_LEFT"),IDA_CONTEXT_MENU_ROTATE_LEFT); + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_IV_OPT_ROTATE_RIGHT"),IDA_CONTEXT_MENU_ROTATE_RIGHT); + + __pOptionMenu->SetShowState(true); + __pOptionMenu->Show(); + + } +} diff --git a/src/GlFileListForm.cpp b/src/GlFileListForm.cpp index 714335e..1668f49 100644 --- a/src/GlFileListForm.cpp +++ b/src/GlFileListForm.cpp @@ -23,6 +23,7 @@ #include "GlAllListPanel.h" #include "GlFileListForm.h" #include "GlFileListPresentationModel.h" +#include "GlGalleryApp.h" #include "GlResourceManager.h" #include "GlSlideSettingListener.h" #include "GlSlideShowPopUp.h" @@ -38,7 +39,9 @@ using namespace Tizen::Ui::Scenes; using namespace Tizen::Content; FileListForm::FileListForm(void) - : __pContextMenuMore(null) + : __isHWBackButtonExist(false) + , __pContextMenuMore(null) + , __pOptionMenu(null) , __pPopUp(null) , __pPresentationModel(null) { @@ -68,6 +71,13 @@ FileListForm::OnInitializing(void) Header* pHeader = GetHeader(); TryReturn(pHeader != null, E_FAILURE, "[%s] fail to get the Header.", GetErrorMessage(GetLastResult())); + __isHWBackButtonExist = false; + + SetFormMenuEventListener(this); + GalleryApp* pApp = static_cast(GalleryApp::GetInstance()); + + __isHWBackButtonExist = pApp->IsHwKeySupported(); + __pPresentationModel = FileListPresentationModel::GetInstance(); __pPresentationModel->ClearThumbnailRequests(); @@ -97,6 +107,13 @@ FileListForm::OnTerminating(void) delete __pContextMenuMore; __pContextMenuMore = null; } + + if ( __pOptionMenu != null ) + { + delete __pOptionMenu; + __pOptionMenu = null; + } + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); return E_SUCCESS; @@ -210,24 +227,27 @@ FileListForm::InitializeFooter(void) pFooter->RemoveAllItems(); pFooter->SetStyle(FOOTER_STYLE_BUTTON_ICON); - ButtonItem footerMore; - footerMore.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_MORE); - Bitmap* pBitmapMore = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE); - Bitmap* pBitmapMoreDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE_DISABLED); - Bitmap* pBitmapMorePressed = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE_PRESSED); - - if (pBitmapMore != null && pBitmapMoreDim != null && pBitmapMorePressed != null) + if ( __isHWBackButtonExist == false ) { - footerMore.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmapMore); - footerMore.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pBitmapMoreDim); - footerMore.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapMorePressed); - } - pFooter->SetButton(BUTTON_POSITION_LEFT, footerMore); + ButtonItem footerMore; + footerMore.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_MORE); + Bitmap* pBitmapMore = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE); + Bitmap* pBitmapMoreDim = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE_DISABLED); + Bitmap* pBitmapMorePressed = ResourceManager::GetBitmapN(IDB_CONTROLBAR_MORE_PRESSED); - delete pBitmapMore; - delete pBitmapMoreDim; - delete pBitmapMorePressed; + if (pBitmapMore != null && pBitmapMoreDim != null && pBitmapMorePressed != null) + { + footerMore.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmapMore); + footerMore.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pBitmapMoreDim); + footerMore.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapMorePressed); + } + pFooter->SetButton(BUTTON_POSITION_LEFT, footerMore); + + delete pBitmapMore; + delete pBitmapMoreDim; + delete pBitmapMorePressed; + } FooterItem itemCamera; itemCamera.Construct(IDA_FOOTER_CAMERA); @@ -238,31 +258,61 @@ FileListForm::InitializeFooter(void) } pFooter->AddItem(itemCamera); - if (__pContextMenuMore != null) + if ( __isHWBackButtonExist == false ) { - delete __pContextMenuMore; - __pContextMenuMore = null; - } - __pContextMenuMore = new (std::nothrow) ContextMenu(); - __pContextMenuMore->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST); + if (__pContextMenuMore != null) + { + delete __pContextMenuMore; + __pContextMenuMore = null; + } - if (__pPresentationModel->GetCurrentAlbumContentInfoCount() > 1) - { - __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"), IDA_FOOTER_SLIDESHOW); - } + __pContextMenuMore = new (std::nothrow) ContextMenu(); + __pContextMenuMore->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST); - if (__pPresentationModel->GetCurrentAlbumContentInfoCount() == 0) - { - __pContextMenuMore->SetEnabled(false); + if (__pPresentationModel->GetCurrentAlbumContentInfoCount() > 1) + { + __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"), IDA_FOOTER_SLIDESHOW); + } + + if (__pPresentationModel->GetCurrentAlbumContentInfoCount() == 0) + { + __pContextMenuMore->SetEnabled(false); + } + else + { + __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_HEADER_EDIT"), IDA_FOOTER_EDIT); + __pContextMenuMore->SetShowState(false); + __pContextMenuMore->AddActionEventListener(*this); + } } else { - __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_HEADER_EDIT"), IDA_FOOTER_EDIT); - __pContextMenuMore->SetShowState(false); - __pContextMenuMore->AddActionEventListener(*this); - } + if (__pOptionMenu != null) + { + delete __pOptionMenu; + __pOptionMenu = null; + } + + __pOptionMenu = new (std::nothrow) OptionMenu(); + __pOptionMenu->Construct(); + + if (__pPresentationModel->GetCurrentAlbumContentInfoCount() > 1) + { + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_MEDIABR_OPT_SLIDESHOW"), IDA_FOOTER_SLIDESHOW); + } + + if (__pPresentationModel->GetCurrentAlbumContentInfoCount() == 0) + { + __pOptionMenu->SetEnabled(false); + } + else + { + __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_HEADER_EDIT"), IDA_FOOTER_EDIT); + __pOptionMenu->AddActionEventListener(*this); + } + } pFooter->SetBackButton(); pFooter->AddActionEventListener(*this); @@ -334,3 +384,19 @@ FileListForm::SetFooterState(bool state) GetFooter()->SetButtonEnabled(BUTTON_POSITION_LEFT,state); GetFooter()->Invalidate(true); } + +void +FileListForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source) +{ + + InitializeFooter(); + + if ( __pOptionMenu == null ) + { + return ; + } + + __pOptionMenu->Show(); + __pOptionMenu->SetShowState(true); + +} diff --git a/src/GlGalleryApp.cpp b/src/GlGalleryApp.cpp index 7a43aab..93b84d4 100644 --- a/src/GlGalleryApp.cpp +++ b/src/GlGalleryApp.cpp @@ -239,3 +239,16 @@ GalleryApp::SetFrameEnabled(const bool enabled) pMainFrame->SetEnabled(enabled); } } + +bool +GalleryApp::IsHwKeySupported(void) +{ + AppLogDebug("ENTER"); + + bool isHwKeyExist = false; + Tizen::System::SystemInfo::GetValue(L"http://tizen.org/feature/input.keys.back", isHwKeyExist); + + AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); + + return isHwKeyExist; +}