Fixed issue 45595
[apps/osp/Gallery.git] / src / GlSlideShowPopUp.cpp
index e196778..2234b8a 100644 (file)
@@ -2,11 +2,11 @@
 // Tizen Native SDK
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//     http://www.tizenopensource.org/license
+//     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,
  * @brief      This file contains the definitions of the SlideShowPopUp class.
  */
 
-#include <FAppUiApp.h>
 #include <FUiScenes.h>
 
 #include "GlResourceManager.h"
-#include "GlSlideShowPopUp.h"
 #include "GlSlideSettingListener.h"
+#include "GlSlideShowPopUp.h"
 
 using namespace Tizen::App;
 using namespace Tizen::Base;
@@ -35,21 +34,18 @@ using namespace Tizen::Ui;
 using namespace Tizen::Ui::Controls;
 using namespace Tizen::Ui::Scenes;
 
-
 static const int ID_FORMAT_START = 501;
 static const int ID_FORMAT_SETTING = 502;
 static const int ID_CANCEL_BUTTON = 503;
 
-
 SlideShowPopUp::SlideShowPopUp(void)
-:__pList(null)
+       : __pList(null)
+       , __pListener(null)
 {
-
 }
 
 SlideShowPopUp::~SlideShowPopUp(void)
 {
-
 }
 
 bool
@@ -57,6 +53,7 @@ SlideShowPopUp::Initialize(void)
 {
        Button* pCancelButton = null;
        Popup::Construct(L"IDL_SLIDESHOW_SETTING_POPUP");
+       Popup::SetPropagatedKeyEventListener(this);
 
        __pList = static_cast<ListView*>(GetControl(L"IDC_POPUP_LIST"));
 
@@ -68,7 +65,7 @@ SlideShowPopUp::Initialize(void)
        __pList->SetItemProvider(*this);
        __pList->AddListViewItemEventListener(*this);
 
-       pCancelButton = static_cast< Button* >(GetControl(L"IDC_BUTTON", true));
+       pCancelButton = static_cast<Button*>(GetControl(L"IDC_BUTTON", true));
 
        if (pCancelButton != null)
        {
@@ -77,14 +74,12 @@ SlideShowPopUp::Initialize(void)
        }
 
        return true;
-
 }
 
 result
 SlideShowPopUp::OnTerminating(void)
 {
-       result r = E_SUCCESS;
-       return r;
+       return E_SUCCESS;
 }
 
 void
@@ -98,6 +93,7 @@ SlideShowPopUp::OnActionPerformed(const Control& source, int actionId)
                Popup::Show();
        }
        break;
+
        default:
                break;
        }
@@ -107,23 +103,33 @@ SlideShowPopUp::OnActionPerformed(const Control& source, int actionId)
 void
 SlideShowPopUp::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
 {
-
        if (__pListener != null)
        {
                __pListener->OnSlideSettingPopUpItemSelected(index);
        }
+}
 
+bool
+SlideShowPopUp::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo)
+{
+       AppLogDebug("ENTER");
+
+       if(keyEventInfo.GetKeyCode() == KEY_BACK)
+       {
+               Popup::SetShowState(false);
+               Popup::Show();
+       }
+       return false;
 }
 
 ListItemBase*
 SlideShowPopUp::CreateItem(int index, int itemWidth)
 {
-       result r = E_FAILURE;
        ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
        int listItemHeight = 112;
 
        CustomItem* pItem = new (std::nothrow) CustomItem();
-       r = pItem->Construct(Dimension(GetClientAreaBounds().width, listItemHeight), style);
+       result r = pItem->Construct(Dimension(GetClientAreaBounds().width, listItemHeight), style);
        pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));
 
        if (IsFailed(r))
@@ -134,17 +140,16 @@ SlideShowPopUp::CreateItem(int index, int itemWidth)
 
        switch (index)
        {
-
        case 0:
        {
-               pItem->AddElement(Rectangle(0, 0, GetClientAreaBounds().width, listItemHeight), ID_FORMAT_START,
+               pItem->AddElement(Rectangle(25, 0, GetClientAreaBounds().width -50, listItemHeight), ID_FORMAT_START,
                                ResourceManager::GetString(L"IDS_MEDIABR_OPT_START_SLIDESHOW"), true);
        }
        break;
 
        case 1:
        {
-               pItem->AddElement(Rectangle(0, 0, GetClientAreaBounds().width, listItemHeight), ID_FORMAT_SETTING,
+               pItem->AddElement(Rectangle(25, 0, GetClientAreaBounds().width -50, listItemHeight), ID_FORMAT_SETTING,
                                ResourceManager::GetString(L"IDS_MEDIABR_BODY_SLIDESHOW_SETTINGS"), true);
        }
        break;
@@ -174,4 +179,3 @@ SlideShowPopUp::SetEventListner(ISlideSettingListener* listner)
 {
        __pListener = listner;
 }
-