Fix N_SE-56081/56610/56463/56136
authorTaejun <tj.twt.park@samsung.com>
Thu, 31 Oct 2013 11:00:38 +0000 (20:00 +0900)
committerTaejun <tj.twt.park@samsung.com>
Thu, 31 Oct 2013 11:00:38 +0000 (20:00 +0900)
Change-Id: Ifdb201ac08db9374c5afd8a9e3217a2246f43409

src/ui/controls/FUiCtrl_Edit.cpp
src/ui/controls/FUiCtrl_EditPresenter.cpp
src/ui/controls/FUiCtrl_SearchBarPresenter.cpp
src/ui/inc/FUiCtrl_Edit.h

index 139a9ce..130a54f 100644 (file)
@@ -227,6 +227,7 @@ _Edit::_Edit(void)
        , __isAccessibilityCreated(false)
        , __isFullScreenKeypadEdit(false)
        , __internalFocus(false)
+       , __pCurrentFrame(null)
        , __isDestroyed(false)
        , __pTextFilter(null)
        , __previousBounds()
@@ -1366,6 +1367,52 @@ _Edit::GetText(int start, int end) const
 }
 
 result
+_Edit::AddClipboardShowTriggerEventListener(void)
+{
+       _ControlManager* pControlManager = _ControlManager::GetInstance();
+       _Window* pWindow = null;
+
+       pWindow = pControlManager->GetCurrentFrame();
+
+       if (pWindow)
+       {
+               if (__pCurrentFrame == null)
+               {
+                       __pCurrentFrame = dynamic_cast<_Frame*>(pWindow);
+
+                       if (__pCurrentFrame)
+                       {
+                               SysLog(NID_UI_CTRL, "[ClipboardShow] FormActivation event is added.");
+                               return __pCurrentFrame->AddFormActivationChangeEventListener(*this);
+                       }
+               }
+
+               SysLog(NID_UI_CTRL, "[ClipboardShow] Already FormActivation event is added!!!!!!!");
+               return E_SUCCESS;
+       }
+       else
+       {
+               SysLog(NID_UI_CTRL, "[ClipboardShow] Current Frame is not exist!!!!!!");
+               return E_SYSTEM;
+       }
+}
+
+result
+_Edit::RemoveClipboardShowTriggerEventListener(void)
+{
+       result r = E_SUCCESS;
+
+       if (__pCurrentFrame)
+       {
+               r = __pCurrentFrame->RemoveFormActivationChangeEventListener(*this);
+               SysLog(NID_UI_CTRL, "[ClipboardShow] FormActivation event is deleted.");
+               __pCurrentFrame = null;
+       }
+
+       return r;
+}
+
+result
 _Edit::AddExpandableEditAreaEventListener(const _IExpandableEditAreaEventListener& listener)
 {
        if (__pExpandableEditAreaEvent == null)
@@ -1516,6 +1563,35 @@ _Edit::OnScrollPositionChanged(Tizen::Ui::_Control& source, float scrollPosition
        return;
 }
 
+void
+_Edit::OnFormActivated(const Tizen::Ui::Controls::_Form& source)
+{
+}
+
+void
+_Edit::OnFormDeactivated(const Tizen::Ui::Controls::_Form& source)
+{
+}
+
+void
+_Edit::OnFormActivating(const Tizen::Ui::Controls::_Form& source)
+{
+}
+
+void
+_Edit::OnFormDeactivating(const Tizen::Ui::Controls::_Form& source)
+{
+       SysLog(NID_UI_CTRL, "[ClipboardShow] OnFormDeactivating is called!!!!!!!");
+
+       if (_pEditPresenter)
+       {
+               if (_pEditPresenter->GetParentForm() == &source)
+               {
+                       SysLog(NID_UI_CTRL, "[ClipboardShow] OnFormDeactivating- ChangeToUnbindState is called!!!!!!!");
+                       _pEditPresenter->ChangeToUnbindState(false);
+               }
+       }
+}
 
 result
 _Edit::AddActionEventListener(const _IActionEventListener& listener)
index 1fc8146..1a28adb 100644 (file)
@@ -927,6 +927,8 @@ _EditPresenter::OnClipboardPopupOpened(Tizen::Graphics::Dimension& clipboardPopu
 
                SysLog(NID_UI_CTRL, "clipboard height = %f, [KeypadExist:%d]keypad height = %f", floatClipboardPopupSize.height, __isKeypadExist, absKeypadBounds.height);
 
+               __pEdit->AddClipboardShowTriggerEventListener();
+
                if (__isKeypadExist) //resize as difference between clipboard height vs keypad height
                {
                        if (floatClipboardPopupSize.height > absKeypadBounds.height)
@@ -1082,22 +1084,25 @@ _EditPresenter::OnClipboardPopupClosed(void)
 
                ChangeLayoutInternal(__pEdit->GetOrientation());
 
+               __pEdit->RemoveClipboardShowTriggerEventListener();
+
                if (__isKeypadExist)
                {
                        AdjustParentPanelHeight(false);
 
+                       __pEdit->SendKeypadEvent(GetKeypadAction(), CORE_KEYPAD_EVENT_STATUS_BOUNDS_CHANGED);
+
                        if (__pParentForm)
                        {
                                __pParentForm->Draw();
 
                                if (__pParentForm->GetVisibleState())
                                {
-                                       SysLog(NID_UI_CTRL, "show is called!!!!!!");
+                                       SysLog(NID_UI_CTRL, "[ClipboardShow] Show is called!!!!!!");
                                        __pParentForm->Show();
                                }
                        }
 
-                       __pEdit->SendKeypadEvent(GetKeypadAction(), CORE_KEYPAD_EVENT_STATUS_BOUNDS_CHANGED);
                }
                else
                {
@@ -1111,13 +1116,6 @@ _EditPresenter::OnClipboardPopupClosed(void)
                        {
                                SysLog(NID_UI_CTRL, "Form deflate RESET!!!");
                                __pParentForm->DeflateClientRectHeight(0.0f);
-                               __pParentForm->Draw();
-
-                               if (__pParentForm->GetVisibleState())
-                               {
-                                       SysLog(NID_UI_CTRL, "show is called!!!!!!");
-                                       __pParentForm->Show();
-                               }
                        }
 
                        if (!__isKeypadCommandButtonVisible)
@@ -1128,6 +1126,17 @@ _EditPresenter::OnClipboardPopupClosed(void)
                        {
                                __pEdit->SendKeypadEvent(GetKeypadAction(), CORE_KEYPAD_EVENT_STATUS_BOUNDS_CHANGED);
                        }
+
+                       if (__pParentForm)
+                       {
+                               __pParentForm->Draw();
+
+                               if (__pParentForm->GetVisibleState())
+                               {
+                                       SysLog(NID_UI_CTRL, "[ClipboardShow] Show is called!!!!!!");
+                                       __pParentForm->Show();
+                               }
+                       }
                }
 
                __clipboardConnected = false;
@@ -1161,6 +1170,7 @@ _EditPresenter::Dispose(void)
        {
                if (__clipboardConnected) //Edit control removed after FocusLost or without FocusLost callback.
                {
+                       __pEdit->RemoveClipboardShowTriggerEventListener();
                        __pClipboard->HidePopup();
                        __isClipboardExist = false;
                }
@@ -4841,6 +4851,7 @@ _EditPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
        {
                __pClipboard->ShowPopup(CLIPBOARD_DATA_TYPE_TEXT, *__pEdit, true);
                __clipboardConnected = true;
+               __pEdit->AddClipboardShowTriggerEventListener();
                return true;
        }
        else if (_KEY_TAB == keyCode)
@@ -10638,6 +10649,10 @@ _EditPresenter::GetParentForm(void)
                }
                return pForm;
        }
+       else
+       {
+               return __pParentForm;
+       }
 
 CATCH:
        return null;
index 5265e60..859cda1 100644 (file)
@@ -511,8 +511,6 @@ _SearchBarPresenter::ChangeMode(SearchBarMode mode, bool isCalledByApp)
        {
                __pSearchBar->SetFocusCallbackParameter(true);
                InitializeViewModeLayout();
-               SetCancelButtonVisible(false);
-               SetContainerVisible(false);
 
                if (__pEdit != null)
                {
@@ -524,6 +522,9 @@ _SearchBarPresenter::ChangeMode(SearchBarMode mode, bool isCalledByApp)
                        }
                }
 
+               SetCancelButtonVisible(false);
+               SetContainerVisible(false);
+
                r = __pSearchBar->SendSearchBarEvent(_SEARCH_BAR_EVENT_MODE_CHANGE);
                SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
                                 "[%s] A system error has occurred. Failed to fire the searchbar event.", GetErrorMessage(E_SYSTEM));
index 23dfb39..8e1a951 100644 (file)
 #include "FUi_TouchLongPressGestureDetector.h"
 #include "FUi_TouchTapGestureDetector.h"
 #include "FUiCtrl_ExpandableEditAreaEvent.h"
+#include "FUiCtrl_Frame.h"
 #include "FUiCtrl_IActionEventListener.h"
 #include "FUiCtrl_IExpandableEditAreaEventListener.h"
+#include "FUiCtrl_IFormActivationChangeEventListener.h"
 #include "FUiCtrl_IKeypadEventListener.h"
 #include "FUiCtrl_ITextBlockEventListener.h"
 #include "FUiCtrl_ITextEventListener.h"
@@ -170,6 +172,7 @@ class _OSP_EXPORT_ _Edit
        , public _ITouchLongPressGestureEventListener
        , public _ITouchTapGestureEventListener
        , public IClipboardPopupEventListener
+       , public _IFormActivationChangeEventListener
        , public _IEditTextFilter
        , public _IScrollEventListener
        , virtual public Tizen::System::ISettingEventListener
@@ -457,6 +460,9 @@ public:
        result AttachScrollPanelEvent(void);
        result DetachScrollPanelEvent(void);
 
+       result AddClipboardShowTriggerEventListener(void);
+       result RemoveClipboardShowTriggerEventListener(void);
+
        result SendExpandableEditAreaEvent(_ExpandableEditAreaEventStatus status, int newLineCount = 0);
        result SendKeypadEvent(CoreKeypadAction keypadAction, CoreKeypadEventStatus eventstatus);
        result SendLanguageEvent(Tizen::Locales::LanguageCode prevLanguageCode, Tizen::Locales::LanguageCode currentLanguageCode);
@@ -510,6 +516,11 @@ public:
        virtual void OnScrollStopped(Tizen::Ui::_Control& source);
        virtual void OnScrollPositionChanged(Tizen::Ui::_Control& source, float scrollPosition);
 
+       virtual void OnFormActivated(const Tizen::Ui::Controls::_Form& source);
+       virtual void OnFormDeactivated(const Tizen::Ui::Controls::_Form& source);
+       virtual void OnFormActivating(const Tizen::Ui::Controls::_Form& source);
+       virtual void OnFormDeactivating(const Tizen::Ui::Controls::_Form& source);
+
        _EditPresenter* GetPresenter(void) const;
        Tizen::Graphics::FloatDimension GetContentSizeInternalF(bool horizontalMode, bool verticalMode) const;
        bool IsInternalFocused(void) const;
@@ -571,6 +582,7 @@ private:
        bool __isAccessibilityCreated;
        bool __isFullScreenKeypadEdit;
        bool __internalFocus;
+       _Frame* __pCurrentFrame;
        bool __isDestroyed;
        IEditTextFilter* __pTextFilter;
        Tizen::Graphics::FloatRectangle __previousBounds;