Back key enabled for pop up
authorAbhismita Ghosh <g.abhismita@samsung.com>
Fri, 28 Jun 2013 13:27:40 +0000 (22:27 +0900)
committerAbhismita Ghosh <g.abhismita@samsung.com>
Fri, 28 Jun 2013 13:27:40 +0000 (22:27 +0900)
Change-Id: I2470b16ef40f2bfea774e344a91a4df7f6f3aa7b

inc/VpSoundPathPopup.h
src/VpSoundPathPopup.cpp
src/VpVolumeSettingPopup.cpp

index 0de4b26..3e982c1 100644 (file)
@@ -29,6 +29,7 @@
 class SoundPathPopup
        : public Tizen::Ui::Controls::Popup
        , public Tizen::Ui::IActionEventListener
+       , public Tizen::Ui::IKeyEventListener
 {
 public:
        SoundPathPopup(void);
@@ -40,6 +41,10 @@ public:
        virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
        virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs);
 
+       virtual void OnKeyLongPressed (const Tizen::Ui::Control &source, Tizen::Ui::KeyCode keyCode){}
+       virtual void OnKeyPressed (const Tizen::Ui::Control &source, Tizen::Ui::KeyCode keyCode){}
+       virtual void OnKeyReleased (const Tizen::Ui::Control &source, Tizen::Ui::KeyCode keyCode);
+
 private:
        enum AudioRouteMode
        {
@@ -55,4 +60,4 @@ private:
        int __audioRouteMode;
 };
 
-#endif // _VP_SOUND_PATH_POPUP_H_
\ No newline at end of file
+#endif // _VP_SOUND_PATH_POPUP_H_
index d382019..ce64050 100755 (executable)
@@ -80,6 +80,7 @@ SoundPathPopup::Construct(int currentOutputDevice, String bluetoothA2dpName, int
        r = Popup::Construct(true, Dimension(W_SOUNDPATH_POPUP, H_SOUNDPATH_POPUP));
        TryCatch(r == E_SUCCESS, , "Popup::Construct() Failed:%s", GetErrorMessage(r));
 
+       Popup::AddKeyEventListener(*this);
        __pCheckButton1st = new (std::nothrow) CheckButton();
        __pCheckButton2nd = new (std::nothrow) CheckButton();
        __pCloseButton = new (std::nothrow) Button();
@@ -463,3 +464,16 @@ SoundPathPopup::OnUserEventReceivedN(RequestId requestId, IList* pArgs)
                break;
        }
 }
+
+void
+SoundPathPopup::OnKeyReleased (const Tizen::Ui::Control &source, Tizen::Ui::KeyCode keyCode)
+{
+       AppLogDebug("ENTER");
+
+       if (keyCode == KEY_BACK)
+       {
+               SetShowState(false);
+       }
+       AppLogDebug("EXIT");
+
+}
index 4ac0e10..7ed66f6 100755 (executable)
@@ -213,11 +213,7 @@ VolumeSettingPopup::OnKeyPressed(const Control& source, KeyCode keyCode)
        if (keyCode == KEY_SIDE_UP
                || keyCode == KEY_SIDE_DOWN)
        {
-               if (GetShowState() == false)
-               {
-                       // Empty statement
-               }
-               else
+               if (GetShowState() == true)
                {
                        result r = E_FAILURE;
 
@@ -235,10 +231,15 @@ VolumeSettingPopup::OnKeyReleased(const Control& source, KeyCode keyCode)
 {
        AppLogDebug("OnKeyReleased Control : %ls, KeyCode : %d", source.GetName().GetPointer(), keyCode);
 
-       if (keyCode == KEY_SIDE_UP
-               || keyCode == KEY_SIDE_DOWN)
+       if (keyCode == KEY_BACK && GetShowState() == true)
        {
-               // Empty statement
+               result r = E_FAILURE;
+
+               r = __pCloseTimer->Cancel();
+               TryReturnVoid(r == E_SUCCESS, "__pCloseTimer->Start() failed:%s", GetErrorMessage(r));
+
+               r = SetShowState(false);
+               TryReturnVoid(r == E_SUCCESS, "SetShowState() failed:%s", GetErrorMessage(r));
        }
 }