From f82f14a9ef2d1ce98f49d0684397d2f81787ab23 Mon Sep 17 00:00:00 2001 From: "hs0219.yang" Date: Fri, 19 Apr 2013 00:29:44 +0900 Subject: [PATCH] Modified popup setOwner() Change-Id: Ie3274c1a7e7fbfaa39111599bf3a637ac1438595 Signed-off-by: hs0219.yang --- src/controls/FWebCtrl_InputPickerPopup.cpp | 7 ++++-- src/controls/FWebCtrl_InputPickerPopup.h | 4 ++-- src/controls/FWebCtrl_WebImpl.cpp | 36 +++++++++++++++++++++++++----- src/controls/FWebCtrl_WebNotification.cpp | 7 +++++- src/controls/FWebCtrl_WebNotification.h | 5 +++-- 5 files changed, 46 insertions(+), 13 deletions(-) mode change 100644 => 100755 src/controls/FWebCtrl_WebNotification.cpp mode change 100644 => 100755 src/controls/FWebCtrl_WebNotification.h diff --git a/src/controls/FWebCtrl_InputPickerPopup.cpp b/src/controls/FWebCtrl_InputPickerPopup.cpp index 502e6e4..77f2696 100755 --- a/src/controls/FWebCtrl_InputPickerPopup.cpp +++ b/src/controls/FWebCtrl_InputPickerPopup.cpp @@ -76,7 +76,7 @@ _InputPickerPopup::~_InputPickerPopup(void) result -_InputPickerPopup::Construct(const String& strDate, Ewk_Input_Type inputType) +_InputPickerPopup::Construct(const String& strDate, Ewk_Input_Type inputType, Tizen::Web::Controls::_WebImpl* pImpl) { result r = E_SUCCESS; @@ -194,6 +194,8 @@ _InputPickerPopup::Construct(const String& strDate, Ewk_Input_Type inputType) r = AddButton(ID_BUTTON_INPUT_DATE_SELECTION); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + __pPopup->SetOwner(&pImpl->GetPublic()); + std::unique_ptr pLayout(dynamic_cast< VerticalBoxLayout* >(__pPopup->GetLayoutN())); SysTryReturnResult(NID_WEB_CTRL, pLayout.get(), E_OUT_OF_MEMORY, "Memory Allocation Failed."); @@ -217,7 +219,7 @@ _InputPickerPopup::Construct(const String& strDate, Ewk_Input_Type inputType) result -_InputPickerPopup::Construct(const Color& color) +_InputPickerPopup::Construct(const Color& color, Tizen::Web::Controls::_WebImpl* pImpl) { result r = E_SUCCESS; @@ -240,6 +242,7 @@ _InputPickerPopup::Construct(const Color& color) pColorPicker->SetColor(color); + __pPopup->SetOwner(&pImpl->GetPublic()); r = __pPopup->AddControl(*pColorPicker); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); diff --git a/src/controls/FWebCtrl_InputPickerPopup.h b/src/controls/FWebCtrl_InputPickerPopup.h index 807e6b7..1603471 100755 --- a/src/controls/FWebCtrl_InputPickerPopup.h +++ b/src/controls/FWebCtrl_InputPickerPopup.h @@ -76,9 +76,9 @@ public: */ virtual ~_InputPickerPopup(void); - result Construct(const Tizen::Base::String& strDate, Ewk_Input_Type inputType); + result Construct(const Tizen::Base::String& strDate, Ewk_Input_Type inputType, Tizen::Web::Controls::_WebImpl* pImpl); - result Construct(const Tizen::Graphics::Color& color); + result Construct(const Tizen::Graphics::Color& color, Tizen::Web::Controls::_WebImpl* pImpl); void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); diff --git a/src/controls/FWebCtrl_WebImpl.cpp b/src/controls/FWebCtrl_WebImpl.cpp index a7bd357..89a71d5 100755 --- a/src/controls/FWebCtrl_WebImpl.cpp +++ b/src/controls/FWebCtrl_WebImpl.cpp @@ -338,7 +338,7 @@ OnScriptAlertRequested(Evas_Object* pView, const char* pMessage, void* pUserData SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage); result r = E_SUCCESS; - + _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData); String msg(pMessage); MessageBox messageBox; @@ -346,6 +346,9 @@ OnScriptAlertRequested(Evas_Object* pView, const char* pMessage, void* pUserData SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r)); int modalResult = 0; + + messageBox.SetOwner(&pImpl->GetPublic()); + r = messageBox.ShowAndWait(modalResult); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -361,7 +364,7 @@ OnScriptConfirmRequested(Evas_Object* pView, const char* pMessage, void* pUserDa SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage); result r = E_SUCCESS; - + _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData); String msg(pMessage); MessageBox messageBox; @@ -369,6 +372,9 @@ OnScriptConfirmRequested(Evas_Object* pView, const char* pMessage, void* pUserDa SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r)); int modalResult = 0; + + messageBox.SetOwner(&pImpl->GetPublic()); + r = messageBox.ShowAndWait(modalResult); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -391,7 +397,7 @@ OnScriptPromptRequested(Evas_Object* pView, const char* pMessage, const char* pD SysLog(NID_WEB_CTRL, "The current value of message is %s, defaulValue is %s", pMessage, pDefaultValue); result r = E_SUCCESS; - + _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData); String msg(pMessage); String defVal(pDefaultValue); @@ -401,6 +407,8 @@ OnScriptPromptRequested(Evas_Object* pView, const char* pMessage, const char* pD r = pPromptPopup->Construct(msg, defVal, pView); SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); + pPromptPopup->SetOwner(&pImpl->GetPublic()); + r = pPromptPopup->ShowPopup(); SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); @@ -574,6 +582,9 @@ OnNotificationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEv SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); int modalResult = 0; + + messageBox.SetOwner(&pImpl->GetPublic()); + r = messageBox.ShowAndWait(modalResult); SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -608,7 +619,7 @@ OnNotificationShow(void* pUserData, Evas_Object* pView, void* pEventInfo) std::unique_ptr<_WebNotification> pNotificationWindow( new (std::nothrow) _WebNotification()); SysTryReturnVoidResult(NID_WEB_CTRL, pNotificationWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - r = pNotificationWindow->Construct(pContext, notificationId); + r = pNotificationWindow->Construct(pContext, notificationId, pImpl); SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Error propogated.", GetErrorMessage(r)); pNotificationWindow->SetText(String(text)); @@ -2323,6 +2334,8 @@ _WebImpl::ShowSelectBoxPopup(bool isMultiSelect, const String& title, Eina_List* __pSelectBox = std::move(pSelectBox); + __pSelectBox->SetOwner(&GetPublic()); + return __pSelectBox->ShowPopup(); } @@ -4289,6 +4302,9 @@ _WebImpl::ShowAuthenticationPopup(const String& host, const String& realm, Authe __pAuthPopup = std::move(pAuthPopup); int modalResult = 0; + + __pAuthPopup->SetOwner(&GetPublic()); + r = __pAuthPopup->ShowAndWait(modalResult); SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); @@ -4313,6 +4329,9 @@ _WebImpl::ShowCertificateConfirmPopup(_CertificatePopupMode userConfirmMode, Ewk __pCertConfirmPopup = std::move(pCertConfirmPopup); int modalResult = 0; + + __pCertConfirmPopup->SetOwner(&GetPublic()); + r = __pCertConfirmPopup->ShowAndWait(modalResult); SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); @@ -4341,6 +4360,9 @@ _WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy) __pUserConfirmPopup = std::move(pUserConfirmPopup); int modalResult = 0; + + __pUserConfirmPopup->SetOwner(&GetPublic()); + r = __pUserConfirmPopup->ShowAndWait(modalResult); SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); @@ -4363,6 +4385,8 @@ _WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPol __pUserConfirmPopup = std::move(pUserConfirmPopup); + __pUserConfirmPopup->SetOwner(&GetPublic()); + r = __pUserConfirmPopup->ShowPopup(); SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); @@ -4504,7 +4528,7 @@ _WebImpl::ShowColorPicker(int red, int green, int blue, int alpha, Color& color) Tizen::Graphics::Color colorVal(static_cast< byte >(red), static_cast< byte >(green), static_cast< byte >(blue), static_cast< byte >(alpha)); - r = pColorHadler->Construct(colorVal); + r = pColorHadler->Construct(colorVal, this); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); __pColorPicker = std::move(pColorHadler); @@ -4531,7 +4555,7 @@ _WebImpl::ShowDatePicker(Ewk_Input_Type inputType, const char* inputValue, Strin std::unique_ptr<_InputPickerPopup> pInputPicker(new (std::nothrow) _InputPickerPopup()); SysTryReturnResult(NID_WEB_CTRL, pInputPicker.get(), E_OUT_OF_MEMORY, "Memory allocation failed."); - r = pInputPicker->Construct(String(inputValue), inputType); + r = pInputPicker->Construct(String(inputValue), inputType, this); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); __pDatePicker = std::move(pInputPicker); diff --git a/src/controls/FWebCtrl_WebNotification.cpp b/src/controls/FWebCtrl_WebNotification.cpp old mode 100644 new mode 100755 index 6ca49c9..d17e128 --- a/src/controls/FWebCtrl_WebNotification.cpp +++ b/src/controls/FWebCtrl_WebNotification.cpp @@ -22,11 +22,15 @@ #include #include +#include +#include #include #include #include #include #include + +#include "FWebCtrl_WebImpl.h" #include "FWebCtrl_WebNotificationHandler.h" #include "FWebCtrl_WebNotification.h" @@ -55,7 +59,7 @@ _WebNotification::~_WebNotification(void) } result -_WebNotification::Construct(Ewk_Context *pContext, uint64_t notificationId) +_WebNotification::Construct(Ewk_Context *pContext, uint64_t notificationId, Tizen::Web::Controls::_WebImpl* pImpl) { // _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation(); @@ -71,6 +75,7 @@ _WebNotification::Construct(Ewk_Context *pContext, uint64_t notificationId) SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r)); SetBounds(rect); + Window::SetOwner(&pImpl->GetPublic()); __pNotificationHandler = std::unique_ptr<_WebNotificationHandler>(new (std::nothrow) _WebNotificationHandler()); SysTryReturnResult(NID_WEB_CTRL, __pNotificationHandler.get(), E_OUT_OF_MEMORY, "Memory allocation failed."); diff --git a/src/controls/FWebCtrl_WebNotification.h b/src/controls/FWebCtrl_WebNotification.h old mode 100644 new mode 100755 index ee79bbe..30e8201 --- a/src/controls/FWebCtrl_WebNotification.h +++ b/src/controls/FWebCtrl_WebNotification.h @@ -34,6 +34,7 @@ #include + namespace Tizen { namespace Base { namespace Runtime { class Timer; @@ -46,7 +47,7 @@ namespace Tizen { namespace Web { namespace Controls // forward declaration class _WebNotification; class _WebNotificationHandler; - +class _WebImpl; class _WebNotification : public Tizen::Ui::Window @@ -58,7 +59,7 @@ public: _WebNotification(void); virtual ~_WebNotification(void); - result Construct(Ewk_Context *pContext, uint64_t notificationId); + result Construct(Ewk_Context *pContext, uint64_t notificationId, _WebImpl* pImpl); void SetText(const Tizen::Base::String& text); Tizen::Base::String GetText(void) const; virtual result OnDraw(void); -- 2.7.4