Apply focus ui, fix for issue
authorhyun lee <hyunn.lee@samsung.com>
Tue, 13 Aug 2013 06:42:57 +0000 (15:42 +0900)
committerhyun lee <hyunn.lee@samsung.com>
Tue, 13 Aug 2013 07:09:38 +0000 (16:09 +0900)
Change-Id: I0487704d9f036a35bb1c41a78a3f52abc2b709de
Signed-off-by: hyun lee <hyunn.lee@samsung.com>
src/controls/FWebCtrl_CertificateConfirmPopup.cpp
src/controls/FWebCtrl_InputPickerPopup.cpp
src/controls/FWebCtrl_PromptPopup.cpp
src/controls/FWebCtrl_SelectBox.cpp
src/controls/FWebCtrl_UserConfirmPopup.cpp
src/controls/FWebCtrl_Web.cpp
src/controls/FWebCtrl_Web.h
src/controls/FWebCtrl_WebImpl.cpp
src/controls/inc/FWebCtrl_UserConfirmPopup.h

index 52d9ba9..ab90665 100755 (executable)
@@ -118,7 +118,7 @@ _CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Cer
                rect.width = pPopupData->labelDim.width;
 
                idList.Add(*(new Integer(ID_BUTTON_CERTIFICATE_CLOSE)));
-               titleList.Add(*(new String(pSysResource->GetString("sys_string", "IDS_TPLATFORM_BUTTON_OK"))));
+               titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_OK"))));
        }
        else    // CERTIFICATE_POPUP_MODE_CONFIRM
        {
index 0826358..1f44ee0 100755 (executable)
@@ -323,7 +323,7 @@ _InputPickerPopup::AddButton(_InputPickerButtonId buttonId)
        _SystemResource* pSysResource = _SystemResource::GetInstance();
        SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
 
-       buttonStr = pSysResource->GetString("sys_string", "IDS_TPLATFORM_BUTTON_OK");
+       buttonStr = pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_OK");
 
        std::unique_ptr<Button> pSelectionBtn(new (std::nothrow) Button());
        SysTryReturnResult(NID_WEB_CTRL, pSelectionBtn.get(), E_OUT_OF_MEMORY, "Memory Allocation Failed.");
index 39f3a6c..d877f51 100755 (executable)
@@ -149,8 +149,8 @@ _PromptPopup::Construct(const String& message, const String& defaultVale,  Evas_
        ArrayList titleList;
        r = titleList.Construct();
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-       titleList.Add(*(new String(pSysResource->GetString("sys_string", "IDS_TPLATFORM_BUTTON_CANCEL_ABB"))));
-       titleList.Add(*(new String(pSysResource->GetString("sys_string", "IDS_TPLATFORM_BUTTON_OK"))));
+       titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CANCEL_ABB"))));
+       titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_OK"))));
 
        r = CreateAndAddButtons(idList, titleList, pButtonPanel);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
index b1e8462..b65d1f4 100755 (executable)
@@ -241,10 +241,10 @@ _SelectBox::Construct(bool isMultiSelect, const String& title, int listCount, Ev
        r = titleList.Construct();
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       titleList.Add(*(new String(pSysResource->GetString("sys_string", "IDS_TPLATFORM_BUTTON_CANCEL_ABB"))));
+       titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CANCEL_ABB"))));
        if (__multiSelection)
        {
-               titleList.Add(*(new String(pSysResource->GetString("sys_string", "IDS_TPLATFORM_BUTTON_OK"))));
+               titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_OK"))));
 
                __pToggledArray = eina_inarray_new(sizeof(int), 0);
                SysTryReturnResult(NID_WEB_CTRL, __pToggledArray, E_OUT_OF_MEMORY, "Memory Allocation failed.");
index 9157826..524926c 100755 (executable)
@@ -64,6 +64,7 @@ _UserConfirmPopup::_UserConfirmPopup(void)
        : __pUserPolicyData(null)
        , __userConfirmMode(USER_CONFIRM_USERMEDIA)
        , __pCheckButton(null)
+       , __isUserActionNeeded(false)
        , __sync(false)
        , __pImpl(null)
 {
@@ -72,7 +73,11 @@ _UserConfirmPopup::_UserConfirmPopup(void)
 
 _UserConfirmPopup::~_UserConfirmPopup(void)
 {
-       HandleUserAction(EINA_FALSE);
+       if (__isUserActionNeeded == true)
+       {
+               HandleUserAction(EINA_FALSE);
+               __isUserActionNeeded = false;
+       }
 }
 
 
@@ -94,6 +99,8 @@ _UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo,
        __userConfirmMode = userConfirmMode;
        __sync = sync;
 
+       __isUserActionNeeded = true;
+
        bool hasTitle = true;
        int popupMaxHeight = 2*pPopupData->labelDim.height + pPopupData->btnDim.height + 2*pPopupData->sideMargin;
 
@@ -412,6 +419,7 @@ CATCH:
        default:
                SysAssert(false);
        }
+       __isUserActionNeeded = false;
 }
 
 
index 09b71aa..802f9ff 100755 (executable)
@@ -341,6 +341,7 @@ _Web::_Web(void)
        , __pPinchGestureHandler(null)
        , __gestureType(WEB_GESTURE_TYPE_TAP)
        , __edgeType(WEB_EDGE_NONE)
+       , __focus(false)
        , __pTextElement(null)
        , __previousTouchedPosition(0.0f, 0.0f)
        , __isFullScreenEntered(false)
@@ -1163,6 +1164,49 @@ _Web::SetFullScreenEntered(bool isFullScreenEntered)
 }
 
 
+void
+_Web::SetFocusEnd(bool focus)
+{
+       __focus = focus;
+}
+
+
+bool
+_Web::IsFocusEnd(void)
+{
+       return __focus;
+}
+
+
+bool
+_Web::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+       _KeyCode keyCode = keyInfo.GetKeyCode();
+
+       if (IsFocusEnd() == true)
+       {
+               SetFocusEnd(false);
+               evas_object_focus_set(GetWebNativeNode(), EINA_FALSE);
+               return false;
+       }
+
+       switch(keyCode)
+       {
+       case _KEY_UP:
+       case _KEY_DOWN:
+               evas_object_focus_set(GetWebNativeNode(), EINA_FALSE);
+               return false;
+               break;
+       default:
+               break;
+       }
+
+       evas_object_focus_set(GetWebNativeNode(), EINA_TRUE);
+
+       return true;
+}
+
+
 bool
 _Web::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
 {
@@ -1182,4 +1226,10 @@ _Web::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
 }
 
 
+void
+_Web::OnDrawFocus(void)
+{
+}
+
+
 }}} // Tizen::Web::Controls
index 44fab11..a42ec43 100755 (executable)
@@ -117,6 +117,9 @@ public:
 
        void SetFullScreenEntered(bool isFullScreenEntered);
 
+       void SetFocusEnd(bool focus);
+       bool IsFocusEnd(void);
+
        virtual result OnAttaching(const _Control* pParent);
        virtual result OnBoundsChanging(const Tizen::Graphics::Rectangle& bounds);
 
@@ -149,7 +152,9 @@ public:
        virtual bool OnCaptureAcquire(Tizen::Graphics::BufferInfo& output);
        virtual void OnCaptureReleased(void) {};
 
+       virtual bool OnKeyPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_KeyInfo& keyInfo);
        virtual bool OnKeyReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_KeyInfo& keyInfo);
+       virtual void OnDrawFocus(void);
 
 private:
        _Web(const _Web& value);
@@ -197,6 +202,8 @@ private:
 
        int __edgeType;
 
+       bool __focus;
+
        Tizen::Ui::_AccessibilityElement* __pTextElement;
 
        Tizen::Graphics::FloatPoint __previousTouchedPosition;
index 525baeb..637f8ab 100755 (executable)
@@ -859,6 +859,28 @@ OnFullScreenExited(void* pUserData, Evas_Object* pView, void* pEventInfo)
 
 
 void
+OnFocusDownRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+       _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+       SysAssertf(pImpl, "Failed to request");
+
+       _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+       pWebCore->SetFocusEnd(true);
+}
+
+
+void
+OnFocusUpRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+       _WebImpl* pImpl = reinterpret_cast<_WebImpl*>(pUserData);
+       SysAssertf(pImpl, "Failed to request");
+
+       _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+       pWebCore->SetFocusEnd(true);
+}
+
+
+void
 OnVibrationRequested(uint64_t duration, void* pUserData)
 {
        result r = E_SUCCESS;
@@ -3545,6 +3567,9 @@ _WebImpl::SetEventListenerCallback(void) const
                evas_object_smart_callback_add(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered, this);
                evas_object_smart_callback_add(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited, this);
 
+               evas_object_smart_callback_add(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested, this);
+               evas_object_smart_callback_add(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested, this);
+
                Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
                SysAssertf(pContext, "Failed to get webkit instance.");
                ewk_context_did_start_download_callback_set(pContext, OnDidStartDownloadCallback, const_cast< _WebImpl* >(this));
@@ -3628,6 +3653,9 @@ _WebImpl::RemoveEventListenerCallback(void) const
                evas_object_smart_callback_del(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered);
                evas_object_smart_callback_del(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited);
 
+               evas_object_smart_callback_del(pWebNativeNode, "keyevent,down,not,handled", OnFocusDownRequested);
+               evas_object_smart_callback_del(pWebNativeNode, "keyevent,up,not,handled", OnFocusUpRequested);
+
                Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
                SysAssertf(pContext, "Failed to get webkit instance.");
                ewk_context_vibration_client_callbacks_set(pContext, null, null, null);
index 0cbdfbe..d6065e2 100755 (executable)
@@ -101,6 +101,7 @@ private:
        void* __pUserPolicyData;
        _UserConfirmMode __userConfirmMode;
        Tizen::Ui::Controls::CheckButton* __pCheckButton;
+       bool __isUserActionNeeded;
 
        bool __sync;
        Tizen::Web::Controls::_WebImpl* __pImpl;